From 7321aab67e7a9c6ed6b9c596db2821cbf38bc254 Mon Sep 17 00:00:00 2001 From: "Bi-Ruei, Chiu" Date: Tue, 27 Mar 2018 22:20:09 +0800 Subject: [PATCH 01/13] Add S1AP R14 based on new asn1c This feature requires an un-official version of asn1c : https://github.com/velichkov/asn1c/tree/s1ap --- cmake_targets/CMakeLists.txt | 111 +- cmake_targets/tools/build_helper | 4 +- cmake_targets/tools/fix_asn1 | 6 +- cmake_targets/tools/generate_asn1 | 4 +- openair2/RRC/LITE/L2_interface.c | 600 +- openair2/RRC/LITE/MESSAGES/asn1_msg.c | 920 +-- openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c | 885 +-- openair2/RRC/LITE/rrc_UE.c | 3815 +++++----- openair2/RRC/LITE/rrc_eNB.c | 5214 ++++++------- openair2/RRC/LITE/rrc_eNB_S1AP.c | 1185 ++- .../X2AP/MESSAGES/ASN1/R14.5/x2ap-14.5.0.asn1 | 5065 +++++++++++++ openair2/X2AP/x2ap_common.c | 88 +- openair2/X2AP/x2ap_common.h | 279 +- .../S1AP/MESSAGES/ASN1/R14.4/s1ap-14.4.0.asn1 | 6634 +++++++++++++++++ openair3/S1AP/s1ap_common.c | 144 +- openair3/S1AP/s1ap_common.h | 438 +- openair3/S1AP/s1ap_eNB.c | 374 +- .../s1ap_eNB_context_management_procedures.c | 217 +- openair3/S1AP/s1ap_eNB_decoder.c | 344 +- openair3/S1AP/s1ap_eNB_decoder.h | 4 +- openair3/S1AP/s1ap_eNB_encoder.c | 724 +- openair3/S1AP/s1ap_eNB_encoder.h | 2 +- openair3/S1AP/s1ap_eNB_handlers.c | 1250 ++-- openair3/S1AP/s1ap_eNB_nas_procedures.c | 1342 ++-- openair3/S1AP/s1ap_eNB_nas_procedures.h | 14 +- openair3/S1AP/s1ap_eNB_overload.c | 40 +- openair3/S1AP/s1ap_eNB_overload.h | 12 +- openair3/S1AP/s1ap_eNB_trace.c | 102 +- openair3/S1AP/s1ap_eNB_trace.h | 12 +- openair3/TEST/EPC_TEST/play_scenario.h | 131 +- openair3/TEST/EPC_TEST/play_scenario_decode.c | 154 +- .../TEST/EPC_TEST/play_scenario_display.c | 212 +- openair3/TEST/EPC_TEST/play_scenario_fsm.c | 124 +- openair3/TEST/EPC_TEST/play_scenario_s1ap.c | 481 +- .../EPC_TEST/play_scenario_s1ap_compare_ie.c | 435 +- openair3/TEST/EPC_TEST/play_scenario_sctp.c | 34 +- openair3/TEST/oaisim_mme_client_test.c | 18 - openair3/TEST/oaisim_mme_list_benchmark.c | 40 +- openair3/TEST/oaisim_mme_s1ap_test.c | 10 +- openair3/TEST/oaisim_mme_sctp_test.c | 6 - openair3/TEST/oaisim_mme_test_s1c_s1ap.c | 99 +- openair3/TEST/test_s1ap.c | 14 +- 42 files changed, 20282 insertions(+), 11305 deletions(-) create mode 100755 openair2/X2AP/MESSAGES/ASN1/R14.5/x2ap-14.5.0.asn1 create mode 100755 openair3/S1AP/MESSAGES/ASN1/R14.4/s1ap-14.4.0.asn1 diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 34b868642d..393ac9f3fe 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -280,6 +280,7 @@ set(protobuf_generated_dir ${OPENAIR_BIN_DIR}) # RRC ###### + add_list2_option(RRC_ASN1_VERSION "Rel14" "ASN.1 version of RRC interface" "Rel8" "Rel10" "Rel14" "CBA") if (${RRC_ASN1_VERSION} STREQUAL "Rel8") @@ -292,7 +293,7 @@ else() 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}) +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}) @@ -331,10 +332,14 @@ 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_VERSION R14 "S1AP Asn.1 grammar version" R8 R9 R10 R14) set(S1AP_DIR ${OPENAIR3_DIR}/S1AP) -if (${S1AP_VERSION} STREQUAL "R10") +if (${S1AP_VERSION} STREQUAL "R14") + set (ASN1RELDIR R14.4) + add_definitions("-DUPDATE_RELEASE_9 -DUPDATE_RELEASE_10 -DUPDATE_RELEASE_14") + set(S1AP_ASN_FILES s1ap-14.4.0.asn1) +elseif (${S1AP_VERSION} STREQUAL "R10") set (ASN1RELDIR R10.5) add_definitions("-DUPDATE_RELEASE_9 -DUPDATE_RELEASE_10") elseif (${S1AP_VERSION} STREQUAL "R9") @@ -342,52 +347,28 @@ elseif (${S1AP_VERSION} STREQUAL "R9") add_definitions("-DUPDATE_RELEASE_9") else(${S1AP_VERSION} STREQUAL "R8") set (ASN1RELDIR R8.10) -endif(${S1AP_VERSION} STREQUAL "R10") +endif(${S1AP_VERSION} STREQUAL "R14") set(S1AP_ASN_DIR ${S1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR}) -set(S1AP_ASN_FILES - ${S1AP_ASN_DIR}/S1AP-CommonDataTypes.asn - ${S1AP_ASN_DIR}/S1AP-Constants.asn - ${S1AP_ASN_DIR}/S1AP-IEs.asn - ${S1AP_ASN_DIR}/S1AP-PDU.asn - ) -set(S1AP_C_DIR ${asn1_generated_dir}/${ASN1RELDIR}) -#message("calling ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES}") -execute_process(COMMAND ${asn1c_call} ${S1AP_C_DIR} ${S1AP_ASN_FILES} +set(S1AP_C_DIR ${asn1_generated_dir}/S1AP_${ASN1RELDIR}) +message("calling ASN1C_PREFIX=S1AP_ asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${S1AP_C_DIR} ${S1AP_ASN_DIR}/${S1AP_ASN_FILES}") +execute_process(COMMAND mkdir -p ${S1AP_C_DIR} + COMMAND env "ASN1C_PREFIX=S1AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${S1AP_C_DIR} ${S1AP_ASN_DIR}/${S1AP_ASN_FILES} RESULT_VARIABLE ret) if (NOT ${ret} STREQUAL 0) - message(FATAL_ERROR "${asn1c_call}: error") -endif (NOT ${ret} STREQUAL 0) -execute_process(COMMAND python ${S1AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f${S1AP_ASN_DIR}/S1AP-PDU-Contents.asn -o${S1AP_C_DIR} - RESULT_VARIABLE ret) -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} - RESULT_VARIABLE ret) -if (NOT ${ret} STREQUAL 0) - message(FATAL_ERROR "${fix_asn1c_call}: error") + message(FATAL_ERROR "${ret}: error") endif (NOT ${ret} STREQUAL 0) file(GLOB S1AP_source ${S1AP_C_DIR}/*.c) -set(S1AP_OAI_generated - ${S1AP_C_DIR}/s1ap_decoder.c - ${S1AP_C_DIR}/s1ap_encoder.c - ${S1AP_C_DIR}/s1ap_xer_print.c - ${S1AP_C_DIR}/s1ap_compare.c - ${S1AP_C_DIR}/s1ap_ies_defs.h - ) file(GLOB s1ap_h ${S1AP_C_DIR}/*.h) set(s1ap_h ${s1ap_h} ) 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} - DEPENDS ${S1AP_ASN_FILES} - ) + OUTPUT ${S1AP_C_DIR}/S1AP_asn_constant.h + COMMAND mkdir -p ${S1AP_C_DIR} + COMMAND env "ASN1C_PREFIX=S1AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${S1AP_C_DIR} ${S1AP_ASN_DIR}/${S1AP_ASN_FILES} + DEPENDS ${S1AP_ASN_DIR}/${S1AP_ASN_FILES} +) add_library(S1AP_LIB - ${S1AP_OAI_generated} ${S1AP_source} ${S1AP_DIR}/s1ap_common.c ) @@ -396,10 +377,9 @@ include_directories ("${S1AP_C_DIR}") include_directories ("${S1AP_DIR}") add_library(S1AP_ENB - ${S1AP_C_DIR}/s1ap_ies_defs.h + # ${S1AP_C_DIR}/s1ap_ies_defs.h ${S1AP_DIR}/s1ap_eNB.c ${S1AP_DIR}/s1ap_eNB_context_management_procedures.c - ${S1AP_DIR}/s1ap_eNB_decoder.c ${S1AP_DIR}/s1ap_eNB_encoder.c ${S1AP_DIR}/s1ap_eNB_handlers.c ${S1AP_DIR}/s1ap_eNB_itti_messaging.c @@ -409,6 +389,7 @@ add_library(S1AP_ENB ${S1AP_DIR}/s1ap_eNB_overload.c ${S1AP_DIR}/s1ap_eNB_trace.c ${S1AP_DIR}/s1ap_eNB_ue_context.c + ${S1AP_DIR}/s1ap_eNB_decoder.c ) @@ -417,61 +398,39 @@ 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_VERSION R14 "X2AP Asn.1 grammar version" R10 R11 R14) set(X2AP_DIR ${OPENAIR2_DIR}/X2AP) -if (${X2AP_VERSION} STREQUAL "R11") +if (${X2AP_VERSION} STREQUAL "R14") + set (ASN1RELDIR R14.5) + set (X2AP_ASN_FILES x2ap-14.5.0.asn1) +elseif (${X2AP_VERSION} STREQUAL "R11") set (ASN1RELDIR R11.2) elseif (${X2AP_VERSION} STREQUAL "R10") set (ASN1RELDIR R.UNKNOWN) -endif(${X2AP_VERSION} STREQUAL "R11") +endif(${X2AP_VERSION} STREQUAL "R14") set(X2AP_ASN_DIR ${X2AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR}) -set(X2AP_ASN_FILES - ${X2AP_ASN_DIR}/X2AP-CommonDataTypes.asn - ${X2AP_ASN_DIR}/X2AP-Constants.asn - ${X2AP_ASN_DIR}/X2AP-IEs.asn - ${X2AP_ASN_DIR}/X2AP-PDU.asn - ${X2AP_ASN_DIR}/X2AP-Containers.asn - ) -set(X2AP_C_DIR ${asn1_generated_dir}/${ASN1RELDIR}) -#message("calling ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES}") -execute_process(COMMAND ${asn1c_call} ${X2AP_C_DIR} ${X2AP_ASN_FILES} +set(X2AP_C_DIR ${asn1_generated_dir}/X2AP_${ASN1RELDIR}) +message("calling asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${X2AP_C_DIR} ${X2AP_ASN_DIR}/${X2AP_ASN_FILES}") +execute_process(COMMAND mkdir -p ${X2AP_C_DIR} + COMMAND env "ASN1C_PREFIX=X2AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${X2AP_C_DIR} ${X2AP_ASN_DIR}/${X2AP_ASN_FILES} RESULT_VARIABLE ret) if (NOT ${ret} STREQUAL 0) message(FATAL_ERROR "${asn1c_call}: error") endif (NOT ${ret} STREQUAL 0) -execute_process(COMMAND python ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2AP_ASN_DIR}/X2AP-PDU-Contents.asn -o ${X2AP_C_DIR} - RESULT_VARIABLE ret) -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} - RESULT_VARIABLE ret) -if (NOT ${ret} STREQUAL 0) - message(FATAL_ERROR "${fix_asn1c_call}: error") -endif (NOT ${ret} STREQUAL 0) file(GLOB X2AP_source ${X2AP_C_DIR}/*.c) -set(X2AP_OAI_generated - ${X2AP_C_DIR}/x2ap_decoder.c - ${X2AP_C_DIR}/x2ap_encoder.c - ${X2AP_C_DIR}/x2ap_xer_print.c - ${X2AP_C_DIR}/x2ap_ies_defs.h - ) file(GLOB x2ap_h ${X2AP_C_DIR}/*.h) set(x2ap_h ${x2ap_h} ) -#message("calling ${X2AP_DIR}/MESSAGES/ASN1/asn1tostruct.py -f ${X2AP_ASN_DIR}/X2AP-PDU-Contents.asn -o ${X2AP_C_DIR}") 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} - DEPENDS ${X2AP_ASN_FILES} + OUTPUT ${X2AP_C_DIR}/X2AP_asn_constant.h + COMMAND mkdir -p ${X2AP_C_DIR} + COMMAND env "ASN1C_PREFIX=X2AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${X2AP_C_DIR} ${X2AP_ASN_DIR}/${X2AP_ASN_FILES} + DEPENDS ${X2AP_ASN_DIR}/${X2AP_ASN_FILES} ) add_library(X2AP_LIB - ${X2AP_OAI_generated} ${X2AP_source} ${X2AP_DIR}/x2ap_common.c ) diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 3bb051f291..243841dcc0 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -659,8 +659,10 @@ install_asn1c_from_source(){ echo_info "\nInstalling ASN1. The log file for ASN1 installation is here: $asn1_install_log " ( $SUDO rm -rf /tmp/asn1c - GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/asn1c.git /tmp/asn1c + # GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/asn1c.git /tmp/asn1c + git clone git checkout https://github.com/velichkov/asn1c /tmp/asn1c cd /tmp/asn1c + git checkout s1ap ./configure make -j`nproc` $SUDO make install diff --git a/cmake_targets/tools/fix_asn1 b/cmake_targets/tools/fix_asn1 index fe819c2716..297aa83ffe 100755 --- a/cmake_targets/tools/fix_asn1 +++ b/cmake_targets/tools/fix_asn1 @@ -94,7 +94,7 @@ function patch_rrc() case "$version" in Rel14 ) echo "patching RRC files release 14" - apply_patches "$directory" RRC_Rel14 ${#RRC_Rel14[*]} + # apply_patches "$directory" RRC_Rel14 ${#RRC_Rel14[*]} ;; Rel10 ) echo "patching RRC files release 10" @@ -115,6 +115,8 @@ function patch_x2ap() local version="$2" case "$version" in + R14 ) + ;; R11 ) echo "patching X2AP files release 11.2" apply_patches "$directory" X2AP_Rel11_2 ${#X2AP_Rel11_2[*]} @@ -131,6 +133,8 @@ function patch_s1ap() local version="$2" case "$version" in + R14 ) + ;; R10 ) #nothing to do anymore (fixes went to asn1c) ;; diff --git a/cmake_targets/tools/generate_asn1 b/cmake_targets/tools/generate_asn1 index 79becbf288..bad91041c1 100755 --- a/cmake_targets/tools/generate_asn1 +++ b/cmake_targets/tools/generate_asn1 @@ -99,7 +99,7 @@ echo done with asnfix echo running asn1c -asn1c -gen-PER -fcompound-names fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample +asn1c -gen-PER -fcompound-names -no-gen-example fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample rm -f fixed_grammar.asn @@ -107,7 +107,7 @@ echo asn1c done else -asn1c -gen-PER -fcompound-names $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample +asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample fi diff --git a/openair2/RRC/LITE/L2_interface.c b/openair2/RRC/LITE/L2_interface.c index 91834d9c9d..c0ab3cecd5 100644 --- a/openair2/RRC/LITE/L2_interface.c +++ b/openair2/RRC/LITE/L2_interface.c @@ -69,7 +69,7 @@ mac_rrc_data_req( const frame_t frameP, const rb_id_t Srb_id, const uint8_t Nb_tb, - uint8_t* const buffer_pP, + uint8_t *const buffer_pP, const uint8_t mbsfn_sync_area ) //-------------------------------------------------------------------------- @@ -78,286 +78,262 @@ mac_rrc_data_req( SRB_INFO *Srb_info; uint8_t Sdu_size = 0; uint8_t sfn = (uint8_t)((frameP>>2)&0xff); - - #ifdef DEBUG_RRC int i; LOG_I(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_idP,Srb_id); #endif - eNB_RRC_INST *rrc; rrc_eNB_carrier_data_t *carrier; BCCH_BCH_Message_t *mib; + rrc = RC.rrc[Mod_idP]; + carrier = &rrc->carrier[0]; + mib = &carrier->mib; + if((Srb_id & RAB_OFFSET) == BCCH) { + if(RC.rrc[Mod_idP]->carrier[CC_id].SI.Active==0) { + return 0; + } - rrc = RC.rrc[Mod_idP]; - carrier = &rrc->carrier[0]; - mib = &carrier->mib; - - if((Srb_id & RAB_OFFSET) == BCCH) { - if(RC.rrc[Mod_idP]->carrier[CC_id].SI.Active==0) { - return 0; - } - - // All even frames transmit SIB in SF 5 - AssertFatal(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1 != 255, - "[eNB %d] MAC Request for SIB1 and SIB1 not initialized\n",Mod_idP); - - if ((frameP%2) == 0) { - memcpy(&buffer_pP[0], - RC.rrc[Mod_idP]->carrier[CC_id].SIB1, - RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1); + // All even frames transmit SIB in SF 5 + AssertFatal(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1 != 255, + "[eNB %d] MAC Request for SIB1 and SIB1 not initialized\n",Mod_idP); + if ((frameP%2) == 0) { + memcpy(&buffer_pP[0], + RC.rrc[Mod_idP]->carrier[CC_id].SIB1, + RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1); #if 0 //defined(ENABLE_ITTI) - { - MessageDef *message_p; - int sib1_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1; - int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu); - - if (sib1_size > sdu_size) { - LOG_E(RRC, "SIB1 SDU larger than BCCH SDU buffer size (%d, %d)", sib1_size, sdu_size); - sib1_size = sdu_size; - } - - message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ); - RRC_MAC_BCCH_DATA_REQ (message_p).frame = frameP; - RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib1_size; - memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, BCCH_SDU_SIZE); - memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, - RC.rrc[Mod_idP]->carrier[CC_id].SIB1, - sib1_size); - RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index; - - itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p); - } -#endif - -#ifdef DEBUG_RRC - LOG_T(RRC,"[eNB %d] Frame %d : BCCH request => SIB 1\n",Mod_idP,frameP); - - for (i=0; icarrier[CC_id].sizeof_SIB1; i++) { - LOG_T(RRC,"%x.",buffer_pP[i]); - } - - LOG_T(RRC,"\n"); -#endif - - return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1); - } // All RFN mod 8 transmit SIB2-3 in SF 5 - else if ((frameP%8) == 1) { - memcpy(&buffer_pP[0], - RC.rrc[Mod_idP]->carrier[CC_id].SIB23, - RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23); - -#if 0 //defined(ENABLE_ITTI) - { - MessageDef *message_p; - int sib23_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23; - int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu); - - if (sib23_size > sdu_size) { - LOG_E(RRC, "SIB23 SDU larger than BCCH SDU buffer size (%d, %d)", sib23_size, sdu_size); - sib23_size = sdu_size; - } - - message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ); - RRC_MAC_BCCH_DATA_REQ (message_p).frame = frameP; - RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib23_size; - memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, BCCH_SDU_SIZE); - memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, - RC.rrc[Mod_idP]->carrier[CC_id].SIB23, - sib23_size); - RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index; - - itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p); - } -#endif - -#ifdef DEBUG_RRC - LOG_T(RRC,"[eNB %d] Frame %d BCCH request => SIB 2-3\n",Mod_idP,frameP); - - for (i=0; icarrier[CC_id].sizeof_SIB23; i++) { - LOG_T(RRC,"%x.",buffer_pP[i]); - } - - LOG_T(RRC,"\n"); -#endif - return(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23); - } else { - return(0); - } - } - if( (Srb_id & RAB_OFFSET ) == MIBCH) { - - mib->message.systemFrameNumber.buf = &sfn; - enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message, - (void*)mib, - carrier->MIB, - 24); - LOG_D(RRC,"Encoded MIB for frame %d (%p), bits %lu\n",sfn,carrier->MIB,enc_rval.encoded); - buffer_pP[0]=carrier->MIB[0]; - buffer_pP[1]=carrier->MIB[1]; - buffer_pP[2]=carrier->MIB[2]; - AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - return(3); - } - - if( (Srb_id & RAB_OFFSET ) == CCCH) { - LOG_T(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id); - - if(RC.rrc[Mod_idP]->carrier[CC_id].Srb0.Active==0) { - LOG_E(RRC,"[eNB %d] CCCH Not active\n",Mod_idP); - return -1; - } - - Srb_info=&RC.rrc[Mod_idP]->carrier[CC_id].Srb0; - - // check if data is there for MAC - if(Srb_info->Tx_buffer.payload_size>0) { //Fill buffer - LOG_D(RRC,"[eNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n",Mod_idP,Srb_info,Srb_info->Tx_buffer.payload_size,buffer_pP,Srb_info->Tx_buffer.Payload); - -#if 0 // defined(ENABLE_ITTI) - { - MessageDef *message_p; - int ccch_size = Srb_info->Tx_buffer.payload_size; - int sdu_size = sizeof(RRC_MAC_CCCH_DATA_REQ (message_p).sdu); - - if (ccch_size > sdu_size) { - LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", ccch_size, sdu_size); - ccch_size = sdu_size; - } - - message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_CCCH_DATA_REQ); - RRC_MAC_CCCH_DATA_REQ (message_p).frame = frameP; - RRC_MAC_CCCH_DATA_REQ (message_p).sdu_size = ccch_size; - memset (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, 0, CCCH_SDU_SIZE); - memcpy (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, Srb_info->Tx_buffer.Payload, ccch_size); - RRC_MAC_CCCH_DATA_REQ (message_p).enb_index = eNB_index; - - itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p); - } -#endif - - memcpy(buffer_pP,Srb_info->Tx_buffer.Payload,Srb_info->Tx_buffer.payload_size); - Sdu_size = Srb_info->Tx_buffer.payload_size; - Srb_info->Tx_buffer.payload_size=0; - } - - return (Sdu_size); - } - - if( (Srb_id & RAB_OFFSET ) == PCCH) { - LOG_T(RRC,"[eNB %d] Frame %d PCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id); - - // check if data is there for MAC - if(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] > 0) { //Fill buffer - LOG_D(RRC,"[eNB %d] PCCH (%p) has %d bytes\n",Mod_idP,&RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], - RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]); - -#if 0 //defined(ENABLE_ITTI) - { - MessageDef *message_p; - int pcch_size = RC.rrc[Mod_idP]->arrier[CC_id].sizeof_paging[mbsfn_sync_area]; - int sdu_size = sizeof(RRC_MAC_PCCH_DATA_REQ (message_p).sdu); - - if (pcch_size > sdu_size) { - LOG_E(RRC, "SDU larger than PCCH SDU buffer size (%d, %d)", pcch_size, sdu_size); - pcch_size = sdu_size; - } - - message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_PCCH_DATA_REQ); - RRC_MAC_PCCH_DATA_REQ (message_p).frame = frameP; - RRC_MAC_PCCH_DATA_REQ (message_p).sdu_size = pcch_size; - memset (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, 0, PCCH_SDU_SIZE); - memcpy (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], pcch_size); - RRC_MAC_PCCH_DATA_REQ (message_p).enb_index = eNB_index; - - itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p); - } -#endif - - memcpy(buffer_pP, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]); - Sdu_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]; - RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] = 0; - } - - return (Sdu_size); - } - -#if defined(Rel10) || defined(Rel14) - - if((Srb_id & RAB_OFFSET) == MCCH) { - if(RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESS[mbsfn_sync_area].Active==0) { - return 0; // this parameter is set in function init_mcch in rrc_eNB.c - } - - -#if 0 // defined(ENABLE_ITTI) { MessageDef *message_p; - int mcch_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]; - int sdu_size = sizeof(RRC_MAC_MCCH_DATA_REQ (message_p).sdu); + int sib1_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1; + int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu); - if (mcch_size > sdu_size) { - LOG_E(RRC, "SDU larger than MCCH SDU buffer size (%d, %d)", mcch_size, sdu_size); - mcch_size = sdu_size; + if (sib1_size > sdu_size) { + LOG_E(RRC, "SIB1 SDU larger than BCCH SDU buffer size (%d, %d)", sib1_size, sdu_size); + sib1_size = sdu_size; } - message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_MCCH_DATA_REQ); - RRC_MAC_MCCH_DATA_REQ (message_p).frame = frameP; - RRC_MAC_MCCH_DATA_REQ (message_p).sdu_size = mcch_size; - memset (RRC_MAC_MCCH_DATA_REQ (message_p).sdu, 0, MCCH_SDU_SIZE); - memcpy (RRC_MAC_MCCH_DATA_REQ (message_p).sdu, - RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area], - mcch_size); - RRC_MAC_MCCH_DATA_REQ (message_p).enb_index = eNB_index; - RRC_MAC_MCCH_DATA_REQ (message_p).mbsfn_sync_area = mbsfn_sync_area; - + message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ); + RRC_MAC_BCCH_DATA_REQ (message_p).frame = frameP; + RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib1_size; + memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, BCCH_SDU_SIZE); + memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, + RC.rrc[Mod_idP]->carrier[CC_id].SIB1, + sib1_size); + RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index; itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p); } #endif - - memcpy(&buffer_pP[0], - RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area], - RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]); - #ifdef DEBUG_RRC - LOG_D(RRC,"[eNB %d] Frame %d : MCCH request => MCCH_MESSAGE \n",Mod_idP,frameP); + LOG_T(RRC,"[eNB %d] Frame %d : BCCH request => SIB 1\n",Mod_idP,frameP); - for (i=0; icarrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]; i++) { + for (i=0; icarrier[CC_id].sizeof_SIB1; i++) { LOG_T(RRC,"%x.",buffer_pP[i]); } LOG_T(RRC,"\n"); #endif + return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1); + } // All RFN mod 8 transmit SIB2-3 in SF 5 + else if ((frameP%8) == 1) { + memcpy(&buffer_pP[0], + RC.rrc[Mod_idP]->carrier[CC_id].SIB23, + RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23); +#if 0 //defined(ENABLE_ITTI) + { + MessageDef *message_p; + int sib23_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23; + int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu); - return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]); - // } - //else - //return(0); + if (sib23_size > sdu_size) { + LOG_E(RRC, "SIB23 SDU larger than BCCH SDU buffer size (%d, %d)", sib23_size, sdu_size); + sib23_size = sdu_size; + } + + message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ); + RRC_MAC_BCCH_DATA_REQ (message_p).frame = frameP; + RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib23_size; + memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, BCCH_SDU_SIZE); + memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, + RC.rrc[Mod_idP]->carrier[CC_id].SIB23, + sib23_size); + RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index; + itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p); + } +#endif +#ifdef DEBUG_RRC + LOG_T(RRC,"[eNB %d] Frame %d BCCH request => SIB 2-3\n",Mod_idP,frameP); + + for (i=0; icarrier[CC_id].sizeof_SIB23; i++) { + LOG_T(RRC,"%x.",buffer_pP[i]); + } + + LOG_T(RRC,"\n"); +#endif + return(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23); + } else { + return(0); } + } + + if( (Srb_id & RAB_OFFSET ) == MIBCH) { + mib->message.systemFrameNumber.buf = &sfn; + enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message, + NULL, + (void *)mib, + carrier->MIB, + 24); + LOG_D(RRC,"Encoded MIB for frame %d (%p), bits %lu\n",sfn,carrier->MIB,enc_rval.encoded); + buffer_pP[0]=carrier->MIB[0]; + buffer_pP[1]=carrier->MIB[1]; + buffer_pP[2]=carrier->MIB[2]; + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + return(3); + } + + if( (Srb_id & RAB_OFFSET ) == CCCH) { + LOG_T(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id); + + if(RC.rrc[Mod_idP]->carrier[CC_id].Srb0.Active==0) { + LOG_E(RRC,"[eNB %d] CCCH Not active\n",Mod_idP); + return -1; + } + + Srb_info=&RC.rrc[Mod_idP]->carrier[CC_id].Srb0; + + // check if data is there for MAC + if(Srb_info->Tx_buffer.payload_size>0) { //Fill buffer + LOG_D(RRC,"[eNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n",Mod_idP,Srb_info,Srb_info->Tx_buffer.payload_size,buffer_pP,Srb_info->Tx_buffer.Payload); +#if 0 // defined(ENABLE_ITTI) + { + MessageDef *message_p; + int ccch_size = Srb_info->Tx_buffer.payload_size; + int sdu_size = sizeof(RRC_MAC_CCCH_DATA_REQ (message_p).sdu); + + if (ccch_size > sdu_size) { + LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", ccch_size, sdu_size); + ccch_size = sdu_size; + } + + message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_CCCH_DATA_REQ); + RRC_MAC_CCCH_DATA_REQ (message_p).frame = frameP; + RRC_MAC_CCCH_DATA_REQ (message_p).sdu_size = ccch_size; + memset (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, 0, CCCH_SDU_SIZE); + memcpy (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, Srb_info->Tx_buffer.Payload, ccch_size); + RRC_MAC_CCCH_DATA_REQ (message_p).enb_index = eNB_index; + itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p); + } +#endif + memcpy(buffer_pP,Srb_info->Tx_buffer.Payload,Srb_info->Tx_buffer.payload_size); + Sdu_size = Srb_info->Tx_buffer.payload_size; + Srb_info->Tx_buffer.payload_size=0; + } + + return (Sdu_size); + } + + if( (Srb_id & RAB_OFFSET ) == PCCH) { + LOG_T(RRC,"[eNB %d] Frame %d PCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id); + + // check if data is there for MAC + if(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] > 0) { //Fill buffer + LOG_D(RRC,"[eNB %d] PCCH (%p) has %d bytes\n",Mod_idP,&RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], + RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]); +#if 0 //defined(ENABLE_ITTI) + { + MessageDef *message_p; + int pcch_size = RC.rrc[Mod_idP]->arrier[CC_id].sizeof_paging[mbsfn_sync_area]; + int sdu_size = sizeof(RRC_MAC_PCCH_DATA_REQ (message_p).sdu); + + if (pcch_size > sdu_size) { + LOG_E(RRC, "SDU larger than PCCH SDU buffer size (%d, %d)", pcch_size, sdu_size); + pcch_size = sdu_size; + } + + message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_PCCH_DATA_REQ); + RRC_MAC_PCCH_DATA_REQ (message_p).frame = frameP; + RRC_MAC_PCCH_DATA_REQ (message_p).sdu_size = pcch_size; + memset (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, 0, PCCH_SDU_SIZE); + memcpy (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], pcch_size); + RRC_MAC_PCCH_DATA_REQ (message_p).enb_index = eNB_index; + itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p); + } +#endif + memcpy(buffer_pP, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]); + Sdu_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]; + RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] = 0; + } + + return (Sdu_size); + } + +#if defined(Rel10) || defined(Rel14) + + if((Srb_id & RAB_OFFSET) == MCCH) { + if(RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESS[mbsfn_sync_area].Active==0) { + return 0; // this parameter is set in function init_mcch in rrc_eNB.c + } + +#if 0 // defined(ENABLE_ITTI) + { + MessageDef *message_p; + int mcch_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]; + int sdu_size = sizeof(RRC_MAC_MCCH_DATA_REQ (message_p).sdu); + + if (mcch_size > sdu_size) { + LOG_E(RRC, "SDU larger than MCCH SDU buffer size (%d, %d)", mcch_size, sdu_size); + mcch_size = sdu_size; + } + + message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_MCCH_DATA_REQ); + RRC_MAC_MCCH_DATA_REQ (message_p).frame = frameP; + RRC_MAC_MCCH_DATA_REQ (message_p).sdu_size = mcch_size; + memset (RRC_MAC_MCCH_DATA_REQ (message_p).sdu, 0, MCCH_SDU_SIZE); + memcpy (RRC_MAC_MCCH_DATA_REQ (message_p).sdu, + RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area], + mcch_size); + RRC_MAC_MCCH_DATA_REQ (message_p).enb_index = eNB_index; + RRC_MAC_MCCH_DATA_REQ (message_p).mbsfn_sync_area = mbsfn_sync_area; + itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p); + } +#endif + memcpy(&buffer_pP[0], + RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area], + RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]); +#ifdef DEBUG_RRC + LOG_D(RRC,"[eNB %d] Frame %d : MCCH request => MCCH_MESSAGE \n",Mod_idP,frameP); + + for (i=0; icarrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]; i++) { + LOG_T(RRC,"%x.",buffer_pP[i]); + } + + LOG_T(RRC,"\n"); +#endif + return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]); + // } + //else + //return(0); + } #endif //Rel10 || Rel14 - #ifdef Rel14 - if ((Srb_id & RAB_OFFSET) == BCCH_SIB1_BR){ - memcpy(&buffer_pP[0], - RC.rrc[Mod_idP]->carrier[CC_id].SIB1_BR, - RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR); - return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR); - } - if ((Srb_id & RAB_OFFSET) == BCCH_SI_BR){ // First SI message with SIB2/3 - memcpy(&buffer_pP[0], - RC.rrc[Mod_idP]->carrier[CC_id].SIB23_BR, - RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR); - return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR); - } + if ((Srb_id & RAB_OFFSET) == BCCH_SIB1_BR) { + memcpy(&buffer_pP[0], + RC.rrc[Mod_idP]->carrier[CC_id].SIB1_BR, + RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR); + return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR); + } + + if ((Srb_id & RAB_OFFSET) == BCCH_SI_BR) { // First SI message with SIB2/3 + memcpy(&buffer_pP[0], + RC.rrc[Mod_idP]->carrier[CC_id].SIB23_BR, + RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR); + return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR); + } #endif - - return(0); } @@ -370,7 +346,7 @@ mac_rrc_data_ind( const sub_frame_t sub_frameP, const rnti_t rntiP, const rb_id_t srb_idP, - const uint8_t* sduP, + const uint8_t *sduP, const sdu_size_t sdu_lenP, const uint8_t mbsfn_sync_areaP ) @@ -379,54 +355,48 @@ mac_rrc_data_ind( SRB_INFO *Srb_info; protocol_ctxt_t ctxt; sdu_size_t sdu_size = 0; - /* for no gcc warnings */ (void)sdu_size; - /* int si_window; */ PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, rntiP, frameP, sub_frameP,0); - - Srb_info = &RC.rrc[module_idP]->carrier[CC_id].Srb0; - LOG_D(RRC,"[eNB %d] Received SDU for CCCH on SRB %d\n",module_idP,Srb_info->Srb_id); - + Srb_info = &RC.rrc[module_idP]->carrier[CC_id].Srb0; + LOG_D(RRC,"[eNB %d] Received SDU for CCCH on SRB %d\n",module_idP,Srb_info->Srb_id); #if 0 //defined(ENABLE_ITTI) - { - MessageDef *message_p; - int msg_sdu_size = sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu); + { + MessageDef *message_p; + int msg_sdu_size = sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu); - if (sdu_lenP > msg_sdu_size) { - LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_lenP, msg_sdu_size); - sdu_size = msg_sdu_size; - } else { - sdu_size = sdu_lenP; - } - - message_p = itti_alloc_new_message (TASK_MAC_ENB, RRC_MAC_CCCH_DATA_IND); - RRC_MAC_CCCH_DATA_IND (message_p).frame = frameP; - RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = sub_frameP; - RRC_MAC_CCCH_DATA_IND (message_p).rnti = rntiP; - RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size; - RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id; - memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); - memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, sduP, sdu_size); - LOG_D(RRC,"[eNB %d] Sending message to RRC task\n",module_idP); - itti_send_msg_to_task (TASK_RRC_ENB, ctxt.instance, message_p); + if (sdu_lenP > msg_sdu_size) { + LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_lenP, msg_sdu_size); + sdu_size = msg_sdu_size; + } else { + sdu_size = sdu_lenP; } + + message_p = itti_alloc_new_message (TASK_MAC_ENB, RRC_MAC_CCCH_DATA_IND); + RRC_MAC_CCCH_DATA_IND (message_p).frame = frameP; + RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = sub_frameP; + RRC_MAC_CCCH_DATA_IND (message_p).rnti = rntiP; + RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size; + RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id; + memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); + memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, sduP, sdu_size); + LOG_D(RRC,"[eNB %d] Sending message to RRC task\n",module_idP); + itti_send_msg_to_task (TASK_RRC_ENB, ctxt.instance, message_p); + } #else - // msg("\n******INST %d Srb_info %p, Srb_id=%d****\n\n",Mod_id,Srb_info,Srb_info->Srb_id); - if (sdu_lenP > 0) { - memcpy(Srb_info->Rx_buffer.Payload,sduP,sdu_lenP); - Srb_info->Rx_buffer.payload_size = sdu_lenP; - rrc_eNB_decode_ccch(&ctxt, Srb_info, CC_id); - } + // msg("\n******INST %d Srb_info %p, Srb_id=%d****\n\n",Mod_id,Srb_info,Srb_info->Srb_id); + if (sdu_lenP > 0) { + memcpy(Srb_info->Rx_buffer.Payload,sduP,sdu_lenP); + Srb_info->Rx_buffer.payload_size = sdu_lenP; + rrc_eNB_decode_ccch(&ctxt, Srb_info, CC_id); + } #endif - return(0); - } //------------------------------------------------------------------------------ @@ -437,7 +407,7 @@ mac_eNB_get_rrc_status( ) //------------------------------------------------------------------------------ { - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; ue_context_p = rrc_eNB_get_ue_context( RC.rrc[Mod_idP], rntiP); @@ -450,60 +420,64 @@ mac_eNB_get_rrc_status( } void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP, - const int CC_idP, - const frame_t frameP, - const sub_frame_t subframeP, - const rnti_t rntiP) + const int CC_idP, + const frame_t frameP, + const sub_frame_t subframeP, + const rnti_t rntiP) { - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; ue_context_p = rrc_eNB_get_ue_context( RC.rrc[Mod_instP], rntiP); if (ue_context_p != NULL) { LOG_I(RRC,"Frame %d, Subframe %d: UE %x UL failure, activating timer\n",frameP,subframeP,rntiP); + if(ue_context_p->ue_context.ul_failure_timer == 0) ue_context_p->ue_context.ul_failure_timer=1; } else { LOG_W(RRC,"Frame %d, Subframe %d: UL failure: UE %x unknown \n",frameP,subframeP,rntiP); } + if (rrc_agent_registered[Mod_instP]) { agent_rrc_xface[Mod_instP]->flexran_agent_notify_ue_state_change(Mod_instP, - rntiP, - PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); + rntiP, + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); } -// rrc_mac_remove_ue(Mod_instP,rntiP); + + // rrc_mac_remove_ue(Mod_instP,rntiP); } void mac_eNB_rrc_uplane_failure(const module_id_t Mod_instP, - const int CC_idP, - const frame_t frameP, - const sub_frame_t subframeP, - const rnti_t rntiP) + const int CC_idP, + const frame_t frameP, + const sub_frame_t subframeP, + const rnti_t rntiP) { - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[Mod_instP], - rntiP); - if (ue_context_p != NULL) { - LOG_I(RRC,"Frame %d, Subframe %d: UE %x U-Plane failure, activating timer\n",frameP,subframeP,rntiP); + struct rrc_eNB_ue_context_s *ue_context_p = NULL; + ue_context_p = rrc_eNB_get_ue_context( + RC.rrc[Mod_instP], + rntiP); - if(ue_context_p->ue_context.ul_failure_timer == 0) - ue_context_p->ue_context.ul_failure_timer=19999; - } - else { - LOG_W(RRC,"Frame %d, Subframe %d: U-Plane failure: UE %x unknown \n",frameP,subframeP,rntiP); - } + if (ue_context_p != NULL) { + LOG_I(RRC,"Frame %d, Subframe %d: UE %x U-Plane failure, activating timer\n",frameP,subframeP,rntiP); + + if(ue_context_p->ue_context.ul_failure_timer == 0) + ue_context_p->ue_context.ul_failure_timer=19999; + } + else { + LOG_W(RRC,"Frame %d, Subframe %d: U-Plane failure: UE %x unknown \n",frameP,subframeP,rntiP); + } } -void mac_eNB_rrc_ul_in_sync(const module_id_t Mod_instP, - const int CC_idP, - const frame_t frameP, - const sub_frame_t subframeP, - const rnti_t rntiP) +void mac_eNB_rrc_ul_in_sync(const module_id_t Mod_instP, + const int CC_idP, + const frame_t frameP, + const sub_frame_t subframeP, + const rnti_t rntiP) { - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; ue_context_p = rrc_eNB_get_ue_context( RC.rrc[Mod_instP], rntiP); diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c index 77ba0c4cad..da78ae16be 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c @@ -137,11 +137,9 @@ int xer_sprint (char *string, size_t string_size, asn_TYPE_descriptor_t *td, voi { asn_enc_rval_t er; xer_sprint_string_t string_buffer; - string_buffer.string = string; string_buffer.string_size = string_size; string_buffer.string_index = 0; - er = xer_encode(td, sptr, XER_F_BASIC, xer__print2s, &string_buffer); if (er.encoded < 0) { @@ -179,40 +177,40 @@ uint8_t get_adjacent_cell_mod_id(uint16_t phyCellId) uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich_Resource, uint32_t phich_duration, uint32_t frame) { - asn_enc_rval_t enc_rval; BCCH_BCH_Message_t *mib=&carrier->mib ; uint8_t sfn = (uint8_t)((frame>>2)&0xff); uint16_t *spare= calloc(1, sizeof(uint16_t)); + if (spare == NULL) abort(); switch (N_RB_DL) { + case 6: + mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n6; + break; - case 6: - mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n6; - break; + case 15: + mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n15; + break; - case 15: - mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n15; - break; + case 25: + mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n25; + break; - case 25: - mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n25; - break; + case 50: + mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n50; + break; - case 50: - mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n50; - break; + case 75: + mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n75; + break; - case 75: - mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n75; - break; + case 100: + mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n100; + break; - case 100: - mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n100; - break; - default: - AssertFatal(1==0,"Unknown dl_Bandwidth %d\n",N_RB_DL); + default: + AssertFatal(1==0,"Unknown dl_Bandwidth %d\n",N_RB_DL); } AssertFatal(phich_Resource <= PHICH_Config__phich_Resource_two,"Illegal phich_Resource\n"); @@ -220,11 +218,10 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich AssertFatal(phich_duration <= PHICH_Config__phich_Duration_extended,"Illegal phich_Duration\n"); mib->message.phich_Config.phich_Duration = phich_duration; LOG_I(RRC,"[MIB] systemBandwidth %x, phich_duration %x, phich_resource %x,sfn %x\n", - (uint32_t)mib->message.dl_Bandwidth, - (uint32_t)phich_duration, - (uint32_t)phich_Resource, - (uint32_t)sfn); - + (uint32_t)mib->message.dl_Bandwidth, + (uint32_t)phich_duration, + (uint32_t)phich_Resource, + (uint32_t)sfn); mib->message.systemFrameNumber.buf = &sfn; mib->message.systemFrameNumber.size = 1; mib->message.systemFrameNumber.bits_unused=0; @@ -237,17 +234,17 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich mib->message.spare.bits_unused = 3; // This makes a spare of 5 bits mib->message.schedulingInfoSIB1_BR_r13 = 0; // turn off eMTC #endif - enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message, - (void*)mib, + NULL, + (void *)mib, carrier->MIB, 24); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); /* -#if defined(ENABLE_ITTI) -# if !defined(DISABLE_XER_SPRINT) + #if defined(ENABLE_ITTI) + # if !defined(DISABLE_XER_SPRINT) { char message_string[20000]; size_t message_string_size; @@ -262,8 +259,8 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich itti_send_msg_to_task(TASK_UNKNOWN, enb_module_idP, msg_p); } } -# endif -#endif + # endif + #endif */ if (enc_rval.encoded==-1) { return(-1); @@ -273,43 +270,32 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich } uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier, - int Mod_id,int CC_id + int Mod_id,int CC_id #if defined(ENABLE_ITTI) , RrcConfigurationReq *configuration #endif ) { - // SystemInformation_t systemInformation; PLMN_IdentityInfo_t PLMN_identity_info; MCC_MNC_Digit_t dummy_mcc[3],dummy_mnc[3]; asn_enc_rval_t enc_rval; SchedulingInfo_t schedulingInfo; SIB_Type_t sib_type; - uint8_t *buffer = carrier->SIB1; BCCH_DL_SCH_Message_t *bcch_message = &carrier->siblock1; SystemInformationBlockType1_t **sib1 = &carrier->sib1; - - memset(bcch_message,0,sizeof(BCCH_DL_SCH_Message_t)); bcch_message->message.present = BCCH_DL_SCH_MessageType_PR_c1; bcch_message->message.choice.c1.present = BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1; // memcpy(&bcch_message.message.choice.c1.choice.systemInformationBlockType1,sib1,sizeof(SystemInformationBlockType1_t)); - *sib1 = &bcch_message->message.choice.c1.choice.systemInformationBlockType1; - memset(&PLMN_identity_info,0,sizeof(PLMN_IdentityInfo_t)); memset(&schedulingInfo,0,sizeof(SchedulingInfo_t)); memset(&sib_type,0,sizeof(SIB_Type_t)); - - - PLMN_identity_info.plmn_Identity.mcc = CALLOC(1,sizeof(*PLMN_identity_info.plmn_Identity.mcc)); memset(PLMN_identity_info.plmn_Identity.mcc,0,sizeof(*PLMN_identity_info.plmn_Identity.mcc)); - asn_set_empty(&PLMN_identity_info.plmn_Identity.mcc->list);//.size=0; - #if defined(ENABLE_ITTI) dummy_mcc[0] = (configuration->mcc / 100) % 10; dummy_mcc[1] = (configuration->mcc / 10) % 10; @@ -322,7 +308,6 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier, ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mcc->list,&dummy_mcc[0]); ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mcc->list,&dummy_mcc[1]); ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mcc->list,&dummy_mcc[2]); - PLMN_identity_info.plmn_Identity.mnc.list.size=0; PLMN_identity_info.plmn_Identity.mnc.list.count=0; #if defined(ENABLE_ITTI) @@ -357,10 +342,7 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier, //assign_enum(&PLMN_identity_info.cellReservedForOperatorUse,PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved); PLMN_identity_info.cellReservedForOperatorUse=PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved; - ASN_SEQUENCE_ADD(&(*sib1)->cellAccessRelatedInfo.plmn_IdentityList.list,&PLMN_identity_info); - - // 16 bits (*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf = MALLOC(2); #if defined(ENABLE_ITTI) @@ -372,7 +354,6 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier, #endif (*sib1)->cellAccessRelatedInfo.trackingAreaCode.size=2; (*sib1)->cellAccessRelatedInfo.trackingAreaCode.bits_unused=0; - // 28 bits (*sib1)->cellAccessRelatedInfo.cellIdentity.buf = MALLOC(8); #if defined(ENABLE_ITTI) @@ -388,14 +369,11 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier, #endif (*sib1)->cellAccessRelatedInfo.cellIdentity.size=4; (*sib1)->cellAccessRelatedInfo.cellIdentity.bits_unused=4; - // assign_enum(&(*sib1)->cellAccessRelatedInfo.cellBarred,SystemInformationBlockType1__cellAccessRelatedInfo__cellBarred_notBarred); (*sib1)->cellAccessRelatedInfo.cellBarred=SystemInformationBlockType1__cellAccessRelatedInfo__cellBarred_notBarred; - // assign_enum(&(*sib1)->cellAccessRelatedInfo.intraFreqReselection,SystemInformationBlockType1__cellAccessRelatedInfo__intraFreqReselection_allowed); (*sib1)->cellAccessRelatedInfo.intraFreqReselection=SystemInformationBlockType1__cellAccessRelatedInfo__intraFreqReselection_notAllowed; (*sib1)->cellAccessRelatedInfo.csg_Indication=0; - (*sib1)->cellSelectionInfo.q_RxLevMin=-65; (*sib1)->cellSelectionInfo.q_RxLevMinOffset=NULL; //(*sib1)->p_Max = CALLOC(1, sizeof(P_Max_t)); @@ -406,52 +384,45 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier, #else 7; #endif - schedulingInfo.si_Periodicity=SchedulingInfo__si_Periodicity_rf8; - // This is for SIB2/3 sib_type=SIB_Type_sibType3; ASN_SEQUENCE_ADD(&schedulingInfo.sib_MappingInfo.list,&sib_type); ASN_SEQUENCE_ADD(&(*sib1)->schedulingInfoList.list,&schedulingInfo); - // ASN_SEQUENCE_ADD(&schedulingInfo.sib_MappingInfo.list,NULL); - #if defined(ENABLE_ITTI) if (configuration->frame_type[CC_id] == TDD) #endif { (*sib1)->tdd_Config = CALLOC(1,sizeof(struct TDD_Config)); - (*sib1)->tdd_Config->subframeAssignment = #if defined(ENABLE_ITTI) configuration->tdd_config[CC_id]; #else 3; #endif - (*sib1)->tdd_Config->specialSubframePatterns = #if defined(ENABLE_ITTI) configuration->tdd_config_s[CC_id]; #else - 0; + 0; #endif } (*sib1)->si_WindowLength=SystemInformationBlockType1__si_WindowLength_ms20; (*sib1)->systemInfoValueTag=0; // (*sib1).nonCriticalExtension = calloc(1,sizeof(*(*sib1).nonCriticalExtension)); - #ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, (void*)bcch_message); + xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, (void *)bcch_message); #endif enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message, - (void*)bcch_message, + NULL, + (void *)bcch_message, buffer, 100); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - #if defined(ENABLE_ITTI) # if !defined(DISABLE_XER_SPRINT) { @@ -460,7 +431,6 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier, if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_BCCH_DL_SCH_Message, (void *)bcch_message)) > 0) { MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_BCCH, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_dl_bcch.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_dl_bcch.text, message_string, message_string_size); @@ -469,7 +439,6 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier, } # endif #endif - LOG_D(RRC,"[eNB] SystemInformationBlockType1 Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); if (enc_rval.encoded==-1) { @@ -495,7 +464,6 @@ uint8_t do_SIB23(uint8_t Mod_id, struct MBSFN_AreaInfo_r9 *MBSFN_Area1, *MBSFN_Area2; #endif asn_enc_rval_t enc_rval; - uint8_t *buffer = RC.rrc[Mod_id]->carrier[CC_id].SIB23; BCCH_DL_SCH_Message_t *bcch_message = &RC.rrc[Mod_id]->carrier[CC_id].systemInformation; SystemInformationBlockType2_t **sib2 = &RC.rrc[Mod_id]->carrier[CC_id].sib2; @@ -531,13 +499,10 @@ uint8_t do_SIB23(uint8_t Mod_id, sib3_part = CALLOC(1,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); memset(sib2_part,0,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); memset(sib3_part,0,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); - sib2_part->present = SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2; sib3_part->present = SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3; - *sib2 = &sib2_part->choice.sib2; *sib3 = &sib3_part->choice.sib3; - #if defined(Rel10) || defined(Rel14) if (MBMS_flag > 0) { @@ -548,9 +513,7 @@ uint8_t do_SIB23(uint8_t Mod_id, } #endif - // sib2 - (*sib2)->ac_BarringInfo = NULL; #if defined(Rel10) || defined(Rel14) #if 0 @@ -561,9 +524,7 @@ uint8_t do_SIB23(uint8_t Mod_id, (*sib2)->ext1 = NULL; (*sib2)->ext2 = NULL; #endif - #if defined(ENABLE_ITTI) - (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.numberOfRA_Preambles = configuration->rach_numberOfRA_Preambles[CC_id]; (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig = NULL; @@ -586,17 +547,14 @@ uint8_t do_SIB23(uint8_t Mod_id, (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer = configuration->rach_macContentionResolutionTimer[CC_id]; (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.maxHARQ_Msg3Tx = configuration->rach_maxHARQ_Msg3Tx[CC_id]; - // BCCH-Config (*sib2)->radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff = configuration->bcch_modificationPeriodCoeff[CC_id]; - // PCCH-Config (*sib2)->radioResourceConfigCommon.pcch_Config.defaultPagingCycle = configuration->pcch_defaultPagingCycle[CC_id]; (*sib2)->radioResourceConfigCommon.pcch_Config.nB = configuration->pcch_nB[CC_id]; - // PRACH-Config (*sib2)->radioResourceConfigCommon.prach_Config.rootSequenceIndex = configuration->prach_root[CC_id]; @@ -608,13 +566,11 @@ uint8_t do_SIB23(uint8_t Mod_id, = configuration->prach_zero_correlation[CC_id]; (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_FreqOffset = configuration->prach_freq_offset[CC_id]; - // PDSCH-Config (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.referenceSignalPower = configuration->pdsch_referenceSignalPower[CC_id]; (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.p_b = configuration->pdsch_p_b[CC_id]; - // PUSCH-Config (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.n_SB = configuration->pusch_n_SB[CC_id]; @@ -632,9 +588,7 @@ uint8_t do_SIB23(uint8_t Mod_id, = configuration->pusch_sequenceHoppingEnabled[CC_id]; (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift = configuration->pusch_nDMRS1[CC_id]; - // PUCCH-Config - (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.deltaPUCCH_Shift = configuration->pucch_delta_shift[CC_id]; (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.nRB_CQI @@ -664,6 +618,7 @@ uint8_t do_SIB23(uint8_t Mod_id, } else { (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts = NULL; } + RC.rrc[Mod_id]->srs_enable[CC_id] = 1; } else { RC.rrc[Mod_id]->srs_enable[CC_id] = 0; @@ -672,7 +627,6 @@ uint8_t do_SIB23(uint8_t Mod_id, } // uplinkPowerControlCommon - (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUSCH = configuration->pusch_p0_Nominal[CC_id]; (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUCCH @@ -693,9 +647,7 @@ uint8_t do_SIB23(uint8_t Mod_id, = configuration->msg3_delta_Preamble[CC_id]; (*sib2)->radioResourceConfigCommon.ul_CyclicPrefixLength = configuration->ul_CyclicPrefixLength[CC_id]; - // UE Timers and Constants - (*sib2)->ue_TimersAndConstants.t300 = configuration->ue_TimersAndConstants_t300[CC_id]; (*sib2)->ue_TimersAndConstants.t301 @@ -708,7 +660,6 @@ uint8_t do_SIB23(uint8_t Mod_id, = configuration->ue_TimersAndConstants_t311[CC_id]; (*sib2)->ue_TimersAndConstants.n311 = configuration->ue_TimersAndConstants_n311[CC_id]; - #else (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.numberOfRA_Preambles=RACH_ConfigCommon__preambleInfo__numberOfRA_Preambles_n64; (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig = NULL; @@ -720,27 +671,20 @@ uint8_t do_SIB23(uint8_t Mod_id, (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer= RACH_ConfigCommon__ra_SupervisionInfo__mac_ContentionResolutionTimer_sf48; (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.maxHARQ_Msg3Tx = 4; - // BCCH-Config (*sib2)->radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff=BCCH_Config__modificationPeriodCoeff_n2; - // PCCH-Config (*sib2)->radioResourceConfigCommon.pcch_Config.defaultPagingCycle = PCCH_Config__defaultPagingCycle_rf128; (*sib2)->radioResourceConfigCommon.pcch_Config.nB=PCCH_Config__nB_oneT; - // PRACH-Config (*sib2)->radioResourceConfigCommon.prach_Config.rootSequenceIndex=Mod_id;//0;//384; (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_ConfigIndex = 0;//3; (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.highSpeedFlag = 0; (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig = 1;//12; (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_FreqOffset = 2; - // PDSCH-Config (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.referenceSignalPower=0; // corresponds to 24.7 dBm 5 MHz/ 27.7 10 MHz/ 30.7 20 MHz - - (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.p_b=0; - // PUSCH-Config (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.n_SB=1; (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode=PUSCH_ConfigCommon__pusch_ConfigBasic__hoppingMode_interSubFrame; @@ -750,55 +694,35 @@ uint8_t do_SIB23(uint8_t Mod_id, (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH=0; (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled=0; (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift=0; - // PUCCH-Config - (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.deltaPUCCH_Shift=PUCCH_ConfigCommon__deltaPUCCH_Shift_ds1; (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.nRB_CQI = 1; (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.nCS_AN = 0; (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.n1PUCCH_AN = 32; - - (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present=SoundingRS_UL_ConfigCommon_PR_release; (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.release=0; - // uplinkPowerControlCommon - (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUSCH = -108; (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUCCH = -108; (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.alpha=UplinkPowerControlCommon__alpha_al1; (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1=DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF2; (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1b=DeltaFList_PUCCH__deltaF_PUCCH_Format1b_deltaF3; - (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2=DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF0; - (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2a=DeltaFList_PUCCH__deltaF_PUCCH_Format2a_deltaF0; - (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b=DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF0; - (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaPreambleMsg3 = 6; - (*sib2)->radioResourceConfigCommon.ul_CyclicPrefixLength=UL_CyclicPrefixLength_len1; - (*sib2)->ue_TimersAndConstants.t300=UE_TimersAndConstants__t300_ms1000; - (*sib2)->ue_TimersAndConstants.t301=UE_TimersAndConstants__t301_ms1000; - (*sib2)->ue_TimersAndConstants.t310=UE_TimersAndConstants__t310_ms1000; - (*sib2)->ue_TimersAndConstants.n310=UE_TimersAndConstants__n310_n20; - (*sib2)->ue_TimersAndConstants.t311=UE_TimersAndConstants__t311_ms10000; - (*sib2)->ue_TimersAndConstants.n311=UE_TimersAndConstants__n311_n1; - #endif - (*sib2)->freqInfo.additionalSpectrumEmission = 1; (*sib2)->freqInfo.ul_CarrierFreq = NULL; (*sib2)->freqInfo.ul_Bandwidth = NULL; // (*sib2)->mbsfn_SubframeConfigList = NULL; - #if defined(Rel10) || defined(Rel14) if (MBMS_flag > 0) { @@ -806,37 +730,29 @@ uint8_t do_SIB23(uint8_t Mod_id, MBSFN_SubframeConfig_t *sib2_mbsfn_SubframeConfig1; (*sib2)->mbsfn_SubframeConfigList = CALLOC(1,sizeof(struct MBSFN_SubframeConfigList)); MBSFNSubframeConfigList = (*sib2)->mbsfn_SubframeConfigList; - sib2_mbsfn_SubframeConfig1= CALLOC(1,sizeof(*sib2_mbsfn_SubframeConfig1)); - memset((void*)sib2_mbsfn_SubframeConfig1,0,sizeof(*sib2_mbsfn_SubframeConfig1)); - + memset((void *)sib2_mbsfn_SubframeConfig1,0,sizeof(*sib2_mbsfn_SubframeConfig1)); sib2_mbsfn_SubframeConfig1->radioframeAllocationPeriod= MBSFN_SubframeConfig__radioframeAllocationPeriod_n4; sib2_mbsfn_SubframeConfig1->radioframeAllocationOffset= 1; sib2_mbsfn_SubframeConfig1->subframeAllocation.present= MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame; sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf= MALLOC(1); sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.size= 1; sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.bits_unused= 2; - sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x38<<2; - ASN_SEQUENCE_ADD(&MBSFNSubframeConfigList->list,sib2_mbsfn_SubframeConfig1); if (MBMS_flag == 4 ) { LOG_I(RRC,"Adding MBSFN subframe Configuration 2 to SIB2\n"); MBSFN_SubframeConfig_t *sib2_mbsfn_SubframeConfig2; sib2_mbsfn_SubframeConfig2= CALLOC(1,sizeof(*sib2_mbsfn_SubframeConfig2)); - memset((void*)sib2_mbsfn_SubframeConfig2,0,sizeof(*sib2_mbsfn_SubframeConfig2)); - + memset((void *)sib2_mbsfn_SubframeConfig2,0,sizeof(*sib2_mbsfn_SubframeConfig2)); sib2_mbsfn_SubframeConfig2->radioframeAllocationPeriod= MBSFN_SubframeConfig__radioframeAllocationPeriod_n4; sib2_mbsfn_SubframeConfig2->radioframeAllocationOffset= 1; sib2_mbsfn_SubframeConfig2->subframeAllocation.present= MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame; sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.buf= MALLOC(1); sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.size= 1; sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.bits_unused= 2; - sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.buf[0]=0x07<<2; - - ASN_SEQUENCE_ADD(&MBSFNSubframeConfigList->list,sib2_mbsfn_SubframeConfig2); } } @@ -844,9 +760,7 @@ uint8_t do_SIB23(uint8_t Mod_id, #else // no MBMS transmission (*sib2)->mbsfn_SubframeConfigList = NULL; #endif - (*sib2)->timeAlignmentTimerCommon=TimeAlignmentTimer_infinity;//TimeAlignmentTimer_sf5120; - /// (*SIB3) #if defined(Rel10) || defined(Rel14) (*sib3)->ext1 = NULL; @@ -858,21 +772,16 @@ uint8_t do_SIB23(uint8_t Mod_id, #endif #endif (*sib3)->cellReselectionInfoCommon.q_Hyst=SystemInformationBlockType3__cellReselectionInfoCommon__q_Hyst_dB4; - (*sib3)->cellReselectionInfoCommon.speedStateReselectionPars=NULL; - (*sib3)->cellReselectionServingFreqInfo.s_NonIntraSearch=NULL; (*sib3)->cellReselectionServingFreqInfo.threshServingLow=31; (*sib3)->cellReselectionServingFreqInfo.cellReselectionPriority=7; - (*sib3)->intraFreqCellReselectionInfo.q_RxLevMin = -70; (*sib3)->intraFreqCellReselectionInfo.p_Max = NULL; (*sib3)->intraFreqCellReselectionInfo.s_IntraSearch = CALLOC(1,sizeof(*(*sib3)->intraFreqCellReselectionInfo.s_IntraSearch)); *(*sib3)->intraFreqCellReselectionInfo.s_IntraSearch = 31; (*sib3)->intraFreqCellReselectionInfo.allowedMeasBandwidth=CALLOC(1,sizeof(*(*sib3)->intraFreqCellReselectionInfo.allowedMeasBandwidth)); - *(*sib3)->intraFreqCellReselectionInfo.allowedMeasBandwidth = AllowedMeasBandwidth_mbw6; - (*sib3)->intraFreqCellReselectionInfo.presenceAntennaPort1 = 0; (*sib3)->intraFreqCellReselectionInfo.neighCellConfig.buf = CALLOC(8,1); (*sib3)->intraFreqCellReselectionInfo.neighCellConfig.size = 1; @@ -880,7 +789,6 @@ uint8_t do_SIB23(uint8_t Mod_id, (*sib3)->intraFreqCellReselectionInfo.neighCellConfig.bits_unused = 6; (*sib3)->intraFreqCellReselectionInfo.t_ReselectionEUTRA = 1; (*sib3)->intraFreqCellReselectionInfo.t_ReselectionEUTRA_SF = (struct SpeedStateScaleFactors *)NULL; - // SIB13 // fill in all elements of SIB13 if present #if defined(Rel10) || defined(Rel14) @@ -890,7 +798,6 @@ uint8_t do_SIB23(uint8_t Mod_id, (*sib13)->notificationConfig_r9.notificationRepetitionCoeff_r9= MBMS_NotificationConfig_r9__notificationRepetitionCoeff_r9_n2; (*sib13)->notificationConfig_r9.notificationOffset_r9= 0; (*sib13)->notificationConfig_r9.notificationSF_Index_r9= 1; - // MBSFN-AreaInfoList MBSFNArea_list= &(*sib13)->mbsfn_AreaInfoList_r9;//CALLOC(1,sizeof(*MBSFNArea_list)); memset(MBSFNArea_list,0,sizeof(*MBSFNArea_list)); @@ -905,14 +812,9 @@ uint8_t do_SIB23(uint8_t Mod_id, // Subframe Allocation Info MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.buf= MALLOC(1); MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.size= 1; - MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.buf[0]=0x20<<2; // FDD: SF1 - - MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.bits_unused= 2; - MBSFN_Area1->mcch_Config_r9.signallingMCS_r9= MBSFN_AreaInfo_r9__mcch_Config_r9__signallingMCS_r9_n7; - ASN_SEQUENCE_ADD(&MBSFNArea_list->list,MBSFN_Area1); //MBSFN Area 2: currently only activated for eMBMS relaying @@ -928,12 +830,8 @@ uint8_t do_SIB23(uint8_t Mod_id, MBSFN_Area2->mcch_Config_r9.sf_AllocInfo_r9.buf= MALLOC(1); MBSFN_Area2->mcch_Config_r9.sf_AllocInfo_r9.size= 1; MBSFN_Area2->mcch_Config_r9.sf_AllocInfo_r9.bits_unused= 2; - MBSFN_Area2->mcch_Config_r9.sf_AllocInfo_r9.buf[0]=0x04<<2; // FDD: SF6 - - MBSFN_Area2->mcch_Config_r9.signallingMCS_r9= MBSFN_AreaInfo_r9__mcch_Config_r9__signallingMCS_r9_n7; - ASN_SEQUENCE_ADD(&MBSFNArea_list->list,MBSFN_Area2); } @@ -941,18 +839,13 @@ uint8_t do_SIB23(uint8_t Mod_id, } #endif - bcch_message->message.present = BCCH_DL_SCH_MessageType_PR_c1; bcch_message->message.choice.c1.present = BCCH_DL_SCH_MessageType__c1_PR_systemInformation; - /* memcpy((void*)&bcch_message.message.choice.c1.choice.systemInformation, (void*)systemInformation, sizeof(SystemInformation_t));*/ - bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.present = SystemInformation__criticalExtensions_PR_systemInformation_r8; - bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count=0; - // asn_set_empty(&systemInformation->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list);//.size=0; // systemInformation->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count=0; ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list, @@ -966,19 +859,16 @@ uint8_t do_SIB23(uint8_t Mod_id, } #endif - - #ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, (void*)bcch_message); + xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, (void *)bcch_message); #endif enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message, - (void*)bcch_message, + NULL, + (void *)bcch_message, buffer, 900); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - - #if defined(ENABLE_ITTI) # if !defined(DISABLE_XER_SPRINT) { @@ -987,17 +877,14 @@ uint8_t do_SIB23(uint8_t Mod_id, if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_BCCH_DL_SCH_Message, (void *)bcch_message)) > 0) { MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_BCCH, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_dl_bcch.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_dl_bcch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); } } # endif #endif - LOG_D(RRC,"[eNB] SystemInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); if (enc_rval.encoded==-1) { @@ -1010,21 +897,15 @@ uint8_t do_SIB23(uint8_t Mod_id, uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) { - asn_enc_rval_t enc_rval; uint8_t buf[5],buf2=0; uint8_t ecause=0; - UL_CCCH_Message_t ul_ccch_msg; - RRCConnectionRequest_t *rrcConnectionRequest; - memset((void *)&ul_ccch_msg,0,sizeof(UL_CCCH_Message_t)); - ul_ccch_msg.message.present = UL_CCCH_MessageType_PR_c1; ul_ccch_msg.message.choice.c1.present = UL_CCCH_MessageType__c1_PR_rrcConnectionRequest; rrcConnectionRequest = &ul_ccch_msg.message.choice.c1.choice.rrcConnectionRequest; - rrcConnectionRequest->criticalExtensions.present = RRCConnectionRequest__criticalExtensions_PR_rrcConnectionRequest_r8; if (1) { @@ -1053,19 +934,16 @@ uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) } rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.establishmentCause = EstablishmentCause_mo_Signalling; //EstablishmentCause_mo_Data; - rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.spare.buf = &buf2; rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.spare.size=1; rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.spare.bits_unused = 7; - - enc_rval = uper_encode_to_buffer(&asn_DEF_UL_CCCH_Message, - (void*)&ul_ccch_msg, + NULL, + (void *)&ul_ccch_msg, buffer, 100); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - #if defined(ENABLE_ITTI) # if !defined(DISABLE_XER_SPRINT) { @@ -1074,50 +952,37 @@ uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_CCCH_Message, (void *) &ul_ccch_msg)) > 0) { MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_CCCH, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_ul_ccch.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_ul_ccch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, NB_eNB_INST + Mod_id, msg_p); } } # endif #endif - LOG_D(RRC,"[UE] RRCConnectionRequest Encoded %zd bits (%zd bytes), ecause %d\n",enc_rval.encoded,(enc_rval.encoded+7)/8,ecause); - return((enc_rval.encoded+7)/8); - } uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Transaction_id, const int dedicatedInfoNASLength, const char *dedicatedInfoNAS) { - - asn_enc_rval_t enc_rval; - UL_DCCH_Message_t ul_dcch_msg; - RRCConnectionSetupComplete_t *rrcConnectionSetupComplete; - memset((void *)&ul_dcch_msg,0,sizeof(UL_DCCH_Message_t)); - ul_dcch_msg.message.present = UL_DCCH_MessageType_PR_c1; ul_dcch_msg.message.choice.c1.present = UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete; rrcConnectionSetupComplete = &ul_dcch_msg.message.choice.c1.choice.rrcConnectionSetupComplete; - rrcConnectionSetupComplete->rrc_TransactionIdentifier = Transaction_id; rrcConnectionSetupComplete->criticalExtensions.present = RRCConnectionSetupComplete__criticalExtensions_PR_c1; rrcConnectionSetupComplete->criticalExtensions.choice.c1.present = RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8; - rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.nonCriticalExtension=CALLOC(1, sizeof(*rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.nonCriticalExtension)); if(usim_test == 0) - rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.selectedPLMN_Identity= 2; + rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.selectedPLMN_Identity= 2; else - rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.selectedPLMN_Identity= 1; + rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.selectedPLMN_Identity= 1; rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME = NULL;//calloc(1,sizeof(*rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME)); @@ -1132,21 +997,19 @@ uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uin memset(&rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.dedicatedInfoNAS,0,sizeof(OCTET_STRING_t)); OCTET_STRING_fromBuf(&rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.dedicatedInfoNAS, dedicatedInfoNAS, dedicatedInfoNASLength); - /* rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.buf = calloc(1,1); rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.buf[0] = 0x98; rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.size=1; rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.bits_unused=0; */ - enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, - (void*)&ul_dcch_msg, + NULL, + (void *)&ul_dcch_msg, buffer, 100); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - #if defined(ENABLE_ITTI) # if !defined(DISABLE_XER_SPRINT) { @@ -1155,58 +1018,45 @@ uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uin if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, NB_eNB_INST + Mod_id, msg_p); } } # endif #endif - LOG_D(RRC,"RRCConnectionSetupComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); - return((enc_rval.encoded+7)/8); - } //------------------------------------------------------------------------------ uint8_t do_RRCConnectionReconfigurationComplete( - const protocol_ctxt_t* const ctxt_pP, - uint8_t* buffer, + const protocol_ctxt_t *const ctxt_pP, + uint8_t *buffer, const uint8_t Transaction_id ) //------------------------------------------------------------------------------ { - - asn_enc_rval_t enc_rval; - UL_DCCH_Message_t ul_dcch_msg; - RRCConnectionReconfigurationComplete_t *rrcConnectionReconfigurationComplete; - memset((void *)&ul_dcch_msg,0,sizeof(UL_DCCH_Message_t)); - ul_dcch_msg.message.present = UL_DCCH_MessageType_PR_c1; ul_dcch_msg.message.choice.c1.present = UL_DCCH_MessageType__c1_PR_rrcConnectionReconfigurationComplete; rrcConnectionReconfigurationComplete = &ul_dcch_msg.message.choice.c1.choice.rrcConnectionReconfigurationComplete; - rrcConnectionReconfigurationComplete->rrc_TransactionIdentifier = Transaction_id; rrcConnectionReconfigurationComplete->criticalExtensions.present = RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8; rrcConnectionReconfigurationComplete->criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.nonCriticalExtension=NULL; - enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, - (void*)&ul_dcch_msg, + NULL, + (void *)&ul_dcch_msg, buffer, 100); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - #if defined(ENABLE_ITTI) # if !defined(DISABLE_XER_SPRINT) { @@ -1215,19 +1065,15 @@ do_RRCConnectionReconfigurationComplete( if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); } } # endif #endif - LOG_D(RRC,"RRCConnectionReconfigurationComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); - return((enc_rval.encoded+7)/8); } @@ -1235,38 +1081,32 @@ do_RRCConnectionReconfigurationComplete( //------------------------------------------------------------------------------ uint8_t do_RRCConnectionSetup( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, int CC_id, - uint8_t* const buffer, + uint8_t *const buffer, const uint8_t transmission_mode, const uint8_t Transaction_id, SRB_ToAddModList_t **SRB_configList, struct PhysicalConfigDedicated **physicalConfigDedicated) { - asn_enc_rval_t enc_rval; uint8_t ecause=0; eNB_RRC_INST *rrc = RC.rrc[ctxt_pP->module_id]; rrc_eNB_carrier_data_t *carrier = &rrc->carrier[CC_id]; - - long* logicalchannelgroup = NULL; - struct SRB_ToAddMod* SRB1_config = NULL; - struct SRB_ToAddMod__rlc_Config* SRB1_rlc_config = NULL; - struct SRB_ToAddMod__logicalChannelConfig* SRB1_lchan_config = NULL; - struct LogicalChannelConfig__ul_SpecificParameters* SRB1_ul_SpecificParameters = NULL; - + long *logicalchannelgroup = NULL; + struct SRB_ToAddMod *SRB1_config = NULL; + struct SRB_ToAddMod__rlc_Config *SRB1_rlc_config = NULL; + struct SRB_ToAddMod__logicalChannelConfig *SRB1_lchan_config = NULL; + struct LogicalChannelConfig__ul_SpecificParameters *SRB1_ul_SpecificParameters = NULL; #ifdef CBA - struct PUSCH_CBAConfigDedicated_vlola* pusch_CBAConfigDedicated_vlola = NULL; - long* betaOffset_CBA_Index = NULL; - long* cShift_CBA = NULL; + struct PUSCH_CBAConfigDedicated_vlola *pusch_CBAConfigDedicated_vlola = NULL; + long *betaOffset_CBA_Index = NULL; + long *cShift_CBA = NULL; #endif - PhysicalConfigDedicated_t* physicalConfigDedicated2 = NULL; - + PhysicalConfigDedicated_t *physicalConfigDedicated2 = NULL; DL_CCCH_Message_t dl_ccch_msg; - - RRCConnectionSetup_t* rrcConnectionSetup = NULL; - + RRCConnectionSetup_t *rrcConnectionSetup = NULL; memset((void *)&dl_ccch_msg,0,sizeof(DL_CCCH_Message_t)); dl_ccch_msg.message.present = DL_CCCH_MessageType_PR_c1; dl_ccch_msg.message.choice.c1.present = DL_CCCH_MessageType__c1_PR_rrcConnectionSetup; @@ -1281,14 +1121,11 @@ do_RRCConnectionSetup( } *SRB_configList = CALLOC(1,sizeof(SRB_ToAddModList_t)); - /// SRB1 SRB1_config = CALLOC(1,sizeof(*SRB1_config)); - SRB1_config->srb_Identity = 1; SRB1_rlc_config = CALLOC(1,sizeof(*SRB1_rlc_config)); SRB1_config->rlc_Config = SRB1_rlc_config; - SRB1_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; SRB1_rlc_config->choice.explicitValue.present=RLC_Config_PR_am; #if defined(ENABLE_ITTI) @@ -1298,44 +1135,31 @@ do_RRCConnectionSetup( SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = rrc->srb1_max_retx_threshold; SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = rrc->srb1_timer_reordering; SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = rrc->srb1_timer_status_prohibit; -#else +#else SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms20;; SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p4;; SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms0; -#endif - +#endif SRB1_lchan_config = CALLOC(1,sizeof(*SRB1_lchan_config)); SRB1_config->logicalChannelConfig = SRB1_lchan_config; - SRB1_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; SRB1_ul_SpecificParameters = CALLOC(1,sizeof(*SRB1_ul_SpecificParameters)); - SRB1_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB1_ul_SpecificParameters; - - SRB1_ul_SpecificParameters->priority = 1; - //assign_enum(&SRB1_ul_SpecificParameters->prioritisedBitRate,LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity); SRB1_ul_SpecificParameters->prioritisedBitRate=LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; - //assign_enum(&SRB1_ul_SpecificParameters->bucketSizeDuration,LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50); SRB1_ul_SpecificParameters->bucketSizeDuration=LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - logicalchannelgroup = CALLOC(1,sizeof(long)); *logicalchannelgroup=0; SRB1_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; - - ASN_SEQUENCE_ADD(&(*SRB_configList)->list,SRB1_config); - // PhysicalConfigDedicated - physicalConfigDedicated2 = CALLOC(1,sizeof(*physicalConfigDedicated2)); *physicalConfigDedicated = physicalConfigDedicated2; - physicalConfigDedicated2->pdsch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pdsch_ConfigDedicated)); physicalConfigDedicated2->pucch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pucch_ConfigDedicated)); physicalConfigDedicated2->pusch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pusch_ConfigDedicated)); @@ -1343,10 +1167,12 @@ do_RRCConnectionSetup( physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH)); physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH)); physicalConfigDedicated2->cqi_ReportConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig)); + if (rrc->srs_enable[CC_id]==1) physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); else physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = NULL; + physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo)); physicalConfigDedicated2->schedulingRequestConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->schedulingRequestConfig)); @@ -1374,7 +1200,6 @@ do_RRCConnectionSetup( physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_ACK_Index = 0; // 2.00 physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_RI_Index = 0; // 1.25 physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_CQI_Index = 8; // 2.25 - // UplinkPowerControlDedicated physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUSCH = 0; // 0 dB //assign_enum(&physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled, @@ -1387,9 +1212,7 @@ do_RRCConnectionSetup( sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient)); // assign_enum(physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient,FilterCoefficient_fc4); // fc4 dB *physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient=FilterCoefficient_fc4; // fc4 dB - // TPC-PDCCH-Config - physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->present=TPC_PDCCH_Config_PR_setup; physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.present = TPC_Index_PR_indexOfFormat3; physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.choice.indexOfFormat3 = 1; @@ -1398,7 +1221,6 @@ do_RRCConnectionSetup( physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf[0]=0x12; physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf[1]=0x34+ue_context_pP->local_uid; physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.bits_unused=0; - physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->present=TPC_PDCCH_Config_PR_setup; physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.present = TPC_Index_PR_indexOfFormat3; physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.choice.indexOfFormat3 = 1; @@ -1407,9 +1229,7 @@ do_RRCConnectionSetup( physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[0]=0x22; physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[1]=0x34+ue_context_pP->local_uid; physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.bits_unused=0; - // CQI ReportConfig - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic)); #if defined(Rel10) || defined(Rel14) *physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic= CQI_ReportModeAperiodic_rm30; @@ -1418,65 +1238,68 @@ do_RRCConnectionSetup( #endif physicalConfigDedicated2->cqi_ReportConfig->nomPDSCH_RS_EPRE_Offset = 0; // 0 dB //physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic=NULL; - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic)); physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = CQI_ReportPeriodic_PR_release; - /* - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = CQI_ReportPeriodic_PR_setup; - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex = 0; // n2_pucch - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex = 0; // Icqi/pmi - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present = CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI; // subband CQI - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.choice.subbandCQI.k=4; + /* + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = CQI_ReportPeriodic_PR_setup; + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex = 0; // n2_pucch + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex = 0; // Icqi/pmi + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present = CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI; // subband CQI + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.choice.subbandCQI.k=4; - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex=NULL; - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI=0; - */ + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex=NULL; + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI=0; + */ //soundingRS-UL-ConfigDedicated if (rrc->srs_enable[CC_id]==1) { physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->present = SoundingRS_UL_ConfigDedicated_PR_setup; physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth = - SoundingRS_UL_ConfigDedicated__setup__srs_Bandwidth_bw0; + SoundingRS_UL_ConfigDedicated__setup__srs_Bandwidth_bw0; physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth = - SoundingRS_UL_ConfigDedicated__setup__srs_HoppingBandwidth_hbw0; + SoundingRS_UL_ConfigDedicated__setup__srs_HoppingBandwidth_hbw0; physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition=0; physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.duration=1; + if (carrier->sib1->tdd_Config==NULL) { // FDD if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present - == SoundingRS_UL_ConfigCommon_PR_setup) - if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig!=0) - LOG_W(RRC,"This code has been optimized for SRS Subframe Config 0, but current config is %zd. Expect undefined behaviour!\n", - carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig); - if (ue_context_pP->local_uid >=20) - LOG_W(RRC,"This code has been optimized for up to 10 UEs, but current UE_id is %d. Expect undefined behaviour!\n", - ue_context_pP->local_uid); + == SoundingRS_UL_ConfigCommon_PR_setup) + if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig!=0) + LOG_W(RRC,"This code has been optimized for SRS Subframe Config 0, but current config is %zd. Expect undefined behaviour!\n", + carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig); + + if (ue_context_pP->local_uid >=20) + LOG_W(RRC,"This code has been optimized for up to 10 UEs, but current UE_id is %d. Expect undefined behaviour!\n", + ue_context_pP->local_uid); + //the current code will allow for 20 UEs - to be revised for more physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=7+ue_context_pP->local_uid/2; physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb= ue_context_pP->local_uid%2; } else { if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present - == SoundingRS_UL_ConfigCommon_PR_setup) - if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig!=7) { - LOG_W(RRC,"This code has been optimized for SRS Subframe Config 7 and TDD config 3, but current configs are %zd and %zd. Expect undefined behaviour!\n", - carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig, - carrier->sib1->tdd_Config->subframeAssignment); - } - if (ue_context_pP->local_uid >=6) - LOG_W(RRC,"This code has been optimized for up to 6 UEs, but current UE_id is %d. Expect undefined behaviour!\n", - ue_context_pP->local_uid); + == SoundingRS_UL_ConfigCommon_PR_setup) + if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig!=7) { + LOG_W(RRC,"This code has been optimized for SRS Subframe Config 7 and TDD config 3, but current configs are %zd and %zd. Expect undefined behaviour!\n", + carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig, + carrier->sib1->tdd_Config->subframeAssignment); + } + + if (ue_context_pP->local_uid >=6) + LOG_W(RRC,"This code has been optimized for up to 6 UEs, but current UE_id is %d. Expect undefined behaviour!\n", + ue_context_pP->local_uid); + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=17+ue_context_pP->local_uid/2; physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb= ue_context_pP->local_uid%2; } + LOG_W(RRC,"local UID %d, srs ConfigIndex %zd, TransmissionComb %zd\n",ue_context_pP->local_uid, - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex, - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb); - + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex, + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb); physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift= - SoundingRS_UL_ConfigDedicated__setup__cyclicShift_cs0; + SoundingRS_UL_ConfigDedicated__setup__cyclicShift_cs0; } - //AntennaInfoDedicated physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo)); physicalConfigDedicated2->antennaInfo->present = PhysicalConfigDedicated__antennaInfo_PR_explicitValue; @@ -1484,53 +1307,51 @@ do_RRCConnectionSetup( // AntennaInfoDedicated__transmissionMode_tm2); switch (transmission_mode) { - default: - LOG_W(RRC,"At RRCConnectionSetup Transmission mode can only take values 1 or 2! Defaulting to 1!\n"); - case 1: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm1; - break; + default: + LOG_W(RRC,"At RRCConnectionSetup Transmission mode can only take values 1 or 2! Defaulting to 1!\n"); - case 2: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm2; - break; - /* - case 3: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm3; - physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction= CALLOC(1, - sizeof(*physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction)); - physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3; - physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1); - physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0; - physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1; - physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6; + case 1: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm1; + break; - break; + case 2: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm2; + break; + /* + case 3: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm3; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction= CALLOC(1, + sizeof(*physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction)); + physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1); + physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6; - case 4: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm4; - break; + break; - case 5: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm5; - break; + case 4: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm4; + break; - case 6: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm6; - break; + case 5: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm5; + break; - case 7: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm7; - break; - */ + case 6: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm6; + break; + + case 7: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm7; + break; + */ } - physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.present = AntennaInfoDedicated__ue_TransmitAntennaSelection_PR_release; physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.release = 0; - // SchedulingRequestConfig - physicalConfigDedicated2->schedulingRequestConfig->present = SchedulingRequestConfig_PR_setup; physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 71 - ue_context_pP->local_uid/10;//ue_context_pP->local_uid; @@ -1538,24 +1359,24 @@ do_RRCConnectionSetup( physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 5+(ue_context_pP->local_uid%10); // Isr = 5 (every 10 subframes, offset=2+UE_id mod3) } else { switch (carrier->sib1->tdd_Config->subframeAssignment) { - case 1: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+(ue_context_pP->local_uid&1)+(( - ue_context_pP->local_uid&3)>>1)*5; // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 7 for UE2, 8 for UE3 , 2 for UE4 etc..) - break; + case 1: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+(ue_context_pP->local_uid&1)+(( + ue_context_pP->local_uid&3)>>1)*5; // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 7 for UE2, 8 for UE3 , 2 for UE4 etc..) + break; - case 3: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+ - (ue_context_pP->local_uid%3); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) - break; + case 3: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+ + (ue_context_pP->local_uid%3); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) + break; - case 4: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+ - (ue_context_pP->local_uid&1); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) - break; + case 4: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+ + (ue_context_pP->local_uid&1); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) + break; - default: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7; // Isr = 5 (every 10 subframes, offset=2 for all UE0 etc..) - break; + default: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7; // Isr = 5 (every 10 subframes, offset=2 for all UE0 etc..) + break; } } @@ -1563,7 +1384,6 @@ do_RRCConnectionSetup( //SchedulingRequestConfig__setup__dsr_TransMax_n4); // assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = SchedulingRequestConfig__setup__dsr_TransMax_n4; physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = SchedulingRequestConfig__setup__dsr_TransMax_n4; - rrcConnectionSetup->rrc_TransactionIdentifier = Transaction_id; rrcConnectionSetup->criticalExtensions.present = RRCConnectionSetup__criticalExtensions_PR_c1; rrcConnectionSetup->criticalExtensions.choice.c1.present =RRCConnectionSetup__criticalExtensions__c1_PR_rrcConnectionSetup_r8 ; @@ -1582,18 +1402,16 @@ do_RRCConnectionSetup( physicalConfigDedicated2->pusch_CBAConfigDedicated_vlola->cShift_CBA=cShift_CBA; rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.sps_CBA_ConfigList_vlola = NULL; #endif - - #ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg); + xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void *)&dl_ccch_msg); #endif enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message, - (void*)&dl_ccch_msg, + NULL, + (void *)&dl_ccch_msg, buffer, 100); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - #if defined(ENABLE_ITTI) # if !defined(DISABLE_XER_SPRINT) { @@ -1602,34 +1420,29 @@ do_RRCConnectionSetup( if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message, (void *) &dl_ccch_msg)) > 0) { MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); } } # endif #endif - LOG_D(RRC,"RRCConnectionSetup Encoded %zd bits (%zd bytes), ecause %d\n", enc_rval.encoded,(enc_rval.encoded+7)/8,ecause); - // FREEMEM(SRB_list); // free(SRB1_config); // free(SRB1_rlc_config); // free(SRB1_lchan_config); // free(SRB1_ul_SpecificParameters); - return((enc_rval.encoded+7)/8); } //------------------------------------------------------------------------------ uint8_t do_SecurityModeCommand( - const protocol_ctxt_t* const ctxt_pP, - uint8_t* const buffer, + const protocol_ctxt_t *const ctxt_pP, + uint8_t *const buffer, const uint8_t Transaction_id, const uint8_t cipheringAlgorithm, const uint8_t integrityProtAlgorithm @@ -1638,15 +1451,11 @@ do_SecurityModeCommand( { DL_DCCH_Message_t dl_dcch_msg; asn_enc_rval_t enc_rval; - memset(&dl_dcch_msg,0,sizeof(DL_DCCH_Message_t)); - dl_dcch_msg.message.present = DL_DCCH_MessageType_PR_c1; dl_dcch_msg.message.choice.c1.present = DL_DCCH_MessageType__c1_PR_securityModeCommand; - dl_dcch_msg.message.choice.c1.choice.securityModeCommand.rrc_TransactionIdentifier = Transaction_id; dl_dcch_msg.message.choice.c1.choice.securityModeCommand.criticalExtensions.present = SecurityModeCommand__criticalExtensions_PR_c1; - dl_dcch_msg.message.choice.c1.choice.securityModeCommand.criticalExtensions.choice.c1.present = SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8; // the two following information could be based on the mod_id @@ -1654,17 +1463,16 @@ do_SecurityModeCommand( = (CipheringAlgorithm_r12_t)cipheringAlgorithm; dl_dcch_msg.message.choice.c1.choice.securityModeCommand.criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm = (e_SecurityAlgorithmConfig__integrityProtAlgorithm)integrityProtAlgorithm; - #ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_DL_DCCH_Message, (void*)&dl_dcch_msg); + xer_fprint(stdout, &asn_DEF_DL_DCCH_Message, (void *)&dl_dcch_msg); #endif enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, - (void*)&dl_dcch_msg, + NULL, + (void *)&dl_dcch_msg, buffer, 100); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - #if defined(ENABLE_ITTI) # if !defined(DISABLE_XER_SPRINT) { @@ -1673,17 +1481,14 @@ do_SecurityModeCommand( if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message, (void *) &dl_dcch_msg)) > 0) { MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); } } # endif #endif - LOG_D(RRC,"[eNB %d] securityModeCommand for UE %x Encoded %zd bits (%zd bytes)\n", ctxt_pP->module_id, ctxt_pP->rnti, @@ -1705,42 +1510,35 @@ do_SecurityModeCommand( //------------------------------------------------------------------------------ uint8_t do_UECapabilityEnquiry( - const protocol_ctxt_t* const ctxt_pP, - uint8_t* const buffer, + const protocol_ctxt_t *const ctxt_pP, + uint8_t *const buffer, const uint8_t Transaction_id ) //------------------------------------------------------------------------------ { - DL_DCCH_Message_t dl_dcch_msg; - RAT_Type_t rat=RAT_Type_eutra; asn_enc_rval_t enc_rval; - memset(&dl_dcch_msg,0,sizeof(DL_DCCH_Message_t)); - dl_dcch_msg.message.present = DL_DCCH_MessageType_PR_c1; dl_dcch_msg.message.choice.c1.present = DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry; - dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.rrc_TransactionIdentifier = Transaction_id; - dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.present = UECapabilityEnquiry__criticalExtensions_PR_c1; dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.present = UECapabilityEnquiry__criticalExtensions__c1_PR_ueCapabilityEnquiry_r8; dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.count=0; ASN_SEQUENCE_ADD(&dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list, &rat); - #ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_DL_DCCH_Message, (void*)&dl_dcch_msg); + xer_fprint(stdout, &asn_DEF_DL_DCCH_Message, (void *)&dl_dcch_msg); #endif enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, - (void*)&dl_dcch_msg, + NULL, + (void *)&dl_dcch_msg, buffer, 100); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - #if defined(ENABLE_ITTI) # if !defined(DISABLE_XER_SPRINT) { @@ -1749,17 +1547,14 @@ do_UECapabilityEnquiry( if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message, (void *) &dl_dcch_msg)) > 0) { MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); } } # endif #endif - LOG_D(RRC,"[eNB %d] UECapabilityRequest for UE %x Encoded %zd bits (%zd bytes)\n", ctxt_pP->module_id, ctxt_pP->rnti, @@ -1779,7 +1574,7 @@ do_UECapabilityEnquiry( //------------------------------------------------------------------------------ uint16_t do_RRCConnectionReconfiguration( - const protocol_ctxt_t* const ctxt_pP, + const protocol_ctxt_t *const ctxt_pP, uint8_t *buffer, uint8_t Transaction_id, SRB_ToAddModList_t *SRB_list, @@ -1806,24 +1601,17 @@ do_RRCConnectionReconfiguration( ) //------------------------------------------------------------------------------ { - asn_enc_rval_t enc_rval; - DL_DCCH_Message_t dl_dcch_msg; RRCConnectionReconfiguration_t *rrcConnectionReconfiguration; - - memset(&dl_dcch_msg,0,sizeof(DL_DCCH_Message_t)); - dl_dcch_msg.message.present = DL_DCCH_MessageType_PR_c1; dl_dcch_msg.message.choice.c1.present = DL_DCCH_MessageType__c1_PR_rrcConnectionReconfiguration; rrcConnectionReconfiguration = &dl_dcch_msg.message.choice.c1.choice.rrcConnectionReconfiguration; - // RRCConnectionReconfiguration rrcConnectionReconfiguration->rrc_TransactionIdentifier = Transaction_id; rrcConnectionReconfiguration->criticalExtensions.present = RRCConnectionReconfiguration__criticalExtensions_PR_c1; rrcConnectionReconfiguration->criticalExtensions.choice.c1.present =RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8 ; - rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated = CALLOC(1, sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated)); rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList = SRB_list; @@ -1850,9 +1638,8 @@ do_RRCConnectionReconfiguration( if (MeasId_list != NULL) { rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig = CALLOC(1, sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig)); - memset((void*)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig, + memset((void *)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig, 0, sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig)); - rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; @@ -1884,27 +1671,24 @@ do_RRCConnectionReconfiguration( if (mobilityInfo !=NULL) { rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo = CALLOC(1, sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo)); - memcpy((void*)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo, (void*)mobilityInfo, + memcpy((void *)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo, (void *)mobilityInfo, sizeof(MobilityControlInfo_t)); - } else { rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo = NULL; } rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.dedicatedInfoNASList = dedicatedInfoNASList; rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.securityConfigHO = NULL; - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, - (void*)&dl_dcch_msg, + NULL, + (void *)&dl_dcch_msg, buffer, RRC_BUF_SIZE); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %zd)!\n", enc_rval.failed_type->name, enc_rval.encoded); - #ifdef XER_PRINT - xer_fprint(stdout,&asn_DEF_DL_DCCH_Message,(void*)&dl_dcch_msg); + xer_fprint(stdout,&asn_DEF_DL_DCCH_Message,(void *)&dl_dcch_msg); #endif - #if defined(ENABLE_ITTI) # if !defined(DISABLE_XER_SPRINT) { @@ -1913,67 +1697,58 @@ do_RRCConnectionReconfiguration( if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message, (void *) &dl_dcch_msg)) > 0) { MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); } } # endif #endif - LOG_I(RRC,"RRCConnectionReconfiguration Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); // for (i=0;i<30;i++) // msg("%x.",buffer[i]); // msg("\n"); - - return((enc_rval.encoded+7)/8); } //------------------------------------------------------------------------------ uint8_t do_RRCConnectionReestablishment( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, int CC_id, - uint8_t* const buffer, + uint8_t *const buffer, const uint8_t transmission_mode, const uint8_t Transaction_id, SRB_ToAddModList_t **SRB_configList, struct PhysicalConfigDedicated **physicalConfigDedicated) { asn_enc_rval_t enc_rval; - - long* logicalchannelgroup = NULL; - struct SRB_ToAddMod* SRB1_config = NULL; - struct SRB_ToAddMod* SRB2_config = NULL; - struct SRB_ToAddMod__rlc_Config* SRB1_rlc_config = NULL; - struct SRB_ToAddMod__logicalChannelConfig* SRB1_lchan_config = NULL; - struct LogicalChannelConfig__ul_SpecificParameters* SRB1_ul_SpecificParameters = NULL; + long *logicalchannelgroup = NULL; + struct SRB_ToAddMod *SRB1_config = NULL; + struct SRB_ToAddMod *SRB2_config = NULL; + struct SRB_ToAddMod__rlc_Config *SRB1_rlc_config = NULL; + struct SRB_ToAddMod__logicalChannelConfig *SRB1_lchan_config = NULL; + struct LogicalChannelConfig__ul_SpecificParameters *SRB1_ul_SpecificParameters = NULL; eNB_RRC_INST *rrc = RC.rrc[ctxt_pP->module_id]; - #ifdef CBA - struct PUSCH_CBAConfigDedicated_vlola* pusch_CBAConfigDedicated_vlola = NULL; - long* betaOffset_CBA_Index = NULL; - long* cShift_CBA = NULL; + struct PUSCH_CBAConfigDedicated_vlola *pusch_CBAConfigDedicated_vlola = NULL; + long *betaOffset_CBA_Index = NULL; + long *cShift_CBA = NULL; #endif - PhysicalConfigDedicated_t* physicalConfigDedicated2 = NULL; - + PhysicalConfigDedicated_t *physicalConfigDedicated2 = NULL; DL_CCCH_Message_t dl_ccch_msg; - - RRCConnectionReestablishment_t* rrcConnectionReestablishment = NULL; - + RRCConnectionReestablishment_t *rrcConnectionReestablishment = NULL; int i = 0; SRB_ToAddModList_t **SRB_configList2 = NULL; SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[Transaction_id]; + if (*SRB_configList2) { free(*SRB_configList2); } - *SRB_configList2 = CALLOC(1, sizeof(SRB_ToAddModList_t)); + *SRB_configList2 = CALLOC(1, sizeof(SRB_ToAddModList_t)); memset((void *)&dl_ccch_msg, 0, sizeof(DL_CCCH_Message_t)); dl_ccch_msg.message.present = DL_CCCH_MessageType_PR_c1; dl_ccch_msg.message.choice.c1.present = DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishment; @@ -1982,15 +1757,15 @@ do_RRCConnectionReestablishment( // RRCConnectionReestablishment // Configure SRB1 - // get old configuration of SRB2 if (*SRB_configList != NULL) { for (i = 0; (i < (*SRB_configList)->list.count) && (i < 3); i++) { LOG_D(RRC, "(*SRB_configList)->list.array[%d]->srb_Identity=%ld\n", - i, (*SRB_configList)->list.array[i]->srb_Identity); - if ((*SRB_configList)->list.array[i]->srb_Identity == 2 ){ + i, (*SRB_configList)->list.array[i]->srb_Identity); + + if ((*SRB_configList)->list.array[i]->srb_Identity == 2 ) { SRB2_config = (*SRB_configList)->list.array[i]; - } else if ((*SRB_configList)->list.array[i]->srb_Identity == 1 ){ + } else if ((*SRB_configList)->list.array[i]->srb_Identity == 1 ) { SRB1_config = (*SRB_configList)->list.array[i]; } } @@ -2001,44 +1776,36 @@ do_RRCConnectionReestablishment( LOG_W(RRC,"SRB1 configuration does not exist in SRB configuration list, use default\n"); /// SRB1 SRB1_config = CALLOC(1, sizeof(*SRB1_config)); - SRB1_config->srb_Identity = 1; SRB1_rlc_config = CALLOC(1, sizeof(*SRB1_rlc_config)); SRB1_config->rlc_Config = SRB1_rlc_config; - SRB1_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; SRB1_rlc_config->choice.explicitValue.present=RLC_Config_PR_am; - #if defined(ENABLE_ITTI) +#if defined(ENABLE_ITTI) SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = rrc->srb1_timer_poll_retransmit; SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = rrc->srb1_poll_pdu; SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = rrc->srb1_poll_byte; SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = rrc->srb1_max_retx_threshold; SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = rrc->srb1_timer_reordering; SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = rrc->srb1_timer_status_prohibit; - #else +#else SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms20;; SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p4;; SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms0; - #endif - +#endif SRB1_lchan_config = CALLOC(1, sizeof(*SRB1_lchan_config)); SRB1_config->logicalChannelConfig = SRB1_lchan_config; - SRB1_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; SRB1_ul_SpecificParameters = CALLOC(1, sizeof(*SRB1_ul_SpecificParameters)); - SRB1_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB1_ul_SpecificParameters; SRB1_ul_SpecificParameters->priority = 1; - //assign_enum(&SRB1_ul_SpecificParameters->prioritisedBitRate,LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity); SRB1_ul_SpecificParameters->prioritisedBitRate=LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; - //assign_enum(&SRB1_ul_SpecificParameters->bucketSizeDuration,LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50); SRB1_ul_SpecificParameters->bucketSizeDuration=LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - logicalchannelgroup = CALLOC(1, sizeof(long)); *logicalchannelgroup = 0; SRB1_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; @@ -2055,11 +1822,8 @@ do_RRCConnectionReestablishment( } *SRB_configList = CALLOC(1, sizeof(SRB_ToAddModList_t)); - ASN_SEQUENCE_ADD(&(*SRB_configList)->list,SRB1_config); - physicalConfigDedicated2 = *physicalConfigDedicated; - rrcConnectionReestablishment->rrc_TransactionIdentifier = Transaction_id; rrcConnectionReestablishment->criticalExtensions.present = RRCConnectionReestablishment__criticalExtensions_PR_c1; rrcConnectionReestablishment->criticalExtensions.choice.c1.present = RRCConnectionReestablishment__criticalExtensions__c1_PR_rrcConnectionReestablishment_r8; @@ -2069,27 +1833,28 @@ do_RRCConnectionReestablishment( rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.radioResourceConfigDedicated.sps_Config = NULL; rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.radioResourceConfigDedicated.physicalConfigDedicated = physicalConfigDedicated2; rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.radioResourceConfigDedicated.mac_MainConfig = NULL; - uint8_t KeNB_star[32] = { 0 }; uint16_t pci = rrc->carrier[CC_id].physCellId; uint32_t earfcn_dl = (uint32_t)freq_to_arfcn10(RC.mac[ctxt_pP->module_id]->common_channels[CC_id].eutra_band, - rrc->carrier[CC_id].dl_CarrierFreq); + rrc->carrier[CC_id].dl_CarrierFreq); bool is_rel8_only = true; + if (earfcn_dl > 65535) { is_rel8_only = false; } LOG_D(RRC, "pci=%d, eutra_band=%d, downlink_frequency=%d, earfcn_dl=%u, is_rel8_only=%s\n", - pci, - RC.mac[ctxt_pP->module_id]->common_channels[CC_id].eutra_band, - rrc->carrier[CC_id].dl_CarrierFreq, - earfcn_dl, - is_rel8_only == true ? "true": "false"); + pci, + RC.mac[ctxt_pP->module_id]->common_channels[CC_id].eutra_band, + rrc->carrier[CC_id].dl_CarrierFreq, + earfcn_dl, + is_rel8_only == true ? "true": "false"); #if defined(ENABLE_SECURITY) + if (ue_context_pP->ue_context.nh_ncc >= 0) { derive_keNB_star(ue_context_pP->ue_context.nh, pci, earfcn_dl, is_rel8_only, KeNB_star); rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.nextHopChainingCount = ue_context_pP->ue_context.nh_ncc; - } else { // first HO + } else { // first HO derive_keNB_star (ue_context_pP->ue_context.kenb, pci, earfcn_dl, is_rel8_only, KeNB_star); // LG: really 1 rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.nextHopChainingCount = 0; @@ -2101,19 +1866,17 @@ do_RRCConnectionReestablishment( #else rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.nextHopChainingCount = 0; #endif - rrcConnectionReestablishment->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r8.nonCriticalExtension = NULL; - #ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg); + xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void *)&dl_ccch_msg); #endif enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message, - (void*)&dl_ccch_msg, + NULL, + (void *)&dl_ccch_msg, buffer, 100); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - #if defined(ENABLE_ITTI) # if !defined(DISABLE_XER_SPRINT) { @@ -2122,22 +1885,18 @@ do_RRCConnectionReestablishment( if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message, (void *) &dl_ccch_msg)) > 0) { MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); } } # endif #endif - #ifdef USER_MODE LOG_D(RRC,"RRCConnectionReestablishment Encoded %zd bits (%zd bytes)\n", enc_rval.encoded,(enc_rval.encoded+7)/8); #endif - return((enc_rval.encoded+7)/8); } @@ -2145,33 +1904,28 @@ do_RRCConnectionReestablishment( uint8_t do_RRCConnectionReestablishmentReject( uint8_t Mod_id, - uint8_t* const buffer) + uint8_t *const buffer) //------------------------------------------------------------------------------ { - asn_enc_rval_t enc_rval; - DL_CCCH_Message_t dl_ccch_msg; RRCConnectionReestablishmentReject_t *rrcConnectionReestablishmentReject; - memset((void *)&dl_ccch_msg,0,sizeof(DL_CCCH_Message_t)); dl_ccch_msg.message.present = DL_CCCH_MessageType_PR_c1; dl_ccch_msg.message.choice.c1.present = DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentReject; rrcConnectionReestablishmentReject = &dl_ccch_msg.message.choice.c1.choice.rrcConnectionReestablishmentReject; - // RRCConnectionReestablishmentReject rrcConnectionReestablishmentReject->criticalExtensions.present = RRCConnectionReestablishmentReject__criticalExtensions_PR_rrcConnectionReestablishmentReject_r8; - #ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg); + xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void *)&dl_ccch_msg); #endif enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message, - (void*)&dl_ccch_msg, + NULL, + (void *)&dl_ccch_msg, buffer, 100); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - #if defined(ENABLE_ITTI) # if !defined(DISABLE_XER_SPRINT) { @@ -2180,20 +1934,16 @@ do_RRCConnectionReestablishmentReject( if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message, (void *) &dl_ccch_msg)) > 0) { MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); } } # endif #endif - LOG_D(RRC,"RRCConnectionReestablishmentReject Encoded %zd bits (%zd bytes)\n", enc_rval.encoded,(enc_rval.encoded+7)/8); - return((enc_rval.encoded+7)/8); } @@ -2201,36 +1951,31 @@ do_RRCConnectionReestablishmentReject( uint8_t do_RRCConnectionReject( uint8_t Mod_id, - uint8_t* const buffer) + uint8_t *const buffer) //------------------------------------------------------------------------------ { - asn_enc_rval_t enc_rval; - DL_CCCH_Message_t dl_ccch_msg; RRCConnectionReject_t *rrcConnectionReject; - memset((void *)&dl_ccch_msg,0,sizeof(DL_CCCH_Message_t)); dl_ccch_msg.message.present = DL_CCCH_MessageType_PR_c1; dl_ccch_msg.message.choice.c1.present = DL_CCCH_MessageType__c1_PR_rrcConnectionReject; rrcConnectionReject = &dl_ccch_msg.message.choice.c1.choice.rrcConnectionReject; - // RRCConnectionReject rrcConnectionReject->criticalExtensions.present = RRCConnectionReject__criticalExtensions_PR_c1; rrcConnectionReject->criticalExtensions.choice.c1.present = RRCConnectionReject__criticalExtensions__c1_PR_rrcConnectionReject_r8; /* let's put a wait time of 1s for the moment */ rrcConnectionReject->criticalExtensions.choice.c1.choice.rrcConnectionReject_r8.waitTime = 1; - #ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg); + xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void *)&dl_ccch_msg); #endif enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message, - (void*)&dl_ccch_msg, + NULL, + (void *)&dl_ccch_msg, buffer, 100); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %ld)!\n", enc_rval.failed_type->name, enc_rval.encoded); - #if defined(ENABLE_ITTI) # if !defined(DISABLE_XER_SPRINT) { @@ -2239,20 +1984,16 @@ do_RRCConnectionReject( if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message, (void *) &dl_ccch_msg)) > 0) { MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); } } # endif #endif - LOG_D(RRC,"RRCConnectionReject Encoded %zd bits (%zd bytes)\n", enc_rval.encoded,(enc_rval.encoded+7)/8); - return((enc_rval.encoded+7)/8); } @@ -2261,36 +2002,27 @@ uint8_t do_RRCConnectionRelease( uint8_t *buffer, uint8_t Transaction_id) { - asn_enc_rval_t enc_rval; - DL_DCCH_Message_t dl_dcch_msg; RRCConnectionRelease_t *rrcConnectionRelease; - - memset(&dl_dcch_msg,0,sizeof(DL_DCCH_Message_t)); - dl_dcch_msg.message.present = DL_DCCH_MessageType_PR_c1; dl_dcch_msg.message.choice.c1.present = DL_DCCH_MessageType__c1_PR_rrcConnectionRelease; rrcConnectionRelease = &dl_dcch_msg.message.choice.c1.choice.rrcConnectionRelease; - // RRCConnectionRelease rrcConnectionRelease->rrc_TransactionIdentifier = Transaction_id; rrcConnectionRelease->criticalExtensions.present = RRCConnectionRelease__criticalExtensions_PR_c1; rrcConnectionRelease->criticalExtensions.choice.c1.present =RRCConnectionRelease__criticalExtensions__c1_PR_rrcConnectionRelease_r8 ; - rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.releaseCause = ReleaseCause_other; rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.redirectedCarrierInfo = NULL; rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.idleModeMobilityControlInfo = NULL; - rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.nonCriticalExtension=CALLOC(1, sizeof(*rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.nonCriticalExtension)); - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, - (void*)&dl_dcch_msg, + NULL, + (void *)&dl_dcch_msg, buffer, RRC_BUF_SIZE); - return((enc_rval.encoded+7)/8); } @@ -2304,7 +2036,6 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, MCCH_Message_t *mcch_message, MBSFNAreaConfiguration_r9_t **mbsfnAreaConfiguration) { - asn_enc_rval_t enc_rval; MBSFN_SubframeConfig_t *mbsfn_SubframeConfig1; PMCH_Info_r9_t *pmch_Info_1; @@ -2312,17 +2043,13 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, // MBMS_SessionInfo_r9_t *mbms_Session_2; eNB_RRC_INST *rrc = RC.rrc[Mod_id]; rrc_eNB_carrier_data_t *carrier = &rrc->carrier[0]; - - memset(mcch_message,0,sizeof(MCCH_Message_t)); mcch_message->message.present = MCCH_MessageType_PR_c1; mcch_message->message.choice.c1.present = MCCH_MessageType__c1_PR_mbsfnAreaConfiguration_r9; *mbsfnAreaConfiguration = &mcch_message->message.choice.c1.choice.mbsfnAreaConfiguration_r9; - // Common Subframe Allocation (CommonSF-Alloc-r9) - mbsfn_SubframeConfig1= CALLOC(1,sizeof(*mbsfn_SubframeConfig1)); - memset((void*)mbsfn_SubframeConfig1,0,sizeof(*mbsfn_SubframeConfig1)); + memset((void *)mbsfn_SubframeConfig1,0,sizeof(*mbsfn_SubframeConfig1)); // mbsfn_SubframeConfig1->radioframeAllocationPeriod= MBSFN_SubframeConfig__radioframeAllocationPeriod_n4; mbsfn_SubframeConfig1->radioframeAllocationOffset= 1; @@ -2333,36 +2060,33 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, // CURRENTLY WE ARE SUPPORITNG ONLY ONE sf ALLOCATION switch (sync_area) { - case 0: - if (carrier->sib1->tdd_Config != NULL) {// pattern 001110 for TDD - mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x08<<2;// shift 2bits cuz 2last bits are unused. - } else { //111000 - mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x38<<2; - } + case 0: + if (carrier->sib1->tdd_Config != NULL) {// pattern 001110 for TDD + mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x08<<2;// shift 2bits cuz 2last bits are unused. + } else { //111000 + mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x38<<2; + } - break; + break; - case 1: - if (carrier->sib1->tdd_Config != NULL) { - mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x08<<2;// shift 2bits cuz 2last bits are unused. - } else { // 000111 - mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x07<<2; - } + case 1: + if (carrier->sib1->tdd_Config != NULL) { + mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x08<<2;// shift 2bits cuz 2last bits are unused. + } else { // 000111 + mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x07<<2; + } - default : - break; + default : + break; } ASN_SEQUENCE_ADD(&(*mbsfnAreaConfiguration)->commonSF_Alloc_r9.list,mbsfn_SubframeConfig1); - // commonSF-AllocPeriod-r9 (*mbsfnAreaConfiguration)->commonSF_AllocPeriod_r9= MBSFNAreaConfiguration_r9__commonSF_AllocPeriod_r9_rf16; - // PMCHs Information List (PMCH-InfoList-r9) // PMCH_1 Config pmch_Info_1 = CALLOC(1,sizeof(PMCH_Info_r9_t)); - memset((void*)pmch_Info_1,0,sizeof(PMCH_Info_r9_t)); - + memset((void *)pmch_Info_1,0,sizeof(PMCH_Info_r9_t)); /* * take the value of last mbsfn subframe in this CSA period because there is only one PMCH in this mbsfn area * Note: this has to be set based on the subframeAllocation and CSA @@ -2370,7 +2094,6 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, pmch_Info_1->pmch_Config_r9.sf_AllocEnd_r9= 3; pmch_Info_1->pmch_Config_r9.dataMCS_r9= 7; pmch_Info_1->pmch_Config_r9.mch_SchedulingPeriod_r9= PMCH_Config_r9__mch_SchedulingPeriod_r9_rf16; - // MBMSs-SessionInfoList-r9 // pmch_Info_1->mbms_SessionInfoList_r9 = CALLOC(1,sizeof(struct MBMS_SessionInfoList_r9)); // Session 1 @@ -2381,7 +2104,7 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, mbms_Session_1->tmgi_r9.plmn_Id_r9.choice.plmn_Index_r9= 1; // Service ID memset(&mbms_Session_1->tmgi_r9.serviceId_r9,0,sizeof(OCTET_STRING_t));// need to check - OCTET_STRING_fromBuf(&mbms_Session_1->tmgi_r9.serviceId_r9,(const char*)&TMGI[2],3); + OCTET_STRING_fromBuf(&mbms_Session_1->tmgi_r9.serviceId_r9,(const char *)&TMGI[2],3); // Session ID is still missing here, it can be used as an rab id or mrb id mbms_Session_1->sessionId_r9 = CALLOC(1,sizeof(OCTET_STRING_t)); mbms_Session_1->sessionId_r9->buf= MALLOC(1); @@ -2390,7 +2113,6 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, // Logical Channel ID mbms_Session_1->logicalChannelIdentity_r9= MTCH; ASN_SEQUENCE_ADD(&pmch_Info_1->mbms_SessionInfoList_r9.list,mbms_Session_1); - /* // Session 2 //mbms_Session_2 = CALLOC(1,sizeof(MBMS_SessionInfo_r9_t)); memset(mbms_Session_2,0,sizeof(MBMS_SessionInfo_r9_t)); @@ -2409,17 +2131,16 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, ASN_SEQUENCE_ADD(&pmch_Info_1->mbms_SessionInfoList_r9.list,mbms_Session_2); */ ASN_SEQUENCE_ADD(&(*mbsfnAreaConfiguration)->pmch_InfoList_r9.list,pmch_Info_1); - #ifdef XER_PRINT - xer_fprint(stdout,&asn_DEF_MCCH_Message,(void*)mcch_message); + xer_fprint(stdout,&asn_DEF_MCCH_Message,(void *)mcch_message); #endif enc_rval = uper_encode_to_buffer(&asn_DEF_MCCH_Message, - (void*)mcch_message, + NULL, + (void *)mcch_message, buffer, 100); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - #if defined(ENABLE_ITTI) # if !defined(DISABLE_XER_SPRINT) { @@ -2428,17 +2149,14 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_MCCH_Message, (void *) &mcch_message)) > 0) { MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_MCCH, message_string_size); msg_p->ittiMsg.rrc_dl_mcch.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_dl_mcch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); } } # endif #endif - LOG_D(RRC,"[eNB] MCCH Message Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); if (enc_rval.encoded==-1) { @@ -2452,22 +2170,16 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_id,long rsrp_s,long rsrq_s,long rsrp_t,long rsrq_t) { - asn_enc_rval_t enc_rval; - UL_DCCH_Message_t ul_dcch_msg; - MeasurementReport_t *measurementReport; - ul_dcch_msg.message.present = UL_DCCH_MessageType_PR_c1; ul_dcch_msg.message.choice.c1.present = UL_DCCH_MessageType__c1_PR_measurementReport; measurementReport = &ul_dcch_msg.message.choice.c1.choice.measurementReport; - measurementReport->criticalExtensions.present=MeasurementReport__criticalExtensions_PR_c1; measurementReport->criticalExtensions.choice.c1.present=MeasurementReport__criticalExtensions__c1_PR_measurementReport_r8; measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.nonCriticalExtension=CALLOC(1, sizeof(*measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.nonCriticalExtension)); - measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measId=measid; #if defined(Rel10) || defined(Rel14) measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultPCell.rsrpResult=rsrp_s; @@ -2479,24 +2191,17 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_ measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells=CALLOC(1, sizeof(*measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells)); measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->present=MeasResults__measResultNeighCells_PR_measResultListEUTRA; - MeasResultListEUTRA_t *measResultListEUTRA2; measResultListEUTRA2 = CALLOC(1,sizeof(*measResultListEUTRA2)); - struct MeasResultEUTRA *measresulteutra2; measresulteutra2 = CALLOC(1,sizeof(*measresulteutra2)); measresulteutra2->physCellId=phy_id;//1; - struct MeasResultEUTRA__cgi_Info *measresult_cgi2; measresult_cgi2 = CALLOC(1,sizeof(*measresult_cgi2)); - memset(&measresult_cgi2->cellGlobalId.plmn_Identity,0,sizeof(measresult_cgi2->cellGlobalId.plmn_Identity)); - // measresult_cgi2->cellGlobalId.plmn_Identity.mcc=CALLOC(1,sizeof(measresult_cgi2->cellGlobalId.plmn_Identity.mcc)); measresult_cgi2->cellGlobalId.plmn_Identity.mcc = CALLOC(1, sizeof(*measresult_cgi2->cellGlobalId.plmn_Identity.mcc)); - asn_set_empty(&measresult_cgi2->cellGlobalId.plmn_Identity.mcc->list);//.size=0; - MCC_MNC_Digit_t dummy; dummy=2; ASN_SEQUENCE_ADD(&measresult_cgi2->cellGlobalId.plmn_Identity.mcc->list,&dummy); @@ -2504,14 +2209,12 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_ ASN_SEQUENCE_ADD(&measresult_cgi2->cellGlobalId.plmn_Identity.mcc->list,&dummy); dummy=2; ASN_SEQUENCE_ADD(&measresult_cgi2->cellGlobalId.plmn_Identity.mcc->list,&dummy); - measresult_cgi2->cellGlobalId.plmn_Identity.mnc.list.size=0; measresult_cgi2->cellGlobalId.plmn_Identity.mnc.list.count=0; dummy=8; ASN_SEQUENCE_ADD(&measresult_cgi2->cellGlobalId.plmn_Identity.mnc.list,&dummy); dummy=0; ASN_SEQUENCE_ADD(&measresult_cgi2->cellGlobalId.plmn_Identity.mnc.list,&dummy); - measresult_cgi2->cellGlobalId.cellIdentity.buf=MALLOC(8); measresult_cgi2->cellGlobalId.cellIdentity.buf[0]=0x01; measresult_cgi2->cellGlobalId.cellIdentity.buf[1]=0x48; @@ -2519,39 +2222,27 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_ measresult_cgi2->cellGlobalId.cellIdentity.buf[3]=0x03; measresult_cgi2->cellGlobalId.cellIdentity.size=4; measresult_cgi2->cellGlobalId.cellIdentity.bits_unused=4; - measresult_cgi2->trackingAreaCode.buf = MALLOC(2); measresult_cgi2->trackingAreaCode.buf[0]=0x00; measresult_cgi2->trackingAreaCode.buf[1]=0x10; measresult_cgi2->trackingAreaCode.size=2; measresult_cgi2->trackingAreaCode.bits_unused=0; - - measresulteutra2->cgi_Info=measresult_cgi2; - struct MeasResultEUTRA__measResult meas2; // int rsrp_va=10; - meas2.rsrpResult=&(rsrp_t); //&rsrp_va; meas2.rsrqResult=&(rsrq_t); - measresulteutra2->measResult=meas2; - ASN_SEQUENCE_ADD(&measResultListEUTRA2->list,measresulteutra2); - measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->choice.measResultListEUTRA=*(measResultListEUTRA2); - enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, - (void*)&ul_dcch_msg, + NULL, + (void *)&ul_dcch_msg, buffer, 100); - - - AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - #if defined(ENABLE_ITTI) # if !defined(DISABLE_XER_SPRINT) { @@ -2560,30 +2251,23 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_ if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, NB_eNB_INST + Mod_id, msg_p); } } # endif #endif - printf("Measurement Report Encoded %zu bits (%zu bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); - return((enc_rval.encoded+7)/8); } uint8_t do_DLInformationTransfer(uint8_t Mod_id, uint8_t **buffer, uint8_t transaction_id, uint32_t pdu_length, uint8_t *pdu_buffer) { ssize_t encoded; - DL_DCCH_Message_t dl_dcch_msg; - memset(&dl_dcch_msg, 0, sizeof(DL_DCCH_Message_t)); - dl_dcch_msg.message.present = DL_DCCH_MessageType_PR_c1; dl_dcch_msg.message.choice.c1.present = DL_DCCH_MessageType__c1_PR_dlInformationTransfer; dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.rrc_TransactionIdentifier = transaction_id; @@ -2593,12 +2277,10 @@ uint8_t do_DLInformationTransfer(uint8_t Mod_id, uint8_t **buffer, uint8_t trans DLInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS; dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType.choice.dedicatedInfoNAS.size = pdu_length; dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType.choice.dedicatedInfoNAS.buf = pdu_buffer; - - encoded = uper_encode_to_new_buffer (&asn_DEF_DL_DCCH_Message, NULL, (void*) &dl_dcch_msg, (void **) buffer); - + encoded = uper_encode_to_new_buffer (&asn_DEF_DL_DCCH_Message, NULL, (void *) &dl_dcch_msg, (void **) buffer); /* -#if defined(ENABLE_ITTI) -# if !defined(DISABLE_XER_SPRINT) + #if defined(ENABLE_ITTI) + # if !defined(DISABLE_XER_SPRINT) { char message_string[10000]; size_t message_string_size; @@ -2613,10 +2295,9 @@ uint8_t do_DLInformationTransfer(uint8_t Mod_id, uint8_t **buffer, uint8_t trans itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); } } -# endif -#endif + # endif + #endif */ - return encoded; } @@ -2624,20 +2305,15 @@ uint8_t do_Paging(uint8_t Mod_id, uint8_t *buffer, ue_paging_identity_t ue_pagin { LOG_D(RRC, "[eNB %d] do_Paging start\n", Mod_id); asn_enc_rval_t enc_rval; - PCCH_Message_t pcch_msg; PagingRecord_t *paging_record_p; int j; - pcch_msg.message.present = PCCH_MessageType_PR_c1; pcch_msg.message.choice.c1.present = PCCH_MessageType__c1_PR_paging; - pcch_msg.message.choice.c1.choice.paging.pagingRecordList = CALLOC(1,sizeof(*pcch_msg.message.choice.c1.choice.paging.pagingRecordList)); - pcch_msg.message.choice.c1.choice.paging.systemInfoModification = NULL; pcch_msg.message.choice.c1.choice.paging.etws_Indication = NULL; pcch_msg.message.choice.c1.choice.paging.nonCriticalExtension = NULL; - asn_set_empty(&pcch_msg.message.choice.c1.choice.paging.pagingRecordList->list); pcch_msg.message.choice.c1.choice.paging.pagingRecordList->list.count = 0; @@ -2655,10 +2331,11 @@ uint8_t do_Paging(uint8_t Mod_id, uint8_t *buffer, ue_paging_identity_t ue_pagin &paging_record_p->ue_Identity.choice.s_TMSI.mmec); paging_record_p->ue_Identity.choice.s_TMSI.mmec.bits_unused = 0; M_TMSI_TO_OCTET_STRING(ue_paging_identity.choice.s_tmsi.m_tmsi, - &paging_record_p->ue_Identity.choice.s_TMSI.m_TMSI); + &paging_record_p->ue_Identity.choice.s_TMSI.m_TMSI); paging_record_p->ue_Identity.choice.s_TMSI.m_TMSI.bits_unused = 0; } else if (ue_paging_identity.presenceMask == UE_PAGING_IDENTITY_imsi) { IMSI_Digit_t imsi_digit[21]; + for (j = 0; j< ue_paging_identity.choice.imsi.length; j++) { /* IMSI size */ imsi_digit[j] = (IMSI_Digit_t)ue_paging_identity.choice.imsi.buffer[j]; ASN_SEQUENCE_ADD(&paging_record_p->ue_Identity.choice.imsi.list, &imsi_digit[j]); @@ -2671,30 +2348,25 @@ uint8_t do_Paging(uint8_t Mod_id, uint8_t *buffer, ue_paging_identity_t ue_pagin } else { paging_record_p->cn_Domain = PagingRecord__cn_Domain_cs; } + /* add to list */ ASN_SEQUENCE_ADD(&pcch_msg.message.choice.c1.choice.paging.pagingRecordList->list, paging_record_p); LOG_D(RRC, "[eNB %d] do_Paging paging_record: cn_Domain %ld, ue_paging_identity.presenceMask %d, PagingRecordList.count %d\n", - Mod_id, paging_record_p->cn_Domain, ue_paging_identity.presenceMask, pcch_msg.message.choice.c1.choice.paging.pagingRecordList->list.count); - - enc_rval = uper_encode_to_buffer(&asn_DEF_PCCH_Message, (void*)&pcch_msg, buffer, RRC_BUF_SIZE); - + Mod_id, paging_record_p->cn_Domain, ue_paging_identity.presenceMask, pcch_msg.message.choice.c1.choice.paging.pagingRecordList->list.count); + enc_rval = uper_encode_to_buffer(&asn_DEF_PCCH_Message, NULL, (void *)&pcch_msg, buffer, RRC_BUF_SIZE); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); #ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_PCCH_Message, (void*)&pcch_msg); + xer_fprint(stdout, &asn_DEF_PCCH_Message, (void *)&pcch_msg); #endif - return((enc_rval.encoded+7)/8); } uint8_t do_ULInformationTransfer(uint8_t **buffer, uint32_t pdu_length, uint8_t *pdu_buffer) { ssize_t encoded; - UL_DCCH_Message_t ul_dcch_msg; - memset(&ul_dcch_msg, 0, sizeof(UL_DCCH_Message_t)); - ul_dcch_msg.message.present = UL_DCCH_MessageType_PR_c1; ul_dcch_msg.message.choice.c1.present = UL_DCCH_MessageType__c1_PR_ulInformationTransfer; ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.present = ULInformationTransfer__criticalExtensions_PR_c1; @@ -2703,9 +2375,7 @@ uint8_t do_ULInformationTransfer(uint8_t **buffer, uint32_t pdu_length, uint8_t ULInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS; ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType.choice.dedicatedInfoNAS.size = pdu_length; ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType.choice.dedicatedInfoNAS.buf = pdu_buffer; - - encoded = uper_encode_to_new_buffer (&asn_DEF_UL_DCCH_Message, NULL, (void*) &ul_dcch_msg, (void **) buffer); - + encoded = uper_encode_to_new_buffer (&asn_DEF_UL_DCCH_Message, NULL, (void *) &ul_dcch_msg, (void **) buffer); return encoded; } @@ -2715,21 +2385,15 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) static SupportedBandEUTRA_t Bandlist[4]; // the macro ASN_SEQUENCE_ADD() does not copy the source, but only stores a reference to it static InterFreqBandInfo_t InterFreqBandInfo[4][4]; // the macro ASN_SEQUENCE_ADD() does not copy the source, but only stores a reference to it static BandInfoEUTRA_t BandInfoEUTRA[4]; // the macro ASN_SEQUENCE_ADD() does not copy the source, but only stores a reference to it - asn_enc_rval_t enc_rval; asn_dec_rval_t dec_rval; - long maxNumberROHC_ContextSessions = PDCP_Parameters__maxNumberROHC_ContextSessions_cs16; int i; - UE_EUTRA_Capability_t *UE_EUTRA_Capability; char UE_EUTRA_Capability_xer[8192]; size_t size; - LOG_I(RRC,"Allocating %zu bytes for UE_EUTRA_Capability\n",sizeof(*UE_EUTRA_Capability)); - UE_EUTRA_Capability = CALLOC(1, sizeof(*UE_EUTRA_Capability)); - assert(UE_EUTRA_Capability); if (!UE_EUTRA_Capability_xer_fname) { @@ -2741,10 +2405,8 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) Bandlist[2].halfDuplex = 0; Bandlist[3].bandEUTRA = 38; // UL/DL 2570-2620, TDD Bandlist[3].halfDuplex = 0; - - memset((void*)InterFreqBandInfo, 0, sizeof(InterFreqBandInfo)); - memset((void*)BandInfoEUTRA, 0, sizeof(BandInfoEUTRA)); - + memset((void *)InterFreqBandInfo, 0, sizeof(InterFreqBandInfo)); + memset((void *)BandInfoEUTRA, 0, sizeof(BandInfoEUTRA)); InterFreqBandInfo[0][0].interFreqNeedForGaps = 0; InterFreqBandInfo[0][1].interFreqNeedForGaps = 1; InterFreqBandInfo[0][2].interFreqNeedForGaps = 1; @@ -2761,8 +2423,6 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) InterFreqBandInfo[3][1].interFreqNeedForGaps = 1; InterFreqBandInfo[3][2].interFreqNeedForGaps = 1; InterFreqBandInfo[3][3].interFreqNeedForGaps = 0; - - UE_EUTRA_Capability->accessStratumRelease = 0;//AccessStratumRelease_rel8; UE_EUTRA_Capability->ue_Category = 4; UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0001=0; @@ -2774,41 +2434,34 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0102=0; UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0103=0; UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0104=0; - UE_EUTRA_Capability->pdcp_Parameters.maxNumberROHC_ContextSessions = &maxNumberROHC_ContextSessions; - UE_EUTRA_Capability->phyLayerParameters.ue_TxAntennaSelectionSupported = 0; UE_EUTRA_Capability->phyLayerParameters.ue_SpecificRefSigsSupported = 0; UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count = 0; - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void*)&Bandlist[0]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void*)&Bandlist[1]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void*)&Bandlist[2]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void*)&Bandlist[3]); - - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void*)&BandInfoEUTRA[0]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void*)&BandInfoEUTRA[1]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void*)&BandInfoEUTRA[2]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void*)&BandInfoEUTRA[3]); - - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void*)&InterFreqBandInfo[0][0]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void*)&InterFreqBandInfo[0][1]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void*)&InterFreqBandInfo[0][2]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void*)&InterFreqBandInfo[0][3]); - - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void*)&InterFreqBandInfo[1][0]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void*)&InterFreqBandInfo[1][1]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void*)&InterFreqBandInfo[1][2]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void*)&InterFreqBandInfo[1][3]); - - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void*)&InterFreqBandInfo[2][0]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void*)&InterFreqBandInfo[2][1]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void*)&InterFreqBandInfo[2][2]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void*)&InterFreqBandInfo[2][3]); - - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void*)&InterFreqBandInfo[3][0]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void*)&InterFreqBandInfo[3][1]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void*)&InterFreqBandInfo[3][2]); - ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void*)&InterFreqBandInfo[3][3]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void *)&Bandlist[0]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void *)&Bandlist[1]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void *)&Bandlist[2]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void *)&Bandlist[3]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void *)&BandInfoEUTRA[0]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void *)&BandInfoEUTRA[1]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void *)&BandInfoEUTRA[2]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void *)&BandInfoEUTRA[3]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void *)&InterFreqBandInfo[0][0]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void *)&InterFreqBandInfo[0][1]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void *)&InterFreqBandInfo[0][2]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void *)&InterFreqBandInfo[0][3]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void *)&InterFreqBandInfo[1][0]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void *)&InterFreqBandInfo[1][1]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void *)&InterFreqBandInfo[1][2]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void *)&InterFreqBandInfo[1][3]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void *)&InterFreqBandInfo[2][0]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void *)&InterFreqBandInfo[2][1]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void *)&InterFreqBandInfo[2][2]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void *)&InterFreqBandInfo[2][3]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void *)&InterFreqBandInfo[3][0]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void *)&InterFreqBandInfo[3][1]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void *)&InterFreqBandInfo[3][2]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void *)&InterFreqBandInfo[3][3]); // UE_EUTRA_Capability->measParameters.bandListEUTRA.list.count = 0; // no measurements on other bands // UE_EUTRA_Capability->featureGroupIndicators // null @@ -2828,8 +2481,7 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) // UE_EUTRA_Capability->interRAT_Parameters // null } else { - - FILE* f = fopen(UE_EUTRA_Capability_xer_fname, "r"); + FILE *f = fopen(UE_EUTRA_Capability_xer_fname, "r"); assert(f); size = fread(UE_EUTRA_Capability_xer, 1, sizeof UE_EUTRA_Capability_xer, f); fclose(f); @@ -2840,7 +2492,7 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) return(NULL); } - dec_rval = xer_decode(0, &asn_DEF_UE_EUTRA_Capability, (void*)UE_EUTRA_Capability, UE_EUTRA_Capability_xer, size); + dec_rval = xer_decode(0, &asn_DEF_UE_EUTRA_Capability, (void *)UE_EUTRA_Capability, UE_EUTRA_Capability_xer, size); assert(dec_rval.code == RC_OK); } @@ -2849,20 +2501,18 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) xer_fprint(stdout,&asn_DEF_UE_EUTRA_Capability,(void *)UE_EUTRA_Capability); #endif enc_rval = uper_encode_to_buffer(&asn_DEF_UE_EUTRA_Capability, - (void*)UE_EUTRA_Capability, + NULL, + (void *)UE_EUTRA_Capability, &UECapability.sdu[0], MAX_UE_CAPABILITY_SIZE); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - #if defined(ENABLE_ITTI) # if defined(DISABLE_XER_SPRINT) { MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_RRC_UE, RRC_UE_EUTRA_CAPABILITY); memcpy (&msg_p->ittiMsg, (void *) UE_EUTRA_Capability, sizeof(RrcUeEutraCapability)); - itti_send_msg_to_task (TASK_UNKNOWN, NB_eNB_INST, msg_p); } # else @@ -2872,17 +2522,14 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UE_EUTRA_Capability, (void *)UE_EUTRA_Capability)) > 0) { MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UE_EUTRA_CAPABILITY, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_ue_eutra_capability.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_ue_eutra_capability.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, msg_p); } } # endif #endif - UECapability.sdu_size = (enc_rval.encoded + 7) / 8; LOG_I(PHY, "[RRC]UE Capability encoded, %d bytes (%zd bits)\n", UECapability.sdu_size, enc_rval.encoded + 7); @@ -2897,7 +2544,6 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) LOG_D(PHY, "[RRC]UE Capability encoded, %s\n", sdu); free(sdu); } - return(&UECapability); } diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c b/openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c index 43721bbfd5..4b152bac2f 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c @@ -78,14 +78,13 @@ /*do_MIB_NB_NB_IoT*/ uint8_t do_MIB_NB_IoT( - rrc_eNB_carrier_data_NB_IoT_t *carrier, - uint16_t N_RB_DL,//may not needed--> for NB_IoT only 1 PRB is used - uint32_t frame, - uint32_t hyper_frame) + rrc_eNB_carrier_data_NB_IoT_t *carrier, + uint16_t N_RB_DL,//may not needed--> for NB_IoT only 1 PRB is used + uint32_t frame, + uint32_t hyper_frame) { asn_enc_rval_t enc_rval; BCCH_BCH_Message_NB_t *mib_NB_IoT = &(carrier->mib_NB_IoT); - /* * systemFrameNumber-MSB: (TS 36.331 pag 576) * define the 4 MSB of the SFN (10 bits). The last significant 6 bits will be acquired implicitly by decoding the NPBCH @@ -98,45 +97,39 @@ uint8_t do_MIB_NB_IoT( * * NOTE: in OAI never modify the SIB messages!!?? */ - //XXX check if correct the bit assignment uint8_t sfn_MSB = (uint8_t)((frame>>6) & 0x0f); // all the 4 bits are set to 1 uint8_t hsfn_LSB = (uint8_t)(hyper_frame & 0x03); //2 bits set to 1 (0x3 = 0011) uint16_t spare=0; //11 bits --> use uint16 - mib_NB_IoT->message.systemFrameNumber_MSB_r13.buf = &sfn_MSB; mib_NB_IoT->message.systemFrameNumber_MSB_r13.size = 1; //if expressed in byte mib_NB_IoT->message.systemFrameNumber_MSB_r13.bits_unused = 4; //is byte based (so how many bits you don't use of the 8 bits of a bite - mib_NB_IoT->message.hyperSFN_LSB_r13.buf= &hsfn_LSB; mib_NB_IoT->message.hyperSFN_LSB_r13.size= 1; mib_NB_IoT->message.hyperSFN_LSB_r13.bits_unused = 6; - //XXX to be set?? mib_NB_IoT->message.spare.buf = (uint8_t *)&spare; mib_NB_IoT->message.spare.size = 2; mib_NB_IoT->message.spare.bits_unused = 5; - //decide how to set it mib_NB_IoT->message.schedulingInfoSIB1_r13 =11; //see TS 36.213-->tables 16.4.1.3-3 ecc... mib_NB_IoT->message.systemInfoValueTag_r13= 0; mib_NB_IoT->message.ab_Enabled_r13 = 0; - //to be decided mib_NB_IoT->message.operationModeInfo_r13.present = MasterInformationBlock_NB__operationModeInfo_r13_PR_inband_SamePCI_r13; mib_NB_IoT->message.operationModeInfo_r13.choice.inband_SamePCI_r13.eutra_CRS_SequenceInfo_r13 = 0; - printf("[MIB] Initialization of frame information,sfn_MSB %x, hsfn_LSB %x\n", (uint32_t)sfn_MSB, - (uint32_t)hsfn_LSB); - + (uint32_t)hsfn_LSB); enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message_NB, - (void*)mib_NB_IoT, + NULL, + (void *)mib_NB_IoT, carrier->MIB_NB_IoT, 100); + if(enc_rval.encoded <= 0) { - LOG_F(RRC, "ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); + LOG_F(RRC, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); } if (enc_rval.encoded==-1) { @@ -144,63 +137,48 @@ uint8_t do_MIB_NB_IoT( } return((enc_rval.encoded+7)/8); - } /*do_SIB1_NB*/ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id, - rrc_eNB_carrier_data_NB_IoT_t *carrier, - NbIoTRrcConfigurationReq *configuration, - uint32_t frame - ) + rrc_eNB_carrier_data_NB_IoT_t *carrier, + NbIoTRrcConfigurationReq *configuration, + uint32_t frame + ) { BCCH_DL_SCH_Message_NB_t *bcch_message= &(carrier->siblock1_NB_IoT); SystemInformationBlockType1_NB_t **sib1_NB_IoT= &(carrier->sib1_NB_IoT); - - asn_enc_rval_t enc_rval; - PLMN_IdentityInfo_NB_r13_t PLMN_identity_info_NB_IoT; MCC_MNC_Digit_t dummy_mcc[3],dummy_mnc[3]; SchedulingInfo_NB_r13_t *schedulingInfo_NB_IoT; SIB_Type_NB_r13_t *sib_type_NB_IoT; - - - long* attachWithoutPDN_Connectivity = NULL; + long *attachWithoutPDN_Connectivity = NULL; attachWithoutPDN_Connectivity = CALLOC(1,sizeof(long)); long *nrs_CRS_PowerOffset=NULL; nrs_CRS_PowerOffset = CALLOC(1, sizeof(long)); long *eutraControlRegionSize=NULL; //this parameter should be set only if we are considering in-band operating mode (samePCI or differentPCI) - eutraControlRegionSize = CALLOC(1,sizeof(long)); + eutraControlRegionSize = CALLOC(1,sizeof(long)); long systemInfoValueTagSI = 0; - memset(bcch_message,0,sizeof(BCCH_DL_SCH_Message_NB_t)); bcch_message->message.present = BCCH_DL_SCH_MessageType_NB_PR_c1; bcch_message->message.choice.c1.present = BCCH_DL_SCH_MessageType_NB__c1_PR_systemInformationBlockType1_r13; - //allocation *sib1_NB_IoT = &bcch_message->message.choice.c1.choice.systemInformationBlockType1_r13; - - /*TS 36.331 v14.2.0 pag 589 * hyperSFN-MSB * Indicates the 8 most significant bits of the hyper-SFN. Together with the hyper-LSB in MIB-NB the complete HSFN is build up */ //FIXME see if correct uint8_t hyperSFN_MSB = (uint8_t) ((frame>>2)& 0xff); - //XXX to be checked (*sib1_NB_IoT)->hyperSFN_MSB_r13.buf = &hyperSFN_MSB; (*sib1_NB_IoT)->hyperSFN_MSB_r13.size = 1; (*sib1_NB_IoT)->hyperSFN_MSB_r13.bits_unused = 0; - memset(&PLMN_identity_info_NB_IoT,0,sizeof(PLMN_IdentityInfo_NB_r13_t)); - PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc = CALLOC(1,sizeof(*PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc)); memset(PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc,0,sizeof(*PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc)); - asn_set_empty(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc->list);//.size=0; - //left as it is??? #if defined(ENABLE_ITTI) dummy_mcc[0] = (configuration->mcc / 100) % 10; @@ -214,11 +192,8 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id, ASN_SEQUENCE_ADD(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc->list,&dummy_mcc[0]); ASN_SEQUENCE_ADD(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc->list,&dummy_mcc[1]); ASN_SEQUENCE_ADD(&PLMN_identity_info_NB_IoT.plmn_Identity_r13.mcc->list,&dummy_mcc[2]); - PLMN_identity_info_NB_IoT.plmn_Identity_r13.mnc.list.size=0; PLMN_identity_info_NB_IoT.plmn_Identity_r13.mnc.list.count=0; - - #if defined(ENABLE_ITTI) if (configuration->mnc >= 100) { @@ -251,15 +226,11 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id, //still set to "notReserved" as in the previous case PLMN_identity_info_NB_IoT.cellReservedForOperatorUse_r13=PLMN_IdentityInfo_NB_r13__cellReservedForOperatorUse_r13_notReserved; - *attachWithoutPDN_Connectivity = 0; PLMN_identity_info_NB_IoT.attachWithoutPDN_Connectivity_r13 = attachWithoutPDN_Connectivity; - ASN_SEQUENCE_ADD(&(*sib1_NB_IoT)->cellAccessRelatedInfo_r13.plmn_IdentityList_r13.list,&PLMN_identity_info_NB_IoT); - // 16 bits = 2 byte (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf = MALLOC(2); //MALLOC works in byte - //lefts as it is? #if defined(ENABLE_ITTI) (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.buf[0] = (configuration->tac >> 8) & 0xff; @@ -270,7 +241,6 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id, #endif (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.size=2; (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.trackingAreaCode_r13.bits_unused=0; - // 28 bits --> i have to use 32 bits = 4 byte (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.buf = MALLOC(8); // why allocate 8 byte? #if defined(ENABLE_ITTI) @@ -286,20 +256,14 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id, #endif (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.size=4; (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellIdentity_r13.bits_unused=4; - //Still set to "notBarred" as in the previous case (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.cellBarred_r13=SystemInformationBlockType1_NB__cellAccessRelatedInfo_r13__cellBarred_r13_notBarred; - //Still Set to "notAllowed" like in the previous case (*sib1_NB_IoT)->cellAccessRelatedInfo_r13.intraFreqReselection_r13=SystemInformationBlockType1_NB__cellAccessRelatedInfo_r13__intraFreqReselection_r13_notAllowed; - - (*sib1_NB_IoT)->cellSelectionInfo_r13.q_RxLevMin_r13=-65; //which value?? TS 36.331 V14.2.1 pag. 589 (*sib1_NB_IoT)->cellSelectionInfo_r13.q_QualMin_r13 = 0; //FIXME new parameter for SIB1-NB, not present in SIB1 (for cell reselection but if not used the UE should apply the default value) - (*sib1_NB_IoT)->p_Max_r13 = CALLOC(1, sizeof(P_Max_t)); *((*sib1_NB_IoT)->p_Max_r13) = 23; - //FIXME (*sib1_NB_IoT)->freqBandIndicator_r13 = #if defined(ENABLE_ITTI) @@ -307,70 +271,54 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id, #else 5; //if not configured we use band 5 (UL: 824 MHz - 849MHz / DL: 869 MHz - 894 MHz FDD mode) #endif - - //OPTIONAL new parameters, to be used? - /* - * freqBandInfo_r13 - * multiBandInfoList_r13 - * nrs_CRS_PowerOffset_r13 - * sib1_NB_IoT->downlinkBitmap_r13.choice.subframePattern10_r13 =(is a BIT_STRING) - */ - - - (*sib1_NB_IoT)->downlinkBitmap_r13 = CALLOC(1, sizeof(struct DL_Bitmap_NB_r13)); - ((*sib1_NB_IoT)->downlinkBitmap_r13)->present= DL_Bitmap_NB_r13_PR_NOTHING; - - *eutraControlRegionSize = 1; - (*sib1_NB_IoT)->eutraControlRegionSize_r13 = eutraControlRegionSize; - - - *nrs_CRS_PowerOffset= 0; - (*sib1_NB_IoT)->nrs_CRS_PowerOffset_r13 = nrs_CRS_PowerOffset; - - schedulingInfo_NB_IoT = (SchedulingInfo_NB_r13_t*) malloc (3*sizeof(SchedulingInfo_NB_r13_t)); - sib_type_NB_IoT = (SIB_Type_NB_r13_t *) malloc (3*sizeof(SIB_Type_NB_r13_t)); - + //OPTIONAL new parameters, to be used? + /* + * freqBandInfo_r13 + * multiBandInfoList_r13 + * nrs_CRS_PowerOffset_r13 + * sib1_NB_IoT->downlinkBitmap_r13.choice.subframePattern10_r13 =(is a BIT_STRING) + */ + (*sib1_NB_IoT)->downlinkBitmap_r13 = CALLOC(1, sizeof(struct DL_Bitmap_NB_r13)); + ((*sib1_NB_IoT)->downlinkBitmap_r13)->present= DL_Bitmap_NB_r13_PR_NOTHING; + *eutraControlRegionSize = 1; + (*sib1_NB_IoT)->eutraControlRegionSize_r13 = eutraControlRegionSize; + *nrs_CRS_PowerOffset= 0; + (*sib1_NB_IoT)->nrs_CRS_PowerOffset_r13 = nrs_CRS_PowerOffset; + schedulingInfo_NB_IoT = (SchedulingInfo_NB_r13_t *) malloc (3*sizeof(SchedulingInfo_NB_r13_t)); + sib_type_NB_IoT = (SIB_Type_NB_r13_t *) malloc (3*sizeof(SIB_Type_NB_r13_t)); memset(&schedulingInfo_NB_IoT[0],0,sizeof(SchedulingInfo_NB_r13_t)); memset(&schedulingInfo_NB_IoT[1],0,sizeof(SchedulingInfo_NB_r13_t)); - memset(&schedulingInfo_NB_IoT[2],0,sizeof(SchedulingInfo_NB_r13_t)); + memset(&schedulingInfo_NB_IoT[2],0,sizeof(SchedulingInfo_NB_r13_t)); memset(&sib_type_NB_IoT[0],0,sizeof(SIB_Type_NB_r13_t)); memset(&sib_type_NB_IoT[1],0,sizeof(SIB_Type_NB_r13_t)); memset(&sib_type_NB_IoT[2],0,sizeof(SIB_Type_NB_r13_t)); - - // Now, follow the scheduler SIB configuration // There is only one sib2+sib3 common setting schedulingInfo_NB_IoT[0].si_Periodicity_r13=SchedulingInfo_NB_r13__si_Periodicity_r13_rf4096; schedulingInfo_NB_IoT[0].si_RepetitionPattern_r13=SchedulingInfo_NB_r13__si_RepetitionPattern_r13_every2ndRF; //This Indicates the starting radio frames within the SI window used for SI message transmission. schedulingInfo_NB_IoT[0].si_TB_r13= SchedulingInfo_NB_r13__si_TB_r13_b680;//208 bits - - // This is for SIB2/3 /*SIB3 --> There is no mapping information of SIB2 since it is always present * in the first SystemInformation message * listed in the schedulingInfoList list. * */ sib_type_NB_IoT[0]=SIB_Type_NB_r13_sibType3_NB_r13; - ASN_SEQUENCE_ADD(&schedulingInfo_NB_IoT[0].sib_MappingInfo_r13.list,&sib_type_NB_IoT[0]); ASN_SEQUENCE_ADD(&(*sib1_NB_IoT)->schedulingInfoList_r13.list,&schedulingInfo_NB_IoT[0]); - //printf("[ASN Debug] SI P: %ld\n",(*sib1_NB_IoT)->schedulingInfoList_r13.list.array[0]->si_Periodicity_r13); - #if defined(ENABLE_ITTI) if (configuration->frame_type == TDD) #endif { - //FIXME in NB-IoT mandatory to be FDD --> so must give an error - LOG_E(RRC,"[NB-IoT %d] Frame Type is TDD --> not supported by NB-IoT, exiting\n", Mod_id); //correct? - exit(-1); + //FIXME in NB-IoT mandatory to be FDD --> so must give an error + LOG_E(RRC,"[NB-IoT %d] Frame Type is TDD --> not supported by NB-IoT, exiting\n", Mod_id); //correct? + exit(-1); } //FIXME which value chose for the following parameter (*sib1_NB_IoT)->si_WindowLength_r13=SystemInformationBlockType1_NB__si_WindowLength_r13_ms160; (*sib1_NB_IoT)->si_RadioFrameOffset_r13= 0; - /*In Nb-IoT change/update of specific SI message can additionally be indicated by a SI message specific value tag * systemInfoValueTagSI (there is no SystemInfoValueTag in SIB1-NB but only in MIB-NB) *contained in systemInfoValueTagList_r13 @@ -379,24 +327,20 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id, (*sib1_NB_IoT)->systemInfoValueTagList_r13 = CALLOC(1, sizeof(struct SystemInfoValueTagList_NB_r13)); asn_set_empty(&(*sib1_NB_IoT)->systemInfoValueTagList_r13->list); ASN_SEQUENCE_ADD(&(*sib1_NB_IoT)->systemInfoValueTagList_r13->list,&systemInfoValueTagSI); - - #ifdef XER_PRINT //generate xml files - xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message_NB, (void*)bcch_message); + xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message_NB, (void *)bcch_message); #endif - - enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message_NB, - (void*)bcch_message, + NULL, + (void *)bcch_message, carrier->SIB1_NB_IoT, 100); - if (enc_rval.encoded > 0){ - LOG_F(RRC,"ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); + if (enc_rval.encoded > 0) { + LOG_F(RRC,"ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); } - #ifdef USER_MODE LOG_D(RRC,"[NB-IoT] SystemInformationBlockType1-NB Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); #endif @@ -417,30 +361,23 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id, { struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member *sib2_NB_part; struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member *sib3_NB_part; - BCCH_DL_SCH_Message_NB_t *bcch_message = &(carrier->systemInformation_NB_IoT); //is the systeminformation-->BCCH_DL_SCH_Message_NB SystemInformationBlockType2_NB_r13_t *sib2_NB_IoT; SystemInformationBlockType3_NB_r13_t *sib3_NB_IoT; - asn_enc_rval_t enc_rval; RACH_Info_NB_r13_t rach_Info_NB_IoT; NPRACH_Parameters_NB_r13_t *nprach_parameters; - //optional long *connEstFailOffset = NULL; connEstFailOffset = CALLOC(1, sizeof(long)); - -// RSRP_ThresholdsNPRACH_InfoList_NB_r13_t *rsrp_ThresholdsPrachInfoList; -// RSRP_Range_t rsrp_range; - + // RSRP_ThresholdsNPRACH_InfoList_NB_r13_t *rsrp_ThresholdsPrachInfoList; + // RSRP_Range_t rsrp_range; ACK_NACK_NumRepetitions_NB_r13_t ack_nack_repetition; struct NPUSCH_ConfigCommon_NB_r13__dmrs_Config_r13 *dmrs_config; - struct DL_GapConfig_NB_r13 *dl_Gap; - + struct DL_GapConfig_NB_r13 *dl_Gap; long *srs_SubframeConfig; srs_SubframeConfig= CALLOC(1, sizeof(long)); - if (bcch_message) { memset(bcch_message,0,sizeof(BCCH_DL_SCH_Message_NB_t)); } else { @@ -449,84 +386,64 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id, } //before schould be allocated memory somewhere? -// if (!carrier->sib2_NB_IoT) { -// LOG_E(RRC,"[NB-IoT %d] sib2_NB_IoT is null, exiting\n", Mod_id); -// exit(-1); -// } -// -// if (!carrier->sib3_NB_IoT) { -// LOG_E(RRC,"[NB-IoT %d] sib3_NB_IoT is null, exiting\n", Mod_id); -// exit(-1); -// } - - + // if (!carrier->sib2_NB_IoT) { + // LOG_E(RRC,"[NB-IoT %d] sib2_NB_IoT is null, exiting\n", Mod_id); + // exit(-1); + // } + // + // if (!carrier->sib3_NB_IoT) { + // LOG_E(RRC,"[NB-IoT %d] sib3_NB_IoT is null, exiting\n", Mod_id); + // exit(-1); + // } LOG_I(RRC,"[NB-IoT %d] Configuration SIB2/3\n", Mod_id); - sib2_NB_part = CALLOC(1,sizeof(struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member)); sib3_NB_part = CALLOC(1,sizeof(struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member)); memset(sib2_NB_part,0,sizeof(struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member)); memset(sib3_NB_part,0,sizeof(struct SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member)); - sib2_NB_part->present = SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_PR_sib2_r13; sib3_NB_part->present = SystemInformation_NB_r13_IEs__sib_TypeAndInfo_r13__Member_PR_sib3_r13; - //may bug if not correct allocation of memory carrier->sib2_NB_IoT = &sib2_NB_part->choice.sib2_r13; carrier->sib3_NB_IoT = &sib3_NB_part->choice.sib3_r13; sib2_NB_IoT = carrier->sib2_NB_IoT; sib3_NB_IoT = carrier->sib3_NB_IoT; - nprach_parameters = (NPRACH_Parameters_NB_r13_t *) malloc (3*sizeof(NPRACH_Parameters_NB_r13_t)); - memset(&nprach_parameters[0],0,sizeof(NPRACH_Parameters_NB_r13_t)); memset(&nprach_parameters[1],0,sizeof(NPRACH_Parameters_NB_r13_t)); memset(&nprach_parameters[2],0,sizeof(NPRACH_Parameters_NB_r13_t)); - -/// SIB2-NB----------------------------------------- - + /// SIB2-NB----------------------------------------- //Barring is manage by ab-Enabled in MIB-NB (but is not a struct as ac-BarringInfo in LTE legacy) - //RACH Config. Common-------------------------------------------------------------- sib2_NB_IoT->radioResourceConfigCommon_r13.rach_ConfigCommon_r13.preambleTransMax_CE_r13 = - configuration->rach_preambleTransMax_CE_NB; + configuration->rach_preambleTransMax_CE_NB; sib2_NB_IoT->radioResourceConfigCommon_r13.rach_ConfigCommon_r13.powerRampingParameters_r13.powerRampingStep = - configuration->rach_powerRampingStep_NB; + configuration->rach_powerRampingStep_NB; sib2_NB_IoT->radioResourceConfigCommon_r13.rach_ConfigCommon_r13.powerRampingParameters_r13.preambleInitialReceivedTargetPower = configuration->rach_preambleInitialReceivedTargetPower_NB; - rach_Info_NB_IoT.ra_ResponseWindowSize_r13 = configuration->rach_raResponseWindowSize_NB; rach_Info_NB_IoT.mac_ContentionResolutionTimer_r13 = configuration-> rach_macContentionResolutionTimer_NB; //rach_infoList max size = maxNPRACH-Resources-NB-r13 = 3 ASN_SEQUENCE_ADD(&sib2_NB_IoT->radioResourceConfigCommon_r13.rach_ConfigCommon_r13.rach_InfoList_r13.list,&rach_Info_NB_IoT); - //TS 36.331 pag 614 --> if not present the value to infinity sould be used *connEstFailOffset = 0; - sib2_NB_IoT->radioResourceConfigCommon_r13.rach_ConfigCommon_r13.connEstFailOffset_r13 = connEstFailOffset; /*OPTIONAL*/ - - // BCCH-Config-NB-IoT---------------------------------------------------------------- sib2_NB_IoT->radioResourceConfigCommon_r13.bcch_Config_r13.modificationPeriodCoeff_r13 = configuration->bcch_modificationPeriodCoeff_NB; - // PCCH-Config-NB-IoT----------------------------------------------------------------- sib2_NB_IoT->radioResourceConfigCommon_r13.pcch_Config_r13.defaultPagingCycle_r13 = configuration->pcch_defaultPagingCycle_NB; sib2_NB_IoT->radioResourceConfigCommon_r13.pcch_Config_r13.nB_r13 = configuration->pcch_nB_NB; sib2_NB_IoT->radioResourceConfigCommon_r13.pcch_Config_r13.npdcch_NumRepetitionPaging_r13 = configuration-> pcch_npdcch_NumRepetitionPaging_NB; - //NPRACH-Config-NB-IoT----------------------------------------------------------------- - - sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.rsrp_ThresholdsPrachInfoList_r13 = NULL; + sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.rsrp_ThresholdsPrachInfoList_r13 = NULL; sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.nprach_CP_Length_r13 = configuration->nprach_CP_Length; /*OPTIONAL*/ -// =CALLOC(1, sizeof(struct RSRP_ThresholdsNPRACH_InfoList_NB_r13)); //fatto uguale dopo -// rsrp_ThresholdsPrachInfoList = sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.rsrp_ThresholdsPrachInfoList_r13; -// rsrp_range = configuration->nprach_rsrp_range_NB; -// ASN_SEQUENCE_ADD(&rsrp_ThresholdsPrachInfoList->list,rsrp_range); - + // =CALLOC(1, sizeof(struct RSRP_ThresholdsNPRACH_InfoList_NB_r13)); //fatto uguale dopo + // rsrp_ThresholdsPrachInfoList = sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.rsrp_ThresholdsPrachInfoList_r13; + // rsrp_range = configuration->nprach_rsrp_range_NB; + // ASN_SEQUENCE_ADD(&rsrp_ThresholdsPrachInfoList->list,rsrp_range); // According configuration to set the 3 CE level configuration setting - nprach_parameters[0].nprach_Periodicity_r13 = configuration->nprach_Periodicity[0]; nprach_parameters[0].nprach_StartTime_r13 = configuration->nprach_StartTime[0]; nprach_parameters[0].nprach_SubcarrierOffset_r13 = configuration->nprach_SubcarrierOffset[0]; @@ -537,7 +454,6 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id, nprach_parameters[0].npdcch_NumRepetitions_RA_r13 = configuration->npdcch_NumRepetitions_RA[0]; nprach_parameters[0].npdcch_StartSF_CSS_RA_r13 = configuration->npdcch_StartSF_CSS_RA[0]; nprach_parameters[0].npdcch_Offset_RA_r13 = configuration->npdcch_Offset_RA[0]; - nprach_parameters[1].nprach_Periodicity_r13 = configuration->nprach_Periodicity[1]; nprach_parameters[1].nprach_StartTime_r13 = configuration->nprach_StartTime[1]; nprach_parameters[1].nprach_SubcarrierOffset_r13 = configuration->nprach_SubcarrierOffset[1]; @@ -548,7 +464,6 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id, nprach_parameters[1].npdcch_NumRepetitions_RA_r13 = configuration->npdcch_NumRepetitions_RA[1]; nprach_parameters[1].npdcch_StartSF_CSS_RA_r13 = configuration->npdcch_StartSF_CSS_RA[1]; nprach_parameters[1].npdcch_Offset_RA_r13 = configuration->npdcch_Offset_RA[1]; - nprach_parameters[2].nprach_Periodicity_r13 = configuration->nprach_Periodicity[2]; nprach_parameters[2].nprach_StartTime_r13 = configuration->nprach_StartTime[2]; nprach_parameters[2].nprach_SubcarrierOffset_r13 = configuration->nprach_SubcarrierOffset[2]; @@ -559,40 +474,29 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id, nprach_parameters[2].npdcch_NumRepetitions_RA_r13 = configuration->npdcch_NumRepetitions_RA[2]; nprach_parameters[2].npdcch_StartSF_CSS_RA_r13 = configuration->npdcch_StartSF_CSS_RA[2]; nprach_parameters[2].npdcch_Offset_RA_r13 = configuration->npdcch_Offset_RA[2]; - - //nprach_parameterList have a max size of 3 possible nprach configuration (see maxNPRACH_Resources_NB_r13) ASN_SEQUENCE_ADD(&sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.nprach_ParametersList_r13.list,&nprach_parameters[0]); ASN_SEQUENCE_ADD(&sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.nprach_ParametersList_r13.list,&nprach_parameters[1]); ASN_SEQUENCE_ADD(&sib2_NB_IoT->radioResourceConfigCommon_r13.nprach_Config_r13.nprach_ParametersList_r13.list,&nprach_parameters[2]); - // NPDSCH-Config NB-IOT sib2_NB_IoT->radioResourceConfigCommon_r13.npdsch_ConfigCommon_r13.nrs_Power_r13= configuration->npdsch_nrs_Power; - - //NPUSCH-Config NB-IoT---------------------------------------------------------------- //list of size 3 (see maxNPRACH_Resources_NB_r13) ack_nack_repetition = configuration-> npusch_ack_nack_numRepetitions_NB; //is an enumerative - ASN_SEQUENCE_ADD(&(sib2_NB_IoT->radioResourceConfigCommon_r13.npusch_ConfigCommon_r13.ack_NACK_NumRepetitions_Msg4_r13.list) ,&ack_nack_repetition); - + ASN_SEQUENCE_ADD(&(sib2_NB_IoT->radioResourceConfigCommon_r13.npusch_ConfigCommon_r13.ack_NACK_NumRepetitions_Msg4_r13.list),&ack_nack_repetition); *srs_SubframeConfig = configuration->npusch_srs_SubframeConfig_NB; sib2_NB_IoT->radioResourceConfigCommon_r13.npusch_ConfigCommon_r13.srs_SubframeConfig_r13= srs_SubframeConfig; /*OPTIONAL*/ - - /*OPTIONAL*/ dmrs_config = CALLOC(1,sizeof(struct NPUSCH_ConfigCommon_NB_r13__dmrs_Config_r13)); dmrs_config->threeTone_CyclicShift_r13 = configuration->npusch_threeTone_CyclicShift_r13; dmrs_config->sixTone_CyclicShift_r13 = configuration->npusch_sixTone_CyclicShift_r13; - /*OPTIONAL * -define the base sequence for a DMRS sequence in a cell with multi tone transmission (3,6,12) see TS 36.331 NPUSCH-Config-NB * -if not defined will be calculated based on the cellID once we configure the phy layer (rrc_mac_config_req) through the config_sib2 */ dmrs_config->threeTone_BaseSequence_r13 = NULL; dmrs_config->sixTone_BaseSequence_r13 = NULL; dmrs_config->twelveTone_BaseSequence_r13 = NULL; - sib2_NB_IoT->radioResourceConfigCommon_r13.npusch_ConfigCommon_r13.dmrs_Config_r13 = dmrs_config; - //ulReferenceSignalsNPUSCH /*Reference Signal (RS) for UL in NB-IoT is called DRS (Demodulation Reference Signal) * sequence-group hopping can be enabled or disabled by means of the cell-specific parameter groupHoppingEnabled_r13 @@ -601,22 +505,17 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id, */ sib2_NB_IoT->radioResourceConfigCommon_r13.npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupHoppingEnabled_r13= configuration->npusch_groupHoppingEnabled; sib2_NB_IoT->radioResourceConfigCommon_r13.npusch_ConfigCommon_r13.ul_ReferenceSignalsNPUSCH_r13.groupAssignmentNPUSCH_r13 =configuration->npusch_groupAssignmentNPUSCH_r13; - - //dl_GAP---------------------------------------------------------------------------------/*OPTIONAL*/ dl_Gap = CALLOC(1,sizeof(struct DL_GapConfig_NB_r13)); dl_Gap->dl_GapDurationCoeff_r13= configuration-> dl_GapDurationCoeff_NB; dl_Gap->dl_GapPeriodicity_r13= configuration->dl_GapPeriodicity_NB; dl_Gap->dl_GapThreshold_r13= configuration->dl_GapThreshold_NB; sib2_NB_IoT->radioResourceConfigCommon_r13.dl_Gap_r13 = dl_Gap; - - // uplinkPowerControlCommon - NB-IoT------------------------------------------------------ sib2_NB_IoT->radioResourceConfigCommon_r13.uplinkPowerControlCommon_r13.p0_NominalNPUSCH_r13 = configuration->npusch_p0_NominalNPUSCH; sib2_NB_IoT->radioResourceConfigCommon_r13.uplinkPowerControlCommon_r13.deltaPreambleMsg3_r13 = configuration->deltaPreambleMsg3; sib2_NB_IoT->radioResourceConfigCommon_r13.uplinkPowerControlCommon_r13.alpha_r13 = configuration->npusch_alpha; //no deltaFlist_PUCCH and no UL cyclic prefix - // UE Timers and Constants -NB-IoT-------------------------------------------------------- sib2_NB_IoT->ue_TimersAndConstants_r13.t300_r13 = configuration-> ue_TimersAndConstants_t300_NB; sib2_NB_IoT->ue_TimersAndConstants_r13.t301_r13 = configuration-> ue_TimersAndConstants_t301_NB; @@ -624,60 +523,45 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id, sib2_NB_IoT->ue_TimersAndConstants_r13.t311_r13 = configuration-> ue_TimersAndConstants_t311_NB; sib2_NB_IoT->ue_TimersAndConstants_r13.n310_r13 = configuration-> ue_TimersAndConstants_n310_NB; sib2_NB_IoT->ue_TimersAndConstants_r13.n311_r13 = configuration-> ue_TimersAndConstants_n311_NB; - //other SIB2-NB Parameters-------------------------------------------------------------------------------- sib2_NB_IoT->freqInfo_r13.additionalSpectrumEmission_r13 = 1; sib2_NB_IoT->freqInfo_r13.ul_CarrierFreq_r13 = NULL; /*OPTIONAL*/ - sib2_NB_IoT->timeAlignmentTimerCommon_r13=TimeAlignmentTimer_infinity;//TimeAlignmentTimer_sf5120; - /*OPTIONAL*/ sib2_NB_IoT->multiBandInfoList_r13 = NULL; - -/// SIB3-NB------------------------------------------------------- - + /// SIB3-NB------------------------------------------------------- sib3_NB_IoT->cellReselectionInfoCommon_r13.q_Hyst_r13=SystemInformationBlockType3_NB_r13__cellReselectionInfoCommon_r13__q_Hyst_r13_dB4; sib3_NB_IoT->cellReselectionServingFreqInfo_r13.s_NonIntraSearch_r13=0; //or define in configuration? - sib3_NB_IoT->intraFreqCellReselectionInfo_r13.q_RxLevMin_r13 = -70; //new sib3_NB_IoT->intraFreqCellReselectionInfo_r13.q_QualMin_r13 = CALLOC(1,sizeof(*sib3_NB_IoT->intraFreqCellReselectionInfo_r13.q_QualMin_r13)); *(sib3_NB_IoT->intraFreqCellReselectionInfo_r13.q_QualMin_r13)= 10; //a caso - sib3_NB_IoT->intraFreqCellReselectionInfo_r13.p_Max_r13 = NULL; sib3_NB_IoT->intraFreqCellReselectionInfo_r13.s_IntraSearchP_r13 = 31; // s_intraSearch --> s_intraSearchP!!! (they call in a different way) sib3_NB_IoT->intraFreqCellReselectionInfo_r13.t_Reselection_r13=1; - //how to manage? sib3_NB_IoT->freqBandInfo_r13 = NULL; sib3_NB_IoT->multiBandInfoList_r13 = NULL; - - -///BCCH message (generate the SI message) + ///BCCH message (generate the SI message) bcch_message->message.present = BCCH_DL_SCH_MessageType_NB_PR_c1; bcch_message->message.choice.c1.present = BCCH_DL_SCH_MessageType_NB__c1_PR_systemInformation_r13; - bcch_message->message.choice.c1.choice.systemInformation_r13.criticalExtensions.present = SystemInformation_NB__criticalExtensions_PR_systemInformation_r13; bcch_message->message.choice.c1.choice.systemInformation_r13.criticalExtensions.choice.systemInformation_r13.sib_TypeAndInfo_r13.list.count=0; - ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation_r13.criticalExtensions.choice.systemInformation_r13.sib_TypeAndInfo_r13.list, sib2_NB_part); ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation_r13.criticalExtensions.choice.systemInformation_r13.sib_TypeAndInfo_r13.list, sib3_NB_part); - #ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message_NB, (void*)bcch_message); + xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message_NB, (void *)bcch_message); #endif enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message_NB, - (void*)bcch_message, + NULL, + (void *)bcch_message, carrier->SIB23_NB_IoT, 900); -// AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", -// enc_rval.failed_type->name, enc_rval.encoded); - -//#if defined(ENABLE_ITTI)..... - - + // AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + // enc_rval.failed_type->name, enc_rval.encoded); + //#if defined(ENABLE_ITTI)..... #ifdef USER_MODE LOG_D(RRC,"[NB-IoT] SystemInformation-NB Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); #endif @@ -689,268 +573,222 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id, carrier->sib2_NB_IoT = sib2_NB_IoT; carrier->sib3_NB_IoT = sib3_NB_IoT; - return((enc_rval.encoded+7)/8); } /*do_RRCConnectionSetup_NB_IoT--> the aim is to establish SRB1 and SRB1bis(implicitly)*/ uint8_t do_RRCConnectionSetup_NB_IoT( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_NB_IoT_t* const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_NB_IoT_t *const ue_context_pP, int CC_id, - uint8_t* const buffer, //Srb0.Tx_buffer.Payload + uint8_t *const buffer, //Srb0.Tx_buffer.Payload const uint8_t Transaction_id, - const NB_IoT_DL_FRAME_PARMS* const frame_parms, // maybe not used - SRB_ToAddModList_NB_r13_t** SRB_configList_NB_IoT, //for both SRB1bis and SRB1 - struct PhysicalConfigDedicated_NB_r13** physicalConfigDedicated_NB_IoT + const NB_IoT_DL_FRAME_PARMS *const frame_parms, // maybe not used + SRB_ToAddModList_NB_r13_t **SRB_configList_NB_IoT, //for both SRB1bis and SRB1 + struct PhysicalConfigDedicated_NB_r13 **physicalConfigDedicated_NB_IoT ) { + asn_enc_rval_t enc_rval; + //MP:logical channel group not defined for Nb-IoT + //MP: logical channel priority pag 605 (is 1 for SRB1 and for SRB1bis should be the same) + //long* prioritySRB1 = NULL; + long *prioritySRB1bis = NULL; + BOOLEAN_t *logicalChannelSR_Prohibit =NULL; //pag 605 + BOOLEAN_t *npusch_AllSymbols= NULL; + // struct SRB_ToAddMod_NB_r13* SRB1_config_NB = NULL; + // struct SRB_ToAddMod_NB_r13__rlc_Config_r13* SRB1_rlc_config_NB = NULL; + // struct SRB_ToAddMod_NB_r13__logicalChannelConfig_r13* SRB1_lchan_config_NB = NULL; + struct SRB_ToAddMod_NB_r13 *SRB1bis_config_NB_IoT = NULL; + struct SRB_ToAddMod_NB_r13__rlc_Config_r13 *SRB1bis_rlc_config_NB_IoT = NULL; + struct SRB_ToAddMod_NB_r13__logicalChannelConfig_r13 *SRB1bis_lchan_config_NB_IoT = NULL; + //No UL_specific parameters for NB-IoT in LogicalChanelConfig-NB + PhysicalConfigDedicated_NB_r13_t *physicalConfigDedicated2_NB_IoT = NULL; + DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT; + RRCConnectionSetup_NB_t *rrcConnectionSetup_NB_IoT = NULL; + memset((void *)&dl_ccch_msg_NB_IoT,0,sizeof(DL_CCCH_Message_NB_t)); + dl_ccch_msg_NB_IoT.message.present = DL_CCCH_MessageType_NB_PR_c1; + dl_ccch_msg_NB_IoT.message.choice.c1.present = DL_CCCH_MessageType_NB__c1_PR_rrcConnectionSetup_r13; + rrcConnectionSetup_NB_IoT = &dl_ccch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionSetup_r13; - asn_enc_rval_t enc_rval; - - - //MP:logical channel group not defined for Nb-IoT - - //MP: logical channel priority pag 605 (is 1 for SRB1 and for SRB1bis should be the same) - //long* prioritySRB1 = NULL; - long* prioritySRB1bis = NULL; - BOOLEAN_t* logicalChannelSR_Prohibit =NULL; //pag 605 - BOOLEAN_t* npusch_AllSymbols= NULL; - -// struct SRB_ToAddMod_NB_r13* SRB1_config_NB = NULL; -// struct SRB_ToAddMod_NB_r13__rlc_Config_r13* SRB1_rlc_config_NB = NULL; -// struct SRB_ToAddMod_NB_r13__logicalChannelConfig_r13* SRB1_lchan_config_NB = NULL; - - struct SRB_ToAddMod_NB_r13* SRB1bis_config_NB_IoT = NULL; - struct SRB_ToAddMod_NB_r13__rlc_Config_r13* SRB1bis_rlc_config_NB_IoT = NULL; - struct SRB_ToAddMod_NB_r13__logicalChannelConfig_r13* SRB1bis_lchan_config_NB_IoT = NULL; - - //No UL_specific parameters for NB-IoT in LogicalChanelConfig-NB - - PhysicalConfigDedicated_NB_r13_t* physicalConfigDedicated2_NB_IoT = NULL; - DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT; - RRCConnectionSetup_NB_t* rrcConnectionSetup_NB_IoT = NULL; - - memset((void *)&dl_ccch_msg_NB_IoT,0,sizeof(DL_CCCH_Message_NB_t)); - dl_ccch_msg_NB_IoT.message.present = DL_CCCH_MessageType_NB_PR_c1; - dl_ccch_msg_NB_IoT.message.choice.c1.present = DL_CCCH_MessageType_NB__c1_PR_rrcConnectionSetup_r13; - rrcConnectionSetup_NB_IoT = &dl_ccch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionSetup_r13; - - - if (*SRB_configList_NB_IoT) { - free(*SRB_configList_NB_IoT); - } - *SRB_configList_NB_IoT = CALLOC(1,sizeof(SRB_ToAddModList_NB_r13_t)); - -/// SRB1-------------------- - { -// SRB1_config_NB = CALLOC(1,sizeof(*SRB1_config_NB)); -// -// //no srb_Identity in SRB_ToAddMod_NB -// -// SRB1_rlc_config_NB = CALLOC(1,sizeof(*SRB1_rlc_config_NB)); -// SRB1_config_NB->rlc_Config_r13 = SRB1_rlc_config_NB; -// -// SRB1_rlc_config_NB->present = SRB_ToAddMod_NB_r13__rlc_Config_r13_PR_explicitValue; -// SRB1_rlc_config_NB->choice.explicitValue.present=RLC_Config_NB_r13_PR_am;//the only possible in NB_IoT -// -//// SRB1_rlc_config_NB->choice.explicitValue.choice.am.ul_AM_RLC_r13.t_PollRetransmit_r13 = enb_properties.properties[ctxt_pP->module_id]->srb1_timer_poll_retransmit_r13; -//// SRB1_rlc_config_NB->choice.explicitValue.choice.am.ul_AM_RLC_r13.maxRetxThreshold_r13 = enb_properties.properties[ctxt_pP->module_id]->srb1_max_retx_threshold_r13; -//// //(musT be disabled--> SRB1 config pag 640 specs ) -//// SRB1_rlc_config_NB->choice.explicitValue.choice.am.dl_AM_RLC_r13.enableStatusReportSN_Gap_r13 =NULL; -// -// -// SRB1_rlc_config_NB->choice.explicitValue.choice.am.ul_AM_RLC_r13.t_PollRetransmit_r13 = T_PollRetransmit_NB_r13_ms25000; -// SRB1_rlc_config_NB->choice.explicitValue.choice.am.ul_AM_RLC_r13.maxRetxThreshold_r13 = UL_AM_RLC_NB_r13__maxRetxThreshold_r13_t8; -// //(musT be disabled--> SRB1 config pag 640 specs ) -// SRB1_rlc_config_NB->choice.explicitValue.choice.am.dl_AM_RLC_r13.enableStatusReportSN_Gap_r13 = NULL; -// -// SRB1_lchan_config_NB = CALLOC(1,sizeof(*SRB1_lchan_config_NB)); -// SRB1_config_NB->logicalChannelConfig_r13 = SRB1_lchan_config_NB; -// -// SRB1_lchan_config_NB->present = SRB_ToAddMod_NB_r13__logicalChannelConfig_r13_PR_explicitValue; -// -// -// prioritySRB1 = CALLOC(1, sizeof(long)); -// *prioritySRB1 = 1; -// SRB1_lchan_config_NB->choice.explicitValue.priority_r13 = prioritySRB1; -// -// logicalChannelSR_Prohibit = CALLOC(1, sizeof(BOOLEAN_t)); -// *logicalChannelSR_Prohibit = 1; -// //schould be set to TRUE (specs pag 641) -// SRB1_lchan_config_NB->choice.explicitValue.logicalChannelSR_Prohibit_r13 = logicalChannelSR_Prohibit; -// -// //ADD SRB1 -// ASN_SEQUENCE_ADD(&(*SRB_configList_NB_IoT)->list,SRB1_config_NB); - } - -///SRB1bis (The configuration for SRB1 and SRB1bis is the same) the only difference is the logical channel identity = 3 but not set here - - SRB1bis_config_NB_IoT = CALLOC(1,sizeof(*SRB1bis_config_NB_IoT)); - - //no srb_Identity in SRB_ToAddMod_NB - SRB1bis_rlc_config_NB_IoT = CALLOC(1,sizeof(*SRB1bis_rlc_config_NB_IoT)); - SRB1bis_config_NB_IoT->rlc_Config_r13 = SRB1bis_rlc_config_NB_IoT; - - SRB1bis_rlc_config_NB_IoT->present = SRB_ToAddMod_NB_r13__rlc_Config_r13_PR_explicitValue; - SRB1bis_rlc_config_NB_IoT->choice.explicitValue.present=RLC_Config_NB_r13_PR_am;//MP: the only possible RLC config in NB_IoT - - SRB1bis_rlc_config_NB_IoT->choice.explicitValue.choice.am.ul_AM_RLC_r13.t_PollRetransmit_r13 = T_PollRetransmit_NB_r13_ms25000; - SRB1bis_rlc_config_NB_IoT->choice.explicitValue.choice.am.ul_AM_RLC_r13.maxRetxThreshold_r13 = UL_AM_RLC_NB_r13__maxRetxThreshold_r13_t8; - //(musT be disabled--> SRB1 config pag 640 specs ) - SRB1bis_rlc_config_NB_IoT->choice.explicitValue.choice.am.dl_AM_RLC_r13.enableStatusReportSN_Gap_r13 =NULL; - - SRB1bis_lchan_config_NB_IoT = CALLOC(1,sizeof(*SRB1bis_lchan_config_NB_IoT)); - SRB1bis_config_NB_IoT->logicalChannelConfig_r13 = SRB1bis_lchan_config_NB_IoT; - - SRB1bis_lchan_config_NB_IoT->present = SRB_ToAddMod_NB_r13__logicalChannelConfig_r13_PR_explicitValue; - - prioritySRB1bis = CALLOC(1, sizeof(long)); - *prioritySRB1bis = 1; //same as SRB1? - SRB1bis_lchan_config_NB_IoT->choice.explicitValue.priority_r13 = prioritySRB1bis; - - logicalChannelSR_Prohibit = CALLOC(1, sizeof(BOOLEAN_t)); - *logicalChannelSR_Prohibit = 1; //schould be set to TRUE (specs pag 641) - SRB1bis_lchan_config_NB_IoT->choice.explicitValue.logicalChannelSR_Prohibit_r13 = logicalChannelSR_Prohibit; - - //ADD SRB1bis - //MP: Actually there is no way to distinguish SRB1 and SRB1bis once put in the list - //MP: SRB_ToAddModList_NB_r13_t size = 1 - ASN_SEQUENCE_ADD(&(*SRB_configList_NB_IoT)->list,SRB1bis_config_NB_IoT); - - - // PhysicalConfigDedicated (NPDCCH, NPUSCH, CarrierConfig, UplinkPowerControl) - - physicalConfigDedicated2_NB_IoT = CALLOC(1,sizeof(*physicalConfigDedicated2_NB_IoT)); - *physicalConfigDedicated_NB_IoT = physicalConfigDedicated2_NB_IoT; - - physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13= CALLOC(1, sizeof(*physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13)); - physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13 = CALLOC(1,sizeof(*physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13)); - physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13 = CALLOC(1,sizeof(*physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13)); - physicalConfigDedicated2_NB_IoT->uplinkPowerControlDedicated_r13 = CALLOC(1,sizeof(*physicalConfigDedicated2_NB_IoT->uplinkPowerControlDedicated_r13)); - - //no tpc, no cqi and no pucch, no pdsch, no soundingRS, no AntennaInfo, no scheduling request config - - /* - * NB-IoT supports the operation with either one or two antenna ports, AP0 and AP1. - * For the latter case, Space Frequency Block Coding (SFBC) is applied. - * Once selected, the same transmission scheme applies to NPBCH, NPDCCH, and NPDSCH. - * */ - - //FIXME: MP: CarrierConfigDedicated check the set values ---------------------------------------------- + if (*SRB_configList_NB_IoT) { + free(*SRB_configList_NB_IoT); + } + *SRB_configList_NB_IoT = CALLOC(1,sizeof(SRB_ToAddModList_NB_r13_t)); + /// SRB1-------------------- + { + // SRB1_config_NB = CALLOC(1,sizeof(*SRB1_config_NB)); + // + // //no srb_Identity in SRB_ToAddMod_NB + // + // SRB1_rlc_config_NB = CALLOC(1,sizeof(*SRB1_rlc_config_NB)); + // SRB1_config_NB->rlc_Config_r13 = SRB1_rlc_config_NB; + // + // SRB1_rlc_config_NB->present = SRB_ToAddMod_NB_r13__rlc_Config_r13_PR_explicitValue; + // SRB1_rlc_config_NB->choice.explicitValue.present=RLC_Config_NB_r13_PR_am;//the only possible in NB_IoT + // + //// SRB1_rlc_config_NB->choice.explicitValue.choice.am.ul_AM_RLC_r13.t_PollRetransmit_r13 = enb_properties.properties[ctxt_pP->module_id]->srb1_timer_poll_retransmit_r13; + //// SRB1_rlc_config_NB->choice.explicitValue.choice.am.ul_AM_RLC_r13.maxRetxThreshold_r13 = enb_properties.properties[ctxt_pP->module_id]->srb1_max_retx_threshold_r13; + //// //(musT be disabled--> SRB1 config pag 640 specs ) + //// SRB1_rlc_config_NB->choice.explicitValue.choice.am.dl_AM_RLC_r13.enableStatusReportSN_Gap_r13 =NULL; + // + // + // SRB1_rlc_config_NB->choice.explicitValue.choice.am.ul_AM_RLC_r13.t_PollRetransmit_r13 = T_PollRetransmit_NB_r13_ms25000; + // SRB1_rlc_config_NB->choice.explicitValue.choice.am.ul_AM_RLC_r13.maxRetxThreshold_r13 = UL_AM_RLC_NB_r13__maxRetxThreshold_r13_t8; + // //(musT be disabled--> SRB1 config pag 640 specs ) + // SRB1_rlc_config_NB->choice.explicitValue.choice.am.dl_AM_RLC_r13.enableStatusReportSN_Gap_r13 = NULL; + // + // SRB1_lchan_config_NB = CALLOC(1,sizeof(*SRB1_lchan_config_NB)); + // SRB1_config_NB->logicalChannelConfig_r13 = SRB1_lchan_config_NB; + // + // SRB1_lchan_config_NB->present = SRB_ToAddMod_NB_r13__logicalChannelConfig_r13_PR_explicitValue; + // + // + // prioritySRB1 = CALLOC(1, sizeof(long)); + // *prioritySRB1 = 1; + // SRB1_lchan_config_NB->choice.explicitValue.priority_r13 = prioritySRB1; + // + // logicalChannelSR_Prohibit = CALLOC(1, sizeof(BOOLEAN_t)); + // *logicalChannelSR_Prohibit = 1; + // //schould be set to TRUE (specs pag 641) + // SRB1_lchan_config_NB->choice.explicitValue.logicalChannelSR_Prohibit_r13 = logicalChannelSR_Prohibit; + // + // //ADD SRB1 + // ASN_SEQUENCE_ADD(&(*SRB_configList_NB_IoT)->list,SRB1_config_NB); + } + ///SRB1bis (The configuration for SRB1 and SRB1bis is the same) the only difference is the logical channel identity = 3 but not set here + SRB1bis_config_NB_IoT = CALLOC(1,sizeof(*SRB1bis_config_NB_IoT)); + //no srb_Identity in SRB_ToAddMod_NB + SRB1bis_rlc_config_NB_IoT = CALLOC(1,sizeof(*SRB1bis_rlc_config_NB_IoT)); + SRB1bis_config_NB_IoT->rlc_Config_r13 = SRB1bis_rlc_config_NB_IoT; + SRB1bis_rlc_config_NB_IoT->present = SRB_ToAddMod_NB_r13__rlc_Config_r13_PR_explicitValue; + SRB1bis_rlc_config_NB_IoT->choice.explicitValue.present=RLC_Config_NB_r13_PR_am;//MP: the only possible RLC config in NB_IoT + SRB1bis_rlc_config_NB_IoT->choice.explicitValue.choice.am.ul_AM_RLC_r13.t_PollRetransmit_r13 = T_PollRetransmit_NB_r13_ms25000; + SRB1bis_rlc_config_NB_IoT->choice.explicitValue.choice.am.ul_AM_RLC_r13.maxRetxThreshold_r13 = UL_AM_RLC_NB_r13__maxRetxThreshold_r13_t8; + //(musT be disabled--> SRB1 config pag 640 specs ) + SRB1bis_rlc_config_NB_IoT->choice.explicitValue.choice.am.dl_AM_RLC_r13.enableStatusReportSN_Gap_r13 =NULL; + SRB1bis_lchan_config_NB_IoT = CALLOC(1,sizeof(*SRB1bis_lchan_config_NB_IoT)); + SRB1bis_config_NB_IoT->logicalChannelConfig_r13 = SRB1bis_lchan_config_NB_IoT; + SRB1bis_lchan_config_NB_IoT->present = SRB_ToAddMod_NB_r13__logicalChannelConfig_r13_PR_explicitValue; + prioritySRB1bis = CALLOC(1, sizeof(long)); + *prioritySRB1bis = 1; //same as SRB1? + SRB1bis_lchan_config_NB_IoT->choice.explicitValue.priority_r13 = prioritySRB1bis; + logicalChannelSR_Prohibit = CALLOC(1, sizeof(BOOLEAN_t)); + *logicalChannelSR_Prohibit = 1; //schould be set to TRUE (specs pag 641) + SRB1bis_lchan_config_NB_IoT->choice.explicitValue.logicalChannelSR_Prohibit_r13 = logicalChannelSR_Prohibit; + //ADD SRB1bis + //MP: Actually there is no way to distinguish SRB1 and SRB1bis once put in the list + //MP: SRB_ToAddModList_NB_r13_t size = 1 + ASN_SEQUENCE_ADD(&(*SRB_configList_NB_IoT)->list,SRB1bis_config_NB_IoT); + // PhysicalConfigDedicated (NPDCCH, NPUSCH, CarrierConfig, UplinkPowerControl) + physicalConfigDedicated2_NB_IoT = CALLOC(1,sizeof(*physicalConfigDedicated2_NB_IoT)); + *physicalConfigDedicated_NB_IoT = physicalConfigDedicated2_NB_IoT; + physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13= CALLOC(1, sizeof(*physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13)); + physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13 = CALLOC(1,sizeof(*physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13)); + physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13 = CALLOC(1,sizeof(*physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13)); + physicalConfigDedicated2_NB_IoT->uplinkPowerControlDedicated_r13 = CALLOC(1,sizeof(*physicalConfigDedicated2_NB_IoT->uplinkPowerControlDedicated_r13)); + //no tpc, no cqi and no pucch, no pdsch, no soundingRS, no AntennaInfo, no scheduling request config + /* + * NB-IoT supports the operation with either one or two antenna ports, AP0 and AP1. + * For the latter case, Space Frequency Block Coding (SFBC) is applied. + * Once selected, the same transmission scheme applies to NPBCH, NPDCCH, and NPDSCH. + * */ + //FIXME: MP: CarrierConfigDedicated check the set values ---------------------------------------------- //DL - - physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.dl_CarrierFreq_r13.carrierFreq_r13=0;//random value set - physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.downlinkBitmapNonAnchor_r13= CALLOC(1,sizeof(struct DL_CarrierConfigDedicated_NB_r13__downlinkBitmapNonAnchor_r13)); - physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.downlinkBitmapNonAnchor_r13->present= - DL_CarrierConfigDedicated_NB_r13__downlinkBitmapNonAnchor_r13_PR_useNoBitmap_r13; - - physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.dl_GapNonAnchor_r13 = CALLOC(1,sizeof(struct DL_CarrierConfigDedicated_NB_r13__dl_GapNonAnchor_r13)); - physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.dl_GapNonAnchor_r13->present = - DL_CarrierConfigDedicated_NB_r13__dl_GapNonAnchor_r13_PR_useNoGap_r13; - - physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.inbandCarrierInfo_r13= NULL; - + physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.dl_CarrierFreq_r13.carrierFreq_r13=0;//random value set + physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.downlinkBitmapNonAnchor_r13= CALLOC(1,sizeof(struct DL_CarrierConfigDedicated_NB_r13__downlinkBitmapNonAnchor_r13)); + physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.downlinkBitmapNonAnchor_r13->present= + DL_CarrierConfigDedicated_NB_r13__downlinkBitmapNonAnchor_r13_PR_useNoBitmap_r13; + physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.dl_GapNonAnchor_r13 = CALLOC(1,sizeof(struct DL_CarrierConfigDedicated_NB_r13__dl_GapNonAnchor_r13)); + physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.dl_GapNonAnchor_r13->present = + DL_CarrierConfigDedicated_NB_r13__dl_GapNonAnchor_r13_PR_useNoGap_r13; + physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->dl_CarrierConfig_r13.inbandCarrierInfo_r13= NULL; //UL - physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->ul_CarrierConfig_r13.ul_CarrierFreq_r13= NULL; - - // NPDCCH - physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13->npdcch_NumRepetitions_r13 =0; - physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13->npdcch_Offset_USS_r13 =0; - physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13->npdcch_StartSF_USS_r13=0; - - // NPUSCH //(specs TS 36.331 v14.2.1 pag 643) /* OPTIONAL */ - physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13->ack_NACK_NumRepetitions_r13= NULL; - npusch_AllSymbols= CALLOC(1, sizeof(BOOLEAN_t)); - *npusch_AllSymbols= 1; //TRUE - physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13->npusch_AllSymbols_r13= npusch_AllSymbols; /* OPTIONAL */ - physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13->groupHoppingDisabled_r13=NULL; /* OPTIONAL */ - - // UplinkPowerControlDedicated - physicalConfigDedicated2_NB_IoT->uplinkPowerControlDedicated_r13->p0_UE_NPUSCH_r13 = 0; // 0 dB (specs TS36.331 v14.2.1 pag 643) - - - //Fill the rrcConnectionSetup-NB message - rrcConnectionSetup_NB_IoT->rrc_TransactionIdentifier = Transaction_id; //input value - rrcConnectionSetup_NB_IoT->criticalExtensions.present = RRCConnectionSetup_NB__criticalExtensions_PR_c1; - rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.present =RRCConnectionSetup_NB__criticalExtensions__c1_PR_rrcConnectionSetup_r13 ; - //MP: carry only SRB1bis at the moment and phyConfigDedicated - rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.srb_ToAddModList_r13 = *SRB_configList_NB_IoT; - rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.drb_ToAddModList_r13 = NULL; - rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.drb_ToReleaseList_r13 = NULL; - rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.rlf_TimersAndConstants_r13 = NULL; - rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13 = physicalConfigDedicated2_NB_IoT; - rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.mac_MainConfig_r13 = NULL; - + physicalConfigDedicated2_NB_IoT->carrierConfigDedicated_r13->ul_CarrierConfig_r13.ul_CarrierFreq_r13= NULL; + // NPDCCH + physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13->npdcch_NumRepetitions_r13 =0; + physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13->npdcch_Offset_USS_r13 =0; + physicalConfigDedicated2_NB_IoT->npdcch_ConfigDedicated_r13->npdcch_StartSF_USS_r13=0; + // NPUSCH //(specs TS 36.331 v14.2.1 pag 643) /* OPTIONAL */ + physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13->ack_NACK_NumRepetitions_r13= NULL; + npusch_AllSymbols= CALLOC(1, sizeof(BOOLEAN_t)); + *npusch_AllSymbols= 1; //TRUE + physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13->npusch_AllSymbols_r13= npusch_AllSymbols; /* OPTIONAL */ + physicalConfigDedicated2_NB_IoT->npusch_ConfigDedicated_r13->groupHoppingDisabled_r13=NULL; /* OPTIONAL */ + // UplinkPowerControlDedicated + physicalConfigDedicated2_NB_IoT->uplinkPowerControlDedicated_r13->p0_UE_NPUSCH_r13 = 0; // 0 dB (specs TS36.331 v14.2.1 pag 643) + //Fill the rrcConnectionSetup-NB message + rrcConnectionSetup_NB_IoT->rrc_TransactionIdentifier = Transaction_id; //input value + rrcConnectionSetup_NB_IoT->criticalExtensions.present = RRCConnectionSetup_NB__criticalExtensions_PR_c1; + rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.present =RRCConnectionSetup_NB__criticalExtensions__c1_PR_rrcConnectionSetup_r13 ; + //MP: carry only SRB1bis at the moment and phyConfigDedicated + rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.srb_ToAddModList_r13 = *SRB_configList_NB_IoT; + rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.drb_ToAddModList_r13 = NULL; + rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.drb_ToReleaseList_r13 = NULL; + rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.rlf_TimersAndConstants_r13 = NULL; + rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13 = physicalConfigDedicated2_NB_IoT; + rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.mac_MainConfig_r13 = NULL; #ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg); + xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void *)&dl_ccch_msg); #endif - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB, - (void*)&dl_ccch_msg_NB_IoT, - buffer, - 100); + enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB, + NULL, + (void *)&dl_ccch_msg_NB_IoT, + buffer, + 100); - if (enc_rval.encoded <= 0) { - LOG_F(RRC, "ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - } + if (enc_rval.encoded <= 0) { + LOG_F(RRC, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + } #ifdef USER_MODE - LOG_D(RRC,"RRCConnectionSetup-NB Encoded %zd bits (%zd bytes), ecause %d\n", - enc_rval.encoded,(enc_rval.encoded+7)/8,ecause); + LOG_D(RRC,"RRCConnectionSetup-NB Encoded %zd bits (%zd bytes), ecause %d\n", + enc_rval.encoded,(enc_rval.encoded+7)/8,ecause); #endif - - return((enc_rval.encoded+7)/8); + return((enc_rval.encoded+7)/8); } /*do_SecurityModeCommand - exactly the same as previous implementation*/ uint8_t do_SecurityModeCommand_NB_IoT( - const protocol_ctxt_t* const ctxt_pP, - uint8_t* const buffer, + const protocol_ctxt_t *const ctxt_pP, + uint8_t *const buffer, const uint8_t Transaction_id, const uint8_t cipheringAlgorithm, const uint8_t integrityProtAlgorithm) { DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT; asn_enc_rval_t enc_rval; - memset(&dl_dcch_msg_NB_IoT,0,sizeof(DL_DCCH_Message_NB_t)); - dl_dcch_msg_NB_IoT.message.present = DL_DCCH_MessageType_NB_PR_c1; dl_dcch_msg_NB_IoT.message.choice.c1.present = DL_DCCH_MessageType_NB__c1_PR_securityModeCommand_r13; - dl_dcch_msg_NB_IoT.message.choice.c1.choice.securityModeCommand_r13.rrc_TransactionIdentifier = Transaction_id; dl_dcch_msg_NB_IoT.message.choice.c1.choice.securityModeCommand_r13.criticalExtensions.present = SecurityModeCommand__criticalExtensions_PR_c1; - dl_dcch_msg_NB_IoT.message.choice.c1.choice.securityModeCommand_r13.criticalExtensions.choice.c1.present = - SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8; - + SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8; // the two following information could be based on the mod_id dl_dcch_msg_NB_IoT.message.choice.c1.choice.securityModeCommand_r13.criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm = (CipheringAlgorithm_r12_t)cipheringAlgorithm; //bug solved - dl_dcch_msg_NB_IoT.message.choice.c1.choice.securityModeCommand_r13.criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm = (e_SecurityAlgorithmConfig__integrityProtAlgorithm)integrityProtAlgorithm; - -//only changed "asn_DEF_DL_DCCH_Message_NB" + //only changed "asn_DEF_DL_DCCH_Message_NB" #ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_DL_DCCH_Message_NB, (void*)&dl_dcch_msg_NB_IoT); + xer_fprint(stdout, &asn_DEF_DL_DCCH_Message_NB, (void *)&dl_dcch_msg_NB_IoT); #endif enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message_NB, - (void*)&dl_dcch_msg_NB_IoT, + NULL, + (void *)&dl_dcch_msg_NB_IoT, buffer, 100); + if (enc_rval.encoded <= 0) { - LOG_F(RRC, "ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); + LOG_F(RRC, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); } - -//#if defined(ENABLE_ITTI) -//# if !defined(DISABLE_XER_SPRINT).... - + //#if defined(ENABLE_ITTI) + //# if !defined(DISABLE_XER_SPRINT).... #ifdef USER_MODE LOG_D(RRC,"[NB-IoT %d] securityModeCommand-NB for UE %x Encoded %zd bits (%zd bytes)\n", ctxt_pP->module_id, @@ -971,46 +809,40 @@ uint8_t do_SecurityModeCommand_NB_IoT( /*do_UECapabilityEnquiry_NB_IoT - very similar to legacy lte*/ uint8_t do_UECapabilityEnquiry_NB_IoT( - const protocol_ctxt_t* const ctxt_pP, - uint8_t* const buffer, + const protocol_ctxt_t *const ctxt_pP, + uint8_t *const buffer, const uint8_t Transaction_id ) { - DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT; //no RAT type in NB-IoT asn_enc_rval_t enc_rval; - memset(&dl_dcch_msg_NB_IoT,0,sizeof(DL_DCCH_Message_NB_t)); - dl_dcch_msg_NB_IoT.message.present = DL_DCCH_MessageType_NB_PR_c1; dl_dcch_msg_NB_IoT.message.choice.c1.present = DL_DCCH_MessageType_NB__c1_PR_ueCapabilityEnquiry_r13; - dl_dcch_msg_NB_IoT.message.choice.c1.choice.ueCapabilityEnquiry_r13.rrc_TransactionIdentifier = Transaction_id; - dl_dcch_msg_NB_IoT.message.choice.c1.choice.ueCapabilityEnquiry_r13.criticalExtensions.present = UECapabilityEnquiry_NB__criticalExtensions_PR_c1; dl_dcch_msg_NB_IoT.message.choice.c1.choice.ueCapabilityEnquiry_r13.criticalExtensions.choice.c1.present = - UECapabilityEnquiry_NB__criticalExtensions__c1_PR_ueCapabilityEnquiry_r13; - + UECapabilityEnquiry_NB__criticalExtensions__c1_PR_ueCapabilityEnquiry_r13; //no ue_CapabilityRequest (list of RAT_Type) - -//only changed "asn_DEF_DL_DCCH_Message_NB" + //only changed "asn_DEF_DL_DCCH_Message_NB" #ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_DL_DCCH_Message_NB, (void*)&dl_dcch_msg_NB_IoT); + xer_fprint(stdout, &asn_DEF_DL_DCCH_Message_NB, (void *)&dl_dcch_msg_NB_IoT); #endif enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message_NB, - (void*)&dl_dcch_msg_NB_IoT, + NULL, + (void *)&dl_dcch_msg_NB_IoT, buffer, 100); + if (enc_rval.encoded <= 0) { - LOG_F(RRC, "ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - } - -//#if defined(ENABLE_ITTI) -//# if !defined(DISABLE_XER_SPRINT).... + LOG_F(RRC, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + } + //#if defined(ENABLE_ITTI) + //# if !defined(DISABLE_XER_SPRINT).... #ifdef USER_MODE LOG_D(RRC,"[NB-IoT %d] UECapabilityEnquiry-NB for UE %x Encoded %zd bits (%zd bytes)\n", ctxt_pP->module_id, @@ -1033,39 +865,32 @@ uint8_t do_UECapabilityEnquiry_NB_IoT( * (including RBs, MAC main configuration and physical channel configuration) * including any associated dedicated NAS information.*/ uint16_t do_RRCConnectionReconfiguration_NB_IoT( - const protocol_ctxt_t* const ctxt_pP, - uint8_t *buffer, - uint8_t Transaction_id, - SRB_ToAddModList_NB_r13_t *SRB1_list_NB, //SRB_ConfigList2 (default)--> only SRB1 - DRB_ToAddModList_NB_r13_t *DRB_list_NB_IoT, //DRB_ConfigList (default) - DRB_ToReleaseList_NB_r13_t *DRB_list2_NB_IoT, //is NULL when passed - struct PhysicalConfigDedicated_NB_r13 *physicalConfigDedicated_NB_IoT, - MAC_MainConfig_NB_r13_t *mac_MainConfig_NB_IoT, - struct RRCConnectionReconfiguration_NB_r13_IEs__dedicatedInfoNASList_r13* dedicatedInfoNASList_NB_IoT) + const protocol_ctxt_t *const ctxt_pP, + uint8_t *buffer, + uint8_t Transaction_id, + SRB_ToAddModList_NB_r13_t *SRB1_list_NB, //SRB_ConfigList2 (default)--> only SRB1 + DRB_ToAddModList_NB_r13_t *DRB_list_NB_IoT, //DRB_ConfigList (default) + DRB_ToReleaseList_NB_r13_t *DRB_list2_NB_IoT, //is NULL when passed + struct PhysicalConfigDedicated_NB_r13 *physicalConfigDedicated_NB_IoT, + MAC_MainConfig_NB_r13_t *mac_MainConfig_NB_IoT, + struct RRCConnectionReconfiguration_NB_r13_IEs__dedicatedInfoNASList_r13 *dedicatedInfoNASList_NB_IoT) { - - //check on DRB_list if contains more than 2 DRB? - + //check on DRB_list if contains more than 2 DRB? asn_enc_rval_t enc_rval; DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT; RRCConnectionReconfiguration_NB_t *rrcConnectionReconfiguration_NB; - - memset(&dl_dcch_msg_NB_IoT,0,sizeof(DL_DCCH_Message_NB_t)); - dl_dcch_msg_NB_IoT.message.present = DL_DCCH_MessageType_NB_PR_c1; dl_dcch_msg_NB_IoT.message.choice.c1.present = DL_DCCH_MessageType_NB__c1_PR_rrcConnectionReconfiguration_r13; rrcConnectionReconfiguration_NB = &dl_dcch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionReconfiguration_r13; - // RRCConnectionReconfiguration rrcConnectionReconfiguration_NB->rrc_TransactionIdentifier = Transaction_id; rrcConnectionReconfiguration_NB->criticalExtensions.present = RRCConnectionReconfiguration_NB__criticalExtensions_PR_c1; rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.present =RRCConnectionReconfiguration_NB__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r13 ; - //RAdioResourceconfigDedicated rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13 = - CALLOC(1,sizeof(*rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13)); + CALLOC(1,sizeof(*rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13)); rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->srb_ToAddModList_r13 = SRB1_list_NB; //only SRB1 rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->drb_ToAddModList_r13 = DRB_list_NB_IoT; rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->drb_ToReleaseList_r13 = DRB_list2_NB_IoT; //NULL @@ -1075,77 +900,69 @@ uint16_t do_RRCConnectionReconfiguration_NB_IoT( if (mac_MainConfig_NB_IoT!=NULL) { rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13 = - CALLOC(1, sizeof(*rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13)); + CALLOC(1, sizeof(*rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13)); rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13->present =RadioResourceConfigDedicated_NB_r13__mac_MainConfig_r13_PR_explicitValue_r13; - //why memcopy only this one? + //why memcopy only this one? memcpy(&rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13->choice.explicitValue_r13, mac_MainConfig_NB_IoT, sizeof(*mac_MainConfig_NB_IoT)); - } else { - rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13=NULL; + rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.radioResourceConfigDedicated_r13->mac_MainConfig_r13=NULL; } //no measConfig, measIDlist //no mobilityControlInfo - rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.dedicatedInfoNASList_r13 = dedicatedInfoNASList_NB_IoT; //mainly used for cell-reselection/handover purposes?? rrcConnectionReconfiguration_NB->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r13.fullConfig_r13 = NULL; - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message_NB, - (void*)&dl_dcch_msg_NB_IoT, + NULL, + (void *)&dl_dcch_msg_NB_IoT, buffer, RRC_BUF_SIZE); + if (enc_rval.encoded <= 0) { - LOG_F(RRC, "ASN1 message encoding failed %s, %li\n", - enc_rval.failed_type->name, enc_rval.encoded); + LOG_F(RRC, "ASN1 message encoding failed %s, %li\n", + enc_rval.failed_type->name, enc_rval.encoded); } //changed only asn_DEF_DL_DCCH_Message_NB #ifdef XER_PRINT - xer_fprint(stdout,&asn_DEF_DL_DCCH_Message_NB,(void*)&dl_dcch_msg_NB_IoT); + xer_fprint(stdout,&asn_DEF_DL_DCCH_Message_NB,(void *)&dl_dcch_msg_NB_IoT); #endif - -//#if defined(ENABLE_ITTI) -//# if !defined(DISABLE_XER_SPRINT)... - - + //#if defined(ENABLE_ITTI) + //# if !defined(DISABLE_XER_SPRINT)... LOG_I(RRC,"RRCConnectionReconfiguration-NB Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); - return((enc_rval.encoded+7)/8); } /*do_RRCConnectionReestablishmentReject - exactly the same as legacy LTE*/ uint8_t do_RRCConnectionReestablishmentReject_NB_IoT( - uint8_t Mod_id, - uint8_t* const buffer) + uint8_t Mod_id, + uint8_t *const buffer) { - asn_enc_rval_t enc_rval; - DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT; RRCConnectionReestablishmentReject_t *rrcConnectionReestablishmentReject; - memset((void *)&dl_ccch_msg_NB_IoT,0,sizeof(DL_CCCH_Message_NB_t)); dl_ccch_msg_NB_IoT.message.present = DL_CCCH_MessageType_NB_PR_c1; dl_ccch_msg_NB_IoT.message.choice.c1.present = DL_CCCH_MessageType_NB__c1_PR_rrcConnectionReestablishmentReject_r13; rrcConnectionReestablishmentReject = &dl_ccch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionReestablishmentReject_r13; - // RRCConnectionReestablishmentReject //exactly the same as LTE rrcConnectionReestablishmentReject->criticalExtensions.present = RRCConnectionReestablishmentReject__criticalExtensions_PR_rrcConnectionReestablishmentReject_r8; - //Only change in "asn_DEF_DL_CCCH_Message_NB" #ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_DL_CCCH_Message_NB, (void*)&dl_ccch_msg_NB_IoT); + xer_fprint(stdout, &asn_DEF_DL_CCCH_Message_NB, (void *)&dl_ccch_msg_NB_IoT); #endif enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB, - (void*)&dl_ccch_msg_NB_IoT, + NULL, + (void *)&dl_ccch_msg_NB_IoT, buffer, 100); + if (enc_rval.encoded <= 0) { - LOG_F(RRC,"ASN1 message encoding failed (%s, %lu)!\n", - enc_rval.failed_type->name, enc_rval.encoded); + LOG_F(RRC,"ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); } //Only change in "asn_DEF_DL_CCCH_Message_NB" @@ -1157,42 +974,34 @@ uint8_t do_RRCConnectionReestablishmentReject_NB_IoT( if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message_NB, (void *) &dl_ccch_msg_NB_IoT)) > 0) { MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB_NB_IoT, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); } } # endif #endif - #ifdef USER_MODE LOG_D(RRC,"RRCConnectionReestablishmentReject Encoded %zd bits (%zd bytes)\n", enc_rval.encoded,(enc_rval.encoded+7)/8); #endif - return((enc_rval.encoded+7)/8); } /*do_RRCConnectionReject_NB_IoT*/ uint8_t do_RRCConnectionReject_NB_IoT( - uint8_t Mod_id, - uint8_t* const buffer) + uint8_t Mod_id, + uint8_t *const buffer) { - asn_enc_rval_t enc_rval; - DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT; RRCConnectionReject_NB_t *rrcConnectionReject_NB_IoT; - memset((void *)&dl_ccch_msg_NB_IoT,0,sizeof(DL_CCCH_Message_NB_t)); dl_ccch_msg_NB_IoT.message.present = DL_CCCH_MessageType_NB_PR_c1; dl_ccch_msg_NB_IoT.message.choice.c1.present = DL_CCCH_MessageType_NB__c1_PR_rrcConnectionReject_r13; rrcConnectionReject_NB_IoT = &dl_ccch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionReject_r13; - // RRCConnectionReject-NB_IoT rrcConnectionReject_NB_IoT->criticalExtensions.present = RRCConnectionReject_NB__criticalExtensions_PR_c1; rrcConnectionReject_NB_IoT->criticalExtensions.choice.c1.present = RRCConnectionReject_NB__criticalExtensions__c1_PR_rrcConnectionReject_r13; @@ -1201,21 +1010,22 @@ uint8_t do_RRCConnectionReject_NB_IoT( //new-use of suspend indication //If present, this field indicates that the UE should remain suspended and not release its stored context. rrcConnectionReject_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReject_r13.rrc_SuspendIndication_r13= - CALLOC(1, sizeof(long)); + CALLOC(1, sizeof(long)); *(rrcConnectionReject_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReject_r13.rrc_SuspendIndication_r13)= - RRCConnectionReject_NB_r13_IEs__rrc_SuspendIndication_r13_true; - + RRCConnectionReject_NB_r13_IEs__rrc_SuspendIndication_r13_true; //Only Modified "asn_DEF_DL_CCCH_Message_NB" #ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_DL_CCCH_Message_NB, (void*)&dl_ccch_msg); + xer_fprint(stdout, &asn_DEF_DL_CCCH_Message_NB, (void *)&dl_ccch_msg); #endif enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB, - (void*)&dl_ccch_msg_NB_IoT, + NULL, + (void *)&dl_ccch_msg_NB_IoT, buffer, 100); + if (enc_rval.encoded <= 0) { - LOG_F(RRC, "ASN1 message encoding failed (%s, %ld)!\n", - enc_rval.failed_type->name, enc_rval.encoded); + LOG_F(RRC, "ASN1 message encoding failed (%s, %ld)!\n", + enc_rval.failed_type->name, enc_rval.encoded); } #if defined(ENABLE_ITTI) @@ -1226,22 +1036,18 @@ uint8_t do_RRCConnectionReject_NB_IoT( if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message_NB, (void *) &dl_ccch_msg_NB_IoT)) > 0) { MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB_NB_IoT, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); } } # endif #endif - #ifdef USER_MODE LOG_D(RRC,"RRCConnectionReject-NB Encoded %zd bits (%zd bytes)\n", enc_rval.encoded,(enc_rval.encoded+7)/8); #endif - return((enc_rval.encoded+7)/8); } @@ -1251,19 +1057,16 @@ uint8_t do_RRCConnectionReject_NB_IoT( /*do_DLInformationTransfer_NB*/ uint8_t do_DLInformationTransfer_NB_IoT( - uint8_t Mod_id, - uint8_t **buffer, - uint8_t transaction_id, - uint32_t pdu_length, - uint8_t *pdu_buffer) + uint8_t Mod_id, + uint8_t **buffer, + uint8_t transaction_id, + uint32_t pdu_length, + uint8_t *pdu_buffer) { ssize_t encoded; - DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT; - memset(&dl_dcch_msg_NB_IoT, 0, sizeof(DL_DCCH_Message_NB_t)); - dl_dcch_msg_NB_IoT.message.present = DL_DCCH_MessageType_NB_PR_c1; dl_dcch_msg_NB_IoT.message.choice.c1.present = DL_DCCH_MessageType_NB__c1_PR_dlInformationTransfer_r13; dl_dcch_msg_NB_IoT.message.choice.c1.choice.dlInformationTransfer_r13.rrc_TransactionIdentifier = transaction_id; @@ -1271,9 +1074,7 @@ uint8_t do_DLInformationTransfer_NB_IoT( dl_dcch_msg_NB_IoT.message.choice.c1.choice.dlInformationTransfer_r13.criticalExtensions.choice.c1.present = DLInformationTransfer_NB__criticalExtensions__c1_PR_dlInformationTransfer_r13; dl_dcch_msg_NB_IoT.message.choice.c1.choice.dlInformationTransfer_r13.criticalExtensions.choice.c1.choice.dlInformationTransfer_r13.dedicatedInfoNAS_r13.size = pdu_length; dl_dcch_msg_NB_IoT.message.choice.c1.choice.dlInformationTransfer_r13.criticalExtensions.choice.c1.choice.dlInformationTransfer_r13.dedicatedInfoNAS_r13.buf = pdu_buffer; - - encoded = uper_encode_to_new_buffer (&asn_DEF_DL_DCCH_Message_NB, NULL, (void*) &dl_dcch_msg_NB_IoT, (void **) buffer); - + encoded = uper_encode_to_new_buffer (&asn_DEF_DL_DCCH_Message_NB, NULL, (void *) &dl_dcch_msg_NB_IoT, (void **) buffer); //only change in "asn_DEF_DL_DCCH_Message_NB" #if defined(ENABLE_ITTI) # if !defined(DISABLE_XER_SPRINT) @@ -1283,17 +1084,14 @@ uint8_t do_DLInformationTransfer_NB_IoT( if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message_NB, (void *)&dl_dcch_msg_NB_IoT)) > 0) { MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB_NB_IoT, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); } } # endif #endif - return encoded; } @@ -1304,51 +1102,44 @@ uint8_t do_DLInformationTransfer_NB_IoT( /*do_RRCConnectionReestablishment_NB-->used to re-establish SRB1*/ //which parameter to use? uint8_t do_RRCConnectionReestablishment_NB_IoT( - uint8_t Mod_id, - uint8_t* const buffer, - const uint8_t Transaction_id, - const NB_IoT_DL_FRAME_PARMS* const frame_parms, //to be changed - SRB_ToAddModList_NB_r13_t* SRB_list_NB_IoT) //should contain SRB1 already configured? + uint8_t Mod_id, + uint8_t *const buffer, + const uint8_t Transaction_id, + const NB_IoT_DL_FRAME_PARMS *const frame_parms, //to be changed + SRB_ToAddModList_NB_r13_t *SRB_list_NB_IoT) //should contain SRB1 already configured? { + asn_enc_rval_t enc_rval; + DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT; + RRCConnectionReestablishment_NB_t *rrcConnectionReestablishment_NB_IoT; + memset(&dl_ccch_msg_NB_IoT, 0, sizeof(DL_CCCH_Message_NB_t)); + dl_ccch_msg_NB_IoT.message.present = DL_CCCH_MessageType_NB_PR_c1; + dl_ccch_msg_NB_IoT.message.choice.c1.present = DL_CCCH_MessageType_NB__c1_PR_rrcConnectionReestablishment_r13; + rrcConnectionReestablishment_NB_IoT = &dl_ccch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionReestablishment_r13; + //rrcConnectionReestablishment_NB + rrcConnectionReestablishment_NB_IoT->rrc_TransactionIdentifier = Transaction_id; + rrcConnectionReestablishment_NB_IoT->criticalExtensions.present = RRCConnectionReestablishment_NB__criticalExtensions_PR_c1; + rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.present = RRCConnectionReestablishment_NB__criticalExtensions__c1_PR_rrcConnectionReestablishment_r13; + rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.srb_ToAddModList_r13 = SRB_list_NB_IoT; + rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.drb_ToAddModList_r13 = NULL; + rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.drb_ToReleaseList_r13 = NULL; + rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.rlf_TimersAndConstants_r13= NULL; + rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.mac_MainConfig_r13= NULL; + rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13 = NULL; + rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.nextHopChainingCount_r13=0; + enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB, + NULL, + (void *)&dl_ccch_msg_NB_IoT, + buffer, + RRC_BUF_SIZE); - asn_enc_rval_t enc_rval; - DL_CCCH_Message_NB_t dl_ccch_msg_NB_IoT; - RRCConnectionReestablishment_NB_t* rrcConnectionReestablishment_NB_IoT; - - memset(&dl_ccch_msg_NB_IoT, 0, sizeof(DL_CCCH_Message_NB_t)); - - dl_ccch_msg_NB_IoT.message.present = DL_CCCH_MessageType_NB_PR_c1; - dl_ccch_msg_NB_IoT.message.choice.c1.present = DL_CCCH_MessageType_NB__c1_PR_rrcConnectionReestablishment_r13; - rrcConnectionReestablishment_NB_IoT = &dl_ccch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionReestablishment_r13; - - //rrcConnectionReestablishment_NB - rrcConnectionReestablishment_NB_IoT->rrc_TransactionIdentifier = Transaction_id; - rrcConnectionReestablishment_NB_IoT->criticalExtensions.present = RRCConnectionReestablishment_NB__criticalExtensions_PR_c1; - rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.present = RRCConnectionReestablishment_NB__criticalExtensions__c1_PR_rrcConnectionReestablishment_r13; - - rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.srb_ToAddModList_r13 = SRB_list_NB_IoT; - rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.drb_ToAddModList_r13 = NULL; - rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.drb_ToReleaseList_r13 = NULL; - rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.rlf_TimersAndConstants_r13= NULL; - rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.mac_MainConfig_r13= NULL; - rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.radioResourceConfigDedicated_r13.physicalConfigDedicated_r13 = NULL; - - rrcConnectionReestablishment_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionReestablishment_r13.nextHopChainingCount_r13=0; - - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB, - (void*)&dl_ccch_msg_NB_IoT, - buffer, - RRC_BUF_SIZE); - - if (enc_rval.encoded <= 0) { - LOG_F(RRC, "ASN1 message encoding failed (%s, %li)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - } + if (enc_rval.encoded <= 0) { + LOG_F(RRC, "ASN1 message encoding failed (%s, %li)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + } #ifdef XER_PRINT - xer_fprint(stdout,&asn_DEF_DL_CCCH_Message_NB,(void*)&dl_ccch_msg_NB_IoT); + xer_fprint(stdout,&asn_DEF_DL_CCCH_Message_NB,(void *)&dl_ccch_msg_NB_IoT); #endif - #if defined(ENABLE_ITTI) # if !defined(DISABLE_XER_SPRINT) { @@ -1357,17 +1148,14 @@ uint8_t do_RRCConnectionReestablishment_NB_IoT( if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message_NB, (void *) &dl_ccch_msg_NB_IoT)) > 0) { MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB_NB_IoT, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); } } # endif #endif - LOG_I(RRC,"RRCConnectionReestablishment-NB Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); return 0; } @@ -1376,39 +1164,30 @@ uint8_t do_RRCConnectionReestablishment_NB_IoT( uint8_t do_RRCConnectionRelease_NB_IoT( uint8_t Mod_id, uint8_t *buffer, - const uint8_t Transaction_id) + const uint8_t Transaction_id) { - asn_enc_rval_t enc_rval; - DL_DCCH_Message_NB_t dl_dcch_msg_NB_IoT; RRCConnectionRelease_NB_t *rrcConnectionRelease_NB_IoT; - - memset(&dl_dcch_msg_NB_IoT,0,sizeof(DL_DCCH_Message_NB_t)); - dl_dcch_msg_NB_IoT.message.present = DL_DCCH_MessageType_NB_PR_c1; dl_dcch_msg_NB_IoT.message.choice.c1.present = DL_DCCH_MessageType_NB__c1_PR_rrcConnectionRelease_r13; rrcConnectionRelease_NB_IoT = &dl_dcch_msg_NB_IoT.message.choice.c1.choice.rrcConnectionRelease_r13; - // RRCConnectionRelease rrcConnectionRelease_NB_IoT->rrc_TransactionIdentifier = Transaction_id; rrcConnectionRelease_NB_IoT->criticalExtensions.present = RRCConnectionRelease_NB__criticalExtensions_PR_c1; rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.present =RRCConnectionRelease_NB__criticalExtensions__c1_PR_rrcConnectionRelease_r13 ; - rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.releaseCause_r13 = ReleaseCause_NB_r13_other; rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.redirectedCarrierInfo_r13 = NULL; rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.extendedWaitTime_r13 = NULL; - //Why allocate memory for non critical extension? rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.nonCriticalExtension=CALLOC(1, sizeof(*rrcConnectionRelease_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r13.nonCriticalExtension)); - enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message_NB, - (void*)&dl_dcch_msg_NB_IoT, + NULL, + (void *)&dl_dcch_msg_NB_IoT, buffer, RRC_BUF_SIZE);//check - return((enc_rval.encoded+7)/8); } diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c index 3edf230ac2..7cd87ab2b7 100644 --- a/openair2/RRC/LITE/rrc_UE.c +++ b/openair2/RRC/LITE/rrc_UE.c @@ -97,38 +97,38 @@ extern void *bigphys_malloc(int); //extern int8_t dB_fixed2(uint32_t x,uint32_t y); extern void pdcp_config_set_security( - const protocol_ctxt_t* const ctxt_pP, - pdcp_t * const pdcp_pP, + const protocol_ctxt_t *const ctxt_pP, + pdcp_t *const pdcp_pP, const rb_id_t rb_idP, const uint16_t lc_idP, const uint8_t security_modeP, - uint8_t * const kRRCenc, - uint8_t * const kRRCint, - uint8_t * const kUPenc); + uint8_t *const kRRCenc, + uint8_t *const kRRCint, + uint8_t *const kUPenc); // internal prototypes -void rrc_ue_process_securityModeCommand( const protocol_ctxt_t* const ctxt_pP, SecurityModeCommand_t* const securityModeCommand, const uint8_t eNB_index ); +void rrc_ue_process_securityModeCommand( const protocol_ctxt_t *const ctxt_pP, SecurityModeCommand_t *const securityModeCommand, const uint8_t eNB_index ); -static int decode_SI( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index ); +static int decode_SI( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index ); -static int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t rsrq, const uint8_t rsrp ); +static int decode_SIB1( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, const uint8_t rsrq, const uint8_t rsrp ); /** \brief Generates/Encodes RRCConnnectionSetupComplete message at UE * \param ctxt_pP Running context * \param eNB_index Index of corresponding eNB/CH * \param Transaction_id Transaction identifier */ -static void rrc_ue_generate_RRCConnectionSetupComplete( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id ); +static void rrc_ue_generate_RRCConnectionSetupComplete( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id ); /** \brief Generates/Encodes RRCConnectionReconfigurationComplete message at UE * \param ctxt_pP Running context * \param eNB_index Index of corresponding eNB/CH * \param Transaction_id RRC transaction identifier */ -static void rrc_ue_generate_RRCConnectionReconfigurationComplete( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id ); +static void rrc_ue_generate_RRCConnectionReconfigurationComplete( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id ); -static void rrc_ue_generate_MeasurementReport(protocol_ctxt_t* const ctxt_pP, uint8_t eNB_index ); +static void rrc_ue_generate_MeasurementReport(protocol_ctxt_t *const ctxt_pP, uint8_t eNB_index ); static uint8_t check_trigger_meas_event( uint8_t module_idP, @@ -171,15 +171,12 @@ static int rrc_set_state (module_id_t ue_mod_idP, Rrc_State_t state) if (UE_rrc_inst[ue_mod_idP].RrcState != state) { UE_rrc_inst[ue_mod_idP].RrcState = state; - #if defined(ENABLE_ITTI) { MessageDef *msg_p; - msg_p = itti_alloc_new_message(TASK_RRC_UE, RRC_STATE_IND); RRC_STATE_IND(msg_p).state = UE_rrc_inst[ue_mod_idP].RrcState; RRC_STATE_IND(msg_p).sub_state = UE_rrc_inst[ue_mod_idP].RrcSubState; - itti_send_msg_to_task(TASK_UNKNOWN, UE_MODULE_ID_TO_INSTANCE(ue_mod_idP), msg_p); } #endif @@ -195,35 +192,32 @@ static int rrc_set_sub_state( module_id_t ue_mod_idP, Rrc_Sub_State_t subState ) #if (defined(ENABLE_ITTI) && (defined(ENABLE_USE_MME) || ENABLE_RAL)) switch (UE_rrc_inst[ue_mod_idP].RrcState) { - case RRC_STATE_INACTIVE: - AssertFatal ((RRC_SUB_STATE_INACTIVE_FIRST <= subState) && (subState <= RRC_SUB_STATE_INACTIVE_LAST), - "Invalid sub state %d for state %d!\n", subState, UE_rrc_inst[ue_mod_idP].RrcState); - break; + case RRC_STATE_INACTIVE: + AssertFatal ((RRC_SUB_STATE_INACTIVE_FIRST <= subState) && (subState <= RRC_SUB_STATE_INACTIVE_LAST), + "Invalid sub state %d for state %d!\n", subState, UE_rrc_inst[ue_mod_idP].RrcState); + break; - case RRC_STATE_IDLE: - AssertFatal ((RRC_SUB_STATE_IDLE_FIRST <= subState) && (subState <= RRC_SUB_STATE_IDLE_LAST), - "Invalid sub state %d for state %d!\n", subState, UE_rrc_inst[ue_mod_idP].RrcState); - break; + case RRC_STATE_IDLE: + AssertFatal ((RRC_SUB_STATE_IDLE_FIRST <= subState) && (subState <= RRC_SUB_STATE_IDLE_LAST), + "Invalid sub state %d for state %d!\n", subState, UE_rrc_inst[ue_mod_idP].RrcState); + break; - case RRC_STATE_CONNECTED: - AssertFatal ((RRC_SUB_STATE_CONNECTED_FIRST <= subState) && (subState <= RRC_SUB_STATE_CONNECTED_LAST), - "Invalid sub state %d for state %d!\n", subState, UE_rrc_inst[ue_mod_idP].RrcState); - break; + case RRC_STATE_CONNECTED: + AssertFatal ((RRC_SUB_STATE_CONNECTED_FIRST <= subState) && (subState <= RRC_SUB_STATE_CONNECTED_LAST), + "Invalid sub state %d for state %d!\n", subState, UE_rrc_inst[ue_mod_idP].RrcState); + break; } #endif if (UE_rrc_inst[ue_mod_idP].RrcSubState != subState) { UE_rrc_inst[ue_mod_idP].RrcSubState = subState; - #if defined(ENABLE_ITTI) { MessageDef *msg_p; - msg_p = itti_alloc_new_message(TASK_RRC_UE, RRC_STATE_IND); RRC_STATE_IND(msg_p).state = UE_rrc_inst[ue_mod_idP].RrcState; RRC_STATE_IND(msg_p).sub_state = UE_rrc_inst[ue_mod_idP].RrcSubState; - itti_send_msg_to_task(TASK_UNKNOWN, UE_MODULE_ID_TO_INSTANCE(ue_mod_idP), msg_p); } #endif @@ -236,33 +230,31 @@ static int rrc_set_sub_state( module_id_t ue_mod_idP, Rrc_Sub_State_t subState ) //----------------------------------------------------------------------------- void openair_rrc_on_ue( - const protocol_ctxt_t* const ctxt_pP + const protocol_ctxt_t *const ctxt_pP ) //----------------------------------------------------------------------------- { unsigned short i; + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" UE?:OPENAIR RRC IN....\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); - - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" UE?:OPENAIR RRC IN....\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); - - for (i = 0; i < NB_eNB_INST; i++) { - LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" Activating CCCH (eNB %d)\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), i); - UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Srb_id = CCCH; - memcpy (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Lchan_desc[0], &CCCH_LCHAN_DESC, LCHAN_DESC_SIZE); - memcpy (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Lchan_desc[1], &CCCH_LCHAN_DESC, LCHAN_DESC_SIZE); - rrc_config_buffer (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i], CCCH, 1); - UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Active = 1; - } + for (i = 0; i < NB_eNB_INST; i++) { + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" Activating CCCH (eNB %d)\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), i); + UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Srb_id = CCCH; + memcpy (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Lchan_desc[0], &CCCH_LCHAN_DESC, LCHAN_DESC_SIZE); + memcpy (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Lchan_desc[1], &CCCH_LCHAN_DESC, LCHAN_DESC_SIZE); + rrc_config_buffer (&UE_rrc_inst[ctxt_pP->module_id].Srb0[i], CCCH, 1); + UE_rrc_inst[ctxt_pP->module_id].Srb0[i].Active = 1; + } } //----------------------------------------------------------------------------- -static void init_SI_UE( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index ) +static void init_SI_UE( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index ) { UE_rrc_inst[ctxt_pP->module_id].sizeof_SIB1[eNB_index] = 0; UE_rrc_inst[ctxt_pP->module_id].sizeof_SI[eNB_index] = 0; - UE_rrc_inst[ctxt_pP->module_id].SIB1[eNB_index] = (uint8_t*)malloc16_clear( 32 ); + UE_rrc_inst[ctxt_pP->module_id].SIB1[eNB_index] = (uint8_t *)malloc16_clear( 32 ); UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType1_t) ); UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType2_t) ); UE_rrc_inst[ctxt_pP->module_id].sib3[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType3_t) ); @@ -278,10 +270,8 @@ static void init_SI_UE( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_ UE_rrc_inst[ctxt_pP->module_id].sib12[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType12_r9_t) ); UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index] = malloc16_clear( sizeof(SystemInformationBlockType13_r9_t) ); #endif - UE_rrc_inst[ctxt_pP->module_id].SI[eNB_index] = (uint8_t*)malloc16_clear( 64 ); - - UE_rrc_inst[ctxt_pP->module_id].si[eNB_index] = (SystemInformation_t*)malloc16_clear( sizeof(SystemInformation_t) ); - + UE_rrc_inst[ctxt_pP->module_id].SI[eNB_index] = (uint8_t *)malloc16_clear( 64 ); + UE_rrc_inst[ctxt_pP->module_id].si[eNB_index] = (SystemInformation_t *)malloc16_clear( sizeof(SystemInformation_t) ); UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus = 0; UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIcnt = 0; } @@ -298,21 +288,19 @@ static void init_MCCH_UE(module_id_t ue_mod_idP, uint8_t eNB_index) for (i=0; i<8; i++) { // MAX MBSFN Area UE_rrc_inst[ue_mod_idP].Info[eNB_index].MCCHStatus[i] = 0; - } } #endif #endif //----------------------------------------------------------------------------- -static void openair_rrc_ue_init_security( const protocol_ctxt_t* const ctxt_pP ) +static void openair_rrc_ue_init_security( const protocol_ctxt_t *const ctxt_pP ) { #if defined(ENABLE_SECURITY) // uint8_t *kRRCenc; // uint8_t *kRRCint; char ascii_buffer[65]; uint8_t i; - memset(UE_rrc_inst[ctxt_pP->module_id].kenb, ctxt_pP->module_id, 32); for (i = 0; i < 32; i++) { @@ -335,7 +323,6 @@ char openair_rrc_ue_init( const module_id_t ue_mod_idP, const unsigned char eNB_ PROTOCOL_RRC_CTXT_ARGS(&ctxt)); rrc_set_state (ue_mod_idP, RRC_STATE_INACTIVE); rrc_set_sub_state (ue_mod_idP, RRC_SUB_STATE_INACTIVE); - LOG_D(RRC,"[UE %d] INIT State = RRC_IDLE (eNB %d)\n",ctxt.module_id,eNB_index); UE_rrc_inst[ctxt.module_id].Info[eNB_index].State=RRC_IDLE; UE_rrc_inst[ctxt.module_id].Info[eNB_index].T300_active = 0; @@ -352,16 +339,13 @@ char openair_rrc_ue_init( const module_id_t ue_mod_idP, const unsigned char eNB_ #else UE_rrc_inst[ctxt.module_id].integrity_algorithm = SecurityAlgorithmConfig__integrityProtAlgorithm_reserved; #endif - openair_rrc_ue_init_security(&ctxt); init_SI_UE(&ctxt,eNB_index); LOG_D(RRC,PROTOCOL_RRC_CTXT_FMT" INIT: phy_sync_2_ch_ind\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); - #ifndef NO_RRM send_msg(&S_rrc,msg_rrc_phy_synch_to_CH_ind(ctxt.module_id,eNB_index,UE_rrc_inst[ctxt.module_id].Mac_id)); #endif - #ifdef NO_RRM //init ch SRB0, SRB1 & BDTCH openair_rrc_on_ue(&ctxt); #endif @@ -374,18 +358,15 @@ char openair_rrc_ue_init( const module_id_t ue_mod_idP, const unsigned char eNB_ UE_rrc_inst[ue_mod_idP].num_active_cba_groups = 0; #endif - return 0; } //----------------------------------------------------------------------------- -void rrc_ue_generate_RRCConnectionRequest( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index ) +void rrc_ue_generate_RRCConnectionRequest( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index ) { - uint8_t i=0,rv[6]; if(UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size ==0) { - // Get RRCConnectionRequest, fill random for now // Generate random byte stream for contention resolution for (i=0; i<6; i++) { @@ -402,9 +383,8 @@ void rrc_ue_generate_RRCConnectionRequest( const protocol_ctxt_t* const ctxt_pP, UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size = do_RRCConnectionRequest( ctxt_pP->module_id, - (uint8_t*)UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.Payload, + (uint8_t *)UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.Payload, rv); - LOG_I(RRC,"[UE %d] : Frame %d, Logical Channel UL-CCCH (SRB0), Generating RRCConnectionRequest (bytes %d, eNB %d)\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Srb0[eNB_index].Tx_buffer.payload_size, eNB_index); @@ -415,7 +395,6 @@ void rrc_ue_generate_RRCConnectionRequest( const protocol_ctxt_t* const ctxt_pP, LOG_T(RRC,"\n"); /*UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.Payload[i] = taus()&0xff; UE_rrc_inst[ue_mod_idP].Srb0[Idx].Tx_buffer.payload_size =i; */ - } } @@ -457,12 +436,11 @@ static const char const nas_attach_req_guti[] = { //----------------------------------------------------------------------------- void rrc_t310_expiration( - const protocol_ctxt_t* const ctxt_pP, + const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index ) //----------------------------------------------------------------------------- { - if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State != RRC_CONNECTED) { LOG_D(RRC, "Timer 310 expired, going to RRC_IDLE\n"); UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_IDLE; @@ -474,7 +452,7 @@ rrc_t310_expiration( if (UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Active == 1) { LOG_D (RRC,"[Inst %d] eNB_index %d, Remove RB %d\n ", ctxt_pP->module_id, eNB_index, - UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id); + UE_rrc_inst[ctxt_pP->module_id].Srb2[eNB_index].Srb_info.Srb_id); rrc_pdcp_config_req (ctxt_pP, SRB_FLAG_YES, CONFIG_ACTION_REMOVE, @@ -496,43 +474,38 @@ rrc_t310_expiration( } //----------------------------------------------------------------------------- -static void rrc_ue_generate_RRCConnectionSetupComplete( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id ) +static void rrc_ue_generate_RRCConnectionSetupComplete( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id ) { - uint8_t buffer[100]; uint8_t size; - const char * nas_msg; + const char *nas_msg; int nas_msg_length; - #if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME) - nas_msg = (char*) UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data; + nas_msg = (char *) UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.data; nas_msg_length = UE_rrc_inst[ctxt_pP->module_id].initialNasMsg.length; #else nas_msg = nas_attach_req_imsi; nas_msg_length = sizeof(nas_attach_req_imsi); #endif - size = do_RRCConnectionSetupComplete(ctxt_pP->module_id, buffer, Transaction_id, nas_msg_length, nas_msg); - LOG_I(RRC,"[UE %d][RAPROC] Frame %d : Logical Channel UL-DCCH (SRB1), Generating RRCConnectionSetupComplete (bytes%d, eNB %d)\n", ctxt_pP->module_id,ctxt_pP->frame, size, eNB_index); LOG_D(RLC, "[FRAME %05d][RRC_UE][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCConnectionSetupComplete to eNB %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n", ctxt_pP->frame, ctxt_pP->module_id+NB_eNB_INST, size, eNB_index, rrc_mui, ctxt_pP->module_id+NB_eNB_INST, DCCH); rrc_data_req_ue ( - ctxt_pP, - DCCH, - rrc_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); + ctxt_pP, + DCCH, + rrc_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); } //----------------------------------------------------------------------------- -static void rrc_ue_generate_RRCConnectionReconfigurationComplete( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id ) +static void rrc_ue_generate_RRCConnectionReconfigurationComplete( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, const uint8_t Transaction_id ) { - uint8_t buffer[32], size; size = do_RRCConnectionReconfigurationComplete(ctxt_pP, buffer, Transaction_id); LOG_I(RRC,PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel UL-DCCH (SRB1), Generating RRCConnectionReconfigurationComplete (bytes %d, eNB_index %d)\n", @@ -547,46 +520,40 @@ static void rrc_ue_generate_RRCConnectionReconfigurationComplete( const protocol UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), DCCH); rrc_data_req_ue ( - ctxt_pP, - DCCH, - rrc_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); + ctxt_pP, + DCCH, + rrc_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); } //----------------------------------------------------------------------------- // Called by L2 interface (MAC) -int rrc_ue_decode_ccch( const protocol_ctxt_t* const ctxt_pP, const SRB_INFO* const Srb_info, const uint8_t eNB_index ) +int rrc_ue_decode_ccch( const protocol_ctxt_t *const ctxt_pP, const SRB_INFO *const Srb_info, const uint8_t eNB_index ) { - DL_CCCH_Message_t* dl_ccch_msg=NULL; + DL_CCCH_Message_t *dl_ccch_msg=NULL; asn_dec_rval_t dec_rval; int rval=0; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_CCCH, VCD_FUNCTION_IN); // LOG_D(RRC,"[UE %d] Decoding DL-CCCH message (%d bytes), State %d\n",ue_mod_idP,Srb_info->Rx_buffer.payload_size, // UE_rrc_inst[ue_mod_idP].Info[eNB_index].State); - dec_rval = uper_decode(NULL, &asn_DEF_DL_CCCH_Message, - (void**)&dl_ccch_msg, - (uint8_t*)Srb_info->Rx_buffer.Payload, + (void **)&dl_ccch_msg, + (uint8_t *)Srb_info->Rx_buffer.Payload, 100,0,0); - #ifdef XER_PRINT - xer_fprint(stdout,&asn_DEF_DL_CCCH_Message,(void*)dl_ccch_msg); + xer_fprint(stdout,&asn_DEF_DL_CCCH_Message,(void *)dl_ccch_msg); #endif - #if defined(ENABLE_ITTI) # if defined(DISABLE_ITTI_XER_PRINT) { MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_RRC_UE, RRC_DL_CCCH_MESSAGE); memcpy (&msg_p->ittiMsg, (void *) dl_ccch_msg, sizeof(RrcDlCcchMessage)); - itti_send_msg_to_task (TASK_UNKNOWN, ctxt_pP->instance, msg_p); } # else @@ -596,11 +563,9 @@ int rrc_ue_decode_ccch( const protocol_ctxt_t* const ctxt_pP, const SRB_INFO* co if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message, (void *)dl_ccch_msg)) > 0) { MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); } } @@ -614,74 +579,68 @@ int rrc_ue_decode_ccch( const protocol_ctxt_t* const ctxt_pP, const SRB_INFO* co } if (dl_ccch_msg->message.present == DL_CCCH_MessageType_PR_c1) { - if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State == RRC_SI_RECEIVED) { - switch (dl_ccch_msg->message.choice.c1.present) { + case DL_CCCH_MessageType__c1_PR_NOTHING: + LOG_I(RRC, "[UE%d] Frame %d : Received PR_NOTHING on DL-CCCH-Message\n", + ctxt_pP->module_id, + ctxt_pP->frame); + rval = 0; + break; - case DL_CCCH_MessageType__c1_PR_NOTHING: - LOG_I(RRC, "[UE%d] Frame %d : Received PR_NOTHING on DL-CCCH-Message\n", - ctxt_pP->module_id, - ctxt_pP->frame); - rval = 0; - break; + case DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishment: + LOG_I(RRC, + "[UE%d] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishment\n", + ctxt_pP->module_id, + ctxt_pP->frame); + rval = 0; + break; - case DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishment: - LOG_I(RRC, - "[UE%d] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishment\n", - ctxt_pP->module_id, - ctxt_pP->frame); - rval = 0; - break; + case DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentReject: + LOG_I(RRC, + "[UE%d] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishmentReject\n", + ctxt_pP->module_id, + ctxt_pP->frame); + rval = 0; + break; - case DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentReject: - LOG_I(RRC, - "[UE%d] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishmentReject\n", - ctxt_pP->module_id, - ctxt_pP->frame); - rval = 0; - break; + case DL_CCCH_MessageType__c1_PR_rrcConnectionReject: + LOG_I(RRC, + "[UE%d] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionReject \n", + ctxt_pP->module_id, + ctxt_pP->frame); + rval = 0; + break; - case DL_CCCH_MessageType__c1_PR_rrcConnectionReject: - LOG_I(RRC, - "[UE%d] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionReject \n", - ctxt_pP->module_id, - ctxt_pP->frame); - rval = 0; - break; + case DL_CCCH_MessageType__c1_PR_rrcConnectionSetup: + LOG_I(RRC, + "[UE%d][RAPROC] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup RNTI %x\n", + ctxt_pP->module_id, + ctxt_pP->frame, + ctxt_pP->rnti); + // Get configuration + // Release T300 timer + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].T300_active = 0; + rrc_ue_process_radioResourceConfigDedicated( + ctxt_pP, + eNB_index, + &dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup.criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated); + rrc_set_state (ctxt_pP->module_id, RRC_STATE_CONNECTED); + rrc_set_sub_state (ctxt_pP->module_id, RRC_SUB_STATE_CONNECTED); + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].rnti = ctxt_pP->rnti; + rrc_ue_generate_RRCConnectionSetupComplete( + ctxt_pP, + eNB_index, + dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup.rrc_TransactionIdentifier); + rval = 0; + break; - case DL_CCCH_MessageType__c1_PR_rrcConnectionSetup: - LOG_I(RRC, - "[UE%d][RAPROC] Frame %d : Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup RNTI %x\n", - ctxt_pP->module_id, - ctxt_pP->frame, - ctxt_pP->rnti); - // Get configuration - - // Release T300 timer - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].T300_active = 0; - rrc_ue_process_radioResourceConfigDedicated( - ctxt_pP, - eNB_index, - &dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup.criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated); - - rrc_set_state (ctxt_pP->module_id, RRC_STATE_CONNECTED); - rrc_set_sub_state (ctxt_pP->module_id, RRC_SUB_STATE_CONNECTED); - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].rnti = ctxt_pP->rnti; - rrc_ue_generate_RRCConnectionSetupComplete( - ctxt_pP, - eNB_index, - dl_ccch_msg->message.choice.c1.choice.rrcConnectionSetup.rrc_TransactionIdentifier); - - rval = 0; - break; - - default: - LOG_E(RRC, "[UE%d] Frame %d : Unknown message\n", - ctxt_pP->module_id, - ctxt_pP->frame); - rval = -1; - break; + default: + LOG_E(RRC, "[UE%d] Frame %d : Unknown message\n", + ctxt_pP->module_id, + ctxt_pP->frame); + rval = -1; + break; } } } @@ -696,31 +655,22 @@ rrc_ue_establish_srb1( module_id_t ue_mod_idP, frame_t frameP, uint8_t eNB_index, - struct SRB_ToAddMod* SRB_config + struct SRB_ToAddMod *SRB_config ) //----------------------------------------------------------------------------- { // add descriptor from RRC PDU - uint8_t lchan_id = DCCH; - UE_rrc_inst[ue_mod_idP].Srb1[eNB_index].Active = 1; UE_rrc_inst[ue_mod_idP].Srb1[eNB_index].Status = RADIO_CONFIG_OK;//RADIO CFG UE_rrc_inst[ue_mod_idP].Srb1[eNB_index].Srb_info.Srb_id = 1; - // copy default configuration for now // memcpy(&UE_rrc_inst[ue_mod_idP].Srb1[eNB_index].Srb_info.Lchan_desc[0],&DCCH_LCHAN_DESC,LCHAN_DESC_SIZE); // memcpy(&UE_rrc_inst[ue_mod_idP].Srb1[eNB_index].Srb_info.Lchan_desc[1],&DCCH_LCHAN_DESC,LCHAN_DESC_SIZE); - - LOG_I(RRC,"[UE %d], CONFIG_SRB1 %d corresponding to eNB_index %d\n", ue_mod_idP,lchan_id,eNB_index); - //rrc_pdcp_config_req (ue_mod_idP+NB_eNB_INST, frameP, 0, CONFIG_ACTION_ADD, lchan_id,UNDEF_SECURITY_MODE); // rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,lchan_id,SIGNALLING_RADIO_BEARER,Rlc_info_am_config); - // UE_rrc_inst[ue_mod_idP].Srb1[eNB_index].Srb_info.Tx_buffer.payload_size=DEFAULT_MEAS_IND_SIZE+1; - - return(0); } @@ -730,31 +680,22 @@ rrc_ue_establish_srb2( module_id_t ue_mod_idP, frame_t frameP, uint8_t eNB_index, - struct SRB_ToAddMod* SRB_config + struct SRB_ToAddMod *SRB_config ) //----------------------------------------------------------------------------- { // add descriptor from RRC PDU - uint8_t lchan_id = DCCH1; - UE_rrc_inst[ue_mod_idP].Srb2[eNB_index].Active = 1; UE_rrc_inst[ue_mod_idP].Srb2[eNB_index].Status = RADIO_CONFIG_OK;//RADIO CFG UE_rrc_inst[ue_mod_idP].Srb2[eNB_index].Srb_info.Srb_id = 2; - // copy default configuration for now // memcpy(&UE_rrc_inst[ue_mod_idP].Srb2[eNB_index].Srb_info.Lchan_desc[0],&DCCH_LCHAN_DESC,LCHAN_DESC_SIZE); // memcpy(&UE_rrc_inst[ue_mod_idP].Srb2[eNB_index].Srb_info.Lchan_desc[1],&DCCH_LCHAN_DESC,LCHAN_DESC_SIZE); - - LOG_I(RRC,"[UE %d], CONFIG_SRB2 %d corresponding to eNB_index %d\n",ue_mod_idP,lchan_id,eNB_index); - //rrc_pdcp_config_req (ue_mod_idP+NB_eNB_INST, frameP, 0, CONFIG_ACTION_ADD, lchan_id, UNDEF_SECURITY_MODE); // rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,lchan_id,SIGNALLING_RADIO_BEARER,Rlc_info_am_config); - // UE_rrc_inst[ue_mod_idP].Srb1[eNB_index].Srb_info.Tx_buffer.payload_size=DEFAULT_MEAS_IND_SIZE+1; - - return(0); } @@ -764,7 +705,7 @@ rrc_ue_establish_drb( module_id_t ue_mod_idP, frame_t frameP, uint8_t eNB_index, - struct DRB_ToAddMod* DRB_config + struct DRB_ToAddMod *DRB_config ) //----------------------------------------------------------------------------- { @@ -776,7 +717,6 @@ rrc_ue_establish_drb( (void)ip_addr_offset3; (void)ip_addr_offset4; #endif - LOG_I(RRC,"[UE %d] Frame %d: processing RRCConnectionReconfiguration: reconfiguring DRB %ld/LCID %d\n", ue_mod_idP, frameP, DRB_config->drb_Identity, (int)*DRB_config->logicalChannelIdentity); /* @@ -802,7 +742,6 @@ rrc_ue_establish_drb( ue_mod_idP, ip_addr_offset3+ue_mod_idP, (long int)((eNB_index * maxDRB) + DRB_config->drb_Identity)); - rb_conf_ipv4(0,//add ue_mod_idP,//cx align with the UE index ip_addr_offset3+ue_mod_idP,//inst num_enb+ue_index @@ -815,7 +754,6 @@ rrc_ue_establish_drb( # endif #endif - return(0); } @@ -823,13 +761,12 @@ rrc_ue_establish_drb( //----------------------------------------------------------------------------- void rrc_ue_process_measConfig( - const protocol_ctxt_t* const ctxt_pP, + const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, - MeasConfig_t* const measConfig + MeasConfig_t *const measConfig ) //----------------------------------------------------------------------------- { - // This is the procedure described in 36.331 Section 5.5.2.1 int i; long ind; @@ -851,8 +788,8 @@ rrc_ue_process_measConfig( if (UE_rrc_inst[ctxt_pP->module_id].MeasObj[eNB_index][ind-1]) { LOG_D(RRC,"Modifying measurement object %ld\n",ind); - memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].MeasObj[eNB_index][ind-1], - (char*)measObj, + memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].MeasObj[eNB_index][ind-1], + (char *)measObj, sizeof(MeasObjectToAddMod_t)); } else { LOG_I(RRC,"Adding measurement object %ld\n",ind); @@ -869,39 +806,37 @@ rrc_ue_process_measConfig( } LOG_I(RRC,"call rrc_mac_config_req \n"); - rrc_mac_config_req_ue(ctxt_pP->module_id,0,eNB_index, - (RadioResourceConfigCommonSIB_t *)NULL, - (struct PhysicalConfigDedicated *)NULL, + (RadioResourceConfigCommonSIB_t *)NULL, + (struct PhysicalConfigDedicated *)NULL, #if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, + (SCellToAddMod_r10_t *)NULL, + //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, #endif - UE_rrc_inst[ctxt_pP->module_id].MeasObj[eNB_index], - (MAC_MainConfig_t *)NULL, - 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *)NULL, - (TDD_Config_t *)NULL, - (MobilityControlInfo_t *)NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL + UE_rrc_inst[ctxt_pP->module_id].MeasObj[eNB_index], + (MAC_MainConfig_t *)NULL, + 0, + (struct LogicalChannelConfig *)NULL, + (MeasGapConfig_t *)NULL, + (TDD_Config_t *)NULL, + (MobilityControlInfo_t *)NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL #if defined(Rel10) || defined(Rel14) - ,0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL - + ,0, + (MBSFN_AreaInfoList_r9_t *)NULL, + (PMCH_InfoList_r9_t *)NULL #endif #ifdef CBA - , - 0, - 0 + , + 0, + 0 #endif - ); + ); } if (measConfig->reportConfigToRemoveList != NULL) { @@ -919,8 +854,8 @@ rrc_ue_process_measConfig( if (UE_rrc_inst[ctxt_pP->module_id].ReportConfig[eNB_index][ind-1]) { LOG_I(RRC,"Modifying Report Configuration %ld\n",ind-1); - memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].ReportConfig[eNB_index][ind-1], - (char*)measConfig->reportConfigToAddModList->list.array[i], + memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].ReportConfig[eNB_index][ind-1], + (char *)measConfig->reportConfigToAddModList->list.array[i], sizeof(ReportConfigToAddMod_t)); } else { LOG_D(RRC,"Adding Report Configuration %ld %p \n",ind-1,measConfig->reportConfigToAddModList->list.array[i]); @@ -932,8 +867,8 @@ rrc_ue_process_measConfig( if (measConfig->quantityConfig != NULL) { if (UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[eNB_index]) { LOG_D(RRC,"Modifying Quantity Configuration \n"); - memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[eNB_index], - (char*)measConfig->quantityConfig, + memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[eNB_index], + (char *)measConfig->quantityConfig, sizeof(QuantityConfig_t)); } else { LOG_D(RRC,"Adding Quantity configuration\n"); @@ -954,8 +889,8 @@ rrc_ue_process_measConfig( if (UE_rrc_inst[ctxt_pP->module_id].MeasId[eNB_index][ind-1]) { LOG_D(RRC,"Modifying Measurement ID %ld\n",ind-1); - memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].MeasId[eNB_index][ind-1], - (char*)measConfig->measIdToAddModList->list.array[i], + memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].MeasId[eNB_index][ind-1], + (char *)measConfig->measIdToAddModList->list.array[i], sizeof(MeasIdToAddMod_t)); } else { LOG_D(RRC,"Adding Measurement ID %ld %p\n",ind-1,measConfig->measIdToAddModList->list.array[i]); @@ -966,8 +901,8 @@ rrc_ue_process_measConfig( if (measConfig->measGapConfig !=NULL) { if (UE_rrc_inst[ctxt_pP->module_id].measGapConfig[eNB_index]) { - memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].measGapConfig[eNB_index], - (char*)measConfig->measGapConfig, + memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].measGapConfig[eNB_index], + (char *)measConfig->measGapConfig, sizeof(MeasGapConfig_t)); } else { UE_rrc_inst[ctxt_pP->module_id].measGapConfig[eNB_index] = measConfig->measGapConfig; @@ -977,8 +912,8 @@ rrc_ue_process_measConfig( if (measConfig->quantityConfig != NULL) { if (UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[eNB_index]) { LOG_I(RRC,"Modifying Quantity Configuration \n"); - memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[eNB_index], - (char*)measConfig->quantityConfig, + memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[eNB_index], + (char *)measConfig->quantityConfig, sizeof(QuantityConfig_t)); } else { LOG_I(RRC,"Adding Quantity configuration\n"); @@ -989,7 +924,6 @@ rrc_ue_process_measConfig( (*UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[eNB_index]->quantityConfigEUTRA->filterCoefficientRSRP)/4); UE_rrc_inst[ctxt_pP->module_id].filter_coeff_rsrq = 1./pow(2, (*UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[eNB_index]->quantityConfigEUTRA->filterCoefficientRSRQ)/4); - LOG_I(RRC,"[UE %d] set rsrp-coeff for eNB %d: %ld rsrq-coeff: %ld rsrp_factor: %f rsrq_factor: %f \n", ctxt_pP->module_id, eNB_index, // UE_rrc_inst[ue_mod_idP].Info[eNB_index].UE_index, *UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[eNB_index]->quantityConfigEUTRA->filterCoefficientRSRP, @@ -1004,7 +938,7 @@ rrc_ue_process_measConfig( if (measConfig->speedStatePars != NULL) { if (UE_rrc_inst[ctxt_pP->module_id].speedStatePars) { - memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].speedStatePars,(char*)measConfig->speedStatePars,sizeof(struct MeasConfig__speedStatePars)); + memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].speedStatePars,(char *)measConfig->speedStatePars,sizeof(struct MeasConfig__speedStatePars)); } else { UE_rrc_inst[ctxt_pP->module_id].speedStatePars = measConfig->speedStatePars; } @@ -1016,231 +950,223 @@ rrc_ue_process_measConfig( void -rrc_ue_update_radioResourceConfigDedicated(RadioResourceConfigDedicated_t* radioResourceConfigDedicated, - const protocol_ctxt_t* const ctxt_pP, - uint8_t eNB_index) +rrc_ue_update_radioResourceConfigDedicated(RadioResourceConfigDedicated_t *radioResourceConfigDedicated, + const protocol_ctxt_t *const ctxt_pP, + uint8_t eNB_index) { - PhysicalConfigDedicated_t* physicalConfigDedicated2 = NULL; + PhysicalConfigDedicated_t *physicalConfigDedicated2 = NULL; + physicalConfigDedicated2 = CALLOC(1,sizeof(*physicalConfigDedicated2)); + physicalConfigDedicated2->pdsch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pdsch_ConfigDedicated)); + physicalConfigDedicated2->pusch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pusch_ConfigDedicated)); + physicalConfigDedicated2->pucch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pucch_ConfigDedicated)); + physicalConfigDedicated2->cqi_ReportConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig)); + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic + = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic)); + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); + physicalConfigDedicated2->schedulingRequestConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->schedulingRequestConfig)); + physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo)); + physicalConfigDedicated2->uplinkPowerControlDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated)); + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH)); + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH)); - physicalConfigDedicated2 = CALLOC(1,sizeof(*physicalConfigDedicated2)); - physicalConfigDedicated2->pdsch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pdsch_ConfigDedicated)); - physicalConfigDedicated2->pusch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pusch_ConfigDedicated)); - physicalConfigDedicated2->pucch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pucch_ConfigDedicated)); - physicalConfigDedicated2->cqi_ReportConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig)); - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic - = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic)); - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); - physicalConfigDedicated2->schedulingRequestConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->schedulingRequestConfig)); - physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo)); + // Update pdsch_ConfigDedicated + if(radioResourceConfigDedicated->physicalConfigDedicated->pdsch_ConfigDedicated != NULL) + { + LOG_I(RRC,"Update pdsch_ConfigDedicated config \n"); - physicalConfigDedicated2->uplinkPowerControlDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated)); - physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH)); - physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH)); + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pdsch_ConfigDedicated == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pdsch_ConfigDedicated = CALLOC(1,sizeof(PDSCH_ConfigDedicated_t)); - // Update pdsch_ConfigDedicated - if(radioResourceConfigDedicated->physicalConfigDedicated->pdsch_ConfigDedicated != NULL) - { - LOG_I(RRC,"Update pdsch_ConfigDedicated config \n"); + memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pdsch_ConfigDedicated, + (char *)radioResourceConfigDedicated->physicalConfigDedicated->pdsch_ConfigDedicated, + sizeof(physicalConfigDedicated2->pdsch_ConfigDedicated)); + } + else + { + LOG_I(RRC,"Keep old config for pdsch_ConfigDedicated\n"); + } - if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pdsch_ConfigDedicated == NULL) - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pdsch_ConfigDedicated = CALLOC(1,sizeof(PDSCH_ConfigDedicated_t)); + // Update pusch_ConfigDedicated + if(radioResourceConfigDedicated->physicalConfigDedicated->pusch_ConfigDedicated != NULL) + { + LOG_I(RRC,"Update pusch_ConfigDedicated config \n"); - memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pdsch_ConfigDedicated, - (char*)radioResourceConfigDedicated->physicalConfigDedicated->pdsch_ConfigDedicated, - sizeof(physicalConfigDedicated2->pdsch_ConfigDedicated)); - } - else - { - LOG_I(RRC,"Keep old config for pdsch_ConfigDedicated\n"); + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pusch_ConfigDedicated == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pusch_ConfigDedicated = CALLOC(1,sizeof(PUSCH_ConfigDedicated_t)); + + memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pusch_ConfigDedicated, + (char *)radioResourceConfigDedicated->physicalConfigDedicated->pusch_ConfigDedicated, + sizeof(physicalConfigDedicated2->pusch_ConfigDedicated)); + } + else + { + LOG_I(RRC,"Keep old config for pusch_ConfigDedicated\n"); + } + + // Update pucch_ConfigDedicated + if(radioResourceConfigDedicated->physicalConfigDedicated->pucch_ConfigDedicated != NULL) + { + LOG_I(RRC,"Update pucch_ConfigDedicated config \n"); + + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pucch_ConfigDedicated == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pucch_ConfigDedicated = CALLOC(1,sizeof(PUCCH_ConfigDedicated_t)); + + memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pucch_ConfigDedicated, + (char *)radioResourceConfigDedicated->physicalConfigDedicated->pucch_ConfigDedicated, + sizeof(physicalConfigDedicated2->pucch_ConfigDedicated)); + } + else + { + LOG_I(RRC,"Keep old config for pucch_ConfigDedicated\n"); + } + + // Update cqi_ReportConfig + if(radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig != NULL) + { + LOG_I(RRC,"Update cqi_ReportConfig config (size=%zu,%zu)\n", sizeof(*physicalConfigDedicated2->cqi_ReportConfig), sizeof(CQI_ReportConfig_t)); + + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig = CALLOC(1,sizeof(CQI_ReportConfig_t)); + + memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig, + (char *)radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig, + sizeof(*physicalConfigDedicated2->cqi_ReportConfig)); + + if (radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic != NULL) { + LOG_I(RRC,"Update cqi_ReportPeriodic config (size=%zu,%zu)\n", sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic), sizeof(CQI_ReportPeriodic_t)); + + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig->cqi_ReportPeriodic == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig->cqi_ReportPeriodic = CALLOC(1,sizeof(CQI_ReportPeriodic_t)); + + memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig->cqi_ReportPeriodic, + (char *)radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic, + sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic)); } + } + else + { + LOG_I(RRC,"Keep old config for cqi_ReportConfig\n"); + } - // Update pusch_ConfigDedicated - if(radioResourceConfigDedicated->physicalConfigDedicated->pusch_ConfigDedicated != NULL) - { - LOG_I(RRC,"Update pusch_ConfigDedicated config \n"); + // Update schedulingRequestConfig + if(radioResourceConfigDedicated->physicalConfigDedicated->schedulingRequestConfig != NULL) + { + LOG_I(RRC,"Update schedulingRequestConfig config \n"); - if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pusch_ConfigDedicated == NULL) - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pusch_ConfigDedicated = CALLOC(1,sizeof(PUSCH_ConfigDedicated_t)); + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->schedulingRequestConfig == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->schedulingRequestConfig = CALLOC(1,sizeof(SchedulingRequestConfig_t)); - memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pusch_ConfigDedicated, - (char*)radioResourceConfigDedicated->physicalConfigDedicated->pusch_ConfigDedicated, - sizeof(physicalConfigDedicated2->pusch_ConfigDedicated)); - } - else - { - LOG_I(RRC,"Keep old config for pusch_ConfigDedicated\n"); - } + memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->schedulingRequestConfig, + (char *)radioResourceConfigDedicated->physicalConfigDedicated->schedulingRequestConfig, + sizeof(physicalConfigDedicated2->schedulingRequestConfig)); + } + else + { + LOG_I(RRC,"Keep old config for schedulingRequestConfig\n"); + } - // Update pucch_ConfigDedicated - if(radioResourceConfigDedicated->physicalConfigDedicated->pucch_ConfigDedicated != NULL) - { - LOG_I(RRC,"Update pucch_ConfigDedicated config \n"); - if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pucch_ConfigDedicated == NULL) - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pucch_ConfigDedicated = CALLOC(1,sizeof(PUCCH_ConfigDedicated_t)); + // Update soundingRS_UL_ConfigDedicated + if(radioResourceConfigDedicated->physicalConfigDedicated->soundingRS_UL_ConfigDedicated != NULL) + { + LOG_I(RRC,"Update soundingRS_UL_ConfigDedicated config \n"); - memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->pucch_ConfigDedicated, - (char*)radioResourceConfigDedicated->physicalConfigDedicated->pucch_ConfigDedicated, - sizeof(physicalConfigDedicated2->pucch_ConfigDedicated)); - } - else - { - LOG_I(RRC,"Keep old config for pucch_ConfigDedicated\n"); - } + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->soundingRS_UL_ConfigDedicated == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(SoundingRS_UL_ConfigDedicated_t)); - // Update cqi_ReportConfig - if(radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig != NULL) - { - LOG_I(RRC,"Update cqi_ReportConfig config (size=%zu,%zu)\n", sizeof(*physicalConfigDedicated2->cqi_ReportConfig), sizeof(CQI_ReportConfig_t)); + memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->soundingRS_UL_ConfigDedicated, + (char *)radioResourceConfigDedicated->physicalConfigDedicated->soundingRS_UL_ConfigDedicated, + sizeof(physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); + } + else + { + LOG_I(RRC,"Keep old config for soundingRS_UL_ConfigDedicated\n"); + } - if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig == NULL) - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig = CALLOC(1,sizeof(CQI_ReportConfig_t)); + // Update antennaInfo + if(radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo != NULL) + { + LOG_I(RRC,"Update antennaInfo config \n"); - memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig, - (char*)radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig, - sizeof(*physicalConfigDedicated2->cqi_ReportConfig)); + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo = CALLOC(1,sizeof(struct PhysicalConfigDedicated__antennaInfo)); - if (radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic != NULL) { - LOG_I(RRC,"Update cqi_ReportPeriodic config (size=%zu,%zu)\n", sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic), sizeof(CQI_ReportPeriodic_t)); + memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo, + (char *)radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo, + sizeof(physicalConfigDedicated2->antennaInfo)); + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo->choice.explicitValue.transmissionMode = + radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode; + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo->choice.explicitValue.codebookSubsetRestriction = + radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo->choice.explicitValue.codebookSubsetRestriction; + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection = + radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection; + LOG_I(PHY,"New Transmission Mode %ld \n",radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode); + LOG_I(PHY,"Configured Transmission Mode %ld \n",UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo->choice.explicitValue.transmissionMode); + } + else + { + LOG_I(RRC,"Keep old config for antennaInfo\n"); + } - if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig->cqi_ReportPeriodic == NULL) - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig->cqi_ReportPeriodic = CALLOC(1,sizeof(CQI_ReportPeriodic_t)); + // Update uplinkPowerControlDedicated + if(radioResourceConfigDedicated->physicalConfigDedicated->uplinkPowerControlDedicated != NULL) + { + LOG_I(RRC,"Update uplinkPowerControlDedicated config \n"); - memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->cqi_ReportConfig->cqi_ReportPeriodic, - (char*)radioResourceConfigDedicated->physicalConfigDedicated->cqi_ReportConfig->cqi_ReportPeriodic, - sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic)); - } - } - else - { - LOG_I(RRC,"Keep old config for cqi_ReportConfig\n"); - } + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->uplinkPowerControlDedicated == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->uplinkPowerControlDedicated = CALLOC(1,sizeof(UplinkPowerControlDedicated_t)); - // Update schedulingRequestConfig - if(radioResourceConfigDedicated->physicalConfigDedicated->schedulingRequestConfig != NULL) - { - LOG_I(RRC,"Update schedulingRequestConfig config \n"); + memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->uplinkPowerControlDedicated, + (char *)radioResourceConfigDedicated->physicalConfigDedicated->uplinkPowerControlDedicated, + sizeof(physicalConfigDedicated2->uplinkPowerControlDedicated)); + } + else + { + LOG_I(RRC,"Keep old config for uplinkPowerControlDedicated\n"); + } - if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->schedulingRequestConfig == NULL) - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->schedulingRequestConfig = CALLOC(1,sizeof(SchedulingRequestConfig_t)); + // Update tpc_PDCCH_ConfigPUCCH + if(radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUCCH != NULL) + { + LOG_I(RRC,"Update tpc_PDCCH_ConfigPUCCH config \n"); - memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->schedulingRequestConfig, - (char*)radioResourceConfigDedicated->physicalConfigDedicated->schedulingRequestConfig, - sizeof(physicalConfigDedicated2->schedulingRequestConfig)); - } - else - { - LOG_I(RRC,"Keep old config for schedulingRequestConfig\n"); - } + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUCCH == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUCCH = CALLOC(1,sizeof(TPC_PDCCH_Config_t)); - // Update soundingRS_UL_ConfigDedicated - if(radioResourceConfigDedicated->physicalConfigDedicated->soundingRS_UL_ConfigDedicated != NULL) - { - LOG_I(RRC,"Update soundingRS_UL_ConfigDedicated config \n"); + memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUCCH, + (char *)radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUCCH, + sizeof(physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH)); + } + else + { + LOG_I(RRC,"Keep old config for tpc_PDCCH_ConfigPUCCH\n"); + } - if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->soundingRS_UL_ConfigDedicated == NULL) - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(SoundingRS_UL_ConfigDedicated_t)); + // Update tpc_PDCCH_ConfigPUSCH + if(radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUSCH != NULL) + { + LOG_I(RRC,"Update tpc_PDCCH_ConfigPUSCH config \n"); - memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->soundingRS_UL_ConfigDedicated, - (char*)radioResourceConfigDedicated->physicalConfigDedicated->soundingRS_UL_ConfigDedicated, - sizeof(physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); - } - else - { - LOG_I(RRC,"Keep old config for soundingRS_UL_ConfigDedicated\n"); - } - - // Update antennaInfo - if(radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo != NULL) - { - LOG_I(RRC,"Update antennaInfo config \n"); - - if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo == NULL) - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo = CALLOC(1,sizeof(struct PhysicalConfigDedicated__antennaInfo)); - - memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo, - (char*)radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo, - sizeof(physicalConfigDedicated2->antennaInfo)); - - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo->choice.explicitValue.transmissionMode = - radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode; - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo->choice.explicitValue.codebookSubsetRestriction = - radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo->choice.explicitValue.codebookSubsetRestriction; - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection = - radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection; - - LOG_I(PHY,"New Transmission Mode %ld \n",radioResourceConfigDedicated->physicalConfigDedicated->antennaInfo->choice.explicitValue.transmissionMode); - LOG_I(PHY,"Configured Transmission Mode %ld \n",UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->antennaInfo->choice.explicitValue.transmissionMode); - - } - else - { - LOG_I(RRC,"Keep old config for antennaInfo\n"); - } - - - // Update uplinkPowerControlDedicated - if(radioResourceConfigDedicated->physicalConfigDedicated->uplinkPowerControlDedicated != NULL) - { - LOG_I(RRC,"Update uplinkPowerControlDedicated config \n"); - - if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->uplinkPowerControlDedicated == NULL) - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->uplinkPowerControlDedicated = CALLOC(1,sizeof(UplinkPowerControlDedicated_t)); - - memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->uplinkPowerControlDedicated, - (char*)radioResourceConfigDedicated->physicalConfigDedicated->uplinkPowerControlDedicated, - sizeof(physicalConfigDedicated2->uplinkPowerControlDedicated)); - } - else - { - LOG_I(RRC,"Keep old config for uplinkPowerControlDedicated\n"); - } - - // Update tpc_PDCCH_ConfigPUCCH - if(radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUCCH != NULL) - { - LOG_I(RRC,"Update tpc_PDCCH_ConfigPUCCH config \n"); - - if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUCCH == NULL) - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUCCH = CALLOC(1,sizeof(TPC_PDCCH_Config_t)); - - memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUCCH, - (char*)radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUCCH, - sizeof(physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH)); - } - else - { - LOG_I(RRC,"Keep old config for tpc_PDCCH_ConfigPUCCH\n"); - } - - // Update tpc_PDCCH_ConfigPUSCH - if(radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUSCH != NULL) - { - LOG_I(RRC,"Update tpc_PDCCH_ConfigPUSCH config \n"); - - if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUSCH == NULL) - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUSCH = CALLOC(1,sizeof(TPC_PDCCH_Config_t)); - - memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUSCH, - (char*)radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUSCH, - sizeof(physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH)); - - } - else - { - LOG_I(RRC,"Keep old config for tpc_PDCCH_ConfigPUSCH\n"); - } + if(UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUSCH == NULL) + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUSCH = CALLOC(1,sizeof(TPC_PDCCH_Config_t)); + memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]->tpc_PDCCH_ConfigPUSCH, + (char *)radioResourceConfigDedicated->physicalConfigDedicated->tpc_PDCCH_ConfigPUSCH, + sizeof(physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH)); + } + else + { + LOG_I(RRC,"Keep old config for tpc_PDCCH_ConfigPUSCH\n"); + } } //----------------------------------------------------------------------------- void rrc_ue_process_radioResourceConfigDedicated( - const protocol_ctxt_t* const ctxt_pP, + const protocol_ctxt_t *const ctxt_pP, uint8_t eNB_index, - RadioResourceConfigDedicated_t* radioResourceConfigDedicated + RadioResourceConfigDedicated_t *radioResourceConfigDedicated ) //----------------------------------------------------------------------------- { - long SRB_id,DRB_id; int i,cnt; LogicalChannelConfig_t *SRB1_logicalChannelConfig,*SRB2_logicalChannelConfig; @@ -1255,9 +1181,9 @@ rrc_ue_process_radioResourceConfigDedicated( if (UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index]) { #if 1 - rrc_ue_update_radioResourceConfigDedicated(radioResourceConfigDedicated, ctxt_pP, eNB_index); + rrc_ue_update_radioResourceConfigDedicated(radioResourceConfigDedicated, ctxt_pP, eNB_index); #else - memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index],(char*)radioResourceConfigDedicated->physicalConfigDedicated, + memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index],(char *)radioResourceConfigDedicated->physicalConfigDedicated, sizeof(struct PhysicalConfigDedicated)); #endif } else { @@ -1270,7 +1196,7 @@ rrc_ue_process_radioResourceConfigDedicated( if (radioResourceConfigDedicated->mac_MainConfig) { if (radioResourceConfigDedicated->mac_MainConfig->present == RadioResourceConfigDedicated__mac_MainConfig_PR_explicitValue) { if (UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index]) { - memcpy((char*)UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index],(char*)&radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue, + memcpy((char *)UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index],(char *)&radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue, sizeof(MAC_MainConfig_t)); } else { UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index] = &radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue; @@ -1318,7 +1244,6 @@ rrc_ue_process_radioResourceConfigDedicated( if (radioResourceConfigDedicated->srb_ToAddModList) { uint8_t *kRRCenc = NULL; uint8_t *kRRCint = NULL; - #if defined(ENABLE_SECURITY) derive_key_rrc_enc(UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm, UE_rrc_inst[ctxt_pP->module_id].kenb, &kRRCenc); @@ -1328,8 +1253,8 @@ rrc_ue_process_radioResourceConfigDedicated( // Refresh SRBs rrc_pdcp_config_asn1_req(ctxt_pP, radioResourceConfigDedicated->srb_ToAddModList, - (DRB_ToAddModList_t*)NULL, - (DRB_ToReleaseList_t*)NULL, + (DRB_ToAddModList_t *)NULL, + (DRB_ToReleaseList_t *)NULL, UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm | (UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm << 4), kRRCenc, @@ -1339,17 +1264,15 @@ rrc_ue_process_radioResourceConfigDedicated( ,(PMCH_InfoList_r9_t *)NULL #endif ,NULL); - // Refresh SRBs rrc_rlc_config_asn1_req(ctxt_pP, radioResourceConfigDedicated->srb_ToAddModList, - (DRB_ToAddModList_t*)NULL, - (DRB_ToReleaseList_t*)NULL + (DRB_ToAddModList_t *)NULL, + (DRB_ToReleaseList_t *)NULL #if defined(Rel10) || defined(Rel14) ,(PMCH_InfoList_r9_t *)NULL #endif ); - #if ENABLE_RAL // first msg that includes srb config UE_rrc_inst[ctxt_pP->module_id].num_srb=radioResourceConfigDedicated->srb_ToAddModList->list.count; @@ -1371,7 +1294,6 @@ rrc_ue_process_radioResourceConfigDedicated( if (UE_rrc_inst[ctxt_pP->module_id].SRB1_config[eNB_index]->logicalChannelConfig) { if (UE_rrc_inst[ctxt_pP->module_id].SRB1_config[eNB_index]->logicalChannelConfig->present == SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { SRB1_logicalChannelConfig = &UE_rrc_inst[ctxt_pP->module_id].SRB1_config[eNB_index]->logicalChannelConfig->choice.explicitValue; - } else { SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; } @@ -1381,39 +1303,38 @@ rrc_ue_process_radioResourceConfigDedicated( LOG_I(RRC, "[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 eNB %d) --->][MAC_UE][MOD %02d][]\n", ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id); - rrc_mac_config_req_ue(ctxt_pP->module_id,0,eNB_index, - (RadioResourceConfigCommonSIB_t *)NULL, - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index], + (RadioResourceConfigCommonSIB_t *)NULL, + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index], #if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, + (SCellToAddMod_r10_t *)NULL, + //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, #endif - (MeasObjectToAddMod_t **)NULL, - UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index], - 1, - SRB1_logicalChannelConfig, - (MeasGapConfig_t *)NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL + (MeasObjectToAddMod_t **)NULL, + UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index], + 1, + SRB1_logicalChannelConfig, + (MeasGapConfig_t *)NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL #if defined(Rel10) || defined(Rel14) - , - 0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL + , + 0, + (MBSFN_AreaInfoList_r9_t *)NULL, + (PMCH_InfoList_r9_t *)NULL #endif #ifdef CBA - , - 0, - 0 + , + 0, + 0 #endif - ); + ); } } else { if (UE_rrc_inst[ctxt_pP->module_id].SRB2_config[eNB_index]) { @@ -1441,38 +1362,37 @@ rrc_ue_process_radioResourceConfigDedicated( eNB_index, ctxt_pP->module_id); rrc_mac_config_req_ue(ctxt_pP->module_id,0,eNB_index, - (RadioResourceConfigCommonSIB_t *)NULL, - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index], + (RadioResourceConfigCommonSIB_t *)NULL, + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index], #if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, + (SCellToAddMod_r10_t *)NULL, + //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, #endif - (MeasObjectToAddMod_t **)NULL, - UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index], - 2, - SRB2_logicalChannelConfig, - UE_rrc_inst[ctxt_pP->module_id].measGapConfig[eNB_index], - (TDD_Config_t *)NULL, - (MobilityControlInfo_t *)NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL + (MeasObjectToAddMod_t **)NULL, + UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index], + 2, + SRB2_logicalChannelConfig, + UE_rrc_inst[ctxt_pP->module_id].measGapConfig[eNB_index], + (TDD_Config_t *)NULL, + (MobilityControlInfo_t *)NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL #if defined(Rel10) || defined(Rel14) - , - 0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL - + , + 0, + (MBSFN_AreaInfoList_r9_t *)NULL, + (PMCH_InfoList_r9_t *)NULL #endif #ifdef CBA - , - 0, - 0 + , + 0, + 0 #endif - ); + ); } } } @@ -1480,22 +1400,19 @@ rrc_ue_process_radioResourceConfigDedicated( // Establish DRBs if present if (radioResourceConfigDedicated->drb_ToAddModList) { - if ( (UE_rrc_inst[ctxt_pP->module_id].defaultDRB == NULL) && (radioResourceConfigDedicated->drb_ToAddModList->list.count >= 1) ) { - // configure the first DRB ID as the default DRB ID - UE_rrc_inst[ctxt_pP->module_id].defaultDRB = malloc(sizeof(rb_id_t)); - *UE_rrc_inst[ctxt_pP->module_id].defaultDRB = radioResourceConfigDedicated->drb_ToAddModList->list.array[0]->drb_Identity; - LOG_I(RRC,"[UE %d] default DRB = %d\n",ctxt_pP->module_id, *UE_rrc_inst[ctxt_pP->module_id].defaultDRB); - } + // configure the first DRB ID as the default DRB ID + UE_rrc_inst[ctxt_pP->module_id].defaultDRB = malloc(sizeof(rb_id_t)); + *UE_rrc_inst[ctxt_pP->module_id].defaultDRB = radioResourceConfigDedicated->drb_ToAddModList->list.array[0]->drb_Identity; + LOG_I(RRC,"[UE %d] default DRB = %d\n",ctxt_pP->module_id, *UE_rrc_inst[ctxt_pP->module_id].defaultDRB); + } uint8_t *kUPenc = NULL; - #if defined(ENABLE_SECURITY) derive_key_up_enc(UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm, UE_rrc_inst[ctxt_pP->module_id].kenb, &kUPenc); #endif - MSC_LOG_TX_MESSAGE( MSC_RRC_UE, MSC_PDCP_UE, @@ -1506,12 +1423,11 @@ rrc_ue_process_radioResourceConfigDedicated( ctxt_pP->rnti, UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm | (UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm << 4)); - // Refresh DRBs rrc_pdcp_config_asn1_req(ctxt_pP, - (SRB_ToAddModList_t*)NULL, + (SRB_ToAddModList_t *)NULL, radioResourceConfigDedicated->drb_ToAddModList, - (DRB_ToReleaseList_t*)NULL, + (DRB_ToReleaseList_t *)NULL, UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm | (UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm << 4), NULL, @@ -1521,12 +1437,11 @@ rrc_ue_process_radioResourceConfigDedicated( ,(PMCH_InfoList_r9_t *)NULL #endif , UE_rrc_inst[ctxt_pP->module_id].defaultDRB); - // Refresh DRBs rrc_rlc_config_asn1_req(ctxt_pP, - (SRB_ToAddModList_t*)NULL, + (SRB_ToAddModList_t *)NULL, radioResourceConfigDedicated->drb_ToAddModList, - (DRB_ToReleaseList_t*)NULL + (DRB_ToReleaseList_t *)NULL #if defined(Rel10) || defined(Rel14) ,(PMCH_InfoList_r9_t *)NULL #endif @@ -1549,42 +1464,41 @@ rrc_ue_process_radioResourceConfigDedicated( eNB_index, ctxt_pP->module_id); rrc_mac_config_req_ue(ctxt_pP->module_id,0,eNB_index, - (RadioResourceConfigCommonSIB_t *)NULL, - UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index], + (RadioResourceConfigCommonSIB_t *)NULL, + UE_rrc_inst[ctxt_pP->module_id].physicalConfigDedicated[eNB_index], #if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, + (SCellToAddMod_r10_t *)NULL, + //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, #endif - (MeasObjectToAddMod_t **)NULL, - UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index], - *UE_rrc_inst[ctxt_pP->module_id].DRB_config[eNB_index][DRB_id]->logicalChannelIdentity, - UE_rrc_inst[ctxt_pP->module_id].DRB_config[eNB_index][DRB_id]->logicalChannelConfig, - UE_rrc_inst[ctxt_pP->module_id].measGapConfig[eNB_index], - (TDD_Config_t*)NULL, - (MobilityControlInfo_t *)NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL + (MeasObjectToAddMod_t **)NULL, + UE_rrc_inst[ctxt_pP->module_id].mac_MainConfig[eNB_index], + *UE_rrc_inst[ctxt_pP->module_id].DRB_config[eNB_index][DRB_id]->logicalChannelIdentity, + UE_rrc_inst[ctxt_pP->module_id].DRB_config[eNB_index][DRB_id]->logicalChannelConfig, + UE_rrc_inst[ctxt_pP->module_id].measGapConfig[eNB_index], + (TDD_Config_t *)NULL, + (MobilityControlInfo_t *)NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL #if defined(Rel10) || defined(Rel14) - , - 0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL + , + 0, + (MBSFN_AreaInfoList_r9_t *)NULL, + (PMCH_InfoList_r9_t *)NULL #endif #ifdef CBA - , - UE_rrc_inst[ue_mod_idP].num_active_cba_groups, // - UE_rrc_inst[ue_mod_idP].cba_rnti[0] + , + UE_rrc_inst[ue_mod_idP].num_active_cba_groups, // + UE_rrc_inst[ue_mod_idP].cba_rnti[0] #endif - ); - + ); } } } - + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_CONNECTED; LOG_I(RRC,"[UE %d] State = RRC_CONNECTED (eNB %d)\n",ctxt_pP->module_id,eNB_index); } @@ -1593,75 +1507,69 @@ rrc_ue_process_radioResourceConfigDedicated( //----------------------------------------------------------------------------- void rrc_ue_process_securityModeCommand( - const protocol_ctxt_t* const ctxt_pP, - SecurityModeCommand_t* const securityModeCommand, + const protocol_ctxt_t *const ctxt_pP, + SecurityModeCommand_t *const securityModeCommand, const uint8_t eNB_index ) //----------------------------------------------------------------------------- { - asn_enc_rval_t enc_rval; - UL_DCCH_Message_t ul_dcch_msg; // SecurityModeCommand_t SecurityModeCommand; uint8_t buffer[200]; int i, securityMode; - LOG_I(RRC,"[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), Processing securityModeCommand (eNB %d)\n", ctxt_pP->module_id,ctxt_pP->frame,eNB_index); switch (securityModeCommand->criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm) { - case CipheringAlgorithm_r12_eea0: - LOG_I(RRC,"[UE %d] Security algorithm is set to eea0\n", - ctxt_pP->module_id); - securityMode= CipheringAlgorithm_r12_eea0; - break; + case CipheringAlgorithm_r12_eea0: + LOG_I(RRC,"[UE %d] Security algorithm is set to eea0\n", + ctxt_pP->module_id); + securityMode= CipheringAlgorithm_r12_eea0; + break; - case CipheringAlgorithm_r12_eea1: - LOG_I(RRC,"[UE %d] Security algorithm is set to eea1\n",ctxt_pP->module_id); - securityMode= CipheringAlgorithm_r12_eea1; - break; + case CipheringAlgorithm_r12_eea1: + LOG_I(RRC,"[UE %d] Security algorithm is set to eea1\n",ctxt_pP->module_id); + securityMode= CipheringAlgorithm_r12_eea1; + break; - case CipheringAlgorithm_r12_eea2: - LOG_I(RRC,"[UE %d] Security algorithm is set to eea2\n", - ctxt_pP->module_id); - securityMode = CipheringAlgorithm_r12_eea2; - break; + case CipheringAlgorithm_r12_eea2: + LOG_I(RRC,"[UE %d] Security algorithm is set to eea2\n", + ctxt_pP->module_id); + securityMode = CipheringAlgorithm_r12_eea2; + break; - default: - LOG_I(RRC,"[UE %d] Security algorithm is set to none\n",ctxt_pP->module_id); - securityMode = CipheringAlgorithm_r12_spare1; - break; + default: + LOG_I(RRC,"[UE %d] Security algorithm is set to none\n",ctxt_pP->module_id); + securityMode = CipheringAlgorithm_r12_spare1; + break; } switch (securityModeCommand->criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm) { - case SecurityAlgorithmConfig__integrityProtAlgorithm_eia1: - LOG_I(RRC,"[UE %d] Integrity protection algorithm is set to eia1\n",ctxt_pP->module_id); - securityMode |= 1 << 5; - break; + case SecurityAlgorithmConfig__integrityProtAlgorithm_eia1: + LOG_I(RRC,"[UE %d] Integrity protection algorithm is set to eia1\n",ctxt_pP->module_id); + securityMode |= 1 << 5; + break; - case SecurityAlgorithmConfig__integrityProtAlgorithm_eia2: - LOG_I(RRC,"[UE %d] Integrity protection algorithm is set to eia2\n",ctxt_pP->module_id); - securityMode |= 1 << 6; - break; + case SecurityAlgorithmConfig__integrityProtAlgorithm_eia2: + LOG_I(RRC,"[UE %d] Integrity protection algorithm is set to eia2\n",ctxt_pP->module_id); + securityMode |= 1 << 6; + break; - default: - LOG_I(RRC,"[UE %d] Integrity protection algorithm is set to none\n",ctxt_pP->module_id); - securityMode |= 0x70 ; - break; + default: + LOG_I(RRC,"[UE %d] Integrity protection algorithm is set to none\n",ctxt_pP->module_id); + securityMode |= 0x70 ; + break; } LOG_D(RRC,"[UE %d] security mode is %x \n",ctxt_pP->module_id, securityMode); - /* Store the parameters received */ UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm = securityModeCommand->criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm; UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm = securityModeCommand->criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm; - memset((void *)&ul_dcch_msg,0,sizeof(UL_DCCH_Message_t)); //memset((void *)&SecurityModeCommand,0,sizeof(SecurityModeCommand_t)); - ul_dcch_msg.message.present = UL_DCCH_MessageType_PR_c1; if (securityMode >= NO_SECURITY_MODE) { @@ -1670,7 +1578,6 @@ rrc_ue_process_securityModeCommand( ul_dcch_msg.message.choice.c1.present = UL_DCCH_MessageType__c1_PR_securityModeFailure; } - #if defined(ENABLE_SECURITY) uint8_t *kRRCenc = NULL; uint8_t *kUPenc = NULL; @@ -1678,47 +1585,44 @@ rrc_ue_process_securityModeCommand( pdcp_t *pdcp_p = NULL; hash_key_t key = HASHTABLE_NOT_A_KEY_VALUE; hashtable_rc_t h_rc; - key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, - ctxt_pP->enb_flag, DCCH, SRB_FLAG_YES); - h_rc = hashtable_get(pdcp_coll_p, key, (void**) &pdcp_p); + ctxt_pP->enb_flag, DCCH, SRB_FLAG_YES); + h_rc = hashtable_get(pdcp_coll_p, key, (void **) &pdcp_p); if (h_rc == HASH_TABLE_OK) { LOG_D(RRC, "PDCP_COLL_KEY_VALUE() returns valid key = %ld\n", key); - LOG_D(RRC, "driving kRRCenc, kRRCint and kUPenc from KeNB=" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x\n", - UE_rrc_inst[ctxt_pP->module_id].kenb[0], UE_rrc_inst[ctxt_pP->module_id].kenb[1], UE_rrc_inst[ctxt_pP->module_id].kenb[2], UE_rrc_inst[ctxt_pP->module_id].kenb[3], - UE_rrc_inst[ctxt_pP->module_id].kenb[4], UE_rrc_inst[ctxt_pP->module_id].kenb[5], UE_rrc_inst[ctxt_pP->module_id].kenb[6], UE_rrc_inst[ctxt_pP->module_id].kenb[7], - UE_rrc_inst[ctxt_pP->module_id].kenb[8], UE_rrc_inst[ctxt_pP->module_id].kenb[9], UE_rrc_inst[ctxt_pP->module_id].kenb[10], UE_rrc_inst[ctxt_pP->module_id].kenb[11], - UE_rrc_inst[ctxt_pP->module_id].kenb[12], UE_rrc_inst[ctxt_pP->module_id].kenb[13], UE_rrc_inst[ctxt_pP->module_id].kenb[14], UE_rrc_inst[ctxt_pP->module_id].kenb[15], - UE_rrc_inst[ctxt_pP->module_id].kenb[16], UE_rrc_inst[ctxt_pP->module_id].kenb[17], UE_rrc_inst[ctxt_pP->module_id].kenb[18], UE_rrc_inst[ctxt_pP->module_id].kenb[19], - UE_rrc_inst[ctxt_pP->module_id].kenb[20], UE_rrc_inst[ctxt_pP->module_id].kenb[21], UE_rrc_inst[ctxt_pP->module_id].kenb[22], UE_rrc_inst[ctxt_pP->module_id].kenb[23], - UE_rrc_inst[ctxt_pP->module_id].kenb[24], UE_rrc_inst[ctxt_pP->module_id].kenb[25], UE_rrc_inst[ctxt_pP->module_id].kenb[26], UE_rrc_inst[ctxt_pP->module_id].kenb[27], - UE_rrc_inst[ctxt_pP->module_id].kenb[28], UE_rrc_inst[ctxt_pP->module_id].kenb[29], UE_rrc_inst[ctxt_pP->module_id].kenb[30], UE_rrc_inst[ctxt_pP->module_id].kenb[31]); - + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x\n", + UE_rrc_inst[ctxt_pP->module_id].kenb[0], UE_rrc_inst[ctxt_pP->module_id].kenb[1], UE_rrc_inst[ctxt_pP->module_id].kenb[2], UE_rrc_inst[ctxt_pP->module_id].kenb[3], + UE_rrc_inst[ctxt_pP->module_id].kenb[4], UE_rrc_inst[ctxt_pP->module_id].kenb[5], UE_rrc_inst[ctxt_pP->module_id].kenb[6], UE_rrc_inst[ctxt_pP->module_id].kenb[7], + UE_rrc_inst[ctxt_pP->module_id].kenb[8], UE_rrc_inst[ctxt_pP->module_id].kenb[9], UE_rrc_inst[ctxt_pP->module_id].kenb[10], UE_rrc_inst[ctxt_pP->module_id].kenb[11], + UE_rrc_inst[ctxt_pP->module_id].kenb[12], UE_rrc_inst[ctxt_pP->module_id].kenb[13], UE_rrc_inst[ctxt_pP->module_id].kenb[14], UE_rrc_inst[ctxt_pP->module_id].kenb[15], + UE_rrc_inst[ctxt_pP->module_id].kenb[16], UE_rrc_inst[ctxt_pP->module_id].kenb[17], UE_rrc_inst[ctxt_pP->module_id].kenb[18], UE_rrc_inst[ctxt_pP->module_id].kenb[19], + UE_rrc_inst[ctxt_pP->module_id].kenb[20], UE_rrc_inst[ctxt_pP->module_id].kenb[21], UE_rrc_inst[ctxt_pP->module_id].kenb[22], UE_rrc_inst[ctxt_pP->module_id].kenb[23], + UE_rrc_inst[ctxt_pP->module_id].kenb[24], UE_rrc_inst[ctxt_pP->module_id].kenb[25], UE_rrc_inst[ctxt_pP->module_id].kenb[26], UE_rrc_inst[ctxt_pP->module_id].kenb[27], + UE_rrc_inst[ctxt_pP->module_id].kenb[28], UE_rrc_inst[ctxt_pP->module_id].kenb[29], UE_rrc_inst[ctxt_pP->module_id].kenb[30], UE_rrc_inst[ctxt_pP->module_id].kenb[31]); derive_key_rrc_enc(UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm, - UE_rrc_inst[ctxt_pP->module_id].kenb, &kRRCenc); + UE_rrc_inst[ctxt_pP->module_id].kenb, &kRRCenc); derive_key_rrc_int(UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm, - UE_rrc_inst[ctxt_pP->module_id].kenb, &kRRCint); + UE_rrc_inst[ctxt_pP->module_id].kenb, &kRRCint); derive_key_up_enc(UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm, - UE_rrc_inst[ctxt_pP->module_id].kenb, &kUPenc); + UE_rrc_inst[ctxt_pP->module_id].kenb, &kUPenc); if (securityMode != 0xff) { pdcp_config_set_security(ctxt_pP, pdcp_p, 0, 0, - UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm - | (UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm << 4), - kRRCenc, kRRCint, kUPenc); + UE_rrc_inst[ctxt_pP->module_id].ciphering_algorithm + | (UE_rrc_inst[ctxt_pP->module_id].integrity_algorithm << 4), + kRRCenc, kRRCint, kUPenc); } else { LOG_W(RRC, "skipped pdcp_config_set_security() as securityMode == 0x%02x", - securityMode); + securityMode); } } else { LOG_W(RRC, "Could not get PDCP instance where key=0x%ld\n", key); @@ -1729,173 +1633,145 @@ rrc_ue_process_securityModeCommand( if (securityModeCommand->criticalExtensions.present == SecurityModeCommand__criticalExtensions_PR_c1) { if (securityModeCommand->criticalExtensions.choice.c1.present != SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8) LOG_W(RRC,"securityModeCommand->criticalExtensions.choice.c1.present (%d) != SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8\n", - securityModeCommand->criticalExtensions.choice.c1.present); - - + securityModeCommand->criticalExtensions.choice.c1.present); + ul_dcch_msg.message.choice.c1.choice.securityModeComplete.rrc_TransactionIdentifier = securityModeCommand->rrc_TransactionIdentifier; ul_dcch_msg.message.choice.c1.choice.securityModeComplete.criticalExtensions.present = SecurityModeCommand__criticalExtensions_PR_c1; ul_dcch_msg.message.choice.c1.choice.securityModeComplete.criticalExtensions.choice.securityModeComplete_r8.nonCriticalExtension =NULL; - LOG_I(RRC,"[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), encoding securityModeComplete (eNB %d)\n", - ctxt_pP->module_id,ctxt_pP->frame,eNB_index); - + ctxt_pP->module_id,ctxt_pP->frame,eNB_index); enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, - (void*)&ul_dcch_msg, - buffer, - 100); + NULL, + (void *)&ul_dcch_msg, + buffer, + 100); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - + enc_rval.failed_type->name, enc_rval.encoded); #ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg); + xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)&ul_dcch_msg); #endif - #if defined(ENABLE_ITTI) # if !defined(DISABLE_XER_SPRINT) { char message_string[20000]; size_t message_string_size; - + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); + MessageDef *msg_p; + msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText)); + msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size); + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); } } # endif #endif + LOG_D(RRC, "securityModeComplete Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8); - LOG_D(RRC, "securityModeComplete Encoded %zd bits (%zd bytes)\n", enc_rval.encoded, (enc_rval.encoded+7)/8); + for (i = 0; i < (enc_rval.encoded + 7) / 8; i++) { + LOG_T(RRC, "%02x.", buffer[i]); + } + + LOG_T(RRC, "\n"); + rrc_data_req ( + ctxt_pP, + DCCH, + rrc_mui++, + SDU_CONFIRM_NO, + (enc_rval.encoded + 7) / 8, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + } + else LOG_W(RRC,"securityModeCommand->criticalExtensions.present (%d) != SecurityModeCommand__criticalExtensions_PR_c1\n", + securityModeCommand->criticalExtensions.present); +} + +//----------------------------------------------------------------------------- +void +rrc_ue_process_ueCapabilityEnquiry( + const protocol_ctxt_t *const ctxt_pP, + UECapabilityEnquiry_t *UECapabilityEnquiry, + uint8_t eNB_index +) +//----------------------------------------------------------------------------- +{ + asn_enc_rval_t enc_rval; + UL_DCCH_Message_t ul_dcch_msg; + UE_CapabilityRAT_Container_t ue_CapabilityRAT_Container; + uint8_t buffer[200]; + int i; + LOG_I(RRC,"[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), Processing UECapabilityEnquiry (eNB %d)\n", + ctxt_pP->module_id, + ctxt_pP->frame, + eNB_index); + memset((void *)&ul_dcch_msg,0,sizeof(UL_DCCH_Message_t)); + memset((void *)&ue_CapabilityRAT_Container,0,sizeof(UE_CapabilityRAT_Container_t)); + ul_dcch_msg.message.present = UL_DCCH_MessageType_PR_c1; + ul_dcch_msg.message.choice.c1.present = UL_DCCH_MessageType__c1_PR_ueCapabilityInformation; + ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.rrc_TransactionIdentifier = UECapabilityEnquiry->rrc_TransactionIdentifier; + ue_CapabilityRAT_Container.rat_Type = RAT_Type_eutra; + OCTET_STRING_fromBuf(&ue_CapabilityRAT_Container.ueCapabilityRAT_Container, + (const char *)UE_rrc_inst[ctxt_pP->module_id].UECapability, + UE_rrc_inst[ctxt_pP->module_id].UECapability_size); + // ue_CapabilityRAT_Container.ueCapabilityRAT_Container.buf = UE_rrc_inst[ue_mod_idP].UECapability; + // ue_CapabilityRAT_Container.ueCapabilityRAT_Container.size = UE_rrc_inst[ue_mod_idP].UECapability_size; + AssertFatal(UECapabilityEnquiry->criticalExtensions.present == UECapabilityEnquiry__criticalExtensions_PR_c1, + "UECapabilityEnquiry->criticalExtensions.present (%d) != UECapabilityEnquiry__criticalExtensions_PR_c1 (%d)\n", + UECapabilityEnquiry->criticalExtensions.present,UECapabilityEnquiry__criticalExtensions_PR_c1); + + if (UECapabilityEnquiry->criticalExtensions.choice.c1.present != UECapabilityEnquiry__criticalExtensions__c1_PR_ueCapabilityEnquiry_r8) + LOG_W(RRC,"UECapabilityEnquiry->criticalExtensions.choice.c1.present (%d) != UECapabilityEnquiry__criticalExtensions__c1_PR_ueCapabilityEnquiry_r8)\n", + UECapabilityEnquiry->criticalExtensions.choice.c1.present); + + ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.present = UECapabilityInformation__criticalExtensions_PR_c1; + ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.present = + UECapabilityInformation__criticalExtensions__c1_PR_ueCapabilityInformation_r8; + ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.count + =0; + + for (i=0; icriticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.count; i++) { + if (*UECapabilityEnquiry->criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.array[i] + == RAT_Type_eutra) { + ASN_SEQUENCE_ADD( + &ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list, + &ue_CapabilityRAT_Container); + enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, NULL, (void *) &ul_dcch_msg, buffer, 100); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", + enc_rval.failed_type->name, enc_rval.encoded); +#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)&ul_dcch_msg); +#endif +#if defined(ENABLE_ITTI) +# if !defined(DISABLE_XER_SPRINT) + { + char message_string[20000]; + size_t message_string_size; + + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { + MessageDef *msg_p; + msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText)); + msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size); + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); + } + } +# endif +#endif + LOG_D(RRC,"UECapabilityInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); for (i = 0; i < (enc_rval.encoded + 7) / 8; i++) { LOG_T(RRC, "%02x.", buffer[i]); } - LOG_T(RRC, "\n"); - rrc_data_req ( - ctxt_pP, - DCCH, - rrc_mui++, - SDU_CONFIRM_NO, - (enc_rval.encoded + 7) / 8, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); - } - - else LOG_W(RRC,"securityModeCommand->criticalExtensions.present (%d) != SecurityModeCommand__criticalExtensions_PR_c1\n", - securityModeCommand->criticalExtensions.present); -} - -//----------------------------------------------------------------------------- -void -rrc_ue_process_ueCapabilityEnquiry( - const protocol_ctxt_t* const ctxt_pP, - UECapabilityEnquiry_t* UECapabilityEnquiry, - uint8_t eNB_index -) -//----------------------------------------------------------------------------- -{ - - asn_enc_rval_t enc_rval; - - UL_DCCH_Message_t ul_dcch_msg; - - - UE_CapabilityRAT_Container_t ue_CapabilityRAT_Container; - - uint8_t buffer[200]; - int i; - - LOG_I(RRC,"[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), Processing UECapabilityEnquiry (eNB %d)\n", - ctxt_pP->module_id, - ctxt_pP->frame, - eNB_index); - - - memset((void *)&ul_dcch_msg,0,sizeof(UL_DCCH_Message_t)); - memset((void *)&ue_CapabilityRAT_Container,0,sizeof(UE_CapabilityRAT_Container_t)); - - ul_dcch_msg.message.present = UL_DCCH_MessageType_PR_c1; - ul_dcch_msg.message.choice.c1.present = UL_DCCH_MessageType__c1_PR_ueCapabilityInformation; - ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.rrc_TransactionIdentifier = UECapabilityEnquiry->rrc_TransactionIdentifier; - - ue_CapabilityRAT_Container.rat_Type = RAT_Type_eutra; - OCTET_STRING_fromBuf(&ue_CapabilityRAT_Container.ueCapabilityRAT_Container, - (const char*)UE_rrc_inst[ctxt_pP->module_id].UECapability, - UE_rrc_inst[ctxt_pP->module_id].UECapability_size); - // ue_CapabilityRAT_Container.ueCapabilityRAT_Container.buf = UE_rrc_inst[ue_mod_idP].UECapability; - // ue_CapabilityRAT_Container.ueCapabilityRAT_Container.size = UE_rrc_inst[ue_mod_idP].UECapability_size; - - - AssertFatal(UECapabilityEnquiry->criticalExtensions.present == UECapabilityEnquiry__criticalExtensions_PR_c1, - "UECapabilityEnquiry->criticalExtensions.present (%d) != UECapabilityEnquiry__criticalExtensions_PR_c1 (%d)\n", - UECapabilityEnquiry->criticalExtensions.present,UECapabilityEnquiry__criticalExtensions_PR_c1); - - if (UECapabilityEnquiry->criticalExtensions.choice.c1.present != UECapabilityEnquiry__criticalExtensions__c1_PR_ueCapabilityEnquiry_r8) - LOG_W(RRC,"UECapabilityEnquiry->criticalExtensions.choice.c1.present (%d) != UECapabilityEnquiry__criticalExtensions__c1_PR_ueCapabilityEnquiry_r8)\n", - UECapabilityEnquiry->criticalExtensions.choice.c1.present); - - ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.present = UECapabilityInformation__criticalExtensions_PR_c1; - ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.present = - UECapabilityInformation__criticalExtensions__c1_PR_ueCapabilityInformation_r8; - ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.count - =0; - - for (i=0; icriticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.count; i++) { - - if (*UECapabilityEnquiry->criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.array[i] - == RAT_Type_eutra) { - ASN_SEQUENCE_ADD( - &ul_dcch_msg.message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list, - &ue_CapabilityRAT_Container); - - enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, (void*) &ul_dcch_msg, buffer, 100); - AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %jd)!\n", - enc_rval.failed_type->name, enc_rval.encoded); - -#ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg); -#endif - -#if defined(ENABLE_ITTI) -# if !defined(DISABLE_XER_SPRINT) - { - char message_string[20000]; - size_t message_string_size; - - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); - } - } -# endif -#endif - - - LOG_D(RRC,"UECapabilityInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); - - for (i = 0; i < (enc_rval.encoded + 7) / 8; i++) { - LOG_T(RRC, "%02x.", buffer[i]); - } - LOG_T(RRC, "\n"); rrc_data_req_ue ( - ctxt_pP, - DCCH, - rrc_mui++, - SDU_CONFIRM_NO, - (enc_rval.encoded + 7) / 8, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); + ctxt_pP, + DCCH, + rrc_mui++, + SDU_CONFIRM_NO, + (enc_rval.encoded + 7) / 8, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); } } } @@ -1904,20 +1780,19 @@ rrc_ue_process_ueCapabilityEnquiry( //----------------------------------------------------------------------------- void rrc_ue_process_rrcConnectionReconfiguration( - const protocol_ctxt_t* const ctxt_pP, + const protocol_ctxt_t *const ctxt_pP, RRCConnectionReconfiguration_t *rrcConnectionReconfiguration, uint8_t eNB_index ) //----------------------------------------------------------------------------- { - LOG_I(RRC,"[UE %d] Frame %d: Receiving from SRB1 (DL-DCCH), Processing RRCConnectionReconfiguration (eNB %d)\n", ctxt_pP->module_id,ctxt_pP->frame,eNB_index); if (rrcConnectionReconfiguration->criticalExtensions.present == RRCConnectionReconfiguration__criticalExtensions_PR_c1) { if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.present == RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8) { - RRCConnectionReconfiguration_r8_IEs_t* rrcConnectionReconfiguration_r8 = + RRCConnectionReconfiguration_r8_IEs_t *rrcConnectionReconfiguration_r8 = &rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8; if (rrcConnectionReconfiguration_r8->mobilityControlInfo) { @@ -1952,12 +1827,10 @@ rrc_ue_process_rrcConnectionReconfiguration( for (list_count = 0; list_count < rrcConnectionReconfiguration_r8->dedicatedInfoNASList->list.count; list_count++) { pdu_length = rrcConnectionReconfiguration_r8->dedicatedInfoNASList->list.array[list_count]->size; pdu_buffer = rrcConnectionReconfiguration_r8->dedicatedInfoNASList->list.array[list_count]->buf; - msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_CONN_ESTABLI_CNF); NAS_CONN_ESTABLI_CNF(msg_p).errCode = AS_SUCCESS; NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.length = pdu_length; NAS_CONN_ESTABLI_CNF(msg_p).nasMsg.data = pdu_buffer; - itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p); } @@ -1969,7 +1842,6 @@ rrc_ue_process_rrcConnectionReconfiguration( MessageDef *message_ral_p = NULL; rrc_ral_connection_reestablishment_ind_t connection_reestablishment_ind; int i; - message_ral_p = itti_alloc_new_message (TASK_RRC_UE, RRC_RAL_CONNECTION_REESTABLISHMENT_IND); memset(&connection_reestablishment_ind, 0, sizeof(rrc_ral_connection_reestablishment_ind_t)); // TO DO ral_si_ind.plmn_id = 0; @@ -1994,7 +1866,6 @@ rrc_ue_process_rrcConnectionReconfiguration( connection_reestablishment_ind.num_srb = rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList->list.count + UE_rrc_inst[ctxt_pP->module_id].num_srb; - } else { connection_reestablishment_ind.num_srb += UE_rrc_inst[ctxt_pP->module_id].num_srb; } @@ -2018,9 +1889,9 @@ rrc_ue_process_rrcConnectionReconfiguration( //----------------------------------------------------------------------------- void rrc_ue_process_mobilityControlInfo( - const protocol_ctxt_t* const ctxt_pP, + const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, - struct MobilityControlInfo* const mobilityControlInfo + struct MobilityControlInfo *const mobilityControlInfo ) //----------------------------------------------------------------------------- { @@ -2036,7 +1907,6 @@ rrc_ue_process_mobilityControlInfo( UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].T304_active = 1; UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].T304_cnt = T304[mobilityControlInfo->t304]; - /* drb2release_list = CALLOC (1, sizeof (*drb2release_list)); lcid= CALLOC (1, sizeof (DRB_Identity_t)); // long @@ -2062,22 +1932,20 @@ rrc_ue_process_mobilityControlInfo( NULL, // key rrc encryption NULL, // key rrc integrity NULL // key encryption -#if defined(Rel10) || defined(Rel14) + #if defined(Rel10) || defined(Rel14) ,NULL -#endif + #endif ,NULL); rrc_rlc_config_asn1_req(NB_eNB_INST+ue_mod_idP, frameP,0,eNB_index, NULL,// SRB_ToAddModList NULL,// DRB_ToAddModList drb2release_list // DRB_ToReleaseList -#if defined(Rel10) || defined(Rel14) + #if defined(Rel10) || defined(Rel14) ,NULL -#endif + #endif ,NULL); */ - - //A little cleanup at RRC... //Copying current queue config to free RRC index /* @@ -2099,47 +1967,43 @@ rrc_ue_process_mobilityControlInfo( LOG_I(RRC, "HO: Reset PDCP and RLC for configured RBs.. \n[FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB2 eNB %d) --->][MAC_UE][MOD %02d][]\n", ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id); - // Reset MAC and configure PHY rrc_mac_config_req_ue(ctxt_pP->module_id, - 0, - eNB_index, - (RadioResourceConfigCommonSIB_t *)NULL, - (struct PhysicalConfigDedicated *)NULL, + 0, + eNB_index, + (RadioResourceConfigCommonSIB_t *)NULL, + (struct PhysicalConfigDedicated *)NULL, #if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, #endif - (MeasObjectToAddMod_t **)NULL, - (MAC_MainConfig_t *)NULL, - 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *)NULL, - (TDD_Config_t *)NULL, - mobilityControlInfo, - (uint8_t *)NULL, - (uint16_t *)NULL, - NULL, - NULL, - NULL, - NULL + (MeasObjectToAddMod_t **)NULL, + (MAC_MainConfig_t *)NULL, + 0, + (struct LogicalChannelConfig *)NULL, + (MeasGapConfig_t *)NULL, + (TDD_Config_t *)NULL, + mobilityControlInfo, + (uint8_t *)NULL, + (uint16_t *)NULL, + NULL, + NULL, + NULL, + NULL #if defined(Rel10) || defined(Rel14) - ,0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL + ,0, + (MBSFN_AreaInfoList_r9_t *)NULL, + (PMCH_InfoList_r9_t *)NULL #endif #ifdef CBA - ,0, - 0 + ,0, + 0 #endif - ); - + ); // Re-establish PDCP for all RBs that are established // rrc_pdcp_config_req (ue_mod_idP+NB_eNB_INST, frameP, 0, CONFIG_ACTION_ADD, ue_mod_idP+DCCH); // rrc_pdcp_config_req (ue_mod_idP+NB_eNB_INST, frameP, 0, CONFIG_ACTION_ADD, ue_mod_idP+DCCH1); // rrc_pdcp_config_req (ue_mod_idP+NB_eNB_INST, frameP, 0, CONFIG_ACTION_ADD, ue_mod_idP+DTCH); - - // Re-establish RLC for all RBs that are established // rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,ue_mod_idP+DCCH,SIGNALLING_RADIO_BEARER,Rlc_info_am_config); // rrc_rlc_config_req(ue_mod_idP+NB_eNB_INST,frameP,0,CONFIG_ACTION_ADD,ue_mod_idP+DCCH1,SIGNALLING_RADIO_BEARER,Rlc_info_am_config); @@ -2161,14 +2025,13 @@ rrc_detach_from_eNB( //----------------------------------------------------------------------------- void rrc_ue_decode_dcch( - const protocol_ctxt_t* const ctxt_pP, + const protocol_ctxt_t *const ctxt_pP, const rb_id_t Srb_id, - const uint8_t* const Buffer, + const uint8_t *const Buffer, const uint8_t eNB_indexP ) //----------------------------------------------------------------------------- { - //DL_DCCH_Message_t dldcchmsg; DL_DCCH_Message_t *dl_dcch_msg=NULL;//&dldcchmsg; // asn_dec_rval_t dec_rval; @@ -2185,7 +2048,6 @@ rrc_ue_decode_dcch( } //memset(dl_dcch_msg,0,sizeof(DL_DCCH_Message_t)); - // decode messages // LOG_D(RRC,"[UE %d] Decoding DL-DCCH message\n",ue_mod_idP); /* @@ -2195,20 +2057,17 @@ rrc_ue_decode_dcch( */ uper_decode(NULL, &asn_DEF_DL_DCCH_Message, - (void**)&dl_dcch_msg, - (uint8_t*)Buffer, + (void **)&dl_dcch_msg, + (uint8_t *)Buffer, RRC_BUF_SIZE,0,0); - #ifdef XER_PRINT - xer_fprint(stdout,&asn_DEF_DL_DCCH_Message,(void*)dl_dcch_msg); + xer_fprint(stdout,&asn_DEF_DL_DCCH_Message,(void *)dl_dcch_msg); #endif - #if defined(ENABLE_ITTI) # if defined(DISABLE_ITTI_XER_PRINT) { msg_p = itti_alloc_new_message (TASK_RRC_UE, RRC_DL_DCCH_MESSAGE); memcpy (&msg_p->ittiMsg, (void *) dl_dcch_msg, sizeof(RrcDlDcchMessage)); - itti_send_msg_to_task (TASK_UNKNOWN, ctxt_pP->instance, msg_p); } # else @@ -2220,7 +2079,6 @@ rrc_ue_decode_dcch( msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); } } @@ -2228,276 +2086,266 @@ rrc_ue_decode_dcch( #endif if (dl_dcch_msg->message.present == DL_DCCH_MessageType_PR_c1) { - if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_indexP].State >= RRC_CONNECTED) { - switch (dl_dcch_msg->message.choice.c1.present) { + case DL_DCCH_MessageType__c1_PR_NOTHING: + LOG_I(RRC, "[UE %d] Frame %d : Received PR_NOTHING on DL-DCCH-Message\n", + ctxt_pP->module_id, ctxt_pP->frame); + return; - case DL_DCCH_MessageType__c1_PR_NOTHING: - LOG_I(RRC, "[UE %d] Frame %d : Received PR_NOTHING on DL-DCCH-Message\n", - ctxt_pP->module_id, ctxt_pP->frame); - return; + case DL_DCCH_MessageType__c1_PR_csfbParametersResponseCDMA2000: + break; - case DL_DCCH_MessageType__c1_PR_csfbParametersResponseCDMA2000: - break; - - case DL_DCCH_MessageType__c1_PR_dlInformationTransfer: { + case DL_DCCH_MessageType__c1_PR_dlInformationTransfer: { #if defined(ENABLE_ITTI) - DLInformationTransfer_t *dlInformationTransfer = &dl_dcch_msg->message.choice.c1.choice.dlInformationTransfer; + DLInformationTransfer_t *dlInformationTransfer = &dl_dcch_msg->message.choice.c1.choice.dlInformationTransfer; - if ((dlInformationTransfer->criticalExtensions.present == DLInformationTransfer__criticalExtensions_PR_c1) - && (dlInformationTransfer->criticalExtensions.choice.c1.present - == DLInformationTransfer__criticalExtensions__c1_PR_dlInformationTransfer_r8) - && (dlInformationTransfer->criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType.present - == DLInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS)) { - /* This message hold a dedicated info NAS payload, forward it to NAS */ - struct DLInformationTransfer_r8_IEs__dedicatedInfoType *dedicatedInfoType = + if ((dlInformationTransfer->criticalExtensions.present == DLInformationTransfer__criticalExtensions_PR_c1) + && (dlInformationTransfer->criticalExtensions.choice.c1.present + == DLInformationTransfer__criticalExtensions__c1_PR_dlInformationTransfer_r8) + && (dlInformationTransfer->criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType.present + == DLInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS)) { + /* This message hold a dedicated info NAS payload, forward it to NAS */ + struct DLInformationTransfer_r8_IEs__dedicatedInfoType *dedicatedInfoType = &dlInformationTransfer->criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType; - uint32_t pdu_length; - uint8_t *pdu_buffer; - MessageDef *msg_p; + uint32_t pdu_length; + uint8_t *pdu_buffer; + MessageDef *msg_p; + pdu_length = dedicatedInfoType->choice.dedicatedInfoNAS.size; + pdu_buffer = dedicatedInfoType->choice.dedicatedInfoNAS.buf; + msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_DOWNLINK_DATA_IND); + NAS_DOWNLINK_DATA_IND(msg_p).UEid = ctxt_pP->module_id; // TODO set the UEid to something else ? + NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length = pdu_length; + NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data = pdu_buffer; + itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p); + } - pdu_length = dedicatedInfoType->choice.dedicatedInfoNAS.size; - pdu_buffer = dedicatedInfoType->choice.dedicatedInfoNAS.buf; +#endif + break; + } - msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_DOWNLINK_DATA_IND); - NAS_DOWNLINK_DATA_IND(msg_p).UEid = ctxt_pP->module_id; // TODO set the UEid to something else ? - NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.length = pdu_length; - NAS_DOWNLINK_DATA_IND(msg_p).nasMsg.data = pdu_buffer; + case DL_DCCH_MessageType__c1_PR_handoverFromEUTRAPreparationRequest: + break; + + case DL_DCCH_MessageType__c1_PR_mobilityFromEUTRACommand: + break; + + case DL_DCCH_MessageType__c1_PR_rrcConnectionReconfiguration: + + // first check if mobilityControlInfo is present + if (dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo + != NULL) { + /* 36.331, 5.3.5.4 Reception of an RRCConnectionReconfiguration including the mobilityControlInfo by the UE (handover)*/ + if (UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId + != dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo->targetPhysCellId) { + LOG_W(RRC, + "[UE %d] Frame %d: Handover target (%ld) is different from RSRP measured target (%ld)..\n", + ctxt_pP->module_id, + ctxt_pP->frame, + dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo->targetPhysCellId, + UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId); + return; + } else if ((target_eNB_index = get_adjacent_cell_mod_id(UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId)) + == 0xFF) { + LOG_W(RRC, + "[UE %d] Frame %d: ue_mod_idP of the target eNB not found, check the network topology\n", + ctxt_pP->module_id, + ctxt_pP->frame); + return; + } else { + LOG_I(RRC, + "[UE% d] Frame %d: Received rrcConnectionReconfiguration with mobilityControlInfo \n", + ctxt_pP->module_id, + ctxt_pP->frame); + UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag = 1; // Ready to send more MeasReports if required + } + } + + rrc_ue_process_rrcConnectionReconfiguration( + ctxt_pP, + &dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration, + eNB_indexP); + + if (target_eNB_index != 0xFF) { + rrc_ue_generate_RRCConnectionReconfigurationComplete( + ctxt_pP, + target_eNB_index, + dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.rrc_TransactionIdentifier); + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_indexP].State = RRC_HO_EXECUTION; + UE_rrc_inst[ctxt_pP->module_id].Info[target_eNB_index].State = RRC_RECONFIGURED; + LOG_I(RRC, "[UE %d] State = RRC_RECONFIGURED during HO (eNB %d)\n", + ctxt_pP->module_id, target_eNB_index); +#if defined(ENABLE_ITTI) +#if ENABLE_RAL + { + MessageDef *message_ral_p = NULL; + rrc_ral_connection_reconfiguration_ho_ind_t connection_reconfiguration_ho_ind; + int i; + message_ral_p = itti_alloc_new_message (TASK_RRC_UE, RRC_RAL_CONNECTION_RECONFIGURATION_HO_IND); + memset(&connection_reconfiguration_ho_ind, 0, sizeof(rrc_ral_connection_reconfiguration_ho_ind_t)); + connection_reconfiguration_ho_ind.ue_id = ctxt_pP->module_id; + + if (dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList + != NULL) { + connection_reconfiguration_ho_ind.num_drb = + dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.count; + + for (i=0; ( + imessage.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.count) + && (i < maxDRB); i++) { + // why minus 1 in RRC code for drb_identity ? + connection_reconfiguration_ho_ind.drb_id[i] = + dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.array[i]->drb_Identity; + } + } else { + connection_reconfiguration_ho_ind.num_drb = 0; + } + + if (dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList + != NULL) { + connection_reconfiguration_ho_ind.num_srb = + dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList->list.count + + + UE_rrc_inst[ctxt_pP->module_id].num_srb; + } else { + connection_reconfiguration_ho_ind.num_srb += UE_rrc_inst[ctxt_pP->module_id].num_srb; + } + + if (connection_reconfiguration_ho_ind.num_srb > 2 ) { + connection_reconfiguration_ho_ind.num_srb =2; + } + + memcpy (&message_ral_p->ittiMsg, (void *) &connection_reconfiguration_ho_ind, sizeof(rrc_ral_connection_reconfiguration_ho_ind_t)); + //#warning "ue_mod_idP ? for instance ? => YES" + LOG_I(RRC, "Sending RRC_RAL_CONNECTION_RECONFIGURATION_HO_IND to mRAL\n"); + itti_send_msg_to_task (TASK_RAL_UE, ctxt_pP->instance, message_ral_p); + } +#endif +#endif + } else { + rrc_ue_generate_RRCConnectionReconfigurationComplete( + ctxt_pP, + eNB_indexP, + dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.rrc_TransactionIdentifier); + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_indexP].State = RRC_RECONFIGURED; + LOG_I(RRC, "[UE %d] State = RRC_RECONFIGURED (eNB %d)\n", + ctxt_pP->module_id, + eNB_indexP); +#if defined(ENABLE_ITTI) +#if ENABLE_RAL + { + MessageDef *message_ral_p = NULL; + rrc_ral_connection_reconfiguration_ind_t connection_reconfiguration_ind; + int i; + message_ral_p = itti_alloc_new_message (TASK_RRC_UE, RRC_RAL_CONNECTION_RECONFIGURATION_IND); + memset(&connection_reconfiguration_ind, 0, sizeof(rrc_ral_connection_reconfiguration_ind_t)); + connection_reconfiguration_ind.ue_id = ctxt_pP->module_id; + + if (dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList + != NULL) { + connection_reconfiguration_ind.num_drb = + dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.count; + + for (i=0; ( + imessage.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.count) + && (i < maxDRB); i++) { + // why minus 1 in RRC code for drb_identity ? + connection_reconfiguration_ind.drb_id[i] = + dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.array[i]->drb_Identity; + } + } else { + connection_reconfiguration_ind.num_drb = 0; + } + + if (dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList + != NULL) { + connection_reconfiguration_ind.num_srb = + dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList->list.count + + + UE_rrc_inst[ctxt_pP->module_id].num_srb; + } else { + connection_reconfiguration_ind.num_srb +=UE_rrc_inst[ctxt_pP->module_id].num_srb; + } + + if (connection_reconfiguration_ind.num_srb > 2 ) { + connection_reconfiguration_ind.num_srb =2; + } + + memcpy (&message_ral_p->ittiMsg, (void *) &connection_reconfiguration_ind, sizeof(rrc_ral_connection_reconfiguration_ind_t)); + //#warning "ue_mod_idP ? for instance ? => YES" + LOG_I(RRC, "Sending RRC_RAL_CONNECTION_RECONFIGURATION_IND to mRAL\n"); + itti_send_msg_to_task (TASK_RAL_UE, ctxt_pP->instance, message_ral_p); + } +#endif +#endif + } + + break; + + case DL_DCCH_MessageType__c1_PR_rrcConnectionRelease: +#if defined(ENABLE_ITTI) + msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_CONN_RELEASE_IND); + + if ((dl_dcch_msg->message.choice.c1.choice.rrcConnectionRelease.criticalExtensions.present + == RRCConnectionRelease__criticalExtensions_PR_c1) + && (dl_dcch_msg->message.choice.c1.choice.rrcConnectionRelease.criticalExtensions.choice.c1.present + == RRCConnectionRelease__criticalExtensions__c1_PR_rrcConnectionRelease_r8)) { + NAS_CONN_RELEASE_IND(msg_p).cause = + dl_dcch_msg->message.choice.c1.choice.rrcConnectionRelease.criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.releaseCause; + } itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p); - } - -#endif - break; - } - - case DL_DCCH_MessageType__c1_PR_handoverFromEUTRAPreparationRequest: - break; - - case DL_DCCH_MessageType__c1_PR_mobilityFromEUTRACommand: - break; - - case DL_DCCH_MessageType__c1_PR_rrcConnectionReconfiguration: - - // first check if mobilityControlInfo is present - if (dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo - != NULL) { - /* 36.331, 5.3.5.4 Reception of an RRCConnectionReconfiguration including the mobilityControlInfo by the UE (handover)*/ - if (UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId - != dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo->targetPhysCellId) { - LOG_W(RRC, - "[UE %d] Frame %d: Handover target (%ld) is different from RSRP measured target (%ld)..\n", - ctxt_pP->module_id, - ctxt_pP->frame, - dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo->targetPhysCellId, - UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId); - return; - } else if ((target_eNB_index = get_adjacent_cell_mod_id(UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId)) - == 0xFF) { - LOG_W(RRC, - "[UE %d] Frame %d: ue_mod_idP of the target eNB not found, check the network topology\n", - ctxt_pP->module_id, - ctxt_pP->frame); - return; - } else { - LOG_I(RRC, - "[UE% d] Frame %d: Received rrcConnectionReconfiguration with mobilityControlInfo \n", - ctxt_pP->module_id, - ctxt_pP->frame); - UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag = 1; // Ready to send more MeasReports if required - } - } - - rrc_ue_process_rrcConnectionReconfiguration( - ctxt_pP, - &dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration, - eNB_indexP); - - if (target_eNB_index != 0xFF) { - rrc_ue_generate_RRCConnectionReconfigurationComplete( - ctxt_pP, - target_eNB_index, - dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.rrc_TransactionIdentifier); - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_indexP].State = RRC_HO_EXECUTION; - UE_rrc_inst[ctxt_pP->module_id].Info[target_eNB_index].State = RRC_RECONFIGURED; - LOG_I(RRC, "[UE %d] State = RRC_RECONFIGURED during HO (eNB %d)\n", - ctxt_pP->module_id, target_eNB_index); -#if defined(ENABLE_ITTI) #if ENABLE_RAL - { - MessageDef *message_ral_p = NULL; - rrc_ral_connection_reconfiguration_ho_ind_t connection_reconfiguration_ho_ind; - int i; - - message_ral_p = itti_alloc_new_message (TASK_RRC_UE, RRC_RAL_CONNECTION_RECONFIGURATION_HO_IND); - memset(&connection_reconfiguration_ho_ind, 0, sizeof(rrc_ral_connection_reconfiguration_ho_ind_t)); - connection_reconfiguration_ho_ind.ue_id = ctxt_pP->module_id; - - if (dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList - != NULL) { - connection_reconfiguration_ho_ind.num_drb = - dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.count; - - for (i=0; ( - imessage.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.count) - && (i < maxDRB); i++) { - // why minus 1 in RRC code for drb_identity ? - connection_reconfiguration_ho_ind.drb_id[i] = - dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.array[i]->drb_Identity; - } - } else { - connection_reconfiguration_ho_ind.num_drb = 0; - } - - if (dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList - != NULL) { - connection_reconfiguration_ho_ind.num_srb = - dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList->list.count - + - UE_rrc_inst[ctxt_pP->module_id].num_srb; - } else { - connection_reconfiguration_ho_ind.num_srb += UE_rrc_inst[ctxt_pP->module_id].num_srb; - } - - if (connection_reconfiguration_ho_ind.num_srb > 2 ) { - connection_reconfiguration_ho_ind.num_srb =2; - } - - memcpy (&message_ral_p->ittiMsg, (void *) &connection_reconfiguration_ho_ind, sizeof(rrc_ral_connection_reconfiguration_ho_ind_t)); - //#warning "ue_mod_idP ? for instance ? => YES" - LOG_I(RRC, "Sending RRC_RAL_CONNECTION_RECONFIGURATION_HO_IND to mRAL\n"); - itti_send_msg_to_task (TASK_RAL_UE, ctxt_pP->instance, message_ral_p); - } + msg_p = itti_alloc_new_message(TASK_RRC_UE, RRC_RAL_CONNECTION_RELEASE_IND); + RRC_RAL_CONNECTION_RELEASE_IND(msg_p).ue_id = ctxt_pP->module_id; + itti_send_msg_to_task(TASK_RAL_UE, ctxt_pP->instance, msg_p); #endif #endif - } else { - rrc_ue_generate_RRCConnectionReconfigurationComplete( + break; + + case DL_DCCH_MessageType__c1_PR_securityModeCommand: + LOG_I(RRC, "[UE %d] Received securityModeCommand (eNB %d)\n", + ctxt_pP->module_id, eNB_indexP); + rrc_ue_process_securityModeCommand( ctxt_pP, - eNB_indexP, - dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.rrc_TransactionIdentifier); - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_indexP].State = RRC_RECONFIGURED; - LOG_I(RRC, "[UE %d] State = RRC_RECONFIGURED (eNB %d)\n", + &dl_dcch_msg->message.choice.c1.choice.securityModeCommand, + eNB_indexP); + break; + + case DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: + LOG_I(RRC, "[UE %d] Received Capability Enquiry (eNB %d)\n", ctxt_pP->module_id, eNB_indexP); -#if defined(ENABLE_ITTI) -#if ENABLE_RAL - { - MessageDef *message_ral_p = NULL; - rrc_ral_connection_reconfiguration_ind_t connection_reconfiguration_ind; - int i; - - message_ral_p = itti_alloc_new_message (TASK_RRC_UE, RRC_RAL_CONNECTION_RECONFIGURATION_IND); - memset(&connection_reconfiguration_ind, 0, sizeof(rrc_ral_connection_reconfiguration_ind_t)); - connection_reconfiguration_ind.ue_id = ctxt_pP->module_id; - - if (dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList - != NULL) { - connection_reconfiguration_ind.num_drb = - dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.count; - - for (i=0; ( - imessage.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.count) - && (i < maxDRB); i++) { - // why minus 1 in RRC code for drb_identity ? - connection_reconfiguration_ind.drb_id[i] = - dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList->list.array[i]->drb_Identity; - } - } else { - connection_reconfiguration_ind.num_drb = 0; - } - - if (dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList - != NULL) { - connection_reconfiguration_ind.num_srb = - dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList->list.count - + - UE_rrc_inst[ctxt_pP->module_id].num_srb; - } else { - connection_reconfiguration_ind.num_srb +=UE_rrc_inst[ctxt_pP->module_id].num_srb; - } - - if (connection_reconfiguration_ind.num_srb > 2 ) { - connection_reconfiguration_ind.num_srb =2; - } - - memcpy (&message_ral_p->ittiMsg, (void *) &connection_reconfiguration_ind, sizeof(rrc_ral_connection_reconfiguration_ind_t)); - //#warning "ue_mod_idP ? for instance ? => YES" - LOG_I(RRC, "Sending RRC_RAL_CONNECTION_RECONFIGURATION_IND to mRAL\n"); - itti_send_msg_to_task (TASK_RAL_UE, ctxt_pP->instance, message_ral_p); - } -#endif -#endif - - } - - break; - - case DL_DCCH_MessageType__c1_PR_rrcConnectionRelease: -#if defined(ENABLE_ITTI) - msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_CONN_RELEASE_IND); - - if ((dl_dcch_msg->message.choice.c1.choice.rrcConnectionRelease.criticalExtensions.present - == RRCConnectionRelease__criticalExtensions_PR_c1) - && (dl_dcch_msg->message.choice.c1.choice.rrcConnectionRelease.criticalExtensions.choice.c1.present - == RRCConnectionRelease__criticalExtensions__c1_PR_rrcConnectionRelease_r8)) { - NAS_CONN_RELEASE_IND(msg_p).cause = - dl_dcch_msg->message.choice.c1.choice.rrcConnectionRelease.criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.releaseCause; - } - - itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p); -#if ENABLE_RAL - msg_p = itti_alloc_new_message(TASK_RRC_UE, RRC_RAL_CONNECTION_RELEASE_IND); - RRC_RAL_CONNECTION_RELEASE_IND(msg_p).ue_id = ctxt_pP->module_id; - itti_send_msg_to_task(TASK_RAL_UE, ctxt_pP->instance, msg_p); -#endif -#endif - break; - - case DL_DCCH_MessageType__c1_PR_securityModeCommand: - LOG_I(RRC, "[UE %d] Received securityModeCommand (eNB %d)\n", - ctxt_pP->module_id, eNB_indexP); - rrc_ue_process_securityModeCommand( - ctxt_pP, - &dl_dcch_msg->message.choice.c1.choice.securityModeCommand, - eNB_indexP); - break; - - case DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry: - LOG_I(RRC, "[UE %d] Received Capability Enquiry (eNB %d)\n", - ctxt_pP->module_id, - eNB_indexP); - rrc_ue_process_ueCapabilityEnquiry( - ctxt_pP, - &dl_dcch_msg->message.choice.c1.choice.ueCapabilityEnquiry, - eNB_indexP); - break; - - case DL_DCCH_MessageType__c1_PR_counterCheck: - break; + rrc_ue_process_ueCapabilityEnquiry( + ctxt_pP, + &dl_dcch_msg->message.choice.c1.choice.ueCapabilityEnquiry, + eNB_indexP); + break; + case DL_DCCH_MessageType__c1_PR_counterCheck: + break; #if defined(Rel10) || defined(Rel14) - case DL_DCCH_MessageType__c1_PR_ueInformationRequest_r9: - break; + case DL_DCCH_MessageType__c1_PR_ueInformationRequest_r9: + break; - case DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r10: - break; + case DL_DCCH_MessageType__c1_PR_loggedMeasurementConfiguration_r10: + break; - case DL_DCCH_MessageType__c1_PR_rnReconfiguration_r10: - break; + case DL_DCCH_MessageType__c1_PR_rnReconfiguration_r10: + break; #endif - case DL_DCCH_MessageType__c1_PR_spare1: - case DL_DCCH_MessageType__c1_PR_spare2: - case DL_DCCH_MessageType__c1_PR_spare3: + case DL_DCCH_MessageType__c1_PR_spare1: + case DL_DCCH_MessageType__c1_PR_spare2: + case DL_DCCH_MessageType__c1_PR_spare3: #if !defined(Rel14) - case DL_DCCH_MessageType__c1_PR_spare4: + case DL_DCCH_MessageType__c1_PR_spare4: #endif - break; + break; - default: - break; + default: + break; } } } @@ -2514,7 +2362,7 @@ const char SIBType[12][6] = {"SIB3","SIB4","SIB5","SIB6","SIB7","SIB8","SIB9","S const char SIBPeriod[8][6]= {"rf8","rf16","rf32","rf64","rf128","rf256","rf512","ERR"}; int siPeriod_int[7] = {80,160,320,640,1280,2560,5120}; -static const char* SIBreserved( long value ) +static const char *SIBreserved( long value ) { if (value < 0 || value > 1) return "ERR"; @@ -2524,7 +2372,7 @@ static const char* SIBreserved( long value ) return "reserved"; } -static const char* SIBbarred( long value ) +static const char *SIBbarred( long value ) { if (value < 0 || value > 1) return "ERR"; @@ -2534,7 +2382,7 @@ static const char* SIBbarred( long value ) return "barred"; } -static const char* SIBallowed( long value ) +static const char *SIBallowed( long value ) { if (value < 0 || value > 1) return "ERR"; @@ -2544,22 +2392,22 @@ static const char* SIBallowed( long value ) return "allowed"; } -static const char* SIB2SoundingPresent( int value ) +static const char *SIB2SoundingPresent( int value ) { switch (value) { - case SoundingRS_UL_ConfigCommon_PR_NOTHING: - return "NOTHING"; + case SoundingRS_UL_ConfigCommon_PR_NOTHING: + return "NOTHING"; - case SoundingRS_UL_ConfigCommon_PR_release: - return "release"; + case SoundingRS_UL_ConfigCommon_PR_release: + return "release"; - case SoundingRS_UL_ConfigCommon_PR_setup: - return "setup"; + case SoundingRS_UL_ConfigCommon_PR_setup: + return "setup"; } return "ERR"; } -static const char* SIB2numberOfRA_Preambles( long value ) +static const char *SIB2numberOfRA_Preambles( long value ) { static char temp[4] = {0}; @@ -2570,7 +2418,7 @@ static const char* SIB2numberOfRA_Preambles( long value ) temp[3] = 0; // terminate string return temp; } -static const char* SIB2powerRampingStep( long value ) +static const char *SIB2powerRampingStep( long value ) { if (value < 0 || value > 3) return "ERR"; @@ -2578,7 +2426,7 @@ static const char* SIB2powerRampingStep( long value ) static const char str[4][4] = {"dB0","dB2","dB4","dB6"}; return str[value]; } -static const char* SIB2preambleInitialReceivedTargetPower( long value ) +static const char *SIB2preambleInitialReceivedTargetPower( long value ) { static char temp[8] = {0}; @@ -2589,7 +2437,7 @@ static const char* SIB2preambleInitialReceivedTargetPower( long value ) temp[7] = 0; // terminate string return temp; } -static const char* SIB2preambleTransMax( long value ) +static const char *SIB2preambleTransMax( long value ) { static char temp[5] = {0}; @@ -2602,26 +2450,26 @@ static const char* SIB2preambleTransMax( long value ) } switch (value) { - case 6: - return "n10"; + case 6: + return "n10"; - case 7: - return "n20"; + case 7: + return "n20"; - case 8: - return "n50"; + case 8: + return "n50"; - case 9: - return "n100"; + case 9: + return "n100"; - case 10: - return "n200"; + case 10: + return "n200"; } /* unreachable but gcc warns... */ return "ERR"; } -static const char* SIB2ra_ResponseWindowSize( long value ) +static const char *SIB2ra_ResponseWindowSize( long value ) { static char temp[4] = {0}; @@ -2634,7 +2482,7 @@ static const char* SIB2ra_ResponseWindowSize( long value ) snprintf( temp, sizeof(temp), "sf%ld", value+2 ); return temp; } -static const char* SIB2mac_ContentionResolutionTimer( long value ) +static const char *SIB2mac_ContentionResolutionTimer( long value ) { static char temp[5] = {0}; @@ -2644,7 +2492,7 @@ static const char* SIB2mac_ContentionResolutionTimer( long value ) snprintf( temp, sizeof(temp), "sf%ld", 8 + value*8 ); return temp; } -static const char* SIB2modificationPeriodCoeff( long value ) +static const char *SIB2modificationPeriodCoeff( long value ) { static char temp[32] = {0}; @@ -2654,7 +2502,7 @@ static const char* SIB2modificationPeriodCoeff( long value ) snprintf( temp, sizeof(temp), "n%d", (int)pow(2,value+1) ); return temp; } -static const char* SIB2defaultPagingCycle( long value ) +static const char *SIB2defaultPagingCycle( long value ) { static char temp[32] = {0}; @@ -2664,7 +2512,7 @@ static const char* SIB2defaultPagingCycle( long value ) snprintf( temp, sizeof(temp), "rf%d", (int)pow(2,value+4) ); return temp; } -static const char* SIB2nB( long value ) +static const char *SIB2nB( long value ) { if (value < 0 || value > 7) return "ERR"; @@ -2678,17 +2526,16 @@ static const char* SIB2nB( long value ) //----------------------------------------------------------------------------- int decode_BCCH_DLSCH_Message( - const protocol_ctxt_t* const ctxt_pP, + const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, - uint8_t* const Sdu, + uint8_t *const Sdu, const uint8_t Sdu_len, const uint8_t rsrq, const uint8_t rsrp ) { BCCH_DL_SCH_Message_t *bcch_message = NULL; - SystemInformationBlockType1_t* sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]; + SystemInformationBlockType1_t *sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]; int i; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_IN ); if (((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&1) == 1) && // SIB1 received @@ -2700,7 +2547,6 @@ int decode_BCCH_DLSCH_Message( } rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_RECEIVING_SIB ); - asn_dec_rval_t dec_rval = uper_decode_complete( NULL, &asn_DEF_BCCH_DL_SCH_Message, (void **)&bcch_message, @@ -2711,11 +2557,13 @@ int decode_BCCH_DLSCH_Message( LOG_E( RRC, "[UE %"PRIu8"] Failed to decode BCCH_DLSCH_MESSAGE (%zu bits)\n", ctxt_pP->module_id, dec_rval.consumed ); - for (i=0;iittiMsg, (void *) bcch_message, sizeof(RrcDlBcchMessage)); - itti_send_msg_to_task (TASK_UNKNOWN, ctxt_pP->instance, msg_p); } # else @@ -2737,11 +2583,9 @@ int decode_BCCH_DLSCH_Message( if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_BCCH_DL_SCH_Message, (void *)bcch_message)) > 0) { MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_DL_BCCH, message_string_size + sizeof (IttiMsgText)); msg_p->ittiMsg.rrc_dl_bcch.size = message_string_size; memcpy(&msg_p->ittiMsg.rrc_dl_bcch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); } } @@ -2750,42 +2594,39 @@ int decode_BCCH_DLSCH_Message( if (bcch_message->message.present == BCCH_DL_SCH_MessageType_PR_c1) { switch (bcch_message->message.choice.c1.present) { - case BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1: - if ((ctxt_pP->frame % 2) == 0) { - // even frame - if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&1) == 0) { - SystemInformationBlockType1_t* sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]; - memcpy( (void*)sib1, - (void*)&bcch_message->message.choice.c1.choice.systemInformationBlockType1, - sizeof(SystemInformationBlockType1_t) ); - LOG_D( RRC, "[UE %"PRIu8"] Decoding First SIB1\n", ctxt_pP->module_id ); - decode_SIB1( ctxt_pP, eNB_index, rsrq, rsrp ); + case BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1: + if ((ctxt_pP->frame % 2) == 0) { + // even frame + if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&1) == 0) { + SystemInformationBlockType1_t *sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]; + memcpy( (void *)sib1, + (void *)&bcch_message->message.choice.c1.choice.systemInformationBlockType1, + sizeof(SystemInformationBlockType1_t) ); + LOG_D( RRC, "[UE %"PRIu8"] Decoding First SIB1\n", ctxt_pP->module_id ); + decode_SIB1( ctxt_pP, eNB_index, rsrq, rsrp ); + } } - } - break; + break; - case BCCH_DL_SCH_MessageType__c1_PR_systemInformation: - if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&1) == 1) { - // SIB1 with schedulingInfoList is available + case BCCH_DL_SCH_MessageType__c1_PR_systemInformation: + if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&1) == 1) { + // SIB1 with schedulingInfoList is available + SystemInformation_t *si = UE_rrc_inst[ctxt_pP->module_id].si[eNB_index]; + memcpy( si, + &bcch_message->message.choice.c1.choice.systemInformation, + sizeof(SystemInformation_t) ); + LOG_D( RRC, "[UE %"PRIu8"] Decoding SI for frameP %"PRIu32"\n", + ctxt_pP->module_id, + ctxt_pP->frame ); + decode_SI( ctxt_pP, eNB_index ); + } - SystemInformation_t* si = UE_rrc_inst[ctxt_pP->module_id].si[eNB_index]; - memcpy( si, - &bcch_message->message.choice.c1.choice.systemInformation, - sizeof(SystemInformation_t) ); + break; - LOG_D( RRC, "[UE %"PRIu8"] Decoding SI for frameP %"PRIu32"\n", - ctxt_pP->module_id, - ctxt_pP->frame ); - - decode_SI( ctxt_pP, eNB_index ); - } - - break; - - case BCCH_DL_SCH_MessageType__c1_PR_NOTHING: - default: - break; + case BCCH_DL_SCH_MessageType__c1_PR_NOTHING: + default: + break; } } @@ -2799,22 +2640,19 @@ int decode_BCCH_DLSCH_Message( } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_BCCH, VCD_FUNCTION_OUT ); - return 0; } //----------------------------------------------------------------------------- int decode_PCCH_DLSCH_Message( - const protocol_ctxt_t* const ctxt_pP, + const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, - uint8_t* const Sdu, + uint8_t *const Sdu, const uint8_t Sdu_len) { PCCH_Message_t *pcch_message = NULL; int i; - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_UE_DECODE_PCCH, VCD_FUNCTION_IN ); - asn_dec_rval_t dec_rval = uper_decode_complete( NULL, &asn_DEF_PCCH_Message, (void **)&pcch_message, @@ -2825,11 +2663,13 @@ int decode_PCCH_DLSCH_Message( LOG_E( RRC, "[UE %"PRIu8"] Failed to decode PCCH_MESSAGE (%zu bits)\n", ctxt_pP->module_id, dec_rval.consumed ); - for (i=0;imodule_id].sib1[eNB_index]; - + SystemInformationBlockType1_t *sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SIB1, VCD_FUNCTION_IN ); - LOG_I( RRC, "[UE %d] : Dumping SIB 1\n", ctxt_pP->module_id ); - PLMN_Identity_t *PLMN_identity = &sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[0]->plmn_Identity; - int mccdigits = PLMN_identity->mcc->list.count; int mncdigits = PLMN_identity->mnc.list.count; - int mcc; if (mccdigits == 2) { @@ -2876,7 +2711,6 @@ static int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_ LOG_I( RRC, "PLMN MCC %0*d, MNC %0*d, TAC 0x%04x\n", mccdigits, mcc, mncdigits, mnc, tac ); long cellReservedForOperatorUse = sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[0]->cellReservedForOperatorUse; LOG_I( RRC, "cellReservedForOperatorUse : raw:%ld decoded:%s\n", cellReservedForOperatorUse, SIBreserved(cellReservedForOperatorUse) ); - // search internal table for provider name int plmn_ind = 0; @@ -2899,7 +2733,6 @@ static int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_ sib1->cellAccessRelatedInfo.cellIdentity.buf[1], sib1->cellAccessRelatedInfo.cellIdentity.buf[2], sib1->cellAccessRelatedInfo.cellIdentity.buf[3] >> sib1->cellAccessRelatedInfo.cellIdentity.bits_unused); - long cellBarred = sib1->cellAccessRelatedInfo.cellBarred; LOG_I( RRC, "cellAccessRelatedInfo.cellBarred : raw:%ld decoded:%s\n", cellBarred, SIBbarred(cellBarred) ); long intraFreqReselection = sib1->cellAccessRelatedInfo.intraFreqReselection; @@ -2953,48 +2786,43 @@ static int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_ LOG_I( RRC, "siWindowLength : %s\n", siWindowLength[min(sib1->si_WindowLength,7)] ); LOG_I( RRC, "systemInfoValueTag : %ld\n", sib1->systemInfoValueTag ); - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIperiod = siPeriod_int[sib1->schedulingInfoList.list.array[0]->si_Periodicity]; UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIwindowsize = siWindowLength_int[sib1->si_WindowLength]; LOG_I( RRC, "[FRAME unknown][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB1 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", ctxt_pP->module_id, eNB_index, ctxt_pP->module_id ); - rrc_mac_config_req_ue(ctxt_pP->module_id, 0, eNB_index, - (RadioResourceConfigCommonSIB_t *)NULL, - (struct PhysicalConfigDedicated *)NULL, + (RadioResourceConfigCommonSIB_t *)NULL, + (struct PhysicalConfigDedicated *)NULL, #if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, #endif - (MeasObjectToAddMod_t **)NULL, - (MAC_MainConfig_t *)NULL, - 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *)NULL, - UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]->tdd_Config, - (MobilityControlInfo_t *) NULL, - &UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIwindowsize, - &UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIperiod, - NULL, - NULL, - NULL, - (MBSFN_SubframeConfigList_t *)NULL + (MeasObjectToAddMod_t **)NULL, + (MAC_MainConfig_t *)NULL, + 0, + (struct LogicalChannelConfig *)NULL, + (MeasGapConfig_t *)NULL, + UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]->tdd_Config, + (MobilityControlInfo_t *) NULL, + &UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIwindowsize, + &UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIperiod, + NULL, + NULL, + NULL, + (MBSFN_SubframeConfigList_t *)NULL #if defined(Rel10) || defined(Rel14) - ,0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL - + ,0, + (MBSFN_AreaInfoList_r9_t *)NULL, + (PMCH_InfoList_r9_t *)NULL #endif #ifdef CBA - , - 0, - 0 + , + 0, + 0 #endif - ); - + ); UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus = 1; UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIB1systemInfoValueTag = sib1->systemInfoValueTag; - #if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME) { int cell_valid = 0; @@ -3003,13 +2831,11 @@ static int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_ /* Cell is not barred */ int plmn; int plmn_number; - plmn_number = sib1->cellAccessRelatedInfo.plmn_IdentityList.list.count; /* Compare requested PLMN and PLMNs from SIB1*/ for (plmn = 0; plmn < plmn_number; plmn++) { PLMN_Identity_t *plmn_Identity; - plmn_Identity = &sib1->cellAccessRelatedInfo.plmn_IdentityList.list.array[plmn]->plmn_Identity; if ( @@ -3035,7 +2861,6 @@ static int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_ ) { /* PLMN match, send a confirmation to NAS */ MessageDef *msg_p; - msg_p = itti_alloc_new_message(TASK_RRC_UE, NAS_CELL_SELECTION_CNF); NAS_CELL_SELECTION_CNF (msg_p).errCode = AS_SUCCESS; NAS_CELL_SELECTION_CNF (msg_p).cellID = BIT_STRING_to_uint32(&sib1->cellAccessRelatedInfo.cellIdentity); @@ -3043,7 +2868,6 @@ static int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_ NAS_CELL_SELECTION_CNF (msg_p).rat = 0xFF; NAS_CELL_SELECTION_CNF (msg_p).rsrq = rsrq; NAS_CELL_SELECTION_CNF (msg_p).rsrp = rsrp; - itti_send_msg_to_task(TASK_NAS_UE, ctxt_pP->instance, msg_p); cell_valid = 1; break; @@ -3054,16 +2878,12 @@ static int decode_SIB1( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_ if (cell_valid == 0) { /* Cell can not be used, ask PHY to try the next one */ MessageDef *msg_p; - msg_p = itti_alloc_new_message(TASK_RRC_UE, PHY_FIND_NEXT_CELL_REQ); - itti_send_msg_to_task(TASK_PHY_UE, ctxt_pP->instance, msg_p); } } #endif - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SIB1, VCD_FUNCTION_OUT ); - return 0; } @@ -3120,7 +2940,6 @@ static void dump_sib2( SystemInformationBlockType2_t *sib2 ) LOG_I( RRC, "radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.preambleInitialReceivedTargetPower : raw:%ld decoded:%s\n", sib2->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.preambleInitialReceivedTargetPower, SIB2preambleInitialReceivedTargetPower(sib2->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.preambleInitialReceivedTargetPower) ); - LOG_I( RRC, "radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.preambleTransMax : raw:%ld decoded:%s\n", sib2->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.preambleTransMax, SIB2preambleTransMax(sib2->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.preambleTransMax) ); @@ -3130,15 +2949,12 @@ static void dump_sib2( SystemInformationBlockType2_t *sib2 ) LOG_I( RRC, "radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer : raw:%ld decoded:%s\n", sib2->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer, SIB2mac_ContentionResolutionTimer(sib2->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer) ); - LOG_I( RRC, "radioResourceConfigCommon.rach_ConfigCommon.maxHARQ_Msg3Tx : %ld\n", sib2->radioResourceConfigCommon.rach_ConfigCommon.maxHARQ_Msg3Tx ); - // BCCH LOG_I( RRC, "radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff : raw:%ld decoded:%s\n", sib2->radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff, SIB2modificationPeriodCoeff(sib2->radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff) ); - // PCCH LOG_I( RRC, "radioResourceConfigCommon.pcch_Config.defaultPagingCycle : raw:%ld decoded:%s\n", sib2->radioResourceConfigCommon.pcch_Config.defaultPagingCycle, @@ -3146,7 +2962,6 @@ static void dump_sib2( SystemInformationBlockType2_t *sib2 ) LOG_I( RRC, "radioResourceConfigCommon.pcch_Config.nB : raw:%ld decoded:%s\n", sib2->radioResourceConfigCommon.pcch_Config.nB, SIB2nB(sib2->radioResourceConfigCommon.pcch_Config.nB) ); - // PRACH LOG_I( RRC, "radioResourceConfigCommon.prach_Config.rootSequenceIndex : %ld\n", sib2->radioResourceConfigCommon.prach_Config.rootSequenceIndex ); @@ -3158,13 +2973,11 @@ static void dump_sib2( SystemInformationBlockType2_t *sib2 ) sib2->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig ); LOG_I( RRC, "radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_FreqOffset : %ld\n", sib2->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_FreqOffset ); - // PDSCH-Config LOG_I( RRC, "radioResourceConfigCommon.pdsch_ConfigCommon.referenceSignalPower : %ld\n", sib2->radioResourceConfigCommon.pdsch_ConfigCommon.referenceSignalPower ); LOG_I( RRC, "radioResourceConfigCommon.pdsch_ConfigCommon.p_b : %ld\n", sib2->radioResourceConfigCommon.pdsch_ConfigCommon.p_b ); - // PUSCH-Config LOG_I( RRC, "radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.n_SB : %ld\n", sib2->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.n_SB ); @@ -3182,7 +2995,6 @@ static void dump_sib2( SystemInformationBlockType2_t *sib2 ) sib2->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled ); LOG_I( RRC, "radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift : %ld\n", sib2->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift ); - // PUCCH-Config LOG_I( RRC, "radioResourceConfigCommon.pucch_ConfigCommon.deltaPUCCH_Shift : %ld\n", sib2->radioResourceConfigCommon.pucch_ConfigCommon.deltaPUCCH_Shift ); @@ -3192,7 +3004,6 @@ static void dump_sib2( SystemInformationBlockType2_t *sib2 ) sib2->radioResourceConfigCommon.pucch_ConfigCommon.nCS_AN ); LOG_I( RRC, "radioResourceConfigCommon.pucch_ConfigCommon.n1PUCCH_AN : %ld\n", sib2->radioResourceConfigCommon.pucch_ConfigCommon.n1PUCCH_AN ); - // SoundingRS_UL_Config LOG_I( RRC, "radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present : raw:%d decoded:%s\n", sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present, @@ -3208,9 +3019,9 @@ static void dump_sib2( SystemInformationBlockType2_t *sib2 ) if(sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts) { - LOG_I( RRC, "radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts : %ld\n", - /* TODO: check that it's okay to access [0] */ - sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts[0] ); + LOG_I( RRC, "radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts : %ld\n", + /* TODO: check that it's okay to access [0] */ + sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts[0] ); } } @@ -3233,15 +3044,12 @@ static void dump_sib2( SystemInformationBlockType2_t *sib2 ) sib2->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b ); LOG_I( RRC, "radioResourceConfigCommon.uplinkPowerControlCommon.deltaPreambleMsg3 : %ld\n", sib2->radioResourceConfigCommon.uplinkPowerControlCommon.deltaPreambleMsg3 ); - LOG_I( RRC, "radioResourceConfigCommon.ul_CyclicPrefixLength : %ld\n", sib2->radioResourceConfigCommon.ul_CyclicPrefixLength ); - #if defined(Rel10) || defined(Rel14) // UplinkPowerControlCommon_v1020 // ... #endif - LOG_I( RRC, "ue_TimersAndConstants.t300 : %ld\n", sib2->ue_TimersAndConstants.t300 ); LOG_I( RRC, "ue_TimersAndConstants.t301 : %ld\n", sib2->ue_TimersAndConstants.t301 ); LOG_I( RRC, "ue_TimersAndConstants.t310 : %ld\n", sib2->ue_TimersAndConstants.t310 ); @@ -3268,7 +3076,6 @@ static void dump_sib2( SystemInformationBlockType2_t *sib2 ) LOG_I( RRC, "mbsfn_SubframeConfigList : not defined\n" ); LOG_I( RRC, "timeAlignmentTimerCommon : %ld\n", sib2->timeAlignmentTimerCommon ); - #if defined(Rel10) || defined(Rel14) if (sib2->lateNonCriticalExtension) { @@ -3313,7 +3120,6 @@ static void dump_sib2( SystemInformationBlockType2_t *sib2 ) static void dump_sib3( SystemInformationBlockType3_t *sib3 ) { LOG_I( RRC, "Dumping SIB3 (see TS36.331 V8.21.0)\n" ); - int q_Hyst_dB = sib3->cellReselectionInfoCommon.q_Hyst; // sib3->cellReselectionInfoCommon.q_Hyst is a enumerated value if (q_Hyst_dB > 6) @@ -3348,7 +3154,6 @@ static void dump_sib3( SystemInformationBlockType3_t *sib3 ) LOG_I( RRC, "cellReselectionServingFreqInfo.threshServingLow : %ld\n", sib3->cellReselectionServingFreqInfo.threshServingLow ); LOG_I( RRC, "cellReselectionServingFreqInfo.cellReselectionPriority : %ld\n", sib3->cellReselectionServingFreqInfo.cellReselectionPriority ); - LOG_I( RRC, "intraFreqCellReselectionInfo.q_RxLevMin : %ld\n", sib3->intraFreqCellReselectionInfo.q_RxLevMin ); if (sib3->intraFreqCellReselectionInfo.p_Max) { @@ -3385,7 +3190,6 @@ int Qoffsettab[31] = {-24,-22,-20,-18,-16,-14,-12,-10,-8,-6,-5,-4,-3,-2,-1,0,1,2 int PhysCellIdRange[16] = {4,8,12,16,24,32,48,64,84,96,128,168,252,504,0,0}; uint64_t arfcn_to_freq(long arfcn) { - if (arfcn < 600) // Band 1 return((uint64_t)2110000000 + (arfcn*100000)); else if (arfcn <1200) // Band 2 @@ -3464,93 +3268,110 @@ static void dump_sib5( SystemInformationBlockType5_t *sib5 ) InterFreqCarrierFreqList_t interFreqCarrierFreqList = sib5->interFreqCarrierFreqList; int i,j; InterFreqCarrierFreqInfo_t *ifcfInfo; - LOG_I( RRC, "Dumping SIB5 (see TS36.331 V8.21.0)\n" ); - - for (i=0;idl_CarrierFreq), - ifcfInfo->dl_CarrierFreq); + arfcn_to_freq(ifcfInfo->dl_CarrierFreq), + ifcfInfo->dl_CarrierFreq); LOG_I(RRC," Q_RXLevMin : %ld\n", ifcfInfo->q_RxLevMin); + if (ifcfInfo->p_Max != NULL) LOG_I(RRC," P_max : %ld\n", *ifcfInfo->p_Max); + LOG_I(RRC," T_ReselectionEUTRA : %ld\n",ifcfInfo->t_ReselectionEUTRA); + if (ifcfInfo->t_ReselectionEUTRA_SF) { LOG_I(RRC," t_ReselectionEUTRA_SF.sf_Medium %ld, t_ReselectionEUTRA_SF.sf_High %ld", - ifcfInfo->t_ReselectionEUTRA_SF->sf_Medium, - ifcfInfo->t_ReselectionEUTRA_SF->sf_High); + ifcfInfo->t_ReselectionEUTRA_SF->sf_Medium, + ifcfInfo->t_ReselectionEUTRA_SF->sf_High); } + LOG_I(RRC," threshX_High : %ld\n",ifcfInfo->threshX_High); LOG_I(RRC," threshX_Low : %ld\n",ifcfInfo->threshX_Low); + switch(ifcfInfo->allowedMeasBandwidth) { - case AllowedMeasBandwidth_mbw6: - LOG_I(RRC," AllowedMeasBandwidth : 6\n"); - break; - case AllowedMeasBandwidth_mbw15: - LOG_I(RRC," AllowedMeasBandwidth : 15\n"); - break; - case AllowedMeasBandwidth_mbw25: - LOG_I(RRC," AllowedMeasBandwidth : 25\n"); - break; - case AllowedMeasBandwidth_mbw50: - LOG_I(RRC," AllowedMeasBandwidth : 50\n"); - break; - case AllowedMeasBandwidth_mbw75: - LOG_I(RRC," AllowedMeasBandwidth : 75\n"); - break; - case AllowedMeasBandwidth_mbw100: - LOG_I(RRC," AllowedMeasBandwidth : 100\n"); - break; + case AllowedMeasBandwidth_mbw6: + LOG_I(RRC," AllowedMeasBandwidth : 6\n"); + break; + + case AllowedMeasBandwidth_mbw15: + LOG_I(RRC," AllowedMeasBandwidth : 15\n"); + break; + + case AllowedMeasBandwidth_mbw25: + LOG_I(RRC," AllowedMeasBandwidth : 25\n"); + break; + + case AllowedMeasBandwidth_mbw50: + LOG_I(RRC," AllowedMeasBandwidth : 50\n"); + break; + + case AllowedMeasBandwidth_mbw75: + LOG_I(RRC," AllowedMeasBandwidth : 75\n"); + break; + + case AllowedMeasBandwidth_mbw100: + LOG_I(RRC," AllowedMeasBandwidth : 100\n"); + break; } + if (ifcfInfo->presenceAntennaPort1) LOG_I(RRC," PresenceAntennaPort1 : True\n"); else LOG_I(RRC," PresenceAntennaPort1 : False\n"); + if (ifcfInfo->cellReselectionPriority) { LOG_I(RRC," CellReselectionPriority : %ld\n", - *ifcfInfo->cellReselectionPriority); + *ifcfInfo->cellReselectionPriority); } + LOG_I(RRC," NeighCellConfig : "); - for (j=0;jneighCellConfig.size;j++) { + + for (j=0; jneighCellConfig.size; j++) { printf("%2x ",ifcfInfo->neighCellConfig.buf[j]); } + printf("\n"); + if (ifcfInfo->q_OffsetFreq) LOG_I(RRC," Q_OffsetFreq : %d\n",Qoffsettab[*ifcfInfo->q_OffsetFreq]); + if (ifcfInfo->interFreqNeighCellList) { - - for (j=0;jinterFreqNeighCellList->list.count;j++) { - LOG_I(RRC," Cell %d\n", j); - LOG_I(RRC," PhysCellId : %ld\n",ifcfInfo->interFreqNeighCellList->list.array[j]->physCellId); - LOG_I(RRC," Q_OffsetRange : %ld\n",ifcfInfo->interFreqNeighCellList->list.array[j]->q_OffsetCell); - + for (j=0; jinterFreqNeighCellList->list.count; j++) { + LOG_I(RRC," Cell %d\n", j); + LOG_I(RRC," PhysCellId : %ld\n",ifcfInfo->interFreqNeighCellList->list.array[j]->physCellId); + LOG_I(RRC," Q_OffsetRange : %ld\n",ifcfInfo->interFreqNeighCellList->list.array[j]->q_OffsetCell); } } + if (ifcfInfo->interFreqBlackCellList) { - - for (j=0;jinterFreqBlackCellList->list.count;j++) { - LOG_I(RRC," Cell %d\n", j); - LOG_I(RRC," PhysCellId start: %ld\n",ifcfInfo->interFreqBlackCellList->list.array[j]->start); - if (ifcfInfo->interFreqBlackCellList->list.array[i]->range) { - LOG_I(RRC," PhysCellId Range : %ld\n",*ifcfInfo->interFreqBlackCellList->list.array[j]->range); - } + for (j=0; jinterFreqBlackCellList->list.count; j++) { + LOG_I(RRC," Cell %d\n", j); + LOG_I(RRC," PhysCellId start: %ld\n",ifcfInfo->interFreqBlackCellList->list.array[j]->start); + + if (ifcfInfo->interFreqBlackCellList->list.array[i]->range) { + LOG_I(RRC," PhysCellId Range : %ld\n",*ifcfInfo->interFreqBlackCellList->list.array[j]->range); + } } } + #if defined(Rel10) || defined(Rel14) + if (ifcfInfo->ext1 && ifcfInfo->ext1->q_QualMin_r9) LOG_I(RRC," Q_QualMin_r9 : %ld\n",*ifcfInfo->ext1->q_QualMin_r9); - + if (ifcfInfo->ext1 && ifcfInfo->ext1->threshX_Q_r9) { LOG_I(RRC," threshX_HighQ_r9 : %ld\n",ifcfInfo->ext1->threshX_Q_r9->threshX_HighQ_r9); LOG_I(RRC," threshX_LowQ_r9: %ld\n",ifcfInfo->ext1->threshX_Q_r9->threshX_LowQ_r9); } + #endif } - } - + #if defined(Rel10) || defined(Rel14) static void dump_sib13( SystemInformationBlockType13_r9_t *sib13 ) { @@ -3563,13 +3384,11 @@ static void dump_sib13( SystemInformationBlockType13_r9_t *sib13 ) #endif //----------------------------------------------------------------------------- -static int decode_SI( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index ) +static int decode_SI( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index ) { - - SystemInformation_t** si = &UE_rrc_inst[ctxt_pP->module_id].si[eNB_index]; + SystemInformation_t **si = &UE_rrc_inst[ctxt_pP->module_id].si[eNB_index]; int new_sib = 0; - SystemInformationBlockType1_t* sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]; - + SystemInformationBlockType1_t *sib1 = UE_rrc_inst[ctxt_pP->module_id].sib1[eNB_index]; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI, VCD_FUNCTION_IN ); // Dump contents @@ -3587,252 +3406,254 @@ static int decode_SI( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_in typeandinfo = (*si)->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.array[i]; switch(typeandinfo->present) { - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2: - if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&2) == 0) { - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=2; - new_sib=1; - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index], &typeandinfo->choice.sib2, sizeof(SystemInformationBlockType2_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB2 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); - dump_sib2( UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index] ); - LOG_I( RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB2 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", - ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id ); - - rrc_mac_config_req_ue(ctxt_pP->module_id, 0, eNB_index, - &UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->radioResourceConfigCommon, - (struct PhysicalConfigDedicated *)NULL, + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2: + if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&2) == 0) { + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=2; + new_sib=1; + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index], &typeandinfo->choice.sib2, sizeof(SystemInformationBlockType2_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB2 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); + dump_sib2( UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index] ); + LOG_I( RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB2 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", + ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id ); + rrc_mac_config_req_ue(ctxt_pP->module_id, 0, eNB_index, + &UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->radioResourceConfigCommon, + (struct PhysicalConfigDedicated *)NULL, #if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, + (SCellToAddMod_r10_t *)NULL, #endif - (MeasObjectToAddMod_t **)NULL, - (MAC_MainConfig_t *)NULL, - 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *)NULL, - (TDD_Config_t *)NULL, - (MobilityControlInfo_t *)NULL, - NULL, - NULL, - UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.ul_CarrierFreq, - UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.ul_Bandwidth, - &UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.additionalSpectrumEmission, - UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->mbsfn_SubframeConfigList + (MeasObjectToAddMod_t **)NULL, + (MAC_MainConfig_t *)NULL, + 0, + (struct LogicalChannelConfig *)NULL, + (MeasGapConfig_t *)NULL, + (TDD_Config_t *)NULL, + (MobilityControlInfo_t *)NULL, + NULL, + NULL, + UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.ul_CarrierFreq, + UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.ul_Bandwidth, + &UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->freqInfo.additionalSpectrumEmission, + UE_rrc_inst[ctxt_pP->module_id].sib2[eNB_index]->mbsfn_SubframeConfigList #if defined(Rel10) || defined(Rel14) - ,0, - (MBSFN_AreaInfoList_r9_t *)NULL, - (PMCH_InfoList_r9_t *)NULL - + ,0, + (MBSFN_AreaInfoList_r9_t *)NULL, + (PMCH_InfoList_r9_t *)NULL #endif #ifdef CBA - ,0, - 0 + ,0, + 0 #endif - ); - // After SI is received, prepare RRCConnectionRequest + ); + // After SI is received, prepare RRCConnectionRequest #if defined(Rel10) || defined(Rel14) - if (UE_rrc_inst[ctxt_pP->module_id].MBMS_flag < 3) // see -Q option + if (UE_rrc_inst[ctxt_pP->module_id].MBMS_flag < 3) // see -Q option #endif #if !(defined(ENABLE_ITTI) && defined(ENABLE_USE_MME)) - rrc_ue_generate_RRCConnectionRequest( ctxt_pP, eNB_index ); - + rrc_ue_generate_RRCConnectionRequest( ctxt_pP, eNB_index ); + #endif - - if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State == RRC_IDLE) { - LOG_I( RRC, "[UE %d] Received SIB1/SIB2/SIB3 Switching to RRC_SI_RECEIVED\n", ctxt_pP->module_id ); - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_SI_RECEIVED; + + if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State == RRC_IDLE) { + LOG_I( RRC, "[UE %d] Received SIB1/SIB2/SIB3 Switching to RRC_SI_RECEIVED\n", ctxt_pP->module_id ); + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].State = RRC_SI_RECEIVED; #if ENABLE_RAL - { - MessageDef *message_ral_p = NULL; - rrc_ral_system_information_ind_t ral_si_ind; - - message_ral_p = itti_alloc_new_message (TASK_RRC_UE, RRC_RAL_SYSTEM_INFORMATION_IND); - memset(&ral_si_ind, 0, sizeof(rrc_ral_system_information_ind_t)); - ral_si_ind.plmn_id.MCCdigit2 = '0'; - ral_si_ind.plmn_id.MCCdigit1 = '2'; - ral_si_ind.plmn_id.MNCdigit3 = '0'; - ral_si_ind.plmn_id.MCCdigit3 = '8'; - ral_si_ind.plmn_id.MNCdigit2 = '9'; - ral_si_ind.plmn_id.MNCdigit1 = '9'; - ral_si_ind.cell_id = 1; - ral_si_ind.dbm = 0; - //ral_si_ind.dbm = fifo_dump_emos_UE.PHY_measurements->rx_rssi_dBm[eNB_index]; - // TO DO - ral_si_ind.sinr = 0; - //ral_si_ind.sinr = fifo_dump_emos_UE.PHY_measurements->subband_cqi_dB[eNB_index][phy_vars_ue->lte_frame_parms.nb_antennas_rx][0]; - // TO DO - ral_si_ind.link_data_rate = 0; - memcpy (&message_ral_p->ittiMsg, (void *) &ral_si_ind, sizeof(rrc_ral_system_information_ind_t)); + { + MessageDef *message_ral_p = NULL; + rrc_ral_system_information_ind_t ral_si_ind; + message_ral_p = itti_alloc_new_message (TASK_RRC_UE, RRC_RAL_SYSTEM_INFORMATION_IND); + memset(&ral_si_ind, 0, sizeof(rrc_ral_system_information_ind_t)); + ral_si_ind.plmn_id.MCCdigit2 = '0'; + ral_si_ind.plmn_id.MCCdigit1 = '2'; + ral_si_ind.plmn_id.MNCdigit3 = '0'; + ral_si_ind.plmn_id.MCCdigit3 = '8'; + ral_si_ind.plmn_id.MNCdigit2 = '9'; + ral_si_ind.plmn_id.MNCdigit1 = '9'; + ral_si_ind.cell_id = 1; + ral_si_ind.dbm = 0; + //ral_si_ind.dbm = fifo_dump_emos_UE.PHY_measurements->rx_rssi_dBm[eNB_index]; + // TO DO + ral_si_ind.sinr = 0; + //ral_si_ind.sinr = fifo_dump_emos_UE.PHY_measurements->subband_cqi_dB[eNB_index][phy_vars_ue->lte_frame_parms.nb_antennas_rx][0]; + // TO DO + ral_si_ind.link_data_rate = 0; + memcpy (&message_ral_p->ittiMsg, (void *) &ral_si_ind, sizeof(rrc_ral_system_information_ind_t)); #warning "ue_mod_idP ? for instance ?" - itti_send_msg_to_task (TASK_RAL_UE, UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), message_ral_p); - } + itti_send_msg_to_task (TASK_RAL_UE, UE_MODULE_ID_TO_INSTANCE(ctxt_pP->module_id), message_ral_p); + } #endif - } - } - break; // case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2 + } + } - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3: - if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&4) == 0) { - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=4; - new_sib=1; - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib3[eNB_index], &typeandinfo->choice.sib3, sizeof(SystemInformationBlockType3_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB3 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); - dump_sib3( UE_rrc_inst[ctxt_pP->module_id].sib3[eNB_index] ); + break; // case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2 - } - break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3: + if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&4) == 0) { + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=4; + new_sib=1; + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib3[eNB_index], &typeandinfo->choice.sib3, sizeof(SystemInformationBlockType3_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB3 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); + dump_sib3( UE_rrc_inst[ctxt_pP->module_id].sib3[eNB_index] ); + } - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib4: - if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&8) == 0) { - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=8; - new_sib=1; - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib4[eNB_index], &typeandinfo->choice.sib4, sizeof(SystemInformationBlockType4_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB4 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); - } + break; - break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib4: + if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&8) == 0) { + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=8; + new_sib=1; + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib4[eNB_index], &typeandinfo->choice.sib4, sizeof(SystemInformationBlockType4_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB4 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); + } - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib5: - if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&16) == 0) { - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=16; - new_sib=1; - - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib5[eNB_index], &typeandinfo->choice.sib5, sizeof(SystemInformationBlockType5_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB5 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); - dump_sib5(UE_rrc_inst[ctxt_pP->module_id].sib5[eNB_index]); - } - break; + break; - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib6: - if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&32) == 0) { - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=32; - new_sib=1; - - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib6[eNB_index], &typeandinfo->choice.sib6, sizeof(SystemInformationBlockType6_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB6 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); - } - break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib5: + if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&16) == 0) { + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=16; + new_sib=1; + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib5[eNB_index], &typeandinfo->choice.sib5, sizeof(SystemInformationBlockType5_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB5 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); + dump_sib5(UE_rrc_inst[ctxt_pP->module_id].sib5[eNB_index]); + } - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib7: - if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&64) == 0) { - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=64; - new_sib=1; - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib7[eNB_index], &typeandinfo->choice.sib7, sizeof(SystemInformationBlockType7_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB7 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); - } - break; + break; - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib8: - if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&128) == 0) { - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=128; - new_sib=1; - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib8[eNB_index], &typeandinfo->choice.sib8, sizeof(SystemInformationBlockType8_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB8 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); - } - break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib6: + if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&32) == 0) { + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=32; + new_sib=1; + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib6[eNB_index], &typeandinfo->choice.sib6, sizeof(SystemInformationBlockType6_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB6 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); + } - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib9: - if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&256) == 0) { - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=256; - new_sib=1; - - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib9[eNB_index], &typeandinfo->choice.sib9, sizeof(SystemInformationBlockType9_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB9 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); - } - break; + break; - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib10: - if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&512) == 0) { - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=512; - new_sib=1; - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib10[eNB_index], &typeandinfo->choice.sib10, sizeof(SystemInformationBlockType10_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB10 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); - } - break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib7: + if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&64) == 0) { + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=64; + new_sib=1; + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib7[eNB_index], &typeandinfo->choice.sib7, sizeof(SystemInformationBlockType7_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB7 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); + } - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib11: - if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&1024) == 0) { - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=1024; - new_sib=1; + break; - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib11[eNB_index], &typeandinfo->choice.sib11, sizeof(SystemInformationBlockType11_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB11 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); - } - break; + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib8: + if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&128) == 0) { + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=128; + new_sib=1; + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib8[eNB_index], &typeandinfo->choice.sib8, sizeof(SystemInformationBlockType8_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB8 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); + } + break; + + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib9: + if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&256) == 0) { + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=256; + new_sib=1; + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib9[eNB_index], &typeandinfo->choice.sib9, sizeof(SystemInformationBlockType9_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB9 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); + } + + break; + + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib10: + if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&512) == 0) { + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=512; + new_sib=1; + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib10[eNB_index], &typeandinfo->choice.sib10, sizeof(SystemInformationBlockType10_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB10 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); + } + + break; + + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib11: + if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&1024) == 0) { + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=1024; + new_sib=1; + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib11[eNB_index], &typeandinfo->choice.sib11, sizeof(SystemInformationBlockType11_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB11 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); + } + + break; #if defined(Rel10) || defined(Rel14) - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib12_v920: - if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&2048) == 0) { - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=2048; - new_sib=1; - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib12[eNB_index], &typeandinfo->choice.sib12_v920, sizeof(SystemInformationBlockType12_r9_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB12 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); - } - break; - - case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib13_v920: - if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&4096) == 0) { - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=4096; - new_sib=1; - - memcpy( UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index], &typeandinfo->choice.sib13_v920, sizeof(SystemInformationBlockType13_r9_t) ); - LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB13 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); - dump_sib13( UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index] ); - // adding here function to store necessary parameters for using in decode_MCCH_Message + maybe transfer to PHY layer - LOG_I( RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB13 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", - ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id); - rrc_mac_config_req_ue(ctxt_pP->module_id,0,eNB_index, - (RadioResourceConfigCommonSIB_t *)NULL, - (struct PhysicalConfigDedicated *)NULL, - (SCellToAddMod_r10_t *)NULL, - (MeasObjectToAddMod_t **)NULL, - (MAC_MainConfig_t *)NULL, - 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *)NULL, - (TDD_Config_t *)NULL, - (MobilityControlInfo_t *)NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - (MBSFN_SubframeConfigList_t *)NULL, - 0, - &UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index]->mbsfn_AreaInfoList_r9, - (PMCH_InfoList_r9_t *)NULL -#ifdef CBA - ,0, - 0 -#endif - ); - break; - } -#endif - default: - break; - } + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib12_v920: + if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&2048) == 0) { + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=2048; + new_sib=1; + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib12[eNB_index], &typeandinfo->choice.sib12_v920, sizeof(SystemInformationBlockType12_r9_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB12 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); + } + break; + + case SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib13_v920: + if ((UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus&4096) == 0) { + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus|=4096; + new_sib=1; + memcpy( UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index], &typeandinfo->choice.sib13_v920, sizeof(SystemInformationBlockType13_r9_t) ); + LOG_I( RRC, "[UE %"PRIu8"] Frame %"PRIu32" Found SIB13 from eNB %"PRIu8"\n", ctxt_pP->module_id, ctxt_pP->frame, eNB_index ); + dump_sib13( UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index] ); + // adding here function to store necessary parameters for using in decode_MCCH_Message + maybe transfer to PHY layer + LOG_I( RRC, "[FRAME %05"PRIu32"][RRC_UE][MOD %02"PRIu8"][][--- MAC_CONFIG_REQ (SIB13 params eNB %"PRIu8") --->][MAC_UE][MOD %02"PRIu8"][]\n", + ctxt_pP->frame, ctxt_pP->module_id, eNB_index, ctxt_pP->module_id); + rrc_mac_config_req_ue(ctxt_pP->module_id,0,eNB_index, + (RadioResourceConfigCommonSIB_t *)NULL, + (struct PhysicalConfigDedicated *)NULL, + (SCellToAddMod_r10_t *)NULL, + (MeasObjectToAddMod_t **)NULL, + (MAC_MainConfig_t *)NULL, + 0, + (struct LogicalChannelConfig *)NULL, + (MeasGapConfig_t *)NULL, + (TDD_Config_t *)NULL, + (MobilityControlInfo_t *)NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + (MBSFN_SubframeConfigList_t *)NULL, + 0, + &UE_rrc_inst[ctxt_pP->module_id].sib13[eNB_index]->mbsfn_AreaInfoList_r9, + (PMCH_InfoList_r9_t *)NULL +#ifdef CBA + ,0, + 0 +#endif + ); + break; + } + +#endif + + default: + break; + } } + if (new_sib == 1) { UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIcnt++; if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIcnt == sib1->schedulingInfoList.list.count) rrc_set_sub_state( ctxt_pP->module_id, RRC_SUB_STATE_IDLE_SIB_COMPLETE ); - LOG_I(RRC,"SIStatus %x, SIcnt %d/%d\n", - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus, - UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIcnt, - sib1->schedulingInfoList.list.count); + LOG_I(RRC,"SIStatus %x, SIcnt %d/%d\n", + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIStatus, + UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].SIcnt, + sib1->schedulingInfoList.list.count); } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI , VCD_FUNCTION_OUT); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_UE_DECODE_SI, VCD_FUNCTION_OUT); return 0; } // layer 3 filtering of RSRP (EUTRA) measurements: 36.331, Sec. 5.5.3.2 //----------------------------------------------------------------------------- -void ue_meas_filtering( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index ) +void ue_meas_filtering( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index ) { float a = UE_rrc_inst[ctxt_pP->module_id].filter_coeff_rsrp; // 'a' in 36.331 Sec. 5.5.3.2 float a1 = UE_rrc_inst[ctxt_pP->module_id].filter_coeff_rsrq; @@ -3844,18 +3665,17 @@ void ue_meas_filtering( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_ if(UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[0]->quantityConfigEUTRA->filterCoefficientRSRP != NULL) { for (eNB_offset = 0; eNB_offset<1+get_n_adj_cells(ctxt_pP->module_id,0); eNB_offset++) { UE_rrc_inst[ctxt_pP->module_id].rsrp_db[eNB_offset] = get_RSRP(ctxt_pP->module_id,0,eNB_offset); - /* - (dB_fixed_times10(get_RSRP(ctxt_pP->module_id,0,eNB_offset))/10.0) - - get_rx_total_gain_dB(ctxt_pP->module_id,0) - - get_bw_gain_dB(ctxt_pP->module_id); - */ + /* + (dB_fixed_times10(get_RSRP(ctxt_pP->module_id,0,eNB_offset))/10.0) - + get_rx_total_gain_dB(ctxt_pP->module_id,0) - + get_bw_gain_dB(ctxt_pP->module_id); + */ UE_rrc_inst[ctxt_pP->module_id].rsrp_db_filtered[eNB_offset] = (1.0-a)*UE_rrc_inst[ctxt_pP->module_id].rsrp_db_filtered[eNB_offset] + a*UE_rrc_inst[ctxt_pP->module_id].rsrp_db[eNB_offset]; - LOG_D(RRC,"RSRP_dBm: %3.2f \n",get_RSRP(ctxt_pP->module_id,0,eNB_offset));; - /* LOG_D(RRC,"gain_loss_dB: %d \n",get_rx_total_gain_dB(ctxt_pP->module_id,0)); - LOG_D(RRC,"gain_fixed_dB: %d \n",dB_fixed(frame_parms->N_RB_DL*12));*/ + /* LOG_D(RRC,"gain_loss_dB: %d \n",get_rx_total_gain_dB(ctxt_pP->module_id,0)); + LOG_D(RRC,"gain_fixed_dB: %d \n",dB_fixed(frame_parms->N_RB_DL*12));*/ LOG_D(PHY,"[UE %d] Frame %d, RRC Measurements => rssi %3.1f dBm (digital: %3.1f dB)\n", ctxt_pP->module_id, ctxt_pP->frame, @@ -3893,9 +3713,8 @@ void ue_meas_filtering( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_ //Below routine implements Measurement Reporting procedure from 36.331 Section 5.5.5 //----------------------------------------------------------------------------- -static void rrc_ue_generate_MeasurementReport(protocol_ctxt_t* const ctxt_pP, uint8_t eNB_index ) +static void rrc_ue_generate_MeasurementReport(protocol_ctxt_t *const ctxt_pP, uint8_t eNB_index ) { - uint8_t buffer[32], size; uint8_t i; uint8_t target_eNB_offset; @@ -3907,7 +3726,6 @@ static void rrc_ue_generate_MeasurementReport(protocol_ctxt_t* const ctxt_pP, ui float rsrp_filtered, rsrq_filtered; static frame_t pframe=0; int result; - nElem = 98; nElem1 = 35; target_eNB_offset = UE_rrc_inst[ctxt_pP->module_id].Info[0].handoverTarget; // eNB_offset of target eNB: used to obtain the mod_id of target eNB @@ -3915,14 +3733,11 @@ static void rrc_ue_generate_MeasurementReport(protocol_ctxt_t* const ctxt_pP, ui for (i=0; imodule_id].measReportList[0][i] != NULL) { measId = UE_rrc_inst[ctxt_pP->module_id].measReportList[0][i]->measId; - // Note: Values in the meas report have to be the mapped values...to implement binary search for LUT rsrp_filtered = UE_rrc_inst[ctxt_pP->module_id].rsrp_db_filtered[eNB_index];//nid_cell]; rsrp_s = binary_search_float(RSRP_meas_mapping,nElem, rsrp_filtered); - rsrq_filtered = UE_rrc_inst[ctxt_pP->module_id].rsrq_db_filtered[eNB_index];//nid_cell]; //RSRQ of serving cell rsrq_s = binary_search_float(RSRQ_meas_mapping,nElem1,rsrq_filtered);//mapped RSRQ of serving cell - LOG_D(RRC,"[UE %d] Frame %d: source eNB %d :rsrp_s: %ld rsrq_s: %ld rsrp_filtered: %f rsrq_filtered: %f \n", ctxt_pP->module_id, ctxt_pP->frame, @@ -3933,7 +3748,6 @@ static void rrc_ue_generate_MeasurementReport(protocol_ctxt_t* const ctxt_pP, ui rsrq_filtered); rsrp_t = binary_search_float(RSRP_meas_mapping,nElem,UE_rrc_inst[ctxt_pP->module_id].rsrp_db_filtered[target_eNB_offset]); //RSRP of target cell rsrq_t = binary_search_float(RSRQ_meas_mapping,nElem1,UE_rrc_inst[ctxt_pP->module_id].rsrq_db_filtered[target_eNB_offset]); //RSRQ of target cell - LOG_D(RRC,"[UE %d] Frame %d: target eNB %d :rsrp_t: %ld rsrq_t: %ld rsrp_filtered: %f rsrq_filtered: %f \n", ctxt_pP->module_id, ctxt_pP->frame, @@ -3942,7 +3756,6 @@ static void rrc_ue_generate_MeasurementReport(protocol_ctxt_t* const ctxt_pP, ui rsrq_t, UE_rrc_inst[ctxt_pP->module_id].rsrp_db_filtered[target_eNB_offset], UE_rrc_inst[ctxt_pP->module_id].rsrq_db_filtered[target_eNB_offset]); - // if (measFlag == 1) { cellId = get_adjacent_cell_id(ctxt_pP->module_id, eNB_index); //PhycellId of serving cell targetCellId = UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId ;//get_adjacent_cell_id(ue_mod_idP,target_eNB_offset); //PhycellId of target cell @@ -3974,7 +3787,7 @@ static void rrc_ue_generate_MeasurementReport(protocol_ctxt_t* const ctxt_pP, ui // Measurement report triggering, described in 36.331 Section 5.5.4.1: called periodically //----------------------------------------------------------------------------- -void ue_measurement_report_triggering(protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index ) +void ue_measurement_report_triggering(protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index ) { uint8_t i,j; Hysteresis_t hys; @@ -4016,65 +3829,65 @@ void ue_measurement_report_triggering(protocol_ctxt_t* const ctxt_pP, const uint -1]->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset; switch (UE_rrc_inst[ctxt_pP->module_id].ReportConfig[i][reportConfigId-1]->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present) { - case ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1: - LOG_D(RRC,"[UE %d] Frame %d : A1 event: check if serving becomes better than threshold\n", - ctxt_pP->module_id, ctxt_pP->frame); - break; + case ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1: + LOG_D(RRC,"[UE %d] Frame %d : A1 event: check if serving becomes better than threshold\n", + ctxt_pP->module_id, ctxt_pP->frame); + break; - case ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2: - LOG_D(RRC,"[UE %d] Frame %d : A2 event, check if serving becomes worse than a threshold\n", - ctxt_pP->module_id, ctxt_pP->frame); - break; + case ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2: + LOG_D(RRC,"[UE %d] Frame %d : A2 event, check if serving becomes worse than a threshold\n", + ctxt_pP->module_id, ctxt_pP->frame); + break; - case ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3: - LOG_D(RRC,"[UE %d] Frame %d : A3 event: check if a neighboring cell becomes offset better than serving to trigger a measurement event \n", - ctxt_pP->module_id, ctxt_pP->frame); + case ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3: + LOG_D(RRC,"[UE %d] Frame %d : A3 event: check if a neighboring cell becomes offset better than serving to trigger a measurement event \n", + ctxt_pP->module_id, ctxt_pP->frame); - if ((check_trigger_meas_event( - ctxt_pP->module_id, - ctxt_pP->frame, - eNB_index, - i,j,ofn,ocn,hys,ofs,ocs,a3_offset,ttt_ms)) && - (UE_rrc_inst[ctxt_pP->module_id].Info[0].State >= RRC_CONNECTED) && - (UE_rrc_inst[ctxt_pP->module_id].Info[0].T304_active == 0 ) && - (UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag == 1)) { - //trigger measurement reporting procedure (36.331, section 5.5.5) - if (UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j] == NULL) { - UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j] = malloc(sizeof(MEAS_REPORT_LIST)); + if ((check_trigger_meas_event( + ctxt_pP->module_id, + ctxt_pP->frame, + eNB_index, + i,j,ofn,ocn,hys,ofs,ocs,a3_offset,ttt_ms)) && + (UE_rrc_inst[ctxt_pP->module_id].Info[0].State >= RRC_CONNECTED) && + (UE_rrc_inst[ctxt_pP->module_id].Info[0].T304_active == 0 ) && + (UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag == 1)) { + //trigger measurement reporting procedure (36.331, section 5.5.5) + if (UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j] == NULL) { + UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j] = malloc(sizeof(MEAS_REPORT_LIST)); + } + + UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j]->measId = UE_rrc_inst[ctxt_pP->module_id].MeasId[i][j]->measId; + UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j]->numberOfReportsSent = 0; + rrc_ue_generate_MeasurementReport( + ctxt_pP, + eNB_index); + UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag = 1; + LOG_I(RRC,"[UE %d] Frame %d: A3 event detected, state: %d \n", + ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[0].State); + } else { + if(UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j] != NULL) { + free(UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j]); + } + + UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j] = NULL; } - UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j]->measId = UE_rrc_inst[ctxt_pP->module_id].MeasId[i][j]->measId; - UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j]->numberOfReportsSent = 0; - rrc_ue_generate_MeasurementReport( - ctxt_pP, - eNB_index); - UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag = 1; - LOG_I(RRC,"[UE %d] Frame %d: A3 event detected, state: %d \n", - ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[0].State); - } else { - if(UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j] != NULL) { - free(UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j]); - } + break; - UE_rrc_inst[ctxt_pP->module_id].measReportList[i][j] = NULL; - } + case ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4: + LOG_D(RRC,"[UE %d] Frame %d : received an A4 event, neighbor becomes offset better than a threshold\n", + ctxt_pP->module_id, ctxt_pP->frame); + break; - break; + case ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5: + LOG_D(RRC,"[UE %d] Frame %d: received an A5 event, serving becomes worse than threshold 1 and neighbor becomes better than threshold 2\n", + ctxt_pP->module_id, ctxt_pP->frame); + break; - case ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4: - LOG_D(RRC,"[UE %d] Frame %d : received an A4 event, neighbor becomes offset better than a threshold\n", - ctxt_pP->module_id, ctxt_pP->frame); - break; - - case ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5: - LOG_D(RRC,"[UE %d] Frame %d: received an A5 event, serving becomes worse than threshold 1 and neighbor becomes better than threshold 2\n", - ctxt_pP->module_id, ctxt_pP->frame); - break; - - default: - LOG_D(RRC,"Invalid ReportConfigEUTRA__triggerType__event__eventId: %d", - UE_rrc_inst[ctxt_pP->module_id].ReportConfig[i][j]->reportConfig.choice.reportConfigEUTRA.triggerType.present); - break; + default: + LOG_D(RRC,"Invalid ReportConfigEUTRA__triggerType__event__eventId: %d", + UE_rrc_inst[ctxt_pP->module_id].ReportConfig[i][j]->reportConfig.choice.reportConfigEUTRA.triggerType.present); + break; } } } @@ -4104,7 +3917,6 @@ static uint8_t check_trigger_meas_event( uint8_t eNB_offset; // uint8_t currentCellIndex = frame_parms->Nid_cell; uint8_t tmp_offset; - LOG_I(RRC,"[UE %d] ofn(%ld) ocn(%ld) hys(%ld) ofs(%ld) ocs(%ld) a3_offset(%ld) ttt(%ld) rssi %3.1f\n", ue_mod_idP, ofn,ocn,hys,ofs,ocs,a3_offset,ttt, @@ -4134,8 +3946,8 @@ static uint8_t check_trigger_meas_event( LOG_D(RRC,"[UE %d] Frame %d eNB %d: Handover triggered: targetCellId: %ld currentCellId: %d eNB_offset: %d rsrp source: %3.1f rsrp target: %3.1f\n", ue_mod_idP, frameP, eNB_index, UE_rrc_inst->HandoverInfoUe.targetCellId,ue_cnx_index,eNB_offset, - get_RSRP(ue_mod_idP,0,0), - get_RSRP(ue_mod_idP,0,1)); + get_RSRP(ue_mod_idP,0,0), + get_RSRP(ue_mod_idP,0,1)); UE_rrc_inst->Info[0].handoverTarget = eNB_offset; //LOG_D(RRC,"PHY_ID: %d \n",UE_rrc_inst->HandoverInfoUe.targetCellId); return 1; @@ -4152,12 +3964,10 @@ static uint8_t check_trigger_meas_event( #if defined(Rel10) || defined(Rel14) //----------------------------------------------------------------------------- -int decode_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index, const uint8_t* const Sdu, const uint8_t Sdu_len, const uint8_t mbsfn_sync_area ) +int decode_MCCH_Message( const protocol_ctxt_t *const ctxt_pP, const uint8_t eNB_index, const uint8_t *const Sdu, const uint8_t Sdu_len, const uint8_t mbsfn_sync_area ) { - MCCH_Message_t *mcch=NULL; - MBSFNAreaConfiguration_r9_t** mcch_message=&UE_rrc_inst[ctxt_pP->module_id].mcch_message[eNB_index]; - + MBSFNAreaConfiguration_r9_t **mcch_message=&UE_rrc_inst[ctxt_pP->module_id].mcch_message[eNB_index]; asn_dec_rval_t dec_rval; if (UE_rrc_inst[ctxt_pP->module_id].Info[eNB_index].MCCHStatus[mbsfn_sync_area] == 1) { @@ -4178,12 +3988,12 @@ int decode_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB ctxt_pP->module_id, dec_rval.consumed); //free the memory - SEQUENCE_free(&asn_DEF_MCCH_Message, (void*)mcch, 1); + SEQUENCE_free(&asn_DEF_MCCH_Message, (void *)mcch, 1); return -1; } #ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_MCCH_Message, (void*)mcch); + xer_fprint(stdout, &asn_DEF_MCCH_Message, (void *)mcch); #endif if (mcch->message.present == MCCH_MessageType_PR_c1) { @@ -4205,7 +4015,6 @@ int decode_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB eNB_index, ctxt_pP->frame, mbsfn_sync_area); - } } } @@ -4217,54 +4026,48 @@ int decode_MCCH_Message( const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB static void decode_MBSFNAreaConfiguration( module_id_t ue_mod_idP, uint8_t eNB_index, frame_t frameP, uint8_t mbsfn_sync_area ) { protocol_ctxt_t ctxt; - LOG_I(RRC,"[UE %d] Frame %d : Number of MCH(s) in the MBSFN Sync Area %d is %d\n", ue_mod_idP, frameP, mbsfn_sync_area, UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->pmch_InfoList_r9.list.count); // store to MAC/PHY necessary parameters for receiving MTCHs - rrc_mac_config_req_ue(ue_mod_idP,0,eNB_index, - (RadioResourceConfigCommonSIB_t *)NULL, - (struct PhysicalConfigDedicated *)NULL, + (RadioResourceConfigCommonSIB_t *)NULL, + (struct PhysicalConfigDedicated *)NULL, #if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, #endif - (MeasObjectToAddMod_t **)NULL, - (MAC_MainConfig_t *)NULL, - 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *)NULL, - (TDD_Config_t *)NULL, - (MobilityControlInfo_t *)NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - (MBSFN_SubframeConfigList_t *)NULL + (MeasObjectToAddMod_t **)NULL, + (MAC_MainConfig_t *)NULL, + 0, + (struct LogicalChannelConfig *)NULL, + (MeasGapConfig_t *)NULL, + (TDD_Config_t *)NULL, + (MobilityControlInfo_t *)NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + (MBSFN_SubframeConfigList_t *)NULL #if defined(Rel10) || defined(Rel14) - , - 0, - (MBSFN_AreaInfoList_r9_t *)NULL, - &UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->pmch_InfoList_r9 - + , + 0, + (MBSFN_AreaInfoList_r9_t *)NULL, + &UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->pmch_InfoList_r9 #endif #ifdef CBA - , - 0, - 0 + , + 0, + 0 #endif - ); - + ); UE_rrc_inst[ue_mod_idP].Info[eNB_index].MCCHStatus[mbsfn_sync_area] = 1; - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_idP, ENB_FLAG_NO, UE_rrc_inst[ue_mod_idP].Info[eNB_index].rnti, frameP, 0,eNB_index); - // Config Radio Bearer for MBMS user data (similar way to configure for eNB side in init_MBMS function) rrc_pdcp_config_asn1_req(&ctxt, NULL, // SRB_ToAddModList NULL, // DRB_ToAddModList - (DRB_ToReleaseList_t*)NULL, + (DRB_ToReleaseList_t *)NULL, 0, // security mode NULL, // key rrc encryption NULL, // key rrc integrity @@ -4273,7 +4076,6 @@ static void decode_MBSFNAreaConfiguration( module_id_t ue_mod_idP, uint8_t eNB_i ,&(UE_rrc_inst[ue_mod_idP].mcch_message[eNB_index]->pmch_InfoList_r9) #endif ,NULL); - rrc_rlc_config_asn1_req(&ctxt, NULL,// SRB_ToAddModList NULL,// DRB_ToAddModList @@ -4283,7 +4085,6 @@ static void decode_MBSFNAreaConfiguration( module_id_t ue_mod_idP, uint8_t eNB_i #endif ); // */ - } #endif // rel10 @@ -4298,467 +4099,424 @@ void *rrc_ue_task( void *args_p ) unsigned int ue_mod_id; int result; SRB_INFO *srb_info_p; - protocol_ctxt_t ctxt; itti_mark_task_ready (TASK_RRC_UE); while(1) { // Wait for a message itti_receive_msg (TASK_RRC_UE, &msg_p); - msg_name = ITTI_MSG_NAME (msg_p); instance = ITTI_MSG_INSTANCE (msg_p); ue_mod_id = UE_INSTANCE_TO_MODULE_ID(instance); switch (ITTI_MSG_ID(msg_p)) { - case TERMINATE_MESSAGE: - LOG_W(RRC, " *** Exiting RRC thread\n"); - itti_exit_task (); - break; + case TERMINATE_MESSAGE: + LOG_W(RRC, " *** Exiting RRC thread\n"); + itti_exit_task (); + break; - case MESSAGE_TEST: - LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, msg_name); - break; + case MESSAGE_TEST: + LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, msg_name); + break; /* MAC messages */ - case RRC_MAC_IN_SYNC_IND: - LOG_D(RRC, "[UE %d] Received %s: frameP %d, eNB %d\n", ue_mod_id, msg_name, - RRC_MAC_IN_SYNC_IND (msg_p).frame, RRC_MAC_IN_SYNC_IND (msg_p).enb_index); + case RRC_MAC_IN_SYNC_IND: + LOG_D(RRC, "[UE %d] Received %s: frameP %d, eNB %d\n", ue_mod_id, msg_name, + RRC_MAC_IN_SYNC_IND (msg_p).frame, RRC_MAC_IN_SYNC_IND (msg_p).enb_index); + UE_rrc_inst[ue_mod_id].Info[RRC_MAC_IN_SYNC_IND (msg_p).enb_index].N310_cnt = 0; - UE_rrc_inst[ue_mod_id].Info[RRC_MAC_IN_SYNC_IND (msg_p).enb_index].N310_cnt = 0; + if (UE_rrc_inst[ue_mod_id].Info[RRC_MAC_IN_SYNC_IND (msg_p).enb_index].T310_active == 1) { + UE_rrc_inst[ue_mod_id].Info[RRC_MAC_IN_SYNC_IND (msg_p).enb_index].N311_cnt++; + } - if (UE_rrc_inst[ue_mod_id].Info[RRC_MAC_IN_SYNC_IND (msg_p).enb_index].T310_active == 1) { - UE_rrc_inst[ue_mod_id].Info[RRC_MAC_IN_SYNC_IND (msg_p).enb_index].N311_cnt++; - } + break; - break; + case RRC_MAC_OUT_OF_SYNC_IND: + LOG_D(RRC, "[UE %d] Received %s: frameP %d, eNB %d\n", ue_mod_id, msg_name, + RRC_MAC_OUT_OF_SYNC_IND (msg_p).frame, RRC_MAC_OUT_OF_SYNC_IND (msg_p).enb_index); + UE_rrc_inst[ue_mod_id].Info[RRC_MAC_OUT_OF_SYNC_IND (msg_p).enb_index].N310_cnt ++; + break; - case RRC_MAC_OUT_OF_SYNC_IND: - LOG_D(RRC, "[UE %d] Received %s: frameP %d, eNB %d\n", ue_mod_id, msg_name, - RRC_MAC_OUT_OF_SYNC_IND (msg_p).frame, RRC_MAC_OUT_OF_SYNC_IND (msg_p).enb_index); + case RRC_MAC_BCCH_DATA_IND: + LOG_D(RRC, "[UE %d] Received %s: frameP %d, eNB %d\n", ue_mod_id, msg_name, + RRC_MAC_BCCH_DATA_IND (msg_p).frame, RRC_MAC_BCCH_DATA_IND (msg_p).enb_index); + // PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, NOT_A_RNTI, RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0); + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, NOT_A_RNTI, RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0,RRC_MAC_BCCH_DATA_IND (msg_p).enb_index); + decode_BCCH_DLSCH_Message (&ctxt, + RRC_MAC_BCCH_DATA_IND (msg_p).enb_index, + RRC_MAC_BCCH_DATA_IND (msg_p).sdu, + RRC_MAC_BCCH_DATA_IND (msg_p).sdu_size, + RRC_MAC_BCCH_DATA_IND (msg_p).rsrq, + RRC_MAC_BCCH_DATA_IND (msg_p).rsrp); + break; - UE_rrc_inst[ue_mod_id].Info[RRC_MAC_OUT_OF_SYNC_IND (msg_p).enb_index].N310_cnt ++; - break; - - case RRC_MAC_BCCH_DATA_IND: - LOG_D(RRC, "[UE %d] Received %s: frameP %d, eNB %d\n", ue_mod_id, msg_name, - RRC_MAC_BCCH_DATA_IND (msg_p).frame, RRC_MAC_BCCH_DATA_IND (msg_p).enb_index); - - // PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, NOT_A_RNTI, RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0); - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, NOT_A_RNTI, RRC_MAC_BCCH_DATA_IND (msg_p).frame, 0,RRC_MAC_BCCH_DATA_IND (msg_p).enb_index); - decode_BCCH_DLSCH_Message (&ctxt, - RRC_MAC_BCCH_DATA_IND (msg_p).enb_index, - RRC_MAC_BCCH_DATA_IND (msg_p).sdu, - RRC_MAC_BCCH_DATA_IND (msg_p).sdu_size, - RRC_MAC_BCCH_DATA_IND (msg_p).rsrq, - RRC_MAC_BCCH_DATA_IND (msg_p).rsrp); - break; - - case RRC_MAC_CCCH_DATA_CNF: - LOG_D(RRC, "[UE %d] Received %s: eNB %d\n", ue_mod_id, msg_name, - RRC_MAC_CCCH_DATA_CNF (msg_p).enb_index); - - // reset the tx buffer to indicate RRC that ccch was successfully transmitted (for example if contention resolution succeeds) - UE_rrc_inst[ue_mod_id].Srb0[RRC_MAC_CCCH_DATA_CNF (msg_p).enb_index].Tx_buffer.payload_size = 0; - break; - - case RRC_MAC_CCCH_DATA_IND: - LOG_D(RRC, "[UE %d] RNTI %x Received %s: frameP %d, eNB %d\n", - ue_mod_id, - RRC_MAC_CCCH_DATA_IND (msg_p).rnti, - msg_name, - RRC_MAC_CCCH_DATA_IND (msg_p).frame, - RRC_MAC_CCCH_DATA_IND (msg_p).enb_index); - - srb_info_p = &UE_rrc_inst[ue_mod_id].Srb0[RRC_MAC_CCCH_DATA_IND (msg_p).enb_index]; - - memcpy (srb_info_p->Rx_buffer.Payload, RRC_MAC_CCCH_DATA_IND (msg_p).sdu, - RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size); - srb_info_p->Rx_buffer.payload_size = RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size; - // PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, RRC_MAC_CCCH_DATA_IND (msg_p).rnti, RRC_MAC_CCCH_DATA_IND (msg_p).frame, 0); - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, RRC_MAC_CCCH_DATA_IND (msg_p).rnti, RRC_MAC_CCCH_DATA_IND (msg_p).frame, 0, RRC_MAC_CCCH_DATA_IND (msg_p).enb_index); - rrc_ue_decode_ccch (&ctxt, - srb_info_p, - RRC_MAC_CCCH_DATA_IND (msg_p).enb_index); - break; + case RRC_MAC_CCCH_DATA_CNF: + LOG_D(RRC, "[UE %d] Received %s: eNB %d\n", ue_mod_id, msg_name, + RRC_MAC_CCCH_DATA_CNF (msg_p).enb_index); + // reset the tx buffer to indicate RRC that ccch was successfully transmitted (for example if contention resolution succeeds) + UE_rrc_inst[ue_mod_id].Srb0[RRC_MAC_CCCH_DATA_CNF (msg_p).enb_index].Tx_buffer.payload_size = 0; + break; + case RRC_MAC_CCCH_DATA_IND: + LOG_D(RRC, "[UE %d] RNTI %x Received %s: frameP %d, eNB %d\n", + ue_mod_id, + RRC_MAC_CCCH_DATA_IND (msg_p).rnti, + msg_name, + RRC_MAC_CCCH_DATA_IND (msg_p).frame, + RRC_MAC_CCCH_DATA_IND (msg_p).enb_index); + srb_info_p = &UE_rrc_inst[ue_mod_id].Srb0[RRC_MAC_CCCH_DATA_IND (msg_p).enb_index]; + memcpy (srb_info_p->Rx_buffer.Payload, RRC_MAC_CCCH_DATA_IND (msg_p).sdu, + RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size); + srb_info_p->Rx_buffer.payload_size = RRC_MAC_CCCH_DATA_IND (msg_p).sdu_size; + // PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, RRC_MAC_CCCH_DATA_IND (msg_p).rnti, RRC_MAC_CCCH_DATA_IND (msg_p).frame, 0); + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, RRC_MAC_CCCH_DATA_IND (msg_p).rnti, RRC_MAC_CCCH_DATA_IND (msg_p).frame, 0, RRC_MAC_CCCH_DATA_IND (msg_p).enb_index); + rrc_ue_decode_ccch (&ctxt, + srb_info_p, + RRC_MAC_CCCH_DATA_IND (msg_p).enb_index); + break; # if defined(Rel10) || defined(Rel14) - case RRC_MAC_MCCH_DATA_IND: - LOG_D(RRC, "[UE %d] Received %s: frameP %d, eNB %d, mbsfn SA %d\n", ue_mod_id, msg_name, - RRC_MAC_MCCH_DATA_IND (msg_p).frame, RRC_MAC_MCCH_DATA_IND (msg_p).enb_index, RRC_MAC_MCCH_DATA_IND (msg_p).mbsfn_sync_area); - - //PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, M_RNTI, RRC_MAC_MCCH_DATA_IND (msg_p).frame, 0); - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, M_RNTI, RRC_MAC_MCCH_DATA_IND (msg_p).frame, 0,RRC_MAC_MCCH_DATA_IND (msg_p).enb_index); - decode_MCCH_Message ( - &ctxt, - RRC_MAC_MCCH_DATA_IND (msg_p).enb_index, - RRC_MAC_MCCH_DATA_IND (msg_p).sdu, - RRC_MAC_MCCH_DATA_IND (msg_p).sdu_size, - RRC_MAC_MCCH_DATA_IND (msg_p).mbsfn_sync_area); - break; + case RRC_MAC_MCCH_DATA_IND: + LOG_D(RRC, "[UE %d] Received %s: frameP %d, eNB %d, mbsfn SA %d\n", ue_mod_id, msg_name, + RRC_MAC_MCCH_DATA_IND (msg_p).frame, RRC_MAC_MCCH_DATA_IND (msg_p).enb_index, RRC_MAC_MCCH_DATA_IND (msg_p).mbsfn_sync_area); + //PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, M_RNTI, RRC_MAC_MCCH_DATA_IND (msg_p).frame, 0); + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, M_RNTI, RRC_MAC_MCCH_DATA_IND (msg_p).frame, 0,RRC_MAC_MCCH_DATA_IND (msg_p).enb_index); + decode_MCCH_Message ( + &ctxt, + RRC_MAC_MCCH_DATA_IND (msg_p).enb_index, + RRC_MAC_MCCH_DATA_IND (msg_p).sdu, + RRC_MAC_MCCH_DATA_IND (msg_p).sdu_size, + RRC_MAC_MCCH_DATA_IND (msg_p).mbsfn_sync_area); + break; # endif /* PDCP messages */ - case RRC_DCCH_DATA_IND: - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, RRC_DCCH_DATA_IND (msg_p).module_id, ENB_FLAG_NO, RRC_DCCH_DATA_IND (msg_p).rnti, RRC_DCCH_DATA_IND (msg_p).frame, 0,RRC_DCCH_DATA_IND (msg_p).eNB_index); - LOG_D(RRC, "[UE %d] Received %s: frameP %d, DCCH %d, eNB %d\n", - RRC_DCCH_DATA_IND (msg_p).module_id, - msg_name, - RRC_DCCH_DATA_IND (msg_p).frame, - RRC_DCCH_DATA_IND (msg_p).dcch_index, - RRC_DCCH_DATA_IND (msg_p).eNB_index); - - LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT"Received %s DCCH %d, eNB %d\n", - PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt), - msg_name, - RRC_DCCH_DATA_IND (msg_p).dcch_index, - RRC_DCCH_DATA_IND (msg_p).eNB_index); - rrc_ue_decode_dcch ( - &ctxt, - RRC_DCCH_DATA_IND (msg_p).dcch_index, - RRC_DCCH_DATA_IND (msg_p).sdu_p, - RRC_DCCH_DATA_IND (msg_p).eNB_index); - // Message buffer has been processed, free it now. - result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), RRC_DCCH_DATA_IND (msg_p).sdu_p); - AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - break; - + case RRC_DCCH_DATA_IND: + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, RRC_DCCH_DATA_IND (msg_p).module_id, ENB_FLAG_NO, RRC_DCCH_DATA_IND (msg_p).rnti, RRC_DCCH_DATA_IND (msg_p).frame, 0,RRC_DCCH_DATA_IND (msg_p).eNB_index); + LOG_D(RRC, "[UE %d] Received %s: frameP %d, DCCH %d, eNB %d\n", + RRC_DCCH_DATA_IND (msg_p).module_id, + msg_name, + RRC_DCCH_DATA_IND (msg_p).frame, + RRC_DCCH_DATA_IND (msg_p).dcch_index, + RRC_DCCH_DATA_IND (msg_p).eNB_index); + LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT"Received %s DCCH %d, eNB %d\n", + PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt), + msg_name, + RRC_DCCH_DATA_IND (msg_p).dcch_index, + RRC_DCCH_DATA_IND (msg_p).eNB_index); + rrc_ue_decode_dcch ( + &ctxt, + RRC_DCCH_DATA_IND (msg_p).dcch_index, + RRC_DCCH_DATA_IND (msg_p).sdu_p, + RRC_DCCH_DATA_IND (msg_p).eNB_index); + // Message buffer has been processed, free it now. + result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), RRC_DCCH_DATA_IND (msg_p).sdu_p); + AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); + break; # if defined(ENABLE_USE_MME) - case NAS_KENB_REFRESH_REQ: - memcpy((void*)UE_rrc_inst[ue_mod_id].kenb, (void*)NAS_KENB_REFRESH_REQ(msg_p).kenb, sizeof(UE_rrc_inst[ue_mod_id].kenb)); - + case NAS_KENB_REFRESH_REQ: + memcpy((void *)UE_rrc_inst[ue_mod_id].kenb, (void *)NAS_KENB_REFRESH_REQ(msg_p).kenb, sizeof(UE_rrc_inst[ue_mod_id].kenb)); LOG_D(RRC, "[UE %d] Received %s: refreshed RRC::KeNB = " - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x" - "%02x%02x%02x%02x\n", - ue_mod_id, msg_name, - UE_rrc_inst[ue_mod_id].kenb[0], UE_rrc_inst[ue_mod_id].kenb[1], UE_rrc_inst[ue_mod_id].kenb[2], UE_rrc_inst[ue_mod_id].kenb[3], - UE_rrc_inst[ue_mod_id].kenb[4], UE_rrc_inst[ue_mod_id].kenb[5], UE_rrc_inst[ue_mod_id].kenb[6], UE_rrc_inst[ue_mod_id].kenb[7], - UE_rrc_inst[ue_mod_id].kenb[8], UE_rrc_inst[ue_mod_id].kenb[9], UE_rrc_inst[ue_mod_id].kenb[10], UE_rrc_inst[ue_mod_id].kenb[11], - UE_rrc_inst[ue_mod_id].kenb[12], UE_rrc_inst[ue_mod_id].kenb[13], UE_rrc_inst[ue_mod_id].kenb[14], UE_rrc_inst[ue_mod_id].kenb[15], - UE_rrc_inst[ue_mod_id].kenb[16], UE_rrc_inst[ue_mod_id].kenb[17], UE_rrc_inst[ue_mod_id].kenb[18], UE_rrc_inst[ue_mod_id].kenb[19], - UE_rrc_inst[ue_mod_id].kenb[20], UE_rrc_inst[ue_mod_id].kenb[21], UE_rrc_inst[ue_mod_id].kenb[22], UE_rrc_inst[ue_mod_id].kenb[23], - UE_rrc_inst[ue_mod_id].kenb[24], UE_rrc_inst[ue_mod_id].kenb[25], UE_rrc_inst[ue_mod_id].kenb[26], UE_rrc_inst[ue_mod_id].kenb[27], - UE_rrc_inst[ue_mod_id].kenb[28], UE_rrc_inst[ue_mod_id].kenb[29], UE_rrc_inst[ue_mod_id].kenb[30], UE_rrc_inst[ue_mod_id].kenb[31]); - - break; + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x" + "%02x%02x%02x%02x\n", + ue_mod_id, msg_name, + UE_rrc_inst[ue_mod_id].kenb[0], UE_rrc_inst[ue_mod_id].kenb[1], UE_rrc_inst[ue_mod_id].kenb[2], UE_rrc_inst[ue_mod_id].kenb[3], + UE_rrc_inst[ue_mod_id].kenb[4], UE_rrc_inst[ue_mod_id].kenb[5], UE_rrc_inst[ue_mod_id].kenb[6], UE_rrc_inst[ue_mod_id].kenb[7], + UE_rrc_inst[ue_mod_id].kenb[8], UE_rrc_inst[ue_mod_id].kenb[9], UE_rrc_inst[ue_mod_id].kenb[10], UE_rrc_inst[ue_mod_id].kenb[11], + UE_rrc_inst[ue_mod_id].kenb[12], UE_rrc_inst[ue_mod_id].kenb[13], UE_rrc_inst[ue_mod_id].kenb[14], UE_rrc_inst[ue_mod_id].kenb[15], + UE_rrc_inst[ue_mod_id].kenb[16], UE_rrc_inst[ue_mod_id].kenb[17], UE_rrc_inst[ue_mod_id].kenb[18], UE_rrc_inst[ue_mod_id].kenb[19], + UE_rrc_inst[ue_mod_id].kenb[20], UE_rrc_inst[ue_mod_id].kenb[21], UE_rrc_inst[ue_mod_id].kenb[22], UE_rrc_inst[ue_mod_id].kenb[23], + UE_rrc_inst[ue_mod_id].kenb[24], UE_rrc_inst[ue_mod_id].kenb[25], UE_rrc_inst[ue_mod_id].kenb[26], UE_rrc_inst[ue_mod_id].kenb[27], + UE_rrc_inst[ue_mod_id].kenb[28], UE_rrc_inst[ue_mod_id].kenb[29], UE_rrc_inst[ue_mod_id].kenb[30], UE_rrc_inst[ue_mod_id].kenb[31]); + break; /* NAS messages */ - case NAS_CELL_SELECTION_REQ: + case NAS_CELL_SELECTION_REQ: + LOG_D(RRC, "[UE %d] Received %s: state %d, plmnID (%d%d%d.%d%d%d), rat %x\n", ue_mod_id, msg_name, rrc_get_state(ue_mod_id), + NAS_CELL_SELECTION_REQ (msg_p).plmnID.MCCdigit1, + NAS_CELL_SELECTION_REQ (msg_p).plmnID.MCCdigit2, + NAS_CELL_SELECTION_REQ (msg_p).plmnID.MCCdigit3, + NAS_CELL_SELECTION_REQ (msg_p).plmnID.MNCdigit1, + NAS_CELL_SELECTION_REQ (msg_p).plmnID.MNCdigit2, + NAS_CELL_SELECTION_REQ (msg_p).plmnID.MNCdigit3, + NAS_CELL_SELECTION_REQ (msg_p).rat); - LOG_D(RRC, "[UE %d] Received %s: state %d, plmnID (%d%d%d.%d%d%d), rat %x\n", ue_mod_id, msg_name, rrc_get_state(ue_mod_id), - NAS_CELL_SELECTION_REQ (msg_p).plmnID.MCCdigit1, - NAS_CELL_SELECTION_REQ (msg_p).plmnID.MCCdigit2, - NAS_CELL_SELECTION_REQ (msg_p).plmnID.MCCdigit3, - NAS_CELL_SELECTION_REQ (msg_p).plmnID.MNCdigit1, - NAS_CELL_SELECTION_REQ (msg_p).plmnID.MNCdigit2, - NAS_CELL_SELECTION_REQ (msg_p).plmnID.MNCdigit3, - NAS_CELL_SELECTION_REQ (msg_p).rat); - - if (rrc_get_state(ue_mod_id) == RRC_STATE_INACTIVE) { - // have a look at MAC/main.c void dl_phy_sync_success(...) - openair_rrc_ue_init(ue_mod_id,0); - } - - /* Save cell selection criterion */ - { - UE_rrc_inst[ue_mod_id].plmnID = NAS_CELL_SELECTION_REQ (msg_p).plmnID; - UE_rrc_inst[ue_mod_id].rat = NAS_CELL_SELECTION_REQ (msg_p).rat; - LOG_D(RRC, "[UE %d] Save cell selection criterion MCC %X%X%X MNC %X%X%X\n", - ue_mod_id, - UE_rrc_inst[ue_mod_id].plmnID.MCCdigit1, - UE_rrc_inst[ue_mod_id].plmnID.MCCdigit2, - UE_rrc_inst[ue_mod_id].plmnID.MCCdigit3, - UE_rrc_inst[ue_mod_id].plmnID.MNCdigit1, - UE_rrc_inst[ue_mod_id].plmnID.MNCdigit2, - UE_rrc_inst[ue_mod_id].plmnID.MNCdigit3); - - } - - switch (rrc_get_state(ue_mod_id)) { - case RRC_STATE_INACTIVE: { - /* Need to first activate lower layers */ - MessageDef *message_p; - - message_p = itti_alloc_new_message(TASK_RRC_UE, ACTIVATE_MESSAGE); - - itti_send_msg_to_task(TASK_L2L1, UE_MODULE_ID_TO_INSTANCE(ue_mod_id), message_p); - - rrc_set_state (ue_mod_id, RRC_STATE_IDLE); - /* Fall through to next case */ - } - - case RRC_STATE_IDLE: { - /* Ask to layer 1 to find a cell matching the criterion */ - MessageDef *message_p; - - message_p = itti_alloc_new_message(TASK_RRC_UE, PHY_FIND_CELL_REQ); - - PHY_FIND_CELL_REQ (message_p).earfcn_start = 1; - PHY_FIND_CELL_REQ (message_p).earfcn_end = 1; - - itti_send_msg_to_task(TASK_PHY_UE, UE_MODULE_ID_TO_INSTANCE(ue_mod_id), message_p); - rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE_SEARCHING); - - break; - } - - case RRC_STATE_CONNECTED: - /* should not happen */ - LOG_E(RRC, "[UE %d] request %s in RRC state %d\n", ue_mod_id, msg_name, rrc_get_state(ue_mod_id)); - break; - - default: - LOG_C(RRC, "[UE %d] Invalid RRC state %d\n", ue_mod_id, rrc_get_state(ue_mod_id)); - break; - } - - break; - - case NAS_CONN_ESTABLI_REQ: - LOG_D(RRC, "[UE %d] Received %s: cause %d, type %d, s_tmsi (mme code %"PRIu8", m-tmsi %"PRIu32"), plmnID (%d%d%d.%d%d%d)\n", ue_mod_id, msg_name, NAS_CONN_ESTABLI_REQ (msg_p).cause, - NAS_CONN_ESTABLI_REQ (msg_p).type, - NAS_CONN_ESTABLI_REQ (msg_p).s_tmsi.MMEcode, - NAS_CONN_ESTABLI_REQ (msg_p).s_tmsi.m_tmsi, - NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MCCdigit1, - NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MCCdigit2, - NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MCCdigit3, - NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MNCdigit1, - NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MNCdigit2, - NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MNCdigit3); - - //PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, NOT_A_RNTI, 0, 0); - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, NOT_A_RNTI, 0, 0, 0); - - UE_rrc_inst[ue_mod_id].initialNasMsg = NAS_CONN_ESTABLI_REQ (msg_p).initialNasMsg; - - switch (rrc_get_state(ue_mod_id)) { - case RRC_STATE_IDLE: { - if (rrc_get_sub_state(ue_mod_id) == RRC_SUB_STATE_IDLE_SIB_COMPLETE) { - rrc_ue_generate_RRCConnectionRequest(&ctxt, 0); - LOG_D(RRC, "not sending connection request\n"); - - rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE_CONNECTING); + if (rrc_get_state(ue_mod_id) == RRC_STATE_INACTIVE) { + // have a look at MAC/main.c void dl_phy_sync_success(...) + openair_rrc_ue_init(ue_mod_id,0); } - break; - } - - case RRC_STATE_INACTIVE: - case RRC_STATE_CONNECTED: - /* should not happen */ - LOG_E(RRC, "[UE %d] request %s in RRC state %d\n", ue_mod_id, msg_name, rrc_get_state(ue_mod_id)); - break; - - default: - LOG_C(RRC, "[UE %d] Invalid RRC state %d\n", ue_mod_id, rrc_get_state(ue_mod_id)); - break; - } - - break; - - case NAS_UPLINK_DATA_REQ: { - uint32_t length; - uint8_t *buffer; - - LOG_D(RRC, "[UE %d] Received %s: UEid %d\n", ue_mod_id, msg_name, NAS_UPLINK_DATA_REQ (msg_p).UEid); - - /* Create message for PDCP (ULInformationTransfer_t) */ - length = do_ULInformationTransfer(&buffer, NAS_UPLINK_DATA_REQ (msg_p).nasMsg.length, NAS_UPLINK_DATA_REQ (msg_p).nasMsg.data); - - /* Transfer data to PDCP */ - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, UE_rrc_inst[ue_mod_id].Info[0].rnti, 0, 0,0); - - // check if SRB2 is created, if yes request data_req on DCCH1 (SRB2) - if(UE_rrc_inst[ue_mod_id].SRB2_config[0] == NULL) - { - rrc_data_req_ue (&ctxt, - DCCH, - rrc_mui++, - SDU_CONFIRM_NO, - length, buffer, - PDCP_TRANSMISSION_MODE_CONTROL); - } - else - { - rrc_data_req_ue (&ctxt, - DCCH1, - rrc_mui++, - SDU_CONFIRM_NO, - length, buffer, - PDCP_TRANSMISSION_MODE_CONTROL); - } - break; - } - -# endif - -# if ENABLE_RAL - - case RRC_RAL_SCAN_REQ: - LOG_D(RRC, "[UE %d] Received %s: state %d\n", ue_mod_id, msg_name); - - switch (rrc_get_state(ue_mod_id)) { - case RRC_STATE_INACTIVE: { - /* Need to first activate lower layers */ - MessageDef *message_p; - - message_p = itti_alloc_new_message(TASK_RRC_UE, ACTIVATE_MESSAGE); - - itti_send_msg_to_task(TASK_L2L1, instance, message_p); - - rrc_set_state (ue_mod_id, RRC_STATE_IDLE); - /* Fall through to next case */ - } - - case RRC_STATE_IDLE: { - if (rrc_get_sub_state(ue_mod_id) != RRC_SUB_STATE_IDLE_SEARCHING) { - /* Ask to layer 1 to find a cell matching the criterion */ - MessageDef *message_p; - - message_p = itti_alloc_new_message(TASK_RRC_UE, PHY_FIND_CELL_REQ); - - rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE_SEARCHING); - - PHY_FIND_CELL_REQ (message_p).transaction_id = RRC_RAL_SCAN_REQ (msg_p).transaction_id; - PHY_FIND_CELL_REQ (message_p).earfcn_start = 1; - PHY_FIND_CELL_REQ (message_p).earfcn_end = 1; //44 - - itti_send_msg_to_task(TASK_PHY_UE, instance, message_p); + /* Save cell selection criterion */ + { + UE_rrc_inst[ue_mod_id].plmnID = NAS_CELL_SELECTION_REQ (msg_p).plmnID; + UE_rrc_inst[ue_mod_id].rat = NAS_CELL_SELECTION_REQ (msg_p).rat; + LOG_D(RRC, "[UE %d] Save cell selection criterion MCC %X%X%X MNC %X%X%X\n", + ue_mod_id, + UE_rrc_inst[ue_mod_id].plmnID.MCCdigit1, + UE_rrc_inst[ue_mod_id].plmnID.MCCdigit2, + UE_rrc_inst[ue_mod_id].plmnID.MCCdigit3, + UE_rrc_inst[ue_mod_id].plmnID.MNCdigit1, + UE_rrc_inst[ue_mod_id].plmnID.MNCdigit2, + UE_rrc_inst[ue_mod_id].plmnID.MNCdigit3); } - break; - } - - case RRC_STATE_CONNECTED: - /* should not happen */ - LOG_E(RRC, "[UE %d] request %s in RRC state %d\n", ue_mod_id, msg_name, rrc_get_state(ue_mod_id)); - break; - - default: - LOG_C(RRC, "[UE %d] Invalid RRC state %d\n", ue_mod_id, rrc_get_state(ue_mod_id)); - break; - } - - break; - - case PHY_FIND_CELL_IND: - LOG_D(RRC, "[UE %d] Received %s: state %d\n", ue_mod_id, msg_name, rrc_get_state(ue_mod_id)); - - switch (rrc_get_state(ue_mod_id)) { - case RRC_STATE_IDLE: - switch (rrc_get_sub_state(ue_mod_id)) { - case RRC_SUB_STATE_IDLE_SEARCHING: { - MessageDef *message_p; - int i; - - message_p = itti_alloc_new_message(TASK_RRC_UE, RRC_RAL_SCAN_CONF); - - RRC_RAL_SCAN_CONF (message_p).transaction_id = PHY_FIND_CELL_IND(msg_p).transaction_id; - RRC_RAL_SCAN_CONF (message_p).num_scan_resp = PHY_FIND_CELL_IND(msg_p).cell_nb; - - for (i = 0 ; i < PHY_FIND_CELL_IND(msg_p).cell_nb; i++) { - // TO DO - memset(&RRC_RAL_SCAN_CONF (message_p).link_scan_resp[i].link_addr, 0, sizeof(ral_link_addr_t)); - // TO DO - memset(&RRC_RAL_SCAN_CONF (message_p).link_scan_resp[i].network_id, 0, sizeof(ral_network_id_t)); - - RRC_RAL_SCAN_CONF (message_p).link_scan_resp[i].sig_strength.choice = RAL_SIG_STRENGTH_CHOICE_DBM; - RRC_RAL_SCAN_CONF (message_p).link_scan_resp[i].sig_strength._union.dbm = PHY_FIND_CELL_IND(msg_p).cells[i].rsrp; + switch (rrc_get_state(ue_mod_id)) { + case RRC_STATE_INACTIVE: { + /* Need to first activate lower layers */ + MessageDef *message_p; + message_p = itti_alloc_new_message(TASK_RRC_UE, ACTIVATE_MESSAGE); + itti_send_msg_to_task(TASK_L2L1, UE_MODULE_ID_TO_INSTANCE(ue_mod_id), message_p); + rrc_set_state (ue_mod_id, RRC_STATE_IDLE); + /* Fall through to next case */ } - rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE); + case RRC_STATE_IDLE: { + /* Ask to layer 1 to find a cell matching the criterion */ + MessageDef *message_p; + message_p = itti_alloc_new_message(TASK_RRC_UE, PHY_FIND_CELL_REQ); + PHY_FIND_CELL_REQ (message_p).earfcn_start = 1; + PHY_FIND_CELL_REQ (message_p).earfcn_end = 1; + itti_send_msg_to_task(TASK_PHY_UE, UE_MODULE_ID_TO_INSTANCE(ue_mod_id), message_p); + rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE_SEARCHING); + break; + } - itti_send_msg_to_task(TASK_RAL_UE, instance, message_p); - break; - } + case RRC_STATE_CONNECTED: + /* should not happen */ + LOG_E(RRC, "[UE %d] request %s in RRC state %d\n", ue_mod_id, msg_name, rrc_get_state(ue_mod_id)); + break; - default: - LOG_C(RRC, "[UE %d] Invalid RRC state %d substate %d\n", - ue_mod_id, - rrc_get_state(ue_mod_id), - rrc_get_sub_state(ue_mod_id)); + default: + LOG_C(RRC, "[UE %d] Invalid RRC state %d\n", ue_mod_id, rrc_get_state(ue_mod_id)); + break; } break; - case RRC_STATE_INACTIVE: - case RRC_STATE_CONNECTED: - /* should not happen */ - LOG_E(RRC, "[UE %d] indication %s in RRC state %d\n", ue_mod_id, msg_name, rrc_get_state(ue_mod_id)); + case NAS_CONN_ESTABLI_REQ: + LOG_D(RRC, "[UE %d] Received %s: cause %d, type %d, s_tmsi (mme code %"PRIu8", m-tmsi %"PRIu32"), plmnID (%d%d%d.%d%d%d)\n", ue_mod_id, msg_name, NAS_CONN_ESTABLI_REQ (msg_p).cause, + NAS_CONN_ESTABLI_REQ (msg_p).type, + NAS_CONN_ESTABLI_REQ (msg_p).s_tmsi.MMEcode, + NAS_CONN_ESTABLI_REQ (msg_p).s_tmsi.m_tmsi, + NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MCCdigit1, + NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MCCdigit2, + NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MCCdigit3, + NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MNCdigit1, + NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MNCdigit2, + NAS_CONN_ESTABLI_REQ (msg_p).plmnID.MNCdigit3); + //PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_NO, NOT_A_RNTI, 0, 0); + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, NOT_A_RNTI, 0, 0, 0); + UE_rrc_inst[ue_mod_id].initialNasMsg = NAS_CONN_ESTABLI_REQ (msg_p).initialNasMsg; + + switch (rrc_get_state(ue_mod_id)) { + case RRC_STATE_IDLE: { + if (rrc_get_sub_state(ue_mod_id) == RRC_SUB_STATE_IDLE_SIB_COMPLETE) { + rrc_ue_generate_RRCConnectionRequest(&ctxt, 0); + LOG_D(RRC, "not sending connection request\n"); + rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE_CONNECTING); + } + + break; + } + + case RRC_STATE_INACTIVE: + case RRC_STATE_CONNECTED: + /* should not happen */ + LOG_E(RRC, "[UE %d] request %s in RRC state %d\n", ue_mod_id, msg_name, rrc_get_state(ue_mod_id)); + break; + + default: + LOG_C(RRC, "[UE %d] Invalid RRC state %d\n", ue_mod_id, rrc_get_state(ue_mod_id)); + break; + } + break; - default: - LOG_C(RRC, "[UE %d] Invalid RRC state %d\n", ue_mod_id, rrc_get_state(ue_mod_id)); - break; - } + case NAS_UPLINK_DATA_REQ: { + uint32_t length; + uint8_t *buffer; + LOG_D(RRC, "[UE %d] Received %s: UEid %d\n", ue_mod_id, msg_name, NAS_UPLINK_DATA_REQ (msg_p).UEid); + /* Create message for PDCP (ULInformationTransfer_t) */ + length = do_ULInformationTransfer(&buffer, NAS_UPLINK_DATA_REQ (msg_p).nasMsg.length, NAS_UPLINK_DATA_REQ (msg_p).nasMsg.data); + /* Transfer data to PDCP */ + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, UE_rrc_inst[ue_mod_id].Info[0].rnti, 0, 0,0); - break; // PHY_FIND_CELL_IND - - case PHY_MEAS_REPORT_IND: { - MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_RRC_UE, RRC_RAL_MEASUREMENT_REPORT_IND); - - memcpy(&RRC_RAL_MEASUREMENT_REPORT_IND (message_p).threshold, - &PHY_MEAS_REPORT_IND(msg_p).threshold, - sizeof(RRC_RAL_MEASUREMENT_REPORT_IND (message_p).threshold)); - - memcpy(&RRC_RAL_MEASUREMENT_REPORT_IND (message_p).link_param, - &PHY_MEAS_REPORT_IND(msg_p).link_param, - sizeof(RRC_RAL_MEASUREMENT_REPORT_IND (message_p).link_param)); - - LOG_D(RRC, "[UE %d] PHY_MEAS_REPORT_IN: sending msg %s to %s \n", ue_mod_id, "RRC_RAL_MEASUREMENT_REPORT_IND", "TASK_RAL_UE"); - itti_send_msg_to_task(TASK_RAL_UE, instance, message_p); - break; - } - - case RRC_RAL_CONFIGURE_THRESHOLD_REQ: - rrc_ue_ral_handle_configure_threshold_request(ue_mod_id, msg_p); - break; - - case RRC_RAL_CONNECTION_ESTABLISHMENT_REQ: - LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, msg_name); - - switch (rrc_get_state(ue_mod_id)) { - case RRC_STATE_IDLE: { - if (rrc_get_sub_state(ue_mod_id) == RRC_SUB_STATE_IDLE_SIB_COMPLETE) { - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, UE_rrc_inst[ue_mod_id].Info[0].rnti, 0, 0, 0); - rrc_ue_generate_RRCConnectionRequest(&ctxt, 0); - LOG_D(RRC, "not sending connection request\n"); - rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE_CONNECTING); + // check if SRB2 is created, if yes request data_req on DCCH1 (SRB2) + if(UE_rrc_inst[ue_mod_id].SRB2_config[0] == NULL) + { + rrc_data_req_ue (&ctxt, + DCCH, + rrc_mui++, + SDU_CONFIRM_NO, + length, buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + } + else + { + rrc_data_req_ue (&ctxt, + DCCH1, + rrc_mui++, + SDU_CONFIRM_NO, + length, buffer, + PDCP_TRANSMISSION_MODE_CONTROL); } break; } - case RRC_STATE_INACTIVE: - case RRC_STATE_CONNECTED: - /* should not happen */ - LOG_E(RRC, "[UE %d] request %s in RRC state %d\n", ue_mod_id, msg_name, rrc_get_state(ue_mod_id)); +# endif +# if ENABLE_RAL + + case RRC_RAL_SCAN_REQ: + LOG_D(RRC, "[UE %d] Received %s: state %d\n", ue_mod_id, msg_name); + + switch (rrc_get_state(ue_mod_id)) { + case RRC_STATE_INACTIVE: { + /* Need to first activate lower layers */ + MessageDef *message_p; + message_p = itti_alloc_new_message(TASK_RRC_UE, ACTIVATE_MESSAGE); + itti_send_msg_to_task(TASK_L2L1, instance, message_p); + rrc_set_state (ue_mod_id, RRC_STATE_IDLE); + /* Fall through to next case */ + } + + case RRC_STATE_IDLE: { + if (rrc_get_sub_state(ue_mod_id) != RRC_SUB_STATE_IDLE_SEARCHING) { + /* Ask to layer 1 to find a cell matching the criterion */ + MessageDef *message_p; + message_p = itti_alloc_new_message(TASK_RRC_UE, PHY_FIND_CELL_REQ); + rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE_SEARCHING); + PHY_FIND_CELL_REQ (message_p).transaction_id = RRC_RAL_SCAN_REQ (msg_p).transaction_id; + PHY_FIND_CELL_REQ (message_p).earfcn_start = 1; + PHY_FIND_CELL_REQ (message_p).earfcn_end = 1; //44 + itti_send_msg_to_task(TASK_PHY_UE, instance, message_p); + } + + break; + } + + case RRC_STATE_CONNECTED: + /* should not happen */ + LOG_E(RRC, "[UE %d] request %s in RRC state %d\n", ue_mod_id, msg_name, rrc_get_state(ue_mod_id)); + break; + + default: + LOG_C(RRC, "[UE %d] Invalid RRC state %d\n", ue_mod_id, rrc_get_state(ue_mod_id)); + break; + } + break; - default: - LOG_C(RRC, "[UE %d] Invalid RRC state %d\n", ue_mod_id, rrc_get_state(ue_mod_id)); + case PHY_FIND_CELL_IND: + LOG_D(RRC, "[UE %d] Received %s: state %d\n", ue_mod_id, msg_name, rrc_get_state(ue_mod_id)); + + switch (rrc_get_state(ue_mod_id)) { + case RRC_STATE_IDLE: + switch (rrc_get_sub_state(ue_mod_id)) { + case RRC_SUB_STATE_IDLE_SEARCHING: { + MessageDef *message_p; + int i; + message_p = itti_alloc_new_message(TASK_RRC_UE, RRC_RAL_SCAN_CONF); + RRC_RAL_SCAN_CONF (message_p).transaction_id = PHY_FIND_CELL_IND(msg_p).transaction_id; + RRC_RAL_SCAN_CONF (message_p).num_scan_resp = PHY_FIND_CELL_IND(msg_p).cell_nb; + + for (i = 0 ; i < PHY_FIND_CELL_IND(msg_p).cell_nb; i++) { + // TO DO + memset(&RRC_RAL_SCAN_CONF (message_p).link_scan_resp[i].link_addr, 0, sizeof(ral_link_addr_t)); + // TO DO + memset(&RRC_RAL_SCAN_CONF (message_p).link_scan_resp[i].network_id, 0, sizeof(ral_network_id_t)); + RRC_RAL_SCAN_CONF (message_p).link_scan_resp[i].sig_strength.choice = RAL_SIG_STRENGTH_CHOICE_DBM; + RRC_RAL_SCAN_CONF (message_p).link_scan_resp[i].sig_strength._union.dbm = PHY_FIND_CELL_IND(msg_p).cells[i].rsrp; + } + + rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE); + itti_send_msg_to_task(TASK_RAL_UE, instance, message_p); + break; + } + + default: + LOG_C(RRC, "[UE %d] Invalid RRC state %d substate %d\n", + ue_mod_id, + rrc_get_state(ue_mod_id), + rrc_get_sub_state(ue_mod_id)); + } + + break; + + case RRC_STATE_INACTIVE: + case RRC_STATE_CONNECTED: + /* should not happen */ + LOG_E(RRC, "[UE %d] indication %s in RRC state %d\n", ue_mod_id, msg_name, rrc_get_state(ue_mod_id)); + break; + + default: + LOG_C(RRC, "[UE %d] Invalid RRC state %d\n", ue_mod_id, rrc_get_state(ue_mod_id)); + break; + } + + break; // PHY_FIND_CELL_IND + + case PHY_MEAS_REPORT_IND: { + MessageDef *message_p; + message_p = itti_alloc_new_message(TASK_RRC_UE, RRC_RAL_MEASUREMENT_REPORT_IND); + memcpy(&RRC_RAL_MEASUREMENT_REPORT_IND (message_p).threshold, + &PHY_MEAS_REPORT_IND(msg_p).threshold, + sizeof(RRC_RAL_MEASUREMENT_REPORT_IND (message_p).threshold)); + memcpy(&RRC_RAL_MEASUREMENT_REPORT_IND (message_p).link_param, + &PHY_MEAS_REPORT_IND(msg_p).link_param, + sizeof(RRC_RAL_MEASUREMENT_REPORT_IND (message_p).link_param)); + LOG_D(RRC, "[UE %d] PHY_MEAS_REPORT_IN: sending msg %s to %s \n", ue_mod_id, "RRC_RAL_MEASUREMENT_REPORT_IND", "TASK_RAL_UE"); + itti_send_msg_to_task(TASK_RAL_UE, instance, message_p); break; } - break; + case RRC_RAL_CONFIGURE_THRESHOLD_REQ: + rrc_ue_ral_handle_configure_threshold_request(ue_mod_id, msg_p); + break; - case RRC_RAL_CONNECTION_RELEASE_REQ: - LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, msg_name); - break; + case RRC_RAL_CONNECTION_ESTABLISHMENT_REQ: + LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, msg_name); + + switch (rrc_get_state(ue_mod_id)) { + case RRC_STATE_IDLE: { + if (rrc_get_sub_state(ue_mod_id) == RRC_SUB_STATE_IDLE_SIB_COMPLETE) { + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, ue_mod_id, ENB_FLAG_NO, UE_rrc_inst[ue_mod_id].Info[0].rnti, 0, 0, 0); + rrc_ue_generate_RRCConnectionRequest(&ctxt, 0); + LOG_D(RRC, "not sending connection request\n"); + rrc_set_sub_state (ue_mod_id, RRC_SUB_STATE_IDLE_CONNECTING); + } + + break; + } + + case RRC_STATE_INACTIVE: + case RRC_STATE_CONNECTED: + /* should not happen */ + LOG_E(RRC, "[UE %d] request %s in RRC state %d\n", ue_mod_id, msg_name, rrc_get_state(ue_mod_id)); + break; + + default: + LOG_C(RRC, "[UE %d] Invalid RRC state %d\n", ue_mod_id, rrc_get_state(ue_mod_id)); + break; + } + + break; + + case RRC_RAL_CONNECTION_RELEASE_REQ: + LOG_D(RRC, "[UE %d] Received %s\n", ue_mod_id, msg_name); + break; #endif - default: - LOG_E(RRC, "[UE %d] Received unexpected message %s\n", ue_mod_id, msg_name); - break; + default: + LOG_E(RRC, "[UE %d] Received unexpected message %s\n", ue_mod_id, msg_name); + break; } result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p); @@ -4774,28 +4532,24 @@ void *rrc_ue_task( void *args_p ) /*------------------------------------------------------------------------------*/ void openair_rrc_top_init_ue( - int eMBMS_active, - char* uecap_xer, - uint8_t cba_group_active, - uint8_t HO_active + int eMBMS_active, + char *uecap_xer, + uint8_t cba_group_active, + uint8_t HO_active ) //----------------------------------------------------------------------------- { - module_id_t module_id; OAI_UECapability_t *UECap = NULL; int CC_id; - /* for no gcc warnings */ (void)CC_id; - LOG_D(RRC, "[OPENAIR][INIT] Init function start: NB_UE_INST=%d, NB_eNB_INST=%d\n", NB_UE_INST, NB_eNB_INST); if (NB_UE_INST > 0) { - UE_rrc_inst = (UE_RRC_INST*) malloc16(NB_UE_INST*sizeof(UE_RRC_INST)); + UE_rrc_inst = (UE_RRC_INST *) malloc16(NB_UE_INST*sizeof(UE_RRC_INST)); memset (UE_rrc_inst, 0, NB_UE_INST * sizeof(UE_RRC_INST)); LOG_D(RRC, "ALLOCATE %d Bytes for UE_RRC_INST @ %p\n", (unsigned int)(NB_UE_INST*sizeof(UE_RRC_INST)), UE_rrc_inst); - // fill UE capability UECap = fill_ue_capability (uecap_xer); @@ -4816,7 +4570,6 @@ openair_rrc_top_init_ue( } else { UE_rrc_inst = NULL; } - } //----------------------------------------------------------------------------- @@ -4826,122 +4579,118 @@ rrc_top_cleanup_ue( ) //----------------------------------------------------------------------------- { - if (NB_UE_INST > 0) free (UE_rrc_inst); - - } //----------------------------------------------------------------------------- RRC_status_t rrc_rx_tx_ue( - protocol_ctxt_t* const ctxt_pP, + protocol_ctxt_t *const ctxt_pP, const uint8_t enb_indexP, const int CC_id ) //----------------------------------------------------------------------------- { - #ifdef LOCALIZATION double estimated_distance; protocol_ctxt_t ctxt; #endif VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_IN); - // check timers + // check timers - if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_active == 1) { - if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt % 10) == 0) - LOG_D(RRC, - "[UE %d][RAPROC] Frame %d T300 Count %d ms\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt); + if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_active == 1) { + if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt % 10) == 0) + LOG_D(RRC, + "[UE %d][RAPROC] Frame %d T300 Count %d ms\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt); - if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt - == T300[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t300]) { - UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_active = 0; - // ALLOW CCCH to be used - UE_rrc_inst[ctxt_pP->module_id].Srb0[enb_indexP].Tx_buffer.payload_size = 0; - rrc_ue_generate_RRCConnectionRequest (ctxt_pP, enb_indexP); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT); - return (RRC_ConnSetup_failed); - } - - UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt++; - } - - if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].SIStatus&2)>0) { - if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt - == N310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.n310]) { - LOG_I(RRC,"Activating T310\n"); - UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 1; - } - } else { // in case we have not received SIB2 yet - /* if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt == 100) { - UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt = 0; - - }*/ + if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt + == T300[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t300]) { + UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_active = 0; + // ALLOW CCCH to be used + UE_rrc_inst[ctxt_pP->module_id].Srb0[enb_indexP].Tx_buffer.payload_size = 0; + rrc_ue_generate_RRCConnectionRequest (ctxt_pP, enb_indexP); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT); - return RRC_OK; + return (RRC_ConnSetup_failed); } - if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active == 1) { - if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N311_cnt - == N311[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.n311]) { - UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0; - UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N311_cnt = 0; - } + UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T300_cnt++; + } - if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt % 10) == 0) { - LOG_D(RRC, "[UE %d] Frame %d T310 Count %d ms\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt); - } + if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].SIStatus&2)>0) { + if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt + == N310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.n310]) { + LOG_I(RRC,"Activating T310\n"); + UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 1; + } + } else { // in case we have not received SIB2 yet + /* if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt == 100) { + UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N310_cnt = 0; - if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt == T310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t310]) { - UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0; - rrc_t310_expiration (ctxt_pP, enb_indexP); - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT); - LOG_I(RRC,"Returning RRC_PHY_RESYNCH: T310 expired\n"); - return RRC_PHY_RESYNCH; - } + }*/ + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT); + return RRC_OK; + } - UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt++; + if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active == 1) { + if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N311_cnt + == N311[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.n311]) { + UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0; + UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].N311_cnt = 0; } - if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_active==1) { - if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt % 10) == 0) - LOG_D(RRC,"[UE %d][RAPROC] Frame %d T304 Count %d ms\n",ctxt_pP->module_id,ctxt_pP->frame, - UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt); - - if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt == 0) { - UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_active = 0; - UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag = 1; - LOG_E(RRC,"[UE %d] Handover failure..initiating connection re-establishment procedure... \n", - ctxt_pP->module_id); - //Implement 36.331, section 5.3.5.6 here - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT); - return(RRC_Handover_failed); - } - - UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt--; + if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt % 10) == 0) { + LOG_D(RRC, "[UE %d] Frame %d T310 Count %d ms\n", ctxt_pP->module_id, ctxt_pP->frame, UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt); } - // Layer 3 filtering of RRC measurements - if (UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[0] != NULL) { - ue_meas_filtering(ctxt_pP,enb_indexP); - } - - ue_measurement_report_triggering(ctxt_pP,enb_indexP); - - if (UE_rrc_inst[ctxt_pP->module_id].Info[0].handoverTarget > 0) { - LOG_I(RRC,"[UE %d] Frame %d : RRC handover initiated\n", ctxt_pP->module_id, ctxt_pP->frame); - } - - if((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State == RRC_HO_EXECUTION) && - (UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId != 0xFF)) { - UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State= RRC_IDLE; + if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt == T310[UE_rrc_inst[ctxt_pP->module_id].sib2[enb_indexP]->ue_TimersAndConstants.t310]) { + UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_active = 0; + rrc_t310_expiration (ctxt_pP, enb_indexP); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT); - return(RRC_HO_STARTED); + LOG_I(RRC,"Returning RRC_PHY_RESYNCH: T310 expired\n"); + return RRC_PHY_RESYNCH; } + UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T310_cnt++; + } + + if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_active==1) { + if ((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt % 10) == 0) + LOG_D(RRC,"[UE %d][RAPROC] Frame %d T304 Count %d ms\n",ctxt_pP->module_id,ctxt_pP->frame, + UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt); + + if (UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt == 0) { + UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_active = 0; + UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.measFlag = 1; + LOG_E(RRC,"[UE %d] Handover failure..initiating connection re-establishment procedure... \n", + ctxt_pP->module_id); + //Implement 36.331, section 5.3.5.6 here + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT); + return(RRC_Handover_failed); + } + + UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].T304_cnt--; + } + + // Layer 3 filtering of RRC measurements + if (UE_rrc_inst[ctxt_pP->module_id].QuantityConfig[0] != NULL) { + ue_meas_filtering(ctxt_pP,enb_indexP); + } + + ue_measurement_report_triggering(ctxt_pP,enb_indexP); + + if (UE_rrc_inst[ctxt_pP->module_id].Info[0].handoverTarget > 0) { + LOG_I(RRC,"[UE %d] Frame %d : RRC handover initiated\n", ctxt_pP->module_id, ctxt_pP->frame); + } + + if((UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State == RRC_HO_EXECUTION) && + (UE_rrc_inst[ctxt_pP->module_id].HandoverInfoUe.targetCellId != 0xFF)) { + UE_rrc_inst[ctxt_pP->module_id].Info[enb_indexP].State= RRC_IDLE; + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT); + return(RRC_HO_STARTED); + } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT); return (RRC_OK); } diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 9faa686ef6..a22698654b 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -105,7 +105,7 @@ extern EMULATION_VARS *Emul_vars; extern eNB_MAC_INST *eNB_mac_inst; extern UE_MAC_INST *UE_mac_inst; #ifdef BIGPHYSAREA -extern void* bigphys_malloc(int); +extern void *bigphys_malloc(int); #endif extern uint16_t two_tier_hexagonal_cellIds[7]; @@ -114,30 +114,30 @@ mui_t rrc_eNB_mui = 0; void openair_rrc_on( - const protocol_ctxt_t* const ctxt_pP + const protocol_ctxt_t *const ctxt_pP ) //----------------------------------------------------------------------------- { int CC_id; + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" ENB:OPENAIR RRC IN....\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" ENB:OPENAIR RRC IN....\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI, BCCH, 1); - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI.Active = 1; - rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0, CCCH, 1); - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Active = 1; - } + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI, BCCH, 1); + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SI.Active = 1; + rrc_config_buffer (&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0, CCCH, 1); + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Active = 1; + } } //----------------------------------------------------------------------------- static void init_SI( - const protocol_ctxt_t* const ctxt_pP, + const protocol_ctxt_t *const ctxt_pP, const int CC_id #if defined(ENABLE_ITTI) , - RrcConfigurationReq * configuration + RrcConfigurationReq *configuration #endif ) //----------------------------------------------------------------------------- @@ -145,14 +145,11 @@ init_SI( #if defined(Rel10) || defined(Rel14) int i; #endif - #ifdef Rel14 SystemInformationBlockType1_v1310_IEs_t *sib1_v13ext=(SystemInformationBlockType1_v1310_IEs_t *)NULL; #endif - LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__); - - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MIB = (uint8_t*) malloc16(4); + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MIB = (uint8_t *) malloc16(4); // copy basic parameters RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId = configuration->Nid_cell[CC_id]; RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB = configuration->nb_antenna_ports[CC_id]; @@ -162,84 +159,74 @@ init_SI( #ifdef Rel14 RC.rrc[ctxt_pP->module_id]->carrier[CC_id].pbch_repetition = configuration->pbch_repetition[CC_id]; #endif - LOG_I(RRC, "Configuring MIB (N_RB_DL %d,phich_Resource %d,phich_Duration %d)\n", - (int)configuration->N_RB_DL[CC_id], - (int)configuration->phich_resource[CC_id], - (int)configuration->phich_duration[CC_id]); + LOG_I(RRC, "Configuring MIB (N_RB_DL %d,phich_Resource %d,phich_Duration %d)\n", + (int)configuration->N_RB_DL[CC_id], + (int)configuration->phich_resource[CC_id], + (int)configuration->phich_duration[CC_id]); do_MIB(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id], #ifdef ENABLE_ITTI - configuration->N_RB_DL[CC_id], - configuration->phich_resource[CC_id], - configuration->phich_duration[CC_id] + configuration->N_RB_DL[CC_id], + configuration->phich_resource[CC_id], + configuration->phich_duration[CC_id] #else - 50,0,0 + 50,0,0 #endif - ,0); - - + ,0); RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 = 0; RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 = 0; - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1 = (uint8_t*) malloc16(32); - + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1 = (uint8_t *) malloc16(32); AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1!=NULL,PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB1 allocated\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 = do_SIB1(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],ctxt_pP->module_id,CC_id #if defined(ENABLE_ITTI) - , configuration + , configuration #endif - ); - + ); AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 != 255,"FATAL, RC.rrc[enb_mod_idP].carrier[CC_id].sizeof_SIB1 == 255"); - - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23 = (uint8_t*) malloc16(64); + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23 = (uint8_t *) malloc16(64); AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23!=NULL,"cannot allocate memory for SIB"); RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 = do_SIB23( - ctxt_pP->module_id, - - CC_id + ctxt_pP->module_id, + CC_id #if defined(ENABLE_ITTI) - , configuration + , configuration #endif - ); - + ); AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 != 255,"FATAL, RC.rrc[mod].carrier[CC_id].sizeof_SIB23 == 255"); - - LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" SIB2/3 Contents (partial)\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.n_SB = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - pusch_ConfigBasic.n_SB); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + pusch_ConfigBasic.n_SB); LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.hoppingMode = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - pusch_ConfigBasic.hoppingMode); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + pusch_ConfigBasic.hoppingMode); LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.pusch_HoppingOffset = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - pusch_ConfigBasic.pusch_HoppingOffset); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + pusch_ConfigBasic.pusch_HoppingOffset); LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.enable64QAM = %d\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - pusch_ConfigBasic.enable64QAM); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + pusch_ConfigBasic.enable64QAM); LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.groupHoppingEnabled = %d\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - ul_ReferenceSignalsPUSCH.groupHoppingEnabled); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + ul_ReferenceSignalsPUSCH.groupHoppingEnabled); LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.groupAssignmentPUSCH = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH); LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.sequenceHoppingEnabled = %d\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled); LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.cyclicShift = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - ul_ReferenceSignalsPUSCH.cyclicShift); - + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + ul_ReferenceSignalsPUSCH.cyclicShift); #if defined(Rel10) || defined(Rel14) if (RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MBMS_flag > 0) { @@ -247,105 +234,104 @@ init_SI( // SIB 2 // LOG_D(RRC, "[eNB %d] mbsfn_SubframeConfigList.list.count = %ld\n", enb_mod_idP, RC.rrc[enb_mod_idP].sib2->mbsfn_SubframeConfigList->list.count); LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" SIB13 contents for MBSFN subframe allocation %d/%d(partial)\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - i, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.count); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + i, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.count); LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" mbsfn_Subframe_pattern is = %x\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0] >> 0); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0] >> 0); LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" radioframe_allocation_period = %ld (just index number, not the real value)\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationPeriod); // need to display the real value, using array of char (like in dumping SIB2) + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationPeriod); // need to display the real value, using array of char (like in dumping SIB2) LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" radioframe_allocation_offset = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationOffset); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationOffset); } - + // SIB13 for (i = 0; i < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.count; i++) { LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" SIB13 contents for MBSFN sync area %d/%d (partial)\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - i, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.count); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + i, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.count); LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" MCCH Repetition Period: %ld (just index number, not real value)\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_RepetitionPeriod_r9); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_RepetitionPeriod_r9); LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" MCCH Offset: %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_Offset_r9); + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_Offset_r9); } } - else memset((void*)&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13,0,sizeof(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13)); -#endif + else memset((void *)&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13,0,sizeof(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13)); +#endif LOG_D(RRC, - PROTOCOL_RRC_CTXT_FMT" RRC_UE --- MAC_CONFIG_REQ (SIB1.tdd & SIB2 params) ---> MAC_UE\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); - + PROTOCOL_RRC_CTXT_FMT" RRC_UE --- MAC_CONFIG_REQ (SIB1.tdd & SIB2 params) ---> MAC_UE\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); #ifdef Rel14 - if ((RC.rrc[ctxt_pP->module_id]->carrier[CC_id].mib.message.schedulingInfoSIB1_BR_r13>0) && + + if ((RC.rrc[ctxt_pP->module_id]->carrier[CC_id].mib.message.schedulingInfoSIB1_BR_r13>0) && (RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR!=NULL)) { - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension!=NULL, - "sib2_br->nonCriticalExtension is null (v8.9)\n"); - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension!=NULL, - "sib2_br->nonCriticalExtension is null (v9.2)\n"); - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, - "sib2_br->nonCriticalExtension is null (v11.3)\n"); - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, - "sib2_br->nonCriticalExtension is null (v12.5)\n"); - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, - "sib2_br->nonCriticalExtension is null (v13.10)\n"); - sib1_v13ext = RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension; + AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension!=NULL, + "sib2_br->nonCriticalExtension is null (v8.9)\n"); + AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension!=NULL, + "sib2_br->nonCriticalExtension is null (v9.2)\n"); + AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, + "sib2_br->nonCriticalExtension is null (v11.3)\n"); + AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, + "sib2_br->nonCriticalExtension is null (v12.5)\n"); + AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, + "sib2_br->nonCriticalExtension is null (v13.10)\n"); + sib1_v13ext = RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension; } -#endif +#endif LOG_D(RRC, "About to call rrc_mac_config_req_eNB\n"); - rrc_mac_config_req_eNB(ctxt_pP->module_id, CC_id, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Ncp, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->freqBandIndicator, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Ncp, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->freqBandIndicator, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq, #ifdef Rel14 - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].pbch_repetition, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].pbch_repetition, #endif - 0, // rnti - (BCCH_BCH_Message_t *) - &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].mib, - (RadioResourceConfigCommonSIB_t *) & - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon, + 0, // rnti + (BCCH_BCH_Message_t *) + &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].mib, + (RadioResourceConfigCommonSIB_t *) & + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon, #if defined(Rel14) - (RadioResourceConfigCommonSIB_t *) & - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2_BR->radioResourceConfigCommon, + (RadioResourceConfigCommonSIB_t *) & + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2_BR->radioResourceConfigCommon, #endif - (struct PhysicalConfigDedicated *)NULL, + (struct PhysicalConfigDedicated *)NULL, #if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, #endif - (MeasObjectToAddMod_t **) NULL, - (MAC_MainConfig_t *) NULL, 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *) NULL, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->tdd_Config, - NULL, - &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->schedulingInfoList, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].ul_CarrierFreq, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->freqInfo.ul_Bandwidth, - &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->freqInfo.additionalSpectrumEmission, - (MBSFN_SubframeConfigList_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList + (MeasObjectToAddMod_t **) NULL, + (MAC_MainConfig_t *) NULL, 0, + (struct LogicalChannelConfig *)NULL, + (MeasGapConfig_t *) NULL, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->tdd_Config, + NULL, + &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->schedulingInfoList, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].ul_CarrierFreq, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->freqInfo.ul_Bandwidth, + &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->freqInfo.additionalSpectrumEmission, + (MBSFN_SubframeConfigList_t *) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList #if defined(Rel10) || defined(Rel14) - , - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MBMS_flag, - (MBSFN_AreaInfoList_r9_t*) & RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9, - (PMCH_InfoList_r9_t *) NULL + , + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MBMS_flag, + (MBSFN_AreaInfoList_r9_t *) & RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9, + (PMCH_InfoList_r9_t *) NULL #endif #ifdef Rel14 - , - sib1_v13ext + , + sib1_v13ext #endif - ); + ); } #if defined(Rel10) || defined(Rel14) @@ -357,92 +343,81 @@ init_MCCH( ) //----------------------------------------------------------------------------- { - int sync_area = 0; // initialize RRC_eNB_INST MCCH entry RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE = - malloc(RC.rrc[enb_mod_idP]->carrier[CC_id].num_mbsfn_sync_area * sizeof(uint8_t*)); + malloc(RC.rrc[enb_mod_idP]->carrier[CC_id].num_mbsfn_sync_area * sizeof(uint8_t *)); for (sync_area = 0; sync_area < RC.rrc[enb_mod_idP]->carrier[CC_id].num_mbsfn_sync_area; sync_area++) { - RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] = 0; RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area] = (uint8_t *) malloc16(32); - AssertFatal(RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area] != NULL, - "[eNB %d]init_MCCH: FATAL, no memory for MCCH MESSAGE allocated \n", enb_mod_idP); + "[eNB %d]init_MCCH: FATAL, no memory for MCCH MESSAGE allocated \n", enb_mod_idP); RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] = do_MBSFNAreaConfig(enb_mod_idP, - sync_area, - (uint8_t *)RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area], - &RC.rrc[enb_mod_idP]->carrier[CC_id].mcch, - &RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message); - + sync_area, + (uint8_t *)RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area], + &RC.rrc[enb_mod_idP]->carrier[CC_id].mcch, + &RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message); LOG_I(RRC, "mcch message pointer %p for sync area %d \n", - RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area], - sync_area); + RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area], + sync_area); LOG_D(RRC, "[eNB %d] MCCH_MESSAGE contents for Sync Area %d (partial)\n", enb_mod_idP, sync_area); LOG_D(RRC, "[eNB %d] CommonSF_AllocPeriod_r9 %ld\n", enb_mod_idP, - RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->commonSF_AllocPeriod_r9); + RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->commonSF_AllocPeriod_r9); LOG_D(RRC, - "[eNB %d] CommonSF_Alloc_r9.list.count (number of MBSFN Subframe Pattern) %d\n", - enb_mod_idP, RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->commonSF_Alloc_r9.list.count); + "[eNB %d] CommonSF_Alloc_r9.list.count (number of MBSFN Subframe Pattern) %d\n", + enb_mod_idP, RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->commonSF_Alloc_r9.list.count); LOG_D(RRC, "[eNB %d] MBSFN Subframe Pattern: %02x (in hex)\n", - enb_mod_idP, - RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->commonSF_Alloc_r9.list.array[0]->subframeAllocation. - choice.oneFrame.buf[0]); - + enb_mod_idP, + RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->commonSF_Alloc_r9.list.array[0]->subframeAllocation. + choice.oneFrame.buf[0]); AssertFatal(RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] != 255, - "RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] == 255"); + "RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] == 255"); RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESS[sync_area].Active = 1; } - //Set the RC.rrc[enb_mod_idP]->MCCH_MESS.Active to 1 (allow to transfer MCCH message RRC->MAC in function mac_rrc_data_req) - // ??Configure MCCH logical channel // call mac_config_req with appropriate structure from ASN.1 description - - // LOG_I(RRC, "DUY: serviceID is %d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->tmgi_r9.serviceId_r9.buf[2]); // LOG_I(RRC, "DUY: session ID is %d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->sessionId_r9->buf[0]); rrc_mac_config_req_eNB(enb_mod_idP, CC_id, - 0,0,0,0,0, -#ifdef Rel14 - 0, -#endif - 0,//rnti - (BCCH_BCH_Message_t *)NULL, - (RadioResourceConfigCommonSIB_t *) NULL, + 0,0,0,0,0, #ifdef Rel14 - (RadioResourceConfigCommonSIB_t *) NULL, + 0, #endif - (struct PhysicalConfigDedicated *)NULL, -#if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + 0,//rnti + (BCCH_BCH_Message_t *)NULL, + (RadioResourceConfigCommonSIB_t *) NULL, +#ifdef Rel14 + (RadioResourceConfigCommonSIB_t *) NULL, #endif - (MeasObjectToAddMod_t **) NULL, - (MAC_MainConfig_t *) NULL, - 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *) NULL, - (TDD_Config_t *) NULL, - (MobilityControlInfo_t *)NULL, - (SchedulingInfoList_t *) NULL, - 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL + (struct PhysicalConfigDedicated *)NULL, #if defined(Rel10) || defined(Rel14) - , - 0, - (MBSFN_AreaInfoList_r9_t *) NULL, - (PMCH_InfoList_r9_t *) & (RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9) + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + (MAC_MainConfig_t *) NULL, + 0, + (struct LogicalChannelConfig *)NULL, + (MeasGapConfig_t *) NULL, + (TDD_Config_t *) NULL, + (MobilityControlInfo_t *)NULL, + (SchedulingInfoList_t *) NULL, + 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL +#if defined(Rel10) || defined(Rel14) + , + 0, + (MBSFN_AreaInfoList_r9_t *) NULL, + (PMCH_InfoList_r9_t *) & (RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9) # endif # ifdef Rel14 - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL + , + (SystemInformationBlockType1_v1310_IEs_t *)NULL # endif - ); - + ); //LOG_I(RRC,"DUY: lcid after rrc_mac_config_req is %02d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9); - } //----------------------------------------------------------------------------- @@ -458,13 +433,11 @@ static void init_MBMS( if (RC.rrc[enb_mod_idP]->carrier[CC_id].MBMS_flag > 0) { PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, enb_mod_idP, ENB_FLAG_YES, NOT_A_RNTI, frameP, 0,enb_mod_idP); - LOG_D(RRC, "[eNB %d] Frame %d : Radio Bearer config request for MBMS\n", enb_mod_idP, frameP); //check the lcid // Configuring PDCP and RLC for MBMS Radio Bearer - rrc_pdcp_config_asn1_req(&ctxt, - (SRB_ToAddModList_t *)NULL, // SRB_ToAddModList - (DRB_ToAddModList_t *)NULL, // DRB_ToAddModList + (SRB_ToAddModList_t *)NULL, // SRB_ToAddModList + (DRB_ToAddModList_t *)NULL, // DRB_ToAddModList (DRB_ToReleaseList_t *)NULL, 0, // security mode NULL, // key rrc encryption @@ -474,13 +447,11 @@ static void init_MBMS( , &(RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9) # endif ,NULL); - rrc_rlc_config_asn1_req(&ctxt, NULL, // SRB_ToAddModList NULL, // DRB_ToAddModList NULL, // DRB_ToReleaseList &(RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9)); - //rrc_mac_config_req(); } } @@ -533,14 +504,14 @@ rrc_eNB_get_next_transaction_identifier( //----------------------------------------------------------------------------- // return the ue context if there is already an UE with ue_identityP, NULL otherwise -static struct rrc_eNB_ue_context_s* +static struct rrc_eNB_ue_context_s * rrc_eNB_ue_context_random_exist( - const protocol_ctxt_t* const ctxt_pP, + const protocol_ctxt_t *const ctxt_pP, const uint64_t ue_identityP ) //----------------------------------------------------------------------------- { - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { if (ue_context_p->ue_context.random_ue_identity == ue_identityP) return ue_context_p; @@ -549,47 +520,48 @@ rrc_eNB_ue_context_random_exist( } //----------------------------------------------------------------------------- // return the ue context if there is already an UE with the same S-TMSI(MMEC+M-TMSI), NULL otherwise -static struct rrc_eNB_ue_context_s* +static struct rrc_eNB_ue_context_s * rrc_eNB_ue_context_stmsi_exist( - const protocol_ctxt_t* const ctxt_pP, + const protocol_ctxt_t *const ctxt_pP, const mme_code_t mme_codeP, const m_tmsi_t m_tmsiP ) //----------------------------------------------------------------------------- { - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { LOG_I(RRC,"checking for UE S-TMSI %x, mme %x (%p): rnti %x", - m_tmsiP, mme_codeP, ue_context_p, - ue_context_p->ue_context.rnti); + m_tmsiP, mme_codeP, ue_context_p, + ue_context_p->ue_context.rnti); + if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) { printf("=> S-TMSI %x, MME %x\n", - ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, - ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code); + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code); + if (ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi == m_tmsiP) if (ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code == mme_codeP) return ue_context_p; } else printf("\n"); - } return NULL; } //----------------------------------------------------------------------------- // return a new ue context structure if ue_identityP, ctxt_pP->rnti not found in collection -static struct rrc_eNB_ue_context_s* +static struct rrc_eNB_ue_context_s * rrc_eNB_get_next_free_ue_context( - const protocol_ctxt_t* const ctxt_pP, + const protocol_ctxt_t *const ctxt_pP, const uint64_t ue_identityP ) //----------------------------------------------------------------------------- { - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[ctxt_pP->module_id], - ctxt_pP->rnti); + RC.rrc[ctxt_pP->module_id], + ctxt_pP->rnti); if (ue_context_p == NULL) { #if 0 @@ -622,7 +594,6 @@ rrc_eNB_get_next_free_ue_context( PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), ue_context_p->local_uid); return ue_context_p; - } else { LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Cannot create new UE context, already exist\n", @@ -641,14 +612,15 @@ void rrc_eNB_emulation_notify_ue_module_id( const uint8_t cell_identity_byte3P) { module_id_t enb_module_id; - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; int CC_id; // find enb_module_id for (enb_module_id = 0; enb_module_id < NUMBER_OF_eNB_MAX; enb_module_id++) { - if(enb_module_id>0){ /*FIX LATER*/ + if(enb_module_id>0) { /*FIX LATER*/ return; } + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { if (&RC.rrc[enb_module_id]->carrier[CC_id].sib1 != NULL) { if ( @@ -670,6 +642,7 @@ void rrc_eNB_emulation_notify_ue_module_id( } } } + oai_emulation.info.eNB_ue_module_id_to_rnti[enb_module_id][ue_module_idP] = rntiP; } @@ -682,8 +655,8 @@ void rrc_eNB_emulation_notify_ue_module_id( //----------------------------------------------------------------------------- void rrc_eNB_free_mem_UE_context( - const protocol_ctxt_t* const ctxt_pP, - struct rrc_eNB_ue_context_s* const ue_context_pP + const protocol_ctxt_t *const ctxt_pP, + struct rrc_eNB_ue_context_s *const ue_context_pP ) //----------------------------------------------------------------------------- { @@ -702,11 +675,11 @@ rrc_eNB_free_mem_UE_context( ue_context_pP->ue_context.SRB_configList = NULL; } - for(i = 0;i < RRC_TRANSACTION_IDENTIFIER_NUMBER;i++){ - if (ue_context_pP->ue_context.SRB_configList2[i]) { - free(ue_context_pP->ue_context.SRB_configList2[i]); - ue_context_pP->ue_context.SRB_configList2[i] = NULL; - } + for(i = 0; i < RRC_TRANSACTION_IDENTIFIER_NUMBER; i++) { + if (ue_context_pP->ue_context.SRB_configList2[i]) { + free(ue_context_pP->ue_context.SRB_configList2[i]); + ue_context_pP->ue_context.SRB_configList2[i] = NULL; + } } if (ue_context_pP->ue_context.DRB_configList) { @@ -714,15 +687,16 @@ rrc_eNB_free_mem_UE_context( ue_context_pP->ue_context.DRB_configList = NULL; } - for(i = 0;i < RRC_TRANSACTION_IDENTIFIER_NUMBER;i++){ - if (ue_context_pP->ue_context.DRB_configList2[i]) { - free(ue_context_pP->ue_context.DRB_configList2[i]); - ue_context_pP->ue_context.DRB_configList2[i] = NULL; - } - if (ue_context_pP->ue_context.DRB_Release_configList2[i]) { - free(ue_context_pP->ue_context.DRB_Release_configList2[i]); - ue_context_pP->ue_context.DRB_Release_configList2[i] = NULL; - } + for(i = 0; i < RRC_TRANSACTION_IDENTIFIER_NUMBER; i++) { + if (ue_context_pP->ue_context.DRB_configList2[i]) { + free(ue_context_pP->ue_context.DRB_configList2[i]); + ue_context_pP->ue_context.DRB_configList2[i] = NULL; + } + + if (ue_context_pP->ue_context.DRB_Release_configList2[i]) { + free(ue_context_pP->ue_context.DRB_Release_configList2[i]); + ue_context_pP->ue_context.DRB_Release_configList2[i] = NULL; + } } memset(ue_context_pP->ue_context.DRB_active, 0, sizeof(ue_context_pP->ue_context.DRB_active)); @@ -761,14 +735,14 @@ rrc_eNB_free_mem_UE_context( ue_context_pP->ue_context.mac_MainConfig = NULL; } -/* if (ue_context_pP->ue_context.measGapConfig) { - ASN_STRUCT_FREE(asn_DEF_MeasGapConfig, ue_context_pP->ue_context.measGapConfig); - ue_context_pP->ue_context.measGapConfig = NULL; - }*/ - if (ue_context_pP->ue_context.handover_info) { - ASN_STRUCT_FREE(asn_DEF_Handover, ue_context_pP->ue_context.handover_info); - ue_context_pP->ue_context.handover_info = NULL; - } + /* if (ue_context_pP->ue_context.measGapConfig) { + ASN_STRUCT_FREE(asn_DEF_MeasGapConfig, ue_context_pP->ue_context.measGapConfig); + ue_context_pP->ue_context.measGapConfig = NULL; + }*/ + if (ue_context_pP->ue_context.handover_info) { + ASN_STRUCT_FREE(asn_DEF_Handover, ue_context_pP->ue_context.handover_info); + ue_context_pP->ue_context.handover_info = NULL; + } //SRB_INFO SI; //SRB_INFO Srb0; @@ -811,11 +785,9 @@ rrc_eNB_free_mem_UE_context( //----------------------------------------------------------------------------- // should be called when UE is lost by eNB void -rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s* const ue_context_pP) +rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s *const ue_context_pP) //----------------------------------------------------------------------------- { - - protocol_ctxt_t ctxt; #if !defined(ENABLE_USE_MME) module_id_t ue_module_id; @@ -823,14 +795,14 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s* (void)ue_module_id; #endif rnti_t rnti = ue_context_pP->ue_context.rnti; - int i, j , CC_id, pdu_number; + int i, j, CC_id, pdu_number; LTE_eNB_ULSCH_t *ulsch = NULL; LTE_eNB_DLSCH_t *dlsch = NULL; nfapi_ul_config_request_body_t *ul_req_tmp = NULL; PHY_VARS_eNB *eNB_PHY = NULL; eNB_MAC_INST *eNB_MAC = RC.mac[enb_mod_idP]; - AssertFatal(enb_mod_idP < NB_eNB_INST, "eNB inst invalid (%d/%d) for UE %x!", enb_mod_idP, NB_eNB_INST, rnti); + /* ue_context_p = rrc_eNB_get_ue_context( &RC.rrc[enb_mod_idP], rntiP @@ -839,32 +811,38 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s* if (NULL != ue_context_pP) { PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, enb_mod_idP, ENB_FLAG_YES, rnti, 0, 0,enb_mod_idP); LOG_W(RRC, "[eNB %d] Removing UE RNTI %x\n", enb_mod_idP, rnti); - #if defined(ENABLE_USE_MME) - if( ue_context_pP->ue_context.ul_failure_timer >= 8 ) { - LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ RNTI %x\n", enb_mod_idP, rnti); - rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(enb_mod_idP, ue_context_pP, S1AP_CAUSE_RADIO_NETWORK, 21); // send cause 21: connection with ue lost - /* From 3GPP 36300v10 p129 : 19.2.2.2.2 S1 UE Context Release Request (eNB triggered) - * If the E-UTRAN internal reason is a radio link failure detected in the eNB, the eNB shall wait a sufficient time before - * triggering the S1 UE Context Release Request procedure - * in order to allow the UE to perform the NAS recovery - * procedure, see TS 23.401 [17]. - */ - return; + + if( ue_context_pP->ue_context.ul_failure_timer >= 8 ) { + LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ RNTI %x\n", enb_mod_idP, rnti); + rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(enb_mod_idP, ue_context_pP, S1AP_CAUSE_RADIO_NETWORK, 21); // send cause 21: connection with ue lost + /* From 3GPP 36300v10 p129 : 19.2.2.2.2 S1 UE Context Release Request (eNB triggered) + * If the E-UTRAN internal reason is a radio link failure detected in the eNB, the eNB shall wait a sufficient time before + * triggering the S1 UE Context Release Request procedure + * in order to allow the UE to perform the NAS recovery + * procedure, see TS 23.401 [17]. + */ + return; } + #endif + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { eNB_PHY = RC.eNB[enb_mod_idP][CC_id]; + for (i=0; iulsch[i]; - if((ulsch != NULL) && (ulsch->rnti == rnti)){ + + if((ulsch != NULL) && (ulsch->rnti == rnti)) { LOG_I(RRC, "clean_eNb_ulsch UE %x \n", rnti); clean_eNb_ulsch(ulsch); } } + for (i=0; idlsch[i][0]; - if((dlsch != NULL) && (dlsch->rnti == rnti)){ + + if((dlsch != NULL) && (dlsch->rnti == rnti)) { LOG_I(RRC, "clean_eNb_dlsch UE %x \n", rnti); clean_eNb_dlsch(dlsch); } @@ -872,53 +850,55 @@ rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s* if (rrc_agent_registered[enb_mod_idP]) { agent_rrc_xface[enb_mod_idP]->flexran_agent_notify_ue_state_change(enb_mod_idP, - rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); + rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); } - for(j = 0; j < 10; j++){ + for(j = 0; j < 10; j++) { ul_req_tmp = &eNB_MAC->UL_req_tmp[CC_id][j].ul_config_request_body; - if(ul_req_tmp){ + + if(ul_req_tmp) { pdu_number = ul_req_tmp->number_of_pdus; - for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--){ - if(ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == rnti){ + + for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--) { + if(ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == rnti) { LOG_I(RRC, "remove UE %x from ul_config_pdu_list %d/%d\n", rnti, pdu_index, pdu_number); - if(pdu_index < pdu_number -1){ + + if(pdu_index < pdu_number -1) { memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t)); } + ul_req_tmp->number_of_pdus--; } } } } } + rrc_mac_remove_ue(enb_mod_idP,rnti); rrc_rlc_remove_ue(&ctxt); pdcp_remove_UE(&ctxt); - rrc_eNB_remove_ue_context( &ctxt, RC.rrc[enb_mod_idP], - (struct rrc_eNB_ue_context_s*) ue_context_pP); + (struct rrc_eNB_ue_context_s *) ue_context_pP); } } //----------------------------------------------------------------------------- void rrc_eNB_process_RRCConnectionSetupComplete( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* ue_context_pP, - RRCConnectionSetupComplete_r8_IEs_t * rrcConnectionSetupComplete + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *ue_context_pP, + RRCConnectionSetupComplete_r8_IEs_t *rrcConnectionSetupComplete ) //----------------------------------------------------------------------------- { LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing RRCConnectionSetupComplete from UE (SRB1 Active)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - - ue_context_pP->ue_context.Srb1.Active=1; + ue_context_pP->ue_context.Srb1.Active=1; T(T_ENB_RRC_CONNECTION_SETUP_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - #if defined(ENABLE_USE_MME) if (EPC_MODE_ENABLED == 1) { @@ -941,47 +921,41 @@ rrc_eNB_process_RRCConnectionSetupComplete( //----------------------------------------------------------------------------- void rrc_eNB_generate_SecurityModeCommand( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP ) //----------------------------------------------------------------------------- { uint8_t buffer[100]; uint8_t size; - T(T_ENB_RRC_SECURITY_MODE_COMMAND, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - size = do_SecurityModeCommand( ctxt_pP, buffer, rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), ue_context_pP->ue_context.ciphering_algorithm, ue_context_pP->ue_context.integrity_algorithm); - #ifdef RRC_MSG_PRINT uint16_t i=0; LOG_F(RRC,"[MSG] RRC Security Mode Command\n"); for (i = 0; i < size; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); + LOG_F(RRC,"%02x ", ((uint8_t *)buffer)[i]); } LOG_F(RRC,"\n"); #endif - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate SecurityModeCommand (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), size); - LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (securityModeCommand to UE MUI %d) --->[PDCP][RB %02d]\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), size, rrc_eNB_mui, DCCH); - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, @@ -992,50 +966,42 @@ rrc_eNB_generate_SecurityModeCommand( ue_context_pP->ue_context.rnti, rrc_eNB_mui, size); - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); - + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); } //----------------------------------------------------------------------------- void rrc_eNB_generate_UECapabilityEnquiry( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP ) //----------------------------------------------------------------------------- { - uint8_t buffer[100]; uint8_t size; - T(T_ENB_RRC_UE_CAPABILITY_ENQUIRY, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - size = do_UECapabilityEnquiry( ctxt_pP, buffer, rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id)); - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate UECapabilityEnquiry (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), size); - LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (UECapabilityEnquiry MUI %d) --->[PDCP][RB %02d]\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), size, rrc_eNB_mui, DCCH); - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, @@ -1046,23 +1012,21 @@ rrc_eNB_generate_UECapabilityEnquiry( ue_context_pP->ue_context.rnti, rrc_eNB_mui, size); - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); - + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); } //----------------------------------------------------------------------------- void rrc_eNB_generate_RRCConnectionReject( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, const int CC_id ) //----------------------------------------------------------------------------- @@ -1070,24 +1034,20 @@ rrc_eNB_generate_RRCConnectionReject( #ifdef RRC_MSG_PRINT int cnt; #endif - T(T_ENB_RRC_CONNECTION_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size = do_RRCConnectionReject(ctxt_pP->module_id, - (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload); - + (uint8_t *) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload); #ifdef RRC_MSG_PRINT LOG_F(RRC,"[MSG] RRCConnectionReject\n"); for (cnt = 0; cnt < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) { - LOG_F(RRC,"%02x ", ((uint8_t*)RC.rrc[ctxt_pP->module_id]->Srb0.Tx_buffer.Payload)[cnt]); + LOG_F(RRC,"%02x ", ((uint8_t *)RC.rrc[ctxt_pP->module_id]->Srb0.Tx_buffer.Payload)[cnt]); } LOG_F(RRC,"\n"); #endif - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, @@ -1097,7 +1057,6 @@ rrc_eNB_generate_RRCConnectionReject( MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReject (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), @@ -1107,8 +1066,8 @@ rrc_eNB_generate_RRCConnectionReject( //----------------------------------------------------------------------------- void rrc_eNB_generate_RRCConnectionReestablishment( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, const int CC_id ) //----------------------------------------------------------------------------- @@ -1117,26 +1076,23 @@ rrc_eNB_generate_RRCConnectionReestablishment( SRB_ToAddModList_t **SRB_configList; SRB_ToAddMod_t *SRB1_config; int cnt; - T(T_ENB_RRC_CONNECTION_REESTABLISHMENT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - SRB_configList = &ue_context_pP->ue_context.SRB_configList; RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size = do_RRCConnectionReestablishment(ctxt_pP, ue_context_pP, CC_id, - (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, + (uint8_t *) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, (uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2 rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), SRB_configList, &ue_context_pP->ue_context.physicalConfigDedicated); - #ifdef RRC_MSG_PRINT LOG_F(RRC,"[MSG] RRCConnectionReestablishment\n"); for (cnt = 0; cnt < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) { - LOG_F(RRC,"%02x ", ((uint8_t*)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload)[cnt]); + LOG_F(RRC,"%02x ", ((uint8_t *)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload)[cnt]); } LOG_F(RRC,"\n"); @@ -1164,38 +1120,38 @@ rrc_eNB_generate_RRCConnectionReestablishment( PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_eNB\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); rrc_mac_config_req_eNB(ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, -#ifdef Rel14 - 0, -#endif - ctxt_pP->rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t *) NULL, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, #ifdef Rel14 - (RadioResourceConfigCommonSIB_t *) NULL, + 0, #endif - (struct PhysicalConfigDedicated* ) ue_context_pP->ue_context.physicalConfigDedicated, -#if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + ctxt_pP->rnti, + (BCCH_BCH_Message_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, +#ifdef Rel14 + (RadioResourceConfigCommonSIB_t *) NULL, #endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - 1, - SRB1_logicalChannelConfig, - ue_context_pP->ue_context.measGapConfig, - (TDD_Config_t *) NULL, - NULL, - (SchedulingInfoList_t *) NULL, - 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL + (struct PhysicalConfigDedicated * ) ue_context_pP->ue_context.physicalConfigDedicated, #if defined(Rel10) || defined(Rel14) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + 1, + SRB1_logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (TDD_Config_t *) NULL, + NULL, + (SchedulingInfoList_t *) NULL, + 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL +#if defined(Rel10) || defined(Rel14) + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL #endif #ifdef Rel14 - ,(SystemInformationBlockType1_v1310_IEs_t *)NULL + ,(SystemInformationBlockType1_v1310_IEs_t *)NULL #endif - ); + ); break; } } @@ -1209,18 +1165,15 @@ rrc_eNB_generate_RRCConnectionReestablishment( MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP->ue_context.rnti, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); - - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReestablishment (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); - // activate release timer, if RRCComplete not received after 10 frames, remove UE //ue_context_pP->ue_context.ue_release_timer = 1; // remove UE after 10 frames after RRCConnectionReestablishmentRelease is triggered //ue_context_pP->ue_context.ue_release_timer_thres = 100; - // activate release timer, if RRCComplete not received after 100 frames, remove UE + // activate release timer, if RRCComplete not received after 100 frames, remove UE int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1; // remove UE after 100 frames after RRCConnectionReestablishmentRelease is triggered @@ -1230,25 +1183,23 @@ rrc_eNB_generate_RRCConnectionReestablishment( //----------------------------------------------------------------------------- void rrc_eNB_process_RRCConnectionReestablishmentComplete( - const protocol_ctxt_t* const ctxt_pP, + const protocol_ctxt_t *const ctxt_pP, const rnti_t reestablish_rnti, - rrc_eNB_ue_context_t* ue_context_pP, + rrc_eNB_ue_context_t *ue_context_pP, const uint8_t xid, - RRCConnectionReestablishmentComplete_r8_IEs_t * rrcConnectionReestablishmentComplete + RRCConnectionReestablishmentComplete_r8_IEs_t *rrcConnectionReestablishmentComplete ) //----------------------------------------------------------------------------- { LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, processing RRCConnectionReestablishmentComplete from UE (SRB1 Active)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - DRB_ToAddModList_t* DRB_configList = ue_context_pP->ue_context.DRB_configList; - SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; - SRB_ToAddModList_t** SRB_configList2 = NULL; - DRB_ToAddModList_t** DRB_configList2 = NULL; + DRB_ToAddModList_t *DRB_configList = ue_context_pP->ue_context.DRB_configList; + SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList; + SRB_ToAddModList_t **SRB_configList2 = NULL; + DRB_ToAddModList_t **DRB_configList2 = NULL; struct SRB_ToAddMod *SRB2_config = NULL; struct DRB_ToAddMod *DRB_config = NULL; int i = 0; @@ -1276,22 +1227,23 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( (void)dedicatedInfoNas; C_RNTI_t *cba_RNTI = NULL; uint8_t next_xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); - ue_context_pP->ue_context.Status = RRC_CONNECTED; - SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[xid]; + // get old configuration of SRB2 if (*SRB_configList2 != NULL) { LOG_D(RRC, "SRB_configList2(%p) count is %d\n SRB_configList2->list.array[0] addr is %p", SRB_configList2, (*SRB_configList2)->list.count, (*SRB_configList2)->list.array[0]); + for (i = 0; (i < (*SRB_configList2)->list.count) && (i < 3); i++) { - if ((*SRB_configList2)->list.array[i]->srb_Identity == 2 ){ + if ((*SRB_configList2)->list.array[i]->srb_Identity == 2 ) { LOG_D(RRC, "get SRB2_config from (ue_context_pP->ue_context.SRB_configList2[%d])\n", xid); SRB2_config = (*SRB_configList2)->list.array[i]; break; } } } + SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[next_xid]; DRB_configList2 = &ue_context_pP->ue_context.DRB_configList2[next_xid]; @@ -1299,70 +1251,71 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( free(*SRB_configList2); LOG_D(RRC, "free(ue_context_pP->ue_context.SRB_configList2[%d])\n", next_xid); } + *SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2)); + if (SRB2_config != NULL) { // Add SRB2 to SRB configuration list - ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config); - LOG_D(RRC, "Add SRB2_config (srb_Identity:%ld) to ue_context_pP->ue_context.SRB_configList\n", - SRB2_config->srb_Identity); + SRB2_config->srb_Identity); LOG_D(RRC, "Add SRB2_config (srb_Identity:%ld) to ue_context_pP->ue_context.SRB_configList2[%d]\n", - SRB2_config->srb_Identity, next_xid); + SRB2_config->srb_Identity, next_xid); } else { // SRB configuration list only contains SRB1. LOG_W(RRC,"SRB2 configuration does not exist in SRB configuration list\n"); } - - if (*DRB_configList2) { free(*DRB_configList2); LOG_D(RRC, "free(ue_context_pP->ue_context.DRB_configList2[%d])\n", next_xid); } + *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); if (DRB_configList != NULL) { LOG_D(RRC, "get DRB_config from (ue_context_pP->ue_context.DRB_configList)\n"); + for (i = 0; (i < DRB_configList->list.count) && (i < 3); i++) { DRB_config = DRB_configList->list.array[i]; - // Add DRB to DRB configuration list, for RRCConnectionReconfigurationComplete ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config); } } + ue_context_pP->ue_context.Srb1.Active = 1; //ue_context_pP->ue_context.Srb2.Srb_info.Srb_id = 2; - # if defined(ENABLE_USE_MME) - rrc_ue_s1ap_ids_t* rrc_ue_s1ap_ids_p = NULL; + rrc_ue_s1ap_ids_t *rrc_ue_s1ap_ids_p = NULL; uint16_t ue_initial_id = ue_context_pP->ue_context.ue_initial_id; uint32_t eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; eNB_RRC_INST *rrc_instance_p = RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]; + if (eNB_ue_s1ap_id > 0) { - h_rc = hashtable_get(rrc_instance_p->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, (void**)&rrc_ue_s1ap_ids_p); + h_rc = hashtable_get(rrc_instance_p->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, (void **)&rrc_ue_s1ap_ids_p); + if (h_rc == HASH_TABLE_OK) { rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti; } } + if (ue_initial_id != 0) { - h_rc = hashtable_get(rrc_instance_p->initial_id2_s1ap_ids, (hash_key_t)ue_initial_id, (void**)&rrc_ue_s1ap_ids_p); + h_rc = hashtable_get(rrc_instance_p->initial_id2_s1ap_ids, (hash_key_t)ue_initial_id, (void **)&rrc_ue_s1ap_ids_p); + if (h_rc == HASH_TABLE_OK) { rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti; } } gtpv1u_enb_create_tunnel_req_t create_tunnel_req; - /* Save e RAB information for later */ - memset(&create_tunnel_req, 0 , sizeof(create_tunnel_req)); + memset(&create_tunnel_req, 0, sizeof(create_tunnel_req)); for (j = 0, i = 0; i < NB_RB_MAX; i++) { if (ue_context_pP->ue_context.e_rab[i].status == E_RAB_STATUS_ESTABLISHED) { create_tunnel_req.eps_bearer_id[j] = ue_context_pP->ue_context.e_rab[i].param.e_rab_id; create_tunnel_req.sgw_S1u_teid[j] = ue_context_pP->ue_context.e_rab[i].param.gtp_teid; - memcpy(&create_tunnel_req.sgw_addr[j], &ue_context_pP->ue_context.e_rab[i].param.sgw_addr, sizeof(transport_layer_addr_t)); @@ -1372,11 +1325,10 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( create_tunnel_req.rnti = ctxt_pP->rnti; // warning put zero above create_tunnel_req.num_tunnels = j; - gtpv1u_update_s1u_tunnel( - ctxt_pP->instance, - &create_tunnel_req, - reestablish_rnti); + ctxt_pP->instance, + &create_tunnel_req, + reestablish_rnti); #endif /* Update RNTI in ue_context */ ue_context_pP->ue_id_rnti = ctxt_pP->rnti; // here ue_id_rnti is just a key, may be something else @@ -1384,62 +1336,51 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( # if defined(ENABLE_USE_MME) uint8_t send_security_mode_command = FALSE; rrc_pdcp_config_security( - ctxt_pP, - ue_context_pP, - send_security_mode_command); + ctxt_pP, + ue_context_pP, + send_security_mode_command); LOG_D(RRC, "set security successfully \n"); #endif // Measurement ID list MeasId_list = CALLOC(1, sizeof(*MeasId_list)); memset((void *)MeasId_list, 0, sizeof(*MeasId_list)); - MeasId0 = CALLOC(1, sizeof(*MeasId0)); MeasId0->measId = 1; MeasId0->measObjectId = 1; MeasId0->reportConfigId = 1; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0); - MeasId1 = CALLOC(1, sizeof(*MeasId1)); MeasId1->measId = 2; MeasId1->measObjectId = 1; MeasId1->reportConfigId = 2; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1); - MeasId2 = CALLOC(1, sizeof(*MeasId2)); MeasId2->measId = 3; MeasId2->measObjectId = 1; MeasId2->reportConfigId = 3; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2); - MeasId3 = CALLOC(1, sizeof(*MeasId3)); MeasId3->measId = 4; MeasId3->measObjectId = 1; MeasId3->reportConfigId = 4; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3); - MeasId4 = CALLOC(1, sizeof(*MeasId4)); MeasId4->measId = 5; MeasId4->measObjectId = 1; MeasId4->reportConfigId = 5; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4); - MeasId5 = CALLOC(1, sizeof(*MeasId5)); MeasId5->measId = 6; MeasId5->measObjectId = 1; MeasId5->reportConfigId = 6; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5); - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; - // Add one EUTRA Measurement Object MeasObj_list = CALLOC(1, sizeof(*MeasObj_list)); memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list)); - // Configure MeasObject - MeasObj = CALLOC(1, sizeof(*MeasObj)); memset((void *)MeasObj, 0, sizeof(*MeasObj)); - MeasObj->measObjectId = 1; MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA; MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 3350; //band 7, 2.68GHz @@ -1451,10 +1392,8 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6; MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB - MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); - CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; // Add adjacent cell lists (6 per eNB) @@ -1463,28 +1402,19 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( CellToAdd->cellIndex = i + 1; CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i); CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0; - ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd); } ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj); // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; - // Report Configurations for periodical, A1-A5 events ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list)); - ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); - ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1)); - ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2)); - ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3)); - ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4)); - ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5)); - ReportConfig_per->reportConfigId = 1; ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = @@ -1496,9 +1426,7 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); - ReportConfig_A1->reportConfigId = 2; ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present = @@ -1509,13 +1437,11 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. a1_Threshold.choice.threshold_RSRP = 10; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1); if (RC.rrc[ctxt_pP->module_id]->HO_flag == 1 /*HO_MEASURMENT */ ) { @@ -1531,39 +1457,32 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( eventA2.a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA2.a2_Threshold.choice.threshold_RSRP = 10; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2); - ReportConfig_A3->reportConfigId = 4; ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present = ReportConfigEUTRA__triggerType_PR_event; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = 1; //10; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA3.reportOnLeave = 1; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.hysteresis = 0.5; // FIXME ...hysteresis is of type long! ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger = TimeToTrigger_ms40; ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3); - ReportConfig_A4->reportConfigId = 5; ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present = @@ -1574,16 +1493,13 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( eventA4.a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA4.a4_Threshold.choice.threshold_RSRP = 10; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4); - ReportConfig_A5->reportConfigId = 6; ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present = @@ -1598,20 +1514,16 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( eventA5.a5_Threshold1.choice.threshold_RSRP = 10; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA5.a5_Threshold2.choice.threshold_RSRP = 10; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5); // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; - rsrp = CALLOC(1, sizeof(RSRP_Range_t)); *rsrp = 20; - Sparams = CALLOC(1, sizeof(*Sparams)); Sparams->present = MeasConfig__speedStatePars_PR_setup; Sparams->choice.setup.timeToTrigger_SF.sf_High = SpeedStateScaleFactors__sf_Medium_oDot75; @@ -1620,7 +1532,6 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5; Sparams->choice.setup.mobilityStateParameters.t_Evaluation = MobilityStateParameters__t_Evaluation_s60; Sparams->choice.setup.mobilityStateParameters.t_HystNormal = MobilityStateParameters__t_HystNormal_s120; - quantityConfig = CALLOC(1, sizeof(*quantityConfig)); memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct QuantityConfigEUTRA)); @@ -1634,7 +1545,6 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ))); *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4; *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4; - LOG_I(RRC, "[eNB %d] Frame %d: potential handover preparation: store the information in an intermediate structure in case of failure\n", ctxt_pP->module_id, ctxt_pP->frame); @@ -1648,15 +1558,14 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL; ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig = CALLOC(1, sizeof(*ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig)); - memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, + memcpy((void *)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, (void *)ue_context_pP->ue_context.mac_MainConfig, sizeof(MAC_MainConfig_t)); ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated = CALLOC(1, sizeof(PhysicalConfigDedicated_t)); - memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, - (void*)ue_context_pP->ue_context.physicalConfigDedicated, sizeof(PhysicalConfigDedicated_t)); + memcpy((void *)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, + (void *)ue_context_pP->ue_context.physicalConfigDedicated, sizeof(PhysicalConfigDedicated_t)); ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.sps_Config = NULL; //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config,(void *)rrc_inst->sps_Config[ue_mod_idP],sizeof(SPS_Config_t)); - } #ifdef CBA @@ -1684,7 +1593,6 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( } #endif - #if defined(ENABLE_ITTI) /* Initialize NAS list */ dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); @@ -1695,7 +1603,7 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); OCTET_STRING_fromBuf(dedicatedInfoNas, - (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, + (char *)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length); LOG_D(RRC, "Add dedicatedInfoNas(%d) to dedicatedInfoNASList\n", i); ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); @@ -1707,11 +1615,10 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; } - /* TODO should test if e RAB are Ok before! */ ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", - i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE"); + i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE"); } /* If list is empty free the list and reset the address */ @@ -1721,47 +1628,45 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( } #endif - // send RRCConnectionReconfiguration memset(buffer, 0, RRC_BUF_SIZE); - size = do_RRCConnectionReconfiguration(ctxt_pP, buffer, next_xid, //Transaction_id, - (SRB_ToAddModList_t*)*SRB_configList2, // SRB_configList - (DRB_ToAddModList_t*)DRB_configList, - (DRB_ToReleaseList_t*)NULL, // DRB2_list, - (struct SPS_Config*)NULL, // maybe ue_context_pP->ue_context.sps_Config, - (struct PhysicalConfigDedicated*)ue_context_pP->ue_context.physicalConfigDedicated, + (SRB_ToAddModList_t *)*SRB_configList2, // SRB_configList + (DRB_ToAddModList_t *)DRB_configList, + (DRB_ToReleaseList_t *)NULL, // DRB2_list, + (struct SPS_Config *)NULL, // maybe ue_context_pP->ue_context.sps_Config, + (struct PhysicalConfigDedicated *)ue_context_pP->ue_context.physicalConfigDedicated, #ifdef EXMIMO_IOT NULL, NULL, NULL,NULL, #else - (MeasObjectToAddModList_t*)MeasObj_list, // MeasObj_list, - (ReportConfigToAddModList_t*)ReportConfig_list, // ReportConfig_list, - (QuantityConfig_t*)quantityConfig, //quantityConfig, - (MeasIdToAddModList_t*)NULL, + (MeasObjectToAddModList_t *)MeasObj_list, // MeasObj_list, + (ReportConfigToAddModList_t *)ReportConfig_list, // ReportConfig_list, + (QuantityConfig_t *)quantityConfig, //quantityConfig, + (MeasIdToAddModList_t *)NULL, #endif - (MAC_MainConfig_t*)ue_context_pP->ue_context.mac_MainConfig, - (MeasGapConfig_t*)NULL, - (MobilityControlInfo_t*)NULL, - (struct MeasConfig__speedStatePars*)Sparams, // Sparams, - (RSRP_Range_t*)rsrp, // rsrp, - (C_RNTI_t*)cba_RNTI, // cba_RNTI - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList //dedicatedInfoNASList + (MAC_MainConfig_t *)ue_context_pP->ue_context.mac_MainConfig, + (MeasGapConfig_t *)NULL, + (MobilityControlInfo_t *)NULL, + (struct MeasConfig__speedStatePars *)Sparams, // Sparams, + (RSRP_Range_t *)rsrp, // rsrp, + (C_RNTI_t *)cba_RNTI, // cba_RNTI + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *)dedicatedInfoNASList //dedicatedInfoNASList #if defined(Rel10) || defined(Rel14) - , (SCellToAddMod_r10_t*)NULL + , (SCellToAddMod_r10_t *)NULL #endif ); - #ifdef RRC_MSG_PRINT LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n"); + for (i = 0; i < size; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); + LOG_F(RRC,"%02x ", ((uint8_t *)buffer)[i]); } + LOG_F(RRC,"\n"); //////////////////////////////////////// #endif - #if defined(ENABLE_ITTI) /* Free all NAS PDUs */ @@ -1774,15 +1679,12 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( } #endif - LOG_I(RRC, "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n", ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - LOG_D(RRC, "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, @@ -1793,51 +1695,56 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( ue_context_pP->ue_context.rnti, rrc_eNB_mui, size); - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); - + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); // delete UE data of prior RNTI. UE use current RNTI. protocol_ctxt_t ctxt_prior = *ctxt_pP; ctxt_prior.rnti = reestablish_rnti; - LTE_eNB_ULSCH_t *ulsch = NULL; nfapi_ul_config_request_body_t *ul_req_tmp = NULL; PHY_VARS_eNB *eNB_PHY = NULL; eNB_MAC_INST *eNB_MAC = RC.mac[ctxt_prior.module_id]; + for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { eNB_PHY = RC.eNB[ctxt_prior.module_id][CC_id]; + for (int i=0; iulsch[i]; - if((ulsch != NULL) && (ulsch->rnti == ctxt_prior.rnti)){ + + if((ulsch != NULL) && (ulsch->rnti == ctxt_prior.rnti)) { LOG_I(RRC, "clean_eNb_ulsch UE %x \n", ctxt_prior.rnti); clean_eNb_ulsch(ulsch); break; } } - for(int j = 0; j < 10; j++){ + for(int j = 0; j < 10; j++) { ul_req_tmp = &eNB_MAC->UL_req_tmp[CC_id][j].ul_config_request_body; - if(ul_req_tmp){ + + if(ul_req_tmp) { int pdu_number = ul_req_tmp->number_of_pdus; - for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--){ - if(ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == ctxt_prior.rnti){ + + for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--) { + if(ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == ctxt_prior.rnti) { LOG_I(RRC, "remove UE %x from ul_config_pdu_list %d/%d\n", ctxt_prior.rnti, pdu_index, pdu_number); - if(pdu_index < pdu_number -1){ - memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t)); + + if(pdu_index < pdu_number -1) { + memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t)); } + ul_req_tmp->number_of_pdus--; } } } } } + rrc_mac_remove_ue(ctxt_prior.module_id, ctxt_prior.rnti); rrc_rlc_remove_ue(&ctxt_prior); pdcp_remove_UE(&ctxt_prior); @@ -1846,8 +1753,8 @@ rrc_eNB_process_RRCConnectionReestablishmentComplete( //----------------------------------------------------------------------------- void rrc_eNB_generate_RRCConnectionReestablishmentReject( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, const int CC_id ) //----------------------------------------------------------------------------- @@ -1858,24 +1765,20 @@ rrc_eNB_generate_RRCConnectionReestablishmentReject( int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1; RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres = 20; - T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size = do_RRCConnectionReestablishmentReject(ctxt_pP->module_id, - (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload); - + (uint8_t *) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload); #ifdef RRC_MSG_PRINT LOG_F(RRC,"[MSG] RRCConnectionReestablishmentReject\n"); for (cnt = 0; cnt < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) { - LOG_F(RRC,"%02x ", ((uint8_t*)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload)[cnt]); + LOG_F(RRC,"%02x ", ((uint8_t *)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload)[cnt]); } LOG_F(RRC,"\n"); #endif - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, @@ -1885,7 +1788,6 @@ rrc_eNB_generate_RRCConnectionReestablishmentReject( MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReestablishmentReject (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), @@ -1895,26 +1797,22 @@ rrc_eNB_generate_RRCConnectionReestablishmentReject( //----------------------------------------------------------------------------- void rrc_eNB_generate_RRCConnectionRelease( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP ) //----------------------------------------------------------------------------- { - uint8_t buffer[RRC_BUF_SIZE]; uint16_t size; - T(T_ENB_RRC_CONNECTION_RELEASE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - memset(buffer, 0, RRC_BUF_SIZE); - size = do_RRCConnectionRelease(ctxt_pP->module_id, buffer,rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id)); // set release timer //ue_context_pP->ue_context.ue_release_timer=1; // remove UE after 10 frames after RRCConnectionRelease is triggered //ue_context_pP->ue_context.ue_release_timer_thres=100; - // set release timer + // set release timer ue_context_pP->ue_context.ue_release_timer_rrc = 1; // remove UE after 10 frames after RRCConnectionRelease is triggered ue_context_pP->ue_context.ue_release_timer_thres_rrc = 100; @@ -1925,14 +1823,12 @@ rrc_eNB_generate_RRCConnectionRelease( PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate RRCConnectionRelease (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), size); - LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (rrcConnectionRelease MUI %d) --->[PDCP][RB %u]\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), size, rrc_eNB_mui, DCCH); - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, @@ -1943,34 +1839,31 @@ rrc_eNB_generate_RRCConnectionRelease( ue_context_pP->ue_context.rnti, rrc_eNB_mui, size); - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); } -uint8_t qci_to_priority[9]={2,4,3,5,1,6,7,8,9}; +uint8_t qci_to_priority[9]= {2,4,3,5,1,6,7,8,9}; // TBD: this directive can be remived if we create a similar e_rab_param_t structure in RRC context -#if defined(ENABLE_ITTI) +#if defined(ENABLE_ITTI) //----------------------------------------------------------------------------- void -rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - const uint8_t ho_state - ) +rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + const uint8_t ho_state + ) //----------------------------------------------------------------------------- { - uint8_t buffer[RRC_BUF_SIZE]; uint16_t size; int i; - struct DRB_ToAddMod *DRB_config = NULL; struct RLC_Config *DRB_rlc_config = NULL; struct PDCP_Config *DRB_pdcp_config = NULL; @@ -1979,61 +1872,53 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* co struct LogicalChannelConfig *DRB_lchan_config = NULL; struct LogicalChannelConfig__ul_SpecificParameters *DRB_ul_SpecificParameters = NULL; - // DRB_ToAddModList_t** DRB_configList=&ue_context_pP->ue_context.DRB_configList; - DRB_ToAddModList_t* DRB_configList=ue_context_pP->ue_context.DRB_configList; - DRB_ToAddModList_t** DRB_configList2=NULL; + // DRB_ToAddModList_t** DRB_configList=&ue_context_pP->ue_context.DRB_configList; + DRB_ToAddModList_t *DRB_configList=ue_context_pP->ue_context.DRB_configList; + DRB_ToAddModList_t **DRB_configList2=NULL; //DRB_ToAddModList_t** RRC_DRB_configList=&ue_context_pP->ue_context.DRB_configList; - struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; DedicatedInfoNAS_t *dedicatedInfoNas = NULL; /* for no gcc warnings */ (void)dedicatedInfoNas; - long *logicalchannelgroup_drb; -// int drb_identity_index=0; - + // int drb_identity_index=0; uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); //Transaction_id, DRB_configList2=&ue_context_pP->ue_context.DRB_configList2[xid]; + if (*DRB_configList2) { free(*DRB_configList2); } + //*DRB_configList = CALLOC(1, sizeof(*DRB_configList)); - *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); + *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); /* Initialize NAS list */ dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); - int e_rab_done=0; - - for ( i = 0 ; - i < ue_context_pP->ue_context.setup_e_rabs ; - i++){ - if (e_rab_done >= ue_context_pP->ue_context.nb_of_e_rabs){ - break; + for ( i = 0 ; + i < ue_context_pP->ue_context.setup_e_rabs ; + i++) { + if (e_rab_done >= ue_context_pP->ue_context.nb_of_e_rabs) { + break; } - + // bypass the new and already configured erabs if (ue_context_pP->ue_context.e_rab[i].status >= E_RAB_STATUS_DONE) { -// drb_identity_index++; + // drb_identity_index++; continue; } - - DRB_config = CALLOC(1, sizeof(*DRB_config)); + DRB_config = CALLOC(1, sizeof(*DRB_config)); DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long)); // allowed value 5..15, value : x+4 - *(DRB_config->eps_BearerIdentity) = ue_context_pP->ue_context.e_rab[i].param.e_rab_id;//+ 4; // especial case generation - - // DRB_config->drb_Identity = 1 + drb_identity_index + e_rab_done;// + i ;// (DRB_Identity_t) ue_context_pP->ue_context.e_rab[i].param.e_rab_id; - // 1 + drb_identiy_index; + *(DRB_config->eps_BearerIdentity) = ue_context_pP->ue_context.e_rab[i].param.e_rab_id;//+ 4; // especial case generation + // DRB_config->drb_Identity = 1 + drb_identity_index + e_rab_done;// + i ;// (DRB_Identity_t) ue_context_pP->ue_context.e_rab[i].param.e_rab_id; + // 1 + drb_identiy_index; DRB_config->drb_Identity = i+1; - DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long)); *(DRB_config->logicalChannelIdentity) = DRB_config->drb_Identity + 2; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2 - DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config)); DRB_config->rlc_Config = DRB_rlc_config; - DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); DRB_config->pdcp_Config = DRB_pdcp_config; DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long)); @@ -2041,123 +1926,115 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* co DRB_pdcp_config->rlc_AM = NULL; DRB_pdcp_config->rlc_UM = NULL; - - switch (ue_context_pP->ue_context.e_rab[i].param.qos.qci){ + switch (ue_context_pP->ue_context.e_rab[i].param.qos.qci) { /* * type: realtime data with medium packer error rate * action: swtich to RLC UM */ - case 1: // 100ms, 10^-2, p2, GBR - case 2: // 150ms, 10^-3, p4, GBR - case 3: // 50ms, 10^-3, p3, GBR - case 4: // 300ms, 10^-6, p5 - case 7: // 100ms, 10^-3, p7, GBR - case 9: // 300ms, 10^-6, p9 - case 65: // 75ms, 10^-2, p0.7, mission critical voice, GBR - case 66: // 100ms, 10^-2, p2, non-mission critical voice , GBR - // RLC - DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; - DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; - // PDCP - PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); - DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; - PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; - break; - + case 1: // 100ms, 10^-2, p2, GBR + case 2: // 150ms, 10^-3, p4, GBR + case 3: // 50ms, 10^-3, p3, GBR + case 4: // 300ms, 10^-6, p5 + case 7: // 100ms, 10^-3, p7, GBR + case 9: // 300ms, 10^-6, p9 + case 65: // 75ms, 10^-2, p0.7, mission critical voice, GBR + case 66: // 100ms, 10^-2, p2, non-mission critical voice , GBR + // RLC + DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; + DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; + // PDCP + PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); + DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; + PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; + break; + /* * type: non-realtime data with low packer error rate * action: swtich to RLC AM */ - case 5: // 100ms, 10^-6, p1 , IMS signaling - case 6: // 300ms, 10^-6, p6 - case 8: // 300ms, 10^-6, p8 - case 69: // 60ms, 10^-6, p0.5, mission critical delay sensitive data, Lowest Priority - case 70: // 200ms, 10^-6, p5.5, mision critical data - // RLC - DRB_rlc_config->present = RLC_Config_PR_am; - DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50; - DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16; - DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; - DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; - DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; - DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25; + case 5: // 100ms, 10^-6, p1 , IMS signaling + case 6: // 300ms, 10^-6, p6 + case 8: // 300ms, 10^-6, p8 + case 69: // 60ms, 10^-6, p0.5, mission critical delay sensitive data, Lowest Priority + case 70: // 200ms, 10^-6, p5.5, mision critical data + // RLC + DRB_rlc_config->present = RLC_Config_PR_am; + DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50; + DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16; + DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; + DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; + DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; + DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25; + // PDCP + PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); + DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; + PDCP_rlc_AM->statusReportRequired = FALSE; + break; - // PDCP - PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); - DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; - PDCP_rlc_AM->statusReportRequired = FALSE; - - break; - default : - LOG_E(RRC,"not supported qci %d\n", ue_context_pP->ue_context.e_rab[i].param.qos.qci); - ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_FAILED; - ue_context_pP->ue_context.e_rab[i].xid = xid; - e_rab_done++; - continue; + default : + LOG_E(RRC,"not supported qci %d\n", ue_context_pP->ue_context.e_rab[i].param.qos.qci); + ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_FAILED; + ue_context_pP->ue_context.e_rab[i].xid = xid; + e_rab_done++; + continue; } DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; - DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config)); DRB_config->logicalChannelConfig = DRB_lchan_config; DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; if (ue_context_pP->ue_context.e_rab[i].param.qos.qci < 9 ) - DRB_ul_SpecificParameters->priority = qci_to_priority[ue_context_pP->ue_context.e_rab[i].param.qos.qci-1] + 3; + DRB_ul_SpecificParameters->priority = qci_to_priority[ue_context_pP->ue_context.e_rab[i].param.qos.qci-1] + 3; // ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.priority_level; - else + else DRB_ul_SpecificParameters->priority= 4; DRB_ul_SpecificParameters->prioritisedBitRate = LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8; - //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; DRB_ul_SpecificParameters->bucketSizeDuration = LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - logicalchannelgroup_drb = CALLOC(1, sizeof(long)); *logicalchannelgroup_drb = 1;//(i+1) % 3; DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; - ASN_SEQUENCE_ADD(&DRB_configList->list, DRB_config); ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config); //ue_context_pP->ue_context.DRB_configList2[drb_identity_index] = &(*DRB_configList); - LOG_I(RRC,"EPS ID %ld, DRB ID %ld (index %d), QCI %d, priority %ld, LCID %ld LCGID %ld \n", - *DRB_config->eps_BearerIdentity, - DRB_config->drb_Identity, i, - ue_context_pP->ue_context.e_rab[i].param.qos.qci, - DRB_ul_SpecificParameters->priority, - *(DRB_config->logicalChannelIdentity), - *DRB_ul_SpecificParameters->logicalChannelGroup - ); - + *DRB_config->eps_BearerIdentity, + DRB_config->drb_Identity, i, + ue_context_pP->ue_context.e_rab[i].param.qos.qci, + DRB_ul_SpecificParameters->priority, + *(DRB_config->logicalChannelIdentity), + *DRB_ul_SpecificParameters->logicalChannelGroup + ); e_rab_done++; - ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; + ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; ue_context_pP->ue_context.e_rab[i].xid = xid; - { if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { - dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); - memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); - OCTET_STRING_fromBuf(dedicatedInfoNas, - (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, - ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length); - ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); - LOG_I(RRC,"add NAS info with size %d (rab id %d)\n",ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length, i); - } - else { - LOG_W(RRC,"Not received activate dedicated EPS bearer context request\n"); + dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); + memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); + OCTET_STRING_fromBuf(dedicatedInfoNas, + (char *)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, + ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length); + ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); + LOG_I(RRC,"add NAS info with size %d (rab id %d)\n",ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length, i); } + else { + LOG_W(RRC,"Not received activate dedicated EPS bearer context request\n"); + } + /* TODO parameters yet to process ... */ { - // ue_context_pP->ue_context.e_rab[i].param.qos; - // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; - // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; + // ue_context_pP->ue_context.e_rab[i].param.qos; + // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; + // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; } } - } /* If list is empty free the list and reset the address */ @@ -2166,38 +2043,36 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* co free(dedicatedInfoNASList); dedicatedInfoNASList = NULL; LOG_W(RRC,"dedlicated NAS list is empty, free the list and reset the address\n"); - } + } } else { LOG_W(RRC,"dedlicated NAS list is empty\n"); } memset(buffer, 0, RRC_BUF_SIZE); - - size = do_RRCConnectionReconfiguration(ctxt_pP, - buffer, - xid, - (SRB_ToAddModList_t*)NULL, - (DRB_ToAddModList_t*)*DRB_configList2, - (DRB_ToReleaseList_t*)NULL, // DRB2_list, - (struct SPS_Config*)NULL, // *sps_Config, - NULL, NULL, NULL, NULL,NULL, - NULL, NULL, NULL, NULL, NULL, NULL, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList + size = do_RRCConnectionReconfiguration(ctxt_pP, + buffer, + xid, + (SRB_ToAddModList_t *)NULL, + (DRB_ToAddModList_t *)*DRB_configList2, + (DRB_ToReleaseList_t *)NULL, // DRB2_list, + (struct SPS_Config *)NULL, // *sps_Config, + NULL, NULL, NULL, NULL,NULL, + NULL, NULL, NULL, NULL, NULL, NULL, + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *)dedicatedInfoNASList #if defined(Rel10) || defined(Rel14) - , (SCellToAddMod_r10_t*)NULL + , (SCellToAddMod_r10_t *)NULL #endif ); - - #ifdef RRC_MSG_PRINT LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n"); + for (i = 0; i < size; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); + LOG_F(RRC,"%02x ", ((uint8_t *)buffer)[i]); } + LOG_F(RRC,"\n"); //////////////////////////////////////// #endif - #if defined(ENABLE_ITTI) /* Free all NAS PDUs */ @@ -2208,16 +2083,14 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* co ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL; } } -#endif - LOG_I(RRC, +#endif + LOG_I(RRC, "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE RNTI %x)\n", ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - LOG_D(RRC, "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, @@ -2228,7 +2101,6 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* co ue_context_pP->ue_context.rnti, rrc_eNB_mui, size); - rrc_data_req( ctxt_pP, DCCH, @@ -2237,20 +2109,17 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* co size, buffer, PDCP_TRANSMISSION_MODE_CONTROL); - - } int -rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - const uint8_t ho_state - ) +rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + const uint8_t ho_state + ) //----------------------------------------------------------------------------- { uint8_t buffer[RRC_BUF_SIZE]; uint16_t size; int i, j; - struct DRB_ToAddMod *DRB_config = NULL; struct RLC_Config *DRB_rlc_config = NULL; struct PDCP_Config *DRB_pdcp_config = NULL; @@ -2258,15 +2127,13 @@ rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* cons struct PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; struct LogicalChannelConfig *DRB_lchan_config = NULL; struct LogicalChannelConfig__ul_SpecificParameters - *DRB_ul_SpecificParameters = NULL; - DRB_ToAddModList_t* DRB_configList = ue_context_pP->ue_context.DRB_configList; - DRB_ToAddModList_t* DRB_configList2 = NULL; - + *DRB_ul_SpecificParameters = NULL; + DRB_ToAddModList_t *DRB_configList = ue_context_pP->ue_context.DRB_configList; + DRB_ToAddModList_t *DRB_configList2 = NULL; struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; DedicatedInfoNAS_t *dedicatedInfoNas = NULL; /* for no gcc warnings */ (void)dedicatedInfoNas; - uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); // Transaction_id, DRB_configList2 = CALLOC(1, sizeof(*DRB_configList2)); /* Initialize NAS list */ @@ -2287,6 +2154,7 @@ rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* cons } DRB_config = NULL; + // search exist DRB_config for (j = 0; j < DRB_configList->list.count; j++) { if((uint8_t)*(DRB_configList->list.array[j]->eps_BearerIdentity) == ue_context_pP->ue_context.modify_e_rab[i].param.e_rab_id) { @@ -2294,6 +2162,7 @@ rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* cons break; } } + if (NULL == DRB_config) { ue_context_pP->ue_context.modify_e_rab[i].xid = xid; ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_FAILED; @@ -2305,85 +2174,89 @@ rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* cons } DRB_rlc_config = DRB_config->rlc_Config; - DRB_pdcp_config = DRB_config->pdcp_Config; *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity; + switch (ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci) { - /* - * type: realtime data with medium packer error rate - * action: swtich to RLC UM - */ - case 1: // 100ms, 10^-2, p2, GBR - case 2: // 150ms, 10^-3, p4, GBR - case 3: // 50ms, 10^-3, p3, GBR - case 4: // 300ms, 10^-6, p5 - case 7: // 100ms, 10^-3, p7, GBR - case 9: // 300ms, 10^-6, p9 - case 65: // 75ms, 10^-2, p0.7, mission critical voice, GBR - case 66: // 100ms, 10^-2, p2, non-mission critical voice , GBR - // RLC - DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; - DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; - // PDCP - if (DRB_pdcp_config->rlc_AM) { - free(DRB_pdcp_config->rlc_AM); - DRB_pdcp_config->rlc_AM = NULL; - } - if (DRB_pdcp_config->rlc_UM) { - free(DRB_pdcp_config->rlc_UM); - DRB_pdcp_config->rlc_UM = NULL; - } - PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); - DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; - PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; - break; + /* + * type: realtime data with medium packer error rate + * action: swtich to RLC UM + */ + case 1: // 100ms, 10^-2, p2, GBR + case 2: // 150ms, 10^-3, p4, GBR + case 3: // 50ms, 10^-3, p3, GBR + case 4: // 300ms, 10^-6, p5 + case 7: // 100ms, 10^-3, p7, GBR + case 9: // 300ms, 10^-6, p9 + case 65: // 75ms, 10^-2, p0.7, mission critical voice, GBR + case 66: // 100ms, 10^-2, p2, non-mission critical voice , GBR + // RLC + DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; + DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; - /* - * type: non-realtime data with low packer error rate - * action: swtich to RLC AM - */ - case 5: // 100ms, 10^-6, p1 , IMS signaling - case 6: // 300ms, 10^-6, p6 - case 8: // 300ms, 10^-6, p8 - case 69: // 60ms, 10^-6, p0.5, mission critical delay sensitive data, Lowest Priority - case 70: // 200ms, 10^-6, p5.5, mision critical data - // RLC - DRB_rlc_config->present = RLC_Config_PR_am; - DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50; - DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16; - DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; - DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; - DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; - DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25; + // PDCP + if (DRB_pdcp_config->rlc_AM) { + free(DRB_pdcp_config->rlc_AM); + DRB_pdcp_config->rlc_AM = NULL; + } - // PDCP - if (DRB_pdcp_config->rlc_AM) { - free(DRB_pdcp_config->rlc_AM); - DRB_pdcp_config->rlc_AM = NULL; - } - if (DRB_pdcp_config->rlc_UM) { - free(DRB_pdcp_config->rlc_UM); - DRB_pdcp_config->rlc_UM = NULL; - } - PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); - DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; - PDCP_rlc_AM->statusReportRequired = FALSE; + if (DRB_pdcp_config->rlc_UM) { + free(DRB_pdcp_config->rlc_UM); + DRB_pdcp_config->rlc_UM = NULL; + } - break; - default : - LOG_E(RRC, "not supported qci %d\n", ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci); - ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_FAILED; - ue_context_pP->ue_context.modify_e_rab[i].xid = xid; - ue_context_pP->ue_context.modify_e_rab[i].cause = S1AP_CAUSE_RADIO_NETWORK; - ue_context_pP->ue_context.modify_e_rab[i].cause_value = 37;//S1ap_CauseRadioNetwork_not_supported_QCI_value; - ue_context_pP->ue_context.nb_of_failed_e_rabs++; - continue; + PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); + DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; + PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; + break; + + /* + * type: non-realtime data with low packer error rate + * action: swtich to RLC AM + */ + case 5: // 100ms, 10^-6, p1 , IMS signaling + case 6: // 300ms, 10^-6, p6 + case 8: // 300ms, 10^-6, p8 + case 69: // 60ms, 10^-6, p0.5, mission critical delay sensitive data, Lowest Priority + case 70: // 200ms, 10^-6, p5.5, mision critical data + // RLC + DRB_rlc_config->present = RLC_Config_PR_am; + DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50; + DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16; + DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; + DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; + DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; + DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25; + + // PDCP + if (DRB_pdcp_config->rlc_AM) { + free(DRB_pdcp_config->rlc_AM); + DRB_pdcp_config->rlc_AM = NULL; + } + + if (DRB_pdcp_config->rlc_UM) { + free(DRB_pdcp_config->rlc_UM); + DRB_pdcp_config->rlc_UM = NULL; + } + + PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); + DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; + PDCP_rlc_AM->statusReportRequired = FALSE; + break; + + default : + LOG_E(RRC, "not supported qci %d\n", ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci); + ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_FAILED; + ue_context_pP->ue_context.modify_e_rab[i].xid = xid; + ue_context_pP->ue_context.modify_e_rab[i].cause = S1AP_CAUSE_RADIO_NETWORK; + ue_context_pP->ue_context.modify_e_rab[i].cause_value = 37;//S1ap_CauseRadioNetwork_not_supported_QCI_value; + ue_context_pP->ue_context.nb_of_failed_e_rabs++; + continue; } DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; - DRB_lchan_config = DRB_config->logicalChannelConfig; DRB_ul_SpecificParameters = DRB_lchan_config->ul_SpecificParameters; @@ -2393,32 +2266,27 @@ rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* cons DRB_ul_SpecificParameters->priority= 4; DRB_ul_SpecificParameters->prioritisedBitRate = LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8; - DRB_ul_SpecificParameters->bucketSizeDuration = LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - ASN_SEQUENCE_ADD(&(DRB_configList2)->list, DRB_config); - LOG_I(RRC, "EPS ID %ld, DRB ID %ld (index %d), QCI %d, priority %ld, LCID %ld LCGID %ld \n", - *DRB_config->eps_BearerIdentity, - DRB_config->drb_Identity, i, - ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci, - DRB_ul_SpecificParameters->priority, - *(DRB_config->logicalChannelIdentity), - *DRB_ul_SpecificParameters->logicalChannelGroup - ); - + *DRB_config->eps_BearerIdentity, + DRB_config->drb_Identity, i, + ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci, + DRB_ul_SpecificParameters->priority, + *(DRB_config->logicalChannelIdentity), + *DRB_ul_SpecificParameters->logicalChannelGroup + ); //e_rab_done++; ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_DONE; ue_context_pP->ue_context.modify_e_rab[i].xid = xid; - { if (ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer != NULL) { dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); OCTET_STRING_fromBuf(dedicatedInfoNas, - (char*)ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer, - ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.length); + (char *)ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer, + ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.length); ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); LOG_I(RRC, "add NAS info with size %d (rab id %d)\n",ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.length, i); } @@ -2440,32 +2308,30 @@ rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* cons } memset(buffer, 0, RRC_BUF_SIZE); - size = do_RRCConnectionReconfiguration(ctxt_pP, - buffer, - xid, - (SRB_ToAddModList_t*)NULL, - (DRB_ToAddModList_t*)DRB_configList2, - (DRB_ToReleaseList_t*)NULL, // DRB2_list, - (struct SPS_Config*)NULL, // *sps_Config, - NULL, NULL, NULL, NULL,NULL, - NULL, NULL, NULL, NULL, NULL, NULL, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList + buffer, + xid, + (SRB_ToAddModList_t *)NULL, + (DRB_ToAddModList_t *)DRB_configList2, + (DRB_ToReleaseList_t *)NULL, // DRB2_list, + (struct SPS_Config *)NULL, // *sps_Config, + NULL, NULL, NULL, NULL,NULL, + NULL, NULL, NULL, NULL, NULL, NULL, + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *)dedicatedInfoNASList #if defined(Rel10) || defined(Rel14) - , (SCellToAddMod_r10_t*)NULL + , (SCellToAddMod_r10_t *)NULL #endif - ); - - + ); #ifdef RRC_MSG_PRINT LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n"); + for (i = 0; i < size; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); + LOG_F(RRC,"%02x ", ((uint8_t *)buffer)[i]); } + LOG_F(RRC,"\n"); //////////////////////////////////////// #endif - #if defined(ENABLE_ITTI) /* Free all NAS PDUs */ @@ -2476,16 +2342,14 @@ rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* cons ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer = NULL; } } -#endif - LOG_I(RRC, +#endif + LOG_I(RRC, "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE RNTI %x)\n", ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - LOG_D(RRC, "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, @@ -2496,7 +2360,6 @@ rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* cons ue_context_pP->ue_context.rnti, rrc_eNB_mui, size); - rrc_data_req( ctxt_pP, DCCH, @@ -2510,101 +2373,101 @@ rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* cons //----------------------------------------------------------------------------- void -rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release( const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - uint8_t xid, - uint32_t nas_length, - uint8_t* nas_buffer) +rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release( const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + uint8_t xid, + uint32_t nas_length, + uint8_t *nas_buffer) //----------------------------------------------------------------------------- { - uint8_t buffer[RRC_BUF_SIZE]; - int i; - uint16_t size = 0; - DRB_ToReleaseList_t** DRB_Release_configList2=NULL; - DRB_Identity_t* DRB_release; - struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; + uint8_t buffer[RRC_BUF_SIZE]; + int i; + uint16_t size = 0; + DRB_ToReleaseList_t **DRB_Release_configList2=NULL; + DRB_Identity_t *DRB_release; + struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; + DRB_Release_configList2=&ue_context_pP->ue_context.DRB_Release_configList2[xid]; - DRB_Release_configList2=&ue_context_pP->ue_context.DRB_Release_configList2[xid]; - if (*DRB_Release_configList2) { - free(*DRB_Release_configList2); + if (*DRB_Release_configList2) { + free(*DRB_Release_configList2); + } + + *DRB_Release_configList2 = CALLOC(1, sizeof(**DRB_Release_configList2)); + + for(i = 0; i < NB_RB_MAX; i++) { + if((ue_context_pP->ue_context.e_rab[i].status == E_RAB_STATUS_TORELEASE) && ue_context_pP->ue_context.e_rab[i].xid == xid) { + DRB_release = CALLOC(1, sizeof(DRB_Identity_t)); + *DRB_release = i+1; + ASN_SEQUENCE_ADD(&(*DRB_Release_configList2)->list, DRB_release); + //free(DRB_release); } - *DRB_Release_configList2 = CALLOC(1, sizeof(**DRB_Release_configList2)); + } - for(i = 0; i < NB_RB_MAX; i++){ - if((ue_context_pP->ue_context.e_rab[i].status == E_RAB_STATUS_TORELEASE) && ue_context_pP->ue_context.e_rab[i].xid == xid){ - DRB_release = CALLOC(1, sizeof(DRB_Identity_t)); - *DRB_release = i+1; - ASN_SEQUENCE_ADD(&(*DRB_Release_configList2)->list, DRB_release); - //free(DRB_release); - } - } + /* If list is empty free the list and reset the address */ + if (nas_length > 0) { + DedicatedInfoNAS_t *dedicatedInfoNas = NULL; + dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); + dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); + memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); + OCTET_STRING_fromBuf(dedicatedInfoNas, + (char *)nas_buffer, + nas_length); + ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); + LOG_I(RRC,"add NAS info with size %d\n",nas_length); + } else { + LOG_W(RRC,"dedlicated NAS list is empty\n"); + } - /* If list is empty free the list and reset the address */ - if (nas_length > 0) { - DedicatedInfoNAS_t *dedicatedInfoNas = NULL; - dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); - dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); - memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); - OCTET_STRING_fromBuf(dedicatedInfoNas, - (char*)nas_buffer, - nas_length); - ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); - LOG_I(RRC,"add NAS info with size %d\n",nas_length); - } else { - LOG_W(RRC,"dedlicated NAS list is empty\n"); - } - - memset(buffer, 0, RRC_BUF_SIZE); - size = do_RRCConnectionReconfiguration(ctxt_pP, - buffer, - xid, - NULL, - NULL, - (DRB_ToReleaseList_t*)*DRB_Release_configList2, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList + memset(buffer, 0, RRC_BUF_SIZE); + size = do_RRCConnectionReconfiguration(ctxt_pP, + buffer, + xid, + NULL, + NULL, + (DRB_ToReleaseList_t *)*DRB_Release_configList2, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *)dedicatedInfoNASList #if defined(Rel10) || defined(Rel14) - , (SCellToAddMod_r10_t*)NULL + , (SCellToAddMod_r10_t *)NULL #endif - ); - ue_context_pP->ue_context.e_rab_release_command_flag = 1; - + ); + ue_context_pP->ue_context.e_rab_release_command_flag = 1; #ifdef RRC_MSG_PRINT LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n"); + for (i = 0; i < size; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); + LOG_F(RRC,"%02x ", ((uint8_t *)buffer)[i]); } + LOG_F(RRC,"\n"); //////////////////////////////////////// #endif - #if defined(ENABLE_ITTI) + /* Free all NAS PDUs */ if (nas_length > 0) { - /* Free the NAS PDU buffer and invalidate it */ - free(nas_buffer); + /* Free the NAS PDU buffer and invalidate it */ + free(nas_buffer); } -#endif +#endif LOG_I(RRC, "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE RNTI %x)\n", ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - LOG_D(RRC, "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, @@ -2615,7 +2478,6 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release( const protocol_ ue_context_pP->ue_context.rnti, rrc_eNB_mui, size); - rrc_data_req( ctxt_pP, DCCH, @@ -2624,33 +2486,29 @@ rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release( const protocol_ size, buffer, PDCP_TRANSMISSION_MODE_CONTROL); - } -#endif +#endif //----------------------------------------------------------------------------- void -rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - const uint8_t ho_state - ) +rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + const uint8_t ho_state + ) //----------------------------------------------------------------------------- { uint8_t buffer[RRC_BUF_SIZE]; uint16_t size; int i; - // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE - eNB_RRC_INST* rrc_inst = RC.rrc[ctxt_pP->module_id]; - struct PhysicalConfigDedicated** physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; - + eNB_RRC_INST *rrc_inst = RC.rrc[ctxt_pP->module_id]; + struct PhysicalConfigDedicated **physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; struct SRB_ToAddMod *SRB2_config = NULL; struct SRB_ToAddMod__rlc_Config *SRB2_rlc_config = NULL; struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config = NULL; struct LogicalChannelConfig__ul_SpecificParameters - *SRB2_ul_SpecificParameters = NULL; - SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; + *SRB2_ul_SpecificParameters = NULL; + SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList; SRB_ToAddModList_t **SRB_configList2 = NULL; - struct DRB_ToAddMod *DRB_config = NULL; struct RLC_Config *DRB_rlc_config = NULL; struct PDCP_Config *DRB_pdcp_config = NULL; @@ -2658,10 +2516,10 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons struct PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; struct LogicalChannelConfig *DRB_lchan_config = NULL; struct LogicalChannelConfig__ul_SpecificParameters - *DRB_ul_SpecificParameters = NULL; - DRB_ToAddModList_t** DRB_configList = &ue_context_pP->ue_context.DRB_configList; - DRB_ToAddModList_t** DRB_configList2 = NULL; - MAC_MainConfig_t *mac_MainConfig = NULL; + *DRB_ul_SpecificParameters = NULL; + DRB_ToAddModList_t **DRB_configList = &ue_context_pP->ue_context.DRB_configList; + DRB_ToAddModList_t **DRB_configList2 = NULL; + MAC_MainConfig_t *mac_MainConfig = NULL; MeasObjectToAddModList_t *MeasObj_list = NULL; MeasObjectToAddMod_t *MeasObj = NULL; ReportConfigToAddModList_t *ReportConfig_list = NULL; @@ -2674,10 +2532,8 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons // uint8_t sCellIndexToAdd = rrc_find_free_SCell_index(enb_mod_idP, ue_mod_idP, 1); //uint8_t sCellIndexToAdd = 0; #endif - long *logicalchannelgroup, *logicalchannelgroup_drb; long *maxHARQ_Tx, *periodicBSR_Timer; - RSRP_Range_t *rsrp = NULL; struct MeasConfig__speedStatePars *Sparams = NULL; QuantityConfig_t *quantityConfig = NULL; @@ -2687,11 +2543,8 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons DedicatedInfoNAS_t *dedicatedInfoNas = NULL; /* for no gcc warnings */ (void)dedicatedInfoNas; - C_RNTI_t *cba_RNTI = NULL; - uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); //Transaction_id, - #ifdef CBA //struct PUSCH_CBAConfigDedicated_vlola *pusch_CBAConfigDedicated_vlola; uint8_t *cba_RNTI_buf; @@ -2717,24 +2570,22 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons } #endif - T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - // Configure SRB2 /// SRB2 SRB_configList2=&ue_context_pP->ue_context.SRB_configList2[xid]; + if (*SRB_configList2) { free(*SRB_configList2); } + *SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2)); memset(*SRB_configList2, 0, sizeof(**SRB_configList2)); SRB2_config = CALLOC(1, sizeof(*SRB2_config)); - SRB2_config->srb_Identity = 2; SRB2_rlc_config = CALLOC(1, sizeof(*SRB2_rlc_config)); SRB2_config->rlc_Config = SRB2_rlc_config; - SRB2_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; SRB2_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; @@ -2743,26 +2594,19 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t32; SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; - SRB2_lchan_config = CALLOC(1, sizeof(*SRB2_lchan_config)); SRB2_config->logicalChannelConfig = SRB2_lchan_config; - SRB2_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; - SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters)); - SRB2_ul_SpecificParameters->priority = 3; // let some priority for SRB1 and dedicated DRBs SRB2_ul_SpecificParameters->prioritisedBitRate = LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; SRB2_ul_SpecificParameters->bucketSizeDuration = LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - // LCG for CCCH and DCCH is 0 as defined in 36331 logicalchannelgroup = CALLOC(1, sizeof(long)); *logicalchannelgroup = 0; - SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; - SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters; // this list has the configuration for SRB1 and SRB2 ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); @@ -2775,21 +2619,20 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons if (*DRB_configList) { free(*DRB_configList); } + *DRB_configList = CALLOC(1, sizeof(**DRB_configList)); memset(*DRB_configList, 0, sizeof(**DRB_configList)); - // list for the configured DRB for a this xid DRB_configList2=&ue_context_pP->ue_context.DRB_configList2[xid]; + if (*DRB_configList2) { free(*DRB_configList2); } + *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); memset(*DRB_configList2, 0, sizeof(**DRB_configList2)); - - /// DRB DRB_config = CALLOC(1, sizeof(*DRB_config)); - DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long)); *(DRB_config->eps_BearerIdentity) = 5L; // LW set to first value, allowed value 5..15, value : x+4 // DRB_config->drb_Identity = (DRB_Identity_t) 1; //allowed values 1..32 @@ -2799,7 +2642,6 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons *(DRB_config->logicalChannelIdentity) = (long)3; // value : x+2 DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config)); DRB_config->rlc_Config = DRB_rlc_config; - #ifdef RRC_DEFAULT_RAB_IS_AM DRB_rlc_config->present = RLC_Config_PR_am; DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50; @@ -2818,18 +2660,15 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; #endif #endif - DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); DRB_config->pdcp_Config = DRB_pdcp_config; DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long)); *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity; DRB_pdcp_config->rlc_AM = NULL; DRB_pdcp_config->rlc_UM = NULL; - /* avoid gcc warnings */ (void)PDCP_rlc_AM; (void)PDCP_rlc_UM; - #ifdef RRC_DEFAULT_RAB_IS_AM // EXMIMO_IOT PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; @@ -2840,33 +2679,25 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; #endif DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; - DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config)); DRB_config->logicalChannelConfig = DRB_lchan_config; DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; - DRB_ul_SpecificParameters->priority = 12; // lower priority than srb1, srb2 and other dedicated bearer DRB_ul_SpecificParameters->prioritisedBitRate =LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ; - //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; DRB_ul_SpecificParameters->bucketSizeDuration = LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM) logicalchannelgroup_drb = CALLOC(1, sizeof(long)); *logicalchannelgroup_drb = 1; DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; - ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config); ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config); - //ue_context_pP->ue_context.DRB_configList2[0] = &(*DRB_configList); - mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig)); ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig; - mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config)); - maxHARQ_Tx = CALLOC(1, sizeof(long)); *maxHARQ_Tx = MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx; @@ -2875,20 +2706,13 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer; mac_MainConfig->ul_SCH_Config->retxBSR_Timer = RetxBSR_Timer_r12_sf320; mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE - mac_MainConfig->timeAlignmentTimerDedicated = TimeAlignmentTimer_infinity; - mac_MainConfig->drx_Config = NULL; - mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config)); - mac_MainConfig->phr_Config->present = MAC_MainConfig__phr_Config_PR_setup; mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes - mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes - mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB - #if defined(Rel10) || defined(Rel14) sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long)); *sr_ProhibitTimer_r9 = 0; // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR @@ -2904,62 +2728,63 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons if ((*physicalConfigDedicated)->antennaInfo) { (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.transmissionMode = rrc_inst->configuration.ue_TransmissionMode[0]; LOG_D(RRC,"Setting transmission mode to %ld+1\n",rrc_inst->configuration.ue_TransmissionMode[0]); + if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm3) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6; } else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2; - + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2; } else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4; } else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4; } } else { LOG_E(RRC,"antenna_info not present in physical_config_dedicated. Not reconfiguring!\n"); } + if ((*physicalConfigDedicated)->cqi_ReportConfig) { if ((rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) || - (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) || - (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6)) { - //feedback mode needs to be set as well - //TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable - printf("setting cqi reporting mode to rm31\n"); + (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) || + (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6)) { + //feedback mode needs to be set as well + //TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable + printf("setting cqi reporting mode to rm31\n"); #if defined(Rel10) || defined(Rel14) - *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportModeAperiodic_rm31; + *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportModeAperiodic_rm31; #else - *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportConfig__cqi_ReportModeAperiodic_rm31; // HLC CQI, no PMI + *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportConfig__cqi_ReportModeAperiodic_rm31; // HLC CQI, no PMI #endif } } @@ -2974,54 +2799,43 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons // Measurement ID list MeasId_list = CALLOC(1, sizeof(*MeasId_list)); memset((void *)MeasId_list, 0, sizeof(*MeasId_list)); - MeasId0 = CALLOC(1, sizeof(*MeasId0)); MeasId0->measId = 1; MeasId0->measObjectId = 1; MeasId0->reportConfigId = 1; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0); - MeasId1 = CALLOC(1, sizeof(*MeasId1)); MeasId1->measId = 2; MeasId1->measObjectId = 1; MeasId1->reportConfigId = 2; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1); - MeasId2 = CALLOC(1, sizeof(*MeasId2)); MeasId2->measId = 3; MeasId2->measObjectId = 1; MeasId2->reportConfigId = 3; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2); - MeasId3 = CALLOC(1, sizeof(*MeasId3)); MeasId3->measId = 4; MeasId3->measObjectId = 1; MeasId3->reportConfigId = 4; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3); - MeasId4 = CALLOC(1, sizeof(*MeasId4)); MeasId4->measId = 5; MeasId4->measObjectId = 1; MeasId4->reportConfigId = 5; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4); - MeasId5 = CALLOC(1, sizeof(*MeasId5)); MeasId5->measId = 6; MeasId5->measObjectId = 1; MeasId5->reportConfigId = 6; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5); - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; - // Add one EUTRA Measurement Object MeasObj_list = CALLOC(1, sizeof(*MeasObj_list)); memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list)); - // Configure MeasObject - MeasObj = CALLOC(1, sizeof(*MeasObj)); memset((void *)MeasObj, 0, sizeof(*MeasObj)); - MeasObj->measObjectId = 1; MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA; MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 3350; //band 7, 2.68GHz @@ -3033,10 +2847,8 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6; MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB - MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); - CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; // Add adjacent cell lists (6 per eNB) @@ -3045,28 +2857,19 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons CellToAdd->cellIndex = i + 1; CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i); CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0; - ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd); } ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj); // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; - // Report Configurations for periodical, A1-A5 events ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list)); - ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); - ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1)); - ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2)); - ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3)); - ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4)); - ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5)); - ReportConfig_per->reportConfigId = 1; ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = @@ -3078,9 +2881,7 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); - ReportConfig_A1->reportConfigId = 2; ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present = @@ -3091,15 +2892,13 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. a1_Threshold.choice.threshold_RSRP = 10; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1); - + if (ho_state == 1 /*HO_MEASURMENT */ ) { LOG_I(RRC, "[eNB %d] frame %d: requesting A2, A3, A4, A5, and A6 event reporting\n", ctxt_pP->module_id, ctxt_pP->frame); @@ -3113,39 +2912,32 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons eventA2.a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA2.a2_Threshold.choice.threshold_RSRP = 10; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2); - ReportConfig_A3->reportConfigId = 4; ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present = ReportConfigEUTRA__triggerType_PR_event; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = 1; //10; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA3.reportOnLeave = 1; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.hysteresis = 0.5; // FIXME ...hysteresis is of type long! ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger = TimeToTrigger_ms40; ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3); - ReportConfig_A4->reportConfigId = 5; ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present = @@ -3156,16 +2948,13 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons eventA4.a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA4.a4_Threshold.choice.threshold_RSRP = 10; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4); - ReportConfig_A5->reportConfigId = 6; ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present = @@ -3180,20 +2969,16 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons eventA5.a5_Threshold1.choice.threshold_RSRP = 10; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA5.a5_Threshold2.choice.threshold_RSRP = 10; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5); // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; - rsrp = CALLOC(1, sizeof(RSRP_Range_t)); *rsrp = 20; - Sparams = CALLOC(1, sizeof(*Sparams)); Sparams->present = MeasConfig__speedStatePars_PR_setup; Sparams->choice.setup.timeToTrigger_SF.sf_High = SpeedStateScaleFactors__sf_Medium_oDot75; @@ -3202,7 +2987,6 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5; Sparams->choice.setup.mobilityStateParameters.t_Evaluation = MobilityStateParameters__t_Evaluation_s60; Sparams->choice.setup.mobilityStateParameters.t_HystNormal = MobilityStateParameters__t_HystNormal_s120; - quantityConfig = CALLOC(1, sizeof(*quantityConfig)); memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct QuantityConfigEUTRA)); @@ -3216,7 +3000,6 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ))); *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4; *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4; - LOG_I(RRC, "[eNB %d] Frame %d: potential handover preparation: store the information in an intermediate structure in case of failure\n", ctxt_pP->module_id, ctxt_pP->frame); @@ -3230,15 +3013,14 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL; ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig = CALLOC(1, sizeof(*ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig)); - memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, + memcpy((void *)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, (void *)mac_MainConfig, sizeof(MAC_MainConfig_t)); ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated = CALLOC(1, sizeof(PhysicalConfigDedicated_t)); - memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, - (void*)ue_context_pP->ue_context.physicalConfigDedicated, sizeof(PhysicalConfigDedicated_t)); + memcpy((void *)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, + (void *)ue_context_pP->ue_context.physicalConfigDedicated, sizeof(PhysicalConfigDedicated_t)); ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.sps_Config = NULL; //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config,(void *)rrc_inst->sps_Config[ue_mod_idP],sizeof(SPS_Config_t)); - } #if defined(ENABLE_ITTI) @@ -3250,8 +3032,8 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); - OCTET_STRING_fromBuf(dedicatedInfoNas, - (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, + OCTET_STRING_fromBuf(dedicatedInfoNas, + (char *)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length); ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); } @@ -3262,11 +3044,10 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; } - /* TODO should test if e RAB are Ok before! */ ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; - LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", - i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE"); + LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", + i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE"); } /* If list is empty free the list and reset the address */ @@ -3276,46 +3057,44 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons } #endif - memset(buffer, 0, RRC_BUF_SIZE); - size = do_RRCConnectionReconfiguration(ctxt_pP, buffer, xid, //Transaction_id, - (SRB_ToAddModList_t*)*SRB_configList2, // SRB_configList - (DRB_ToAddModList_t*)*DRB_configList, - (DRB_ToReleaseList_t*)NULL, // DRB2_list, - (struct SPS_Config*)NULL, // *sps_Config, - (struct PhysicalConfigDedicated*)*physicalConfigDedicated, + (SRB_ToAddModList_t *)*SRB_configList2, // SRB_configList + (DRB_ToAddModList_t *)*DRB_configList, + (DRB_ToReleaseList_t *)NULL, // DRB2_list, + (struct SPS_Config *)NULL, // *sps_Config, + (struct PhysicalConfigDedicated *)*physicalConfigDedicated, #ifdef EXMIMO_IOT NULL, NULL, NULL,NULL, #else - (MeasObjectToAddModList_t*)MeasObj_list, - (ReportConfigToAddModList_t*)ReportConfig_list, - (QuantityConfig_t*)quantityConfig, - (MeasIdToAddModList_t*)MeasId_list, + (MeasObjectToAddModList_t *)MeasObj_list, + (ReportConfigToAddModList_t *)ReportConfig_list, + (QuantityConfig_t *)quantityConfig, + (MeasIdToAddModList_t *)MeasId_list, #endif - (MAC_MainConfig_t*)mac_MainConfig, - (MeasGapConfig_t*)NULL, - (MobilityControlInfo_t*)NULL, - (struct MeasConfig__speedStatePars*)Sparams, - (RSRP_Range_t*)rsrp, - (C_RNTI_t*)cba_RNTI, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList + (MAC_MainConfig_t *)mac_MainConfig, + (MeasGapConfig_t *)NULL, + (MobilityControlInfo_t *)NULL, + (struct MeasConfig__speedStatePars *)Sparams, + (RSRP_Range_t *)rsrp, + (C_RNTI_t *)cba_RNTI, + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *)dedicatedInfoNASList #if defined(Rel10) || defined(Rel14) - , (SCellToAddMod_r10_t*)NULL + , (SCellToAddMod_r10_t *)NULL #endif ); - #ifdef RRC_MSG_PRINT LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n"); + for (i = 0; i < size; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); + LOG_F(RRC,"%02x ", ((uint8_t *)buffer)[i]); } + LOG_F(RRC,"\n"); //////////////////////////////////////// #endif - #if defined(ENABLE_ITTI) /* Free all NAS PDUs */ @@ -3328,15 +3107,12 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons } #endif - LOG_I(RRC, "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n", ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - LOG_D(RRC, "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, @@ -3347,42 +3123,38 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons ue_context_pP->ue_context.rnti, rrc_eNB_mui, size); - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); } //----------------------------------------------------------------------------- void -flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - const uint8_t ho_state, - agent_reconf_rrc * trig_param - ) +flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + const uint8_t ho_state, + agent_reconf_rrc *trig_param + ) //----------------------------------------------------------------------------- { uint8_t buffer[RRC_BUF_SIZE]; uint16_t size; int i; - // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE - eNB_RRC_INST* rrc_inst = RC.rrc[ctxt_pP->module_id]; - struct PhysicalConfigDedicated** physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; - + eNB_RRC_INST *rrc_inst = RC.rrc[ctxt_pP->module_id]; + struct PhysicalConfigDedicated **physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; struct SRB_ToAddMod *SRB2_config = NULL; struct SRB_ToAddMod__rlc_Config *SRB2_rlc_config = NULL; struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config = NULL; struct LogicalChannelConfig__ul_SpecificParameters - *SRB2_ul_SpecificParameters = NULL; - SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; + *SRB2_ul_SpecificParameters = NULL; + SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList; SRB_ToAddModList_t **SRB_configList2 = NULL; - struct DRB_ToAddMod *DRB_config = NULL; struct RLC_Config *DRB_rlc_config = NULL; struct PDCP_Config *DRB_pdcp_config = NULL; @@ -3390,15 +3162,15 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt struct PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; struct LogicalChannelConfig *DRB_lchan_config = NULL; struct LogicalChannelConfig__ul_SpecificParameters - *DRB_ul_SpecificParameters = NULL; - DRB_ToAddModList_t** DRB_configList = &ue_context_pP->ue_context.DRB_configList; - DRB_ToAddModList_t** DRB_configList2 = NULL; - MAC_MainConfig_t *mac_MainConfig = NULL; + *DRB_ul_SpecificParameters = NULL; + DRB_ToAddModList_t **DRB_configList = &ue_context_pP->ue_context.DRB_configList; + DRB_ToAddModList_t **DRB_configList2 = NULL; + MAC_MainConfig_t *mac_MainConfig = NULL; MeasObjectToAddModList_t *MeasObj_list = NULL; MeasObjectToAddMod_t *MeasObj = NULL; ReportConfigToAddModList_t *ReportConfig_list = NULL; ReportConfigToAddMod_t *ReportConfig_per;//, *ReportConfig_A1, - // *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; + // *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; MeasIdToAddModList_t *MeasId_list = NULL; MeasIdToAddMod_t *MeasId0; //, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; #if Rel10 @@ -3406,10 +3178,8 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt // uint8_t sCellIndexToAdd = rrc_find_free_SCell_index(enb_mod_idP, ue_mod_idP, 1); //uint8_t sCellIndexToAdd = 0; #endif - long *logicalchannelgroup, *logicalchannelgroup_drb; long *maxHARQ_Tx, *periodicBSR_Timer; - RSRP_Range_t *rsrp = NULL; struct MeasConfig__speedStatePars *Sparams = NULL; QuantityConfig_t *quantityConfig = NULL; @@ -3419,11 +3189,8 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt DedicatedInfoNAS_t *dedicatedInfoNas = NULL; /* for no gcc warnings */ (void)dedicatedInfoNas; - C_RNTI_t *cba_RNTI = NULL; - uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); //Transaction_id, - #ifdef CBA //struct PUSCH_CBAConfigDedicated_vlola *pusch_CBAConfigDedicated_vlola; uint8_t *cba_RNTI_buf; @@ -3449,24 +3216,22 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt } #endif - T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - // Configure SRB2 /// SRB2 SRB_configList2=&ue_context_pP->ue_context.SRB_configList2[xid]; + if (*SRB_configList2) { free(*SRB_configList2); } + *SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2)); memset(*SRB_configList2, 0, sizeof(**SRB_configList2)); SRB2_config = CALLOC(1, sizeof(*SRB2_config)); - SRB2_config->srb_Identity = 2; SRB2_rlc_config = CALLOC(1, sizeof(*SRB2_rlc_config)); SRB2_config->rlc_Config = SRB2_rlc_config; - SRB2_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; SRB2_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; @@ -3475,26 +3240,19 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t32; SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; - SRB2_lchan_config = CALLOC(1, sizeof(*SRB2_lchan_config)); SRB2_config->logicalChannelConfig = SRB2_lchan_config; - SRB2_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; - SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters)); - SRB2_ul_SpecificParameters->priority = 3; // let some priority for SRB1 and dedicated DRBs SRB2_ul_SpecificParameters->prioritisedBitRate = LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; SRB2_ul_SpecificParameters->bucketSizeDuration = LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - // LCG for CCCH and DCCH is 0 as defined in 36331 logicalchannelgroup = CALLOC(1, sizeof(long)); *logicalchannelgroup = 0; - SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; - SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters; // this list has the configuration for SRB1 and SRB2 ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); @@ -3507,21 +3265,20 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt if (*DRB_configList) { free(*DRB_configList); } + *DRB_configList = CALLOC(1, sizeof(**DRB_configList)); memset(*DRB_configList, 0, sizeof(**DRB_configList)); - // list for the configured DRB for a this xid DRB_configList2=&ue_context_pP->ue_context.DRB_configList2[xid]; + if (*DRB_configList2) { free(*DRB_configList2); } + *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); memset(*DRB_configList2, 0, sizeof(**DRB_configList2)); - - /// DRB DRB_config = CALLOC(1, sizeof(*DRB_config)); - DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long)); *(DRB_config->eps_BearerIdentity) = 5L; // LW set to first value, allowed value 5..15, value : x+4 // DRB_config->drb_Identity = (DRB_Identity_t) 1; //allowed values 1..32 @@ -3531,7 +3288,6 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt *(DRB_config->logicalChannelIdentity) = (long)3; // value : x+2 DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config)); DRB_config->rlc_Config = DRB_rlc_config; - #ifdef RRC_DEFAULT_RAB_IS_AM DRB_rlc_config->present = RLC_Config_PR_am; DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50; @@ -3550,18 +3306,15 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; #endif #endif - DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); DRB_config->pdcp_Config = DRB_pdcp_config; DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long)); *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity; DRB_pdcp_config->rlc_AM = NULL; DRB_pdcp_config->rlc_UM = NULL; - /* avoid gcc warnings */ (void)PDCP_rlc_AM; (void)PDCP_rlc_UM; - #ifdef RRC_DEFAULT_RAB_IS_AM // EXMIMO_IOT PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; @@ -3572,33 +3325,25 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; #endif DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; - DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config)); DRB_config->logicalChannelConfig = DRB_lchan_config; DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; - DRB_ul_SpecificParameters->priority = 12; // lower priority than srb1, srb2 and other dedicated bearer DRB_ul_SpecificParameters->prioritisedBitRate =LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ; - //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; DRB_ul_SpecificParameters->bucketSizeDuration = LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM) logicalchannelgroup_drb = CALLOC(1, sizeof(long)); *logicalchannelgroup_drb = 1; DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; - ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config); ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config); - //ue_context_pP->ue_context.DRB_configList2[0] = &(*DRB_configList); - mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig)); // ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig; - mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config)); - maxHARQ_Tx = CALLOC(1, sizeof(long)); *maxHARQ_Tx = MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx; @@ -3607,20 +3352,13 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer; mac_MainConfig->ul_SCH_Config->retxBSR_Timer = RetxBSR_Timer_r12_sf320; mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE - mac_MainConfig->timeAlignmentTimerDedicated = TimeAlignmentTimer_infinity; - mac_MainConfig->drx_Config = NULL; - mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config)); - mac_MainConfig->phr_Config->present = MAC_MainConfig__phr_Config_PR_setup; mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes - mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes - mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB - #ifdef Rel10 sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long)); *sr_ProhibitTimer_r9 = 0; // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR @@ -3636,62 +3374,63 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt if ((*physicalConfigDedicated)->antennaInfo) { (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.transmissionMode = rrc_inst->configuration.ue_TransmissionMode[0]; LOG_D(RRC,"Setting transmission mode to %ld+1\n",rrc_inst->configuration.ue_TransmissionMode[0]); + if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm3) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6; } else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2; - + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2; } else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4; } else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4; } } else { LOG_E(RRC,"antenna_info not present in physical_config_dedicated. Not reconfiguring!\n"); } + if ((*physicalConfigDedicated)->cqi_ReportConfig) { if ((rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) || - (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) || - (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6)) { - //feedback mode needs to be set as well - //TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable - printf("setting cqi reporting mode to rm31\n"); + (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) || + (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6)) { + //feedback mode needs to be set as well + //TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable + printf("setting cqi reporting mode to rm31\n"); #if defined(Rel10) || defined(Rel14) - *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportModeAperiodic_rm31; + *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportModeAperiodic_rm31; #else - *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportConfig__cqi_ReportModeAperiodic_rm31; // HLC CQI, no PMI + *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportConfig__cqi_ReportModeAperiodic_rm31; // HLC CQI, no PMI #endif } } @@ -3706,25 +3445,19 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt // Measurement ID list MeasId_list = CALLOC(1, sizeof(*MeasId_list)); memset((void *)MeasId_list, 0, sizeof(*MeasId_list)); - MeasId0 = CALLOC(1, sizeof(*MeasId0)); MeasId0->measId = 1; MeasId0->measObjectId = 1; MeasId0->reportConfigId = 1; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0); - /* * Add one EUTRA Measurement Object */ - MeasObj_list = CALLOC(1, sizeof(*MeasObj_list)); memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list)); - - // Configure MeasObject - + // Configure MeasObject MeasObj = CALLOC(1, sizeof(*MeasObj)); memset((void *)MeasObj, 0, sizeof(*MeasObj)); - MeasObj->measObjectId = 1; MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA; MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 3350; //band 7, 2.68GHz @@ -3736,10 +3469,8 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6; MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB - MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); - CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; // Add adjacent cell lists (6 per eNB) @@ -3748,7 +3479,6 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt CellToAdd->cellIndex = i + 1; CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i); CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0; - ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd); } @@ -3759,78 +3489,51 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt /* RRC Strategy Measurement */ - - if (strcmp("one_shot", trig_param->trigger_policy) == 0){ - - trig_param->report_interval = 0; - trig_param->report_amount = 0; - + if (strcmp("one_shot", trig_param->trigger_policy) == 0) { + trig_param->report_interval = 0; + trig_param->report_amount = 0; } - - else if (strcmp("event_driven", trig_param->trigger_policy) == 0){ - - trig_param->report_interval = 6; - trig_param->report_amount = 2; - + else if (strcmp("event_driven", trig_param->trigger_policy) == 0) { + trig_param->report_interval = 6; + trig_param->report_amount = 2; } - - else if (strcmp("periodical", trig_param->trigger_policy) == 0){ - - trig_param->report_interval = 1; - trig_param->report_amount = 7; - + else if (strcmp("periodical", trig_param->trigger_policy) == 0) { + trig_param->report_interval = 1; + trig_param->report_amount = 7; } - else { - - LOG_E(FLEXRAN_AGENT, "There is something wrong on RRC agent!"); + LOG_E(FLEXRAN_AGENT, "There is something wrong on RRC agent!"); } - - ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list)); - ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); - - // Periodical Measurement Report - + // Periodical Measurement Report ReportConfig_per->reportConfigId = 1; ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_periodical; - - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose = - ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; - - // ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger = TimeToTrigger_ms40; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = trig_param->report_interval ;//ReportInterval_ms2048; // RRC counter frame- ms1024 is 1ms - - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = trig_param->report_amount; //ReportConfigEUTRA__reportAmount_r2; // put r1 to see once, r2 for 2 times and ... - - + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_periodical; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose = + ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; + // ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger = TimeToTrigger_ms40; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = trig_param->report_interval ;//ReportInterval_ms2048; // RRC counter frame- ms1024 is 1ms + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = trig_param->report_amount; //ReportConfigEUTRA__reportAmount_r2; // put r1 to see once, r2 for 2 times and ... ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); - - - - quantityConfig = CALLOC(1, sizeof(*quantityConfig)); - memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); - quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct QuantityConfigEUTRA)); - memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA)); - quantityConfig->quantityConfigCDMA2000 = NULL; - quantityConfig->quantityConfigGERAN = NULL; - quantityConfig->quantityConfigUTRA = NULL; - quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = - CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP))); - quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = - CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ))); - *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4; - *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4; - - + quantityConfig = CALLOC(1, sizeof(*quantityConfig)); + memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); + quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct QuantityConfigEUTRA)); + memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA)); + quantityConfig->quantityConfigCDMA2000 = NULL; + quantityConfig->quantityConfigGERAN = NULL; + quantityConfig->quantityConfigUTRA = NULL; + quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = + CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP))); + quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = + CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ))); + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4; + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4; #if defined(ENABLE_ITTI) /* Initialize NAS list */ dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); @@ -3840,23 +3543,22 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); - OCTET_STRING_fromBuf(dedicatedInfoNas, - (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, + OCTET_STRING_fromBuf(dedicatedInfoNas, + (char *)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length); ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); } /* TODO parameters yet to process ... */ // { - // ue_context_pP->ue_context.e_rab[i].param.qos; - // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; - // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; + // ue_context_pP->ue_context.e_rab[i].param.qos; + // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; + // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; // } - /* TODO should test if e RAB are Ok before! */ ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; - LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", - i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE"); + LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", + i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE"); } /* If list is empty free the list and reset the address */ @@ -3866,46 +3568,44 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt } #endif - memset(buffer, 0, RRC_BUF_SIZE); - size = do_RRCConnectionReconfiguration(ctxt_pP, buffer, xid, //Transaction_id, - (SRB_ToAddModList_t*)NULL, // SRB_configList - (DRB_ToAddModList_t*)NULL, - (DRB_ToReleaseList_t*)NULL, // DRB2_list, - (struct SPS_Config*)NULL, // *sps_Config, - (struct PhysicalConfigDedicated*)*physicalConfigDedicated, -// #ifdef EXMIMO_IOT -// NULL, NULL, NULL,NULL, -// #else - (MeasObjectToAddModList_t*)MeasObj_list, - (ReportConfigToAddModList_t*)ReportConfig_list, - (QuantityConfig_t*)quantityConfig, - (MeasIdToAddModList_t*)MeasId_list, -// #endif - (MAC_MainConfig_t*)mac_MainConfig, - (MeasGapConfig_t*)NULL, - (MobilityControlInfo_t*)NULL, - (struct MeasConfig__speedStatePars*)Sparams, - (RSRP_Range_t*)rsrp, - (C_RNTI_t*)cba_RNTI, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList + (SRB_ToAddModList_t *)NULL, // SRB_configList + (DRB_ToAddModList_t *)NULL, + (DRB_ToReleaseList_t *)NULL, // DRB2_list, + (struct SPS_Config *)NULL, // *sps_Config, + (struct PhysicalConfigDedicated *)*physicalConfigDedicated, + // #ifdef EXMIMO_IOT + // NULL, NULL, NULL,NULL, + // #else + (MeasObjectToAddModList_t *)MeasObj_list, + (ReportConfigToAddModList_t *)ReportConfig_list, + (QuantityConfig_t *)quantityConfig, + (MeasIdToAddModList_t *)MeasId_list, + // #endif + (MAC_MainConfig_t *)mac_MainConfig, + (MeasGapConfig_t *)NULL, + (MobilityControlInfo_t *)NULL, + (struct MeasConfig__speedStatePars *)Sparams, + (RSRP_Range_t *)rsrp, + (C_RNTI_t *)cba_RNTI, + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *)dedicatedInfoNASList #if defined(Rel10) || defined(Rel14) - , (SCellToAddMod_r10_t*)NULL + , (SCellToAddMod_r10_t *)NULL #endif ); - #ifdef RRC_MSG_PRINT LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n"); + for (i = 0; i < size; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); + LOG_F(RRC,"%02x ", ((uint8_t *)buffer)[i]); } + LOG_F(RRC,"\n"); //////////////////////////////////////// #endif - #if defined(ENABLE_ITTI) /* Free all NAS PDUs */ @@ -3918,15 +3618,12 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt } #endif - LOG_I(RRC, "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n", ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - LOG_D(RRC, "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, @@ -3937,31 +3634,28 @@ flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt ue_context_pP->ue_context.rnti, rrc_eNB_mui, size); - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); } //----------------------------------------------------------------------------- int rrc_eNB_generate_RRCConnectionReconfiguration_SCell( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, uint32_t dl_CarrierFreq_r10 ) //----------------------------------------------------------------------------- { - uint8_t size; uint8_t buffer[100]; - #if defined(Rel10) || defined(Rel14) uint8_t sCellIndexToAdd = 0; //one SCell so far @@ -3979,30 +3673,28 @@ rrc_eNB_generate_RRCConnectionReconfiguration_SCell( size = do_RRCConnectionReconfiguration(ctxt_pP, buffer, rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),//Transaction_id, - (SRB_ToAddModList_t*)NULL, - (DRB_ToAddModList_t*)NULL, - (DRB_ToReleaseList_t*)NULL, - (struct SPS_Config*)NULL, - (struct PhysicalConfigDedicated*)NULL, - (MeasObjectToAddModList_t*)NULL, - (ReportConfigToAddModList_t*)NULL, - (QuantityConfig_t*)NULL, - (MeasIdToAddModList_t*)NULL, - (MAC_MainConfig_t*)NULL, - (MeasGapConfig_t*)NULL, - (MobilityControlInfo_t*)NULL, - (struct MeasConfig__speedStatePars*)NULL, - (RSRP_Range_t*)NULL, - (C_RNTI_t*)NULL, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)NULL - + (SRB_ToAddModList_t *)NULL, + (DRB_ToAddModList_t *)NULL, + (DRB_ToReleaseList_t *)NULL, + (struct SPS_Config *)NULL, + (struct PhysicalConfigDedicated *)NULL, + (MeasObjectToAddModList_t *)NULL, + (ReportConfigToAddModList_t *)NULL, + (QuantityConfig_t *)NULL, + (MeasIdToAddModList_t *)NULL, + (MAC_MainConfig_t *)NULL, + (MeasGapConfig_t *)NULL, + (MobilityControlInfo_t *)NULL, + (struct MeasConfig__speedStatePars *)NULL, + (RSRP_Range_t *)NULL, + (C_RNTI_t *)NULL, + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *)NULL #if defined(Rel10) || defined(Rel14) , ue_context_pP->ue_context.sCell_config #endif ); LOG_I(RRC,"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n", ctxt_pP->module_id,ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_RRC_UE, @@ -4013,15 +3705,14 @@ rrc_eNB_generate_RRCConnectionReconfiguration_SCell( ue_context_pP->ue_context.rnti, rrc_eNB_mui, size); - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); return(0); } @@ -4029,64 +3720,62 @@ rrc_eNB_generate_RRCConnectionReconfiguration_SCell( //----------------------------------------------------------------------------- void rrc_eNB_process_MeasurementReport( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* ue_context_pP, - const MeasResults_t* const measResults2 + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *ue_context_pP, + const MeasResults_t *const measResults2 ) //----------------------------------------------------------------------------- { int i=0; int neighboring_cells=-1; - T(T_ENB_RRC_MEASUREMENT_REPORT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); if (measResults2 == NULL ) return; - - if (measResults2->measId > 0 ){ - if (ue_context_pP->ue_context.measResults == NULL) { - ue_context_pP->ue_context.measResults = CALLOC(1, sizeof(MeasResults_t)); - } - ue_context_pP->ue_context.measResults->measId=measResults2->measId; - ue_context_pP->ue_context.measResults->measResultPCell.rsrpResult=measResults2->measResultPCell.rsrpResult; - ue_context_pP->ue_context.measResults->measResultPCell.rsrqResult=measResults2->measResultPCell.rsrqResult; - LOG_D(RRC, "[eNB %d]Frame %d: UE %x (Measurement Id %d): RSRP of Source %ld\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId, ue_context_pP->ue_context.measResults->measResultPCell.rsrpResult-140); - LOG_D(RRC, "[eNB %d]Frame %d: UE %x (Measurement Id %d): RSRQ of Source %ld\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId, ue_context_pP->ue_context.measResults->measResultPCell.rsrqResult/2 - 20); - } - if (measResults2->measResultNeighCells == NULL) - return; - if (measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count > 0) { - neighboring_cells = measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count; - - if (ue_context_pP->ue_context.measResults->measResultNeighCells == NULL) { - - ue_context_pP->ue_context.measResults->measResultNeighCells = CALLOC(1, sizeof(*measResults2->measResultNeighCells)*neighboring_cells); - } - ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.count = neighboring_cells; - for (i=0; i < neighboring_cells; i++){ - memcpy (ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i], - measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[i], - sizeof(MeasResultListEUTRA_t)); - - LOG_D(RRC, "Physical Cell Id %d\n", - (int)ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->physCellId); - LOG_D(RRC, "RSRP of Target %d\n", - (int)*(ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrpResult)); - LOG_D(RRC, "RSRQ of Target %d\n", - (int)*(ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrqResult)); - } - } + if (measResults2->measId > 0 ) { + if (ue_context_pP->ue_context.measResults == NULL) { + ue_context_pP->ue_context.measResults = CALLOC(1, sizeof(MeasResults_t)); + } -// #if defined(Rel10) || defined(Rel14) + ue_context_pP->ue_context.measResults->measId=measResults2->measId; + ue_context_pP->ue_context.measResults->measResultPCell.rsrpResult=measResults2->measResultPCell.rsrpResult; + ue_context_pP->ue_context.measResults->measResultPCell.rsrqResult=measResults2->measResultPCell.rsrqResult; + LOG_D(RRC, "[eNB %d]Frame %d: UE %x (Measurement Id %d): RSRP of Source %ld\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId, ue_context_pP->ue_context.measResults->measResultPCell.rsrpResult-140); + LOG_D(RRC, "[eNB %d]Frame %d: UE %x (Measurement Id %d): RSRQ of Source %ld\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId, ue_context_pP->ue_context.measResults->measResultPCell.rsrqResult/2 - 20); + } - -// #else + if (measResults2->measResultNeighCells == NULL) + return; + + if (measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count > 0) { + neighboring_cells = measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count; + + if (ue_context_pP->ue_context.measResults->measResultNeighCells == NULL) { + ue_context_pP->ue_context.measResults->measResultNeighCells = CALLOC(1, sizeof(*measResults2->measResultNeighCells)*neighboring_cells); + } + + ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.count = neighboring_cells; + + for (i=0; i < neighboring_cells; i++) { + memcpy (ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i], + measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[i], + sizeof(MeasResultListEUTRA_t)); + LOG_D(RRC, "Physical Cell Id %d\n", + (int)ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->physCellId); + LOG_D(RRC, "RSRP of Target %d\n", + (int)*(ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrpResult)); + LOG_D(RRC, "RSRQ of Target %d\n", + (int)*(ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrqResult)); + } + } + + // #if defined(Rel10) || defined(Rel14) + // #else // LOG_I(RRC, "RSRP of Source %d\n", measResults2->measResultServCell.rsrpResult); // LOG_I(RRC, "RSRQ of Source %d\n", measResults2->measResultServCell.rsrqResult); -// #endif - + // #endif // if (ue_context_pP->ue_context.handover_info->ho_prepare != 0xF0) { // rrc_eNB_generate_HandoverPreparationInformation(ctxt_pP, // ue_context_pP, @@ -4096,33 +3785,29 @@ rrc_eNB_process_MeasurementReport( // LOG_D(RRC, "[eNB %d] Frame %d: Ignoring MeasReport from UE %x as Handover is in progress... \n", ctxt_pP->module_id, ctxt_pP->frame, // ctxt_pP->rnti); // } - //Look for IP address of the target eNB //Send Handover Request -> target eNB //Wait for Handover Acknowledgement <- target eNB //Send Handover Command - //x2delay(); // handover_request_x2(ue_mod_idP,enb_mod_idP,measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId); - // uint8_t buffer[100]; // int size=rrc_eNB_generate_Handover_Command_TeNB(0,0,buffer); // // send_check_message((char*)buffer,size); //send_handover_command(); - } //----------------------------------------------------------------------------- void rrc_eNB_generate_HandoverPreparationInformation( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, PhysCellId_t targetPhyId ) //----------------------------------------------------------------------------- { - struct rrc_eNB_ue_context_s* ue_context_target_p = NULL; + struct rrc_eNB_ue_context_s *ue_context_target_p = NULL; //uint8_t UE_id_target = -1; uint8_t mod_id_target = get_adjacent_cell_mod_id(targetPhyId); HANDOVER_INFO *handoverInfo = CALLOC(1, sizeof(*handoverInfo)); @@ -4132,30 +3817,24 @@ rrc_eNB_generate_HandoverPreparationInformation( struct PhysicalConfigDedicated **physicalConfigDedicated = &RC.rrc[enb_mod_idP]->physicalConfigDedicated[ue_mod_idP]; RadioResourceConfigDedicated_t *radioResourceConfigDedicated = CALLOC(1,sizeof(RadioResourceConfigDedicated_t)); */ - T(T_ENB_RRC_HANDOVER_PREPARATION_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - handoverInfo->as_config.antennaInfoCommon.antennaPortsCount = 0; //Not used 0- but check value handoverInfo->as_config.sourceDl_CarrierFreq = 36090; //Verify! - memcpy((void *)&handoverInfo->as_config.sourceMasterInformationBlock, - (void*)&RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.mib, sizeof(MasterInformationBlock_t)); + (void *)&RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.mib, sizeof(MasterInformationBlock_t)); memcpy((void *)&handoverInfo->as_config.sourceMeasConfig, - (void*)ue_context_pP->ue_context.measConfig, sizeof(MeasConfig_t)); - + (void *)ue_context_pP->ue_context.measConfig, sizeof(MeasConfig_t)); // FIXME handoverInfo not used... free( handoverInfo ); handoverInfo = 0; - //to be configured - memset((void*)&ue_context_pP->ue_context.handover_info->as_config.sourceSecurityAlgorithmConfig, + memset((void *)&ue_context_pP->ue_context.handover_info->as_config.sourceSecurityAlgorithmConfig, 0, sizeof(SecurityAlgorithmConfig_t)); - - memcpy((void*)&ue_context_pP->ue_context.handover_info->as_config.sourceSystemInformationBlockType1, - (void*)&RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.SIB1, sizeof(SystemInformationBlockType1_t)); - memcpy((void*)&ue_context_pP->ue_context.handover_info->as_config.sourceSystemInformationBlockType2, - (void*)&RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.SIB23, sizeof(SystemInformationBlockType2_t)); + memcpy((void *)&ue_context_pP->ue_context.handover_info->as_config.sourceSystemInformationBlockType1, + (void *)&RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.SIB1, sizeof(SystemInformationBlockType1_t)); + memcpy((void *)&ue_context_pP->ue_context.handover_info->as_config.sourceSystemInformationBlockType2, + (void *)&RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.SIB23, sizeof(SystemInformationBlockType2_t)); ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo = CALLOC(1, sizeof(ReestablishmentInfo_t)); ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->sourcePhysCellId = @@ -4194,11 +3873,11 @@ rrc_eNB_generate_HandoverPreparationInformation( mod_id_target); ue_context_target_p->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_target_p->ue_context.handover_info))); - memcpy((void*)&ue_context_target_p->ue_context.handover_info->as_context, - (void*)&ue_context_pP->ue_context.handover_info->as_context, + memcpy((void *)&ue_context_target_p->ue_context.handover_info->as_context, + (void *)&ue_context_pP->ue_context.handover_info->as_context, sizeof(AS_Context_t)); - memcpy((void*)&ue_context_target_p->ue_context.handover_info->as_config, - (void*)&ue_context_pP->ue_context.handover_info->as_config, + memcpy((void *)&ue_context_target_p->ue_context.handover_info->as_config, + (void *)&ue_context_pP->ue_context.handover_info->as_config, sizeof(AS_Config_t)); ue_context_target_p->ue_context.handover_info->ho_prepare = 0x00;// 0xFF; ue_context_target_p->ue_context.handover_info->ho_complete = 0; @@ -4208,11 +3887,9 @@ rrc_eNB_generate_HandoverPreparationInformation( ue_context_target_p->ue_context.handover_info->modid_t = mod_id_target; ue_context_target_p->ue_context.handover_info->modid_s = ctxt_pP->module_id; ue_context_target_p->ue_context.handover_info->ueid_t = ue_context_target_p->ue_context.rnti; - } else { LOG_E(RRC, "\nError in obtaining free UE id in target eNB %ld for handover \n", targetPhyId); } - } else { LOG_E(RRC, "\nError in obtaining Module ID of target eNB for handover \n"); } @@ -4221,15 +3898,13 @@ rrc_eNB_generate_HandoverPreparationInformation( //----------------------------------------------------------------------------- void rrc_eNB_process_handoverPreparationInformation( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP ) //----------------------------------------------------------------------------- { T(T_ENB_RRC_HANDOVER_PREPARATION_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - LOG_I(RRC, "[eNB %d] Frame %d : Logical Channel UL-DCCH, processing RRCHandoverPreparationInformation, sending RRCConnectionReconfiguration to UE %d \n", ctxt_pP->module_id, ctxt_pP->frame, ue_context_pP->ue_context.rnti); @@ -4244,12 +3919,12 @@ rrc_eNB_process_handoverPreparationInformation( //----------------------------------------------------------------------------- void check_handovers( - protocol_ctxt_t* const ctxt_pP + protocol_ctxt_t *const ctxt_pP ) //----------------------------------------------------------------------------- { int result; - struct rrc_eNB_ue_context_s* ue_context_p; + struct rrc_eNB_ue_context_s *ue_context_p; RB_FOREACH(ue_context_p, rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head) { ctxt_pP->rnti = ue_context_p->ue_id_rnti; @@ -4297,34 +3972,30 @@ check_handovers( //----------------------------------------------------------------------------- void rrc_eNB_generate_RRCConnectionReconfiguration_handover( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - uint8_t* const nas_pdu, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + uint8_t *const nas_pdu, const uint32_t nas_length ) //----------------------------------------------------------------------------- { T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - uint8_t buffer[RRC_BUF_SIZE]; uint16_t size; int i; uint8_t rv[2]; uint16_t Idx; // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE - eNB_RRC_INST* rrc_inst = RC.rrc[ctxt_pP->module_id]; - struct PhysicalConfigDedicated** physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; - + eNB_RRC_INST *rrc_inst = RC.rrc[ctxt_pP->module_id]; + struct PhysicalConfigDedicated **physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; struct SRB_ToAddMod *SRB2_config; struct SRB_ToAddMod__rlc_Config *SRB2_rlc_config; struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config; struct LogicalChannelConfig__ul_SpecificParameters *SRB2_ul_SpecificParameters; LogicalChannelConfig_t *SRB1_logicalChannelConfig = NULL; - SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; // not used in this context: may be removed + SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList; // not used in this context: may be removed SRB_ToAddModList_t *SRB_configList2; - struct DRB_ToAddMod *DRB_config; struct RLC_Config *DRB_rlc_config; struct PDCP_Config *DRB_pdcp_config; @@ -4332,7 +4003,6 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( struct LogicalChannelConfig *DRB_lchan_config; struct LogicalChannelConfig__ul_SpecificParameters *DRB_ul_SpecificParameters; DRB_ToAddModList_t *DRB_configList2; - MAC_MainConfig_t *mac_MainConfig; MeasObjectToAddModList_t *MeasObj_list; MeasObjectToAddMod_t *MeasObj; @@ -4349,10 +4019,8 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( #if defined(Rel10) || defined(Rel14) long *sr_ProhibitTimer_r9; #endif - long *logicalchannelgroup, *logicalchannelgroup_drb; long *maxHARQ_Tx, *periodicBSR_Timer; - // RSRP_Range_t *rsrp; struct MeasConfig__speedStatePars *Sparams; CellsToAddMod_t *CellToAdd; @@ -4366,7 +4034,6 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( PhysicalConfigDedicated_t *physicalConfigDedicated2; struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList; protocol_ctxt_t ctxt; - LOG_D(RRC, "[eNB %d] Frame %d: handover preparation: get the newSourceUEIdentity (C-RNTI): ", ctxt_pP->module_id, ctxt_pP->frame); @@ -4383,7 +4050,6 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( SRB1_config->srb_Identity = 1; SRB1_rlc_config = CALLOC(1, sizeof(*SRB1_rlc_config)); SRB1_config->rlc_Config = SRB1_rlc_config; - SRB1_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; SRB1_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; @@ -4392,35 +4058,25 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t16; SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; - SRB1_lchan_config = CALLOC(1, sizeof(*SRB1_lchan_config)); SRB1_config->logicalChannelConfig = SRB1_lchan_config; - SRB1_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; SRB1_ul_SpecificParameters = CALLOC(1, sizeof(*SRB1_ul_SpecificParameters)); - SRB1_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB1_ul_SpecificParameters; - SRB1_ul_SpecificParameters->priority = 1; - //assign_enum(&SRB1_ul_SpecificParameters->prioritisedBitRate,LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity); SRB1_ul_SpecificParameters->prioritisedBitRate = LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; - //assign_enum(&SRB1_ul_SpecificParameters->bucketSizeDuration,LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50); SRB1_ul_SpecificParameters->bucketSizeDuration = LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - logicalchannelgroup = CALLOC(1, sizeof(long)); *logicalchannelgroup = 0; SRB1_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; - ASN_SEQUENCE_ADD(&SRB_configList2->list, SRB1_config); - //2nd: now reconfigure phy config dedicated physicalConfigDedicated2 = CALLOC(1, sizeof(*physicalConfigDedicated2)); *physicalConfigDedicated = physicalConfigDedicated2; - physicalConfigDedicated2->pdsch_ConfigDedicated = CALLOC(1, sizeof(*physicalConfigDedicated2->pdsch_ConfigDedicated)); physicalConfigDedicated2->pucch_ConfigDedicated = @@ -4442,18 +4098,15 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( //assign_enum(&physicalConfigDedicated2->pdsch_ConfigDedicated->p_a, // PDSCH_ConfigDedicated__p_a_dB0); physicalConfigDedicated2->pdsch_ConfigDedicated->p_a = PDSCH_ConfigDedicated__p_a_dB0; - // PUCCH physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.present = PUCCH_ConfigDedicated__ackNackRepetition_PR_release; physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.choice.release = 0; physicalConfigDedicated2->pucch_ConfigDedicated->tdd_AckNackFeedbackMode = NULL; //PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing; - // Pusch_config_dedicated physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_ACK_Index = 0; // 2.00 physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_RI_Index = 0; // 1.25 physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_CQI_Index = 8; // 2.25 - // UplinkPowerControlDedicated physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUSCH = 0; // 0 dB //assign_enum(&physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled, @@ -4467,7 +4120,6 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( CALLOC(1, sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient)); // assign_enum(physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient,FilterCoefficient_fc4); // fc4 dB *physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient = FilterCoefficient_fc4; // fc4 dB - // TPC-PDCCH-Config physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->present = TPC_PDCCH_Config_PR_setup; physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.present = TPC_Index_PR_indexOfFormat3; @@ -4477,7 +4129,6 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf[0] = 0x12; physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf[1] = 0x34 + ue_context_pP->local_uid; physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.bits_unused = 0; - physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->present = TPC_PDCCH_Config_PR_setup; physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.present = TPC_Index_PR_indexOfFormat3; physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.choice.indexOfFormat3 = 1; @@ -4486,7 +4137,6 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[0] = 0x22; physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[1] = 0x34 + ue_context_pP->local_uid; physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.bits_unused = 0; - // CQI ReportConfig /* physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic)); @@ -4503,7 +4153,6 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex=NULL; physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI=0; */ - //soundingRS-UL-ConfigDedicated /* physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->present = SoundingRS_UL_ConfigDedicated_PR_setup; @@ -4518,7 +4167,6 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( assign_enum(&physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift, SoundingRS_UL_ConfigDedicated__setup__cyclicShift_cs0); */ - //AntennaInfoDedicated physicalConfigDedicated2->antennaInfo = CALLOC(1, sizeof(*physicalConfigDedicated2->antennaInfo)); physicalConfigDedicated2->antennaInfo->present = PhysicalConfigDedicated__antennaInfo_PR_explicitValue; @@ -4546,7 +4194,6 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.present = AntennaInfoDedicated__ue_TransmitAntennaSelection_PR_release; physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.release = 0; - // SchedulingRequestConfig physicalConfigDedicated2->schedulingRequestConfig->present = SchedulingRequestConfig_PR_setup; physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = ue_context_pP->local_uid; @@ -4556,24 +4203,24 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( 10); // Isr = 5 (every 10 subframes, offset=2+UE_id mod3) } else { switch (rrc_inst->carrier[0].sib1->tdd_Config->subframeAssignment) { - case 1: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid & 1) + (( - ue_context_pP->local_uid & 3) >> 1) * 5; // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 7 for UE2, 8 for UE3 , 2 for UE4 etc..) - break; + case 1: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid & 1) + (( + ue_context_pP->local_uid & 3) >> 1) * 5; // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 7 for UE2, 8 for UE3 , 2 for UE4 etc..) + break; - case 3: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid % - 3); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) - break; + case 3: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid % + 3); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) + break; - case 4: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid & - 1); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) - break; + case 4: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid & + 1); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) + break; - default: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7; // Isr = 5 (every 10 subframes, offset=2 for all UE0 etc..) - break; + default: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7; // Isr = 5 (every 10 subframes, offset=2 for all UE0 etc..) + break; } } @@ -4582,59 +4229,55 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( // assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = SchedulingRequestConfig__setup__dsr_TransMax_n4; physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = SchedulingRequestConfig__setup__dsr_TransMax_n4; - LOG_D(RRC, "handover_config [FRAME %05d][RRC_eNB][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 UE %x) --->][MAC_eNB][MOD %02d][]\n", ctxt_pP->frame, ctxt_pP->module_id, ue_context_pP->ue_context.rnti, ctxt_pP->module_id); rrc_mac_config_req_eNB( - ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, -#ifdef Rel14 -0, -#endif - ue_context_pP->ue_context.rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t*) NULL, + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, #ifdef Rel14 - (RadioResourceConfigCommonSIB_t*) NULL, + 0, #endif - ue_context_pP->ue_context.physicalConfigDedicated, -#if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + ue_context_pP->ue_context.rnti, + (BCCH_BCH_Message_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, +#ifdef Rel14 + (RadioResourceConfigCommonSIB_t *) NULL, #endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - 1, - SRB1_logicalChannelConfig, - ue_context_pP->ue_context.measGapConfig, - (TDD_Config_t*) NULL, - (MobilityControlInfo_t*) NULL, - (SchedulingInfoList_t*) NULL, - 0, - NULL, - NULL, - (MBSFN_SubframeConfigList_t *) NULL + ue_context_pP->ue_context.physicalConfigDedicated, #if defined(Rel10) || defined(Rel14) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + 1, + SRB1_logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (TDD_Config_t *) NULL, + (MobilityControlInfo_t *) NULL, + (SchedulingInfoList_t *) NULL, + 0, + NULL, + NULL, + (MBSFN_SubframeConfigList_t *) NULL +#if defined(Rel10) || defined(Rel14) + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL #endif # ifdef Rel14 - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL + , + (SystemInformationBlockType1_v1310_IEs_t *)NULL # endif - ); - + ); // Configure target eNB SRB2 /// SRB2 SRB2_config = CALLOC(1, sizeof(*SRB2_config)); SRB_configList2 = CALLOC(1, sizeof(*SRB_configList2)); memset(SRB_configList2, 0, sizeof(*SRB_configList2)); - SRB2_config->srb_Identity = 2; SRB2_rlc_config = CALLOC(1, sizeof(*SRB2_rlc_config)); SRB2_config->rlc_Config = SRB2_rlc_config; - SRB2_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; SRB2_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; @@ -4643,34 +4286,26 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t32; SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; - SRB2_lchan_config = CALLOC(1, sizeof(*SRB2_lchan_config)); SRB2_config->logicalChannelConfig = SRB2_lchan_config; - SRB2_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; - SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters)); - SRB2_ul_SpecificParameters->priority = 1; SRB2_ul_SpecificParameters->prioritisedBitRate = LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; SRB2_ul_SpecificParameters->bucketSizeDuration = LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - // LCG for CCCH and DCCH is 0 as defined in 36331 logicalchannelgroup = CALLOC(1, sizeof(long)); *logicalchannelgroup = 0; - SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters; ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); ASN_SEQUENCE_ADD(&SRB_configList2->list, SRB2_config); - // Configure target eNB DRB DRB_configList2 = CALLOC(1, sizeof(*DRB_configList2)); /// DRB DRB_config = CALLOC(1, sizeof(*DRB_config)); - //DRB_config->drb_Identity = (DRB_Identity_t) 1; //allowed values 1..32 // NN: this is the 1st DRB for this ue, so set it to 1 DRB_config->drb_Identity = (DRB_Identity_t) 1; // (ue_mod_idP+1); //allowed values 1..32 @@ -4682,7 +4317,6 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; - DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); DRB_config->pdcp_Config = DRB_pdcp_config; DRB_pdcp_config->discardTimer = NULL; @@ -4691,53 +4325,37 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; - DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config)); DRB_config->logicalChannelConfig = DRB_lchan_config; DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; - DRB_ul_SpecificParameters->priority = 2; // lower priority than srb1, srb2 DRB_ul_SpecificParameters->prioritisedBitRate = LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; DRB_ul_SpecificParameters->bucketSizeDuration = LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM) logicalchannelgroup_drb = CALLOC(1, sizeof(long)); *logicalchannelgroup_drb = 1; DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; - ASN_SEQUENCE_ADD(&DRB_configList2->list, DRB_config); - mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig)); ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig; - mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config)); - maxHARQ_Tx = CALLOC(1, sizeof(long)); *maxHARQ_Tx = MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx; - periodicBSR_Timer = CALLOC(1, sizeof(long)); *periodicBSR_Timer = PeriodicBSR_Timer_r12_sf64; mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer; - mac_MainConfig->ul_SCH_Config->retxBSR_Timer = RetxBSR_Timer_r12_sf320; - mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE - mac_MainConfig->drx_Config = NULL; - mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config)); - mac_MainConfig->phr_Config->present = MAC_MainConfig__phr_Config_PR_setup; mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes - mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes - mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB - #if defined(Rel10) || defined(Rel14) sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long)); *sr_ProhibitTimer_r9 = 0; // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR @@ -4748,54 +4366,43 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( // Measurement ID list MeasId_list = CALLOC(1, sizeof(*MeasId_list)); memset((void *)MeasId_list, 0, sizeof(*MeasId_list)); - MeasId0 = CALLOC(1, sizeof(*MeasId0)); MeasId0->measId = 1; MeasId0->measObjectId = 1; MeasId0->reportConfigId = 1; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0); - MeasId1 = CALLOC(1, sizeof(*MeasId1)); MeasId1->measId = 2; MeasId1->measObjectId = 1; MeasId1->reportConfigId = 2; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1); - MeasId2 = CALLOC(1, sizeof(*MeasId2)); MeasId2->measId = 3; MeasId2->measObjectId = 1; MeasId2->reportConfigId = 3; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2); - MeasId3 = CALLOC(1, sizeof(*MeasId3)); MeasId3->measId = 4; MeasId3->measObjectId = 1; MeasId3->reportConfigId = 4; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3); - MeasId4 = CALLOC(1, sizeof(*MeasId4)); MeasId4->measId = 5; MeasId4->measObjectId = 1; MeasId4->reportConfigId = 5; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4); - MeasId5 = CALLOC(1, sizeof(*MeasId5)); MeasId5->measId = 6; MeasId5->measObjectId = 1; MeasId5->reportConfigId = 6; ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5); - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; - // Add one EUTRA Measurement Object MeasObj_list = CALLOC(1, sizeof(*MeasObj_list)); memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list)); - // Configure MeasObject - MeasObj = CALLOC(1, sizeof(*MeasObj)); memset((void *)MeasObj, 0, sizeof(*MeasObj)); - MeasObj->measObjectId = 1; MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA; MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; @@ -4806,7 +4413,6 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6; MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB - MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; @@ -4817,28 +4423,19 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( CellToAdd->cellIndex = i + 1; CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i); CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0; - ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd); } ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj); // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; - // Report Configurations for periodical, A1-A5 events ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list)); - ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); - ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1)); - ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2)); - ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3)); - ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4)); - ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5)); - ReportConfig_per->reportConfigId = 1; ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = @@ -4850,9 +4447,7 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); - ReportConfig_A1->reportConfigId = 2; ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present = @@ -4863,15 +4458,12 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. a1_Threshold.choice.threshold_RSRP = 10; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1); - ReportConfig_A2->reportConfigId = 3; ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present = @@ -4882,15 +4474,12 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA2. a2_Threshold.choice.threshold_RSRP = 10; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2); - ReportConfig_A3->reportConfigId = 4; ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present = @@ -4901,15 +4490,12 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( 10; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA3.reportOnLeave = 1; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3); - ReportConfig_A4->reportConfigId = 5; ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present = @@ -4920,15 +4506,12 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA4. a4_Threshold.choice.threshold_RSRP = 10; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4); - ReportConfig_A5->reportConfigId = 6; ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present = @@ -4943,15 +4526,12 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( eventA5.a5_Threshold1.choice.threshold_RSRP = 10; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. eventA5.a5_Threshold2.choice.threshold_RSRP = 10; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5); - Sparams = CALLOC(1, sizeof(*Sparams)); Sparams->present = MeasConfig__speedStatePars_PR_setup; Sparams->choice.setup.timeToTrigger_SF.sf_High = SpeedStateScaleFactors__sf_Medium_oDot75; @@ -4960,7 +4540,6 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5; Sparams->choice.setup.mobilityStateParameters.t_Evaluation = MobilityStateParameters__t_Evaluation_s60; Sparams->choice.setup.mobilityStateParameters.t_HystNormal = MobilityStateParameters__t_HystNormal_s120; - quantityConfig = CALLOC(1, sizeof(*quantityConfig)); memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(*quantityConfig->quantityConfigEUTRA)); @@ -4974,9 +4553,7 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( CALLOC(1, sizeof(*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ)); *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4; *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4; - /* mobilityinfo */ - mobilityInfo = CALLOC(1, sizeof(*mobilityInfo)); memset((void *)mobilityInfo, 0, sizeof(*mobilityInfo)); mobilityInfo->targetPhysCellId = @@ -4987,22 +4564,17 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( mobilityInfo->targetPhysCellId, ctxt_pP->module_id, ue_context_pP->ue_context.rnti); - mobilityInfo->additionalSpectrumEmission = CALLOC(1, sizeof(*mobilityInfo->additionalSpectrumEmission)); *mobilityInfo->additionalSpectrumEmission = 1; //Check this value! - mobilityInfo->t304 = MobilityControlInfo__t304_ms50; // need to configure an appropriate value here - // New UE Identity (C-RNTI) to identify an UE uniquely in a cell mobilityInfo->newUE_Identity.size = 2; mobilityInfo->newUE_Identity.bits_unused = 0; mobilityInfo->newUE_Identity.buf = rv; mobilityInfo->newUE_Identity.buf[0] = rv[0]; mobilityInfo->newUE_Identity.buf[1] = rv[1]; - //memset((void *)&mobilityInfo->radioResourceConfigCommon,(void *)&rrc_inst->sib2->radioResourceConfigCommon,sizeof(RadioResourceConfigCommon_t)); //memset((void *)&mobilityInfo->radioResourceConfigCommon,0,sizeof(RadioResourceConfigCommon_t)); - // Configuring radioResourceConfigCommon mobilityInfo->radioResourceConfigCommon.rach_ConfigCommon = CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.rach_ConfigCommon)); @@ -5013,7 +4585,6 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( memcpy((void *)mobilityInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo, (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.prach_Config.prach_ConfigInfo, sizeof(PRACH_ConfigInfo_t)); - mobilityInfo->radioResourceConfigCommon.prach_Config.rootSequenceIndex = rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.prach_Config.rootSequenceIndex; mobilityInfo->radioResourceConfigCommon.pdsch_ConfigCommon = @@ -5045,31 +4616,27 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( mobilityInfo->radioResourceConfigCommon.ul_CyclicPrefixLength = rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.ul_CyclicPrefixLength; //End of configuration of radioResourceConfigCommon - mobilityInfo->carrierFreq = CALLOC(1, sizeof(*mobilityInfo->carrierFreq)); //CALLOC(1,sizeof(CarrierFreqEUTRA_t)); 36090 mobilityInfo->carrierFreq->dl_CarrierFreq = 36090; mobilityInfo->carrierFreq->ul_CarrierFreq = NULL; - mobilityInfo->carrierBandwidth = CALLOC(1, sizeof( *mobilityInfo->carrierBandwidth)); //CALLOC(1,sizeof(struct CarrierBandwidthEUTRA)); AllowedMeasBandwidth_mbw25 mobilityInfo->carrierBandwidth->dl_Bandwidth = CarrierBandwidthEUTRA__dl_Bandwidth_n25; mobilityInfo->carrierBandwidth->ul_Bandwidth = NULL; mobilityInfo->rach_ConfigDedicated = NULL; - // store the srb and drb list for ho management, mainly in case of failure - memcpy(ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.srb_ToAddModList, - (void*)SRB_configList2, + (void *)SRB_configList2, sizeof(SRB_ToAddModList_t)); - memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList, - (void*)DRB_configList2, + memcpy((void *)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList, + (void *)DRB_configList2, sizeof(DRB_ToAddModList_t)); ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL; - memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, - (void*)mac_MainConfig, + memcpy((void *)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, + (void *)mac_MainConfig, sizeof(MAC_MainConfig_t)); - memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, - (void*)ue_context_pP->ue_context.physicalConfigDedicated, + memcpy((void *)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, + (void *)ue_context_pP->ue_context.physicalConfigDedicated, sizeof(PhysicalConfigDedicated_t)); /* memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config, (void *)rrc_inst->sps_Config[ue_mod_idP], @@ -5084,19 +4651,15 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( ue_context_pP->ue_context.Srb1.Srb_info.Srb_id = Idx; memcpy(&ue_context_pP->ue_context.Srb1.Srb_info.Lchan_desc[0], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); memcpy(&ue_context_pP->ue_context.Srb1.Srb_info.Lchan_desc[1], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); - - // SRB2 + // SRB2 ue_context_pP->ue_context.Srb2.Active = 1; ue_context_pP->ue_context.Srb2.Srb_info.Srb_id = Idx; memcpy(&ue_context_pP->ue_context.Srb2.Srb_info.Lchan_desc[0], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); memcpy(&ue_context_pP->ue_context.Srb2.Srb_info.Lchan_desc[1], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); - LOG_I(RRC, "[eNB %d] CALLING RLC CONFIG SRB1 (rbid %d) for UE %x\n", ctxt_pP->module_id, Idx, ue_context_pP->ue_context.rnti); - // rrc_pdcp_config_req (enb_mod_idP, frameP, 1, CONFIG_ACTION_ADD, idx, UNDEF_SECURITY_MODE); // rrc_rlc_config_req(enb_mod_idP,frameP,1,CONFIG_ACTION_ADD,Idx,SIGNALLING_RADIO_BEARER,Rlc_info_am_config); - rrc_pdcp_config_asn1_req(&ctxt, ue_context_pP->ue_context.SRB_configList, (DRB_ToAddModList_t *) NULL, (DRB_ToReleaseList_t *) NULL, 0xff, NULL, NULL, NULL @@ -5104,7 +4667,6 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( , (PMCH_InfoList_r9_t *) NULL #endif ,NULL); - rrc_rlc_config_asn1_req(&ctxt, ue_context_pP->ue_context.SRB_configList, (DRB_ToAddModList_t *) NULL, (DRB_ToReleaseList_t *) NULL @@ -5112,13 +4674,10 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( , (PMCH_InfoList_r9_t *) NULL #endif ); - /* Initialize NAS list */ dedicatedInfoNASList = NULL; - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; memset(buffer, 0, RRC_BUF_SIZE); - size = do_RRCConnectionReconfiguration( ctxt_pP, buffer, @@ -5143,7 +4702,6 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( , NULL // SCellToAddMod_r10_t #endif ); - LOG_I(RRC, "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration for handover (bytes %d, UE rnti %x)\n", ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); @@ -5160,55 +4718,52 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; } */ - LOG_D(RRC, "[FRAME %05d][RRC_eNB][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration_handover to UE %x MUI %d) --->][PDCP][MOD %02d][RB %02d]\n", ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); //rrc_rlc_data_req(ctxt_pP->module_id,frameP, 1,(ue_mod_idP*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer); //pdcp_data_req (ctxt_pP->module_id, frameP, 1, (ue_mod_idP * NB_RB_MAX) + DCCH,rrc_eNB_mui++, 0, size, (char *) buffer, 1); - rrc_mac_config_req_eNB( - ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, -#ifdef Rel14 - 0, -#endif - ue_context_pP->ue_context.rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t *) NULL, + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, #ifdef Rel14 - (RadioResourceConfigCommonSIB_t *) NULL, + 0, #endif - ue_context_pP->ue_context.physicalConfigDedicated, -#if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + ue_context_pP->ue_context.rnti, + (BCCH_BCH_Message_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, +#ifdef Rel14 + (RadioResourceConfigCommonSIB_t *) NULL, #endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - 1, - SRB1_logicalChannelConfig, - ue_context_pP->ue_context.measGapConfig, - (TDD_Config_t *) NULL, - (MobilityControlInfo_t *) mobilityInfo, - (SchedulingInfoList_t *) NULL, 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL + ue_context_pP->ue_context.physicalConfigDedicated, #if defined(Rel10) || defined(Rel14) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + 1, + SRB1_logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (TDD_Config_t *) NULL, + (MobilityControlInfo_t *) mobilityInfo, + (SchedulingInfoList_t *) NULL, 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL +#if defined(Rel10) || defined(Rel14) + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL #endif # ifdef Rel14 - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL + , + (SystemInformationBlockType1_v1310_IEs_t *)NULL # endif - ); - + ); /* handoverCommand.criticalExtensions.present = HandoverCommand__criticalExtensions_PR_c1; handoverCommand.criticalExtensions.choice.c1.present = HandoverCommand__criticalExtensions__c1_PR_handoverCommand_r8; handoverCommand.criticalExtensions.choice.c1.choice.handoverCommand_r8.handoverCommandMessage.buf = buffer; handoverCommand.criticalExtensions.choice.c1.choice.handoverCommand_r8.handoverCommandMessage.size = size; */ -//#warning "COMPILATION PROBLEM" + //#warning "COMPILATION PROBLEM" #ifdef PROBLEM_COMPILATION_RESOLVED if (sourceModId != 0xFF) { @@ -5255,8 +4810,8 @@ rrc_eNB_generate_RRCConnectionReconfiguration_handover( //----------------------------------------------------------------------------- void rrc_eNB_process_RRCConnectionReconfigurationComplete( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* ue_context_pP, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *ue_context_pP, const uint8_t xid ) //----------------------------------------------------------------------------- @@ -5271,20 +4826,16 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( (void)dest_ip_offset; (void)ue_module_id; #endif - uint8_t *kRRCenc = NULL; uint8_t *kRRCint = NULL; uint8_t *kUPenc = NULL; ue_context_pP->ue_context.ue_reestablishment_timer = 0; - - DRB_ToAddModList_t* DRB_configList = ue_context_pP->ue_context.DRB_configList2[xid]; - SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList2[xid]; - DRB_ToReleaseList_t* DRB_Release_configList2 = ue_context_pP->ue_context.DRB_Release_configList2[xid]; - DRB_Identity_t* drb_id_p = NULL; - + DRB_ToAddModList_t *DRB_configList = ue_context_pP->ue_context.DRB_configList2[xid]; + SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList2[xid]; + DRB_ToReleaseList_t *DRB_Release_configList2 = ue_context_pP->ue_context.DRB_Release_configList2[xid]; + DRB_Identity_t *drb_id_p = NULL; T(T_ENB_RRC_CONNECTION_RECONFIGURATION_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - #if defined(ENABLE_SECURITY) /* Derive the keys from kenb */ @@ -5297,9 +4848,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( ue_context_pP->ue_context.kenb, &kRRCenc); derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm, ue_context_pP->ue_context.kenb, &kRRCint); - #endif - // Refresh SRBs/DRBs MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, @@ -5309,12 +4858,11 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( MSC_AS_TIME_FMT" CONFIG_REQ UE %x DRB (security unchanged)", MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP->ue_context.rnti); - rrc_pdcp_config_asn1_req( ctxt_pP, SRB_configList, //NULL, //LG-RK 14/05/2014 SRB_configList, - DRB_configList, -// (DRB_ToReleaseList_t *) NULL, + DRB_configList, + // (DRB_ToReleaseList_t *) NULL, DRB_Release_configList2, /*RC.rrc[ctxt_pP->module_id]->ciphering_algorithm[ue_mod_idP] | (RC.rrc[ctxt_pP->module_id]->integrity_algorithm[ue_mod_idP] << 4), @@ -5332,44 +4880,45 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( ctxt_pP, SRB_configList, // NULL, //LG-RK 14/05/2014 SRB_configList, DRB_configList, -// (DRB_ToReleaseList_t *) NULL + // (DRB_ToReleaseList_t *) NULL DRB_Release_configList2 #if defined(Rel10) || defined(Rel14) , (PMCH_InfoList_r9_t *) NULL #endif ); - + // set the SRB active in Ue context if (SRB_configList != NULL) { for (i = 0; (i < SRB_configList->list.count) && (i < 3); i++) { - if (SRB_configList->list.array[i]->srb_Identity == 1 ){ - ue_context_pP->ue_context.Srb1.Active=1; + if (SRB_configList->list.array[i]->srb_Identity == 1 ) { + ue_context_pP->ue_context.Srb1.Active=1; } else if (SRB_configList->list.array[i]->srb_Identity == 2 ) { - ue_context_pP->ue_context.Srb2.Active=1; - ue_context_pP->ue_context.Srb2.Srb_info.Srb_id=2; - LOG_I(RRC,"[eNB %d] Frame %d CC %d : SRB2 is now active\n", - ctxt_pP->module_id, - ctxt_pP->frame, - ue_context_pP->ue_context.primaryCC_id); + ue_context_pP->ue_context.Srb2.Active=1; + ue_context_pP->ue_context.Srb2.Srb_info.Srb_id=2; + LOG_I(RRC,"[eNB %d] Frame %d CC %d : SRB2 is now active\n", + ctxt_pP->module_id, + ctxt_pP->frame, + ue_context_pP->ue_context.primaryCC_id); } else { - LOG_W(RRC,"[eNB %d] Frame %d CC %d : invalide SRB identity %ld\n", - ctxt_pP->module_id, - ctxt_pP->frame, + LOG_W(RRC,"[eNB %d] Frame %d CC %d : invalide SRB identity %ld\n", + ctxt_pP->module_id, + ctxt_pP->frame, ue_context_pP->ue_context.primaryCC_id, - SRB_configList->list.array[i]->srb_Identity); + SRB_configList->list.array[i]->srb_Identity); } } + free(SRB_configList); ue_context_pP->ue_context.SRB_configList2[xid] = NULL; } - + // Loop through DRBs and establish if necessary if (DRB_configList != NULL) { for (i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8) if (DRB_configList->list.array[i]) { - drb_id = (int)DRB_configList->list.array[i]->drb_Identity; + drb_id = (int)DRB_configList->list.array[i]->drb_Identity; LOG_I(RRC, "[eNB %d] Frame %d : Logical Channel UL-DCCH, Received RRCConnectionReconfigurationComplete from UE rnti %x, reconfiguring DRB %d/LCID %d\n", ctxt_pP->module_id, @@ -5395,7 +4944,6 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( RADIO_ACCESS_BEARER,Rlc_info_um); */ ue_context_pP->ue_context.DRB_active[drb_id] = 1; - LOG_D(RRC, "[eNB %d] Frame %d: Establish RLC UM Bidirectional, DRB %d Active\n", ctxt_pP->module_id, ctxt_pP->frame, (int)DRB_configList->list.array[i]->drb_Identity); @@ -5430,7 +4978,6 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( # endif #endif - LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (DRB) ---> MAC_eNB\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); @@ -5440,43 +4987,41 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( } rrc_mac_config_req_eNB( - ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, -#ifdef Rel14 - 0, -#endif - ue_context_pP->ue_context.rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t *) NULL, + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, #ifdef Rel14 - (RadioResourceConfigCommonSIB_t *) NULL, + 0, #endif - ue_context_pP->ue_context.physicalConfigDedicated, -#if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + ue_context_pP->ue_context.rnti, + (BCCH_BCH_Message_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, +#ifdef Rel14 + (RadioResourceConfigCommonSIB_t *) NULL, #endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - DRB2LCHAN[i], - DRB_configList->list.array[i]->logicalChannelConfig, - ue_context_pP->ue_context.measGapConfig, - (TDD_Config_t *) NULL, - NULL, - (SchedulingInfoList_t *) NULL, - 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL + ue_context_pP->ue_context.physicalConfigDedicated, #if defined(Rel10) || defined(Rel14) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + DRB2LCHAN[i], + DRB_configList->list.array[i]->logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (TDD_Config_t *) NULL, + NULL, + (SchedulingInfoList_t *) NULL, + 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL +#if defined(Rel10) || defined(Rel14) + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL #endif # ifdef Rel14 - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL + , + (SystemInformationBlockType1_v1310_IEs_t *)NULL # endif - ); - + ); } else { // remove LCHAN from MAC/PHY - if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) { // DRB has just been removed so remove RLC + PDCP for DRB /* rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_REMOVE, @@ -5496,95 +5041,94 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete( PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (DRB) ---> MAC_eNB\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); rrc_mac_config_req_eNB(ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, -#ifdef Rel14 - 0, -#endif - ue_context_pP->ue_context.rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t *) NULL, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, #ifdef Rel14 - (RadioResourceConfigCommonSIB_t *) NULL, + 0, #endif - ue_context_pP->ue_context.physicalConfigDedicated, -#if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + ue_context_pP->ue_context.rnti, + (BCCH_BCH_Message_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, +#ifdef Rel14 + (RadioResourceConfigCommonSIB_t *) NULL, #endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - DRB2LCHAN[i], - (LogicalChannelConfig_t *) NULL, - (MeasGapConfig_t *) NULL, - (TDD_Config_t *) NULL, - NULL, - (SchedulingInfoList_t *) NULL, - 0, NULL, NULL, NULL + ue_context_pP->ue_context.physicalConfigDedicated, #if defined(Rel10) || defined(Rel14) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + DRB2LCHAN[i], + (LogicalChannelConfig_t *) NULL, + (MeasGapConfig_t *) NULL, + (TDD_Config_t *) NULL, + NULL, + (SchedulingInfoList_t *) NULL, + 0, NULL, NULL, NULL +#if defined(Rel10) || defined(Rel14) + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL #endif # ifdef Rel14 - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL + , + (SystemInformationBlockType1_v1310_IEs_t *)NULL # endif - ); + ); } } } - free(DRB_configList); + + free(DRB_configList); ue_context_pP->ue_context.DRB_configList2[xid] = NULL; } - if(DRB_Release_configList2 != NULL){ - for (i = 0; i < DRB_Release_configList2->list.count; i++) { - if (DRB_Release_configList2->list.array[i]) { - drb_id_p = DRB_Release_configList2->list.array[i]; - drb_id = *drb_id_p; - if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) { - ue_context_pP->ue_context.DRB_active[drb_id] = 0; - } - } + if(DRB_Release_configList2 != NULL) { + for (i = 0; i < DRB_Release_configList2->list.count; i++) { + if (DRB_Release_configList2->list.array[i]) { + drb_id_p = DRB_Release_configList2->list.array[i]; + drb_id = *drb_id_p; + + if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) { + ue_context_pP->ue_context.DRB_active[drb_id] = 0; + } } - free(DRB_Release_configList2); - ue_context_pP->ue_context.DRB_Release_configList2[xid] = NULL; + } + + free(DRB_Release_configList2); + ue_context_pP->ue_context.DRB_Release_configList2[xid] = NULL; } } //----------------------------------------------------------------------------- void rrc_eNB_generate_RRCConnectionSetup( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, const int CC_id ) //----------------------------------------------------------------------------- { - LogicalChannelConfig_t *SRB1_logicalChannelConfig; //,*SRB2_logicalChannelConfig; SRB_ToAddModList_t **SRB_configList; SRB_ToAddMod_t *SRB1_config; int cnt; - T(T_ENB_RRC_CONNECTION_SETUP, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - SRB_configList = &ue_context_pP->ue_context.SRB_configList; RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size = do_RRCConnectionSetup(ctxt_pP, ue_context_pP, CC_id, - (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, - (uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2 + (uint8_t *) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, + (uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2 rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), SRB_configList, &ue_context_pP->ue_context.physicalConfigDedicated); - #ifdef RRC_MSG_PRINT LOG_F(RRC,"[MSG] RRC Connection Setup\n"); for (cnt = 0; cnt < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) { - LOG_F(RRC,"%02x ", ((uint8_t*)RC.rrc[ctxt_pP->module_id]->Srb0.Tx_buffer.Payload)[cnt]); + LOG_F(RRC,"%02x ", ((uint8_t *)RC.rrc[ctxt_pP->module_id]->Srb0.Tx_buffer.Payload)[cnt]); } LOG_F(RRC,"\n"); @@ -5613,40 +5157,40 @@ rrc_eNB_generate_RRCConnectionSetup( PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_eNB\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); rrc_mac_config_req_eNB( - ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, -#ifdef Rel14 - 0, -#endif - ue_context_pP->ue_context.rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t *) NULL, + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, #ifdef Rel14 - (RadioResourceConfigCommonSIB_t *) NULL, + 0, #endif - ue_context_pP->ue_context.physicalConfigDedicated, -#if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, + ue_context_pP->ue_context.rnti, + (BCCH_BCH_Message_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, +#ifdef Rel14 + (RadioResourceConfigCommonSIB_t *) NULL, #endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - 1, - SRB1_logicalChannelConfig, - ue_context_pP->ue_context.measGapConfig, - (TDD_Config_t *) NULL, - NULL, - (SchedulingInfoList_t *) NULL, - 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL + ue_context_pP->ue_context.physicalConfigDedicated, #if defined(Rel10) || defined(Rel14) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + 1, + SRB1_logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (TDD_Config_t *) NULL, + NULL, + (SchedulingInfoList_t *) NULL, + 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL +#if defined(Rel10) || defined(Rel14) + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL #endif # ifdef Rel14 - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL + , + (SystemInformationBlockType1_v1310_IEs_t *)NULL # endif - ); + ); break; } } @@ -5661,21 +5205,18 @@ rrc_eNB_generate_RRCConnectionSetup( MSC_AS_TIME_ARGS(ctxt_pP), ue_context_pP->ue_context.rnti, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); - - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionSetup (bytes %d)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); - // activate release timer, if RRCSetupComplete not received after 10 frames, remove UE //ue_context_pP->ue_context.ue_release_timer=1; // remove UE after 10 frames after RRCConnectionRelease is triggered //ue_context_pP->ue_context.ue_release_timer_thres=100; - // activate release timer, if RRCSetupComplete not received after 100 frames, remove UE - ue_context_pP->ue_context.ue_release_timer=1; - // remove UE after 10 frames after RRCConnectionRelease is triggered - ue_context_pP->ue_context.ue_release_timer_thres=1000; + // activate release timer, if RRCSetupComplete not received after 100 frames, remove UE + ue_context_pP->ue_context.ue_release_timer=1; + // remove UE after 10 frames after RRCConnectionRelease is triggered + ue_context_pP->ue_context.ue_release_timer_thres=1000; } @@ -5684,7 +5225,7 @@ rrc_eNB_generate_RRCConnectionSetup( char openair_rrc_eNB_configuration( const module_id_t enb_mod_idP, - RrcConfigurationReq* configuration + RrcConfigurationReq *configuration ) #else char @@ -5696,18 +5237,18 @@ openair_rrc_eNB_init( { protocol_ctxt_t ctxt; int CC_id; - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, enb_mod_idP, ENB_FLAG_YES, NOT_A_RNTI, 0, 0,enb_mod_idP); LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Init...\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); - #if OCP_FRAMEWORK + while ( RC.rrc[enb_mod_idP] == NULL ) { LOG_E(RRC, "RC.rrc not yet initialized, waiting 1 second\n"); sleep(1); } -#endif + +#endif AssertFatal(RC.rrc[enb_mod_idP] != NULL, "RC.rrc not initialized!"); AssertFatal(NUMBER_OF_UE_MAX < (module_id_t)0xFFFFFFFFFFFFFFFF, " variable overflow"); #ifdef ENABLE_ITTI @@ -5739,22 +5280,15 @@ openair_rrc_eNB_init( // for (j = 0; j < (NUMBER_OF_UE_MAX + 1); j++) { // RC.rrc[enb_mod_idP]->Srb2[j].Active = 0; // } - - RC.rrc[ctxt.module_id]->initial_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); RC.rrc[ctxt.module_id]->s1ap_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); - memcpy(&RC.rrc[ctxt.module_id]->configuration,configuration,sizeof(RrcConfigurationReq)); - /// System Information INIT - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Checking release \n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); #if defined(Rel10) || defined(Rel14) - // can clear it at runtime RC.rrc[ctxt.module_id]->carrier[0].MBMS_flag = 0; - // This has to come from some top-level configuration // only CC_id 0 is logged #if defined(Rel10) @@ -5764,7 +5298,6 @@ openair_rrc_eNB_init( #endif PROTOCOL_RRC_CTXT_ARGS(&ctxt), RC.rrc[ctxt.module_id]->carrier[0].MBMS_flag); - #else LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Rel8 RRC\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); #endif @@ -5788,7 +5321,6 @@ openair_rrc_eNB_init( RC.rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[3], RC.rrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups); } - #endif for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { @@ -5798,32 +5330,33 @@ openair_rrc_eNB_init( , configuration #endif ); + for (int ue_id = 0; ue_id < NUMBER_OF_UE_MAX; ue_id++) { - RC.rrc[ctxt.module_id]->carrier[CC_id].sizeof_paging[ue_id] = 0; - RC.rrc[ctxt.module_id]->carrier[CC_id].paging[ue_id] = (uint8_t*) malloc16(256); + RC.rrc[ctxt.module_id]->carrier[CC_id].sizeof_paging[ue_id] = 0; + RC.rrc[ctxt.module_id]->carrier[CC_id].paging[ue_id] = (uint8_t *) malloc16(256); } } - rrc_init_global_param(); + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - #if defined(Rel10) || defined(Rel14) + switch (RC.rrc[ctxt.module_id]->carrier[CC_id].MBMS_flag) { - case 1: - case 2: - case 3: - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Configuring 1 MBSFN sync area\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); - RC.rrc[ctxt.module_id]->carrier[CC_id].num_mbsfn_sync_area = 1; - break; + case 1: + case 2: + case 3: + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Configuring 1 MBSFN sync area\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); + RC.rrc[ctxt.module_id]->carrier[CC_id].num_mbsfn_sync_area = 1; + break; - case 4: - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Configuring 2 MBSFN sync area\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); - RC.rrc[ctxt.module_id]->carrier[CC_id].num_mbsfn_sync_area = 2; - break; + case 4: + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Configuring 2 MBSFN sync area\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); + RC.rrc[ctxt.module_id]->carrier[CC_id].num_mbsfn_sync_area = 2; + break; - default: - RC.rrc[ctxt.module_id]->carrier[CC_id].num_mbsfn_sync_area = 0; - break; + default: + RC.rrc[ctxt.module_id]->carrier[CC_id].num_mbsfn_sync_area = 0; + break; } // if we are here the RC.rrc[enb_mod_idP]->MBMS_flag > 0, @@ -5833,21 +5366,19 @@ openair_rrc_eNB_init( /// MTCH data bearer init init_MBMS(ctxt.module_id, CC_id, 0); } -#endif +#endif openair_rrc_top_init_eNB(RC.rrc[ctxt.module_id]->carrier[CC_id].MBMS_flag,0); } openair_rrc_on(&ctxt); - return 0; - } /*------------------------------------------------------------------------------*/ int rrc_eNB_decode_ccch( - protocol_ctxt_t* const ctxt_pP, - const SRB_INFO* const Srb_info, + protocol_ctxt_t *const ctxt_pP, + const SRB_INFO *const Srb_info, const int CC_id ) //----------------------------------------------------------------------------- @@ -5855,21 +5386,18 @@ rrc_eNB_decode_ccch( module_id_t Idx; asn_dec_rval_t dec_rval; UL_CCCH_Message_t *ul_ccch_msg = NULL; - RRCConnectionRequest_r8_IEs_t* rrcConnectionRequest = NULL; - RRCConnectionReestablishmentRequest_r8_IEs_t* rrcConnectionReestablishmentRequest = NULL; + RRCConnectionRequest_r8_IEs_t *rrcConnectionRequest = NULL; + RRCConnectionReestablishmentRequest_r8_IEs_t *rrcConnectionReestablishmentRequest = NULL; int i, rval; - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; uint64_t random_value = 0; int stmsi_received = 0; - T(T_ENB_RRC_UL_CCCH_DATA_IN, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - //memset(ul_ccch_msg,0,sizeof(UL_CCCH_Message_t)); - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Decoding UL CCCH %x.%x.%x.%x.%x.%x (%p)\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ((uint8_t*) Srb_info->Rx_buffer.Payload)[0], + ((uint8_t *) Srb_info->Rx_buffer.Payload)[0], ((uint8_t *) Srb_info->Rx_buffer.Payload)[1], ((uint8_t *) Srb_info->Rx_buffer.Payload)[2], ((uint8_t *) Srb_info->Rx_buffer.Payload)[3], @@ -5878,15 +5406,15 @@ rrc_eNB_decode_ccch( dec_rval = uper_decode( NULL, &asn_DEF_UL_CCCH_Message, - (void**)&ul_ccch_msg, - (uint8_t*) Srb_info->Rx_buffer.Payload, + (void **)&ul_ccch_msg, + (uint8_t *) Srb_info->Rx_buffer.Payload, 100, 0, 0); /* -#if defined(ENABLE_ITTI) -# if defined(DISABLE_ITTI_XER_PRINT) + #if defined(ENABLE_ITTI) + # if defined(DISABLE_ITTI_XER_PRINT) { MessageDef *message_p; @@ -5895,7 +5423,7 @@ rrc_eNB_decode_ccch( itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, message_p); } -# else + # else { char message_string[10000]; size_t message_string_size; @@ -5911,8 +5439,8 @@ rrc_eNB_decode_ccch( itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); } } -# endif -#endif + # endif + #endif */ for (i = 0; i < 8; i++) { @@ -5927,452 +5455,440 @@ rrc_eNB_decode_ccch( } if (ul_ccch_msg->message.present == UL_CCCH_MessageType_PR_c1) { - switch (ul_ccch_msg->message.choice.c1.present) { + case UL_CCCH_MessageType__c1_PR_NOTHING: + LOG_I(RRC, + PROTOCOL_RRC_CTXT_FMT" Received PR_NOTHING on UL-CCCH-Message\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + break; - case UL_CCCH_MessageType__c1_PR_NOTHING: - LOG_I(RRC, - PROTOCOL_RRC_CTXT_FMT" Received PR_NOTHING on UL-CCCH-Message\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); - break; - - case UL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentRequest: - T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - + case UL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentRequest: + T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); #ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC Connection Reestablishment Request\n"); + LOG_F(RRC,"[MSG] RRC Connection Reestablishment Request\n"); - for (i = 0; i < Srb_info->Rx_buffer.payload_size; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)Srb_info->Rx_buffer.Payload)[i]); - } - - LOG_F(RRC,"\n"); -#endif - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT"MAC_eNB--- MAC_DATA_IND (rrcConnectionReestablishmentRequest on SRB0) --> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrcConnectionReestablishmentRequest = - &ul_ccch_msg->message.choice.c1.choice.rrcConnectionReestablishmentRequest.criticalExtensions.choice.rrcConnectionReestablishmentRequest_r8; - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest cause %s\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ((rrcConnectionReestablishmentRequest->reestablishmentCause == ReestablishmentCause_otherFailure) ? "Other Failure" : - (rrcConnectionReestablishmentRequest->reestablishmentCause == ReestablishmentCause_handoverFailure) ? "Handover Failure" : - "reconfigurationFailure")); - /*{ - uint64_t c_rnti = 0; - - memcpy(((uint8_t *) & c_rnti) + 3, rrcConnectionReestablishmentRequest.UE_identity.c_RNTI.buf, - rrcConnectionReestablishmentRequest.UE_identity.c_RNTI.size); - ue_mod_id = rrc_eNB_get_UE_index(enb_mod_idP, c_rnti); - } - - if ((RC.rrc[enb_mod_idP]->phyCellId == rrcConnectionReestablishmentRequest.UE_identity.physCellId) && - (ue_mod_id != UE_INDEX_INVALID)){ - rrc_eNB_generate_RRCConnectionReestablishment(enb_mod_idP, frameP, ue_mod_id); - }else { - rrc_eNB_generate_RRCConnectionReestablishmentReject(enb_mod_idP, frameP, ue_mod_id); - } - */ - /* reject all reestablishment attempts for the moment */ -// rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, -// rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti), -// CC_id); -{ - uint16_t c_rnti = 0; - - if (rrcConnectionReestablishmentRequest->ue_Identity.physCellId != RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId) { - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest ue_Identity.physCellId(%ld) is not equal to current physCellId(%d), let's reject the UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - rrcConnectionReestablishmentRequest->ue_Identity.physCellId, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId); - rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); - break; - } - LOG_D(RRC, "physCellId is %ld\n", rrcConnectionReestablishmentRequest->ue_Identity.physCellId); - - for (i = 0; i < rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.size; i++) { - LOG_D(RRC, "rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.buf[%d] = %x\n", - i, rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.buf[i]); - } - - if (rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI.size == 0 || - rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI.size > 2) { - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest c_RNTI range error, let's reject the UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); - break; - - } - - c_rnti = BIT_STRING_to_uint16(&rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI); - LOG_D(RRC, "c_rnti is %x\n", c_rnti); - - ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], c_rnti); - if (ue_context_p == NULL) { - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest without UE context, let's reject the UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); - break; - } - int UE_id = find_UE_id(ctxt_pP->module_id, c_rnti); - if(ue_context_p->ue_context.ue_reestablishment_timer > 0 || RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer > 0){ - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishment(Previous) don't complete, let's reject the UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); - break; - } - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" UE context: %p\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ue_context_p); - ue_context_p->ue_context.ul_failure_timer = 0; - ue_context_p->ue_context.ue_release_timer = 0; - ue_context_p->ue_context.ue_reestablishment_timer = 0; - ue_context_p->ue_context.ue_release_timer_s1 = 0; - ue_context_p->ue_context.ue_release_timer_rrc = 0; - - /* reset timers */ - ue_context_p->ue_context.ul_failure_timer = 0; - ue_context_p->ue_context.ue_release_timer = 0; - - // insert C-RNTI to map - for (i = 0; i < NUMBER_OF_UE_MAX; i++) { - if (reestablish_rnti_map[i][0] == 0) { - reestablish_rnti_map[i][0] = ctxt_pP->rnti; - reestablish_rnti_map[i][1] = c_rnti; - break; + for (i = 0; i < Srb_info->Rx_buffer.payload_size; i++) { + LOG_F(RRC,"%02x ", ((uint8_t *)Srb_info->Rx_buffer.Payload)[i]); } - } - LOG_D(RRC, "reestablish_rnti_map[%d] [0] %x, [1] %x\n", - i, reestablish_rnti_map[i][0], reestablish_rnti_map[i][1]); -#if defined(ENABLE_ITTI) - ue_context_p->ue_context.reestablishment_cause = rrcConnectionReestablishmentRequest->reestablishmentCause; - LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept connection reestablishment request from UE physCellId %ld cause %ld\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - rrcConnectionReestablishmentRequest->ue_Identity.physCellId, - ue_context_p->ue_context.reestablishment_cause); -#else - LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept connection restablishment request for UE\n", + LOG_F(RRC,"\n"); +#endif + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT"MAC_eNB--- MAC_DATA_IND (rrcConnectionReestablishmentRequest on SRB0) --> RRC_eNB\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); -#endif + rrcConnectionReestablishmentRequest = + &ul_ccch_msg->message.choice.c1.choice.rrcConnectionReestablishmentRequest.criticalExtensions.choice.rrcConnectionReestablishmentRequest_r8; + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest cause %s\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ((rrcConnectionReestablishmentRequest->reestablishmentCause == ReestablishmentCause_otherFailure) ? "Other Failure" : + (rrcConnectionReestablishmentRequest->reestablishmentCause == ReestablishmentCause_handoverFailure) ? "Handover Failure" : + "reconfigurationFailure")); + /*{ + uint64_t c_rnti = 0; -#ifndef NO_RRM - send_msg(&S_rrc, msg_rrc_MR_attach_ind(ctxt_pP->module_id, Mac_id)); -#else + memcpy(((uint8_t *) & c_rnti) + 3, rrcConnectionReestablishmentRequest.UE_identity.c_RNTI.buf, + rrcConnectionReestablishmentRequest.UE_identity.c_RNTI.size); + ue_mod_id = rrc_eNB_get_UE_index(enb_mod_idP, c_rnti); + } - ue_context_p->ue_context.primaryCC_id = CC_id; - - //LG COMMENT Idx = (ue_mod_idP * NB_RB_MAX) + DCCH; - Idx = DCCH; - // SRB1 - ue_context_p->ue_context.Srb1.Active = 1; - ue_context_p->ue_context.Srb1.Srb_info.Srb_id = Idx; - memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[0], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[1], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - - // SRB2: set it to go through SRB1 with id 1 (DCCH) - ue_context_p->ue_context.Srb2.Active = 1; - ue_context_p->ue_context.Srb2.Srb_info.Srb_id = Idx; - memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[0], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[1], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - - rrc_eNB_generate_RRCConnectionReestablishment(ctxt_pP, ue_context_p, CC_id); - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1 (rbid %d)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - Idx); - - MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, - MSC_PDCP_ENB, - NULL, - 0, - MSC_AS_TIME_FMT" CONFIG_REQ UE %x SRB", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti); - - rrc_pdcp_config_asn1_req(ctxt_pP, - ue_context_p->ue_context.SRB_configList, - (DRB_ToAddModList_t *) NULL, - (DRB_ToReleaseList_t*) NULL, - 0xff, - NULL, - NULL, - NULL -# if defined(Rel10) || defined(Rel14) - , (PMCH_InfoList_r9_t *) NULL -# endif - ,NULL); - - rrc_rlc_config_asn1_req(ctxt_pP, - ue_context_p->ue_context.SRB_configList, - (DRB_ToAddModList_t*) NULL, - (DRB_ToReleaseList_t*) NULL -# if defined(Rel10) || defined(Rel14) - , (PMCH_InfoList_r9_t *) NULL -# endif - ); -#endif //NO_RRM - } - break; - - case UL_CCCH_MessageType__c1_PR_rrcConnectionRequest: - T(T_ENB_RRC_CONNECTION_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC Connection Request\n"); - - for (i = 0; i < Srb_info->Rx_buffer.payload_size; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)Srb_info->Rx_buffer.Payload)[i]); - } - - LOG_F(RRC,"\n"); -#endif - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT"MAC_eNB --- MAC_DATA_IND (rrcConnectionRequest on SRB0) --> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[ctxt_pP->module_id], - ctxt_pP->rnti); - - if (ue_context_p != NULL) { - // erase content - rrc_eNB_free_mem_UE_context(ctxt_pP, ue_context_p); - - MSC_LOG_RX_DISCARDED_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Srb_info->Rx_buffer.Payload, - dec_rval.consumed, - MSC_AS_TIME_FMT" RRCConnectionRequest UE %x size %u (UE already in context)", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - dec_rval.consumed); - } else { - rrcConnectionRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.choice.rrcConnectionRequest_r8; + if ((RC.rrc[enb_mod_idP]->phyCellId == rrcConnectionReestablishmentRequest.UE_identity.physCellId) && + (ue_mod_id != UE_INDEX_INVALID)){ + rrc_eNB_generate_RRCConnectionReestablishment(enb_mod_idP, frameP, ue_mod_id); + }else { + rrc_eNB_generate_RRCConnectionReestablishmentReject(enb_mod_idP, frameP, ue_mod_id); + } + */ + /* reject all reestablishment attempts for the moment */ + // rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, + // rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti), + // CC_id); { - if (InitialUE_Identity_PR_randomValue == rrcConnectionRequest->ue_Identity.present) { - AssertFatal(rrcConnectionRequest->ue_Identity.choice.randomValue.size == 5, - "wrong InitialUE-Identity randomValue size, expected 5, provided %d", - rrcConnectionRequest->ue_Identity.choice.randomValue.size); - memcpy(((uint8_t*) & random_value) + 3, - rrcConnectionRequest->ue_Identity.choice.randomValue.buf, - rrcConnectionRequest->ue_Identity.choice.randomValue.size); - /* if there is already a registered UE (with another RNTI) with this random_value, - * the current one must be removed from MAC/PHY (zombie UE) - */ -#if 0 - if ((ue_context_p = rrc_eNB_ue_context_random_exist(ctxt_pP, random_value))) { - LOG_W(RRC, "new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n", - ctxt_pP->rnti, ue_context_p->ue_context.rnti, ctxt_pP->rnti); - rrc_mac_remove_ue(ctxt_pP->module_id, ctxt_pP->rnti); - ue_context_p = NULL; - return 0; - } else { - ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value); - } -#endif - if ((ue_context_p = rrc_eNB_ue_context_random_exist(ctxt_pP, random_value))) { - LOG_W(RRC, "new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n", - ctxt_pP->rnti, ue_context_p->ue_context.rnti, ue_context_p->ue_context.rnti); - ue_context_p->ue_context.ul_failure_timer = 20000; - } - ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value); - } else if (InitialUE_Identity_PR_s_TMSI == rrcConnectionRequest->ue_Identity.present) { - /* Save s-TMSI */ - S_TMSI_t s_TMSI = rrcConnectionRequest->ue_Identity.choice.s_TMSI; - mme_code_t mme_code = BIT_STRING_to_uint8(&s_TMSI.mmec); - m_tmsi_t m_tmsi = BIT_STRING_to_uint32(&s_TMSI.m_TMSI); - random_value = (((uint64_t)mme_code) << 32) | m_tmsi; - if ((ue_context_p = rrc_eNB_ue_context_stmsi_exist(ctxt_pP, mme_code, m_tmsi))) { - LOG_I(RRC," S-TMSI exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p,ue_context_p->ue_context.rnti,ctxt_pP->rnti); - rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti); - stmsi_received=1; - /* replace rnti in the context */ - /* for that, remove the context from the RB tree */ - RB_REMOVE(rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p); - /* and insert again, after changing rnti everywhere it has to be changed */ - ue_context_p->ue_id_rnti = ctxt_pP->rnti; - ue_context_p->ue_context.rnti = ctxt_pP->rnti; - RB_INSERT(rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p); - /* reset timers */ - ue_context_p->ue_context.ul_failure_timer = 0; - ue_context_p->ue_context.ue_release_timer = 0; - ue_context_p->ue_context.ue_reestablishment_timer = 0; - ue_context_p->ue_context.ue_release_timer_s1 = 0; - ue_context_p->ue_context.ue_release_timer_rrc = 0; - } else { - LOG_I(RRC," S-TMSI doesn't exist, setting Initialue_identity_s_TMSI.m_tmsi to %p => %x\n",ue_context_p,m_tmsi); -// ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, NOT_A_RANDOM_UE_IDENTITY); - ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP,random_value); - if (ue_context_p == NULL) - LOG_E(RRC, "%s:%d:%s: rrc_eNB_get_next_free_ue_context returned NULL\n", __FILE__, __LINE__, __FUNCTION__); - if (ue_context_p != NULL) { - ue_context_p->ue_context.Initialue_identity_s_TMSI.presence = TRUE; - ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code = mme_code; - ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi = m_tmsi; - } else { - /* TODO: do we have to break here? */ - //break; - } - } + uint16_t c_rnti = 0; - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Srb_info->Rx_buffer.Payload, - dec_rval.consumed, - MSC_AS_TIME_FMT" RRCConnectionRequest UE %x size %u (s-TMSI mmec %u m_TMSI %u random UE id (0x%" PRIx64 ")", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - dec_rval.consumed, - ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, - ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, - ue_context_p->ue_context.random_ue_identity); - } else { + if (rrcConnectionReestablishmentRequest->ue_Identity.physCellId != RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId) { LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionRequest without random UE identity or S-TMSI not supported, let's reject the UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrc_eNB_generate_RRCConnectionReject(ctxt_pP, - rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti), - CC_id); + PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest ue_Identity.physCellId(%ld) is not equal to current physCellId(%d), let's reject the UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + rrcConnectionReestablishmentRequest->ue_Identity.physCellId, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId); + rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); break; } + LOG_D(RRC, "physCellId is %ld\n", rrcConnectionReestablishmentRequest->ue_Identity.physCellId); + + for (i = 0; i < rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.size; i++) { + LOG_D(RRC, "rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.buf[%d] = %x\n", + i, rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.buf[i]); + } + + if (rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI.size == 0 || + rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI.size > 2) { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest c_RNTI range error, let's reject the UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); + break; + } + + c_rnti = BIT_STRING_to_uint16(&rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI); + LOG_D(RRC, "c_rnti is %x\n", c_rnti); + ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], c_rnti); + + if (ue_context_p == NULL) { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest without UE context, let's reject the UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); + break; + } + + int UE_id = find_UE_id(ctxt_pP->module_id, c_rnti); + + if(ue_context_p->ue_context.ue_reestablishment_timer > 0 || RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer > 0) { + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishment(Previous) don't complete, let's reject the UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); + break; + } + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" UE context: %p\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p); + ue_context_p->ue_context.ul_failure_timer = 0; + ue_context_p->ue_context.ue_release_timer = 0; + ue_context_p->ue_context.ue_reestablishment_timer = 0; + ue_context_p->ue_context.ue_release_timer_s1 = 0; + ue_context_p->ue_context.ue_release_timer_rrc = 0; + /* reset timers */ + ue_context_p->ue_context.ul_failure_timer = 0; + ue_context_p->ue_context.ue_release_timer = 0; + + // insert C-RNTI to map + for (i = 0; i < NUMBER_OF_UE_MAX; i++) { + if (reestablish_rnti_map[i][0] == 0) { + reestablish_rnti_map[i][0] = ctxt_pP->rnti; + reestablish_rnti_map[i][1] = c_rnti; + break; + } + } + + LOG_D(RRC, "reestablish_rnti_map[%d] [0] %x, [1] %x\n", + i, reestablish_rnti_map[i][0], reestablish_rnti_map[i][1]); +#if defined(ENABLE_ITTI) + ue_context_p->ue_context.reestablishment_cause = rrcConnectionReestablishmentRequest->reestablishmentCause; + LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept connection reestablishment request from UE physCellId %ld cause %ld\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + rrcConnectionReestablishmentRequest->ue_Identity.physCellId, + ue_context_p->ue_context.reestablishment_cause); +#else + LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept connection restablishment request for UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); +#endif +#ifndef NO_RRM + send_msg(&S_rrc, msg_rrc_MR_attach_ind(ctxt_pP->module_id, Mac_id)); +#else + ue_context_p->ue_context.primaryCC_id = CC_id; + //LG COMMENT Idx = (ue_mod_idP * NB_RB_MAX) + DCCH; + Idx = DCCH; + // SRB1 + ue_context_p->ue_context.Srb1.Active = 1; + ue_context_p->ue_context.Srb1.Srb_info.Srb_id = Idx; + memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[0], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[1], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + // SRB2: set it to go through SRB1 with id 1 (DCCH) + ue_context_p->ue_context.Srb2.Active = 1; + ue_context_p->ue_context.Srb2.Srb_info.Srb_id = Idx; + memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[0], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[1], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + rrc_eNB_generate_RRCConnectionReestablishment(ctxt_pP, ue_context_p, CC_id); + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1 (rbid %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + Idx); + MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, + MSC_PDCP_ENB, + NULL, + 0, + MSC_AS_TIME_FMT" CONFIG_REQ UE %x SRB", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti); + rrc_pdcp_config_asn1_req(ctxt_pP, + ue_context_p->ue_context.SRB_configList, + (DRB_ToAddModList_t *) NULL, + (DRB_ToReleaseList_t *) NULL, + 0xff, + NULL, + NULL, + NULL +# if defined(Rel10) || defined(Rel14) + , (PMCH_InfoList_r9_t *) NULL +# endif + ,NULL); + rrc_rlc_config_asn1_req(ctxt_pP, + ue_context_p->ue_context.SRB_configList, + (DRB_ToAddModList_t *) NULL, + (DRB_ToReleaseList_t *) NULL +# if defined(Rel10) || defined(Rel14) + , (PMCH_InfoList_r9_t *) NULL +# endif + ); +#endif //NO_RRM } + break; + + case UL_CCCH_MessageType__c1_PR_rrcConnectionRequest: + T(T_ENB_RRC_CONNECTION_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Request\n"); + + for (i = 0; i < Srb_info->Rx_buffer.payload_size; i++) { + LOG_F(RRC,"%02x ", ((uint8_t *)Srb_info->Rx_buffer.Payload)[i]); + } + + LOG_F(RRC,"\n"); +#endif LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" UE context: %p\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ue_context_p); + PROTOCOL_RRC_CTXT_UE_FMT"MAC_eNB --- MAC_DATA_IND (rrcConnectionRequest on SRB0) --> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + ue_context_p = rrc_eNB_get_ue_context( + RC.rrc[ctxt_pP->module_id], + ctxt_pP->rnti); if (ue_context_p != NULL) { - - -#if defined(ENABLE_ITTI) - ue_context_p->ue_context.establishment_cause = rrcConnectionRequest->establishmentCause; - ue_context_p->ue_context.reestablishment_cause = ReestablishmentCause_spare1; - if (stmsi_received==0) - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection from UE random UE identity (0x%" PRIx64 ") MME code %u TMSI %u cause %ld\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ue_context_p->ue_context.random_ue_identity, - ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, - ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, - ue_context_p->ue_context.establishment_cause); - else - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection from UE MME code %u TMSI %u cause %ld\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, - ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, - ue_context_p->ue_context.establishment_cause); -#else - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection for UE random UE identity (0x%" PRIx64 ")\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ue_context_p->ue_context.random_ue_identity); -#endif - if (stmsi_received == 0) - RC.rrc[ctxt_pP->module_id]->Nb_ue++; - + // erase content + rrc_eNB_free_mem_UE_context(ctxt_pP, ue_context_p); + MSC_LOG_RX_DISCARDED_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Srb_info->Rx_buffer.Payload, + dec_rval.consumed, + MSC_AS_TIME_FMT" RRCConnectionRequest UE %x size %u (UE already in context)", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + dec_rval.consumed); } else { - // no context available - if (rrc_agent_registered[ctxt_pP->module_id]) { - agent_rrc_xface[ctxt_pP->module_id]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, - ctxt_pP->rnti, - PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); - } - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Can't create new context for UE random UE identity (0x%" PRIx64 ")\n", + rrcConnectionRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.choice.rrcConnectionRequest_r8; + { + if (InitialUE_Identity_PR_randomValue == rrcConnectionRequest->ue_Identity.present) { + AssertFatal(rrcConnectionRequest->ue_Identity.choice.randomValue.size == 5, + "wrong InitialUE-Identity randomValue size, expected 5, provided %d", + rrcConnectionRequest->ue_Identity.choice.randomValue.size); + memcpy(((uint8_t *) & random_value) + 3, + rrcConnectionRequest->ue_Identity.choice.randomValue.buf, + rrcConnectionRequest->ue_Identity.choice.randomValue.size); + /* if there is already a registered UE (with another RNTI) with this random_value, + * the current one must be removed from MAC/PHY (zombie UE) + */ +#if 0 + + if ((ue_context_p = rrc_eNB_ue_context_random_exist(ctxt_pP, random_value))) { + LOG_W(RRC, "new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n", + ctxt_pP->rnti, ue_context_p->ue_context.rnti, ctxt_pP->rnti); + rrc_mac_remove_ue(ctxt_pP->module_id, ctxt_pP->rnti); + ue_context_p = NULL; + return 0; + } else { + ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value); + } + +#endif + + if ((ue_context_p = rrc_eNB_ue_context_random_exist(ctxt_pP, random_value))) { + LOG_W(RRC, "new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n", + ctxt_pP->rnti, ue_context_p->ue_context.rnti, ue_context_p->ue_context.rnti); + ue_context_p->ue_context.ul_failure_timer = 20000; + } + + ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value); + } else if (InitialUE_Identity_PR_s_TMSI == rrcConnectionRequest->ue_Identity.present) { + /* Save s-TMSI */ + S_TMSI_t s_TMSI = rrcConnectionRequest->ue_Identity.choice.s_TMSI; + mme_code_t mme_code = BIT_STRING_to_uint8(&s_TMSI.mmec); + m_tmsi_t m_tmsi = BIT_STRING_to_uint32(&s_TMSI.m_TMSI); + random_value = (((uint64_t)mme_code) << 32) | m_tmsi; + + if ((ue_context_p = rrc_eNB_ue_context_stmsi_exist(ctxt_pP, mme_code, m_tmsi))) { + LOG_I(RRC," S-TMSI exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p,ue_context_p->ue_context.rnti,ctxt_pP->rnti); + rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti); + stmsi_received=1; + /* replace rnti in the context */ + /* for that, remove the context from the RB tree */ + RB_REMOVE(rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p); + /* and insert again, after changing rnti everywhere it has to be changed */ + ue_context_p->ue_id_rnti = ctxt_pP->rnti; + ue_context_p->ue_context.rnti = ctxt_pP->rnti; + RB_INSERT(rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p); + /* reset timers */ + ue_context_p->ue_context.ul_failure_timer = 0; + ue_context_p->ue_context.ue_release_timer = 0; + ue_context_p->ue_context.ue_reestablishment_timer = 0; + ue_context_p->ue_context.ue_release_timer_s1 = 0; + ue_context_p->ue_context.ue_release_timer_rrc = 0; + } else { + LOG_I(RRC," S-TMSI doesn't exist, setting Initialue_identity_s_TMSI.m_tmsi to %p => %x\n",ue_context_p,m_tmsi); + // ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, NOT_A_RANDOM_UE_IDENTITY); + ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP,random_value); + + if (ue_context_p == NULL) + LOG_E(RRC, "%s:%d:%s: rrc_eNB_get_next_free_ue_context returned NULL\n", __FILE__, __LINE__, __FUNCTION__); + + if (ue_context_p != NULL) { + ue_context_p->ue_context.Initialue_identity_s_TMSI.presence = TRUE; + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code = mme_code; + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi = m_tmsi; + } else { + /* TODO: do we have to break here? */ + //break; + } + } + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Srb_info->Rx_buffer.Payload, + dec_rval.consumed, + MSC_AS_TIME_FMT" RRCConnectionRequest UE %x size %u (s-TMSI mmec %u m_TMSI %u random UE id (0x%" PRIx64 ")", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + dec_rval.consumed, + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.random_ue_identity); + } else { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionRequest without random UE identity or S-TMSI not supported, let's reject the UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rrc_eNB_generate_RRCConnectionReject(ctxt_pP, + rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti), + CC_id); + break; + } + } + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" UE context: %p\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - random_value); - rrc_mac_remove_ue(ctxt_pP->module_id,ctxt_pP->rnti); - return -1; + ue_context_p); + + if (ue_context_p != NULL) { +#if defined(ENABLE_ITTI) + ue_context_p->ue_context.establishment_cause = rrcConnectionRequest->establishmentCause; + ue_context_p->ue_context.reestablishment_cause = ReestablishmentCause_spare1; + + if (stmsi_received==0) + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection from UE random UE identity (0x%" PRIx64 ") MME code %u TMSI %u cause %ld\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p->ue_context.random_ue_identity, + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.establishment_cause); + else + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection from UE MME code %u TMSI %u cause %ld\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.establishment_cause); + +#else + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection for UE random UE identity (0x%" PRIx64 ")\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p->ue_context.random_ue_identity); +#endif + + if (stmsi_received == 0) + RC.rrc[ctxt_pP->module_id]->Nb_ue++; + } else { + // no context available + if (rrc_agent_registered[ctxt_pP->module_id]) { + agent_rrc_xface[ctxt_pP->module_id]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, + ctxt_pP->rnti, + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); + } + + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Can't create new context for UE random UE identity (0x%" PRIx64 ")\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + random_value); + rrc_mac_remove_ue(ctxt_pP->module_id,ctxt_pP->rnti); + return -1; + } } - } #ifndef NO_RRM - send_msg(&S_rrc, msg_rrc_MR_attach_ind(ctxt_pP->module_id, Mac_id)); + send_msg(&S_rrc, msg_rrc_MR_attach_ind(ctxt_pP->module_id, Mac_id)); #else - - ue_context_p->ue_context.primaryCC_id = CC_id; - - //LG COMMENT Idx = (ue_mod_idP * NB_RB_MAX) + DCCH; - Idx = DCCH; - // SRB1 - ue_context_p->ue_context.Srb1.Active = 1; - ue_context_p->ue_context.Srb1.Srb_info.Srb_id = Idx; - memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[0], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[1], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - - // SRB2: set it to go through SRB1 with id 1 (DCCH) - ue_context_p->ue_context.Srb2.Active = 1; - ue_context_p->ue_context.Srb2.Srb_info.Srb_id = Idx; - memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[0], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[1], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - - rrc_eNB_generate_RRCConnectionSetup(ctxt_pP, ue_context_p, CC_id); - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1 (rbid %d)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - Idx); - - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_PDCP_ENB, - NULL, - 0, - MSC_AS_TIME_FMT" CONFIG_REQ UE %x SRB", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti); - - rrc_pdcp_config_asn1_req(ctxt_pP, - ue_context_p->ue_context.SRB_configList, - (DRB_ToAddModList_t *) NULL, - (DRB_ToReleaseList_t*) NULL, - 0xff, - NULL, - NULL, - NULL + ue_context_p->ue_context.primaryCC_id = CC_id; + //LG COMMENT Idx = (ue_mod_idP * NB_RB_MAX) + DCCH; + Idx = DCCH; + // SRB1 + ue_context_p->ue_context.Srb1.Active = 1; + ue_context_p->ue_context.Srb1.Srb_info.Srb_id = Idx; + memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[0], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[1], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + // SRB2: set it to go through SRB1 with id 1 (DCCH) + ue_context_p->ue_context.Srb2.Active = 1; + ue_context_p->ue_context.Srb2.Srb_info.Srb_id = Idx; + memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[0], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[1], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + rrc_eNB_generate_RRCConnectionSetup(ctxt_pP, ue_context_p, CC_id); + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1 (rbid %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + Idx); + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_PDCP_ENB, + NULL, + 0, + MSC_AS_TIME_FMT" CONFIG_REQ UE %x SRB", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti); + rrc_pdcp_config_asn1_req(ctxt_pP, + ue_context_p->ue_context.SRB_configList, + (DRB_ToAddModList_t *) NULL, + (DRB_ToReleaseList_t *) NULL, + 0xff, + NULL, + NULL, + NULL # if defined(Rel10) || defined(Rel14) - , (PMCH_InfoList_r9_t *) NULL + , (PMCH_InfoList_r9_t *) NULL # endif - ,NULL); - - rrc_rlc_config_asn1_req(ctxt_pP, - ue_context_p->ue_context.SRB_configList, - (DRB_ToAddModList_t*) NULL, - (DRB_ToReleaseList_t*) NULL + ,NULL); + rrc_rlc_config_asn1_req(ctxt_pP, + ue_context_p->ue_context.SRB_configList, + (DRB_ToAddModList_t *) NULL, + (DRB_ToReleaseList_t *) NULL # if defined(Rel10) || defined(Rel14) - , (PMCH_InfoList_r9_t *) NULL + , (PMCH_InfoList_r9_t *) NULL # endif - ); + ); #endif //NO_RRM + break; - break; - - default: - LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown message\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rval = -1; - break; + default: + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown message\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rval = -1; + break; } rval = 0; @@ -6388,28 +5904,25 @@ rrc_eNB_decode_ccch( //----------------------------------------------------------------------------- int rrc_eNB_decode_dcch( - const protocol_ctxt_t* const ctxt_pP, + const protocol_ctxt_t *const ctxt_pP, const rb_id_t Srb_id, - const uint8_t* const Rx_sdu, + const uint8_t *const Rx_sdu, const sdu_size_t sdu_sizeP ) //----------------------------------------------------------------------------- { - asn_dec_rval_t dec_rval; //UL_DCCH_Message_t uldcchmsg; UL_DCCH_Message_t *ul_dcch_msg = NULL; //&uldcchmsg; int i; - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; #if defined(ENABLE_ITTI) # if defined(ENABLE_USE_MME) - MessageDef * msg_delete_tunnels_p = NULL; + MessageDef *msg_delete_tunnels_p = NULL; uint8_t xid; #endif #endif - - int dedicated_DRB=0; - + int dedicated_DRB=0; T(T_ENB_RRC_UL_DCCH_DATA_IN, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); @@ -6422,21 +5935,21 @@ rrc_eNB_decode_dcch( PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), Srb_id); } - //memset(ul_dcch_msg,0,sizeof(UL_DCCH_Message_t)); + //memset(ul_dcch_msg,0,sizeof(UL_DCCH_Message_t)); LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Decoding UL-DCCH Message\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); dec_rval = uper_decode( NULL, &asn_DEF_UL_DCCH_Message, - (void**)&ul_dcch_msg, + (void **)&ul_dcch_msg, Rx_sdu, sdu_sizeP, 0, 0); /* -#if defined(ENABLE_ITTI) -# if defined(DISABLE_ITTI_XER_PRINT) + #if defined(ENABLE_ITTI) + # if defined(DISABLE_ITTI_XER_PRINT) { MessageDef *message_p; @@ -6445,7 +5958,7 @@ rrc_eNB_decode_dcch( itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, message_p); } -# else + # else { char message_string[10000]; size_t message_string_size; @@ -6461,8 +5974,8 @@ rrc_eNB_decode_dcch( itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); } } -# endif -#endif + # endif + #endif */ { for (i = 0; i < sdu_sizeP; i++) { @@ -6484,546 +5997,529 @@ rrc_eNB_decode_dcch( ctxt_pP->rnti); if (ul_dcch_msg->message.present == UL_DCCH_MessageType_PR_c1) { - switch (ul_dcch_msg->message.choice.c1.present) { - case UL_DCCH_MessageType__c1_PR_NOTHING: /* No components present */ - break; + case UL_DCCH_MessageType__c1_PR_NOTHING: /* No components present */ + break; - case UL_DCCH_MessageType__c1_PR_csfbParametersRequestCDMA2000: - break; + case UL_DCCH_MessageType__c1_PR_csfbParametersRequestCDMA2000: + break; - case UL_DCCH_MessageType__c1_PR_measurementReport: - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND " - "%d bytes (measurementReport) ---> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH, - sdu_sizeP); - rrc_eNB_process_MeasurementReport( - ctxt_pP, - ue_context_p, - &ul_dcch_msg->message.choice.c1.choice.measurementReport. - criticalExtensions.choice.c1.choice.measurementReport_r8.measResults); - break; - - case UL_DCCH_MessageType__c1_PR_rrcConnectionReconfigurationComplete: -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC Connection Reconfiguration Complete\n"); - - for (i = 0; i < sdu_sizeP; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); - } - - LOG_F(RRC,"\n"); -#endif - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" RRCConnectionReconfigurationComplete UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); - - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " - "(RRCConnectionReconfigurationComplete) ---> RRC_eNB]\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH, - sdu_sizeP); - - if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions. - present == - RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8) { - /*NN: revise the condition */ - if (ue_context_p->ue_context.Status == RRC_RECONFIGURED){ - dedicated_DRB = 1; - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); - }else { - dedicated_DRB = 0; - ue_context_p->ue_context.Status = RRC_RECONFIGURED; - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (default DRB, xid %ld)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); - } - rrc_eNB_process_RRCConnectionReconfigurationComplete( + case UL_DCCH_MessageType__c1_PR_measurementReport: + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND " + "%d bytes (measurementReport) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); + rrc_eNB_process_MeasurementReport( ctxt_pP, ue_context_p, - ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + &ul_dcch_msg->message.choice.c1.choice.measurementReport. + criticalExtensions.choice.c1.choice.measurementReport_r8.measResults); + break; + + case UL_DCCH_MessageType__c1_PR_rrcConnectionReconfigurationComplete: +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Reconfiguration Complete\n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t *)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" RRCConnectionReconfigurationComplete UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(RRCConnectionReconfigurationComplete) ---> RRC_eNB]\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); + + if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions. + present == + RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8) { + /*NN: revise the condition */ + if (ue_context_p->ue_context.Status == RRC_RECONFIGURED) { + dedicated_DRB = 1; + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + } else { + dedicated_DRB = 0; + ue_context_p->ue_context.Status = RRC_RECONFIGURED; + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (default DRB, xid %ld)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + } + + rrc_eNB_process_RRCConnectionReconfigurationComplete( + ctxt_pP, + ue_context_p, + ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + + //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future + if (rrc_agent_registered[ctxt_pP->module_id]) { + agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, + ue_context_p->ue_id_rnti, + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED); + } + } - //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future - if (rrc_agent_registered[ctxt_pP->module_id]) { - agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, - ue_context_p->ue_id_rnti, - PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED); - } - } #if defined(ENABLE_ITTI) # if defined(ENABLE_USE_MME) - if (EPC_MODE_ENABLED == 1) { - if (dedicated_DRB == 1){ -// rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(ctxt_pP, -// ue_context_p, -// ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); -if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { - rrc_eNB_send_S1AP_E_RAB_MODIFY_RESP(ctxt_pP, - ue_context_p, - ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); - ue_context_p->ue_context.nb_of_modify_e_rabs = 0; - ue_context_p->ue_context.nb_of_failed_e_rabs = 0; - memset(ue_context_p->ue_context.modify_e_rab, 0, sizeof(ue_context_p->ue_context.modify_e_rab)); - for(int i = 0; i < NB_RB_MAX; i++) { - ue_context_p->ue_context.modify_e_rab[i].xid = -1; - } + if (EPC_MODE_ENABLED == 1) { + if (dedicated_DRB == 1) { + // rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(ctxt_pP, + // ue_context_p, + // ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { + rrc_eNB_send_S1AP_E_RAB_MODIFY_RESP(ctxt_pP, + ue_context_p, + ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + ue_context_p->ue_context.nb_of_modify_e_rabs = 0; + ue_context_p->ue_context.nb_of_failed_e_rabs = 0; + memset(ue_context_p->ue_context.modify_e_rab, 0, sizeof(ue_context_p->ue_context.modify_e_rab)); - } else if(ue_context_p->ue_context.e_rab_release_command_flag == 1){ - xid = ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier; - ue_context_p->ue_context.e_rab_release_command_flag = 0; - //gtp tunnel delete - msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ); - memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; - for(i = 0; i < NB_RB_MAX; i++){ - if(xid == ue_context_p->ue_context.e_rab[i].xid){ - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = ue_context_p->ue_context.enb_gtp_ebi[i]; - ue_context_p->ue_context.enb_gtp_teid[i] = 0; - memset(&ue_context_p->ue_context.enb_gtp_addrs[i], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[i])); - ue_context_p->ue_context.enb_gtp_ebi[i] = 0; - } - } - itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->instance, msg_delete_tunnels_p); - //S1AP_E_RAB_RELEASE_RESPONSE - rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(ctxt_pP, - ue_context_p, - xid); - } else { + for(int i = 0; i < NB_RB_MAX; i++) { + ue_context_p->ue_context.modify_e_rab[i].xid = -1; + } + } else if(ue_context_p->ue_context.e_rab_release_command_flag == 1) { + xid = ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier; + ue_context_p->ue_context.e_rab_release_command_flag = 0; + //gtp tunnel delete + msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ); + memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); + GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; + + for(i = 0; i < NB_RB_MAX; i++) { + if(xid == ue_context_p->ue_context.e_rab[i].xid) { + GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = ue_context_p->ue_context.enb_gtp_ebi[i]; + ue_context_p->ue_context.enb_gtp_teid[i] = 0; + memset(&ue_context_p->ue_context.enb_gtp_addrs[i], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[i])); + ue_context_p->ue_context.enb_gtp_ebi[i] = 0; + } + } + + itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->instance, msg_delete_tunnels_p); + //S1AP_E_RAB_RELEASE_RESPONSE + rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(ctxt_pP, + ue_context_p, + xid); + } else { rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(ctxt_pP, - ue_context_p, - ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); - } - }else { - if(ue_context_p->ue_context.reestablishment_cause == ReestablishmentCause_spare1){ - rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP, - ue_context_p); + ue_context_p, + ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + } } else { - ue_context_p->ue_context.reestablishment_cause = ReestablishmentCause_spare1; - for (uint8_t e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { - if (ue_context_p->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE) { - ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED; - } else { - ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_FAILED; + if(ue_context_p->ue_context.reestablishment_cause == ReestablishmentCause_spare1) { + rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP, + ue_context_p); + } else { + ue_context_p->ue_context.reestablishment_cause = ReestablishmentCause_spare1; + + for (uint8_t e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { + if (ue_context_p->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE) { + ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED; + } else { + ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_FAILED; + } } } } - } - } + } + #else // establish a dedicated bearer - if (dedicated_DRB == 0 ) { - // ue_context_p->ue_context.e_rab[0].status = E_RAB_STATUS_ESTABLISHED; - rrc_eNB_reconfigure_DRBs(ctxt_pP,ue_context_p); - } - + + if (dedicated_DRB == 0 ) { + // ue_context_p->ue_context.e_rab[0].status = E_RAB_STATUS_ESTABLISHED; + rrc_eNB_reconfigure_DRBs(ctxt_pP,ue_context_p); + } + #endif -#endif - break; - - case UL_DCCH_MessageType__c1_PR_rrcConnectionReestablishmentComplete: - T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); +#endif + break; + case UL_DCCH_MessageType__c1_PR_rrcConnectionReestablishmentComplete: + T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); #ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC Connection Reestablishment Complete\n"); + LOG_F(RRC,"[MSG] RRC Connection Reestablishment Complete\n"); - for (i = 0; i < sdu_sizeP; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); - } + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t *)Rx_sdu)[i]); + } - LOG_F(RRC,"\n"); + LOG_F(RRC,"\n"); #endif + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" rrcConnectionReestablishmentComplete UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(rrcConnectionReestablishmentComplete) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); + { + int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); + RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 0; + rnti_t reestablish_rnti = 0; - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" rrcConnectionReestablishmentComplete UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); + // select C-RNTI from map + for (i = 0; i < NUMBER_OF_UE_MAX; i++) { + if (reestablish_rnti_map[i][0] == ctxt_pP->rnti) { + reestablish_rnti = reestablish_rnti_map[i][1]; + ue_context_p = rrc_eNB_get_ue_context( + RC.rrc[ctxt_pP->module_id], + reestablish_rnti); + // clear currentC-RNTI from map + reestablish_rnti_map[i][0] = 0; + reestablish_rnti_map[i][1] = 0; + break; + } + } - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " - "(rrcConnectionReestablishmentComplete) ---> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH, - sdu_sizeP); - { - int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); - RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 0; - rnti_t reestablish_rnti = 0; - // select C-RNTI from map - for (i = 0; i < NUMBER_OF_UE_MAX; i++) { - if (reestablish_rnti_map[i][0] == ctxt_pP->rnti) { - reestablish_rnti = reestablish_rnti_map[i][1]; - ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[ctxt_pP->module_id], - reestablish_rnti); - // clear currentC-RNTI from map - reestablish_rnti_map[i][0] = 0; - reestablish_rnti_map[i][1] = 0; + LOG_D(RRC, "reestablish_rnti_map[%d] [0] %x, [1] %x\n", + i, reestablish_rnti_map[i][0], reestablish_rnti_map[i][1]); + + if (!ue_context_p) { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentComplete without UE context, falt\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); break; } - } - LOG_D(RRC, "reestablish_rnti_map[%d] [0] %x, [1] %x\n", - i, reestablish_rnti_map[i][0], reestablish_rnti_map[i][1]); - if (!ue_context_p) { - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentComplete without UE context, falt\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - break; + if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.present == + RRCConnectionReestablishmentComplete__criticalExtensions_PR_rrcConnectionReestablishmentComplete_r8) { + rrc_eNB_process_RRCConnectionReestablishmentComplete(ctxt_pP, reestablish_rnti, ue_context_p, + ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.rrc_TransactionIdentifier, + &ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.choice.rrcConnectionReestablishmentComplete_r8); + + //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future + if (mac_agent_registered[ctxt_pP->module_id]) { + agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, + ue_context_p->ue_id_rnti, + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); + } + } + + //ue_context_p->ue_context.ue_release_timer = 0; + ue_context_p->ue_context.ue_reestablishment_timer = 1; + // remove UE after 100 frames after RRCConnectionReestablishmentRelease is triggered + ue_context_p->ue_context.ue_reestablishment_timer_thres = 1000; + } + break; + + case UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete: +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection SetupComplete\n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t *)Rx_sdu)[i]); } - if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.present == - RRCConnectionReestablishmentComplete__criticalExtensions_PR_rrcConnectionReestablishmentComplete_r8) { - rrc_eNB_process_RRCConnectionReestablishmentComplete(ctxt_pP, reestablish_rnti, ue_context_p, - ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.rrc_TransactionIdentifier, - &ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.choice.rrcConnectionReestablishmentComplete_r8); + LOG_F(RRC,"\n"); +#endif + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" RRCConnectionSetupComplete UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(RRCConnectionSetupComplete) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); - //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future - if (mac_agent_registered[ctxt_pP->module_id]) { - agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, - ue_context_p->ue_id_rnti, - PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); + if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.present == + RRCConnectionSetupComplete__criticalExtensions_PR_c1) { + if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1. + present == + RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8) { + rrc_eNB_process_RRCConnectionSetupComplete( + ctxt_pP, + ue_context_p, + &ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8); + ue_context_p->ue_context.Status = RRC_CONNECTED; + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + + //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future + if (rrc_agent_registered[ctxt_pP->module_id]) { + agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, + ue_context_p->ue_id_rnti, + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); + } } } - //ue_context_p->ue_context.ue_release_timer = 0; - ue_context_p->ue_context.ue_reestablishment_timer = 1; - // remove UE after 100 frames after RRCConnectionReestablishmentRelease is triggered - ue_context_p->ue_context.ue_reestablishment_timer_thres = 1000; - } - break; - case UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete: + ue_context_p->ue_context.ue_release_timer=0; + break; + + case UL_DCCH_MessageType__c1_PR_securityModeComplete: + T(T_ENB_RRC_SECURITY_MODE_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); #ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC Connection SetupComplete\n"); + LOG_F(RRC,"[MSG] RRC Security Mode Complete\n"); - for (i = 0; i < sdu_sizeP; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); - } - - LOG_F(RRC,"\n"); -#endif - - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" RRCConnectionSetupComplete UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); - - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " - "(RRCConnectionSetupComplete) ---> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH, - sdu_sizeP); - - if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.present == - RRCConnectionSetupComplete__criticalExtensions_PR_c1) { - if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1. - present == - RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8) { - rrc_eNB_process_RRCConnectionSetupComplete( - ctxt_pP, - ue_context_p, - &ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8); - ue_context_p->ue_context.Status = RRC_CONNECTED; - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - - //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future - if (rrc_agent_registered[ctxt_pP->module_id]) { - agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, - ue_context_p->ue_id_rnti, - PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); - } + for (i = 0; i < sdu_sizeP; i++) eNB->pusch_vars[UE_id] { + LOG_F(RRC,"%02x ", ((uint8_t *)Rx_sdu)[i]); } - } - - ue_context_p->ue_context.ue_release_timer=0; - break; - - case UL_DCCH_MessageType__c1_PR_securityModeComplete: - T(T_ENB_RRC_SECURITY_MODE_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC Security Mode Complete\n"); - - for (i = 0; i < sdu_sizeP; i++) eNB->pusch_vars[UE_id]{ - LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); - } - - LOG_F(RRC,"\n"); + LOG_F(RRC,"\n"); #endif - - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" securityModeComplete UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); - - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" received securityModeComplete on UL-DCCH %d from UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH); - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " - "(securityModeComplete) ---> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH, - sdu_sizeP); -#ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg); -#endif - // confirm with PDCP about the security mode for DCCH - //rrc_pdcp_config_req (enb_mod_idP, frameP, 1,CONFIG_ACTION_SET_SECURITY_MODE, (ue_mod_idP * NB_RB_MAX) + DCCH, 0x77); - // continue the procedure - rrc_eNB_generate_UECapabilityEnquiry( - ctxt_pP, - ue_context_p); - break; - - case UL_DCCH_MessageType__c1_PR_securityModeFailure: - T(T_ENB_RRC_SECURITY_MODE_FAILURE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC Security Mode Failure\n"); - - for (i = 0; i < sdu_sizeP; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); - } - - LOG_F(RRC,"\n"); -#endif - - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" securityModeFailure UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); - - LOG_W(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " - "(securityModeFailure) ---> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH, - sdu_sizeP); -#ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg); -#endif - // cancel the security mode in PDCP - - // followup with the remaining procedure -//#warning "LG Removed rrc_eNB_generate_UECapabilityEnquiry after receiving securityModeFailure" - rrc_eNB_generate_UECapabilityEnquiry(ctxt_pP, ue_context_p); - break; - - case UL_DCCH_MessageType__c1_PR_ueCapabilityInformation: - T(T_ENB_RRC_UE_CAPABILITY_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC UECapablility Information \n"); - - for (i = 0; i < sdu_sizeP; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); - } - - LOG_F(RRC,"\n"); -#endif - - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" ueCapabilityInformation UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); - - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" received ueCapabilityInformation on UL-DCCH %d from UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH); - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " - "(UECapabilityInformation) ---> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH, - sdu_sizeP); -#ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg); -#endif - LOG_I(RRC, "got UE capabilities for UE %x\n", ctxt_pP->rnti); - if (ue_context_p->ue_context.UE_Capability) { - LOG_I(RRC, "freeing old UE capabilities for UE %x\n", ctxt_pP->rnti); - asn_DEF_UE_EUTRA_Capability.free_struct(&asn_DEF_UE_EUTRA_Capability, - ue_context_p->ue_context.UE_Capability, 0); - ue_context_p->ue_context.UE_Capability = 0; - } - dec_rval = uper_decode(NULL, - &asn_DEF_UE_EUTRA_Capability, - (void **)&ue_context_p->ue_context.UE_Capability, - ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions. - choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list. - array[0]->ueCapabilityRAT_Container.buf, - ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions. - choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list. - array[0]->ueCapabilityRAT_Container.size, 0, 0); -#ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_UE_EUTRA_Capability, ue_context_p->ue_context.UE_Capability); -#endif - - if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { - LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Failed to decode UE capabilities (%zu bytes)\n", + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" securityModeComplete UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" received securityModeComplete on UL-DCCH %d from UE\n", PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - dec_rval.consumed); - asn_DEF_UE_EUTRA_Capability.free_struct(&asn_DEF_UE_EUTRA_Capability, - ue_context_p->ue_context.UE_Capability, 0); - ue_context_p->ue_context.UE_Capability = 0; - } - -#if defined(ENABLE_USE_MME) - - if (EPC_MODE_ENABLED == 1) { - rrc_eNB_send_S1AP_UE_CAPABILITIES_IND(ctxt_pP, - ue_context_p, - ul_dcch_msg); - } -#else - ue_context_p->ue_context.nb_of_e_rabs = 1; - for (i = 0; i < ue_context_p->ue_context.nb_of_e_rabs; i++){ - ue_context_p->ue_context.e_rab[i].status = E_RAB_STATUS_NEW; - ue_context_p->ue_context.e_rab[i].param.e_rab_id = 1+i; - ue_context_p->ue_context.e_rab[i].param.qos.qci=9; - } - ue_context_p->ue_context.setup_e_rabs =ue_context_p->ue_context.nb_of_e_rabs; + DCCH); + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(securityModeComplete) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); +#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg); #endif + // confirm with PDCP about the security mode for DCCH + //rrc_pdcp_config_req (enb_mod_idP, frameP, 1,CONFIG_ACTION_SET_SECURITY_MODE, (ue_mod_idP * NB_RB_MAX) + DCCH, 0x77); + // continue the procedure + rrc_eNB_generate_UECapabilityEnquiry( + ctxt_pP, + ue_context_p); + break; - rrc_eNB_generate_defaultRRCConnectionReconfiguration(ctxt_pP, - ue_context_p, - RC.rrc[ctxt_pP->module_id]->HO_flag); - break; - - case UL_DCCH_MessageType__c1_PR_ulHandoverPreparationTransfer: - T(T_ENB_RRC_UL_HANDOVER_PREPARATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - break; - - case UL_DCCH_MessageType__c1_PR_ulInformationTransfer: - T(T_ENB_RRC_UL_INFORMATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - LOG_D(RRC,"[MSG] RRC UL Information Transfer \n"); + case UL_DCCH_MessageType__c1_PR_securityModeFailure: + T(T_ENB_RRC_SECURITY_MODE_FAILURE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); #ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC UL Information Transfer \n"); + LOG_F(RRC,"[MSG] RRC Security Mode Failure\n"); - for (i = 0; i < sdu_sizeP; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); - } + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t *)Rx_sdu)[i]); + } - LOG_F(RRC,"\n"); + LOG_F(RRC,"\n"); +#endif + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" securityModeFailure UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + LOG_W(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(securityModeFailure) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); +#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg); +#endif + // cancel the security mode in PDCP + // followup with the remaining procedure + //#warning "LG Removed rrc_eNB_generate_UECapabilityEnquiry after receiving securityModeFailure" + rrc_eNB_generate_UECapabilityEnquiry(ctxt_pP, ue_context_p); + break; + + case UL_DCCH_MessageType__c1_PR_ueCapabilityInformation: + T(T_ENB_RRC_UE_CAPABILITY_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC UECapablility Information \n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t *)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" ueCapabilityInformation UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" received ueCapabilityInformation on UL-DCCH %d from UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH); + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(UECapabilityInformation) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); +#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg); +#endif + LOG_I(RRC, "got UE capabilities for UE %x\n", ctxt_pP->rnti); + + if (ue_context_p->ue_context.UE_Capability) { + LOG_I(RRC, "freeing old UE capabilities for UE %x\n", ctxt_pP->rnti); + ASN_STRUCT_FREE(asn_DEF_UE_EUTRA_Capability, + ue_context_p->ue_context.UE_Capability); + ue_context_p->ue_context.UE_Capability = 0; + } + + dec_rval = uper_decode(NULL, + &asn_DEF_UE_EUTRA_Capability, + (void **)&ue_context_p->ue_context.UE_Capability, + ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions. + choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list. + array[0]->ueCapabilityRAT_Container.buf, + ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions. + choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list. + array[0]->ueCapabilityRAT_Container.size, 0, 0); +#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_UE_EUTRA_Capability, ue_context_p->ue_context.UE_Capability); #endif - - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" ulInformationTransfer UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Failed to decode UE capabilities (%zu bytes)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + dec_rval.consumed); + ASN_STRUCT_FREE(asn_DEF_UE_EUTRA_Capability, + ue_context_p->ue_context.UE_Capability); + ue_context_p->ue_context.UE_Capability = 0; + } #if defined(ENABLE_USE_MME) - if (EPC_MODE_ENABLED == 1) { - rrc_eNB_send_S1AP_UPLINK_NAS(ctxt_pP, - ue_context_p, - ul_dcch_msg); - } + if (EPC_MODE_ENABLED == 1) { + rrc_eNB_send_S1AP_UE_CAPABILITIES_IND(ctxt_pP, + ue_context_p, + ul_dcch_msg); + } + +#else + ue_context_p->ue_context.nb_of_e_rabs = 1; + + for (i = 0; i < ue_context_p->ue_context.nb_of_e_rabs; i++) { + ue_context_p->ue_context.e_rab[i].status = E_RAB_STATUS_NEW; + ue_context_p->ue_context.e_rab[i].param.e_rab_id = 1+i; + ue_context_p->ue_context.e_rab[i].param.qos.qci=9; + } + + ue_context_p->ue_context.setup_e_rabs =ue_context_p->ue_context.nb_of_e_rabs; +#endif + rrc_eNB_generate_defaultRRCConnectionReconfiguration(ctxt_pP, + ue_context_p, + RC.rrc[ctxt_pP->module_id]->HO_flag); + break; + + case UL_DCCH_MessageType__c1_PR_ulHandoverPreparationTransfer: + T(T_ENB_RRC_UL_HANDOVER_PREPARATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + break; + + case UL_DCCH_MessageType__c1_PR_ulInformationTransfer: + T(T_ENB_RRC_UL_INFORMATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + LOG_D(RRC,"[MSG] RRC UL Information Transfer \n"); +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC UL Information Transfer \n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t *)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" ulInformationTransfer UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); +#if defined(ENABLE_USE_MME) + + if (EPC_MODE_ENABLED == 1) { + rrc_eNB_send_S1AP_UPLINK_NAS(ctxt_pP, + ue_context_p, + ul_dcch_msg); + } #endif - break; - - case UL_DCCH_MessageType__c1_PR_counterCheckResponse: - T(T_ENB_RRC_COUNTER_CHECK_RESPONSE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - break; + break; + case UL_DCCH_MessageType__c1_PR_counterCheckResponse: + T(T_ENB_RRC_COUNTER_CHECK_RESPONSE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + break; #if defined(Rel10) || defined(Rel14) - case UL_DCCH_MessageType__c1_PR_ueInformationResponse_r9: - T(T_ENB_RRC_UE_INFORMATION_RESPONSE_R9, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + case UL_DCCH_MessageType__c1_PR_ueInformationResponse_r9: + T(T_ENB_RRC_UE_INFORMATION_RESPONSE_R9, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + break; - break; + case UL_DCCH_MessageType__c1_PR_proximityIndication_r9: + T(T_ENB_RRC_PROXIMITY_INDICATION_R9, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + break; - case UL_DCCH_MessageType__c1_PR_proximityIndication_r9: - T(T_ENB_RRC_PROXIMITY_INDICATION_R9, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + case UL_DCCH_MessageType__c1_PR_rnReconfigurationComplete_r10: + T(T_ENB_RRC_RECONFIGURATION_COMPLETE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + break; - break; + case UL_DCCH_MessageType__c1_PR_mbmsCountingResponse_r10: + T(T_ENB_RRC_MBMS_COUNTING_RESPONSE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + break; - case UL_DCCH_MessageType__c1_PR_rnReconfigurationComplete_r10: - T(T_ENB_RRC_RECONFIGURATION_COMPLETE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - break; - - case UL_DCCH_MessageType__c1_PR_mbmsCountingResponse_r10: - T(T_ENB_RRC_MBMS_COUNTING_RESPONSE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - break; - - case UL_DCCH_MessageType__c1_PR_interFreqRSTDMeasurementIndication_r10: - T(T_ENB_RRC_INTER_FREQ_RSTD_MEASUREMENT_INDICATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - break; + case UL_DCCH_MessageType__c1_PR_interFreqRSTDMeasurementIndication_r10: + T(T_ENB_RRC_INTER_FREQ_RSTD_MEASUREMENT_INDICATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + break; #endif - default: - T(T_ENB_RRC_UNKNOW_MESSAGE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown message %s:%u\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - __FILE__, __LINE__); - return -1; + default: + T(T_ENB_RRC_UNKNOW_MESSAGE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown message %s:%u\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + __FILE__, __LINE__); + return -1; } return 0; @@ -7033,20 +6529,18 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { __FILE__, __LINE__); return -1; } - } #if defined(ENABLE_ITTI) -void rrc_eNB_reconfigure_DRBs (const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* ue_context_pP){ - +void rrc_eNB_reconfigure_DRBs (const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *ue_context_pP) { int i; int e_rab_done=0; - for (i = 0; + + for (i = 0; i < 3;//NB_RB_MAX - 3; // S1AP_MAX_E_RAB i++) { - - if ( ue_context_pP->ue_context.e_rab[i].status < E_RAB_STATUS_DONE){ + if ( ue_context_pP->ue_context.e_rab[i].status < E_RAB_STATUS_DONE) { ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_NEW; ue_context_pP->ue_context.e_rab[i].param.e_rab_id = i + 1; ue_context_pP->ue_context.e_rab[i].param.qos.qci = i % 9; @@ -7055,26 +6549,25 @@ void rrc_eNB_reconfigure_DRBs (const protocol_ctxt_t* const ctxt_pP, ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.pre_emp_vulnerability= PRE_EMPTION_VULNERABILITY_DISABLED; ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL; ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length = 0; - // memset (ue_context_pP->ue_context.e_rab[i].param.sgw_addr.buffer,0,20); + // memset (ue_context_pP->ue_context.e_rab[i].param.sgw_addr.buffer,0,20); ue_context_pP->ue_context.e_rab[i].param.sgw_addr.length = 0; ue_context_pP->ue_context.e_rab[i].param.gtp_teid=0; - ue_context_pP->ue_context.nb_of_e_rabs++; e_rab_done++; - LOG_I(RRC,"setting up the dedicated DRBs %d (index %d) status %d \n", - ue_context_pP->ue_context.e_rab[i].param.e_rab_id, i, ue_context_pP->ue_context.e_rab[i].status); + LOG_I(RRC,"setting up the dedicated DRBs %d (index %d) status %d \n", + ue_context_pP->ue_context.e_rab[i].param.e_rab_id, i, ue_context_pP->ue_context.e_rab[i].status); } } + ue_context_pP->ue_context.setup_e_rabs+=e_rab_done; - rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(ctxt_pP, ue_context_pP, 0); } //----------------------------------------------------------------------------- -void* +void * rrc_enb_task( - void* args_p + void *args_p ) //----------------------------------------------------------------------------- { @@ -7084,141 +6577,136 @@ rrc_enb_task( int result; SRB_INFO *srb_info_p; int CC_id; - protocol_ctxt_t ctxt; itti_mark_task_ready(TASK_RRC_ENB); LOG_I(RRC,"Entering main loop of RRC message task\n"); + while (1) { // Wait for a message itti_receive_msg(TASK_RRC_ENB, &msg_p); - msg_name_p = ITTI_MSG_NAME(msg_p); instance = ITTI_MSG_INSTANCE(msg_p); LOG_I(RRC,"Received message %s\n",msg_name_p); switch (ITTI_MSG_ID(msg_p)) { - case TERMINATE_MESSAGE: - LOG_W(RRC, " *** Exiting RRC thread\n"); - itti_exit_task(); - break; + case TERMINATE_MESSAGE: + LOG_W(RRC, " *** Exiting RRC thread\n"); + itti_exit_task(); + break; - case MESSAGE_TEST: - LOG_I(RRC, "[eNB %d] Received %s\n", instance, msg_name_p); - break; + case MESSAGE_TEST: + LOG_I(RRC, "[eNB %d] Received %s\n", instance, msg_name_p); + break; /* Messages from MAC */ - case RRC_MAC_CCCH_DATA_IND: - PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, - instance, - ENB_FLAG_YES, - RRC_MAC_CCCH_DATA_IND(msg_p).rnti, - msg_p->ittiMsgHeader.lte_time.frame, - msg_p->ittiMsgHeader.lte_time.slot); - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received %s\n", - PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt), - msg_name_p); + case RRC_MAC_CCCH_DATA_IND: + PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, + instance, + ENB_FLAG_YES, + RRC_MAC_CCCH_DATA_IND(msg_p).rnti, + msg_p->ittiMsgHeader.lte_time.frame, + msg_p->ittiMsgHeader.lte_time.slot); + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received %s\n", + PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt), + msg_name_p); + CC_id = RRC_MAC_CCCH_DATA_IND(msg_p).CC_id; + srb_info_p = &RC.rrc[instance]->carrier[CC_id].Srb0; + LOG_I(RRC,"Decoding CCCH : inst %d, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n", + instance,CC_id,&ctxt, RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); + AssertFatal(RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size < RRC_BUFFER_SIZE_MAX, + "CCCH message has size %d > %d\n", + RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,RRC_BUFFER_SIZE_MAX); + memcpy(srb_info_p->Rx_buffer.Payload, + RRC_MAC_CCCH_DATA_IND(msg_p).sdu, + RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); + srb_info_p->Rx_buffer.payload_size = RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size; + rrc_eNB_decode_ccch(&ctxt, srb_info_p, CC_id); + break; - CC_id = RRC_MAC_CCCH_DATA_IND(msg_p).CC_id; - srb_info_p = &RC.rrc[instance]->carrier[CC_id].Srb0; - - LOG_I(RRC,"Decoding CCCH : inst %d, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n", - instance,CC_id,&ctxt, RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); - AssertFatal(RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size < RRC_BUFFER_SIZE_MAX, - "CCCH message has size %d > %d\n", - RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,RRC_BUFFER_SIZE_MAX); - memcpy(srb_info_p->Rx_buffer.Payload, - RRC_MAC_CCCH_DATA_IND(msg_p).sdu, - RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); - srb_info_p->Rx_buffer.payload_size = RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size; - - rrc_eNB_decode_ccch(&ctxt, srb_info_p, CC_id); - break; - /* Messages from PDCP */ - case RRC_DCCH_DATA_IND: - PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, - instance, - ENB_FLAG_YES, - RRC_DCCH_DATA_IND(msg_p).rnti, - msg_p->ittiMsgHeader.lte_time.frame, - msg_p->ittiMsgHeader.lte_time.slot); - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received on DCCH %d %s\n", - PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt), - RRC_DCCH_DATA_IND(msg_p).dcch_index, - msg_name_p); - rrc_eNB_decode_dcch(&ctxt, - RRC_DCCH_DATA_IND(msg_p).dcch_index, - RRC_DCCH_DATA_IND(msg_p).sdu_p, - RRC_DCCH_DATA_IND(msg_p).sdu_size); - - // Message buffer has been processed, free it now. - result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), RRC_DCCH_DATA_IND(msg_p).sdu_p); - AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - break; - + case RRC_DCCH_DATA_IND: + PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, + instance, + ENB_FLAG_YES, + RRC_DCCH_DATA_IND(msg_p).rnti, + msg_p->ittiMsgHeader.lte_time.frame, + msg_p->ittiMsgHeader.lte_time.slot); + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received on DCCH %d %s\n", + PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt), + RRC_DCCH_DATA_IND(msg_p).dcch_index, + msg_name_p); + rrc_eNB_decode_dcch(&ctxt, + RRC_DCCH_DATA_IND(msg_p).dcch_index, + RRC_DCCH_DATA_IND(msg_p).sdu_p, + RRC_DCCH_DATA_IND(msg_p).sdu_size); + // Message buffer has been processed, free it now. + result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), RRC_DCCH_DATA_IND(msg_p).sdu_p); + AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); + break; # if defined(ENABLE_USE_MME) /* Messages from S1AP */ - case S1AP_DOWNLINK_NAS: - rrc_eNB_process_S1AP_DOWNLINK_NAS(msg_p, msg_name_p, instance, &rrc_eNB_mui); - break; + case S1AP_DOWNLINK_NAS: + rrc_eNB_process_S1AP_DOWNLINK_NAS(msg_p, msg_name_p, instance, &rrc_eNB_mui); + break; - case S1AP_INITIAL_CONTEXT_SETUP_REQ: - rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p, msg_name_p, instance); - break; + case S1AP_INITIAL_CONTEXT_SETUP_REQ: + rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p, msg_name_p, instance); + break; - case S1AP_UE_CTXT_MODIFICATION_REQ: - rrc_eNB_process_S1AP_UE_CTXT_MODIFICATION_REQ(msg_p, msg_name_p, instance); - break; + case S1AP_UE_CTXT_MODIFICATION_REQ: + rrc_eNB_process_S1AP_UE_CTXT_MODIFICATION_REQ(msg_p, msg_name_p, instance); + break; - case S1AP_PAGING_IND: - LOG_D(RRC, "[eNB %d] Received Paging message from S1AP: %s\n", instance, msg_name_p); - rrc_eNB_process_PAGING_IND(msg_p, msg_name_p, instance); - break; - - case S1AP_E_RAB_SETUP_REQ: - rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(msg_p, msg_name_p, instance); - LOG_D(RRC, "[eNB %d] Received the message %s\n", instance, msg_name_p); - break; + case S1AP_PAGING_IND: + LOG_D(RRC, "[eNB %d] Received Paging message from S1AP: %s\n", instance, msg_name_p); + rrc_eNB_process_PAGING_IND(msg_p, msg_name_p, instance); + break; - case S1AP_E_RAB_MODIFY_REQ: - rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(msg_p, msg_name_p, instance); - break; + case S1AP_E_RAB_SETUP_REQ: + rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(msg_p, msg_name_p, instance); + LOG_D(RRC, "[eNB %d] Received the message %s\n", instance, msg_name_p); + break; - case S1AP_E_RAB_RELEASE_COMMAND: - rrc_eNB_process_S1AP_E_RAB_RELEASE_COMMAND(msg_p, msg_name_p, instance); - break; - - case S1AP_UE_CONTEXT_RELEASE_REQ: - rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_REQ(msg_p, msg_name_p, instance); - break; + case S1AP_E_RAB_MODIFY_REQ: + rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(msg_p, msg_name_p, instance); + break; - case S1AP_UE_CONTEXT_RELEASE_COMMAND: - rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND(msg_p, msg_name_p, instance); - break; + case S1AP_E_RAB_RELEASE_COMMAND: + rrc_eNB_process_S1AP_E_RAB_RELEASE_COMMAND(msg_p, msg_name_p, instance); + break; - case GTPV1U_ENB_DELETE_TUNNEL_RESP: - /* Nothing to do. Apparently everything is done in S1AP processing */ - //LOG_I(RRC, "[eNB %d] Received message %s, not processed because procedure not synched\n", - //instance, msg_name_p); - if (rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti) - && rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc > 0) { - rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc = - rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_thres_rrc; - } - break; + case S1AP_UE_CONTEXT_RELEASE_REQ: + rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_REQ(msg_p, msg_name_p, instance); + break; + case S1AP_UE_CONTEXT_RELEASE_COMMAND: + rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND(msg_p, msg_name_p, instance); + break; + + case GTPV1U_ENB_DELETE_TUNNEL_RESP: + + /* Nothing to do. Apparently everything is done in S1AP processing */ + //LOG_I(RRC, "[eNB %d] Received message %s, not processed because procedure not synched\n", + //instance, msg_name_p); + if (rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti) + && rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc > 0) { + rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc = + rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_thres_rrc; + } + + break; # endif /* Messages from eNB app */ - case RRC_CONFIGURATION_REQ: - LOG_I(RRC, "[eNB %d] Received %s : %p\n", instance, msg_name_p,&RRC_CONFIGURATION_REQ(msg_p)); - openair_rrc_eNB_configuration(ENB_INSTANCE_TO_MODULE_ID(instance), &RRC_CONFIGURATION_REQ(msg_p)); - break; + case RRC_CONFIGURATION_REQ: + LOG_I(RRC, "[eNB %d] Received %s : %p\n", instance, msg_name_p,&RRC_CONFIGURATION_REQ(msg_p)); + openair_rrc_eNB_configuration(ENB_INSTANCE_TO_MODULE_ID(instance), &RRC_CONFIGURATION_REQ(msg_p)); + break; - default: - LOG_E(RRC, "[eNB %d] Received unexpected message %s\n", instance, msg_name_p); - break; + default: + LOG_E(RRC, "[eNB %d] Received unexpected message %s\n", instance, msg_name_p); + break; } result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p); @@ -7233,13 +6721,10 @@ void openair_rrc_top_init_eNB(int eMBMS_active,uint8_t HO_active) //----------------------------------------------------------------------------- { - module_id_t module_id; int CC_id; - /* for no gcc warnings */ (void)CC_id; - LOG_D(RRC, "[OPENAIR][INIT] Init function start: NB_eNB_INST=%d\n", RC.nb_inst); if (RC.nb_inst > 0) { @@ -7268,9 +6753,7 @@ openair_rrc_top_init_eNB(int eMBMS_active,uint8_t HO_active) } #endif - } - - + } } //----------------------------------------------------------------------------- @@ -7280,8 +6763,8 @@ rrc_top_cleanup_eNB( ) //----------------------------------------------------------------------------- { + for (int i=0; imodule_id]->rrc_ue_head)) { - if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe==0)) { - if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) { - LOG_I(RRC,"UE rnti %x:S-TMSI %x failure timer %d/8\n", - ue_context_p->ue_context.rnti, - ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, - ue_context_p->ue_context.ul_failure_timer); - } - else { - LOG_I(RRC,"UE rnti %x failure timer %d/8\n", - ue_context_p->ue_context.rnti, - ue_context_p->ue_context.ul_failure_timer); - } + check_handovers(ctxt_pP); + // counetr, and get the value and aggregate + // check for UL failure + RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { + if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe==0)) { + if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) { + LOG_I(RRC,"UE rnti %x:S-TMSI %x failure timer %d/8\n", + ue_context_p->ue_context.rnti, + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.ul_failure_timer); } - if (ue_context_p->ue_context.ul_failure_timer>0) { - ue_context_p->ue_context.ul_failure_timer++; - if (ue_context_p->ue_context.ul_failure_timer >= 8) { - // remove UE after 20 seconds after MAC has indicated UL failure - LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti); - ue_to_be_removed = ue_context_p; - break; - } - } - if (ue_context_p->ue_context.ue_release_timer_s1>0) { - ue_context_p->ue_context.ue_release_timer_s1++; - if (ue_context_p->ue_context.ue_release_timer_s1 >= - ue_context_p->ue_context.ue_release_timer_thres_s1) { - LOG_I(RRC,"Removing UE %x instance Because of UE_CONTEXT_RELEASE_COMMAND not received after %d ms from sending request\n", - ue_context_p->ue_context.rnti, ue_context_p->ue_context.ue_release_timer_thres_s1); - ue_to_be_removed = ue_context_p; - break; - } + else { + LOG_I(RRC,"UE rnti %x failure timer %d/8\n", + ue_context_p->ue_context.rnti, + ue_context_p->ue_context.ul_failure_timer); } + } - if (ue_context_p->ue_context.ue_release_timer_rrc>0) { - ue_context_p->ue_context.ue_release_timer_rrc++; - if (ue_context_p->ue_context.ue_release_timer_rrc >= + if (ue_context_p->ue_context.ul_failure_timer>0) { + ue_context_p->ue_context.ul_failure_timer++; + + if (ue_context_p->ue_context.ul_failure_timer >= 8) { + // remove UE after 20 seconds after MAC has indicated UL failure + LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti); + ue_to_be_removed = ue_context_p; + break; + } + } + + if (ue_context_p->ue_context.ue_release_timer_s1>0) { + ue_context_p->ue_context.ue_release_timer_s1++; + + if (ue_context_p->ue_context.ue_release_timer_s1 >= + ue_context_p->ue_context.ue_release_timer_thres_s1) { + LOG_I(RRC,"Removing UE %x instance Because of UE_CONTEXT_RELEASE_COMMAND not received after %d ms from sending request\n", + ue_context_p->ue_context.rnti, ue_context_p->ue_context.ue_release_timer_thres_s1); + ue_to_be_removed = ue_context_p; + break; + } + } + + if (ue_context_p->ue_context.ue_release_timer_rrc>0) { + ue_context_p->ue_context.ue_release_timer_rrc++; + + if (ue_context_p->ue_context.ue_release_timer_rrc >= ue_context_p->ue_context.ue_release_timer_thres_rrc) { - LOG_I(RRC,"Removing UE %x instance After UE_CONTEXT_RELEASE_Complete\n", ue_context_p->ue_context.rnti); - ue_to_be_removed = ue_context_p; - break; - } + LOG_I(RRC,"Removing UE %x instance After UE_CONTEXT_RELEASE_Complete\n", ue_context_p->ue_context.rnti); + ue_to_be_removed = ue_context_p; + break; } + } - if (ue_context_p->ue_context.ue_reestablishment_timer>0) { - ue_context_p->ue_context.ue_reestablishment_timer++; - if (ue_context_p->ue_context.ue_reestablishment_timer >= - ue_context_p->ue_context.ue_reestablishment_timer_thres) { - LOG_I(RRC,"UE %d reestablishment_timer max\n",ue_context_p->ue_context.rnti); - ue_context_p->ue_context.ul_failure_timer = 20000; - ue_to_be_removed = ue_context_p; - ue_context_p->ue_context.ue_reestablishment_timer = 0; - break; - } - } - if (ue_context_p->ue_context.ue_release_timer>0) { - ue_context_p->ue_context.ue_release_timer++; - if (ue_context_p->ue_context.ue_release_timer >= - ue_context_p->ue_context.ue_release_timer_thres) { - LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti); - ue_to_be_removed = ue_context_p; - break; - } + if (ue_context_p->ue_context.ue_reestablishment_timer>0) { + ue_context_p->ue_context.ue_reestablishment_timer++; + + if (ue_context_p->ue_context.ue_reestablishment_timer >= + ue_context_p->ue_context.ue_reestablishment_timer_thres) { + LOG_I(RRC,"UE %d reestablishment_timer max\n",ue_context_p->ue_context.rnti); + ue_context_p->ue_context.ul_failure_timer = 20000; + ue_to_be_removed = ue_context_p; + ue_context_p->ue_context.ue_reestablishment_timer = 0; + break; } } - if (ue_to_be_removed) { - if(ue_to_be_removed->ue_context.ul_failure_timer >= 8) { - ue_to_be_removed->ue_context.ue_release_timer_s1 = 1; - ue_to_be_removed->ue_context.ue_release_timer_thres_s1 = 100; - ue_to_be_removed->ue_context.ue_release_timer = 0; - ue_to_be_removed->ue_context.ue_reestablishment_timer = 0; - } - rrc_eNB_free_UE(ctxt_pP->module_id,ue_to_be_removed); - if(ue_to_be_removed->ue_context.ul_failure_timer >= 8){ - ue_to_be_removed->ue_context.ul_failure_timer = 0; + + if (ue_context_p->ue_context.ue_release_timer>0) { + ue_context_p->ue_context.ue_release_timer++; + + if (ue_context_p->ue_context.ue_release_timer >= + ue_context_p->ue_context.ue_release_timer_thres) { + LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti); + ue_to_be_removed = ue_context_p; + break; } } + } + + if (ue_to_be_removed) { + if(ue_to_be_removed->ue_context.ul_failure_timer >= 8) { + ue_to_be_removed->ue_context.ue_release_timer_s1 = 1; + ue_to_be_removed->ue_context.ue_release_timer_thres_s1 = 100; + ue_to_be_removed->ue_context.ue_release_timer = 0; + ue_to_be_removed->ue_context.ue_reestablishment_timer = 0; + } + + rrc_eNB_free_UE(ctxt_pP->module_id,ue_to_be_removed); + + if(ue_to_be_removed->ue_context.ul_failure_timer >= 8) { + ue_to_be_removed->ue_context.ul_failure_timer = 0; + } + } #ifdef RRC_LOCALIZATION + /* for the localization, only primary CC_id might be relevant*/ + gettimeofday(&ts, NULL); + current_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000; + ref_timestamp_ms = RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms; + RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { + ctxt = *ctxt_pP; + ctxt.rnti = ue_context_p->ue_context.rnti; + estimated_distance = rrc_get_estimated_ue_distance( + &ctxt, + CC_id, + RC.rrc[ctxt_pP->module_id]->loc_type); - /* for the localization, only primary CC_id might be relevant*/ - gettimeofday(&ts, NULL); - current_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000; - ref_timestamp_ms = RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms; - RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { - ctxt = *ctxt_pP; - ctxt.rnti = ue_context_p->ue_context.rnti; - estimated_distance = rrc_get_estimated_ue_distance( - &ctxt, - CC_id, - RC.rrc[ctxt_pP->module_id]->loc_type); - - if ((current_timestamp_ms - ref_timestamp_ms > RC.rrc[ctxt_pP->module_id]->aggregation_period_ms) && - estimated_distance != -1) { - LOG_D(LOCALIZE, " RRC [UE/id %d -> eNB/id %d] timestamp %d frame %d estimated r = %f\n", - ctxt.rnti, - ctxt_pP->module_id, - current_timestamp_ms, - ctxt_pP->frame, - estimated_distance); - LOG_D(LOCALIZE, " RRC status %d\n", ue_context_p->ue_context.Status); - push_front(&RC.rrc[ctxt_pP->module_id]->loc_list, - estimated_distance); - RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms = current_timestamp_ms; - } + if ((current_timestamp_ms - ref_timestamp_ms > RC.rrc[ctxt_pP->module_id]->aggregation_period_ms) && + estimated_distance != -1) { + LOG_D(LOCALIZE, " RRC [UE/id %d -> eNB/id %d] timestamp %d frame %d estimated r = %f\n", + ctxt.rnti, + ctxt_pP->module_id, + current_timestamp_ms, + ctxt_pP->frame, + estimated_distance); + LOG_D(LOCALIZE, " RRC status %d\n", ue_context_p->ue_context.Status); + push_front(&RC.rrc[ctxt_pP->module_id]->loc_list, + estimated_distance); + RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms = current_timestamp_ms; } - + } #endif - (void)ts; /* remove gcc warning "unused variable" */ - (void)ref_timestamp_ms; /* remove gcc warning "unused variable" */ - (void)current_timestamp_ms; /* remove gcc warning "unused variable" */ - + (void)ts; /* remove gcc warning "unused variable" */ + (void)ref_timestamp_ms; /* remove gcc warning "unused variable" */ + (void)current_timestamp_ms; /* remove gcc warning "unused variable" */ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT); return (RRC_OK); } diff --git a/openair2/RRC/LITE/rrc_eNB_S1AP.c b/openair2/RRC/LITE/rrc_eNB_S1AP.c index 80ae1c9ba5..0ef840ee42 100644 --- a/openair2/RRC/LITE/rrc_eNB_S1AP.c +++ b/openair2/RRC/LITE/rrc_eNB_S1AP.c @@ -60,7 +60,7 @@ #include "RRC/LITE/rrc_eNB_GTPV1U.h" #include "TLVDecoder.h" -#include "S1ap-NAS-PDU.h" +#include "S1AP_NAS-PDU.h" #include "flexran_agent_common_internal.h" extern RAN_CONTEXT_t RC; @@ -91,18 +91,16 @@ void extract_imsi(uint8_t *pdu_buf, uint32_t pdu_len, rrc_eNB_ue_context_t *ue_c /* Process NAS message locally to get the IMSI */ nas_message_t nas_msg; memset(&nas_msg, 0, sizeof(nas_message_t)); - int size = 0; - nas_message_security_header_t *header = &nas_msg.header; /* Decode the first octet of the header (security header type or EPS * bearer identity, and protocol discriminator) */ - DECODE_U8((char *) pdu_buf, *(uint8_t*) (header), size); + DECODE_U8((char *) pdu_buf, *(uint8_t *) (header), size); /* Decode NAS message only if decodable*/ if (!(header->security_header_type <= SECURITY_HEADER_TYPE_INTEGRITY_PROTECTED - && header->protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE - && pdu_len > NAS_MESSAGE_SECURITY_HEADER_SIZE)) + && header->protocol_discriminator == EPS_MOBILITY_MANAGEMENT_MESSAGE + && pdu_len > NAS_MESSAGE_SECURITY_HEADER_SIZE)) return; if (header->security_header_type != SECURITY_HEADER_TYPE_NOT_PROTECTED) { @@ -116,11 +114,9 @@ void extract_imsi(uint8_t *pdu_buf, uint32_t pdu_len, rrc_eNB_ue_context_t *ue_c * can modify it as we want. The callee retains the original address! */ pdu_buf += size; pdu_len -= size; - /* Decode plain NAS message */ EMM_msg *e_msg = &nas_msg.plain.emm; emm_msg_header_t *emm_header = &e_msg->header; - /* First decode the EMM message header */ int e_head_size = 0; @@ -163,9 +159,9 @@ void extract_imsi(uint8_t *pdu_buf, uint32_t pdu_len, rrc_eNB_ue_context_t *ue_c # if defined(ENABLE_ITTI) //------------------------------------------------------------------------------ -struct rrc_ue_s1ap_ids_s* +struct rrc_ue_s1ap_ids_s * rrc_eNB_S1AP_get_ue_ids( - eNB_RRC_INST* const rrc_instance_pP, + eNB_RRC_INST *const rrc_instance_pP, const uint16_t ue_initial_id, const uint32_t eNB_ue_s1ap_id ) @@ -177,44 +173,51 @@ rrc_eNB_S1AP_get_ue_ids( // we assume that a rrc_ue_s1ap_ids_s is initially inserted in initial_id2_s1ap_ids if (eNB_ue_s1ap_id > 0) { - h_rc = hashtable_get(rrc_instance_pP->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, (void**)&result); + h_rc = hashtable_get(rrc_instance_pP->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, (void **)&result); } + if (ue_initial_id != UE_INITIAL_ID_INVALID) { - h_rc = hashtable_get(rrc_instance_pP->initial_id2_s1ap_ids, (hash_key_t)ue_initial_id, (void**)&result); - if (h_rc == HASH_TABLE_OK) { - if (eNB_ue_s1ap_id > 0) { - h_rc = hashtable_get(rrc_instance_pP->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, (void**)&result2); - if (h_rc != HASH_TABLE_OK) { - result2 = malloc(sizeof(*result2)); - if (NULL != result2) { - *result2 = *result; - result2->eNB_ue_s1ap_id = eNB_ue_s1ap_id; - result->eNB_ue_s1ap_id = eNB_ue_s1ap_id; + h_rc = hashtable_get(rrc_instance_pP->initial_id2_s1ap_ids, (hash_key_t)ue_initial_id, (void **)&result); + + if (h_rc == HASH_TABLE_OK) { + if (eNB_ue_s1ap_id > 0) { + h_rc = hashtable_get(rrc_instance_pP->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, (void **)&result2); + + if (h_rc != HASH_TABLE_OK) { + result2 = malloc(sizeof(*result2)); + + if (NULL != result2) { + *result2 = *result; + result2->eNB_ue_s1ap_id = eNB_ue_s1ap_id; + result->eNB_ue_s1ap_id = eNB_ue_s1ap_id; h_rc = hashtable_insert(rrc_instance_pP->s1ap_id2_s1ap_ids, - (hash_key_t)eNB_ue_s1ap_id, - result2); + (hash_key_t)eNB_ue_s1ap_id, + result2); + if (h_rc != HASH_TABLE_OK) { LOG_E(S1AP, "[eNB %ld] Error while hashtable_insert in s1ap_id2_s1ap_ids eNB_ue_s1ap_id %"PRIu32"\n", - rrc_instance_pP - RC.rrc[0], eNB_ue_s1ap_id); + rrc_instance_pP - RC.rrc[0], eNB_ue_s1ap_id); } - } - } - } - } + } + } + } + } } + return result; } //------------------------------------------------------------------------------ void rrc_eNB_S1AP_remove_ue_ids( - eNB_RRC_INST* const rrc_instance_pP, - struct rrc_ue_s1ap_ids_s* const ue_ids_pP + eNB_RRC_INST *const rrc_instance_pP, + struct rrc_ue_s1ap_ids_s *const ue_ids_pP ) //------------------------------------------------------------------------------ { const uint16_t ue_initial_id = ue_ids_pP->ue_initial_id; const uint32_t eNB_ue_s1ap_id = ue_ids_pP->eNB_ue_s1ap_id; hashtable_rc_t h_rc; + if (rrc_instance_pP == NULL) { LOG_E(RRC, "Bad RRC instance\n"); return; @@ -226,21 +229,23 @@ rrc_eNB_S1AP_remove_ue_ids( } if (eNB_ue_s1ap_id > 0) { - h_rc = hashtable_remove(rrc_instance_pP->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id); - if (h_rc != HASH_TABLE_OK) { - LOG_W(RRC, "S1AP Did not find entry in hashtable s1ap_id2_s1ap_ids for eNB_ue_s1ap_id %u\n", eNB_ue_s1ap_id); - } else { - LOG_W(RRC, "S1AP removed entry in hashtable s1ap_id2_s1ap_ids for eNB_ue_s1ap_id %u\n", eNB_ue_s1ap_id); - } + h_rc = hashtable_remove(rrc_instance_pP->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id); + + if (h_rc != HASH_TABLE_OK) { + LOG_W(RRC, "S1AP Did not find entry in hashtable s1ap_id2_s1ap_ids for eNB_ue_s1ap_id %u\n", eNB_ue_s1ap_id); + } else { + LOG_W(RRC, "S1AP removed entry in hashtable s1ap_id2_s1ap_ids for eNB_ue_s1ap_id %u\n", eNB_ue_s1ap_id); + } } if (ue_initial_id != UE_INITIAL_ID_INVALID) { h_rc = hashtable_remove(rrc_instance_pP->initial_id2_s1ap_ids, (hash_key_t)ue_initial_id); - if (h_rc != HASH_TABLE_OK) { - LOG_W(RRC, "S1AP Did not find entry in hashtable initial_id2_s1ap_ids for ue_initial_id %u\n", ue_initial_id); - } else { - LOG_W(RRC, "S1AP removed entry in hashtable initial_id2_s1ap_ids for ue_initial_id %u\n", ue_initial_id); - } + + if (h_rc != HASH_TABLE_OK) { + LOG_W(RRC, "S1AP Did not find entry in hashtable initial_id2_s1ap_ids for ue_initial_id %u\n", ue_initial_id); + } else { + LOG_W(RRC, "S1AP removed entry in hashtable initial_id2_s1ap_ids for ue_initial_id %u\n", ue_initial_id); + } } } @@ -278,14 +283,14 @@ get_next_ue_initial_id( *\param eNB_ue_s1ap_id The value sent by S1AP. *\return the UE index or UE_INDEX_INVALID if not found. */ -static struct rrc_eNB_ue_context_s* +static struct rrc_eNB_ue_context_s * rrc_eNB_get_ue_context_from_s1ap_ids( const instance_t instanceP, const uint16_t ue_initial_idP, const uint32_t eNB_ue_s1ap_idP ) { - rrc_ue_s1ap_ids_t* temp = NULL; + rrc_ue_s1ap_ids_t *temp = NULL; temp = rrc_eNB_S1AP_get_ue_ids( RC.rrc[ENB_INSTANCE_TO_MODULE_ID(instanceP)], @@ -293,7 +298,6 @@ rrc_eNB_get_ue_context_from_s1ap_ids( eNB_ue_s1ap_idP); if (temp) { - return rrc_eNB_get_ue_context( RC.rrc[ENB_INSTANCE_TO_MODULE_ID(instanceP)], temp->ue_rnti); @@ -309,8 +313,7 @@ rrc_eNB_get_ue_context_from_s1ap_ids( */ static CipheringAlgorithm_r12_t rrc_eNB_select_ciphering(uint16_t algorithms) { - -//#warning "Forced return SecurityAlgorithmConfig__cipheringAlgorithm_eea0, to be deleted in future" + //#warning "Forced return SecurityAlgorithmConfig__cipheringAlgorithm_eea0, to be deleted in future" return CipheringAlgorithm_r12_eea0; if (algorithms & S1AP_ENCRYPTION_EEA2_MASK) { @@ -331,7 +334,6 @@ static CipheringAlgorithm_r12_t rrc_eNB_select_ciphering(uint16_t algorithms) */ static e_SecurityAlgorithmConfig__integrityProtAlgorithm rrc_eNB_select_integrity(uint16_t algorithms) { - if (algorithms & S1AP_INTEGRITY_EIA2_MASK) { return SecurityAlgorithmConfig__integrityProtAlgorithm_eia2; } @@ -352,18 +354,16 @@ static e_SecurityAlgorithmConfig__integrityProtAlgorithm rrc_eNB_select_integrit */ static 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 + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + security_capabilities_t *security_capabilities_pP ) { boolean_t changed = FALSE; CipheringAlgorithm_r12_t cipheringAlgorithm; e_SecurityAlgorithmConfig__integrityProtAlgorithm integrityProtAlgorithm; - /* Save security parameters */ ue_context_pP->ue_context.security_capabilities = *security_capabilities_pP; - // translation LOG_D(RRC, "[eNB %d] NAS security_capabilities.encryption_algorithms %u AS ciphering_algorithm %lu NAS security_capabilities.integrity_algorithms %u AS integrity_algorithm %u\n", @@ -394,7 +394,6 @@ rrc_eNB_process_security( (unsigned long)cipheringAlgorithm, integrityProtAlgorithm, changed ? "changed" : "same"); - return changed; } @@ -406,16 +405,15 @@ rrc_eNB_process_security( */ //------------------------------------------------------------------------------ static 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 + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + uint8_t *security_key_pP ) //------------------------------------------------------------------------------ { #if defined(ENABLE_SECURITY) char ascii_buffer[65]; uint8_t i; - /* Saves the security key */ memcpy (ue_context_pP->ue_context.kenb, security_key_pP, SECURITY_KEY_LENGTH); memset (ue_context_pP->ue_context.nh, 0, SECURITY_KEY_LENGTH); @@ -426,7 +424,6 @@ static void process_eNB_security_key ( } ascii_buffer[2 * i] = '\0'; - LOG_I (RRC, "[eNB %d][UE %x] Saved security key %s\n", ctxt_pP->module_id, ue_context_pP->ue_context.rnti, ascii_buffer); #endif } @@ -435,17 +432,14 @@ static void process_eNB_security_key ( //------------------------------------------------------------------------------ void rrc_pdcp_config_security( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, const uint8_t send_security_mode_command ) //------------------------------------------------------------------------------ { - #if defined(ENABLE_SECURITY) - - - SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; + SRB_ToAddModList_t *SRB_configList = ue_context_pP->ue_context.SRB_configList; uint8_t *kRRCenc = NULL; uint8_t *kRRCint = NULL; uint8_t *kUPenc = NULL; @@ -467,11 +461,9 @@ rrc_pdcp_config_security( derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm, ue_context_pP->ue_context.kenb, &kRRCint); - #if !defined(USRP_REC_PLAY) #define DEBUG_SECURITY 1 #endif - #if defined (DEBUG_SECURITY) #undef msg #define msg printf @@ -486,7 +478,6 @@ rrc_pdcp_config_security( } msg("\n"); - msg("\nKRRCenc:"); for(i = 0; i < 32; i++) { @@ -494,7 +485,6 @@ rrc_pdcp_config_security( } msg("\n"); - msg("\nKRRCint:"); for(i = 0; i < 32; i++) { @@ -502,13 +492,11 @@ rrc_pdcp_config_security( } msg("\n"); - } #endif //DEBUG_SECURITY key = PDCP_COLL_KEY_VALUE(ctxt_pP->module_id, ctxt_pP->rnti, ctxt_pP->enb_flag, DCCH, SRB_FLAG_YES); - h_rc = hashtable_get(pdcp_coll_p, key, (void**)&pdcp_p); - + h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); if (h_rc == HASH_TABLE_OK) { pdcp_config_set_security( @@ -536,8 +524,8 @@ rrc_pdcp_config_security( //------------------------------------------------------------------------------ void rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP ) //------------------------------------------------------------------------------ { @@ -545,7 +533,6 @@ rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP( int e_rab; int e_rabs_done = 0; int e_rabs_failed = 0; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_INITIAL_CONTEXT_SETUP_RESP); S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; @@ -576,11 +563,8 @@ rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP( ue_context_pP->ue_id_rnti, S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).eNB_ue_s1ap_id, e_rabs_done, e_rabs_failed); - - S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).nb_of_e_rabs = e_rabs_done; S1AP_INITIAL_CONTEXT_SETUP_RESP (msg_p).nb_of_e_rabs_failed = e_rabs_failed; - itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p); } # endif @@ -588,9 +572,9 @@ rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP( //------------------------------------------------------------------------------ void rrc_eNB_send_S1AP_UPLINK_NAS( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - UL_DCCH_Message_t* const ul_dcch_msg + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + UL_DCCH_Message_t *const ul_dcch_msg ) //------------------------------------------------------------------------------ { @@ -605,23 +589,19 @@ rrc_eNB_send_S1AP_UPLINK_NAS( == ULInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS)) { /* This message hold a dedicated info NAS payload, forward it to NAS */ struct ULInformationTransfer_r8_IEs__dedicatedInfoType *dedicatedInfoType = - &ulInformationTransfer->criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType; + &ulInformationTransfer->criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType; uint32_t pdu_length; uint8_t *pdu_buffer; MessageDef *msg_p; - pdu_length = dedicatedInfoType->choice.dedicatedInfoNAS.size; pdu_buffer = dedicatedInfoType->choice.dedicatedInfoNAS.buf; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_UPLINK_NAS); S1AP_UPLINK_NAS (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; S1AP_UPLINK_NAS (msg_p).nas_pdu.length = pdu_length; S1AP_UPLINK_NAS (msg_p).nas_pdu.buffer = pdu_buffer; - extract_imsi(S1AP_UPLINK_NAS (msg_p).nas_pdu.buffer, - S1AP_UPLINK_NAS (msg_p).nas_pdu.length, - ue_context_pP); - + S1AP_UPLINK_NAS (msg_p).nas_pdu.length, + ue_context_pP); itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p); } } @@ -636,7 +616,6 @@ rrc_eNB_send_S1AP_UPLINK_NAS( ULInformationTransfer__criticalExtensions_PR_c1) { if (ulInformationTransfer->criticalExtensions.choice.c1.present == ULInformationTransfer__criticalExtensions__c1_PR_ulInformationTransfer_r8) { - ULInformationTransfer_r8_IEs_t *ulInformationTransferR8; ulInformationTransferR8 = @@ -644,15 +623,13 @@ rrc_eNB_send_S1AP_UPLINK_NAS( c1.choice.ulInformationTransfer_r8; if (ulInformationTransferR8->dedicatedInfoType.present == - ULInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS) { - + ULInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS) { extract_imsi(ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.buf, - ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.size, - ue_context_pP); - + ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.size, + ue_context_pP); s1ap_eNB_new_data_request (mod_id, ue_index, - ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.buf, - ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.size); + ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.buf, + ulInformationTransferR8->dedicatedInfoType.choice.dedicatedInfoNAS.size); } } } @@ -662,9 +639,9 @@ rrc_eNB_send_S1AP_UPLINK_NAS( //------------------------------------------------------------------------------ void rrc_eNB_send_S1AP_UE_CAPABILITIES_IND( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - UL_DCCH_Message_t* ul_dcch_msg + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + UL_DCCH_Message_t *ul_dcch_msg ) //------------------------------------------------------------------------------ { @@ -680,39 +657,39 @@ void rrc_eNB_send_S1AP_UE_CAPABILITIES_IND( return; } - asn_enc_rval_t ret = uper_encode_to_buffer(&asn_DEF_UECapabilityInformation, ueCapabilityInformation, buf, 4096); + asn_enc_rval_t ret = uper_encode_to_buffer(&asn_DEF_UECapabilityInformation, NULL, ueCapabilityInformation, buf, 4096); + if (ret.encoded == -1) abort(); memset(&rac, 0, sizeof(UERadioAccessCapabilityInformation_t)); - rac.criticalExtensions.present = UERadioAccessCapabilityInformation__criticalExtensions_PR_c1; rac.criticalExtensions.choice.c1.present = UERadioAccessCapabilityInformation__criticalExtensions__c1_PR_ueRadioAccessCapabilityInformation_r8; rac.criticalExtensions.choice.c1.choice.ueRadioAccessCapabilityInformation_r8.ue_RadioAccessCapabilityInfo.buf = buf; rac.criticalExtensions.choice.c1.choice.ueRadioAccessCapabilityInformation_r8.ue_RadioAccessCapabilityInfo.size = (ret.encoded+7)/8; rac.criticalExtensions.choice.c1.choice.ueRadioAccessCapabilityInformation_r8.nonCriticalExtension = NULL; - /* 8192 is arbitrary, should be big enough */ buf2 = malloc16(8192); + if (buf2 == NULL) abort(); - ret = uper_encode_to_buffer(&asn_DEF_UERadioAccessCapabilityInformation, &rac, buf2, 8192); + + ret = uper_encode_to_buffer(&asn_DEF_UERadioAccessCapabilityInformation, NULL, &rac, buf2, 8192); + if (ret.encoded == -1) abort(); MessageDef *msg_p; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_UE_CAPABILITIES_IND); S1AP_UE_CAPABILITIES_IND (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; S1AP_UE_CAPABILITIES_IND (msg_p).ue_radio_cap.length = (ret.encoded+7)/8; S1AP_UE_CAPABILITIES_IND (msg_p).ue_radio_cap.buffer = buf2; - itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p); } //------------------------------------------------------------------------------ void rrc_eNB_send_S1AP_NAS_FIRST_REQ( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - RRCConnectionSetupComplete_r8_IEs_t* rrcConnectionSetupComplete + const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + RRCConnectionSetupComplete_r8_IEs_t *rrcConnectionSetupComplete ) //------------------------------------------------------------------------------ @@ -721,67 +698,58 @@ rrc_eNB_send_S1AP_NAS_FIRST_REQ( eNB_RRC_INST *rrc=RC.rrc[ctxt_pP->module_id]; #if defined(ENABLE_ITTI) { - MessageDef* message_p = NULL; - rrc_ue_s1ap_ids_t* rrc_ue_s1ap_ids_p = NULL; + MessageDef *message_p = NULL; + rrc_ue_s1ap_ids_t *rrc_ue_s1ap_ids_p = NULL; hashtable_rc_t h_rc; - message_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_NAS_FIRST_REQ); memset(&message_p->ittiMsg.s1ap_nas_first_req, 0, sizeof(s1ap_nas_first_req_t)); - ue_context_pP->ue_context.ue_initial_id = get_next_ue_initial_id (ctxt_pP->module_id); S1AP_NAS_FIRST_REQ (message_p).ue_initial_id = ue_context_pP->ue_context.ue_initial_id; - rrc_ue_s1ap_ids_p = malloc(sizeof(*rrc_ue_s1ap_ids_p)); rrc_ue_s1ap_ids_p->ue_initial_id = ue_context_pP->ue_context.ue_initial_id; rrc_ue_s1ap_ids_p->eNB_ue_s1ap_id = UE_INITIAL_ID_INVALID; rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti; - h_rc = hashtable_insert(RC.rrc[ctxt_pP->module_id]->initial_id2_s1ap_ids, - (hash_key_t)ue_context_pP->ue_context.ue_initial_id, - rrc_ue_s1ap_ids_p); + (hash_key_t)ue_context_pP->ue_context.ue_initial_id, + rrc_ue_s1ap_ids_p); + if (h_rc != HASH_TABLE_OK) { LOG_E(S1AP, "[eNB %d] Error while hashtable_insert in initial_id2_s1ap_ids ue_initial_id %u\n", - ctxt_pP->module_id, ue_context_pP->ue_context.ue_initial_id); + ctxt_pP->module_id, ue_context_pP->ue_context.ue_initial_id); } /* Assume that cause is coded in the same way in RRC and S1ap, just check that the value is in S1ap range */ AssertFatal(ue_context_pP->ue_context.establishment_cause < RRC_CAUSE_LAST, - "Establishment cause invalid (%jd/%d) for eNB %d!", - ue_context_pP->ue_context.establishment_cause, RRC_CAUSE_LAST, ctxt_pP->module_id); - + "Establishment cause invalid (%jd/%d) for eNB %d!", + ue_context_pP->ue_context.establishment_cause, RRC_CAUSE_LAST, ctxt_pP->module_id); S1AP_NAS_FIRST_REQ (message_p).establishment_cause = ue_context_pP->ue_context.establishment_cause; - /* Forward NAS message */S1AP_NAS_FIRST_REQ (message_p).nas_pdu.buffer = - rrcConnectionSetupComplete->dedicatedInfoNAS.buf; + rrcConnectionSetupComplete->dedicatedInfoNAS.buf; S1AP_NAS_FIRST_REQ (message_p).nas_pdu.length = rrcConnectionSetupComplete->dedicatedInfoNAS.size; - extract_imsi(S1AP_NAS_FIRST_REQ (message_p).nas_pdu.buffer, S1AP_NAS_FIRST_REQ (message_p).nas_pdu.length, ue_context_pP); - /* Fill UE identities with available information */ { S1AP_NAS_FIRST_REQ (message_p).ue_identity.presenceMask = UE_IDENTITIES_NONE; if (ue_context_pP->ue_context.Initialue_identity_s_TMSI.presence) { /* Fill s-TMSI */ - UE_S_TMSI* s_TMSI = &ue_context_pP->ue_context.Initialue_identity_s_TMSI; - + UE_S_TMSI *s_TMSI = &ue_context_pP->ue_context.Initialue_identity_s_TMSI; S1AP_NAS_FIRST_REQ (message_p).ue_identity.presenceMask |= UE_IDENTITIES_s_tmsi; S1AP_NAS_FIRST_REQ (message_p).ue_identity.s_tmsi.mme_code = s_TMSI->mme_code; S1AP_NAS_FIRST_REQ (message_p).ue_identity.s_tmsi.m_tmsi = s_TMSI->m_tmsi; LOG_I(S1AP, "[eNB %d] Build S1AP_NAS_FIRST_REQ with s_TMSI: MME code %u M-TMSI %u ue %x\n", - ctxt_pP->module_id, - S1AP_NAS_FIRST_REQ (message_p).ue_identity.s_tmsi.mme_code, - S1AP_NAS_FIRST_REQ (message_p).ue_identity.s_tmsi.m_tmsi, - ue_context_pP->ue_context.rnti); + ctxt_pP->module_id, + S1AP_NAS_FIRST_REQ (message_p).ue_identity.s_tmsi.mme_code, + S1AP_NAS_FIRST_REQ (message_p).ue_identity.s_tmsi.m_tmsi, + ue_context_pP->ue_context.rnti); } if (rrcConnectionSetupComplete->registeredMME != NULL) { /* Fill GUMMEI */ struct RegisteredMME *r_mme = rrcConnectionSetupComplete->registeredMME; //int selected_plmn_identity = rrcConnectionSetupComplete->selectedPLMN_Identity; - S1AP_NAS_FIRST_REQ (message_p).ue_identity.presenceMask |= UE_IDENTITIES_gummei; if (r_mme->plmn_Identity != NULL) { @@ -789,9 +757,9 @@ rrc_eNB_send_S1AP_NAS_FIRST_REQ( /* Use first indicated PLMN MCC if it is defined */ S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mcc = *r_mme->plmn_Identity->mcc->list.array[0]; LOG_I(S1AP, "[eNB %d] Build S1AP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI MCC %u ue %x\n", - ctxt_pP->module_id, - S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mcc, - ue_context_pP->ue_context.rnti); + ctxt_pP->module_id, + S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mcc, + ue_context_pP->ue_context.rnti); } if (r_mme->plmn_Identity->mnc.list.count > 0) { @@ -803,9 +771,8 @@ rrc_eNB_send_S1AP_NAS_FIRST_REQ( ue_context_pP->ue_context.rnti); } } else { - // const Enb_properties_array_t *enb_properties_p = NULL; - // enb_properties_p = enb_config_get(); - + // const Enb_properties_array_t *enb_properties_p = NULL; + // enb_properties_p = enb_config_get(); // actually the eNB configuration contains only one PLMN (can be up to 6) S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mcc = rrc->mcc; S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mnc = rrc->mnc; @@ -814,7 +781,6 @@ rrc_eNB_send_S1AP_NAS_FIRST_REQ( S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mme_code = BIT_STRING_to_uint8 (&r_mme->mmec); S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mme_group_id = BIT_STRING_to_uint16 (&r_mme->mmegi); - MSC_LOG_TX_MESSAGE( MSC_S1AP_ENB, MSC_S1AP_MME, @@ -824,7 +790,6 @@ rrc_eNB_send_S1AP_NAS_FIRST_REQ( MSC_AS_TIME_ARGS(ctxt_pP), ctxt_pP->module_id, ctxt_pP->rnti); - LOG_I(S1AP, "[eNB %d] Build S1AP_NAS_FIRST_REQ adding in s_TMSI: GUMMEI mme_code %u mme_group_id %u ue %x\n", ctxt_pP->module_id, S1AP_NAS_FIRST_REQ (message_p).ue_identity.gummei.mme_code, @@ -851,10 +816,10 @@ rrc_eNB_send_S1AP_NAS_FIRST_REQ( //------------------------------------------------------------------------------ int rrc_eNB_process_S1AP_DOWNLINK_NAS( - MessageDef* msg_p, - const char* msg_name, + MessageDef *msg_p, + const char *msg_name, instance_t instance, - mui_t* rrc_eNB_mui + mui_t *rrc_eNB_mui ) //------------------------------------------------------------------------------ { @@ -862,15 +827,12 @@ rrc_eNB_process_S1AP_DOWNLINK_NAS( uint32_t eNB_ue_s1ap_id; uint32_t length; uint8_t *buffer; - uint8_t srb_id; - - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint8_t srb_id; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; protocol_ctxt_t ctxt; ue_initial_id = S1AP_DOWNLINK_NAS (msg_p).ue_initial_id; eNB_ue_s1ap_id = S1AP_DOWNLINK_NAS (msg_p).eNB_ue_s1ap_id; ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, ue_initial_id, eNB_ue_s1ap_id); - - LOG_I(RRC, "[eNB %d] Received %s: ue_initial_id %d, eNB_ue_s1ap_id %d\n", instance, msg_name, @@ -878,7 +840,6 @@ rrc_eNB_process_S1AP_DOWNLINK_NAS( eNB_ue_s1ap_id); if (ue_context_p == NULL) { - MSC_LOG_RX_MESSAGE( MSC_RRC_ENB, MSC_S1AP_ENB, @@ -888,20 +849,14 @@ rrc_eNB_process_S1AP_DOWNLINK_NAS( 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), ue_initial_id, eNB_ue_s1ap_id); - /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */ MessageDef *msg_fail_p; - LOG_W(RRC, "[eNB %d] In S1AP_DOWNLINK_NAS: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id); - msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_NAS_NON_DELIVERY_IND); S1AP_NAS_NON_DELIVERY_IND (msg_fail_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; S1AP_NAS_NON_DELIVERY_IND (msg_fail_p).nas_pdu.length = S1AP_DOWNLINK_NAS (msg_p).nas_pdu.length; S1AP_NAS_NON_DELIVERY_IND (msg_fail_p).nas_pdu.buffer = S1AP_DOWNLINK_NAS (msg_p).nas_pdu.buffer; - // TODO add failure cause when defined! - - MSC_LOG_TX_MESSAGE( MSC_RRC_ENB, MSC_S1AP_ENB, @@ -911,14 +866,11 @@ rrc_eNB_process_S1AP_DOWNLINK_NAS( 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), ue_initial_id, eNB_ue_s1ap_id); - itti_send_msg_to_task (TASK_S1AP, instance, msg_fail_p); return (-1); } else { PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0); - srb_id = ue_context_p->ue_context.Srb2.Srb_info.Srb_id; - /* Is it the first income from S1AP ? */ if (ue_context_p->ue_context.eNB_ue_s1ap_id == 0) { @@ -934,8 +886,6 @@ rrc_eNB_process_S1AP_DOWNLINK_NAS( 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), ue_initial_id, S1AP_DOWNLINK_NAS (msg_p).eNB_ue_s1ap_id); - - /* Create message for PDCP (DLInformationTransfer_t) */ length = do_DLInformationTransfer ( instance, @@ -943,30 +893,28 @@ rrc_eNB_process_S1AP_DOWNLINK_NAS( rrc_eNB_get_next_transaction_identifier (instance), S1AP_DOWNLINK_NAS (msg_p).nas_pdu.length, S1AP_DOWNLINK_NAS (msg_p).nas_pdu.buffer); - #ifdef RRC_MSG_PRINT int i=0; LOG_F(RRC,"[MSG] RRC DL Information Transfer\n"); for (i = 0; i < length; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); + LOG_F(RRC,"%02x ", ((uint8_t *)buffer)[i]); } LOG_F(RRC,"\n"); #endif - /* - * switch UL or DL NAS message without RRC piggybacked to SRB2 if active. + /* + * switch UL or DL NAS message without RRC piggybacked to SRB2 if active. */ /* Transfer data to PDCP */ rrc_data_req ( - &ctxt, - srb_id, - *rrc_eNB_mui++, - SDU_CONFIRM_NO, - length, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); - + &ctxt, + srb_id, + *rrc_eNB_mui++, + SDU_CONFIRM_NO, + length, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); return (0); } } @@ -979,9 +927,8 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char //MessageDef *message_gtpv1u_p = NULL; gtpv1u_enb_create_tunnel_req_t create_tunnel_req; gtpv1u_enb_create_tunnel_resp_t create_tunnel_resp; - uint8_t inde_list[NB_RB_MAX - 3]={0}; - - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint8_t inde_list[NB_RB_MAX - 3]= {0}; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; protocol_ctxt_t ctxt; ue_initial_id = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).ue_initial_id; eNB_ue_s1ap_id = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).eNB_ue_s1ap_id; @@ -992,63 +939,49 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char if (ue_context_p == NULL) { /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */ MessageDef *msg_fail_p = NULL; - LOG_W(RRC, "[eNB %d] In S1AP_INITIAL_CONTEXT_SETUP_REQ: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id); - msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_INITIAL_CONTEXT_SETUP_FAIL); S1AP_INITIAL_CONTEXT_SETUP_FAIL (msg_fail_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; - // TODO add failure cause when defined! - itti_send_msg_to_task (TASK_S1AP, instance, msg_fail_p); return (-1); } else { - PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0); ue_context_p->ue_context.eNB_ue_s1ap_id = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).eNB_ue_s1ap_id; - /* Save e RAB information for later */ { int i; - - memset(&create_tunnel_req, 0 , sizeof(create_tunnel_req)); + memset(&create_tunnel_req, 0, sizeof(create_tunnel_req)); ue_context_p->ue_context.nb_of_e_rabs = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).nb_of_e_rabs; - + for (i = 0; i < ue_context_p->ue_context.nb_of_e_rabs; i++) { ue_context_p->ue_context.e_rab[i].status = E_RAB_STATUS_NEW; ue_context_p->ue_context.e_rab[i].param = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).e_rab_param[i]; - - create_tunnel_req.eps_bearer_id[i] = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).e_rab_param[i].e_rab_id; create_tunnel_req.sgw_S1u_teid[i] = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).e_rab_param[i].gtp_teid; - memcpy(&create_tunnel_req.sgw_addr[i], &S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).e_rab_param[i].sgw_addr, sizeof(transport_layer_addr_t)); inde_list[create_tunnel_req.num_tunnels]= i; create_tunnel_req.num_tunnels++; } - - create_tunnel_req.rnti = ue_context_p->ue_context.rnti; // warning put zero above -// create_tunnel_req.num_tunnels = i; + create_tunnel_req.rnti = ue_context_p->ue_context.rnti; // warning put zero above + // create_tunnel_req.num_tunnels = i; gtpv1u_create_s1u_tunnel( instance, &create_tunnel_req, &create_tunnel_resp); - rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP( - &ctxt, - &create_tunnel_resp, - &inde_list[0]); + &ctxt, + &create_tunnel_resp, + &inde_list[0]); ue_context_p->ue_context.setup_e_rabs=ue_context_p->ue_context.nb_of_e_rabs; } - /* TODO parameters yet to process ... */ { // S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p).ue_ambr; } - rrc_eNB_process_security ( &ctxt, ue_context_p, @@ -1057,10 +990,8 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char &ctxt, ue_context_p, S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p).security_key); - { uint8_t send_security_mode_command = TRUE; - #ifndef EXMIMO_IOT if ((ue_context_p->ue_context.ciphering_algorithm == SecurityAlgorithmConfig__cipheringAlgorithm_eea0) @@ -1075,7 +1006,6 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char send_security_mode_command); if (send_security_mode_command) { - rrc_eNB_generate_SecurityModeCommand ( &ctxt, ue_context_p); @@ -1097,27 +1027,21 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char int rrc_eNB_process_S1AP_UE_CTXT_MODIFICATION_REQ(MessageDef *msg_p, const char *msg_name, instance_t instance) { uint32_t eNB_ue_s1ap_id; - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; protocol_ctxt_t ctxt; - eNB_ue_s1ap_id = S1AP_UE_CTXT_MODIFICATION_REQ (msg_p).eNB_ue_s1ap_id; ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, UE_INITIAL_ID_INVALID, eNB_ue_s1ap_id); if (ue_context_p == NULL) { /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */ MessageDef *msg_fail_p; - LOG_W(RRC, "[eNB %d] In S1AP_UE_CTXT_MODIFICATION_REQ: unknown UE from eNB_ue_s1ap_id (%d)\n", instance, eNB_ue_s1ap_id); - msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_UE_CTXT_MODIFICATION_FAIL); S1AP_UE_CTXT_MODIFICATION_FAIL (msg_fail_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; - // TODO add failure cause when defined! - itti_send_msg_to_task (TASK_S1AP, instance, msg_fail_p); return (-1); } else { - PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0); /* TODO parameters yet to process ... */ { @@ -1143,20 +1067,16 @@ int rrc_eNB_process_S1AP_UE_CTXT_MODIFICATION_REQ(MessageDef *msg_p, const char &ctxt, ue_context_p, S1AP_UE_CTXT_MODIFICATION_REQ(msg_p).security_key); - /* TODO reconfigure lower layers... */ } /* Send the response */ { MessageDef *msg_resp_p; - msg_resp_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CTXT_MODIFICATION_RESP); S1AP_UE_CTXT_MODIFICATION_RESP(msg_resp_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; - itti_send_msg_to_task(TASK_S1AP, instance, msg_resp_p); } - return (0); } } @@ -1165,39 +1085,30 @@ int rrc_eNB_process_S1AP_UE_CTXT_MODIFICATION_REQ(MessageDef *msg_p, const char int rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_REQ (MessageDef *msg_p, const char *msg_name, instance_t instance) { uint32_t eNB_ue_s1ap_id; - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - + struct rrc_eNB_ue_context_s *ue_context_p = NULL; eNB_ue_s1ap_id = S1AP_UE_CONTEXT_RELEASE_REQ(msg_p).eNB_ue_s1ap_id; ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, UE_INITIAL_ID_INVALID, eNB_ue_s1ap_id); if (ue_context_p == NULL) { /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */ MessageDef *msg_fail_p; - LOG_W(RRC, "[eNB %d] In S1AP_UE_CONTEXT_RELEASE_REQ: unknown UE from eNB_ue_s1ap_id (%d)\n", instance, eNB_ue_s1ap_id); - msg_fail_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_RESP); /* TODO change message ID. */ S1AP_UE_CONTEXT_RELEASE_RESP(msg_fail_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; - // TODO add failure cause when defined! - itti_send_msg_to_task(TASK_S1AP, instance, msg_fail_p); return (-1); } else { /* TODO release context. */ - /* Send the response */ { MessageDef *msg_resp_p; - msg_resp_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_RESP); S1AP_UE_CONTEXT_RELEASE_RESP(msg_resp_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; - itti_send_msg_to_task(TASK_S1AP, instance, msg_resp_p); } - return (0); } } @@ -1205,7 +1116,7 @@ int rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_REQ (MessageDef *msg_p, const char * //------------------------------------------------------------------------------ void rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ ( const module_id_t enb_mod_idP, - const rrc_eNB_ue_context_t* const ue_context_pP, + const rrc_eNB_ue_context_t *const ue_context_pP, const s1ap_Cause_t causeP, const long cause_valueP ) @@ -1215,13 +1126,12 @@ void rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ ( LOG_W(RRC, "[eNB] In S1AP_UE_CONTEXT_RELEASE_COMMAND: invalid UE\n"); } else { - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_S1AP_ENB, - NULL,0, - "0 S1AP_UE_CONTEXT_RELEASE_REQ eNB_ue_s1ap_id 0x%06"PRIX32" ", - ue_context_pP->ue_context.eNB_ue_s1ap_id); - + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_S1AP_ENB, + NULL,0, + "0 S1AP_UE_CONTEXT_RELEASE_REQ eNB_ue_s1ap_id 0x%06"PRIX32" ", + ue_context_pP->ue_context.eNB_ue_s1ap_id); MessageDef *msg_context_release_req_p = NULL; msg_context_release_req_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_REQ); S1AP_UE_CONTEXT_RELEASE_REQ(msg_context_release_req_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; @@ -1239,47 +1149,40 @@ int rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND (MessageDef *msg_p, const ch protocol_ctxt_t ctxt; struct rrc_eNB_ue_context_s *ue_context_p = NULL; struct rrc_ue_s1ap_ids_s *rrc_ue_s1ap_ids = NULL; - eNB_ue_s1ap_id = S1AP_UE_CONTEXT_RELEASE_COMMAND(msg_p).eNB_ue_s1ap_id; - - ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, UE_INITIAL_ID_INVALID, eNB_ue_s1ap_id); if (ue_context_p == NULL) { /* Can not associate this message to an UE index */ MessageDef *msg_complete_p; - LOG_W(RRC, "[eNB %d] In S1AP_UE_CONTEXT_RELEASE_COMMAND: unknown UE from eNB_ue_s1ap_id (%d)\n", instance, eNB_ue_s1ap_id); - MSC_LOG_EVENT( - MSC_RRC_ENB, - "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" context not found", - eNB_ue_s1ap_id); - + MSC_RRC_ENB, + "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" context not found", + eNB_ue_s1ap_id); MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_S1AP_ENB, - NULL,0, - "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" ", - eNB_ue_s1ap_id); - + MSC_RRC_ENB, + MSC_S1AP_ENB, + NULL,0, + "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" ", + eNB_ue_s1ap_id); msg_complete_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_COMPLETE); S1AP_UE_CONTEXT_RELEASE_COMPLETE(msg_complete_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; itti_send_msg_to_task(TASK_S1AP, instance, msg_complete_p); - rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids( - RC.rrc[instance], - UE_INITIAL_ID_INVALID, - eNB_ue_s1ap_id); + RC.rrc[instance], + UE_INITIAL_ID_INVALID, + eNB_ue_s1ap_id); if (NULL != rrc_ue_s1ap_ids) { rrc_eNB_S1AP_remove_ue_ids( - RC.rrc[instance], - rrc_ue_s1ap_ids); + RC.rrc[instance], + rrc_ue_s1ap_ids); } + return (-1); } else { ue_context_p->ue_context.ue_release_timer_s1 = 0; @@ -1295,19 +1198,16 @@ int rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND (MessageDef *msg_p, const ch int e_rab; //int mod_id = 0; MessageDef *msg_delete_tunnels_p = NULL; - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_GTPU_ENB, - NULL,0, - "0 GTPV1U_ENB_DELETE_TUNNEL_REQ rnti %x ", - eNB_ue_s1ap_id); - + MSC_RRC_ENB, + MSC_GTPU_ENB, + NULL,0, + "0 GTPV1U_ENB_DELETE_TUNNEL_REQ rnti %x ", + eNB_ue_s1ap_id); msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ); memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); - // do not wait response GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; @@ -1321,32 +1221,27 @@ int rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND (MessageDef *msg_p, const ch } itti_send_msg_to_task(TASK_GTPV1_U, instance, msg_delete_tunnels_p); - - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_S1AP_ENB, - NULL,0, - "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" ", - eNB_ue_s1ap_id); - + MSC_RRC_ENB, + MSC_S1AP_ENB, + NULL,0, + "0 S1AP_UE_CONTEXT_RELEASE_COMPLETE eNB_ue_s1ap_id 0x%06"PRIX32" ", + eNB_ue_s1ap_id); MessageDef *msg_complete_p = NULL; msg_complete_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_COMPLETE); S1AP_UE_CONTEXT_RELEASE_COMPLETE(msg_complete_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; itti_send_msg_to_task(TASK_S1AP, instance, msg_complete_p); - rrc_ue_s1ap_ids = rrc_eNB_S1AP_get_ue_ids( - RC.rrc[instance], - UE_INITIAL_ID_INVALID, - eNB_ue_s1ap_id); + RC.rrc[instance], + UE_INITIAL_ID_INVALID, + eNB_ue_s1ap_id); if (NULL != rrc_ue_s1ap_ids) { rrc_eNB_S1AP_remove_ue_ids( - RC.rrc[instance], - rrc_ue_s1ap_ids); + RC.rrc[instance], + rrc_ue_s1ap_ids); } } - return (0); } } @@ -1357,12 +1252,10 @@ int rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(MessageDef *msg_p, const char *msg_name uint32_t eNB_ue_s1ap_id; gtpv1u_enb_create_tunnel_req_t create_tunnel_req; gtpv1u_enb_create_tunnel_resp_t create_tunnel_resp; - uint8_t inde_list[NB_RB_MAX - 3]={0}; - - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint8_t inde_list[NB_RB_MAX - 3]= {0}; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; protocol_ctxt_t ctxt; uint8_t e_rab_done; - ue_initial_id = S1AP_E_RAB_SETUP_REQ (msg_p).ue_initial_id; eNB_ue_s1ap_id = S1AP_E_RAB_SETUP_REQ (msg_p).eNB_ue_s1ap_id; ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, ue_initial_id, eNB_ue_s1ap_id); @@ -1372,174 +1265,150 @@ int rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(MessageDef *msg_p, const char *msg_name if (ue_context_p == NULL) { /* Can not associate this message to an UE index, send a failure to S1AP and discard it! */ MessageDef *msg_fail_p = NULL; - LOG_W(RRC, "[eNB %d] In S1AP_E_RAB_SETUP_REQ: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id); - msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_SETUP_REQUEST_FAIL); S1AP_E_RAB_SETUP_REQ (msg_fail_p).eNB_ue_s1ap_id = eNB_ue_s1ap_id; - // TODO add failure cause when defined! - itti_send_msg_to_task (TASK_S1AP, instance, msg_fail_p); return (-1); } else { - PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0); ue_context_p->ue_context.eNB_ue_s1ap_id = S1AP_E_RAB_SETUP_REQ (msg_p).eNB_ue_s1ap_id; - /* Save e RAB information for later */ { int i; - - memset(&create_tunnel_req, 0 , sizeof(create_tunnel_req)); + memset(&create_tunnel_req, 0, sizeof(create_tunnel_req)); uint8_t nb_e_rabs_tosetup = S1AP_E_RAB_SETUP_REQ (msg_p).nb_e_rabs_tosetup; e_rab_done = 0; // keep the previous bearer // the index for the rec - for (i = 0; - // i < nb_e_rabs_tosetup; - i < NB_RB_MAX - 3; // loop all e-rabs in e_rab[] - i++) { - //if (ue_context_p->ue_context.e_rab[i+ue_context_p->ue_context.setup_e_rabs].status == E_RAB_STATUS_DONE) - // LOG_W(RRC,"E-RAB already configured, reconfiguring\n"); + for (i = 0; + // i < nb_e_rabs_tosetup; + i < NB_RB_MAX - 3; // loop all e-rabs in e_rab[] + i++) { + //if (ue_context_p->ue_context.e_rab[i+ue_context_p->ue_context.setup_e_rabs].status == E_RAB_STATUS_DONE) + // LOG_W(RRC,"E-RAB already configured, reconfiguring\n"); // check e-rab status, if e rab status is greater than E_RAB_STATUS_DONE, don't not config this one if(ue_context_p->ue_context.e_rab[i].status >= E_RAB_STATUS_DONE) - continue; + continue; + //ue_context_p->ue_context.e_rab[i+ue_context_p->ue_context.setup_e_rabs].status = E_RAB_STATUS_NEW; //ue_context_p->ue_context.e_rab[i+ue_context_p->ue_context.setup_e_rabs].param = S1AP_E_RAB_SETUP_REQ (msg_p).e_rab_setup_params[i]; ue_context_p->ue_context.e_rab[i].status = E_RAB_STATUS_NEW; ue_context_p->ue_context.e_rab[i].param = S1AP_E_RAB_SETUP_REQ (msg_p).e_rab_setup_params[e_rab_done]; - create_tunnel_req.eps_bearer_id[e_rab_done] = S1AP_E_RAB_SETUP_REQ (msg_p).e_rab_setup_params[e_rab_done].e_rab_id; create_tunnel_req.sgw_S1u_teid[e_rab_done] = S1AP_E_RAB_SETUP_REQ (msg_p).e_rab_setup_params[e_rab_done].gtp_teid; - memcpy(&create_tunnel_req.sgw_addr[e_rab_done], & S1AP_E_RAB_SETUP_REQ (msg_p).e_rab_setup_params[e_rab_done].sgw_addr, sizeof(transport_layer_addr_t)); - - LOG_I(RRC,"E_RAB setup REQ: local index %d teid %u, eps id %d \n", - i, - create_tunnel_req.sgw_S1u_teid[e_rab_done], - create_tunnel_req.eps_bearer_id[i] ); + LOG_I(RRC,"E_RAB setup REQ: local index %d teid %u, eps id %d \n", + i, + create_tunnel_req.sgw_S1u_teid[e_rab_done], + create_tunnel_req.eps_bearer_id[i] ); inde_list[e_rab_done] = i; - e_rab_done++; - if(e_rab_done >= nb_e_rabs_tosetup){ - break; + e_rab_done++; + + if(e_rab_done >= nb_e_rabs_tosetup) { + break; } } + ue_context_p->ue_context.nb_of_e_rabs=nb_e_rabs_tosetup; - - create_tunnel_req.rnti = ue_context_p->ue_context.rnti; // warning put zero above create_tunnel_req.num_tunnels = e_rab_done; - // NN: not sure if we should create a new tunnel: need to check teid, etc. gtpv1u_create_s1u_tunnel( instance, &create_tunnel_req, &create_tunnel_resp); - rrc_eNB_process_GTPV1U_CREATE_TUNNEL_RESP( - &ctxt, - &create_tunnel_resp, - &inde_list[0]); - + &ctxt, + &create_tunnel_resp, + &inde_list[0]); ue_context_p->ue_context.setup_e_rabs+=nb_e_rabs_tosetup; - } - /* TODO parameters yet to process ... */ { // S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p).ue_ambr; } - rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(&ctxt, ue_context_p, 0); - return (0); } } /*NN: careful about the typcast of xid (long -> uint8_t*/ -int rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - uint8_t xid ){ - +int rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + uint8_t xid ) { MessageDef *msg_p = NULL; int e_rab; int e_rabs_done = 0; int e_rabs_failed = 0; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_SETUP_RESP); S1AP_E_RAB_SETUP_RESP (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; - - for (e_rab = 0; e_rab < ue_context_pP->ue_context.setup_e_rabs ; e_rab++) { - /* only respond to the corresponding transaction */ + for (e_rab = 0; e_rab < ue_context_pP->ue_context.setup_e_rabs ; e_rab++) { + /* only respond to the corresponding transaction */ //if (((xid+1)%4) == ue_context_pP->ue_context.e_rab[e_rab].xid) { if (xid == ue_context_pP->ue_context.e_rab[e_rab].xid) { - if (ue_context_pP->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE) { - - S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].e_rab_id = ue_context_pP->ue_context.e_rab[e_rab].param.e_rab_id; - // TODO add other information from S1-U when it will be integrated - S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].gtp_teid = ue_context_pP->ue_context.enb_gtp_teid[e_rab]; - S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr = ue_context_pP->ue_context.enb_gtp_addrs[e_rab]; - //S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rab].eNB_addr.length += 4; - ue_context_pP->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED; - - LOG_I (RRC,"enb_gtp_addr (msg index %d, e_rab index %d, status %d, xid %d): nb_of_e_rabs %d, e_rab_id %d, teid: %u, addr: %d.%d.%d.%d \n ", - e_rabs_done, e_rab, ue_context_pP->ue_context.e_rab[e_rab].status, xid, - ue_context_pP->ue_context.nb_of_e_rabs, - S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].e_rab_id, - S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].gtp_teid, - S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr.buffer[0], - S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr.buffer[1], - S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr.buffer[2], - S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr.buffer[3]); - - e_rabs_done++; - } else if ((ue_context_pP->ue_context.e_rab[e_rab].status == E_RAB_STATUS_NEW) || - (ue_context_pP->ue_context.e_rab[e_rab].status == E_RAB_STATUS_ESTABLISHED)){ - LOG_D (RRC,"E-RAB is NEW or already ESTABLISHED\n"); - }else { /* to be improved */ - ue_context_pP->ue_context.e_rab[e_rab].status = E_RAB_STATUS_FAILED; - S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs_failed[e_rabs_failed].e_rab_id = ue_context_pP->ue_context.e_rab[e_rab].param.e_rab_id; - e_rabs_failed++; - // TODO add cause when it will be integrated - } - + S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].e_rab_id = ue_context_pP->ue_context.e_rab[e_rab].param.e_rab_id; + // TODO add other information from S1-U when it will be integrated + S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].gtp_teid = ue_context_pP->ue_context.enb_gtp_teid[e_rab]; + S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr = ue_context_pP->ue_context.enb_gtp_addrs[e_rab]; + //S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rab].eNB_addr.length += 4; + ue_context_pP->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED; + LOG_I (RRC,"enb_gtp_addr (msg index %d, e_rab index %d, status %d, xid %d): nb_of_e_rabs %d, e_rab_id %d, teid: %u, addr: %d.%d.%d.%d \n ", + e_rabs_done, e_rab, ue_context_pP->ue_context.e_rab[e_rab].status, xid, + ue_context_pP->ue_context.nb_of_e_rabs, + S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].e_rab_id, + S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].gtp_teid, + S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr.buffer[0], + S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr.buffer[1], + S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr.buffer[2], + S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs[e_rabs_done].eNB_addr.buffer[3]); + e_rabs_done++; + } else if ((ue_context_pP->ue_context.e_rab[e_rab].status == E_RAB_STATUS_NEW) || + (ue_context_pP->ue_context.e_rab[e_rab].status == E_RAB_STATUS_ESTABLISHED)) { + LOG_D (RRC,"E-RAB is NEW or already ESTABLISHED\n"); + } else { /* to be improved */ + ue_context_pP->ue_context.e_rab[e_rab].status = E_RAB_STATUS_FAILED; + S1AP_E_RAB_SETUP_RESP (msg_p).e_rabs_failed[e_rabs_failed].e_rab_id = ue_context_pP->ue_context.e_rab[e_rab].param.e_rab_id; + e_rabs_failed++; + // TODO add cause when it will be integrated + } + S1AP_E_RAB_SETUP_RESP (msg_p).nb_of_e_rabs = e_rabs_done; S1AP_E_RAB_SETUP_RESP (msg_p).nb_of_e_rabs_failed = e_rabs_failed; - // NN: add conditions for e_rabs_failed + // NN: add conditions for e_rabs_failed } else { - /*debug info for the xid */ + /*debug info for the xid */ LOG_D(RRC,"xid does not corresponds (context e_rab index %d, status %d, xid %d/%d) \n ", - e_rab, ue_context_pP->ue_context.e_rab[e_rab].status, xid, ue_context_pP->ue_context.e_rab[e_rab].xid); - } + e_rab, ue_context_pP->ue_context.e_rab[e_rab].status, xid, ue_context_pP->ue_context.e_rab[e_rab].xid); + } } - if ((e_rabs_done > 0) ){ - LOG_I(RRC,"S1AP_E_RAB_SETUP_RESP: sending the message: nb_of_erabs %d, total e_rabs %d, index %d\n", - ue_context_pP->ue_context.nb_of_e_rabs, ue_context_pP->ue_context.setup_e_rabs, e_rab); - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_S1AP_ENB, - (const char *)&S1AP_E_RAB_SETUP_RESP (msg_p), - sizeof(s1ap_e_rab_setup_resp_t), - MSC_AS_TIME_FMT" E_RAB_SETUP_RESP UE %X eNB_ue_s1ap_id %u e_rabs:%u succ %u fail", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_id_rnti, - S1AP_E_RAB_SETUP_RESP (msg_p).eNB_ue_s1ap_id, - e_rabs_done, e_rabs_failed); - - - itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p); - } - for(int i = 0; i < NB_RB_MAX; i++) { - ue_context_pP->ue_context.e_rab[i].xid = -1; + if ((e_rabs_done > 0) ) { + LOG_I(RRC,"S1AP_E_RAB_SETUP_RESP: sending the message: nb_of_erabs %d, total e_rabs %d, index %d\n", + ue_context_pP->ue_context.nb_of_e_rabs, ue_context_pP->ue_context.setup_e_rabs, e_rab); + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_S1AP_ENB, + (const char *)&S1AP_E_RAB_SETUP_RESP (msg_p), + sizeof(s1ap_e_rab_setup_resp_t), + MSC_AS_TIME_FMT" E_RAB_SETUP_RESP UE %X eNB_ue_s1ap_id %u e_rabs:%u succ %u fail", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_id_rnti, + S1AP_E_RAB_SETUP_RESP (msg_p).eNB_ue_s1ap_id, + e_rabs_done, e_rabs_failed); + itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p); } - + + for(int i = 0; i < NB_RB_MAX; i++) { + ue_context_pP->ue_context.e_rab[i].xid = -1; + } + return 0; } @@ -1548,9 +1417,8 @@ int rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(MessageDef *msg_p, const char *msg_nam int i; uint16_t ue_initial_id; uint32_t eNB_ue_s1ap_id; - struct rrc_eNB_ue_context_s* ue_context_p = NULL; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; protocol_ctxt_t ctxt; - ue_initial_id = S1AP_E_RAB_MODIFY_REQ (msg_p).ue_initial_id; eNB_ue_s1ap_id = S1AP_E_RAB_MODIFY_REQ (msg_p).eNB_ue_s1ap_id; ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, ue_initial_id, eNB_ue_s1ap_id); @@ -1562,27 +1430,23 @@ int rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(MessageDef *msg_p, const char *msg_nam LOG_W(RRC, "[eNB %d] In S1AP_E_RAB_MODIFY_REQ: unknown UE from S1AP ids (%d, %d)\n", instance, ue_initial_id, eNB_ue_s1ap_id); int nb_of_e_rabs_failed = 0; MessageDef *msg_fail_p = NULL; - msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_MODIFY_RESP); - S1AP_E_RAB_MODIFY_RESP (msg_fail_p).eNB_ue_s1ap_id = S1AP_E_RAB_MODIFY_REQ (msg_p).eNB_ue_s1ap_id; S1AP_E_RAB_MODIFY_RESP (msg_fail_p).nb_of_e_rabs = 0; for (nb_of_e_rabs_failed = 0; nb_of_e_rabs_failed < S1AP_E_RAB_MODIFY_REQ (msg_p).nb_e_rabs_tomodify; nb_of_e_rabs_failed++) { S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs_failed[nb_of_e_rabs_failed].e_rab_id = - S1AP_E_RAB_MODIFY_REQ (msg_p).e_rab_modify_params[nb_of_e_rabs_failed].e_rab_id; + S1AP_E_RAB_MODIFY_REQ (msg_p).e_rab_modify_params[nb_of_e_rabs_failed].e_rab_id; S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs_failed[nb_of_e_rabs_failed].cause = S1AP_CAUSE_RADIO_NETWORK; S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs_failed[nb_of_e_rabs_failed].cause_value = 31;//S1ap_CauseRadioNetwork_multiple_E_RAB_ID_instances; } - S1AP_E_RAB_MODIFY_RESP (msg_fail_p).nb_of_e_rabs_failed = nb_of_e_rabs_failed; + S1AP_E_RAB_MODIFY_RESP (msg_fail_p).nb_of_e_rabs_failed = nb_of_e_rabs_failed; itti_send_msg_to_task(TASK_S1AP, instance, msg_fail_p); return (-1); - } else { PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0); ue_context_p->ue_context.eNB_ue_s1ap_id = eNB_ue_s1ap_id; - /* Save e RAB information for later */ { int j; @@ -1596,9 +1460,10 @@ int rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(MessageDef *msg_p, const char *msg_nam // already treated continue; } + for (j = i+1; j < S1AP_E_RAB_MODIFY_REQ (msg_p).nb_e_rabs_tomodify; j++) { if (is_treated[j] == FALSE && - S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[j].e_rab_id == S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[i].e_rab_id) { + S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[j].e_rab_id == S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[i].e_rab_id) { // handle multiple E-RAB ID ue_context_p->ue_context.modify_e_rab[j].status = E_RAB_STATUS_NEW; ue_context_p->ue_context.modify_e_rab[j].param.e_rab_id = S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[j].e_rab_id; @@ -1609,6 +1474,7 @@ int rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(MessageDef *msg_p, const char *msg_nam is_treated[j] = TRUE; } } + if (is_treated[i] == TRUE) { // handle multiple E-RAB ID ue_context_p->ue_context.modify_e_rab[i].status = E_RAB_STATUS_NEW; @@ -1632,9 +1498,10 @@ int rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(MessageDef *msg_p, const char *msg_nam for (j = 0; j < NB_RB_MAX-3; j++) { if (ue_context_p->ue_context.e_rab[j].param.e_rab_id == S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[i].e_rab_id) { - if(ue_context_p->ue_context.e_rab[j].status == E_RAB_STATUS_TORELEASE || ue_context_p->ue_context.e_rab[j].status == E_RAB_STATUS_DONE){ + if(ue_context_p->ue_context.e_rab[j].status == E_RAB_STATUS_TORELEASE || ue_context_p->ue_context.e_rab[j].status == E_RAB_STATUS_DONE) { break; } + ue_context_p->ue_context.modify_e_rab[i].status = E_RAB_STATUS_NEW; ue_context_p->ue_context.modify_e_rab[i].cause = S1AP_CAUSE_NOTHING; ue_context_p->ue_context.modify_e_rab[i].param.e_rab_id = S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[i].e_rab_id; @@ -1643,7 +1510,6 @@ int rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(MessageDef *msg_p, const char *msg_nam ue_context_p->ue_context.modify_e_rab[i].param.nas_pdu.buffer = S1AP_E_RAB_MODIFY_REQ(msg_p).e_rab_modify_params[i].nas_pdu.buffer; ue_context_p->ue_context.modify_e_rab[i].param.sgw_addr = ue_context_p->ue_context.e_rab[j].param.sgw_addr; ue_context_p->ue_context.modify_e_rab[i].param.gtp_teid = ue_context_p->ue_context.e_rab[j].param.gtp_teid; - is_treated[i] = TRUE; break; } @@ -1663,7 +1529,6 @@ int rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(MessageDef *msg_p, const char *msg_nam ue_context_p->ue_context.nb_of_modify_e_rabs = S1AP_E_RAB_MODIFY_REQ (msg_p).nb_e_rabs_tomodify; ue_context_p->ue_context.nb_of_failed_e_rabs = nb_of_failed_e_rabs; } - /* TODO parameters yet to process ... */ { // S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p).ue_ambr; @@ -1678,36 +1543,31 @@ int rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(MessageDef *msg_p, const char *msg_nam { int nb_of_e_rabs_failed = 0; MessageDef *msg_fail_p = NULL; - msg_fail_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_MODIFY_RESP); - S1AP_E_RAB_MODIFY_RESP (msg_fail_p).eNB_ue_s1ap_id = S1AP_E_RAB_MODIFY_REQ (msg_p).eNB_ue_s1ap_id; -// S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs[S1AP_MAX_E_RAB]; + // S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs[S1AP_MAX_E_RAB]; S1AP_E_RAB_MODIFY_RESP (msg_fail_p).nb_of_e_rabs = 0; for(nb_of_e_rabs_failed = 0; nb_of_e_rabs_failed < ue_context_p->ue_context.nb_of_failed_e_rabs; nb_of_e_rabs_failed++) { S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs_failed[nb_of_e_rabs_failed].e_rab_id = - ue_context_p->ue_context.modify_e_rab[nb_of_e_rabs_failed].param.e_rab_id; + ue_context_p->ue_context.modify_e_rab[nb_of_e_rabs_failed].param.e_rab_id; S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs_failed[nb_of_e_rabs_failed].cause = ue_context_p->ue_context.modify_e_rab[nb_of_e_rabs_failed].cause; } + S1AP_E_RAB_MODIFY_RESP (msg_fail_p).nb_of_e_rabs_failed = nb_of_e_rabs_failed; - itti_send_msg_to_task (TASK_S1AP, instance, msg_fail_p); - ue_context_p->ue_context.nb_of_modify_e_rabs = 0; ue_context_p->ue_context.nb_of_failed_e_rabs = 0; memset(ue_context_p->ue_context.modify_e_rab, 0, sizeof(ue_context_p->ue_context.modify_e_rab)); - return (0); } } // end of ue_context_p != NULL } /*NN: careful about the typcast of xid (long -> uint8_t*/ -int rrc_eNB_send_S1AP_E_RAB_MODIFY_RESP(const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - uint8_t xid ) { - +int rrc_eNB_send_S1AP_E_RAB_MODIFY_RESP(const protocol_ctxt_t *const ctxt_pP, + rrc_eNB_ue_context_t *const ue_context_pP, + uint8_t xid ) { MessageDef *msg_p = NULL; int i; int e_rab; @@ -1717,7 +1577,6 @@ int rrc_eNB_send_S1AP_E_RAB_MODIFY_RESP(const protocol_ctxt_t* const ctxt_pP, S1AP_E_RAB_MODIFY_RESP (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; for (e_rab = 0; e_rab < ue_context_pP->ue_context.nb_of_modify_e_rabs; e_rab++) { - /* only respond to the corresponding transaction */ if (xid == ue_context_pP->ue_context.modify_e_rab[e_rab].xid) { if (ue_context_pP->ue_context.modify_e_rab[e_rab].status == E_RAB_STATUS_DONE) { @@ -1730,199 +1589,198 @@ int rrc_eNB_send_S1AP_E_RAB_MODIFY_RESP(const protocol_ctxt_t* const ctxt_pP, break; } } + if (i < ue_context_pP->ue_context.setup_e_rabs) { S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs[e_rabs_done].e_rab_id = ue_context_pP->ue_context.modify_e_rab[e_rab].param.e_rab_id; - // TODO add other information from S1-U when it will be integrated - + // TODO add other information from S1-U when it will be integrated LOG_D (RRC,"enb_gtp_addr (msg index %d, e_rab index %d, status %d, xid %d): nb_of_modify_e_rabs %d, e_rab_id %d \n ", - e_rabs_done, e_rab, ue_context_pP->ue_context.modify_e_rab[e_rab].status, xid, - ue_context_pP->ue_context.nb_of_modify_e_rabs, - S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs[e_rabs_done].e_rab_id); - + e_rabs_done, e_rab, ue_context_pP->ue_context.modify_e_rab[e_rab].status, xid, + ue_context_pP->ue_context.nb_of_modify_e_rabs, + S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs[e_rabs_done].e_rab_id); e_rabs_done++; } else { // unexpected S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs_failed[e_rabs_failed].e_rab_id = ue_context_pP->ue_context.modify_e_rab[e_rab].param.e_rab_id; - S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs_failed[e_rabs_failed].cause = S1AP_CAUSE_RADIO_NETWORK; S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs_failed[e_rabs_failed].cause_value = 30;//S1ap_CauseRadioNetwork_unknown_E_RAB_ID; - e_rabs_failed++; } } else if ((ue_context_pP->ue_context.modify_e_rab[e_rab].status == E_RAB_STATUS_NEW) || - (ue_context_pP->ue_context.modify_e_rab[e_rab].status == E_RAB_STATUS_ESTABLISHED)){ + (ue_context_pP->ue_context.modify_e_rab[e_rab].status == E_RAB_STATUS_ESTABLISHED)) { LOG_D (RRC,"E-RAB is NEW or already ESTABLISHED\n"); } else { /* status == E_RAB_STATUS_FAILED; */ S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs_failed[e_rabs_failed].e_rab_id = ue_context_pP->ue_context.modify_e_rab[e_rab].param.e_rab_id; // add failure cause when defined S1AP_E_RAB_MODIFY_RESP (msg_p).e_rabs_failed[e_rabs_failed].cause = ue_context_pP->ue_context.modify_e_rab[e_rab].cause; - e_rabs_failed++; } } else { /*debug info for the xid */ LOG_D(RRC,"xid does not corresponds (context e_rab index %d, status %d, xid %d/%d) \n ", - e_rab, ue_context_pP->ue_context.modify_e_rab[e_rab].status, xid, ue_context_pP->ue_context.modify_e_rab[e_rab].xid); + e_rab, ue_context_pP->ue_context.modify_e_rab[e_rab].status, xid, ue_context_pP->ue_context.modify_e_rab[e_rab].xid); } } - S1AP_E_RAB_MODIFY_RESP (msg_p).nb_of_e_rabs = e_rabs_done; S1AP_E_RAB_MODIFY_RESP (msg_p).nb_of_e_rabs_failed = e_rabs_failed; + // NN: add conditions for e_rabs_failed if (e_rabs_done > 0 || e_rabs_failed > 0) { LOG_D(RRC,"S1AP_E_RAB_MODIFY_RESP: sending the message: nb_of_modify_e_rabs %d, total e_rabs %d, index %d\n", - ue_context_pP->ue_context.nb_of_modify_e_rabs, ue_context_pP->ue_context.setup_e_rabs, e_rab); -MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_S1AP_ENB, - (const char *)&S1AP_E_RAB_SETUP_RESP (msg_p), - sizeof(s1ap_e_rab_setup_resp_t), - MSC_AS_TIME_FMT" E_RAB_MODIFY_RESP UE %X eNB_ue_s1ap_id %u e_rabs:%u succ %u fail", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_id_rnti, - S1AP_E_RAB_MODIFY_RESP (msg_p).eNB_ue_s1ap_id, - e_rabs_done, e_rabs_failed); - + ue_context_pP->ue_context.nb_of_modify_e_rabs, ue_context_pP->ue_context.setup_e_rabs, e_rab); + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_S1AP_ENB, + (const char *)&S1AP_E_RAB_SETUP_RESP (msg_p), + sizeof(s1ap_e_rab_setup_resp_t), + MSC_AS_TIME_FMT" E_RAB_MODIFY_RESP UE %X eNB_ue_s1ap_id %u e_rabs:%u succ %u fail", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_id_rnti, + S1AP_E_RAB_MODIFY_RESP (msg_p).eNB_ue_s1ap_id, + e_rabs_done, e_rabs_failed); itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p); } return 0; } -int rrc_eNB_process_S1AP_E_RAB_RELEASE_COMMAND(MessageDef *msg_p, const char *msg_name, instance_t instance){ - uint16_t mme_ue_s1ap_id; - uint32_t eNB_ue_s1ap_id; - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - protocol_ctxt_t ctxt; - e_rab_release_t e_rab_release_params[S1AP_MAX_E_RAB]; - uint8_t nb_e_rabs_torelease; - int erab; - int i; - uint8_t b_existed,is_existed; - uint8_t xid; - uint8_t e_rab_release_drb; - MessageDef * msg_delete_tunnels_p = NULL; - e_rab_release_drb = 0; - memcpy(&e_rab_release_params[0], &(S1AP_E_RAB_RELEASE_COMMAND (msg_p).e_rab_release_params[0]), sizeof(e_rab_release_t)*S1AP_MAX_E_RAB); +int rrc_eNB_process_S1AP_E_RAB_RELEASE_COMMAND(MessageDef *msg_p, const char *msg_name, instance_t instance) { + uint16_t mme_ue_s1ap_id; + uint32_t eNB_ue_s1ap_id; + struct rrc_eNB_ue_context_s *ue_context_p = NULL; + protocol_ctxt_t ctxt; + e_rab_release_t e_rab_release_params[S1AP_MAX_E_RAB]; + uint8_t nb_e_rabs_torelease; + int erab; + int i; + uint8_t b_existed,is_existed; + uint8_t xid; + uint8_t e_rab_release_drb; + MessageDef *msg_delete_tunnels_p = NULL; + e_rab_release_drb = 0; + memcpy(&e_rab_release_params[0], &(S1AP_E_RAB_RELEASE_COMMAND (msg_p).e_rab_release_params[0]), sizeof(e_rab_release_t)*S1AP_MAX_E_RAB); + mme_ue_s1ap_id = S1AP_E_RAB_RELEASE_COMMAND (msg_p).mme_ue_s1ap_id; + eNB_ue_s1ap_id = S1AP_E_RAB_RELEASE_COMMAND (msg_p).eNB_ue_s1ap_id; + nb_e_rabs_torelease = S1AP_E_RAB_RELEASE_COMMAND (msg_p).nb_e_rabs_torelease; + ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, UE_INITIAL_ID_INVALID, eNB_ue_s1ap_id); - mme_ue_s1ap_id = S1AP_E_RAB_RELEASE_COMMAND (msg_p).mme_ue_s1ap_id; - eNB_ue_s1ap_id = S1AP_E_RAB_RELEASE_COMMAND (msg_p).eNB_ue_s1ap_id; - nb_e_rabs_torelease = S1AP_E_RAB_RELEASE_COMMAND (msg_p).nb_e_rabs_torelease; - ue_context_p = rrc_eNB_get_ue_context_from_s1ap_ids(instance, UE_INITIAL_ID_INVALID, eNB_ue_s1ap_id); - if(ue_context_p != NULL){ - PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0); + if(ue_context_p != NULL) { + PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0); + xid = rrc_eNB_get_next_transaction_identifier(ctxt.module_id); + LOG_D(RRC,"S1AP-E-RAB Release Command: MME_UE_S1AP_ID %d ENB_UE_S1AP_ID %d release_e_rabs %d \n", + mme_ue_s1ap_id, eNB_ue_s1ap_id,nb_e_rabs_torelease); - xid = rrc_eNB_get_next_transaction_identifier(ctxt.module_id); + for(erab = 0; erab < nb_e_rabs_torelease; erab++) { + b_existed = 0; + is_existed = 0; - LOG_D(RRC,"S1AP-E-RAB Release Command: MME_UE_S1AP_ID %d ENB_UE_S1AP_ID %d release_e_rabs %d \n", - mme_ue_s1ap_id, eNB_ue_s1ap_id,nb_e_rabs_torelease); - for(erab = 0; erab < nb_e_rabs_torelease; erab++){ - b_existed = 0; - is_existed = 0; - for ( i = erab-1; i>= 0; i--){ - if (e_rab_release_params[erab].e_rab_id == e_rab_release_params[i].e_rab_id){ - is_existed = 1; - break; - } - } - if(is_existed == 1){ - //e_rab_id is existed - continue; - } - for ( i = 0; i < NB_RB_MAX; i++){ - if (e_rab_release_params[erab].e_rab_id == ue_context_p->ue_context.e_rab[i].param.e_rab_id){ - b_existed = 1; - break; - } - } - if(b_existed == 0) { - //no e_rab_id - ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].e_rab_id = e_rab_release_params[erab].e_rab_id; - ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].cause = S1AP_CAUSE_RADIO_NETWORK; - ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].cause_value = 30; - ue_context_p->ue_context.nb_release_of_e_rabs++; - } else { - if(ue_context_p->ue_context.e_rab[i].status == E_RAB_STATUS_FAILED){ - ue_context_p->ue_context.e_rab[i].xid = xid; - continue; - } else if(ue_context_p->ue_context.e_rab[i].status == E_RAB_STATUS_ESTABLISHED){ - ue_context_p->ue_context.e_rab[i].status = E_RAB_STATUS_TORELEASE; - ue_context_p->ue_context.e_rab[i].xid = xid; - e_rab_release_drb++; - }else{ - //e_rab_id status NG - ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].e_rab_id = e_rab_release_params[erab].e_rab_id; - ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].cause = S1AP_CAUSE_RADIO_NETWORK; - ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].cause_value = 0; - ue_context_p->ue_context.nb_release_of_e_rabs++; - } - } + for ( i = erab-1; i>= 0; i--) { + if (e_rab_release_params[erab].e_rab_id == e_rab_release_params[i].e_rab_id) { + is_existed = 1; + break; } - if(e_rab_release_drb > 0) { - //RRCConnectionReconfiguration To UE - rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release(&ctxt, ue_context_p, xid, S1AP_E_RAB_RELEASE_COMMAND (msg_p).nas_pdu.length, S1AP_E_RAB_RELEASE_COMMAND (msg_p).nas_pdu.buffer); + } + + if(is_existed == 1) { + //e_rab_id is existed + continue; + } + + for ( i = 0; i < NB_RB_MAX; i++) { + if (e_rab_release_params[erab].e_rab_id == ue_context_p->ue_context.e_rab[i].param.e_rab_id) { + b_existed = 1; + break; + } + } + + if(b_existed == 0) { + //no e_rab_id + ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].e_rab_id = e_rab_release_params[erab].e_rab_id; + ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].cause = S1AP_CAUSE_RADIO_NETWORK; + ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].cause_value = 30; + ue_context_p->ue_context.nb_release_of_e_rabs++; + } else { + if(ue_context_p->ue_context.e_rab[i].status == E_RAB_STATUS_FAILED) { + ue_context_p->ue_context.e_rab[i].xid = xid; + continue; + } else if(ue_context_p->ue_context.e_rab[i].status == E_RAB_STATUS_ESTABLISHED) { + ue_context_p->ue_context.e_rab[i].status = E_RAB_STATUS_TORELEASE; + ue_context_p->ue_context.e_rab[i].xid = xid; + e_rab_release_drb++; } else { - //gtp tunnel delete - msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ); - memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; - for(i = 0; i < NB_RB_MAX; i++){ - if(xid == ue_context_p->ue_context.e_rab[i].xid){ - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = ue_context_p->ue_context.enb_gtp_ebi[i]; - ue_context_p->ue_context.enb_gtp_teid[i] = 0; - memset(&ue_context_p->ue_context.enb_gtp_addrs[i], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[i])); - ue_context_p->ue_context.enb_gtp_ebi[i] = 0; - } - } - - itti_send_msg_to_task(TASK_GTPV1_U, instance, msg_delete_tunnels_p); - - //S1AP_E_RAB_RELEASE_RESPONSE - rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(&ctxt, ue_context_p, xid); + //e_rab_id status NG + ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].e_rab_id = e_rab_release_params[erab].e_rab_id; + ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].cause = S1AP_CAUSE_RADIO_NETWORK; + ue_context_p->ue_context.e_rabs_release_failed[ue_context_p->ue_context.nb_release_of_e_rabs].cause_value = 0; + ue_context_p->ue_context.nb_release_of_e_rabs++; } - } else { - LOG_E(RRC,"S1AP-E-RAB Release Command: MME_UE_S1AP_ID %d ENB_UE_S1AP_ID %d Error ue_context_p NULL \n", - S1AP_E_RAB_RELEASE_COMMAND (msg_p).mme_ue_s1ap_id, S1AP_E_RAB_RELEASE_COMMAND (msg_p).eNB_ue_s1ap_id); - return -1; + } } - return 0; + if(e_rab_release_drb > 0) { + //RRCConnectionReconfiguration To UE + rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release(&ctxt, ue_context_p, xid, S1AP_E_RAB_RELEASE_COMMAND (msg_p).nas_pdu.length, S1AP_E_RAB_RELEASE_COMMAND (msg_p).nas_pdu.buffer); + } else { + //gtp tunnel delete + msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ); + memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); + GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; + + for(i = 0; i < NB_RB_MAX; i++) { + if(xid == ue_context_p->ue_context.e_rab[i].xid) { + GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = ue_context_p->ue_context.enb_gtp_ebi[i]; + ue_context_p->ue_context.enb_gtp_teid[i] = 0; + memset(&ue_context_p->ue_context.enb_gtp_addrs[i], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[i])); + ue_context_p->ue_context.enb_gtp_ebi[i] = 0; + } + } + + itti_send_msg_to_task(TASK_GTPV1_U, instance, msg_delete_tunnels_p); + //S1AP_E_RAB_RELEASE_RESPONSE + rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(&ctxt, ue_context_p, xid); + } + } else { + LOG_E(RRC,"S1AP-E-RAB Release Command: MME_UE_S1AP_ID %d ENB_UE_S1AP_ID %d Error ue_context_p NULL \n", + S1AP_E_RAB_RELEASE_COMMAND (msg_p).mme_ue_s1ap_id, S1AP_E_RAB_RELEASE_COMMAND (msg_p).eNB_ue_s1ap_id); + return -1; + } + + return 0; } -int rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(const protocol_ctxt_t* const ctxt_pP, rrc_eNB_ue_context_t* const ue_context_pP, uint8_t xid){ - int e_rabs_released = 0; - MessageDef *msg_p; +int rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(const protocol_ctxt_t *const ctxt_pP, rrc_eNB_ue_context_t *const ue_context_pP, uint8_t xid) { + int e_rabs_released = 0; + MessageDef *msg_p; + msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_RELEASE_RESPONSE); + S1AP_E_RAB_RELEASE_RESPONSE (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; - msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_RELEASE_RESPONSE); - S1AP_E_RAB_RELEASE_RESPONSE (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; - - for (int i = 0; i < NB_RB_MAX; i++){ - if (xid == ue_context_pP->ue_context.e_rab[i].xid){ - S1AP_E_RAB_RELEASE_RESPONSE (msg_p).e_rab_release[e_rabs_released].e_rab_id = ue_context_pP->ue_context.e_rab[i].param.e_rab_id; - e_rabs_released++; - //clear - memset(&ue_context_pP->ue_context.e_rab[i],0,sizeof(e_rab_param_t)); - } + for (int i = 0; i < NB_RB_MAX; i++) { + if (xid == ue_context_pP->ue_context.e_rab[i].xid) { + S1AP_E_RAB_RELEASE_RESPONSE (msg_p).e_rab_release[e_rabs_released].e_rab_id = ue_context_pP->ue_context.e_rab[i].param.e_rab_id; + e_rabs_released++; + //clear + memset(&ue_context_pP->ue_context.e_rab[i],0,sizeof(e_rab_param_t)); } - S1AP_E_RAB_RELEASE_RESPONSE (msg_p).nb_of_e_rabs_released = e_rabs_released; - S1AP_E_RAB_RELEASE_RESPONSE (msg_p).nb_of_e_rabs_failed = ue_context_pP->ue_context.nb_release_of_e_rabs; - memcpy(&(S1AP_E_RAB_RELEASE_RESPONSE (msg_p).e_rabs_failed[0]),&ue_context_pP->ue_context.e_rabs_release_failed[0],sizeof(e_rab_failed_t)*ue_context_pP->ue_context.nb_release_of_e_rabs); + } - ue_context_pP->ue_context.setup_e_rabs -= e_rabs_released; - LOG_I(RRC,"S1AP-E-RAB RELEASE RESPONSE: ENB_UE_S1AP_ID %d release_e_rabs %d setup_e_rabs %d \n", - S1AP_E_RAB_RELEASE_RESPONSE (msg_p).eNB_ue_s1ap_id, - e_rabs_released, ue_context_pP->ue_context.setup_e_rabs); - - itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p); - //clear xid - for(int i = 0; i < NB_RB_MAX; i++) { - ue_context_pP->ue_context.e_rab[i].xid = -1; - } - //clear release e_rabs - ue_context_pP->ue_context.nb_release_of_e_rabs = 0; - memset(&ue_context_pP->ue_context.e_rabs_release_failed[0],0,sizeof(e_rab_failed_t)*S1AP_MAX_E_RAB); - return 0; + S1AP_E_RAB_RELEASE_RESPONSE (msg_p).nb_of_e_rabs_released = e_rabs_released; + S1AP_E_RAB_RELEASE_RESPONSE (msg_p).nb_of_e_rabs_failed = ue_context_pP->ue_context.nb_release_of_e_rabs; + memcpy(&(S1AP_E_RAB_RELEASE_RESPONSE (msg_p).e_rabs_failed[0]),&ue_context_pP->ue_context.e_rabs_release_failed[0],sizeof(e_rab_failed_t)*ue_context_pP->ue_context.nb_release_of_e_rabs); + ue_context_pP->ue_context.setup_e_rabs -= e_rabs_released; + LOG_I(RRC,"S1AP-E-RAB RELEASE RESPONSE: ENB_UE_S1AP_ID %d release_e_rabs %d setup_e_rabs %d \n", + S1AP_E_RAB_RELEASE_RESPONSE (msg_p).eNB_ue_s1ap_id, + e_rabs_released, ue_context_pP->ue_context.setup_e_rabs); + itti_send_msg_to_task (TASK_S1AP, ctxt_pP->instance, msg_p); + + //clear xid + for(int i = 0; i < NB_RB_MAX; i++) { + ue_context_pP->ue_context.e_rab[i].xid = -1; + } + + //clear release e_rabs + ue_context_pP->ue_context.nb_release_of_e_rabs = 0; + memset(&ue_context_pP->ue_context.e_rabs_release_failed[0],0,sizeof(e_rab_failed_t)*S1AP_MAX_E_RAB); + return 0; } /*------------------------------------------------------------------------------*/ @@ -1935,125 +1793,142 @@ int rrc_eNB_process_PAGING_IND(MessageDef *msg_p, const char *msg_name, instance uint32_t Ns = 0; /* Ns: max(1,nB/T) */ uint8_t i_s; /* i_s = floor(UE_ID/N) mod Ns */ uint32_t T; /* DRX cycle */ + for (uint16_t tai_size = 0; tai_size < S1AP_PAGING_IND(msg_p).tai_size; tai_size++) { - LOG_D(RRC,"[eNB %d] In S1AP_PAGING_IND: MCC %d, MNC %d, TAC %d\n", instance, S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mcc, - S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mnc, S1AP_PAGING_IND(msg_p).tac[tai_size]); - if (RC.rrc[instance]->configuration.mcc == S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mcc - && RC.rrc[instance]->configuration.mnc == S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mnc - && RC.rrc[instance]->configuration.tac == S1AP_PAGING_IND(msg_p).tac[tai_size]) { - for (uint8_t CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - lte_frame_type_t frame_type = RC.eNB[instance][CC_id]->frame_parms.frame_type; - /* get nB from configuration */ - /* get default DRX cycle from configuration */ - Tc = (uint8_t)RC.rrc[instance]->configuration.pcch_defaultPagingCycle[CC_id]; - if (Tc < PCCH_Config__defaultPagingCycle_rf32 || Tc > PCCH_Config__defaultPagingCycle_rf256) { - continue; - } - Tue = (uint8_t)S1AP_PAGING_IND(msg_p).paging_drx; - /* set T = min(Tc,Tue) */ - T = Tc < Tue ? Ttab[Tc] : Ttab[Tue]; - /* set pcch_nB = PCCH-Config->nB */ - pcch_nB = (uint32_t)RC.rrc[instance]->configuration.pcch_nB[CC_id]; - switch (pcch_nB) { - case PCCH_Config__nB_fourT: - Ns = 4; - break; - case PCCH_Config__nB_twoT: - Ns = 2; - break; - default: - Ns = 1; - break; - } - /* set N = min(T,nB) */ - if (pcch_nB > PCCH_Config__nB_oneT) { - switch (pcch_nB) { - case PCCH_Config__nB_halfT: - N = T/2; - break; - case PCCH_Config__nB_quarterT: - N = T/4; - break; - case PCCH_Config__nB_oneEighthT: - N = T/8; - break; - case PCCH_Config__nB_oneSixteenthT: - N = T/16; - break; - case PCCH_Config__nB_oneThirtySecondT: - N = T/32; - break; - default: - /* pcch_nB error */ - LOG_E(RRC, "[eNB %d] In S1AP_PAGING_IND: pcch_nB error (pcch_nB %d) \n", - instance, pcch_nB); - return (-1); - } - } else { - N = T; - } + LOG_D(RRC,"[eNB %d] In S1AP_PAGING_IND: MCC %d, MNC %d, TAC %d\n", instance, S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mcc, + S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mnc, S1AP_PAGING_IND(msg_p).tac[tai_size]); - /* insert data to UE_PF_PO or update data in UE_PF_PO */ - pthread_mutex_lock(&ue_pf_po_mutex); - uint8_t i = 0; - for (i = 0; i < NUMBER_OF_UE_MAX; i++) { - if ((UE_PF_PO[CC_id][i].enable_flag == TRUE && UE_PF_PO[CC_id][i].ue_index_value == (uint16_t)(S1AP_PAGING_IND(msg_p).ue_index_value)) - || (UE_PF_PO[CC_id][i].enable_flag != TRUE)) { - /* set T = min(Tc,Tue) */ - UE_PF_PO[CC_id][i].T = T; - /* set UE_ID */ - UE_PF_PO[CC_id][i].ue_index_value = (uint16_t)S1AP_PAGING_IND(msg_p).ue_index_value; - /* calculate PF and PO */ - /* set PF_min : SFN mod T = (T div N)*(UE_ID mod N) */ - UE_PF_PO[CC_id][i].PF_min = (T / N) * (UE_PF_PO[CC_id][i].ue_index_value % N); - /* set PO */ - /* i_s = floor(UE_ID/N) mod Ns */ - i_s = (uint8_t)((UE_PF_PO[CC_id][i].ue_index_value / N) % Ns); - if (Ns == 1) { - UE_PF_PO[CC_id][i].PO = (frame_type==FDD) ? 9 : 0; - } else if (Ns==2) { - UE_PF_PO[CC_id][i].PO = (frame_type==FDD) ? (4+(5*i_s)) : (5*i_s); - } else if (Ns==4) { - UE_PF_PO[CC_id][i].PO = (frame_type==FDD) ? (4*(i_s&1)+(5*(i_s>>1))) : ((i_s&1)+(5*(i_s>>1))); - } - if (UE_PF_PO[CC_id][i].enable_flag == TRUE) { - //paging exist UE log - LOG_D(RRC,"[eNB %d] CC_id %d In S1AP_PAGING_IND: Update exist UE %d, T %d, PF %d, PO %d\n", instance, CC_id, UE_PF_PO[CC_id][i].ue_index_value, T, UE_PF_PO[CC_id][i].PF_min, UE_PF_PO[CC_id][i].PO); - } else { - /* set enable_flag */ - UE_PF_PO[CC_id][i].enable_flag = TRUE; - //paging new UE log - LOG_D(RRC,"[eNB %d] CC_id %d In S1AP_PAGING_IND: Insert a new UE %d, T %d, PF %d, PO %d\n", instance, CC_id, UE_PF_PO[CC_id][i].ue_index_value, T, UE_PF_PO[CC_id][i].PF_min, UE_PF_PO[CC_id][i].PO); - } - break; - } - } - pthread_mutex_unlock(&ue_pf_po_mutex); + if (RC.rrc[instance]->configuration.mcc == S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mcc + && RC.rrc[instance]->configuration.mnc == S1AP_PAGING_IND(msg_p).plmn_identity[tai_size].mnc + && RC.rrc[instance]->configuration.tac == S1AP_PAGING_IND(msg_p).tac[tai_size]) { + for (uint8_t CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + lte_frame_type_t frame_type = RC.eNB[instance][CC_id]->frame_parms.frame_type; + /* get nB from configuration */ + /* get default DRX cycle from configuration */ + Tc = (uint8_t)RC.rrc[instance]->configuration.pcch_defaultPagingCycle[CC_id]; - uint32_t length; - uint8_t buffer[RRC_BUF_SIZE]; - uint8_t *message_buffer; - /* Transfer data to PDCP */ - MessageDef *message_p; - message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_PCCH_DATA_REQ); - /* Create message for PDCP (DLInformationTransfer_t) */ - length = do_Paging (instance, - buffer, - S1AP_PAGING_IND(msg_p).ue_paging_identity, - S1AP_PAGING_IND(msg_p).cn_domain); - message_buffer = itti_malloc (TASK_RRC_ENB, TASK_PDCP_ENB, length); - /* Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). */ - memcpy (message_buffer, buffer, length); - RRC_PCCH_DATA_REQ (message_p).sdu_size = length; - RRC_PCCH_DATA_REQ (message_p).sdu_p = message_buffer; - RRC_PCCH_DATA_REQ (message_p).mode = PDCP_TRANSMISSION_MODE_TRANSPARENT; /* not used */ - RRC_PCCH_DATA_REQ (message_p).rnti = P_RNTI; - RRC_PCCH_DATA_REQ (message_p).ue_index = i; - RRC_PCCH_DATA_REQ (message_p).CC_id = CC_id; - LOG_D(RRC, "[eNB %d] CC_id %d In S1AP_PAGING_IND: send encdoed buffer to PDCP buffer_size %d\n", instance, CC_id, length); - itti_send_msg_to_task (TASK_PDCP_ENB, instance, message_p); + if (Tc < PCCH_Config__defaultPagingCycle_rf32 || Tc > PCCH_Config__defaultPagingCycle_rf256) { + continue; + } + + Tue = (uint8_t)S1AP_PAGING_IND(msg_p).paging_drx; + /* set T = min(Tc,Tue) */ + T = Tc < Tue ? Ttab[Tc] : Ttab[Tue]; + /* set pcch_nB = PCCH-Config->nB */ + pcch_nB = (uint32_t)RC.rrc[instance]->configuration.pcch_nB[CC_id]; + + switch (pcch_nB) { + case PCCH_Config__nB_fourT: + Ns = 4; + break; + + case PCCH_Config__nB_twoT: + Ns = 2; + break; + + default: + Ns = 1; + break; + } + + /* set N = min(T,nB) */ + if (pcch_nB > PCCH_Config__nB_oneT) { + switch (pcch_nB) { + case PCCH_Config__nB_halfT: + N = T/2; + break; + + case PCCH_Config__nB_quarterT: + N = T/4; + break; + + case PCCH_Config__nB_oneEighthT: + N = T/8; + break; + + case PCCH_Config__nB_oneSixteenthT: + N = T/16; + break; + + case PCCH_Config__nB_oneThirtySecondT: + N = T/32; + break; + + default: + /* pcch_nB error */ + LOG_E(RRC, "[eNB %d] In S1AP_PAGING_IND: pcch_nB error (pcch_nB %d) \n", + instance, pcch_nB); + return (-1); } + } else { + N = T; + } + + /* insert data to UE_PF_PO or update data in UE_PF_PO */ + pthread_mutex_lock(&ue_pf_po_mutex); + uint8_t i = 0; + + for (i = 0; i < NUMBER_OF_UE_MAX; i++) { + if ((UE_PF_PO[CC_id][i].enable_flag == TRUE && UE_PF_PO[CC_id][i].ue_index_value == (uint16_t)(S1AP_PAGING_IND(msg_p).ue_index_value)) + || (UE_PF_PO[CC_id][i].enable_flag != TRUE)) { + /* set T = min(Tc,Tue) */ + UE_PF_PO[CC_id][i].T = T; + /* set UE_ID */ + UE_PF_PO[CC_id][i].ue_index_value = (uint16_t)S1AP_PAGING_IND(msg_p).ue_index_value; + /* calculate PF and PO */ + /* set PF_min : SFN mod T = (T div N)*(UE_ID mod N) */ + UE_PF_PO[CC_id][i].PF_min = (T / N) * (UE_PF_PO[CC_id][i].ue_index_value % N); + /* set PO */ + /* i_s = floor(UE_ID/N) mod Ns */ + i_s = (uint8_t)((UE_PF_PO[CC_id][i].ue_index_value / N) % Ns); + + if (Ns == 1) { + UE_PF_PO[CC_id][i].PO = (frame_type==FDD) ? 9 : 0; + } else if (Ns==2) { + UE_PF_PO[CC_id][i].PO = (frame_type==FDD) ? (4+(5*i_s)) : (5*i_s); + } else if (Ns==4) { + UE_PF_PO[CC_id][i].PO = (frame_type==FDD) ? (4*(i_s&1)+(5*(i_s>>1))) : ((i_s&1)+(5*(i_s>>1))); + } + + if (UE_PF_PO[CC_id][i].enable_flag == TRUE) { + //paging exist UE log + LOG_D(RRC,"[eNB %d] CC_id %d In S1AP_PAGING_IND: Update exist UE %d, T %d, PF %d, PO %d\n", instance, CC_id, UE_PF_PO[CC_id][i].ue_index_value, T, UE_PF_PO[CC_id][i].PF_min, UE_PF_PO[CC_id][i].PO); + } else { + /* set enable_flag */ + UE_PF_PO[CC_id][i].enable_flag = TRUE; + //paging new UE log + LOG_D(RRC,"[eNB %d] CC_id %d In S1AP_PAGING_IND: Insert a new UE %d, T %d, PF %d, PO %d\n", instance, CC_id, UE_PF_PO[CC_id][i].ue_index_value, T, UE_PF_PO[CC_id][i].PF_min, UE_PF_PO[CC_id][i].PO); + } + + break; + } + } + + pthread_mutex_unlock(&ue_pf_po_mutex); + uint32_t length; + uint8_t buffer[RRC_BUF_SIZE]; + uint8_t *message_buffer; + /* Transfer data to PDCP */ + MessageDef *message_p; + message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_PCCH_DATA_REQ); + /* Create message for PDCP (DLInformationTransfer_t) */ + length = do_Paging (instance, + buffer, + S1AP_PAGING_IND(msg_p).ue_paging_identity, + S1AP_PAGING_IND(msg_p).cn_domain); + message_buffer = itti_malloc (TASK_RRC_ENB, TASK_PDCP_ENB, length); + /* Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). */ + memcpy (message_buffer, buffer, length); + RRC_PCCH_DATA_REQ (message_p).sdu_size = length; + RRC_PCCH_DATA_REQ (message_p).sdu_p = message_buffer; + RRC_PCCH_DATA_REQ (message_p).mode = PDCP_TRANSMISSION_MODE_TRANSPARENT; /* not used */ + RRC_PCCH_DATA_REQ (message_p).rnti = P_RNTI; + RRC_PCCH_DATA_REQ (message_p).ue_index = i; + RRC_PCCH_DATA_REQ (message_p).CC_id = CC_id; + LOG_D(RRC, "[eNB %d] CC_id %d In S1AP_PAGING_IND: send encdoed buffer to PDCP buffer_size %d\n", instance, CC_id, length); + itti_send_msg_to_task (TASK_PDCP_ENB, instance, message_p); } + } } return (0); diff --git a/openair2/X2AP/MESSAGES/ASN1/R14.5/x2ap-14.5.0.asn1 b/openair2/X2AP/MESSAGES/ASN1/R14.5/x2ap-14.5.0.asn1 new file mode 100755 index 0000000000..acde008ffb --- /dev/null +++ b/openair2/X2AP/MESSAGES/ASN1/R14.5/x2ap-14.5.0.asn1 @@ -0,0 +1,5065 @@ +-- ************************************************************** +-- +-- Elementary Procedure definitions +-- +-- ************************************************************** + +X2AP-PDU-Descriptions { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +eps-Access (21) modules (3) x2ap (2) version1 (1) x2ap-PDU-Descriptions (0) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Criticality, + ProcedureCode + +FROM X2AP-CommonDataTypes + + CellActivationRequest, + CellActivationResponse, + CellActivationFailure, + ENBConfigurationUpdate, + ENBConfigurationUpdateAcknowledge, + ENBConfigurationUpdateFailure, + ErrorIndication, + HandoverCancel, + HandoverReport, + HandoverPreparationFailure, + HandoverRequest, + HandoverRequestAcknowledge, + LoadInformation, + PrivateMessage, + ResetRequest, + ResetResponse, + ResourceStatusFailure, + ResourceStatusRequest, + ResourceStatusResponse, + ResourceStatusUpdate, + RLFIndication, + SNStatusTransfer, + UEContextRelease, + X2SetupFailure, + X2SetupRequest, + X2SetupResponse, + MobilityChangeRequest, + MobilityChangeAcknowledge, + MobilityChangeFailure, + X2Release, + X2APMessageTransfer, + SeNBAdditionRequest, + SeNBAdditionRequestAcknowledge, + SeNBAdditionRequestReject, + SeNBReconfigurationComplete, + SeNBModificationRequest, + SeNBModificationRequestAcknowledge, + SeNBModificationRequestReject, + SeNBModificationRequired, + SeNBModificationConfirm, + SeNBModificationRefuse, + SeNBReleaseRequest, + SeNBReleaseRequired, + SeNBReleaseConfirm, + SeNBCounterCheckRequest, + X2RemovalFailure, + X2RemovalRequest, + X2RemovalResponse, + RetrieveUEContextRequest, + RetrieveUEContextResponse, + RetrieveUEContextFailure + +FROM X2AP-PDU-Contents + + id-cellActivation, + id-eNBConfigurationUpdate, + id-errorIndication, + id-handoverCancel, + id-handoverReport, + id-handoverPreparation, + + id-loadIndication, + id-privateMessage, + id-reset, + + id-resourceStatusReporting, + id-resourceStatusReportingInitiation, + id-rLFIndication, + id-snStatusTransfer, + id-uEContextRelease, + id-x2Setup, + id-mobilitySettingsChange, + id-x2Release, + id-x2APMessageTransfer, + id-seNBAdditionPreparation, + id-seNBReconfigurationCompletion, + id-meNBinitiatedSeNBModificationPreparation, + id-seNBinitiatedSeNBModification, + id-meNBinitiatedSeNBRelease, + id-seNBinitiatedSeNBRelease, + id-seNBCounterCheck, + id-x2Removal, + id-retrieveUEContext + +FROM X2AP-Constants; + +-- ************************************************************** +-- +-- Interface Elementary Procedure Class +-- +-- ************************************************************** + +X2AP-ELEMENTARY-PROCEDURE ::= CLASS { + &InitiatingMessage , + &SuccessfulOutcome OPTIONAL, + &UnsuccessfulOutcome OPTIONAL, + &procedureCode ProcedureCode UNIQUE, + &criticality Criticality DEFAULT ignore +} +WITH SYNTAX { + INITIATING MESSAGE &InitiatingMessage + [SUCCESSFUL OUTCOME &SuccessfulOutcome] + [UNSUCCESSFUL OUTCOME &UnsuccessfulOutcome] + PROCEDURE CODE &procedureCode + [CRITICALITY &criticality] +} + +-- ************************************************************** +-- +-- Interface PDU Definition +-- +-- ************************************************************** + +X2AP-PDU ::= CHOICE { + initiatingMessage InitiatingMessage, + successfulOutcome SuccessfulOutcome, + unsuccessfulOutcome UnsuccessfulOutcome, + ... +} + +InitiatingMessage ::= SEQUENCE { + procedureCode X2AP-ELEMENTARY-PROCEDURE.&procedureCode ({X2AP-ELEMENTARY-PROCEDURES}), + criticality X2AP-ELEMENTARY-PROCEDURE.&criticality ({X2AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value X2AP-ELEMENTARY-PROCEDURE.&InitiatingMessage ({X2AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +SuccessfulOutcome ::= SEQUENCE { + procedureCode X2AP-ELEMENTARY-PROCEDURE.&procedureCode ({X2AP-ELEMENTARY-PROCEDURES}), + criticality X2AP-ELEMENTARY-PROCEDURE.&criticality ({X2AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value X2AP-ELEMENTARY-PROCEDURE.&SuccessfulOutcome ({X2AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +UnsuccessfulOutcome ::= SEQUENCE { + procedureCode X2AP-ELEMENTARY-PROCEDURE.&procedureCode ({X2AP-ELEMENTARY-PROCEDURES}), + criticality X2AP-ELEMENTARY-PROCEDURE.&criticality ({X2AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value X2AP-ELEMENTARY-PROCEDURE.&UnsuccessfulOutcome ({X2AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +-- ************************************************************** +-- +-- Interface Elementary Procedure List +-- +-- ************************************************************** + +X2AP-ELEMENTARY-PROCEDURES X2AP-ELEMENTARY-PROCEDURE ::= { + X2AP-ELEMENTARY-PROCEDURES-CLASS-1 | + X2AP-ELEMENTARY-PROCEDURES-CLASS-2 , + ... +} + +X2AP-ELEMENTARY-PROCEDURES-CLASS-1 X2AP-ELEMENTARY-PROCEDURE ::= { + handoverPreparation | + reset | + x2Setup | + resourceStatusReportingInitiation | + eNBConfigurationUpdate | + mobilitySettingsChange | + cellActivation | + seNBAdditionPreparation | + meNBinitiatedSeNBModificationPreparation | + seNBinitiatedSeNBModification | + seNBinitiatedSeNBRelease | + x2Removal | + retrieveUEContext, + ... +} + +X2AP-ELEMENTARY-PROCEDURES-CLASS-2 X2AP-ELEMENTARY-PROCEDURE ::= { + snStatusTransfer | + uEContextRelease | + handoverCancel | + errorIndication | + resourceStatusReporting | + loadIndication | + privateMessage | + rLFIndication | + handoverReport | + x2Release | + x2APMessageTransfer | + seNBReconfigurationCompletion | + meNBinitiatedSeNBRelease | + seNBCounterCheck, + ... + +} + +-- ************************************************************** +-- +-- Interface Elementary Procedures +-- +-- ************************************************************** + +handoverPreparation X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE HandoverRequest + SUCCESSFUL OUTCOME HandoverRequestAcknowledge + UNSUCCESSFUL OUTCOME HandoverPreparationFailure + PROCEDURE CODE id-handoverPreparation + CRITICALITY reject +} + +snStatusTransfer X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE SNStatusTransfer + PROCEDURE CODE id-snStatusTransfer + CRITICALITY ignore +} + +uEContextRelease X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextRelease + PROCEDURE CODE id-uEContextRelease + CRITICALITY ignore +} + + +handoverCancel X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE HandoverCancel + PROCEDURE CODE id-handoverCancel + CRITICALITY ignore +} + +handoverReport X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE HandoverReport + PROCEDURE CODE id-handoverReport + CRITICALITY ignore +} + +errorIndication X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ErrorIndication + PROCEDURE CODE id-errorIndication + CRITICALITY ignore +} + +reset X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ResetRequest + SUCCESSFUL OUTCOME ResetResponse + PROCEDURE CODE id-reset + CRITICALITY reject +} + +x2Setup X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE X2SetupRequest + SUCCESSFUL OUTCOME X2SetupResponse + UNSUCCESSFUL OUTCOME X2SetupFailure + PROCEDURE CODE id-x2Setup + CRITICALITY reject +} + + +loadIndication X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE LoadInformation + PROCEDURE CODE id-loadIndication + CRITICALITY ignore +} + +eNBConfigurationUpdate X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ENBConfigurationUpdate + SUCCESSFUL OUTCOME ENBConfigurationUpdateAcknowledge + UNSUCCESSFUL OUTCOME ENBConfigurationUpdateFailure + PROCEDURE CODE id-eNBConfigurationUpdate + CRITICALITY reject +} + +resourceStatusReportingInitiation X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ResourceStatusRequest + SUCCESSFUL OUTCOME ResourceStatusResponse + UNSUCCESSFUL OUTCOME ResourceStatusFailure + PROCEDURE CODE id-resourceStatusReportingInitiation + CRITICALITY reject +} + +resourceStatusReporting X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ResourceStatusUpdate + PROCEDURE CODE id-resourceStatusReporting + CRITICALITY ignore +} + +rLFIndication X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RLFIndication + PROCEDURE CODE id-rLFIndication + CRITICALITY ignore +} + +privateMessage X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PrivateMessage + PROCEDURE CODE id-privateMessage + CRITICALITY ignore +} + +mobilitySettingsChange X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE MobilityChangeRequest + SUCCESSFUL OUTCOME MobilityChangeAcknowledge + UNSUCCESSFUL OUTCOME MobilityChangeFailure + PROCEDURE CODE id-mobilitySettingsChange + CRITICALITY reject +} + +cellActivation X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE CellActivationRequest + SUCCESSFUL OUTCOME CellActivationResponse + UNSUCCESSFUL OUTCOME CellActivationFailure + PROCEDURE CODE id-cellActivation + CRITICALITY reject +} + +x2Release X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE X2Release + PROCEDURE CODE id-x2Release + CRITICALITY reject +} + +x2APMessageTransfer X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE X2APMessageTransfer + PROCEDURE CODE id-x2APMessageTransfer + CRITICALITY reject +} + +seNBAdditionPreparation X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE SeNBAdditionRequest + SUCCESSFUL OUTCOME SeNBAdditionRequestAcknowledge + UNSUCCESSFUL OUTCOME SeNBAdditionRequestReject + PROCEDURE CODE id-seNBAdditionPreparation + CRITICALITY reject +} + +seNBReconfigurationCompletion X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE SeNBReconfigurationComplete + PROCEDURE CODE id-seNBReconfigurationCompletion + CRITICALITY ignore +} + +meNBinitiatedSeNBModificationPreparation X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE SeNBModificationRequest + SUCCESSFUL OUTCOME SeNBModificationRequestAcknowledge + UNSUCCESSFUL OUTCOME SeNBModificationRequestReject + PROCEDURE CODE id-meNBinitiatedSeNBModificationPreparation + CRITICALITY reject +} + +seNBinitiatedSeNBModification X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE SeNBModificationRequired + SUCCESSFUL OUTCOME SeNBModificationConfirm + UNSUCCESSFUL OUTCOME SeNBModificationRefuse + PROCEDURE CODE id-seNBinitiatedSeNBModification + CRITICALITY reject +} + +meNBinitiatedSeNBRelease X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE SeNBReleaseRequest + PROCEDURE CODE id-meNBinitiatedSeNBRelease + CRITICALITY ignore +} + +seNBinitiatedSeNBRelease X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE SeNBReleaseRequired + SUCCESSFUL OUTCOME SeNBReleaseConfirm + PROCEDURE CODE id-seNBinitiatedSeNBRelease + CRITICALITY reject +} + +seNBCounterCheck X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE SeNBCounterCheckRequest + PROCEDURE CODE id-seNBCounterCheck + CRITICALITY reject +} + +x2Removal X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE X2RemovalRequest + SUCCESSFUL OUTCOME X2RemovalResponse + UNSUCCESSFUL OUTCOME X2RemovalFailure + PROCEDURE CODE id-x2Removal + CRITICALITY reject +} + +retrieveUEContext X2AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RetrieveUEContextRequest + SUCCESSFUL OUTCOME RetrieveUEContextResponse + UNSUCCESSFUL OUTCOME RetrieveUEContextFailure + PROCEDURE CODE id-retrieveUEContext + CRITICALITY reject +} + +END + + +-- ************************************************************** +-- +-- PDU definitions for X2AP. +-- +-- ************************************************************** + +X2AP-PDU-Contents { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +eps-Access (21) modules (3) x2ap (2) version1 (1) x2ap-PDU-Contents (1) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + ABSInformation, + ABS-Status, + AS-SecurityInformation, + BearerType, + Cause, + CompositeAvailableCapacityGroup, + Correlation-ID, + COUNTvalue, + CellReportingIndicator, + CriticalityDiagnostics, + CRNTI, + CSGMembershipStatus, + CSG-Id, + DeactivationIndication, + DL-Forwarding, + DynamicDLTransmissionInformation, + ECGI, + E-RAB-ID, + E-RAB-Level-QoS-Parameters, + E-RAB-List, + EUTRANTraceID, + GlobalENB-ID, + GTPtunnelEndpoint, + GUGroupIDList, + GUMMEI, + HandoverReportType, + HandoverRestrictionList, + Masked-IMEISV, + InvokeIndication, + LocationReportingInformation, + MDT-Configuration, + ManagementBasedMDTallowed, + MDTPLMNList, + Neighbour-Information, + PCI, + PDCP-SN, + PLMN-Identity, + ReceiveStatusofULPDCPSDUs, + Registration-Request, + RelativeNarrowbandTxPower, + RadioResourceStatus, + RRCConnReestabIndicator, + RRCConnSetupIndicator, + UE-RLF-Report-Container, + RRC-Context, + ServedCell-Information, + ServedCells, + ShortMAC-I, + SRVCCOperationPossible, + SubscriberProfileIDforRFP, + TargetCellInUTRAN, + TargeteNBtoSource-eNBTransparentContainer, + TimeToWait, + TraceActivation, + TraceDepth, + TransportLayerAddress, + UEAggregateMaximumBitRate, + UE-HistoryInformation, + UE-HistoryInformationFromTheUE, + UE-S1AP-ID, + UESecurityCapabilities, + UE-X2AP-ID, + UL-HighInterferenceIndicationInfo, + UL-InterferenceOverloadIndication, + HWLoadIndicator, + S1TNLLoadIndicator, + Measurement-ID, + ReportCharacteristics, + MobilityParametersInformation, + MobilityParametersModificationRange, + ReceiveStatusOfULPDCPSDUsExtended, + COUNTValueExtended, + SubframeAssignment, + ExtendedULInterferenceOverloadInfo, + ExpectedUEBehaviour, + SeNBSecurityKey, + MeNBtoSeNBContainer, + SeNBtoMeNBContainer, + SCGChangeIndication, + CoMPInformation, + ReportingPeriodicityRSRPMR, + RSRPMRList, + UE-RLF-Report-Container-for-extended-bands, + ProSeAuthorized, + CoverageModificationList, + ReportingPeriodicityCSIR, + CSIReportList, + ReceiveStatusOfULPDCPSDUsPDCP-SNlength18, + COUNTvaluePDCP-SNlength18, + LHN-ID, + UE-ContextKeptIndicator, + UE-X2AP-ID-Extension, + SIPTOBearerDeactivationIndication, + TunnelInformation, + V2XServicesAuthorized, + X2BenefitValue, + ResumeID, + EUTRANCellIdentifier, + MakeBeforeBreakIndicator, + WTID, + WT-UE-XwAP-ID, + UESidelinkAggregateMaximumBitRate + +FROM X2AP-IEs + + PrivateIE-Container{}, + ProtocolExtensionContainer{}, + ProtocolIE-Container{}, + ProtocolIE-ContainerList{}, + ProtocolIE-ContainerPair{}, + ProtocolIE-ContainerPairList{}, + ProtocolIE-Single-Container{}, + X2AP-PRIVATE-IES, + X2AP-PROTOCOL-EXTENSION, + X2AP-PROTOCOL-IES, + X2AP-PROTOCOL-IES-PAIR +FROM X2AP-Containers + + id-ABSInformation, + id-ActivatedCellList, + id-BearerType, + id-Cause, + id-CellInformation, + id-CellInformation-Item, + id-CellMeasurementResult, + id-CellMeasurementResult-Item, + id-CellToReport, + id-CellToReport-Item, + id-CompositeAvailableCapacityGroup, + id-CriticalityDiagnostics, + id-DeactivationIndication, + id-DynamicDLTransmissionInformation, + id-E-RABs-Admitted-Item, + id-E-RABs-Admitted-List, + id-E-RABs-NotAdmitted-List, + id-E-RABs-SubjectToStatusTransfer-List, + id-E-RABs-SubjectToStatusTransfer-Item, + id-E-RABs-ToBeSetup-Item, + id-GlobalENB-ID, + id-GUGroupIDList, + id-GUGroupIDToAddList, + id-GUGroupIDToDeleteList, + id-GUMMEI-ID, + id-Masked-IMEISV, + id-InvokeIndication, + id-New-eNB-UE-X2AP-ID, + id-Old-eNB-UE-X2AP-ID, + id-Registration-Request, + id-ReportingPeriodicity, + id-ServedCells, + id-ServedCellsToActivate, + id-ServedCellsToAdd, + id-ServedCellsToModify, + id-ServedCellsToDelete, + id-SRVCCOperationPossible, + id-TargetCell-ID, + id-TargeteNBtoSource-eNBTransparentContainer, + id-TimeToWait, + id-TraceActivation, + id-UE-ContextInformation, + id-UE-HistoryInformation, + id-UE-X2AP-ID, + id-Measurement-ID, + id-ReportCharacteristics, + id-ENB1-Measurement-ID, + id-ENB2-Measurement-ID, + id-ENB1-Cell-ID, + id-ENB2-Cell-ID, + id-ENB2-Proposed-Mobility-Parameters, + id-ENB1-Mobility-Parameters, + id-ENB2-Mobility-Parameters-Modification-Range, + id-FailureCellPCI, + id-Re-establishmentCellECGI, + id-FailureCellCRNTI, + id-ShortMAC-I, + id-SourceCellECGI, + id-FailureCellECGI, + id-HandoverReportType, + id-UE-RLF-Report-Container, + id-PartialSuccessIndicator, + id-MeasurementInitiationResult-List, + id-MeasurementInitiationResult-Item, + id-MeasurementFailureCause-Item, + id-CompleteFailureCauseInformation-List, + id-CompleteFailureCauseInformation-Item, + id-CSGMembershipStatus, + id-CSG-Id, + id-MDTConfiguration, + id-ManagementBasedMDTallowed, + id-ABS-Status, + id-RRCConnSetupIndicator, + id-RRCConnReestabIndicator, + id-TargetCellInUTRAN, + id-MobilityInformation, + id-SourceCellCRNTI, + id-ManagementBasedMDTPLMNList, + id-ReceiveStatusOfULPDCPSDUsExtended, + id-ULCOUNTValueExtended, + id-DLCOUNTValueExtended, + id-IntendedULDLConfiguration, + id-ExtendedULInterferenceOverloadInfo, + id-RNL-Header, + id-x2APMessage, + id-UE-HistoryInformationFromTheUE, + id-ExpectedUEBehaviour, + id-MeNB-UE-X2AP-ID, + id-SeNB-UE-X2AP-ID, + id-UE-SecurityCapabilities, + id-SeNBSecurityKey, + id-SeNBUEAggregateMaximumBitRate, + id-ServingPLMN, + id-E-RABs-ToBeAdded-List, + id-E-RABs-ToBeAdded-Item, + id-MeNBtoSeNBContainer, + id-E-RABs-Admitted-ToBeAdded-List, + id-E-RABs-Admitted-ToBeAdded-Item, + id-SeNBtoMeNBContainer, + id-ResponseInformationSeNBReconfComp, + id-UE-ContextInformationSeNBModReq, + id-E-RABs-ToBeAdded-ModReqItem, + id-E-RABs-ToBeModified-ModReqItem, + id-E-RABs-ToBeReleased-ModReqItem, + id-E-RABs-Admitted-ToBeAdded-ModAckList, + id-E-RABs-Admitted-ToBeModified-ModAckList, + id-E-RABs-Admitted-ToBeReleased-ModAckList, + id-E-RABs-Admitted-ToBeAdded-ModAckItem, + id-E-RABs-Admitted-ToBeModified-ModAckItem, + id-E-RABs-Admitted-ToBeReleased-ModAckItem, + id-SCGChangeIndication, + id-E-RABs-ToBeReleased-ModReqd, + id-E-RABs-ToBeReleased-ModReqdItem, + id-E-RABs-ToBeReleased-List-RelReq, + id-E-RABs-ToBeReleased-RelReqItem, + id-E-RABs-ToBeReleased-List-RelConf, + id-E-RABs-ToBeReleased-RelConfItem, + id-E-RABs-SubjectToCounterCheck-List, + id-E-RABs-SubjectToCounterCheckItem, + id-CoMPInformation, + id-ReportingPeriodicityRSRPMR, + id-RSRPMRList, + id-UE-RLF-Report-Container-for-extended-bands, + id-ProSeAuthorized, + id-CoverageModificationList, + id-ReportingPeriodicityCSIR, + id-CSIReportList, + id-ReceiveStatusOfULPDCPSDUsPDCP-SNlength18, + id-ULCOUNTValuePDCP-SNlength18, + id-DLCOUNTValuePDCP-SNlength18, + id-LHN-ID, + id-Correlation-ID, + id-SIPTO-Correlation-ID, + id-UE-ContextReferenceAtSeNB, + id-UE-ContextReferenceAtWT, + id-UE-ContextKeptIndicator, + id-WT-UE-ContextKeptIndicator, + id-New-eNB-UE-X2AP-ID-Extension, + id-Old-eNB-UE-X2AP-ID-Extension, + id-MeNB-UE-X2AP-ID-Extension, + id-SeNB-UE-X2AP-ID-Extension, + id-SIPTO-BearerDeactivationIndication, + id-Tunnel-Information-for-BBF, + id-SIPTO-L-GW-TransportLayerAddress, + id-GW-TransportLayerAddress, + id-X2RemovalThreshold, + id-CellReportingIndicator, + id-V2XServicesAuthorized, + id-resumeID, + id-UE-ContextInformationRetrieve, + id-E-RABs-ToBeSetupRetrieve-Item, + id-NewEUTRANCellIdentifier, + id-MakeBeforeBreakIndicator, + id-UESidelinkAggregateMaximumBitRate, + id-uL-GTPtunnelEndpoint, + + maxCellineNB, + maxnoofBearers, + maxnoofPDCP-SN, + maxFailedMeasObjects, + maxnoofCellIDforMDT, + maxnoofTAforMDT +FROM X2AP-Constants; + +-- ************************************************************** +-- +-- HANDOVER REQUEST +-- +-- ************************************************************** + +HandoverRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{HandoverRequest-IEs}}, + ... +} + +HandoverRequest-IEs X2AP-PROTOCOL-IES ::= { + { ID id-Old-eNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}| + { ID id-TargetCell-ID CRITICALITY reject TYPE ECGI PRESENCE mandatory}| + { ID id-GUMMEI-ID CRITICALITY reject TYPE GUMMEI PRESENCE mandatory}| + { ID id-UE-ContextInformation CRITICALITY reject TYPE UE-ContextInformation PRESENCE mandatory}| + { ID id-UE-HistoryInformation CRITICALITY ignore TYPE UE-HistoryInformation PRESENCE mandatory}| + { ID id-TraceActivation CRITICALITY ignore TYPE TraceActivation PRESENCE optional}| + { ID id-SRVCCOperationPossible CRITICALITY ignore TYPE SRVCCOperationPossible PRESENCE optional}| + { ID id-CSGMembershipStatus CRITICALITY reject TYPE CSGMembershipStatus PRESENCE optional}| + { ID id-MobilityInformation CRITICALITY ignore TYPE MobilityInformation PRESENCE optional}| + { ID id-Masked-IMEISV CRITICALITY ignore TYPE Masked-IMEISV PRESENCE optional}| + { ID id-UE-HistoryInformationFromTheUE CRITICALITY ignore TYPE UE-HistoryInformationFromTheUE PRESENCE optional}| + { ID id-ExpectedUEBehaviour CRITICALITY ignore TYPE ExpectedUEBehaviour PRESENCE optional}| + { ID id-ProSeAuthorized CRITICALITY ignore TYPE ProSeAuthorized PRESENCE optional}| + { ID id-UE-ContextReferenceAtSeNB CRITICALITY ignore TYPE UE-ContextReferenceAtSeNB PRESENCE optional}| + { ID id-Old-eNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-V2XServicesAuthorized CRITICALITY ignore TYPE V2XServicesAuthorized PRESENCE optional}| + { ID id-UE-ContextReferenceAtWT CRITICALITY ignore TYPE UE-ContextReferenceAtWT PRESENCE optional}, + ... +} + +UE-ContextInformation ::= SEQUENCE { + mME-UE-S1AP-ID UE-S1AP-ID, + uESecurityCapabilities UESecurityCapabilities, + aS-SecurityInformation AS-SecurityInformation, + uEaggregateMaximumBitRate UEAggregateMaximumBitRate, + subscriberProfileIDforRFP SubscriberProfileIDforRFP OPTIONAL, + e-RABs-ToBeSetup-List E-RABs-ToBeSetup-List, + rRC-Context RRC-Context, + handoverRestrictionList HandoverRestrictionList OPTIONAL, + locationReportingInformation LocationReportingInformation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {UE-ContextInformation-ExtIEs} } OPTIONAL, + ... +} + +UE-ContextInformation-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { +{ ID id-ManagementBasedMDTallowed CRITICALITY ignore EXTENSION ManagementBasedMDTallowed PRESENCE optional }| +{ ID id-ManagementBasedMDTPLMNList CRITICALITY ignore EXTENSION MDTPLMNList PRESENCE optional }| +{ ID id-UESidelinkAggregateMaximumBitRate CRITICALITY ignore EXTENSION UESidelinkAggregateMaximumBitRate PRESENCE optional}, + ... +} + +E-RABs-ToBeSetup-List ::= SEQUENCE (SIZE(1..maxnoofBearers)) OF ProtocolIE-Single-Container { {E-RABs-ToBeSetup-ItemIEs} } + +E-RABs-ToBeSetup-ItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-E-RABs-ToBeSetup-Item CRITICALITY ignore TYPE E-RABs-ToBeSetup-Item PRESENCE mandatory }, + ... +} + +E-RABs-ToBeSetup-Item ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + e-RAB-Level-QoS-Parameters E-RAB-Level-QoS-Parameters, + dL-Forwarding DL-Forwarding OPTIONAL, + uL-GTPtunnelEndpoint GTPtunnelEndpoint, + iE-Extensions ProtocolExtensionContainer { {E-RABs-ToBeSetup-ItemExtIEs} } OPTIONAL, + ... +} + +E-RABs-ToBeSetup-ItemExtIEs X2AP-PROTOCOL-EXTENSION ::= { + { ID id-BearerType CRITICALITY reject EXTENSION BearerType PRESENCE optional}, + ... +} + +MobilityInformation ::= BIT STRING (SIZE(32)) + +UE-ContextReferenceAtSeNB ::= SEQUENCE { + source-GlobalSeNB-ID GlobalENB-ID, + seNB-UE-X2AP-ID UE-X2AP-ID, + seNB-UE-X2AP-ID-Extension UE-X2AP-ID-Extension, + iE-Extensions ProtocolExtensionContainer { {UE-ContextReferenceAtSeNB-ItemExtIEs} } OPTIONAL, + ... +} + +UE-ContextReferenceAtSeNB-ItemExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +UE-ContextReferenceAtWT ::= SEQUENCE { + wTID WTID, + wT-UE-XwAP-ID WT-UE-XwAP-ID, + iE-Extensions ProtocolExtensionContainer { {UE-ContextReferenceAtWT-ItemExtIEs} } OPTIONAL, + ... +} + +UE-ContextReferenceAtWT-ItemExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- ************************************************************** +-- +-- HANDOVER REQUEST ACKNOWLEDGE +-- +-- ************************************************************** + +HandoverRequestAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{HandoverRequestAcknowledge-IEs}}, + ... +} + +HandoverRequestAcknowledge-IEs X2AP-PROTOCOL-IES ::= { + { ID id-Old-eNB-UE-X2AP-ID CRITICALITY ignore TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-New-eNB-UE-X2AP-ID CRITICALITY ignore TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-E-RABs-Admitted-List CRITICALITY ignore TYPE E-RABs-Admitted-List PRESENCE mandatory}| + { ID id-E-RABs-NotAdmitted-List CRITICALITY ignore TYPE E-RAB-List PRESENCE optional}| + { ID id-TargeteNBtoSource-eNBTransparentContainer CRITICALITY ignore TYPE TargeteNBtoSource-eNBTransparentContainer PRESENCE mandatory}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}| + { ID id-UE-ContextKeptIndicator CRITICALITY ignore TYPE UE-ContextKeptIndicator PRESENCE optional}| + { ID id-SeNB-UE-X2AP-ID-Extension CRITICALITY ignore TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-Old-eNB-UE-X2AP-ID-Extension CRITICALITY ignore TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-New-eNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-WT-UE-ContextKeptIndicator CRITICALITY ignore TYPE UE-ContextKeptIndicator PRESENCE optional}, + ... +} + +E-RABs-Admitted-List ::= SEQUENCE (SIZE (1..maxnoofBearers)) OF ProtocolIE-Single-Container { {E-RABs-Admitted-ItemIEs} } + +E-RABs-Admitted-ItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-E-RABs-Admitted-Item CRITICALITY ignore TYPE E-RABs-Admitted-Item PRESENCE mandatory } +} + +E-RABs-Admitted-Item ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + uL-GTP-TunnelEndpoint GTPtunnelEndpoint OPTIONAL, + dL-GTP-TunnelEndpoint GTPtunnelEndpoint OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {E-RABs-Admitted-Item-ExtIEs} } OPTIONAL, + ... +} + +E-RABs-Admitted-Item-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- ************************************************************** +-- +-- HANDOVER PREPARATION FAILURE +-- +-- ************************************************************** + +HandoverPreparationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{HandoverPreparationFailure-IEs}}, + ... +} + +HandoverPreparationFailure-IEs X2AP-PROTOCOL-IES ::= { + { ID id-Old-eNB-UE-X2AP-ID CRITICALITY ignore TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}| + { ID id-Old-eNB-UE-X2AP-ID-Extension CRITICALITY ignore TYPE UE-X2AP-ID-Extension PRESENCE optional}, + + ... +} + +-- ************************************************************** +-- +-- Handover Report +-- +-- ************************************************************** + +HandoverReport ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{HandoverReport-IEs}}, + ... +} + +HandoverReport-IEs X2AP-PROTOCOL-IES ::= { + { ID id-HandoverReportType CRITICALITY ignore TYPE HandoverReportType PRESENCE mandatory}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}| + { ID id-SourceCellECGI CRITICALITY ignore TYPE ECGI PRESENCE mandatory}| + { ID id-FailureCellECGI CRITICALITY ignore TYPE ECGI PRESENCE mandatory}| + { ID id-Re-establishmentCellECGI CRITICALITY ignore TYPE ECGI PRESENCE conditional} -- The IE shall be present if the Handover Report Type IE is set to “HO to Wrong Cell” -- | + { ID id-TargetCellInUTRAN CRITICALITY ignore TYPE TargetCellInUTRAN PRESENCE conditional} -- The IE shall be present if the Handover Report Type IE is set to "InterRAT ping-pong" --| + { ID id-SourceCellCRNTI CRITICALITY ignore TYPE CRNTI PRESENCE optional}| + { ID id-MobilityInformation CRITICALITY ignore TYPE MobilityInformation PRESENCE optional}| + { ID id-UE-RLF-Report-Container CRITICALITY ignore TYPE UE-RLF-Report-Container PRESENCE optional}| + { ID id-UE-RLF-Report-Container-for-extended-bands CRITICALITY ignore TYPE UE-RLF-Report-Container-for-extended-bands PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- SN Status Transfer +-- +-- ************************************************************** + +SNStatusTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{SNStatusTransfer-IEs}}, + ... +} + +SNStatusTransfer-IEs X2AP-PROTOCOL-IES ::= { + { ID id-Old-eNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-New-eNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-E-RABs-SubjectToStatusTransfer-List CRITICALITY ignore TYPE E-RABs-SubjectToStatusTransfer-List PRESENCE mandatory}| + { ID id-Old-eNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-New-eNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}, + ... +} + +E-RABs-SubjectToStatusTransfer-List ::= SEQUENCE (SIZE (1..maxnoofBearers)) OF ProtocolIE-Single-Container { { E-RABs-SubjectToStatusTransfer-ItemIEs} } + +E-RABs-SubjectToStatusTransfer-ItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-E-RABs-SubjectToStatusTransfer-Item CRITICALITY ignore TYPE E-RABs-SubjectToStatusTransfer-Item PRESENCE mandatory } +} + +E-RABs-SubjectToStatusTransfer-Item ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + + receiveStatusofULPDCPSDUs ReceiveStatusofULPDCPSDUs OPTIONAL, + uL-COUNTvalue COUNTvalue, + dL-COUNTvalue COUNTvalue, + iE-Extensions ProtocolExtensionContainer { {E-RABs-SubjectToStatusTransfer-ItemExtIEs} } OPTIONAL, + ... +} + +E-RABs-SubjectToStatusTransfer-ItemExtIEs X2AP-PROTOCOL-EXTENSION ::= { + { ID id-ReceiveStatusOfULPDCPSDUsExtended CRITICALITY ignore EXTENSION ReceiveStatusOfULPDCPSDUsExtended PRESENCE optional}| + { ID id-ULCOUNTValueExtended CRITICALITY ignore EXTENSION COUNTValueExtended PRESENCE optional}| + { ID id-DLCOUNTValueExtended CRITICALITY ignore EXTENSION COUNTValueExtended PRESENCE optional}| + { ID id-ReceiveStatusOfULPDCPSDUsPDCP-SNlength18 CRITICALITY ignore EXTENSION ReceiveStatusOfULPDCPSDUsPDCP-SNlength18 PRESENCE optional}| + { ID id-ULCOUNTValuePDCP-SNlength18 CRITICALITY ignore EXTENSION COUNTvaluePDCP-SNlength18 PRESENCE optional}| + { ID id-DLCOUNTValuePDCP-SNlength18 CRITICALITY ignore EXTENSION COUNTvaluePDCP-SNlength18 PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- UE Context Release +-- +-- ************************************************************** + +UEContextRelease ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{UEContextRelease-IEs}}, + ... +} + +UEContextRelease-IEs X2AP-PROTOCOL-IES ::= { + { ID id-Old-eNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-New-eNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-Old-eNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-New-eNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-SIPTO-BearerDeactivationIndication CRITICALITY ignore TYPE SIPTOBearerDeactivationIndication PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- HANDOVER CANCEL +-- +-- ************************************************************** + +HandoverCancel ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{HandoverCancel-IEs}}, + ... +} + +HandoverCancel-IEs X2AP-PROTOCOL-IES ::= { + { ID id-Old-eNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-New-eNB-UE-X2AP-ID CRITICALITY ignore TYPE UE-X2AP-ID PRESENCE optional}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}| + { ID id-Old-eNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-New-eNB-UE-X2AP-ID-Extension CRITICALITY ignore TYPE UE-X2AP-ID-Extension PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- ERROR INDICATION +-- +-- ************************************************************** + +ErrorIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ErrorIndication-IEs}}, + ... +} + +ErrorIndication-IEs X2AP-PROTOCOL-IES ::= { + { ID id-Old-eNB-UE-X2AP-ID CRITICALITY ignore TYPE UE-X2AP-ID PRESENCE optional}| + { ID id-New-eNB-UE-X2AP-ID CRITICALITY ignore TYPE UE-X2AP-ID PRESENCE optional}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}| + { ID id-Old-eNB-UE-X2AP-ID-Extension CRITICALITY ignore TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-New-eNB-UE-X2AP-ID-Extension CRITICALITY ignore TYPE UE-X2AP-ID-Extension PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- Reset Request +-- +-- ************************************************************** + +ResetRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ResetRequest-IEs}}, + ... +} + +ResetRequest-IEs X2AP-PROTOCOL-IES ::= { + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- Reset Response +-- +-- ************************************************************** + +ResetResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ResetResponse-IEs}}, + ... +} + +ResetResponse-IEs X2AP-PROTOCOL-IES ::= { + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- X2 SETUP REQUEST +-- +-- ************************************************************** + +X2SetupRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{X2SetupRequest-IEs}}, + ... +} + +X2SetupRequest-IEs X2AP-PROTOCOL-IES ::= { + { ID id-GlobalENB-ID CRITICALITY reject TYPE GlobalENB-ID PRESENCE mandatory}| + { ID id-ServedCells CRITICALITY reject TYPE ServedCells PRESENCE mandatory}| + { ID id-GUGroupIDList CRITICALITY reject TYPE GUGroupIDList PRESENCE optional}| + { ID id-LHN-ID CRITICALITY ignore TYPE LHN-ID PRESENCE optional}, +... +} + + + +-- ************************************************************** +-- +-- X2 SETUP RESPONSE +-- +-- ************************************************************** + +X2SetupResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{X2SetupResponse-IEs}}, + ... +} + +X2SetupResponse-IEs X2AP-PROTOCOL-IES ::= { + { ID id-GlobalENB-ID CRITICALITY reject TYPE GlobalENB-ID PRESENCE mandatory}| + { ID id-ServedCells CRITICALITY reject TYPE ServedCells PRESENCE mandatory}| + { ID id-GUGroupIDList CRITICALITY reject TYPE GUGroupIDList PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}| + { ID id-LHN-ID CRITICALITY ignore TYPE LHN-ID PRESENCE optional}, + ... +} + + + +-- ************************************************************** +-- +-- X2 SETUP FAILURE +-- +-- ************************************************************** + +X2SetupFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{X2SetupFailure-IEs}}, + ... +} + +X2SetupFailure-IEs X2AP-PROTOCOL-IES ::= { + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory} | + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional} | + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + + ... +} + + + +-- ************************************************************** +-- +-- LOAD INFORMATION +-- +-- ************************************************************** + +LoadInformation ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{LoadInformation-IEs}}, + ... +} + +LoadInformation-IEs X2AP-PROTOCOL-IES ::= { + { ID id-CellInformation CRITICALITY ignore TYPE CellInformation-List PRESENCE mandatory} , + ... +} + +CellInformation-List ::= SEQUENCE (SIZE (1..maxCellineNB)) OF ProtocolIE-Single-Container { {CellInformation-ItemIEs} } + +CellInformation-ItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-CellInformation-Item CRITICALITY ignore TYPE CellInformation-Item PRESENCE mandatory } +} + +CellInformation-Item ::= SEQUENCE { + cell-ID ECGI, + ul-InterferenceOverloadIndication UL-InterferenceOverloadIndication OPTIONAL, + ul-HighInterferenceIndicationInfo UL-HighInterferenceIndicationInfo OPTIONAL, + relativeNarrowbandTxPower RelativeNarrowbandTxPower OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {CellInformation-Item-ExtIEs} } OPTIONAL, + ... +} + +CellInformation-Item-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { +{ ID id-ABSInformation CRITICALITY ignore EXTENSION ABSInformation PRESENCE optional }| +{ ID id-InvokeIndication CRITICALITY ignore EXTENSION InvokeIndication PRESENCE optional }| +{ ID id-IntendedULDLConfiguration CRITICALITY ignore EXTENSION SubframeAssignment PRESENCE optional }| +{ ID id-ExtendedULInterferenceOverloadInfo CRITICALITY ignore EXTENSION ExtendedULInterferenceOverloadInfo PRESENCE optional }| +{ ID id-CoMPInformation CRITICALITY ignore EXTENSION CoMPInformation PRESENCE optional }| +{ ID id-DynamicDLTransmissionInformation CRITICALITY ignore EXTENSION DynamicDLTransmissionInformation PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- ENB CONFIGURATION UPDATE +-- +-- ************************************************************** + +ENBConfigurationUpdate ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ENBConfigurationUpdate-IEs}}, + ... +} + +ENBConfigurationUpdate-IEs X2AP-PROTOCOL-IES ::= { + { ID id-ServedCellsToAdd CRITICALITY reject TYPE ServedCells PRESENCE optional}| + { ID id-ServedCellsToModify CRITICALITY reject TYPE ServedCellsToModify PRESENCE optional}| + { ID id-ServedCellsToDelete CRITICALITY reject TYPE Old-ECGIs PRESENCE optional}| + { ID id-GUGroupIDToAddList CRITICALITY reject TYPE GUGroupIDList PRESENCE optional}| + { ID id-GUGroupIDToDeleteList CRITICALITY reject TYPE GUGroupIDList PRESENCE optional}| + { ID id-CoverageModificationList CRITICALITY reject TYPE CoverageModificationList PRESENCE optional}, + ... +} + +ServedCellsToModify::= SEQUENCE (SIZE (1..maxCellineNB)) OF ServedCellsToModify-Item + +ServedCellsToModify-Item::= SEQUENCE { + old-ecgi ECGI, + servedCellInfo ServedCell-Information, + neighbour-Info Neighbour-Information OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { ServedCellsToModify-Item-ExtIEs} } OPTIONAL, + ... +} + +ServedCellsToModify-Item-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { +{ ID id-DeactivationIndication CRITICALITY ignore EXTENSION DeactivationIndication PRESENCE optional }, + ... +} + + +Old-ECGIs::= SEQUENCE (SIZE (1..maxCellineNB)) OF ECGI + +-- ************************************************************** +-- +-- ENB CONFIGURATION UPDATE ACKNOWLEDGE +-- +-- ************************************************************** + +ENBConfigurationUpdateAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ENBConfigurationUpdateAcknowledge-IEs}}, + ... +} + +ENBConfigurationUpdateAcknowledge-IEs X2AP-PROTOCOL-IES ::= { + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, +... +} + +-- ************************************************************** +-- +-- ENB CONFIGURATION UPDATE FAIURE +-- +-- ************************************************************** + +ENBConfigurationUpdateFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ENBConfigurationUpdateFailure-IEs}}, + ... +} + +ENBConfigurationUpdateFailure-IEs X2AP-PROTOCOL-IES ::= { + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + + + +-- ************************************************************** +-- +-- Resource Status Request +-- +-- ************************************************************** + +ResourceStatusRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ResourceStatusRequest-IEs}}, + ... +} + +ResourceStatusRequest-IEs X2AP-PROTOCOL-IES ::= { + { ID id-ENB1-Measurement-ID CRITICALITY reject TYPE Measurement-ID PRESENCE mandatory}| + { ID id-ENB2-Measurement-ID CRITICALITY ignore TYPE Measurement-ID PRESENCE conditional}|-- The IE shall be present if the Registration Request IE is set to “Stop”, “Partial stop” or to “Add”-- + { ID id-Registration-Request CRITICALITY reject TYPE Registration-Request PRESENCE mandatory}| + { ID id-ReportCharacteristics CRITICALITY reject TYPE ReportCharacteristics PRESENCE optional}| + { ID id-CellToReport CRITICALITY ignore TYPE CellToReport-List PRESENCE mandatory}| + { ID id-ReportingPeriodicity CRITICALITY ignore TYPE ReportingPeriodicity PRESENCE optional}| + { ID id-PartialSuccessIndicator CRITICALITY ignore TYPE PartialSuccessIndicator PRESENCE optional}| + { ID id-ReportingPeriodicityRSRPMR CRITICALITY ignore TYPE ReportingPeriodicityRSRPMR PRESENCE optional}| + { ID id-ReportingPeriodicityCSIR CRITICALITY ignore TYPE ReportingPeriodicityCSIR PRESENCE optional}, + ... +} + + +CellToReport-List ::= SEQUENCE (SIZE (1..maxCellineNB)) OF ProtocolIE-Single-Container { {CellToReport-ItemIEs} } + +CellToReport-ItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-CellToReport-Item CRITICALITY ignore TYPE CellToReport-Item PRESENCE mandatory} +} + +CellToReport-Item ::= SEQUENCE { + cell-ID ECGI, + iE-Extensions ProtocolExtensionContainer { {CellToReport-Item-ExtIEs} } OPTIONAL, + ... +} + +CellToReport-Item-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + + +ReportingPeriodicity ::= ENUMERATED { + one-thousand-ms, + two-thousand-ms, + five-thousand-ms, + ten-thousand-ms, +... +} + +PartialSuccessIndicator ::= ENUMERATED { + partial-success-allowed, +... +} + +-- ************************************************************** +-- +-- Resource Status Response +-- +-- ************************************************************** + +ResourceStatusResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ResourceStatusResponse-IEs}}, + ... +} + +ResourceStatusResponse-IEs X2AP-PROTOCOL-IES ::= { + { ID id-ENB1-Measurement-ID CRITICALITY reject TYPE Measurement-ID PRESENCE mandatory}| + { ID id-ENB2-Measurement-ID CRITICALITY reject TYPE Measurement-ID PRESENCE mandatory}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}| + { ID id-MeasurementInitiationResult-List CRITICALITY ignore TYPE MeasurementInitiationResult-List PRESENCE optional}, + ... +} + + +MeasurementInitiationResult-List ::= SEQUENCE (SIZE (1..maxCellineNB)) OF ProtocolIE-Single-Container { { MeasurementInitiationResult-ItemIEs} } + +MeasurementInitiationResult-ItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-MeasurementInitiationResult-Item CRITICALITY ignore TYPE MeasurementInitiationResult-Item PRESENCE mandatory} +} + +MeasurementInitiationResult-Item ::= SEQUENCE { + cell-ID ECGI, + measurementFailureCause-List MeasurementFailureCause-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { MeasurementInitiationResult-Item-ExtIEs} } OPTIONAL, + ... +} + +MeasurementInitiationResult-Item-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +MeasurementFailureCause-List ::= SEQUENCE (SIZE (1..maxFailedMeasObjects)) OF ProtocolIE-Single-Container { { MeasurementFailureCause-ItemIEs} } + +MeasurementFailureCause-ItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-MeasurementFailureCause-Item CRITICALITY ignore TYPE MeasurementFailureCause-Item PRESENCE mandatory} +} + +MeasurementFailureCause-Item ::= SEQUENCE { + measurementFailedReportCharacteristics ReportCharacteristics, + cause Cause, + iE-Extensions ProtocolExtensionContainer { { MeasurementFailureCause-Item-ExtIEs} } OPTIONAL, + ... +} + +MeasurementFailureCause-Item-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- ************************************************************** +-- +-- Resource Status Failure +-- +-- ************************************************************** + +ResourceStatusFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ResourceStatusFailure-IEs}}, + ... +} + +ResourceStatusFailure-IEs X2AP-PROTOCOL-IES ::= { + { ID id-ENB1-Measurement-ID CRITICALITY reject TYPE Measurement-ID PRESENCE mandatory}| + { ID id-ENB2-Measurement-ID CRITICALITY reject TYPE Measurement-ID PRESENCE mandatory}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}| + { ID id-CompleteFailureCauseInformation-List CRITICALITY ignore TYPE CompleteFailureCauseInformation-List PRESENCE optional}, + ... +} + +CompleteFailureCauseInformation-List ::= SEQUENCE (SIZE (1..maxCellineNB)) OF ProtocolIE-Single-Container { {CompleteFailureCauseInformation-ItemIEs} } + +CompleteFailureCauseInformation-ItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-CompleteFailureCauseInformation-Item CRITICALITY ignore TYPE CompleteFailureCauseInformation-Item PRESENCE mandatory} +} + +CompleteFailureCauseInformation-Item ::= SEQUENCE { + cell-ID ECGI, + measurementFailureCause-List MeasurementFailureCause-List, + iE-Extensions ProtocolExtensionContainer { { CompleteFailureCauseInformation-Item-ExtIEs} } OPTIONAL, + ... +} + +CompleteFailureCauseInformation-Item-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- ************************************************************** +-- +-- Resource Status Update +-- +-- ************************************************************** + +ResourceStatusUpdate ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ResourceStatusUpdate-IEs}}, + ... +} + +ResourceStatusUpdate-IEs X2AP-PROTOCOL-IES ::= { + { ID id-ENB1-Measurement-ID CRITICALITY reject TYPE Measurement-ID PRESENCE mandatory}| + { ID id-ENB2-Measurement-ID CRITICALITY reject TYPE Measurement-ID PRESENCE mandatory}| + { ID id-CellMeasurementResult CRITICALITY ignore TYPE CellMeasurementResult-List PRESENCE mandatory}, + ... +} + +CellMeasurementResult-List ::= SEQUENCE (SIZE (1..maxCellineNB)) OF ProtocolIE-Single-Container { {CellMeasurementResult-ItemIEs} } + +CellMeasurementResult-ItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-CellMeasurementResult-Item CRITICALITY ignore TYPE CellMeasurementResult-Item PRESENCE mandatory} +} + +CellMeasurementResult-Item ::= SEQUENCE { + cell-ID ECGI, + hWLoadIndicator HWLoadIndicator OPTIONAL, + s1TNLLoadIndicator S1TNLLoadIndicator OPTIONAL, + radioResourceStatus RadioResourceStatus OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {CellMeasurementResult-Item-ExtIEs} } OPTIONAL, + ... +} + +CellMeasurementResult-Item-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + { ID id-CompositeAvailableCapacityGroup CRITICALITY ignore EXTENSION CompositeAvailableCapacityGroup PRESENCE optional}| + { ID id-ABS-Status CRITICALITY ignore EXTENSION ABS-Status PRESENCE optional}| + { ID id-RSRPMRList CRITICALITY ignore EXTENSION RSRPMRList PRESENCE optional}| + { ID id-CSIReportList CRITICALITY ignore EXTENSION CSIReportList PRESENCE optional}| + { ID id-CellReportingIndicator CRITICALITY ignore EXTENSION CellReportingIndicator PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- PRIVATE MESSAGE +-- +-- ************************************************************** + +PrivateMessage ::= SEQUENCE { + privateIEs PrivateIE-Container {{PrivateMessage-IEs}}, + ... +} + +PrivateMessage-IEs X2AP-PRIVATE-IES ::= { + ... +} + +-- ************************************************************** +-- +-- MOBILITY CHANGE REQUEST +-- +-- ************************************************************** + +MobilityChangeRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{MobilityChangeRequest-IEs}}, + ... +} + +MobilityChangeRequest-IEs X2AP-PROTOCOL-IES ::= { + { ID id-ENB1-Cell-ID CRITICALITY reject TYPE ECGI PRESENCE mandatory}| + { ID id-ENB2-Cell-ID CRITICALITY reject TYPE ECGI PRESENCE mandatory}| + { ID id-ENB1-Mobility-Parameters CRITICALITY ignore TYPE MobilityParametersInformation PRESENCE optional}| + { ID id-ENB2-Proposed-Mobility-Parameters CRITICALITY reject TYPE MobilityParametersInformation PRESENCE mandatory}| + { ID id-Cause CRITICALITY reject TYPE Cause PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- MOBILITY CHANGE ACKNOWLEDGE +-- +-- ************************************************************** + +MobilityChangeAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{MobilityChangeAcknowledge-IEs}}, + ... +} + +MobilityChangeAcknowledge-IEs X2AP-PROTOCOL-IES ::= { + { ID id-ENB1-Cell-ID CRITICALITY reject TYPE ECGI PRESENCE mandatory}| + { ID id-ENB2-Cell-ID CRITICALITY reject TYPE ECGI PRESENCE mandatory}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- MOBILITY CHANGE FAILURE +-- +-- ************************************************************** + +MobilityChangeFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{MobilityChangeFailure-IEs}}, + ... +} + +MobilityChangeFailure-IEs X2AP-PROTOCOL-IES ::= { + { ID id-ENB1-Cell-ID CRITICALITY ignore TYPE ECGI PRESENCE mandatory}| + { ID id-ENB2-Cell-ID CRITICALITY ignore TYPE ECGI PRESENCE mandatory}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}| + { ID id-ENB2-Mobility-Parameters-Modification-Range CRITICALITY ignore TYPE MobilityParametersModificationRange PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- Radio Link Failure Indication +-- +-- ************************************************************** + +RLFIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{RLFIndication-IEs}}, + ... +} + +RLFIndication-IEs X2AP-PROTOCOL-IES ::= { + { ID id-FailureCellPCI CRITICALITY ignore TYPE PCI PRESENCE mandatory}| + { ID id-Re-establishmentCellECGI CRITICALITY ignore TYPE ECGI PRESENCE mandatory}| + { ID id-FailureCellCRNTI CRITICALITY ignore TYPE CRNTI PRESENCE mandatory}| + { ID id-ShortMAC-I CRITICALITY ignore TYPE ShortMAC-I PRESENCE optional}| + { ID id-UE-RLF-Report-Container CRITICALITY ignore TYPE UE-RLF-Report-Container PRESENCE optional}| + { ID id-RRCConnSetupIndicator CRITICALITY reject TYPE RRCConnSetupIndicator PRESENCE optional}| + { ID id-RRCConnReestabIndicator CRITICALITY ignore TYPE RRCConnReestabIndicator PRESENCE optional}| + { ID id-UE-RLF-Report-Container-for-extended-bands CRITICALITY ignore TYPE UE-RLF-Report-Container-for-extended-bands PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- Cell Activation Request +-- +-- ************************************************************** + +CellActivationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{CellActivationRequest-IEs}}, + ... +} + +CellActivationRequest-IEs X2AP-PROTOCOL-IES ::= { + { ID id-ServedCellsToActivate CRITICALITY reject TYPE ServedCellsToActivate PRESENCE mandatory}, + ... +} + +ServedCellsToActivate::= SEQUENCE (SIZE (1..maxCellineNB)) OF ServedCellsToActivate-Item + +ServedCellsToActivate-Item::= SEQUENCE { + ecgi ECGI, + iE-Extensions ProtocolExtensionContainer { { ServedCellsToActivate-Item-ExtIEs} } OPTIONAL, + ... +} + +ServedCellsToActivate-Item-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- ************************************************************** +-- +-- Cell Activation Response +-- +-- ************************************************************** + +CellActivationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{CellActivationResponse-IEs}}, + ... +} + +CellActivationResponse-IEs X2AP-PROTOCOL-IES ::= { + { ID id-ActivatedCellList CRITICALITY ignore TYPE ActivatedCellList PRESENCE mandatory}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + +ActivatedCellList ::= SEQUENCE (SIZE (1..maxCellineNB)) OF ActivatedCellList-Item + +ActivatedCellList-Item::= SEQUENCE { + ecgi ECGI, + iE-Extensions ProtocolExtensionContainer { { ActivatedCellList-Item-ExtIEs} } OPTIONAL, + ... +} + +ActivatedCellList-Item-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +--************************************************************** +-- +-- CELL ACTIVATION FAILURE +-- +-- ************************************************************** + +CellActivationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{CellActivationFailure-IEs}}, + ... +} + +CellActivationFailure-IEs X2AP-PROTOCOL-IES ::= { + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- X2 RELEASE +-- +-- ************************************************************** + +X2Release ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{X2Release-IEs}}, + ... +} + +X2Release-IEs X2AP-PROTOCOL-IES ::= { + { ID id-GlobalENB-ID CRITICALITY reject TYPE GlobalENB-ID PRESENCE mandatory}, +... +} + +-- ************************************************************** +-- +-- X2AP Message Transfer +-- +-- ************************************************************** + +X2APMessageTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{X2APMessageTransfer-IEs}}, + ... +} + +X2APMessageTransfer-IEs X2AP-PROTOCOL-IES ::= { + { ID id-RNL-Header CRITICALITY reject TYPE RNL-Header PRESENCE mandatory}| + { ID id-x2APMessage CRITICALITY reject TYPE X2AP-Message PRESENCE optional}, + ... +} + +RNL-Header ::= SEQUENCE { + source-GlobalENB-ID GlobalENB-ID, + target-GlobalENB-ID GlobalENB-ID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { RNL-Header-Item-ExtIEs} } OPTIONAL, + ... +} + +RNL-Header-Item-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +X2AP-Message ::= OCTET STRING + +-- ************************************************************** +-- +-- SENB ADDITION REQUEST +-- +-- ************************************************************** + +SeNBAdditionRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{SeNBAdditionRequest-IEs}}, + ... +} + +SeNBAdditionRequest-IEs X2AP-PROTOCOL-IES ::= { + { ID id-MeNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-UE-SecurityCapabilities CRITICALITY reject TYPE UESecurityCapabilities PRESENCE conditional}| + -- This IE shall be present if the Bearer Option IE is set to the value “SCG bearer” -- + { ID id-SeNBSecurityKey CRITICALITY reject TYPE SeNBSecurityKey PRESENCE conditional}| + -- This IE shall be present if the Bearer Option IE is set to the value “SCG bearer” -- + { ID id-SeNBUEAggregateMaximumBitRate CRITICALITY reject TYPE UEAggregateMaximumBitRate PRESENCE mandatory}| + { ID id-ServingPLMN CRITICALITY ignore TYPE PLMN-Identity PRESENCE optional}| + { ID id-E-RABs-ToBeAdded-List CRITICALITY reject TYPE E-RABs-ToBeAdded-List PRESENCE mandatory}| + { ID id-MeNBtoSeNBContainer CRITICALITY reject TYPE MeNBtoSeNBContainer PRESENCE mandatory}| + { ID id-CSGMembershipStatus CRITICALITY reject TYPE CSGMembershipStatus PRESENCE optional}| + { ID id-SeNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE optional}| + { ID id-SeNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-ExpectedUEBehaviour CRITICALITY ignore TYPE ExpectedUEBehaviour PRESENCE optional}| + { ID id-MeNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}, + ... +} + +E-RABs-ToBeAdded-List ::= SEQUENCE (SIZE(1..maxnoofBearers)) OF ProtocolIE-Single-Container { { E-RABs-ToBeAdded-ItemIEs} } + +E-RABs-ToBeAdded-ItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-E-RABs-ToBeAdded-Item CRITICALITY reject TYPE E-RABs-ToBeAdded-Item PRESENCE mandatory}, + ... +} + +E-RABs-ToBeAdded-Item ::= CHOICE { + sCG-Bearer E-RABs-ToBeAdded-Item-SCG-Bearer, + split-Bearer E-RABs-ToBeAdded-Item-Split-Bearer, + ... +} + +E-RABs-ToBeAdded-Item-SCG-Bearer ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + e-RAB-Level-QoS-Parameters E-RAB-Level-QoS-Parameters, + dL-Forwarding DL-Forwarding OPTIONAL, + s1-UL-GTPtunnelEndpoint GTPtunnelEndpoint, + iE-Extensions ProtocolExtensionContainer { {E-RABs-ToBeAdded-Item-SCG-BearerExtIEs} } OPTIONAL, + ... +} + +E-RABs-ToBeAdded-Item-SCG-BearerExtIEs X2AP-PROTOCOL-EXTENSION ::= { + { ID id-Correlation-ID CRITICALITY ignore EXTENSION Correlation-ID PRESENCE optional}| + { ID id-SIPTO-Correlation-ID CRITICALITY ignore EXTENSION Correlation-ID PRESENCE optional}, + ... +} + +E-RABs-ToBeAdded-Item-Split-Bearer ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + e-RAB-Level-QoS-Parameters E-RAB-Level-QoS-Parameters, + meNB-GTPtunnelEndpoint GTPtunnelEndpoint, + iE-Extensions ProtocolExtensionContainer { {E-RABs-ToBeAdded-Item-Split-BearerExtIEs} } OPTIONAL, + ... +} + +E-RABs-ToBeAdded-Item-Split-BearerExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- ************************************************************** +-- +-- SENB ADDITION REQUEST ACKNOWLEDGE +-- +-- ************************************************************** + +SeNBAdditionRequestAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{SeNBAdditionRequestAcknowledge-IEs}}, + ... +} + +SeNBAdditionRequestAcknowledge-IEs X2AP-PROTOCOL-IES ::= { + { ID id-MeNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-SeNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-E-RABs-Admitted-ToBeAdded-List CRITICALITY ignore TYPE E-RABs-Admitted-ToBeAdded-List PRESENCE mandatory}| + { ID id-E-RABs-NotAdmitted-List CRITICALITY ignore TYPE E-RAB-List PRESENCE optional}| + { ID id-SeNBtoMeNBContainer CRITICALITY reject TYPE SeNBtoMeNBContainer PRESENCE mandatory}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}| + { ID id-GW-TransportLayerAddress CRITICALITY ignore TYPE TransportLayerAddress PRESENCE optional}| + { ID id-SIPTO-L-GW-TransportLayerAddress CRITICALITY ignore TYPE TransportLayerAddress PRESENCE optional}| + { ID id-MeNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-SeNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-Tunnel-Information-for-BBF CRITICALITY ignore TYPE TunnelInformation PRESENCE optional}, + ... +} + +E-RABs-Admitted-ToBeAdded-List ::= SEQUENCE (SIZE (1..maxnoofBearers)) OF ProtocolIE-Single-Container { {E-RABs-Admitted-ToBeAdded-ItemIEs} } + +E-RABs-Admitted-ToBeAdded-ItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-E-RABs-Admitted-ToBeAdded-Item CRITICALITY ignore TYPE E-RABs-Admitted-ToBeAdded-Item PRESENCE mandatory} +} + +E-RABs-Admitted-ToBeAdded-Item ::= CHOICE { + sCG-Bearer E-RABs-Admitted-ToBeAdded-Item-SCG-Bearer, + split-Bearer E-RABs-Admitted-ToBeAdded-Item-Split-Bearer, + ... +} + +E-RABs-Admitted-ToBeAdded-Item-SCG-Bearer ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + s1-DL-GTPtunnelEndpoint GTPtunnelEndpoint, + dL-Forwarding-GTPtunnelEndpoint GTPtunnelEndpoint OPTIONAL, + uL-Forwarding-GTPtunnelEndpoint GTPtunnelEndpoint OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {E-RABs-Admitted-ToBeAdded-Item-SCG-BearerExtIEs} } OPTIONAL, + ... +} + +E-RABs-Admitted-ToBeAdded-Item-SCG-BearerExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-RABs-Admitted-ToBeAdded-Item-Split-Bearer ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + seNB-GTPtunnelEndpoint GTPtunnelEndpoint, + iE-Extensions ProtocolExtensionContainer { {E-RABs-Admitted-ToBeAdded-Item-Split-BearerExtIEs} } OPTIONAL, + ... +} + +E-RABs-Admitted-ToBeAdded-Item-Split-BearerExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- ************************************************************** +-- +-- SENB ADDITION REQUEST REJECT +-- +-- ************************************************************** + +SeNBAdditionRequestReject ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{SeNBAdditionRequestReject-IEs}}, + ... +} + +SeNBAdditionRequestReject-IEs X2AP-PROTOCOL-IES ::= { + { ID id-MeNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-SeNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}| + { ID id-MeNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-SeNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- SENB RECONFIGURATION COMPLETE +-- +-- ************************************************************** + +SeNBReconfigurationComplete ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{SeNBReconfigurationComplete-IEs}}, + ... +} + +SeNBReconfigurationComplete-IEs X2AP-PROTOCOL-IES ::= { + { ID id-MeNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-SeNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-ResponseInformationSeNBReconfComp CRITICALITY ignore TYPE ResponseInformationSeNBReconfComp PRESENCE mandatory}| + { ID id-MeNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-SeNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}, + ... +} + +ResponseInformationSeNBReconfComp ::= CHOICE { + success ResponseInformationSeNBReconfComp-SuccessItem, + reject-by-MeNB ResponseInformationSeNBReconfComp-RejectByMeNBItem, + ... +} + +ResponseInformationSeNBReconfComp-SuccessItem ::= SEQUENCE { + meNBtoSeNBContainer MeNBtoSeNBContainer OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {ResponseInformationSeNBReconfComp-SuccessItemExtIEs} } OPTIONAL, + ... +} + +ResponseInformationSeNBReconfComp-SuccessItemExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +ResponseInformationSeNBReconfComp-RejectByMeNBItem ::= SEQUENCE { + cause Cause, + meNBtoSeNBContainer MeNBtoSeNBContainer OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { ResponseInformationSeNBReconfComp-RejectByMeNBItemExtIEs} } OPTIONAL, + ... +} + +ResponseInformationSeNBReconfComp-RejectByMeNBItemExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- ************************************************************** +-- +-- SENB MODIFICATION REQUEST +-- +-- ************************************************************** + +SeNBModificationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ SeNBModificationRequest-IEs}}, + ... +} + +SeNBModificationRequest-IEs X2AP-PROTOCOL-IES ::= { + { ID id-MeNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-SeNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}| + { ID id-SCGChangeIndication CRITICALITY ignore TYPE SCGChangeIndication PRESENCE optional}| + { ID id-ServingPLMN CRITICALITY ignore TYPE PLMN-Identity PRESENCE optional}| + { ID id-UE-ContextInformationSeNBModReq CRITICALITY reject TYPE UE-ContextInformationSeNBModReq PRESENCE optional}| + { ID id-MeNBtoSeNBContainer CRITICALITY ignore TYPE MeNBtoSeNBContainer PRESENCE optional}| + { ID id-CSGMembershipStatus CRITICALITY reject TYPE CSGMembershipStatus PRESENCE optional}| + { ID id-MeNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-SeNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}, + ... +} + +UE-ContextInformationSeNBModReq ::= SEQUENCE { + uE-SecurityCapabilities UESecurityCapabilities OPTIONAL, + seNB-SecurityKey SeNBSecurityKey OPTIONAL, + seNBUEAggregateMaximumBitRate UEAggregateMaximumBitRate OPTIONAL, + e-RABs-ToBeAdded E-RABs-ToBeAdded-List-ModReq OPTIONAL, + e-RABs-ToBeModified E-RABs-ToBeModified-List-ModReq OPTIONAL, + e-RABs-ToBeReleased E-RABs-ToBeReleased-List-ModReq OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { UE-ContextInformationSeNBModReqExtIEs} } OPTIONAL, + ... +} + +UE-ContextInformationSeNBModReqExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-RABs-ToBeAdded-List-ModReq ::= SEQUENCE (SIZE(1..maxnoofBearers)) OF ProtocolIE-Single-Container { {E-RABs-ToBeAdded-ModReqItemIEs} } + +E-RABs-ToBeAdded-ModReqItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-E-RABs-ToBeAdded-ModReqItem CRITICALITY ignore TYPE E-RABs-ToBeAdded-ModReqItem PRESENCE mandatory}, + ... +} + +E-RABs-ToBeAdded-ModReqItem ::= CHOICE { + sCG-Bearer E-RABs-ToBeAdded-ModReqItem-SCG-Bearer, + split-Bearer E-RABs-ToBeAdded-ModReqItem-Split-Bearer, + ... +} + +E-RABs-ToBeAdded-ModReqItem-SCG-Bearer ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + e-RAB-Level-QoS-Parameters E-RAB-Level-QoS-Parameters, + dL-Forwarding DL-Forwarding OPTIONAL, + s1-UL-GTPtunnelEndpoint GTPtunnelEndpoint, + iE-Extensions ProtocolExtensionContainer { {E-RABs-ToBeAdded-ModReqItem-SCG-BearerExtIEs} } OPTIONAL, + ... +} + +E-RABs-ToBeAdded-ModReqItem-SCG-BearerExtIEs X2AP-PROTOCOL-EXTENSION ::= { + { ID id-Correlation-ID CRITICALITY ignore EXTENSION Correlation-ID PRESENCE optional}| + { ID id-SIPTO-Correlation-ID CRITICALITY ignore EXTENSION Correlation-ID PRESENCE optional}, + ... +} + +E-RABs-ToBeAdded-ModReqItem-Split-Bearer ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + e-RAB-Level-QoS-Parameters E-RAB-Level-QoS-Parameters, + meNB-GTPtunnelEndpoint GTPtunnelEndpoint, + iE-Extensions ProtocolExtensionContainer { {E-RABs-ToBeAdded-ModReqItem-Split-BearerExtIEs} } OPTIONAL, + ... +} + +E-RABs-ToBeAdded-ModReqItem-Split-BearerExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-RABs-ToBeModified-List-ModReq ::= SEQUENCE (SIZE(1..maxnoofBearers)) OF ProtocolIE-Single-Container { {E-RABs-ToBeModified-ModReqItemIEs} } + +E-RABs-ToBeModified-ModReqItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-E-RABs-ToBeModified-ModReqItem CRITICALITY ignore TYPE E-RABs-ToBeModified-ModReqItem PRESENCE mandatory}, + ... +} + + +E-RABs-ToBeModified-ModReqItem ::= CHOICE { + sCG-Bearer E-RABs-ToBeModified-ModReqItem-SCG-Bearer, + split-Bearer E-RABs-ToBeModified-ModReqItem-Split-Bearer, + ... +} + +E-RABs-ToBeModified-ModReqItem-SCG-Bearer ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + e-RAB-Level-QoS-Parameters E-RAB-Level-QoS-Parameters OPTIONAL, + s1-UL-GTPtunnelEndpoint GTPtunnelEndpoint OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {E-RABs-ToBeModified-ModReqItem-SCG-BearerExtIEs} } OPTIONAL, + ... +} + +E-RABs-ToBeModified-ModReqItem-SCG-BearerExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-RABs-ToBeModified-ModReqItem-Split-Bearer ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + e-RAB-Level-QoS-Parameters E-RAB-Level-QoS-Parameters OPTIONAL, + meNB-GTPtunnelEndpoint GTPtunnelEndpoint OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {E-RABs-ToBeModified-ModReqItem-Split-BearerExtIEs} } OPTIONAL, + ... +} + +E-RABs-ToBeModified-ModReqItem-Split-BearerExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-RABs-ToBeReleased-List-ModReq ::= SEQUENCE (SIZE(1..maxnoofBearers)) OF ProtocolIE-Single-Container { {E-RABs-ToBeReleased-ModReqItemIEs} } + +E-RABs-ToBeReleased-ModReqItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-E-RABs-ToBeReleased-ModReqItem CRITICALITY ignore TYPE E-RABs-ToBeReleased-ModReqItem PRESENCE mandatory}, + ... +} + +E-RABs-ToBeReleased-ModReqItem ::= CHOICE { + sCG-Bearer E-RABs-ToBeReleased-ModReqItem-SCG-Bearer, + split-Bearer E-RABs-ToBeReleased-ModReqItem-Split-Bearer, + ... +} + +E-RABs-ToBeReleased-ModReqItem-SCG-Bearer ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + dL-GTPtunnelEndpoint GTPtunnelEndpoint OPTIONAL, + uL-GTPtunnelEndpoint GTPtunnelEndpoint OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {E-RABs-ToBeReleased-ModReqItem-SCG-BearerExtIEs} } OPTIONAL, + ... +} + +E-RABs-ToBeReleased-ModReqItem-SCG-BearerExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-RABs-ToBeReleased-ModReqItem-Split-Bearer ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + dL-GTPtunnelEndpoint GTPtunnelEndpoint OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {E-RABs-ToBeReleased-ModReqItem-Split-BearerExtIEs} } OPTIONAL, + ... +} + +E-RABs-ToBeReleased-ModReqItem-Split-BearerExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- ************************************************************** +-- +-- SENB MODIFICATION REQUEST ACKNOWLEDGE +-- +-- ************************************************************** + +SeNBModificationRequestAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{SeNBModificationRequestAcknowledge-IEs}}, + ... +} + +SeNBModificationRequestAcknowledge-IEs X2AP-PROTOCOL-IES ::= { + { ID id-MeNB-UE-X2AP-ID CRITICALITY ignore TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-SeNB-UE-X2AP-ID CRITICALITY ignore TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-E-RABs-Admitted-ToBeAdded-ModAckList CRITICALITY ignore TYPE E-RABs-Admitted-ToBeAdded-ModAckList PRESENCE optional}| + { ID id-E-RABs-Admitted-ToBeModified-ModAckList CRITICALITY ignore TYPE E-RABs-Admitted-ToBeModified-ModAckList PRESENCE optional}| + { ID id-E-RABs-Admitted-ToBeReleased-ModAckList CRITICALITY ignore TYPE E-RABs-Admitted-ToBeReleased-ModAckList PRESENCE optional}| + { ID id-E-RABs-NotAdmitted-List CRITICALITY ignore TYPE E-RAB-List PRESENCE optional}| + { ID id-SeNBtoMeNBContainer CRITICALITY ignore TYPE SeNBtoMeNBContainer PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}| + { ID id-MeNB-UE-X2AP-ID-Extension CRITICALITY ignore TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-SeNB-UE-X2AP-ID-Extension CRITICALITY ignore TYPE UE-X2AP-ID-Extension PRESENCE optional}, + ... +} + +E-RABs-Admitted-ToBeAdded-ModAckList ::= SEQUENCE (SIZE (1..maxnoofBearers)) OF ProtocolIE-Single-Container { {E-RABs-Admitted-ToBeAdded-ModAckItemIEs} } + +E-RABs-Admitted-ToBeAdded-ModAckItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-E-RABs-Admitted-ToBeAdded-ModAckItem CRITICALITY ignore TYPE E-RABs-Admitted-ToBeAdded-ModAckItem PRESENCE mandatory} +} + +E-RABs-Admitted-ToBeAdded-ModAckItem ::= CHOICE { + sCG-Bearer E-RABs-Admitted-ToBeAdded-ModAckItem-SCG-Bearer, + split-Bearer E-RABs-Admitted-ToBeAdded-ModAckItem-Split-Bearer, + ... +} + +E-RABs-Admitted-ToBeAdded-ModAckItem-SCG-Bearer ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + s1-DL-GTPtunnelEndpoint GTPtunnelEndpoint, + dL-Forwarding-GTPtunnelEndpoint GTPtunnelEndpoint OPTIONAL, + uL-Forwarding-GTPtunnelEndpoint GTPtunnelEndpoint OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {E-RABs-Admitted-ToBeAdded-ModAckItem-SCG-BearerExtIEs} } OPTIONAL, + ... +} + +E-RABs-Admitted-ToBeAdded-ModAckItem-SCG-BearerExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-RABs-Admitted-ToBeAdded-ModAckItem-Split-Bearer ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + seNB-GTPtunnelEndpoint GTPtunnelEndpoint, + iE-Extensions ProtocolExtensionContainer { {E-RABs-Admitted-ToBeAdded-ModAckItem-Split-BearerExtIEs} } OPTIONAL, + ... +} + +E-RABs-Admitted-ToBeAdded-ModAckItem-Split-BearerExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} +E-RABs-Admitted-ToBeModified-ModAckList ::= SEQUENCE (SIZE (1..maxnoofBearers)) OF ProtocolIE-Single-Container { {E-RABs-Admitted-ToBeModified-ModAckItemIEs} } + +E-RABs-Admitted-ToBeModified-ModAckItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-E-RABs-Admitted-ToBeModified-ModAckItem CRITICALITY ignore TYPE E-RABs-Admitted-ToBeModified-ModAckItem PRESENCE mandatory} +} + +E-RABs-Admitted-ToBeModified-ModAckItem ::= CHOICE { + sCG-Bearer E-RABs-Admitted-ToBeModified-ModAckItem-SCG-Bearer, + split-Bearer E-RABs-Admitted-ToBeModified-ModAckItem-Split-Bearer, + ... +} + +E-RABs-Admitted-ToBeModified-ModAckItem-SCG-Bearer ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + s1-DL-GTPtunnelEndpoint GTPtunnelEndpoint OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {E-RABs-Admitted-ToBeModified-ModAckItem-SCG-BearerExtIEs} } OPTIONAL, + ... +} + +E-RABs-Admitted-ToBeModified-ModAckItem-SCG-BearerExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-RABs-Admitted-ToBeModified-ModAckItem-Split-Bearer ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + seNB-GTPtunnelEndpoint GTPtunnelEndpoint OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {E-RABs-Admitted-ToBeModified-ModAckItem-Split-BearerExtIEs} } OPTIONAL, + ... +} + +E-RABs-Admitted-ToBeModified-ModAckItem-Split-BearerExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-RABs-Admitted-ToBeReleased-ModAckList ::= SEQUENCE (SIZE (1..maxnoofBearers)) OF ProtocolIE-Single-Container { {E-RABs-Admitted-ToBeReleased-ModAckItemIEs} } + +E-RABs-Admitted-ToBeReleased-ModAckItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-E-RABs-Admitted-ToBeReleased-ModAckItem CRITICALITY ignore TYPE E-RABs-Admitted-ToReleased-ModAckItem PRESENCE mandatory} +} + +E-RABs-Admitted-ToReleased-ModAckItem ::= CHOICE { + sCG-Bearer E-RABs-Admitted-ToBeReleased-ModAckItem-SCG-Bearer, + split-Bearer E-RABs-Admitted-ToBeReleased-ModAckItem-Split-Bearer, + ... +} + +E-RABs-Admitted-ToBeReleased-ModAckItem-SCG-Bearer ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + iE-Extensions ProtocolExtensionContainer { {E-RABs-Admitted-ToBeReleased-ModAckItem-SCG-BearerExtIEs} } OPTIONAL, + ... +} + +E-RABs-Admitted-ToBeReleased-ModAckItem-SCG-BearerExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-RABs-Admitted-ToBeReleased-ModAckItem-Split-Bearer ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + iE-Extensions ProtocolExtensionContainer { {E-RABs-Admitted-ToBeReleased-ModAckItem-Split-BearerExtIEs} } OPTIONAL, + ... +} + +E-RABs-Admitted-ToBeReleased-ModAckItem-Split-BearerExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- ************************************************************** +-- +-- SENB MODIFICATION REQUEST REJECT +-- +-- ************************************************************** + +SeNBModificationRequestReject ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{SeNBModificationRequestReject-IEs}}, + ... +} + +SeNBModificationRequestReject-IEs X2AP-PROTOCOL-IES ::= { + { ID id-MeNB-UE-X2AP-ID CRITICALITY ignore TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-SeNB-UE-X2AP-ID CRITICALITY ignore TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}| + { ID id-MeNB-UE-X2AP-ID-Extension CRITICALITY ignore TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-SeNB-UE-X2AP-ID-Extension CRITICALITY ignore TYPE UE-X2AP-ID-Extension PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- SENB MODIFICATION REQUIRED +-- +-- ************************************************************** + +SeNBModificationRequired ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{SeNBModificationRequired-IEs}}, + ... +} + +SeNBModificationRequired-IEs X2AP-PROTOCOL-IES ::= { + { ID id-MeNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-SeNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}| + { ID id-SCGChangeIndication CRITICALITY ignore TYPE SCGChangeIndication PRESENCE optional}| + { ID id-E-RABs-ToBeReleased-ModReqd CRITICALITY ignore TYPE E-RABs-ToBeReleased-ModReqd PRESENCE optional}| + { ID id-SeNBtoMeNBContainer CRITICALITY ignore TYPE SeNBtoMeNBContainer PRESENCE optional}| + { ID id-MeNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-SeNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}, + ... +} + + +E-RABs-ToBeReleased-ModReqd ::= SEQUENCE (SIZE (1..maxnoofBearers)) OF ProtocolIE-Single-Container { {E-RABs-ToBeReleased-ModReqdItemIEs} } + +E-RABs-ToBeReleased-ModReqdItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-E-RABs-ToBeReleased-ModReqdItem CRITICALITY ignore TYPE E-RABs-ToBeReleased-ModReqdItem PRESENCE mandatory }, + ... +} + +E-RABs-ToBeReleased-ModReqdItem ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + cause Cause, + iE-Extensions ProtocolExtensionContainer { {E-RABs-ToBeReleased-ModReqdItemExtIEs} } OPTIONAL, + ... +} + +E-RABs-ToBeReleased-ModReqdItemExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- ************************************************************** +-- +-- SENB MODIFICATION CONFIRM +-- +-- ************************************************************** + +SeNBModificationConfirm ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{SeNBModificationConfirm-IEs}}, + ... +} + +SeNBModificationConfirm-IEs X2AP-PROTOCOL-IES ::= { + { ID id-MeNB-UE-X2AP-ID CRITICALITY ignore TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-SeNB-UE-X2AP-ID CRITICALITY ignore TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-MeNBtoSeNBContainer CRITICALITY ignore TYPE MeNBtoSeNBContainer PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}| + { ID id-MeNB-UE-X2AP-ID-Extension CRITICALITY ignore TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-SeNB-UE-X2AP-ID-Extension CRITICALITY ignore TYPE UE-X2AP-ID-Extension PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- SENB MODIFICATION REFUSE +-- +-- ************************************************************** + +SeNBModificationRefuse ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{SeNBModificationRefuse-IEs}}, + ... +} + +SeNBModificationRefuse-IEs X2AP-PROTOCOL-IES ::= { + { ID id-MeNB-UE-X2AP-ID CRITICALITY ignore TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-SeNB-UE-X2AP-ID CRITICALITY ignore TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}| + { ID id-MeNBtoSeNBContainer CRITICALITY ignore TYPE MeNBtoSeNBContainer PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}| + { ID id-MeNB-UE-X2AP-ID-Extension CRITICALITY ignore TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-SeNB-UE-X2AP-ID-Extension CRITICALITY ignore TYPE UE-X2AP-ID-Extension PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- SENB RELEASE REQUEST +-- +-- ************************************************************** + +SeNBReleaseRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{SeNBReleaseRequest-IEs}}, + ... +} + +SeNBReleaseRequest-IEs X2AP-PROTOCOL-IES ::= { + { ID id-MeNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-SeNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE optional}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE optional}| + { ID id-E-RABs-ToBeReleased-List-RelReq CRITICALITY ignore TYPE E-RABs-ToBeReleased-List-RelReq PRESENCE optional}| + { ID id-UE-ContextKeptIndicator CRITICALITY ignore TYPE UE-ContextKeptIndicator PRESENCE optional}| + { ID id-MeNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-SeNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-MakeBeforeBreakIndicator CRITICALITY ignore TYPE MakeBeforeBreakIndicator PRESENCE optional}, + ... +} +E-RABs-ToBeReleased-List-RelReq ::= SEQUENCE (SIZE(1..maxnoofBearers)) OF ProtocolIE-Single-Container { {E-RABs-ToBeReleased-RelReqItemIEs} } + +E-RABs-ToBeReleased-RelReqItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-E-RABs-ToBeReleased-RelReqItem CRITICALITY ignore TYPE E-RABs-ToBeReleased-RelReqItem PRESENCE mandatory}, + ... +} + +E-RABs-ToBeReleased-RelReqItem ::= CHOICE { + sCG-Bearer E-RABs-ToBeReleased-RelReqItem-SCG-Bearer, + split-Bearer E-RABs-ToBeReleased-RelReqItem-Split-Bearer, + ... +} + +E-RABs-ToBeReleased-RelReqItem-SCG-Bearer ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + uL-GTPtunnelEndpoint GTPtunnelEndpoint OPTIONAL, + dL-GTPtunnelEndpoint GTPtunnelEndpoint OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {E-RABs-ToBeReleased-RelReqItem-SCG-BearerExtIEs} } OPTIONAL, + ... +} + +E-RABs-ToBeReleased-RelReqItem-SCG-BearerExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-RABs-ToBeReleased-RelReqItem-Split-Bearer ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + dL-GTPtunnelEndpoint GTPtunnelEndpoint OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {E-RABs-ToBeReleased-RelReqItem-Split-BearerExtIEs} } OPTIONAL, + ... +} + +E-RABs-ToBeReleased-RelReqItem-Split-BearerExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- ************************************************************** +-- +-- SENB RELEASE REQUIRED +-- +-- ************************************************************** + +SeNBReleaseRequired ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{SeNBReleaseRequired-IEs}}, + ... +} + +SeNBReleaseRequired-IEs X2AP-PROTOCOL-IES ::= { + { ID id-MeNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-SeNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}| + { ID id-MeNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-SeNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- SENB RELEASE CONFIRM +-- +-- ************************************************************** + +SeNBReleaseConfirm ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{SeNBReleaseConfirm-IEs}}, + ... +} + +SeNBReleaseConfirm-IEs X2AP-PROTOCOL-IES ::= { + { ID id-MeNB-UE-X2AP-ID CRITICALITY ignore TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-SeNB-UE-X2AP-ID CRITICALITY ignore TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-E-RABs-ToBeReleased-List-RelConf CRITICALITY ignore TYPE E-RABs-ToBeReleased-List-RelConf PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}| + { ID id-MeNB-UE-X2AP-ID-Extension CRITICALITY ignore TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-SeNB-UE-X2AP-ID-Extension CRITICALITY ignore TYPE UE-X2AP-ID-Extension PRESENCE optional}, + ... +} +E-RABs-ToBeReleased-List-RelConf ::= SEQUENCE (SIZE(1..maxnoofBearers)) OF ProtocolIE-Single-Container { {E-RABs-ToBeReleased-RelConfItemIEs} } + +E-RABs-ToBeReleased-RelConfItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-E-RABs-ToBeReleased-RelConfItem CRITICALITY ignore TYPE E-RABs-ToBeReleased-RelConfItem PRESENCE mandatory}, + ... +} + +E-RABs-ToBeReleased-RelConfItem ::= CHOICE { + sCG-Bearer E-RABs-ToBeReleased-RelConfItem-SCG-Bearer, + split-Bearer E-RABs-ToBeReleased-RelConfItem-Split-Bearer, + ... +} + +E-RABs-ToBeReleased-RelConfItem-SCG-Bearer ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + uL-GTPtunnelEndpoint GTPtunnelEndpoint OPTIONAL, + dL-GTPtunnelEndpoint GTPtunnelEndpoint OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {E-RABs-ToBeReleased-RelConfItem-SCG-BearerExtIEs} } OPTIONAL, + ... +} + +E-RABs-ToBeReleased-RelConfItem-SCG-BearerExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-RABs-ToBeReleased-RelConfItem-Split-Bearer ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + dL-GTPtunnelEndpoint GTPtunnelEndpoint OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {E-RABs-ToBeReleased-RelConfItem-Split-BearerExtIEs} } OPTIONAL, + ... +} + +E-RABs-ToBeReleased-RelConfItem-Split-BearerExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- ************************************************************** +-- +-- SENB COUNTER CHECK REQUEST +-- +-- ************************************************************** + +SeNBCounterCheckRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{SeNBCounterCheckRequest-IEs}}, + ... +} + +SeNBCounterCheckRequest-IEs X2AP-PROTOCOL-IES ::= { + { ID id-MeNB-UE-X2AP-ID CRITICALITY ignore TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-SeNB-UE-X2AP-ID CRITICALITY ignore TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-E-RABs-SubjectToCounterCheck-List CRITICALITY ignore TYPE E-RABs-SubjectToCounterCheck-List PRESENCE mandatory}| + { ID id-MeNB-UE-X2AP-ID-Extension CRITICALITY ignore TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-SeNB-UE-X2AP-ID-Extension CRITICALITY ignore TYPE UE-X2AP-ID-Extension PRESENCE optional}, + ... +} +E-RABs-SubjectToCounterCheck-List ::= SEQUENCE (SIZE(1..maxnoofBearers)) OF ProtocolIE-Single-Container { {E-RABs-SubjectToCounterCheckItemIEs} } + +E-RABs-SubjectToCounterCheckItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-E-RABs-SubjectToCounterCheckItem CRITICALITY ignore TYPE E-RABs-SubjectToCounterCheckItem PRESENCE mandatory}, + ... +} + +E-RABs-SubjectToCounterCheckItem ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + uL-Count INTEGER (0..4294967295), + dL-Count INTEGER (0..4294967295), + iE-Extensions ProtocolExtensionContainer { {E-RABs-SubjectToCounterCheckItemExtIEs} } OPTIONAL, + ... +} + +E-RABs-SubjectToCounterCheckItemExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- ************************************************************** +-- +-- X2 REMOVAL REQUEST +-- +-- ************************************************************** + +X2RemovalRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{X2RemovalRequest-IEs}}, + ... +} + +X2RemovalRequest-IEs X2AP-PROTOCOL-IES ::= { + { ID id-GlobalENB-ID CRITICALITY reject TYPE GlobalENB-ID PRESENCE mandatory}| + { ID id-X2RemovalThreshold CRITICALITY reject TYPE X2BenefitValue PRESENCE optional}, +... +} + + + +-- ************************************************************** +-- +-- X2 REMOVAL RESPONSE +-- +-- ************************************************************** + +X2RemovalResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{X2RemovalResponse-IEs}}, + ... +} + +X2RemovalResponse-IEs X2AP-PROTOCOL-IES ::= { + { ID id-GlobalENB-ID CRITICALITY reject TYPE GlobalENB-ID PRESENCE mandatory}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + + + +-- ************************************************************** +-- +-- X2 REMOVAL FAILURE +-- +-- ************************************************************** + +X2RemovalFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{X2RemovalFailure-IEs}}, + ... +} + +X2RemovalFailure-IEs X2AP-PROTOCOL-IES ::= { + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- RETRIEVE UE CONTEXT REQUEST +-- +-- ************************************************************** + +RetrieveUEContextRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ RetrieveUEContextRequest-IEs}}, + ... +} + +RetrieveUEContextRequest-IEs X2AP-PROTOCOL-IES ::= { + { ID id-New-eNB-UE-X2AP-ID CRITICALITY reject TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-SeNB-UE-X2AP-ID-Extension CRITICALITY reject TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-resumeID CRITICALITY reject TYPE ResumeID PRESENCE mandatory}| + { ID id-ShortMAC-I CRITICALITY reject TYPE ShortMAC-I PRESENCE mandatory}| + { ID id-NewEUTRANCellIdentifier CRITICALITY reject TYPE EUTRANCellIdentifier PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- RETRIEVE UE CONTEXT RESPONSE +-- +-- ************************************************************** + +RetrieveUEContextResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ RetrieveUEContextResponse-IEs}}, + ... +} + +RetrieveUEContextResponse-IEs X2AP-PROTOCOL-IES ::= { + { ID id-New-eNB-UE-X2AP-ID CRITICALITY ignore TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-New-eNB-UE-X2AP-ID-Extension CRITICALITY ignore TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-Old-eNB-UE-X2AP-ID CRITICALITY ignore TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-Old-eNB-UE-X2AP-ID-Extension CRITICALITY ignore TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-GUMMEI-ID CRITICALITY reject TYPE GUMMEI PRESENCE mandatory}| + { ID id-UE-ContextInformationRetrieve CRITICALITY reject TYPE UE-ContextInformationRetrieve PRESENCE mandatory}| + { ID id-TraceActivation CRITICALITY ignore TYPE TraceActivation PRESENCE optional}| + { ID id-SRVCCOperationPossible CRITICALITY ignore TYPE SRVCCOperationPossible PRESENCE optional}| + { ID id-Masked-IMEISV CRITICALITY ignore TYPE Masked-IMEISV PRESENCE optional}| + { ID id-ExpectedUEBehaviour CRITICALITY ignore TYPE ExpectedUEBehaviour PRESENCE optional}| + { ID id-ProSeAuthorized CRITICALITY ignore TYPE ProSeAuthorized PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}| + { ID id-V2XServicesAuthorized CRITICALITY ignore TYPE V2XServicesAuthorized PRESENCE optional}, + ... +} + +UE-ContextInformationRetrieve ::= SEQUENCE { + mME-UE-S1AP-ID UE-S1AP-ID, + uESecurityCapabilities UESecurityCapabilities, + aS-SecurityInformation AS-SecurityInformation, + uEaggregateMaximumBitRate UEAggregateMaximumBitRate, + subscriberProfileIDforRFP SubscriberProfileIDforRFP OPTIONAL, + e-RABs-ToBeSetup-ListRetrieve E-RABs-ToBeSetup-ListRetrieve, + rRC-Context RRC-Context, + handoverRestrictionList HandoverRestrictionList OPTIONAL, + locationReportingInformation LocationReportingInformation OPTIONAL, + managBasedMDTallowed ManagementBasedMDTallowed OPTIONAL, + managBasedMDTPLMNList MDTPLMNList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {UE-ContextInformationRetrieve-ExtIEs} } OPTIONAL, + ... +} + +UE-ContextInformationRetrieve-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { +{ ID id-UESidelinkAggregateMaximumBitRate CRITICALITY ignore EXTENSION UESidelinkAggregateMaximumBitRate PRESENCE optional}, + ... +} + +E-RABs-ToBeSetup-ListRetrieve ::= SEQUENCE (SIZE(1..maxnoofBearers)) OF ProtocolIE-Single-Container { {E-RABs-ToBeSetupRetrieve-ItemIEs} } + +E-RABs-ToBeSetupRetrieve-ItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-E-RABs-ToBeSetupRetrieve-Item CRITICALITY ignore TYPE E-RABs-ToBeSetupRetrieve-Item PRESENCE mandatory}, + ... +} + +E-RABs-ToBeSetupRetrieve-Item ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + e-RAB-Level-QoS-Parameters E-RAB-Level-QoS-Parameters, + bearerType BearerType OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {E-RABs-ToBeSetupRetrieve-ItemExtIEs} } OPTIONAL, + ... +} + +E-RABs-ToBeSetupRetrieve-ItemExtIEs X2AP-PROTOCOL-EXTENSION ::= { + { ID id-uL-GTPtunnelEndpoint CRITICALITY reject EXTENSION GTPtunnelEndpoint PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- RETRIEVE UE CONTEXT FAILURE +-- +-- ************************************************************** + +RetrieveUEContextFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ RetrieveUEContextFailure-IEs}}, + ... +} + +RetrieveUEContextFailure-IEs X2AP-PROTOCOL-IES ::= { + { ID id-New-eNB-UE-X2AP-ID CRITICALITY ignore TYPE UE-X2AP-ID PRESENCE mandatory}| + { ID id-New-eNB-UE-X2AP-ID-Extension CRITICALITY ignore TYPE UE-X2AP-ID-Extension PRESENCE optional}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + +END + + +-- ************************************************************** +-- +-- Information Element Definitions +-- +-- ************************************************************** + +X2AP-IEs { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +eps-Access (21) modules (3) x2ap (2) version1 (1) x2ap-IEs (2) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +IMPORTS + + id-E-RAB-Item, + id-Number-of-Antennaports, + id-MBSFN-Subframe-Info, + id-PRACH-Configuration, + id-CSG-Id, + id-MDTConfiguration, + id-SignallingBasedMDTPLMNList, + id-MultibandInfoList, + id-FreqBandIndicatorPriority, + id-NeighbourTAC, + id-Time-UE-StayedInCell-EnhancedGranularity, + id-MBMS-Service-Area-List, + id-HO-cause, + id-eARFCNExtension, + id-DL-EARFCNExtension, + id-UL-EARFCNExtension, + id-M3Configuration, + id-M4Configuration, + id-M5Configuration, + id-MDT-Location-Info, + id-AdditionalSpecialSubframe-Info, + id-UEID, + id-enhancedRNTP, + id-ProSeUEtoNetworkRelaying, + id-M6Configuration, + id-M7Configuration, + id-OffsetOfNbiotChannelNumberToDL-EARFCN, + id-OffsetOfNbiotChannelNumberToUL-EARFCN, + id-AdditionalSpecialSubframeExtension-Info, + id-BandwidthReducedSI, + id-DL-scheduling-PDCCH-CCE-usage, + id-UL-scheduling-PDCCH-CCE-usage, + maxnoofBearers, + maxCellineNB, + maxEARFCN, + maxEARFCNPlusOne, + newmaxEARFCN, + maxInterfaces, + + maxnoofBands, + maxnoofBPLMNs, + maxnoofCells, + maxnoofEPLMNs, + maxnoofEPLMNsPlusOne, + maxnoofForbLACs, + maxnoofForbTACs, + maxnoofNeighbours, + maxnoofPRBs, + maxNrOfErrors, + maxPools, + maxnoofMBSFN, + maxnoofTAforMDT, + maxnoofCellIDforMDT, + maxnoofMBMSServiceAreaIdentities, + maxnoofMDTPLMNs, + maxnoofCoMPHypothesisSet, + maxnoofCoMPCells, + maxUEReport, + maxCellReport, + maxnoofPA, + maxCSIProcess, + maxCSIReport, + maxSubband + +FROM X2AP-Constants + + Criticality, + ProcedureCode, + ProtocolIE-ID, + TriggeringMessage +FROM X2AP-CommonDataTypes + + ProtocolExtensionContainer{}, + ProtocolIE-Single-Container{}, + + X2AP-PROTOCOL-EXTENSION, + X2AP-PROTOCOL-IES +FROM X2AP-Containers; + +-- A + +ABSInformation ::= CHOICE { + fdd ABSInformationFDD, + tdd ABSInformationTDD, + abs-inactive NULL, + ... +} + +ABSInformationFDD ::= SEQUENCE { + abs-pattern-info BIT STRING (SIZE(40)), + numberOfCellSpecificAntennaPorts ENUMERATED {one, two, four, ...}, + measurement-subset BIT STRING (SIZE(40)), + iE-Extensions ProtocolExtensionContainer { { ABSInformationFDD-ExtIEs} } OPTIONAL, + ... +} + +ABSInformationFDD-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +ABSInformationTDD ::= SEQUENCE { + abs-pattern-info BIT STRING (SIZE(1..70, ...)), + numberOfCellSpecificAntennaPorts ENUMERATED {one, two, four, ...}, + measurement-subset BIT STRING (SIZE(1..70, ...)), + iE-Extensions ProtocolExtensionContainer { { ABSInformationTDD-ExtIEs} } OPTIONAL, + ... +} + +ABSInformationTDD-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +ABS-Status ::= SEQUENCE { + dL-ABS-status DL-ABS-status, + usableABSInformation UsableABSInformation, + iE-Extensions ProtocolExtensionContainer { {ABS-Status-ExtIEs} } OPTIONAL, + ... +} + +ABS-Status-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +AdditionalSpecialSubframe-Info ::= SEQUENCE { + additionalspecialSubframePatterns AdditionalSpecialSubframePatterns, + cyclicPrefixDL CyclicPrefixDL, + cyclicPrefixUL CyclicPrefixUL, + iE-Extensions ProtocolExtensionContainer { { AdditionalSpecialSubframe-Info-ExtIEs} } OPTIONAL, + ... +} + +AdditionalSpecialSubframe-Info-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +AdditionalSpecialSubframePatterns ::= ENUMERATED { + ssp0, + ssp1, + ssp2, + ssp3, + ssp4, + ssp5, + ssp6, + ssp7, + ssp8, + ssp9, + ... +} + +AdditionalSpecialSubframeExtension-Info ::= SEQUENCE { + additionalspecialSubframePatternsExtension AdditionalSpecialSubframePatternsExtension, + cyclicPrefixDL CyclicPrefixDL, + cyclicPrefixUL CyclicPrefixUL, + iE-Extensions ProtocolExtensionContainer { { AdditionalSpecialSubframeExtension-Info-ExtIEs} } OPTIONAL, + ... +} + +AdditionalSpecialSubframeExtension-Info-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +AdditionalSpecialSubframePatternsExtension ::= ENUMERATED { + ssp10, + ... +} + +AllocationAndRetentionPriority ::= SEQUENCE { + priorityLevel PriorityLevel, + pre-emptionCapability Pre-emptionCapability, + pre-emptionVulnerability Pre-emptionVulnerability, + iE-Extensions ProtocolExtensionContainer { {AllocationAndRetentionPriority-ExtIEs} } OPTIONAL, + ... +} + +AllocationAndRetentionPriority-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +AreaScopeOfMDT ::= CHOICE { + cellBased CellBasedMDT, + tABased TABasedMDT, + pLMNWide NULL, + ..., + tAIBased TAIBasedMDT +} + +AS-SecurityInformation ::= SEQUENCE { + key-eNodeB-star Key-eNodeB-Star, + nextHopChainingCount NextHopChainingCount, + iE-Extensions ProtocolExtensionContainer { { AS-SecurityInformation-ExtIEs} } OPTIONAL, + ... +} + +AS-SecurityInformation-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + + +-- B + +BandwidthReducedSI::= ENUMERATED { + scheduled, + ... +} + +BearerType ::= ENUMERATED { + non-IP, + ... +} + +BenefitMetric ::= INTEGER (-101..100, ...) + +BitRate ::= INTEGER (0..10000000000) +BroadcastPLMNs-Item ::= SEQUENCE (SIZE(1..maxnoofBPLMNs)) OF PLMN-Identity + + +-- C + +CapacityValue ::= INTEGER (0..100) + +Cause ::= CHOICE { + radioNetwork CauseRadioNetwork, + transport CauseTransport, + protocol CauseProtocol, + misc CauseMisc, + ... +} + +CauseMisc ::= ENUMERATED { + control-processing-overload, + hardware-failure, + om-intervention, + not-enough-user-plane-processing-resources, + unspecified, + ... +} + +CauseProtocol ::= ENUMERATED { + transfer-syntax-error, + abstract-syntax-error-reject, + abstract-syntax-error-ignore-and-notify, + message-not-compatible-with-receiver-state, + semantic-error, + unspecified, + abstract-syntax-error-falsely-constructed-message, + ... +} + +CauseRadioNetwork ::= ENUMERATED { + handover-desirable-for-radio-reasons, + time-critical-handover, + resource-optimisation-handover, + reduce-load-in-serving-cell, + partial-handover, + unknown-new-eNB-UE-X2AP-ID, + unknown-old-eNB-UE-X2AP-ID, + unknown-pair-of-UE-X2AP-ID, + ho-target-not-allowed, + tx2relocoverall-expiry, + trelocprep-expiry, + cell-not-available, + no-radio-resources-available-in-target-cell, + invalid-MME-GroupID, + unknown-MME-Code, + encryption-and-or-integrity-protection-algorithms-not-supported, + reportCharacteristicsEmpty, + noReportPeriodicity, + existingMeasurementID, + unknown-eNB-Measurement-ID, + measurement-temporarily-not-available, + unspecified, + ..., + load-balancing, + handover-optimisation, + value-out-of-allowed-range, + multiple-E-RAB-ID-instances, + switch-off-ongoing, + not-supported-QCI-value, + measurement-not-supported-for-the-object, + tDCoverall-expiry, + tDCprep-expiry, + action-desirable-for-radio-reasons, + reduce-load, + resource-optimisation, + time-critical-action, + target-not-allowed, + no-radio-resources-available, + invalid-QoS-combination, + encryption-algorithms-not-aupported, + procedure-cancelled, + rRM-purpose, + improve-user-bit-rate, + user-inactivity, + radio-connection-with-UE-lost, + failure-in-the-radio-interface-procedure, + bearer-option-not-supported + +} + +CauseTransport ::= ENUMERATED { + transport-resource-unavailable, + unspecified, + ... +} + +CellBasedMDT::= SEQUENCE { + cellIdListforMDT CellIdListforMDT, + iE-Extensions ProtocolExtensionContainer { {CellBasedMDT-ExtIEs} } OPTIONAL, + ... +} + +CellBasedMDT-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +CellCapacityClassValue ::= INTEGER (1..100, ...) + +CellDeploymentStatusIndicator ::= ENUMERATED {pre-change-notification, ...} + +CellIdListforMDT ::= SEQUENCE (SIZE(1..maxnoofCellIDforMDT)) OF ECGI + +CellReplacingInfo ::= SEQUENCE { + replacingCellsList ReplacingCellsList, + iE-Extensions ProtocolExtensionContainer { { CellReplacingInfo-ExtIEs}} OPTIONAL, + ... +} + +CellReplacingInfo-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +CellReportingIndicator ::= ENUMERATED {stop-request, ... } + +Cell-Size ::= ENUMERATED {verysmall, small, medium, large, ... } + + +CellType ::= SEQUENCE { + cell-Size Cell-Size, + iE-Extensions ProtocolExtensionContainer { { CellType-ExtIEs}} OPTIONAL, + ... +} + +CellType-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +CoMPHypothesisSet ::= SEQUENCE (SIZE(1..maxnoofCoMPCells)) OF CoMPHypothesisSetItem + +CoMPHypothesisSetItem ::= SEQUENCE { + coMPCellID ECGI, + coMPHypothesis BIT STRING (SIZE(6..4400, ...)), + iE-Extensions ProtocolExtensionContainer { { CoMPHypothesisSetItem-ExtIEs} } OPTIONAL, + ... +} + +CoMPHypothesisSetItem-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +CoMPInformation ::= SEQUENCE { + coMPInformationItem CoMPInformationItem, + coMPInformationStartTime CoMPInformationStartTime, + iE-Extensions ProtocolExtensionContainer { { CoMPInformation-ExtIEs} } OPTIONAL, + ... +} + +CoMPInformation-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +CoMPInformationItem ::= SEQUENCE (SIZE(1..maxnoofCoMPHypothesisSet)) OF + SEQUENCE { + coMPHypothesisSet CoMPHypothesisSet, + benefitMetric BenefitMetric, + iE-Extensions ProtocolExtensionContainer { { CoMPInformationItem-ExtIEs} } OPTIONAL, + ... + } + +CoMPInformationItem-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +CoMPInformationStartTime ::= SEQUENCE (SIZE(0..1)) OF + SEQUENCE { + startSFN INTEGER (0..1023, ...), + startSubframeNumber INTEGER (0..9, ...), + iE-Extensions ProtocolExtensionContainer { { CoMPInformationStartTime-ExtIEs} } OPTIONAL, + ... + } + +CoMPInformationStartTime-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +CompositeAvailableCapacity ::= SEQUENCE { + cellCapacityClassValue CellCapacityClassValue OPTIONAL, + capacityValue CapacityValue, + iE-Extensions ProtocolExtensionContainer { { CompositeAvailableCapacity-ExtIEs} } OPTIONAL, + ... +} + +CompositeAvailableCapacity-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +CompositeAvailableCapacityGroup ::= SEQUENCE { + dL-CompositeAvailableCapacity CompositeAvailableCapacity, + uL-CompositeAvailableCapacity CompositeAvailableCapacity, + iE-Extensions ProtocolExtensionContainer { { CompositeAvailableCapacityGroup-ExtIEs} } OPTIONAL, + ... +} + +CompositeAvailableCapacityGroup-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +Correlation-ID ::= OCTET STRING (SIZE (4)) + +COUNTvalue ::= SEQUENCE { + pDCP-SN PDCP-SN, + hFN HFN, + iE-Extensions ProtocolExtensionContainer { { COUNTvalue-ExtIEs} } OPTIONAL, + ... +} + +COUNTvalue-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +COUNTValueExtended ::= SEQUENCE { + pDCP-SNExtended PDCP-SNExtended, + hFNModified HFNModified, + iE-Extensions ProtocolExtensionContainer { { COUNTValueExtended-ExtIEs} } OPTIONAL, + ... +} + +COUNTValueExtended-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +COUNTvaluePDCP-SNlength18 ::= SEQUENCE { + pDCP-SNlength18 PDCP-SNlength18, + hFNforPDCP-SNlength18 HFNforPDCP-SNlength18, + iE-Extensions ProtocolExtensionContainer { { COUNTvaluePDCP-SNlength18-ExtIEs} } OPTIONAL, + ... +} + +COUNTvaluePDCP-SNlength18-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +CoverageModificationList ::= SEQUENCE (SIZE (1..maxCellineNB)) OF CoverageModification-Item + +CoverageModification-Item ::= SEQUENCE { + eCGI ECGI, + coverageState INTEGER (0..15, ...), + cellDeploymentStatusIndicator CellDeploymentStatusIndicator OPTIONAL, + cellReplacingInfo CellReplacingInfo OPTIONAL, +-- Included in case the Cell Deployment Status Indicator IE is present + ... +} + +CriticalityDiagnostics ::= SEQUENCE { + procedureCode ProcedureCode OPTIONAL, + triggeringMessage TriggeringMessage OPTIONAL, + procedureCriticality Criticality OPTIONAL, + iEsCriticalityDiagnostics CriticalityDiagnostics-IE-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {CriticalityDiagnostics-ExtIEs} } OPTIONAL, + ... +} + + +CriticalityDiagnostics-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +CriticalityDiagnostics-IE-List ::= SEQUENCE (SIZE (1..maxNrOfErrors)) OF + SEQUENCE { + iECriticality Criticality, + iE-ID ProtocolIE-ID, + typeOfError TypeOfError, + iE-Extensions ProtocolExtensionContainer { {CriticalityDiagnostics-IE-List-ExtIEs} } OPTIONAL, + ... +} + +CriticalityDiagnostics-IE-List-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +CRNTI ::= BIT STRING (SIZE (16)) + +CSGMembershipStatus ::= ENUMERATED { + member, + not-member +} + +CSG-Id ::= BIT STRING (SIZE (27)) + +CSIReportList ::= SEQUENCE (SIZE(1..maxUEReport)) OF + SEQUENCE { + uEID UEID, + cSIReportPerCSIProcess CSIReportPerCSIProcess, + iE-Extensions ProtocolExtensionContainer { { CSIReportList-ExtIEs} } OPTIONAL, + ... + } + +CSIReportList-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +CSIReportPerCSIProcess ::= SEQUENCE (SIZE(1.. maxCSIProcess)) OF + SEQUENCE { + cSIProcessConfigurationIndex INTEGER (1..7, ...), + cSIReportPerCSIProcessItem CSIReportPerCSIProcessItem, + iE-Extensions ProtocolExtensionContainer { { CSIReportPerCSIProcess-ExtIEs} } OPTIONAL, + ... + } + +CSIReportPerCSIProcess-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +CSIReportPerCSIProcessItem ::= SEQUENCE (SIZE(1.. maxCSIReport)) OF + SEQUENCE { + rI INTEGER (1..8, ...), + widebandCQI WidebandCQI, + subbandSize SubbandSize, + subbandCQIList SubbandCQIList OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { CSIReportPerCSIProcessItem-ExtIEs} } OPTIONAL, + ... + } + +CSIReportPerCSIProcessItem-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +CyclicPrefixDL ::= ENUMERATED { + normal, + extended, + ... +} + +CyclicPrefixUL ::= ENUMERATED { + normal, + extended, + ... +} + + +-- D + +DeactivationIndication::= ENUMERATED { + deactivated, + ... +} + +DL-ABS-status::= INTEGER (0..100) + +DL-Forwarding ::= ENUMERATED { + dL-forwardingProposed, + ... +} + +DL-GBR-PRB-usage::= INTEGER (0..100) + +DL-non-GBR-PRB-usage::= INTEGER (0..100) + +DL-scheduling-PDCCH-CCE-usage::= INTEGER (0..100) + +DL-Total-PRB-usage::= INTEGER (0..100) + +DynamicDLTransmissionInformation ::= CHOICE { + naics-active DynamicNAICSInformation, + naics-inactive NULL, + ... +} + +DynamicNAICSInformation ::= SEQUENCE { + transmissionModes BIT STRING (SIZE(8)) OPTIONAL, + pB-information INTEGER(0..3) OPTIONAL, + pA-list SEQUENCE (SIZE(0..maxnoofPA)) OF PA-Values, + iE-Extensions ProtocolExtensionContainer { {DynamicNAICSInformation-ExtIEs} } OPTIONAL, + ... +} + +DynamicNAICSInformation-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- E + +EARFCN ::= INTEGER (0..maxEARFCN) + +EARFCNExtension ::= INTEGER(maxEARFCNPlusOne..newmaxEARFCN, ...) + +ECGI ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + eUTRANcellIdentifier EUTRANCellIdentifier, + iE-Extensions ProtocolExtensionContainer { {ECGI-ExtIEs} } OPTIONAL, + ... +} + +ECGI-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +EnhancedRNTP ::= SEQUENCE { + enhancedRNTPBitmap BIT STRING (SIZE(12..8800, ...)), + rNTP-High-Power-Threshold RNTP-Threshold, + enhancedRNTPStartTime EnhancedRNTPStartTime OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { EnhancedRNTP-ExtIEs} } OPTIONAL, + ... +} + +EnhancedRNTP-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +EnhancedRNTPStartTime ::= SEQUENCE { + startSFN INTEGER (0..1023, ...), + startSubframeNumber INTEGER (0..9, ...), + iE-Extensions ProtocolExtensionContainer { { EnhancedRNTPStartTime-ExtIEs} } OPTIONAL, + ... + } + +EnhancedRNTPStartTime-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +ENB-ID ::= CHOICE { + macro-eNB-ID BIT STRING (SIZE (20)), + home-eNB-ID BIT STRING (SIZE (28)), + ... , + short-Macro-eNB-ID BIT STRING (SIZE(18)), + long-Macro-eNB-ID BIT STRING (SIZE(21)) +} + +EncryptionAlgorithms ::= BIT STRING (SIZE (16, ...)) + +EPLMNs ::= SEQUENCE (SIZE(1..maxnoofEPLMNs)) OF PLMN-Identity + +E-RAB-ID ::= INTEGER (0..15, ...) + +E-RAB-Level-QoS-Parameters ::= SEQUENCE { + qCI QCI, + allocationAndRetentionPriority AllocationAndRetentionPriority, + gbrQosInformation GBR-QosInformation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { E-RAB-Level-QoS-Parameters-ExtIEs} } OPTIONAL, + ... +} + +E-RAB-Level-QoS-Parameters-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-RAB-List ::= SEQUENCE (SIZE(1.. maxnoofBearers)) OF ProtocolIE-Single-Container { {E-RAB-ItemIEs} } + +E-RAB-ItemIEs X2AP-PROTOCOL-IES ::= { + { ID id-E-RAB-Item CRITICALITY ignore TYPE E-RAB-Item PRESENCE mandatory }, + ... +} + +E-RAB-Item ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + cause Cause, + iE-Extensions ProtocolExtensionContainer { {E-RAB-Item-ExtIEs} } OPTIONAL, + ... +} + +E-RAB-Item-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +EUTRA-Mode-Info ::= CHOICE { + fDD FDD-Info, + tDD TDD-Info, + ... +} + +EUTRANCellIdentifier ::= BIT STRING (SIZE (28)) + +EUTRANTraceID ::= OCTET STRING (SIZE (8)) + +EventType ::= ENUMERATED{ + change-of-serving-cell, + ... +} + +ExpectedUEBehaviour ::= SEQUENCE { + expectedActivity ExpectedUEActivityBehaviour OPTIONAL, + expectedHOInterval ExpectedHOInterval OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { ExpectedUEBehaviour-ExtIEs} } OPTIONAL, + ... +} + +ExpectedUEBehaviour-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +ExpectedUEActivityBehaviour ::= SEQUENCE { + expectedActivityPeriod ExpectedActivityPeriod OPTIONAL, + expectedIdlePeriod ExpectedIdlePeriod OPTIONAL, + sourceofUEActivityBehaviourInformation SourceOfUEActivityBehaviourInformation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { ExpectedUEActivityBehaviour-ExtIEs} } OPTIONAL, + ... +} + +ExpectedUEActivityBehaviour-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +ExpectedActivityPeriod ::= INTEGER (1..30|40|50|60|80|100|120|150|180|181,...) + +ExpectedIdlePeriod ::= INTEGER (1..30|40|50|60|80|100|120|150|180|181,...) + +ExpectedHOInterval ::= ENUMERATED { + sec15, sec30, sec60, sec90, sec120, sec180, long-time, + ... +} + +ExtendedULInterferenceOverloadInfo ::= SEQUENCE { + associatedSubframes BIT STRING (SIZE (5)), + extended-ul-InterferenceOverloadIndication UL-InterferenceOverloadIndication, + iE-Extensions ProtocolExtensionContainer { { ExtendedULInterferenceOverloadInfo-ExtIEs} } OPTIONAL, + ... +} + +ExtendedULInterferenceOverloadInfo-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- F + +FDD-Info ::= SEQUENCE { + uL-EARFCN EARFCN, + dL-EARFCN EARFCN, + uL-Transmission-Bandwidth Transmission-Bandwidth, + dL-Transmission-Bandwidth Transmission-Bandwidth, + iE-Extensions ProtocolExtensionContainer { {FDD-Info-ExtIEs} } OPTIONAL, + ... +} + +FDD-Info-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + { ID id-UL-EARFCNExtension CRITICALITY reject EXTENSION EARFCNExtension PRESENCE optional}| + { ID id-DL-EARFCNExtension CRITICALITY reject EXTENSION EARFCNExtension PRESENCE optional}| + { ID id-OffsetOfNbiotChannelNumberToDL-EARFCN CRITICALITY reject EXTENSION OffsetOfNbiotChannelNumberToEARFCN PRESENCE optional}| + { ID id-OffsetOfNbiotChannelNumberToUL-EARFCN CRITICALITY reject EXTENSION OffsetOfNbiotChannelNumberToEARFCN PRESENCE optional}, + ... +} + +ForbiddenInterRATs ::= ENUMERATED { + all, + geran, + utran, + cdma2000, + ..., + geranandutran, + cdma2000andutran + +} + +ForbiddenTAs ::= SEQUENCE (SIZE(1.. maxnoofEPLMNsPlusOne)) OF ForbiddenTAs-Item + +ForbiddenTAs-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + forbiddenTACs ForbiddenTACs, + iE-Extensions ProtocolExtensionContainer { {ForbiddenTAs-Item-ExtIEs} } OPTIONAL, + ... +} + +ForbiddenTAs-Item-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +ForbiddenTACs ::= SEQUENCE (SIZE(1..maxnoofForbTACs)) OF TAC + +ForbiddenLAs ::= SEQUENCE (SIZE(1..maxnoofEPLMNsPlusOne)) OF ForbiddenLAs-Item + +ForbiddenLAs-Item ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + forbiddenLACs ForbiddenLACs, + iE-Extensions ProtocolExtensionContainer { {ForbiddenLAs-Item-ExtIEs} } OPTIONAL, + ... +} + +ForbiddenLAs-Item-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +ForbiddenLACs ::= SEQUENCE (SIZE(1..maxnoofForbLACs)) OF LAC + +Fourframes ::= BIT STRING (SIZE (24)) + +FreqBandIndicator ::= INTEGER (1..256, ...) + +FreqBandIndicatorPriority ::= ENUMERATED { + not-broadcasted, + broadcasted, + ... +} + +-- G + +GBR-QosInformation ::= SEQUENCE { + e-RAB-MaximumBitrateDL BitRate, + e-RAB-MaximumBitrateUL BitRate, + e-RAB-GuaranteedBitrateDL BitRate, + e-RAB-GuaranteedBitrateUL BitRate, + iE-Extensions ProtocolExtensionContainer { { GBR-QosInformation-ExtIEs} } OPTIONAL, + ... +} + +GBR-QosInformation-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +GlobalENB-ID ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + eNB-ID ENB-ID, + iE-Extensions ProtocolExtensionContainer { {GlobalENB-ID-ExtIEs} } OPTIONAL, + ... +} + +GlobalENB-ID-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +GTPtunnelEndpoint ::= SEQUENCE { + transportLayerAddress TransportLayerAddress, + gTP-TEID GTP-TEI, + iE-Extensions ProtocolExtensionContainer { {GTPtunnelEndpoint-ExtIEs} } OPTIONAL, + ... +} + +GTPtunnelEndpoint-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +GTP-TEI ::= OCTET STRING (SIZE (4)) + +GUGroupIDList ::= SEQUENCE (SIZE (1..maxPools)) OF GU-Group-ID + + +GU-Group-ID ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + mME-Group-ID MME-Group-ID, + iE-Extensions ProtocolExtensionContainer { {GU-Group-ID-ExtIEs} } OPTIONAL, + ... +} + +GU-Group-ID-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + + +GUMMEI ::= SEQUENCE { + + gU-Group-ID GU-Group-ID, + mME-Code MME-Code, + iE-Extensions ProtocolExtensionContainer { {GUMMEI-ExtIEs} } OPTIONAL, + ... +} + +GUMMEI-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + + + +-- H + +HandoverReportType ::= ENUMERATED { + hoTooEarly, + hoToWrongCell, + ..., + interRATpingpong +} + +HandoverRestrictionList ::= SEQUENCE { + servingPLMN PLMN-Identity, + equivalentPLMNs EPLMNs OPTIONAL, + forbiddenTAs ForbiddenTAs OPTIONAL, + forbiddenLAs ForbiddenLAs OPTIONAL, + forbiddenInterRATs ForbiddenInterRATs OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {HandoverRestrictionList-ExtIEs} } OPTIONAL, + ... +} + +HandoverRestrictionList-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +HFN ::= INTEGER (0..1048575) + +HFNModified ::= INTEGER (0..131071) + +HFNforPDCP-SNlength18 ::= INTEGER (0..16383) + +HWLoadIndicator ::= SEQUENCE { + dLHWLoadIndicator LoadIndicator, + uLHWLoadIndicator LoadIndicator, + iE-Extensions ProtocolExtensionContainer { { HWLoadIndicator-ExtIEs} } OPTIONAL, + ... +} + +HWLoadIndicator-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + + +-- I + +IntegrityProtectionAlgorithms ::= BIT STRING (SIZE (16, ...)) + +InterfacesToTrace ::= BIT STRING (SIZE (8)) + +InvokeIndication ::= ENUMERATED{ + abs-information, + ..., + naics-information-start, + naics-information-stop +} + +-- J +-- K + +Key-eNodeB-Star ::= BIT STRING (SIZE(256)) + +-- L + +LAC ::= OCTET STRING (SIZE (2)) --(EXCEPT ('0000'H|'FFFE'H)) + +LastVisitedCell-Item ::= CHOICE { + e-UTRAN-Cell LastVisitedEUTRANCellInformation, + uTRAN-Cell LastVisitedUTRANCellInformation, + gERAN-Cell LastVisitedGERANCellInformation, + ... +} + +LastVisitedEUTRANCellInformation ::= SEQUENCE { + global-Cell-ID ECGI, + cellType CellType, + time-UE-StayedInCell Time-UE-StayedInCell, + iE-Extensions ProtocolExtensionContainer { { LastVisitedEUTRANCellInformation-ExtIEs} } OPTIONAL, + ... +} + +LastVisitedEUTRANCellInformation-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { +-- Extension for Rel-11 to support enhanced granularity for time UE stayed in cell -- + { ID id-Time-UE-StayedInCell-EnhancedGranularity CRITICALITY ignore EXTENSION Time-UE-StayedInCell-EnhancedGranularity PRESENCE optional}| + { ID id-HO-cause CRITICALITY ignore EXTENSION Cause PRESENCE optional}, + ... +} + +LastVisitedGERANCellInformation ::= CHOICE { + undefined NULL, + ... +} + +LastVisitedUTRANCellInformation ::= OCTET STRING + +LHN-ID ::= OCTET STRING(SIZE (32..256)) + +Links-to-log ::= ENUMERATED {uplink, downlink, both-uplink-and-downlink, ...} + +LoadIndicator ::= ENUMERATED { + lowLoad, + mediumLoad, + highLoad, + overLoad, + ... +} + +LocationReportingInformation ::= SEQUENCE { + eventType EventType, + reportArea ReportArea, + iE-Extensions ProtocolExtensionContainer { {LocationReportingInformation-ExtIEs} } OPTIONAL, + ... +} + +LocationReportingInformation-ExtIEs X2AP-PROTOCOL-EXTENSION ::={ + ... +} + +-- M + +M1PeriodicReporting ::= SEQUENCE { + reportInterval ReportIntervalMDT, + reportAmount ReportAmountMDT, + iE-Extensions ProtocolExtensionContainer { { M1PeriodicReporting-ExtIEs} } OPTIONAL, + ... +} + +M1PeriodicReporting-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +M1ReportingTrigger::= ENUMERATED{ + periodic, + a2eventtriggered, + ..., + a2eventtriggered-periodic +} + +M1ThresholdEventA2 ::= SEQUENCE { + measurementThreshold MeasurementThresholdA2, + iE-Extensions ProtocolExtensionContainer { { M1ThresholdEventA2-ExtIEs} } OPTIONAL, + ... +} + +M1ThresholdEventA2-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +M3Configuration ::= SEQUENCE { + m3period M3period, + iE-Extensions ProtocolExtensionContainer { { M3Configuration-ExtIEs} } OPTIONAL, + ... +} + +M3Configuration-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +M3period ::= ENUMERATED {ms100, ms1000, ms10000, ... } + +M4Configuration ::= SEQUENCE { + m4period M4period, + m4-links-to-log Links-to-log, + iE-Extensions ProtocolExtensionContainer { { M4Configuration-ExtIEs} } OPTIONAL, + ... +} + +M4Configuration-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +M4period ::= ENUMERATED {ms1024, ms2048, ms5120, ms10240, min1, ... } + + +M5Configuration ::= SEQUENCE { + m5period M5period, + m5-links-to-log Links-to-log, + iE-Extensions ProtocolExtensionContainer { { M5Configuration-ExtIEs} } OPTIONAL, + ... +} + +M5Configuration-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +M5period ::= ENUMERATED {ms1024, ms2048, ms5120, ms10240, min1, ... } + +M6Configuration ::= SEQUENCE { + m6report-interval M6report-interval, + m6delay-threshold M6delay-threshold OPTIONAL, +-- This IE shall be present if the M6 Links to log IE is set to “uplink” or to “both-uplink-and-downlink” -- + m6-links-to-log Links-to-log, + iE-Extensions ProtocolExtensionContainer { { M6Configuration-ExtIEs} } OPTIONAL, + ... +} + +M6Configuration-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +M6report-interval ::= ENUMERATED { ms1024, ms2048, ms5120, ms10240, ... } + +M6delay-threshold ::= ENUMERATED { ms30, ms40, ms50, ms60, ms70, ms80, ms90, ms100, ms150, ms300, ms500, ms750, ... } + +M7Configuration ::= SEQUENCE { + m7period M7period, + m7-links-to-log Links-to-log, + iE-Extensions ProtocolExtensionContainer { { M7Configuration-ExtIEs} } OPTIONAL, + ... +} + +M7Configuration-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +M7period ::= INTEGER(1..60, ...) + +MakeBeforeBreakIndicator::= ENUMERATED {true, ...} + +ManagementBasedMDTallowed ::= ENUMERATED {allowed, ...} + +Masked-IMEISV ::= BIT STRING (SIZE (64)) + +MDT-Activation ::= ENUMERATED { + immediate-MDT-only, + immediate-MDT-and-Trace, + ... +} + +MDT-Configuration ::= SEQUENCE { + mdt-Activation MDT-Activation, + areaScopeOfMDT AreaScopeOfMDT, + measurementsToActivate MeasurementsToActivate, + m1reportingTrigger M1ReportingTrigger, + m1thresholdeventA2 M1ThresholdEventA2 OPTIONAL, +-- Included in case of event-triggered, or event-triggered periodic reporting for measurement M1 + m1periodicReporting M1PeriodicReporting OPTIONAL, +-- Included in case of periodic, or event-triggered periodic reporting for measurement M1 + iE-Extensions ProtocolExtensionContainer { { MDT-Configuration-ExtIEs} } OPTIONAL, + ... +} + +MDT-Configuration-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + {ID id-M3Configuration CRITICALITY ignore EXTENSION M3Configuration PRESENCE conditional}| + {ID id-M4Configuration CRITICALITY ignore EXTENSION M4Configuration PRESENCE conditional}| + {ID id-M5Configuration CRITICALITY ignore EXTENSION M5Configuration PRESENCE conditional}| + {ID id-MDT-Location-Info CRITICALITY ignore EXTENSION MDT-Location-Info PRESENCE optional}| + {ID id-SignallingBasedMDTPLMNList CRITICALITY ignore EXTENSION MDTPLMNList PRESENCE optional}| + {ID id-M6Configuration CRITICALITY ignore EXTENSION M6Configuration PRESENCE conditional}| + {ID id-M7Configuration CRITICALITY ignore EXTENSION M7Configuration PRESENCE conditional}, + ... +} + +MDTPLMNList ::= SEQUENCE (SIZE(1..maxnoofMDTPLMNs)) OF PLMN-Identity + +MDT-Location-Info ::= BIT STRING (SIZE (8)) + +Measurement-ID ::= INTEGER (1..4095, ...) + +MeasurementsToActivate::= BIT STRING (SIZE (8)) + +MeasurementThresholdA2 ::= CHOICE { + threshold-RSRP Threshold-RSRP, + threshold-RSRQ Threshold-RSRQ, + ... +} + +MeNBtoSeNBContainer ::= OCTET STRING + +MME-Group-ID ::= OCTET STRING (SIZE (2)) + +MME-Code ::= OCTET STRING (SIZE (1)) + +MBMS-Service-Area-Identity-List ::= SEQUENCE (SIZE(1.. maxnoofMBMSServiceAreaIdentities)) OF MBMS-Service-Area-Identity + +MBMS-Service-Area-Identity ::= OCTET STRING (SIZE (2)) + +MBSFN-Subframe-Infolist::= SEQUENCE (SIZE(1.. maxnoofMBSFN)) OF MBSFN-Subframe-Info + +MBSFN-Subframe-Info ::= SEQUENCE { + radioframeAllocationPeriod RadioframeAllocationPeriod, + radioframeAllocationOffset RadioframeAllocationOffset, + subframeAllocation SubframeAllocation, + iE-Extensions ProtocolExtensionContainer { { MBSFN-Subframe-Info-ExtIEs } } OPTIONAL, + ... +} + +MBSFN-Subframe-Info-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +MobilityParametersModificationRange ::= SEQUENCE { + handoverTriggerChangeLowerLimit INTEGER (-20..20), + handoverTriggerChangeUpperLimit INTEGER (-20..20), + ... +} + +MobilityParametersInformation ::= SEQUENCE { + handoverTriggerChange INTEGER (-20..20), + ... +} + +MultibandInfoList ::= SEQUENCE (SIZE(1..maxnoofBands)) OF BandInfo + + +BandInfo ::= SEQUENCE { + freqBandIndicator FreqBandIndicator, + iE-Extensions ProtocolExtensionContainer { { BandInfo-ExtIEs } } OPTIONAL, + ... +} + +BandInfo-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- N + +Neighbour-Information ::= SEQUENCE (SIZE (0..maxnoofNeighbours)) OF SEQUENCE { + eCGI ECGI, + pCI PCI, + eARFCN EARFCN, + iE-Extensions ProtocolExtensionContainer { {Neighbour-Information-ExtIEs} } OPTIONAL, + ... +} + +Neighbour-Information-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + { ID id-NeighbourTAC CRITICALITY ignore EXTENSION TAC PRESENCE optional}| + { ID id-eARFCNExtension CRITICALITY reject EXTENSION EARFCNExtension PRESENCE optional}, + ... +} + +NextHopChainingCount ::= INTEGER (0..7) + +Number-of-Antennaports ::= ENUMERATED { + an1, + an2, + an4, + ... +} + +-- O + +OffsetOfNbiotChannelNumberToEARFCN ::= ENUMERATED { + minusTen, + minusNine, + minusEight, + minusSeven, + minusSix, + minusFive, + minusFour, + minusThree, + minusTwo, + minusOne, + minusZeroDotFive, + zero, + one, + two, + three, + four, + five, + six, + seven, + eight, + nine, + ... +} + +Oneframe ::= BIT STRING (SIZE (6)) + +-- P + +PA-Values ::= ENUMERATED { + dB-6, + dB-4dot77, + dB-3, + dB-1dot77, + dB0, + dB1, + dB2, + dB3, + ... +} + +PDCP-SN ::= INTEGER (0..4095) + +PDCP-SNExtended ::= INTEGER (0..32767) + +PDCP-SNlength18 ::= INTEGER (0..262143) + +PCI ::= INTEGER (0..503, ...) + +PLMN-Identity ::= OCTET STRING (SIZE(3)) + +Port-Number ::= OCTET STRING (SIZE (2)) + +PRACH-Configuration ::= SEQUENCE { + rootSequenceIndex INTEGER (0..837), + zeroCorrelationIndex INTEGER (0..15), + highSpeedFlag BOOLEAN, + prach-FreqOffset INTEGER (0..94), + prach-ConfigIndex INTEGER (0..63) OPTIONAL, -- present for TDD -- + iE-Extensions ProtocolExtensionContainer { {PRACH-Configuration-ExtIEs} } OPTIONAL, + ... +} + +PRACH-Configuration-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +Pre-emptionCapability ::= ENUMERATED { + shall-not-trigger-pre-emption, + may-trigger-pre-emption +} + +Pre-emptionVulnerability ::= ENUMERATED { + not-pre-emptable, + pre-emptable +} + +PriorityLevel ::= INTEGER { spare (0), highest (1), lowest (14), no-priority (15) } (0..15) + +ProSeAuthorized ::= SEQUENCE { + proSeDirectDiscovery ProSeDirectDiscovery OPTIONAL, + proSeDirectCommunication ProSeDirectCommunication OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {ProSeAuthorized-ExtIEs} } OPTIONAL, + ... +} + +ProSeAuthorized-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + { ID id-ProSeUEtoNetworkRelaying CRITICALITY ignore EXTENSION ProSeUEtoNetworkRelaying PRESENCE optional}, + ... +} + +ProSeDirectDiscovery ::= ENUMERATED { + authorized, + not-authorized, + ... +} + +ProSeDirectCommunication ::= ENUMERATED { + authorized, + not-authorized, + ... +} + +ProSeUEtoNetworkRelaying ::= ENUMERATED { + authorized, + not-authorized, + ... +} + +-- Q + +QCI ::= INTEGER (0..255) + +-- R + +RadioframeAllocationOffset ::= INTEGER (0..7, ...) + +RadioframeAllocationPeriod ::= ENUMERATED{ + n1, + n2, + n4, + n8, + n16, + n32, + ... +} + + +RadioResourceStatus ::= SEQUENCE { + dL-GBR-PRB-usage DL-GBR-PRB-usage, + uL-GBR-PRB-usage UL-GBR-PRB-usage, + dL-non-GBR-PRB-usage DL-non-GBR-PRB-usage, + uL-non-GBR-PRB-usage UL-non-GBR-PRB-usage, + dL-Total-PRB-usage DL-Total-PRB-usage, + uL-Total-PRB-usage UL-Total-PRB-usage, + iE-Extensions ProtocolExtensionContainer { {RadioResourceStatus-ExtIEs} } OPTIONAL, + ... +} + +RadioResourceStatus-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + {ID id-DL-scheduling-PDCCH-CCE-usage CRITICALITY ignore EXTENSION DL-scheduling-PDCCH-CCE-usage PRESENCE optional}| + + {ID id-UL-scheduling-PDCCH-CCE-usage CRITICALITY ignore EXTENSION UL-scheduling-PDCCH-CCE-usage PRESENCE optional}, + ... +} + +ReceiveStatusofULPDCPSDUs ::= BIT STRING (SIZE(4096)) + +ReceiveStatusOfULPDCPSDUsExtended ::= BIT STRING (SIZE(1..16384)) + +ReceiveStatusOfULPDCPSDUsPDCP-SNlength18 ::= BIT STRING (SIZE(1..131072)) + +Registration-Request ::= ENUMERATED { + start, + stop, + ..., + partial-stop, + add +} + +RelativeNarrowbandTxPower ::= SEQUENCE { + + rNTP-PerPRB BIT STRING (SIZE(6..110, ...)), + rNTP-Threshold RNTP-Threshold, + numberOfCellSpecificAntennaPorts ENUMERATED {one, two, four, ...}, + p-B INTEGER (0..3,...), + pDCCH-InterferenceImpact INTEGER (0..4,...), + iE-Extensions ProtocolExtensionContainer { { RelativeNarrowbandTxPower-ExtIEs} } OPTIONAL, + ... +} + +RelativeNarrowbandTxPower-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + { ID id-enhancedRNTP CRITICALITY ignore EXTENSION EnhancedRNTP PRESENCE optional }, + ... +} + +ReplacingCellsList ::= SEQUENCE (SIZE(0.. maxCellineNB)) OF ReplacingCellsList-Item + +ReplacingCellsList-Item ::= SEQUENCE { + eCGI ECGI, + ... +} + +ReportAmountMDT ::= ENUMERATED{r1, r2, r4, r8, r16, r32, r64, rinfinity} + +ReportArea ::= ENUMERATED{ + ecgi, + ... +} + +ReportCharacteristics ::= BIT STRING (SIZE (32)) + +ReportingPeriodicityCSIR ::= ENUMERATED { + ms5, + ms10, + ms20, + ms40, + ms80, +... +} + +ReportingPeriodicityRSRPMR ::= ENUMERATED { + one-hundred-20-ms, + two-hundred-40-ms, + four-hundred-80-ms, + six-hundred-40-ms, +... +} + +ReportIntervalMDT ::= ENUMERATED {ms120, ms240, ms480, ms640, ms1024, ms2048, ms5120, ms10240, min1, min6, min12, min30, min60} + +ResumeID ::= CHOICE { + non-truncated BIT STRING(SIZE(40)), + truncated BIT STRING(SIZE(24)), + ... +} + +RNTP-Threshold ::= ENUMERATED { + minusInfinity, + minusEleven, + minusTen, + minusNine, + minusEight, + minusSeven, + minusSix, + minusFive, + minusFour, + minusThree, + minusTwo, + minusOne, + zero, + one, + two, + three, + ... +} + +RRC-Context ::= OCTET STRING + +RRCConnReestabIndicator ::= ENUMERATED { + reconfigurationFailure, handoverFailure, otherFailure, ... +} +-- The values correspond to the values of ReestablishmentCause reported from the UE in the RRCConnectionReestablishmentRequest, as defined in TS 36.331 [9] + +RRCConnSetupIndicator::= ENUMERATED { + rrcConnSetup, + ... +} + +RSRPMeasurementResult ::= SEQUENCE (SIZE(1..maxCellReport)) OF + SEQUENCE { + rSRPCellID ECGI, + rSRPMeasured INTEGER (0..97, ...), + iE-Extensions ProtocolExtensionContainer { { RSRPMeasurementResult-ExtIEs} } OPTIONAL, + ... + } + +RSRPMeasurementResult-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +RSRPMRList ::= SEQUENCE (SIZE(1..maxUEReport)) OF + SEQUENCE { + rSRPMeasurementResult RSRPMeasurementResult, + iE-Extensions ProtocolExtensionContainer { { RSRPMRList-ExtIEs} } OPTIONAL, + ... + } + +RSRPMRList-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + { ID id-UEID CRITICALITY ignore EXTENSION UEID PRESENCE optional}, + ... +} + +-- S + +S1TNLLoadIndicator ::= SEQUENCE { + dLS1TNLLoadIndicator LoadIndicator, + uLS1TNLLoadIndicator LoadIndicator, + iE-Extensions ProtocolExtensionContainer { { S1TNLLoadIndicator-ExtIEs} } OPTIONAL, + ... +} + +S1TNLLoadIndicator-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +SCGChangeIndication ::= ENUMERATED {pDCPCountWrapAround, pSCellChange, other, ...} + +SeNBSecurityKey ::= BIT STRING (SIZE(256)) + +SeNBtoMeNBContainer ::= OCTET STRING + + +ServedCells ::= SEQUENCE (SIZE (1.. maxCellineNB)) OF SEQUENCE { + servedCellInfo ServedCell-Information, + neighbour-Info Neighbour-Information OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {ServedCell-ExtIEs} } OPTIONAL, + ... +} + +ServedCell-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +ServedCell-Information ::= SEQUENCE { + pCI PCI, + cellId ECGI, + tAC TAC, + broadcastPLMNs BroadcastPLMNs-Item, + eUTRA-Mode-Info EUTRA-Mode-Info, + iE-Extensions ProtocolExtensionContainer { {ServedCell-Information-ExtIEs} } OPTIONAL, + ... +} + +ServedCell-Information-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + { ID id-Number-of-Antennaports CRITICALITY ignore EXTENSION Number-of-Antennaports PRESENCE optional}| + { ID id-PRACH-Configuration CRITICALITY ignore EXTENSION PRACH-Configuration PRESENCE optional}| + { ID id-MBSFN-Subframe-Info CRITICALITY ignore EXTENSION MBSFN-Subframe-Infolist PRESENCE optional}| + { ID id-CSG-Id CRITICALITY ignore EXTENSION CSG-Id PRESENCE optional}| + { ID id-MBMS-Service-Area-List CRITICALITY ignore EXTENSION MBMS-Service-Area-Identity-List PRESENCE optional}| + { ID id-MultibandInfoList CRITICALITY ignore EXTENSION MultibandInfoList PRESENCE optional}| + { ID id-FreqBandIndicatorPriority CRITICALITY ignore EXTENSION FreqBandIndicatorPriority PRESENCE optional}| + { ID id-BandwidthReducedSI CRITICALITY ignore EXTENSION BandwidthReducedSI PRESENCE optional}, + ... +} + +SIPTOBearerDeactivationIndication ::= ENUMERATED { + true, + ... +} + +ShortMAC-I ::= BIT STRING (SIZE(16)) + +SourceOfUEActivityBehaviourInformation ::= ENUMERATED { + subscription-information, + statistics, + ... +} + +SpecialSubframe-Info ::= SEQUENCE { + specialSubframePatterns SpecialSubframePatterns, + cyclicPrefixDL CyclicPrefixDL, + cyclicPrefixUL CyclicPrefixUL, + iE-Extensions ProtocolExtensionContainer { { SpecialSubframe-Info-ExtIEs} } OPTIONAL, + ... +} + +SpecialSubframe-Info-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +SpecialSubframePatterns ::= ENUMERATED { + ssp0, + ssp1, + ssp2, + ssp3, + ssp4, + ssp5, + ssp6, + ssp7, + ssp8, + ... +} + +SubbandCQI ::= SEQUENCE { + subbandCQICodeword0 SubbandCQICodeword0, + subbandCQICodeword1 SubbandCQICodeword1 OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { SubbandCQI-ExtIEs} } OPTIONAL, + ... +} + +SRVCCOperationPossible ::= ENUMERATED { + possible, + ... +} + +SubbandCQI-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +SubbandCQICodeword0 ::= CHOICE { + four-bitCQI INTEGER (0..15, ...), + two-bitSubbandDifferentialCQI INTEGER (0..3, ...), + two-bitDifferentialCQI INTEGER (0..3, ...), + ... +} +SubbandCQICodeword1 ::= CHOICE { + four-bitCQI INTEGER (0..15, ...), + three-bitSpatialDifferentialCQI INTEGER (0..7, ...), + two-bitSubbandDifferentialCQI INTEGER (0..3, ...), + two-bitDifferentialCQI INTEGER (0..3, ...), + ... +} + +SubbandCQIList ::= SEQUENCE (SIZE(1.. maxSubband)) OF SubbandCQIItem + +SubbandCQIItem ::= SEQUENCE { + subbandCQI SubbandCQI, + subbandIndex INTEGER (0..27,...), + iE-Extensions ProtocolExtensionContainer { { SubbandCQIItem-ExtIEs} } OPTIONAL, + ... +} + +SubbandCQIItem-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +SubbandSize ::= ENUMERATED { + size2, + size3, + size4, + size6, + size8, + ... +} + +SubscriberProfileIDforRFP ::= INTEGER (1..256) + +SubframeAllocation ::= CHOICE { + oneframe Oneframe, + fourframes Fourframes, + ... +} + +SubframeAssignment ::= ENUMERATED { + sa0, + sa1, + sa2, + sa3, + sa4, + sa5, + sa6, + ... +} + + +-- T + +TABasedMDT::= SEQUENCE { + tAListforMDT TAListforMDT, + iE-Extensions ProtocolExtensionContainer { {TABasedMDT-ExtIEs} } OPTIONAL, + ... +} + +TABasedMDT-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +TAC ::= OCTET STRING (SIZE (2)) + +TAIBasedMDT ::= SEQUENCE { + tAIListforMDT TAIListforMDT, + iE-Extensions ProtocolExtensionContainer { {TAIBasedMDT-ExtIEs} } OPTIONAL, + ... +} + +TAIBasedMDT-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +TAIListforMDT ::= SEQUENCE (SIZE(1..maxnoofTAforMDT)) OF TAI-Item + +TAI-Item ::= SEQUENCE { + tAC TAC, + pLMN-Identity PLMN-Identity, + iE-Extensions ProtocolExtensionContainer { { TAI-Item-ExtIEs} } OPTIONAL, + ... +} + +TAI-Item-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +TAListforMDT ::= SEQUENCE (SIZE(1..maxnoofTAforMDT)) OF TAC + +TargetCellInUTRAN ::= OCTET STRING -- This IE is to be encoded according to the UTRAN Cell ID in the Last Visited UTRAN Cell Information IE in TS 25.413 [24] + +TargeteNBtoSource-eNBTransparentContainer ::= OCTET STRING + +TDD-Info ::= SEQUENCE { + eARFCN EARFCN, + transmission-Bandwidth Transmission-Bandwidth, + subframeAssignment SubframeAssignment, + specialSubframe-Info SpecialSubframe-Info, + iE-Extensions ProtocolExtensionContainer { {TDD-Info-ExtIEs} } OPTIONAL, + ... +} +TDD-Info-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + { ID id-AdditionalSpecialSubframe-Info CRITICALITY ignore EXTENSION AdditionalSpecialSubframe-Info PRESENCE optional}| + { ID id-eARFCNExtension CRITICALITY reject EXTENSION EARFCNExtension PRESENCE optional}| + { ID id-AdditionalSpecialSubframeExtension-Info CRITICALITY ignore EXTENSION AdditionalSpecialSubframeExtension-Info PRESENCE optional}, + ... +} + +Threshold-RSRP ::= INTEGER(0..97) + +Threshold-RSRQ ::= INTEGER(0..34) + +TimeToWait ::= ENUMERATED { + v1s, + v2s, + v5s, + v10s, + v20s, + v60s, + ... +} + +Time-UE-StayedInCell ::= INTEGER (0..4095) + +Time-UE-StayedInCell-EnhancedGranularity ::= INTEGER (0..40950) + +TraceActivation ::= SEQUENCE { + eUTRANTraceID EUTRANTraceID, + interfacesToTrace InterfacesToTrace, + traceDepth TraceDepth, + traceCollectionEntityIPAddress TraceCollectionEntityIPAddress, + iE-Extensions ProtocolExtensionContainer { {TraceActivation-ExtIEs} } OPTIONAL, + ... +} + +TraceActivation-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + { ID id-MDTConfiguration CRITICALITY ignore EXTENSION MDT-Configuration PRESENCE optional}, + ... +} + +TraceCollectionEntityIPAddress ::= BIT STRING (SIZE(1..160, ...)) + +TraceDepth ::= ENUMERATED { + minimum, + medium, + maximum, + minimumWithoutVendorSpecificExtension, + mediumWithoutVendorSpecificExtension, + maximumWithoutVendorSpecificExtension, + ... +} + +Transmission-Bandwidth ::= ENUMERATED { + bw6, + bw15, + bw25, + bw50, + bw75, + bw100, + ..., + bw1 +} + +TransportLayerAddress ::= BIT STRING (SIZE(1..160, ...)) + +TunnelInformation ::= SEQUENCE { + transportLayerAddress TransportLayerAddress, + uDP-Port-Number Port-Number OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {Tunnel-Information-ExtIEs} } OPTIONAL, + ... +} + +Tunnel-Information-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +TypeOfError ::= ENUMERATED { + not-understood, + missing, + ... +} + + +-- U + +UEAggregateMaximumBitRate ::= SEQUENCE { + uEaggregateMaximumBitRateDownlink BitRate, + uEaggregateMaximumBitRateUplink BitRate, + iE-Extensions ProtocolExtensionContainer { {UEAggregate-MaximumBitrate-ExtIEs} } OPTIONAL, + ... +} + +UEAggregate-MaximumBitrate-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +UE-ContextKeptIndicator ::= ENUMERATED { + true, + ... +} + +UEID ::= BIT STRING (SIZE (16)) + +UE-HistoryInformation ::= SEQUENCE (SIZE(1..maxnoofCells)) OF LastVisitedCell-Item + +UE-HistoryInformationFromTheUE ::= OCTET STRING +-- This IE is a transparent container and shall be encoded as the VisitedCellInfoList field contained in the UEInformationResponse message as defined in TS 36.331 [9] + +UE-S1AP-ID ::= INTEGER (0.. 4294967295) + +UE-X2AP-ID ::= INTEGER (0..4095) + +UE-X2AP-ID-Extension ::= INTEGER (0..4095, ...) + +UE-RLF-Report-Container::= OCTET STRING +-- This IE is a transparent container and shall be encoded as the RLF-Report-r9 field contained in the UEInformationResponse message as defined in TS 36.331 [9] + +UE-RLF-Report-Container-for-extended-bands ::= OCTET STRING +-- This IE is a transparent container and shall be encoded as the RLF-Report-v9e0 field contained in the UEInformationResponse message as defined in TS 36.331 [9] + +UESecurityCapabilities ::= SEQUENCE { + encryptionAlgorithms EncryptionAlgorithms, + integrityProtectionAlgorithms IntegrityProtectionAlgorithms, + iE-Extensions ProtocolExtensionContainer { { UESecurityCapabilities-ExtIEs} } OPTIONAL, +... +} + +UESecurityCapabilities-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +UESidelinkAggregateMaximumBitRate ::= SEQUENCE { + uESidelinkAggregateMaximumBitRate BitRate, + iE-Extensions ProtocolExtensionContainer { {UE-Sidelink-Aggregate-MaximumBitRate-ExtIEs} } OPTIONAL, + ... +} + +UE-Sidelink-Aggregate-MaximumBitRate-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-GBR-PRB-usage::= INTEGER (0..100) + +UL-HighInterferenceIndicationInfo ::= SEQUENCE (SIZE(1..maxCellineNB)) OF UL-HighInterferenceIndicationInfo-Item + +UL-HighInterferenceIndicationInfo-Item ::= SEQUENCE { + target-Cell-ID ECGI, + ul-interferenceindication UL-HighInterferenceIndication, + iE-Extensions ProtocolExtensionContainer { { UL-HighInterferenceIndicationInfo-Item-ExtIEs} } OPTIONAL, + ... +} + +UL-HighInterferenceIndicationInfo-Item-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-HighInterferenceIndication ::= BIT STRING (SIZE(1..110, ...)) + +UL-InterferenceOverloadIndication ::= SEQUENCE (SIZE(1..maxnoofPRBs)) OF UL-InterferenceOverloadIndication-Item + +UL-InterferenceOverloadIndication-Item ::= ENUMERATED { + high-interference, + medium-interference, + low-interference, + ... +} + +UL-non-GBR-PRB-usage::= INTEGER (0..100) + +UL-scheduling-PDCCH-CCE-usage::= INTEGER (0..100) + +UL-Total-PRB-usage::= INTEGER (0..100) + +UsableABSInformation ::= CHOICE { + fdd UsableABSInformationFDD, + tdd UsableABSInformationTDD, + ... +} + +UsableABSInformationFDD ::= SEQUENCE { + usable-abs-pattern-info BIT STRING (SIZE(40)), + iE-Extensions ProtocolExtensionContainer { { UsableABSInformationFDD-ExtIEs} } OPTIONAL, + ... +} + +UsableABSInformationFDD-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +UsableABSInformationTDD ::= SEQUENCE { + usaable-abs-pattern-info BIT STRING (SIZE(1..70, ...)), + iE-Extensions ProtocolExtensionContainer { { UsableABSInformationTDD-ExtIEs} } OPTIONAL, + ... +} + +UsableABSInformationTDD-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + + +-- V + +V2XServicesAuthorized ::= SEQUENCE { + vehicleUE VehicleUE OPTIONAL, +pedestrianUE PedestrianUE OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {V2XServicesAuthorized-ExtIEs} } OPTIONAL, + ... +} + +V2XServicesAuthorized-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +VehicleUE ::= ENUMERATED { + authorized, + not-authorized, + ... +} + +PedestrianUE ::= ENUMERATED { + authorized, + not-authorized, + ... +} + +-- W + +WidebandCQI ::= SEQUENCE { + widebandCQICodeword0 INTEGER (0..15, ...), + widebandCQICodeword1 WidebandCQICodeword1 OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { WidebandCQI-ExtIEs} } OPTIONAL, + ... +} + +WidebandCQI-ExtIEs X2AP-PROTOCOL-EXTENSION ::= { + ... +} + +WidebandCQICodeword1::= CHOICE { + four-bitCQI INTEGER (0..15, ...), + three-bitSpatialDifferentialCQI INTEGER (0..7, ...), + ... +} + +WTID ::= CHOICE { + wTID-Type1 WTID-Type1, + wTID-Type2 WTID-Long-Type2, + ... +} + +WTID-Type1 ::= SEQUENCE { + pLMN-Identity PLMN-Identity, + shortWTID BIT STRING (SIZE(24)), + ... +} + +WTID-Long-Type2 ::= BIT STRING (SIZE(48)) + +WT-UE-XwAP-ID ::= OCTET STRING (SIZE (3)) + +-- X + +X2BenefitValue ::= INTEGER (1..8, ...) + +-- Y +-- Z + +END + + +-- ************************************************************** +-- +-- Common definitions +-- +-- ************************************************************** + +X2AP-CommonDataTypes { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +eps-Access (21) modules (3) x2ap (2) version1 (1) x2ap-CommonDataTypes (3) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- Extension constants +-- +-- ************************************************************** + +maxPrivateIEs INTEGER ::= 65535 +maxProtocolExtensions INTEGER ::= 65535 +maxProtocolIEs INTEGER ::= 65535 + +-- ************************************************************** +-- +-- Common Data Types +-- +-- ************************************************************** + +Criticality ::= ENUMERATED { reject, ignore, notify } + +Presence ::= ENUMERATED { optional, conditional, mandatory } + +PrivateIE-ID ::= CHOICE { + local INTEGER (0.. maxPrivateIEs), + global OBJECT IDENTIFIER +} + +ProcedureCode ::= INTEGER (0..255) + + +ProtocolIE-ID ::= INTEGER (0..maxProtocolIEs) + + +TriggeringMessage ::= ENUMERATED { initiating-message, successful-outcome, unsuccessful-outcome} + +END + + +-- ************************************************************** +-- +-- Constant definitions +-- +-- ************************************************************** + +X2AP-Constants { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +eps-Access (21) modules (3) x2ap (2) version1 (1) x2ap-Constants (4) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +IMPORTS + ProcedureCode, + ProtocolIE-ID +FROM X2AP-CommonDataTypes; + +-- ************************************************************** +-- +-- Elementary Procedures +-- +-- ************************************************************** + +id-handoverPreparation ProcedureCode ::= 0 +id-handoverCancel ProcedureCode ::= 1 +id-loadIndication ProcedureCode ::= 2 +id-errorIndication ProcedureCode ::= 3 +id-snStatusTransfer ProcedureCode ::= 4 +id-uEContextRelease ProcedureCode ::= 5 +id-x2Setup ProcedureCode ::= 6 +id-reset ProcedureCode ::= 7 +id-eNBConfigurationUpdate ProcedureCode ::= 8 +id-resourceStatusReportingInitiation ProcedureCode ::= 9 +id-resourceStatusReporting ProcedureCode ::= 10 +id-privateMessage ProcedureCode ::= 11 +id-mobilitySettingsChange ProcedureCode ::= 12 +id-rLFIndication ProcedureCode ::= 13 +id-handoverReport ProcedureCode ::= 14 +id-cellActivation ProcedureCode ::= 15 +id-x2Release ProcedureCode ::= 16 +id-x2APMessageTransfer ProcedureCode ::= 17 +id-x2Removal ProcedureCode ::= 18 +id-seNBAdditionPreparation ProcedureCode ::= 19 +id-seNBReconfigurationCompletion ProcedureCode ::= 20 +id-meNBinitiatedSeNBModificationPreparation ProcedureCode ::= 21 +id-seNBinitiatedSeNBModification ProcedureCode ::= 22 +id-meNBinitiatedSeNBRelease ProcedureCode ::= 23 +id-seNBinitiatedSeNBRelease ProcedureCode ::= 24 +id-seNBCounterCheck ProcedureCode ::= 25 +id-retrieveUEContext ProcedureCode ::= 26 + + +-- ************************************************************** +-- +-- Lists +-- +-- ************************************************************** + +maxEARFCN INTEGER ::= 65535 +maxEARFCNPlusOne INTEGER ::= 65536 +newmaxEARFCN INTEGER ::= 262143 +maxInterfaces INTEGER ::= 16 +maxCellineNB INTEGER ::= 256 +maxnoofBands INTEGER ::= 16 +maxnoofBearers INTEGER ::= 256 +maxNrOfErrors INTEGER ::= 256 +maxnoofPDCP-SN INTEGER ::= 16 +maxnoofEPLMNs INTEGER ::= 15 +maxnoofEPLMNsPlusOne INTEGER ::= 16 +maxnoofForbLACs INTEGER ::= 4096 +maxnoofForbTACs INTEGER ::= 4096 +maxnoofBPLMNs INTEGER ::= 6 +maxnoofNeighbours INTEGER ::= 512 +maxnoofPRBs INTEGER ::= 110 +maxPools INTEGER ::= 16 +maxnoofCells INTEGER ::= 16 +maxnoofMBSFN INTEGER ::= 8 +maxFailedMeasObjects INTEGER ::= 32 +maxnoofCellIDforMDT INTEGER ::= 32 +maxnoofTAforMDT INTEGER ::= 8 +maxnoofMBMSServiceAreaIdentities INTEGER ::= 256 +maxnoofMDTPLMNs INTEGER ::= 16 +maxnoofCoMPHypothesisSet INTEGER ::= 256 +maxnoofCoMPCells INTEGER ::= 32 +maxUEReport INTEGER ::= 128 +maxCellReport INTEGER ::= 9 +maxnoofPA INTEGER ::= 3 +maxCSIProcess INTEGER ::= 4 +maxCSIReport INTEGER ::= 2 +maxSubband INTEGER ::= 14 + +-- ************************************************************** +-- +-- IEs +-- +-- ************************************************************** + +id-E-RABs-Admitted-Item ProtocolIE-ID ::= 0 +id-E-RABs-Admitted-List ProtocolIE-ID ::= 1 +id-E-RAB-Item ProtocolIE-ID ::= 2 +id-E-RABs-NotAdmitted-List ProtocolIE-ID ::= 3 +id-E-RABs-ToBeSetup-Item ProtocolIE-ID ::= 4 +id-Cause ProtocolIE-ID ::= 5 +id-CellInformation ProtocolIE-ID ::= 6 +id-CellInformation-Item ProtocolIE-ID ::= 7 +id-New-eNB-UE-X2AP-ID ProtocolIE-ID ::= 9 +id-Old-eNB-UE-X2AP-ID ProtocolIE-ID ::= 10 +id-TargetCell-ID ProtocolIE-ID ::= 11 +id-TargeteNBtoSource-eNBTransparentContainer ProtocolIE-ID ::= 12 +id-TraceActivation ProtocolIE-ID ::= 13 +id-UE-ContextInformation ProtocolIE-ID ::= 14 +id-UE-HistoryInformation ProtocolIE-ID ::= 15 +id-UE-X2AP-ID ProtocolIE-ID ::= 16 +id-CriticalityDiagnostics ProtocolIE-ID ::= 17 +id-E-RABs-SubjectToStatusTransfer-List ProtocolIE-ID ::= 18 +id-E-RABs-SubjectToStatusTransfer-Item ProtocolIE-ID ::= 19 +id-ServedCells ProtocolIE-ID ::= 20 +id-GlobalENB-ID ProtocolIE-ID ::= 21 +id-TimeToWait ProtocolIE-ID ::= 22 +id-GUMMEI-ID ProtocolIE-ID ::= 23 +id-GUGroupIDList ProtocolIE-ID ::= 24 +id-ServedCellsToAdd ProtocolIE-ID ::= 25 +id-ServedCellsToModify ProtocolIE-ID ::= 26 +id-ServedCellsToDelete ProtocolIE-ID ::= 27 +id-Registration-Request ProtocolIE-ID ::= 28 +id-CellToReport ProtocolIE-ID ::= 29 +id-ReportingPeriodicity ProtocolIE-ID ::= 30 +id-CellToReport-Item ProtocolIE-ID ::= 31 +id-CellMeasurementResult ProtocolIE-ID ::= 32 +id-CellMeasurementResult-Item ProtocolIE-ID ::= 33 +id-GUGroupIDToAddList ProtocolIE-ID ::= 34 +id-GUGroupIDToDeleteList ProtocolIE-ID ::= 35 +id-SRVCCOperationPossible ProtocolIE-ID ::= 36 +id-Measurement-ID ProtocolIE-ID ::= 37 +id-ReportCharacteristics ProtocolIE-ID ::= 38 +id-ENB1-Measurement-ID ProtocolIE-ID ::= 39 +id-ENB2-Measurement-ID ProtocolIE-ID ::= 40 +id-Number-of-Antennaports ProtocolIE-ID ::= 41 +id-CompositeAvailableCapacityGroup ProtocolIE-ID ::= 42 +id-ENB1-Cell-ID ProtocolIE-ID ::= 43 +id-ENB2-Cell-ID ProtocolIE-ID ::= 44 +id-ENB2-Proposed-Mobility-Parameters ProtocolIE-ID ::= 45 +id-ENB1-Mobility-Parameters ProtocolIE-ID ::= 46 +id-ENB2-Mobility-Parameters-Modification-Range ProtocolIE-ID ::= 47 +id-FailureCellPCI ProtocolIE-ID ::= 48 +id-Re-establishmentCellECGI ProtocolIE-ID ::= 49 +id-FailureCellCRNTI ProtocolIE-ID ::= 50 +id-ShortMAC-I ProtocolIE-ID ::= 51 +id-SourceCellECGI ProtocolIE-ID ::= 52 +id-FailureCellECGI ProtocolIE-ID ::= 53 +id-HandoverReportType ProtocolIE-ID ::= 54 +id-PRACH-Configuration ProtocolIE-ID ::= 55 +id-MBSFN-Subframe-Info ProtocolIE-ID ::= 56 +id-ServedCellsToActivate ProtocolIE-ID ::= 57 +id-ActivatedCellList ProtocolIE-ID ::= 58 +id-DeactivationIndication ProtocolIE-ID ::= 59 +id-UE-RLF-Report-Container ProtocolIE-ID ::= 60 +id-ABSInformation ProtocolIE-ID ::= 61 +id-InvokeIndication ProtocolIE-ID ::= 62 +id-ABS-Status ProtocolIE-ID ::= 63 +id-PartialSuccessIndicator ProtocolIE-ID ::= 64 +id-MeasurementInitiationResult-List ProtocolIE-ID ::= 65 +id-MeasurementInitiationResult-Item ProtocolIE-ID ::= 66 +id-MeasurementFailureCause-Item ProtocolIE-ID ::= 67 +id-CompleteFailureCauseInformation-List ProtocolIE-ID ::= 68 +id-CompleteFailureCauseInformation-Item ProtocolIE-ID ::= 69 +id-CSG-Id ProtocolIE-ID ::= 70 +id-CSGMembershipStatus ProtocolIE-ID ::= 71 +id-MDTConfiguration ProtocolIE-ID ::= 72 +id-ManagementBasedMDTallowed ProtocolIE-ID ::= 74 +id-RRCConnSetupIndicator ProtocolIE-ID ::= 75 +id-NeighbourTAC ProtocolIE-ID ::= 76 +id-Time-UE-StayedInCell-EnhancedGranularity ProtocolIE-ID ::= 77 +id-RRCConnReestabIndicator ProtocolIE-ID ::= 78 +id-MBMS-Service-Area-List ProtocolIE-ID ::= 79 +id-HO-cause ProtocolIE-ID ::= 80 +id-TargetCellInUTRAN ProtocolIE-ID ::= 81 +id-MobilityInformation ProtocolIE-ID ::= 82 +id-SourceCellCRNTI ProtocolIE-ID ::= 83 +id-MultibandInfoList ProtocolIE-ID ::= 84 +id-M3Configuration ProtocolIE-ID ::= 85 +id-M4Configuration ProtocolIE-ID ::= 86 +id-M5Configuration ProtocolIE-ID ::= 87 +id-MDT-Location-Info ProtocolIE-ID ::= 88 +id-ManagementBasedMDTPLMNList ProtocolIE-ID ::= 89 +id-SignallingBasedMDTPLMNList ProtocolIE-ID ::= 90 +id-ReceiveStatusOfULPDCPSDUsExtended ProtocolIE-ID ::= 91 +id-ULCOUNTValueExtended ProtocolIE-ID ::= 92 +id-DLCOUNTValueExtended ProtocolIE-ID ::= 93 +id-eARFCNExtension ProtocolIE-ID ::= 94 +id-UL-EARFCNExtension ProtocolIE-ID ::= 95 +id-DL-EARFCNExtension ProtocolIE-ID ::= 96 +id-AdditionalSpecialSubframe-Info ProtocolIE-ID ::= 97 +id-Masked-IMEISV ProtocolIE-ID ::= 98 +id-IntendedULDLConfiguration ProtocolIE-ID ::= 99 +id-ExtendedULInterferenceOverloadInfo ProtocolIE-ID ::= 100 +id-RNL-Header ProtocolIE-ID ::= 101 +id-x2APMessage ProtocolIE-ID ::= 102 +id-ProSeAuthorized ProtocolIE-ID ::= 103 +id-ExpectedUEBehaviour ProtocolIE-ID ::= 104 +id-UE-HistoryInformationFromTheUE ProtocolIE-ID ::= 105 +id-DynamicDLTransmissionInformation ProtocolIE-ID ::= 106 +id-UE-RLF-Report-Container-for-extended-bands ProtocolIE-ID ::= 107 +id-CoMPInformation ProtocolIE-ID ::= 108 +id-ReportingPeriodicityRSRPMR ProtocolIE-ID ::= 109 +id-RSRPMRList ProtocolIE-ID ::= 110 +id-MeNB-UE-X2AP-ID ProtocolIE-ID ::= 111 +id-SeNB-UE-X2AP-ID ProtocolIE-ID ::= 112 +id-UE-SecurityCapabilities ProtocolIE-ID ::= 113 +id-SeNBSecurityKey ProtocolIE-ID ::= 114 +id-SeNBUEAggregateMaximumBitRate ProtocolIE-ID ::= 115 +id-ServingPLMN ProtocolIE-ID ::= 116 +id-E-RABs-ToBeAdded-List ProtocolIE-ID ::= 117 +id-E-RABs-ToBeAdded-Item ProtocolIE-ID ::= 118 +id-MeNBtoSeNBContainer ProtocolIE-ID ::= 119 +id-E-RABs-Admitted-ToBeAdded-List ProtocolIE-ID ::= 120 +id-E-RABs-Admitted-ToBeAdded-Item ProtocolIE-ID ::= 121 +id-SeNBtoMeNBContainer ProtocolIE-ID ::= 122 +id-ResponseInformationSeNBReconfComp ProtocolIE-ID ::= 123 +id-UE-ContextInformationSeNBModReq ProtocolIE-ID ::= 124 +id-E-RABs-ToBeAdded-ModReqItem ProtocolIE-ID ::= 125 +id-E-RABs-ToBeModified-ModReqItem ProtocolIE-ID ::= 126 +id-E-RABs-ToBeReleased-ModReqItem ProtocolIE-ID ::= 127 +id-E-RABs-Admitted-ToBeAdded-ModAckList ProtocolIE-ID ::= 128 +id-E-RABs-Admitted-ToBeModified-ModAckList ProtocolIE-ID ::= 129 +id-E-RABs-Admitted-ToBeReleased-ModAckList ProtocolIE-ID ::= 130 +id-E-RABs-Admitted-ToBeAdded-ModAckItem ProtocolIE-ID ::= 131 +id-E-RABs-Admitted-ToBeModified-ModAckItem ProtocolIE-ID ::= 132 +id-E-RABs-Admitted-ToBeReleased-ModAckItem ProtocolIE-ID ::= 133 +id-E-RABs-ToBeReleased-ModReqd ProtocolIE-ID ::= 134 +id-E-RABs-ToBeReleased-ModReqdItem ProtocolIE-ID ::= 135 +id-SCGChangeIndication ProtocolIE-ID ::= 136 +id-E-RABs-ToBeReleased-List-RelReq ProtocolIE-ID ::= 137 +id-E-RABs-ToBeReleased-RelReqItem ProtocolIE-ID ::= 138 +id-E-RABs-ToBeReleased-List-RelConf ProtocolIE-ID ::= 139 +id-E-RABs-ToBeReleased-RelConfItem ProtocolIE-ID ::= 140 +id-E-RABs-SubjectToCounterCheck-List ProtocolIE-ID ::= 141 +id-E-RABs-SubjectToCounterCheckItem ProtocolIE-ID ::= 142 +id-CoverageModificationList ProtocolIE-ID ::= 143 +id-ReportingPeriodicityCSIR ProtocolIE-ID ::= 145 +id-CSIReportList ProtocolIE-ID ::= 146 +id-UEID ProtocolIE-ID ::= 147 +id-enhancedRNTP ProtocolIE-ID ::= 148 +id-ProSeUEtoNetworkRelaying ProtocolIE-ID ::= 149 +id-ReceiveStatusOfULPDCPSDUsPDCP-SNlength18 ProtocolIE-ID ::= 150 +id-ULCOUNTValuePDCP-SNlength18 ProtocolIE-ID ::= 151 +id-DLCOUNTValuePDCP-SNlength18 ProtocolIE-ID ::= 152 +id-UE-ContextReferenceAtSeNB ProtocolIE-ID ::= 153 +id-UE-ContextKeptIndicator ProtocolIE-ID ::= 154 +id-New-eNB-UE-X2AP-ID-Extension ProtocolIE-ID ::= 155 +id-Old-eNB-UE-X2AP-ID-Extension ProtocolIE-ID ::= 156 +id-MeNB-UE-X2AP-ID-Extension ProtocolIE-ID ::= 157 +id-SeNB-UE-X2AP-ID-Extension ProtocolIE-ID ::= 158 +id-LHN-ID ProtocolIE-ID ::= 159 +id-FreqBandIndicatorPriority ProtocolIE-ID ::= 160 +id-M6Configuration ProtocolIE-ID ::= 161 +id-M7Configuration ProtocolIE-ID ::= 162 +id-Tunnel-Information-for-BBF ProtocolIE-ID ::= 163 +id-SIPTO-BearerDeactivationIndication ProtocolIE-ID ::= 164 +id-GW-TransportLayerAddress ProtocolIE-ID ::= 165 +id-Correlation-ID ProtocolIE-ID ::= 166 +id-SIPTO-Correlation-ID ProtocolIE-ID ::= 167 +id-SIPTO-L-GW-TransportLayerAddress ProtocolIE-ID ::= 168 +id-X2RemovalThreshold ProtocolIE-ID ::= 169 +id-CellReportingIndicator ProtocolIE-ID ::= 170 +id-BearerType ProtocolIE-ID ::= 171 +id-resumeID ProtocolIE-ID ::= 172 +id-UE-ContextInformationRetrieve ProtocolIE-ID ::= 173 +id-E-RABs-ToBeSetupRetrieve-Item ProtocolIE-ID ::= 174 +id-NewEUTRANCellIdentifier ProtocolIE-ID ::= 175 +id-V2XServicesAuthorized ProtocolIE-ID ::= 176 +id-OffsetOfNbiotChannelNumberToDL-EARFCN ProtocolIE-ID ::= 177 +id-OffsetOfNbiotChannelNumberToUL-EARFCN ProtocolIE-ID ::= 178 +id-AdditionalSpecialSubframeExtension-Info ProtocolIE-ID ::= 179 +id-BandwidthReducedSI ProtocolIE-ID ::= 180 +id-MakeBeforeBreakIndicator ProtocolIE-ID ::= 181 +id-UE-ContextReferenceAtWT ProtocolIE-ID ::= 182 +id-WT-UE-ContextKeptIndicator ProtocolIE-ID ::= 183 +id-UESidelinkAggregateMaximumBitRate ProtocolIE-ID ::= 184 +id-uL-GTPtunnelEndpoint ProtocolIE-ID ::= 185 +id-DL-scheduling-PDCCH-CCE-usage ProtocolIE-ID ::= 193 +id-UL-scheduling-PDCCH-CCE-usage ProtocolIE-ID ::= 194 + +END + + +-- ************************************************************** +-- +-- Container definitions +-- +-- ************************************************************** + +X2AP-Containers { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +eps-Access (21) modules (3) x2ap (2) version1 (1) x2ap-Containers (5) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + maxPrivateIEs, + maxProtocolExtensions, + maxProtocolIEs, + Criticality, + Presence, + PrivateIE-ID, + ProtocolIE-ID +FROM X2AP-CommonDataTypes; + +-- ************************************************************** +-- +-- Class Definition for Protocol IEs +-- +-- ************************************************************** + +X2AP-PROTOCOL-IES ::= CLASS { + &id ProtocolIE-ID UNIQUE, + &criticality Criticality, + &Value, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + TYPE &Value + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Protocol IEs +-- +-- ************************************************************** + +X2AP-PROTOCOL-IES-PAIR ::= CLASS { + &id ProtocolIE-ID UNIQUE, + &firstCriticality Criticality, + &FirstValue, + &secondCriticality Criticality, + &SecondValue, + &presence Presence +} +WITH SYNTAX { + ID &id + FIRST CRITICALITY &firstCriticality + FIRST TYPE &FirstValue + SECOND CRITICALITY &secondCriticality + SECOND TYPE &SecondValue + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Protocol Extensions +-- +-- ************************************************************** + +X2AP-PROTOCOL-EXTENSION ::= CLASS { + &id ProtocolIE-ID UNIQUE, + &criticality Criticality, + &Extension, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + EXTENSION &Extension + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Private IEs +-- +-- ************************************************************** + +X2AP-PRIVATE-IES ::= CLASS { + &id PrivateIE-ID, + &criticality Criticality, + &Value, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + TYPE &Value + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Container for Protocol IEs +-- +-- ************************************************************** + +ProtocolIE-Container {X2AP-PROTOCOL-IES : IEsSetParam} ::= + SEQUENCE (SIZE (0..maxProtocolIEs)) OF + ProtocolIE-Field {{IEsSetParam}} + +ProtocolIE-Single-Container {X2AP-PROTOCOL-IES : IEsSetParam} ::= + ProtocolIE-Field {{IEsSetParam}} + +ProtocolIE-Field {X2AP-PROTOCOL-IES : IEsSetParam} ::= SEQUENCE { + id X2AP-PROTOCOL-IES.&id ({IEsSetParam}), + criticality X2AP-PROTOCOL-IES.&criticality ({IEsSetParam}{@id}), + value X2AP-PROTOCOL-IES.&Value ({IEsSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Protocol IE Pairs +-- +-- ************************************************************** + +ProtocolIE-ContainerPair {X2AP-PROTOCOL-IES-PAIR : IEsSetParam} ::= + SEQUENCE (SIZE (0..maxProtocolIEs)) OF + ProtocolIE-FieldPair {{IEsSetParam}} + +ProtocolIE-FieldPair {X2AP-PROTOCOL-IES-PAIR : IEsSetParam} ::= SEQUENCE { + id X2AP-PROTOCOL-IES-PAIR.&id ({IEsSetParam}), + firstCriticality X2AP-PROTOCOL-IES-PAIR.&firstCriticality ({IEsSetParam}{@id}), + firstValue X2AP-PROTOCOL-IES-PAIR.&FirstValue ({IEsSetParam}{@id}), + secondCriticality X2AP-PROTOCOL-IES-PAIR.&secondCriticality ({IEsSetParam}{@id}), + secondValue X2AP-PROTOCOL-IES-PAIR.&SecondValue ({IEsSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container Lists for Protocol IE Containers +-- +-- ************************************************************** + +ProtocolIE-ContainerList {INTEGER : lowerBound, INTEGER : upperBound, X2AP-PROTOCOL-IES : IEsSetParam} ::= + SEQUENCE (SIZE (lowerBound..upperBound)) OF + ProtocolIE-Container {{IEsSetParam}} + +ProtocolIE-ContainerPairList {INTEGER : lowerBound, INTEGER : upperBound, X2AP-PROTOCOL-IES-PAIR : IEsSetParam} ::= + SEQUENCE (SIZE (lowerBound..upperBound)) OF + ProtocolIE-ContainerPair {{IEsSetParam}} + +-- ************************************************************** +-- +-- Container for Protocol Extensions +-- +-- ************************************************************** + +ProtocolExtensionContainer {X2AP-PROTOCOL-EXTENSION : ExtensionSetParam} ::= + SEQUENCE (SIZE (1..maxProtocolExtensions)) OF + ProtocolExtensionField {{ExtensionSetParam}} + +ProtocolExtensionField {X2AP-PROTOCOL-EXTENSION : ExtensionSetParam} ::= SEQUENCE { + id X2AP-PROTOCOL-EXTENSION.&id ({ExtensionSetParam}), + criticality X2AP-PROTOCOL-EXTENSION.&criticality ({ExtensionSetParam}{@id}), + extensionValue X2AP-PROTOCOL-EXTENSION.&Extension ({ExtensionSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Private IEs +-- +-- ************************************************************** + +PrivateIE-Container {X2AP-PRIVATE-IES : IEsSetParam} ::= + SEQUENCE (SIZE (1..maxPrivateIEs)) OF + PrivateIE-Field {{IEsSetParam}} + +PrivateIE-Field {X2AP-PRIVATE-IES : IEsSetParam} ::= SEQUENCE { + id X2AP-PRIVATE-IES.&id ({IEsSetParam}), + criticality X2AP-PRIVATE-IES.&criticality ({IEsSetParam}{@id}), + value X2AP-PRIVATE-IES.&Value ({IEsSetParam}{@id}) +} + +END + diff --git a/openair2/X2AP/x2ap_common.c b/openair2/X2AP/x2ap_common.c index d92f2c69bb..762ba810c7 100644 --- a/openair2/X2AP/x2ap_common.c +++ b/openair2/X2AP/x2ap_common.c @@ -29,7 +29,7 @@ #include #include "x2ap_common.h" -#include "X2AP-PDU.h" +#include "X2AP_X2AP-PDU.h" int asn_debug = 0; int asn1_xer_print = 0; @@ -55,29 +55,27 @@ inline void ASN_DEBUG(const char *fmt, ...) ssize_t x2ap_generate_initiating_message( uint8_t **buffer, uint32_t *length, - X2ap_ProcedureCode_t procedureCode, - X2ap_Criticality_t criticality, + X2AP_ProcedureCode_t procedureCode, + X2AP_Criticality_t criticality, asn_TYPE_descriptor_t *td, void *sptr) { - X2AP_PDU_t pdu; + X2AP_X2AP_PDU_t pdu; ssize_t encoded; - - memset(&pdu, 0, sizeof(X2AP_PDU_t)); - - pdu.present = X2AP_PDU_PR_initiatingMessage; + memset(&pdu, 0, sizeof(X2AP_X2AP_PDU_t)); + pdu.present = X2AP_X2AP_PDU_PR_initiatingMessage; pdu.choice.initiatingMessage.procedureCode = procedureCode; pdu.choice.initiatingMessage.criticality = criticality; ANY_fromType_aper(&pdu.choice.initiatingMessage.value, td, sptr); if (asn1_xer_print) { - xer_fprint(stdout, &asn_DEF_X2AP_PDU, (void *)&pdu); + xer_fprint(stdout, &asn_DEF_X2AP_X2AP_PDU, (void *)&pdu); } /* We can safely free list of IE from sptr */ ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr); - if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_PDU, 0, &pdu, + if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_X2AP_PDU, 0, &pdu, (void **)buffer)) < 0) { return -1; } @@ -89,107 +87,67 @@ ssize_t x2ap_generate_initiating_message( ssize_t x2ap_generate_successfull_outcome( uint8_t **buffer, uint32_t *length, - X2ap_ProcedureCode_t procedureCode, - X2ap_Criticality_t criticality, + X2AP_ProcedureCode_t procedureCode, + X2AP_Criticality_t criticality, asn_TYPE_descriptor_t *td, void *sptr) { - X2AP_PDU_t pdu; + X2AP_X2AP_PDU_t pdu; ssize_t encoded; - - memset(&pdu, 0, sizeof(X2AP_PDU_t)); - - pdu.present = X2AP_PDU_PR_successfulOutcome; + memset(&pdu, 0, sizeof(X2AP_X2AP_PDU_t)); + pdu.present = X2AP_X2AP_PDU_PR_successfulOutcome; pdu.choice.successfulOutcome.procedureCode = procedureCode; pdu.choice.successfulOutcome.criticality = criticality; ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr); if (asn1_xer_print) { - xer_fprint(stdout, &asn_DEF_X2AP_PDU, (void *)&pdu); + xer_fprint(stdout, &asn_DEF_X2AP_X2AP_PDU, (void *)&pdu); } /* We can safely free list of IE from sptr */ ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr); - if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_PDU, 0, &pdu, + if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_X2AP_PDU, 0, &pdu, (void **)buffer)) < 0) { return -1; } *length = encoded; - return encoded; } ssize_t x2ap_generate_unsuccessfull_outcome( uint8_t **buffer, uint32_t *length, - X2ap_ProcedureCode_t procedureCode, - X2ap_Criticality_t criticality, + X2AP_ProcedureCode_t procedureCode, + X2AP_Criticality_t criticality, asn_TYPE_descriptor_t *td, void *sptr) { - X2AP_PDU_t pdu; + X2AP_X2AP_PDU_t pdu; ssize_t encoded; - - memset(&pdu, 0, sizeof(X2AP_PDU_t)); - - pdu.present = X2AP_PDU_PR_unsuccessfulOutcome; + memset(&pdu, 0, sizeof(X2AP_X2AP_PDU_t)); + pdu.present = X2AP_X2AP_PDU_PR_unsuccessfulOutcome; pdu.choice.successfulOutcome.procedureCode = procedureCode; pdu.choice.successfulOutcome.criticality = criticality; ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr); if (asn1_xer_print) { - xer_fprint(stdout, &asn_DEF_X2AP_PDU, (void *)&pdu); + xer_fprint(stdout, &asn_DEF_X2AP_X2AP_PDU, (void *)&pdu); } /* We can safely free list of IE from sptr */ ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr); - if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_PDU, 0, &pdu, + if ((encoded = aper_encode_to_new_buffer(&asn_DEF_X2AP_X2AP_PDU, 0, &pdu, (void **)buffer)) < 0) { return -1; } *length = encoded; - return encoded; } -X2ap_IE_t *x2ap_new_ie( - X2ap_ProtocolIE_ID_t id, - X2ap_Criticality_t criticality, - asn_TYPE_descriptor_t *type, - void *sptr) +void x2ap_handle_criticality(X2AP_Criticality_t criticality) { - X2ap_IE_t *buff; - - if ((buff = malloc(sizeof(X2ap_IE_t))) == NULL) { - // Possible error on malloc - return NULL; - } - - memset((void *)buff, 0, sizeof(X2ap_IE_t)); - - buff->id = id; - buff->criticality = criticality; - - if (ANY_fromType_aper(&buff->value, type, sptr) < 0) { - fprintf(stderr, "Encoding of %s failed\n", type->name); - free(buff); - return NULL; - } - - if (asn1_xer_print) - if (xer_fprint(stdout, &asn_DEF_X2ap_IE, buff) < 0) { - free(buff); - return NULL; - } - - return buff; -} - -void x2ap_handle_criticality(X2ap_Criticality_t criticality) -{ - } diff --git a/openair2/X2AP/x2ap_common.h b/openair2/X2AP/x2ap_common.h index b7c9361476..6843e2913f 100644 --- a/openair2/X2AP/x2ap_common.h +++ b/openair2/X2AP/x2ap_common.h @@ -23,247 +23,17 @@ # include "config.h" #endif -#include "X2ap-ABSInformationFDD.h" -#include "X2ap-ABSInformation.h" -#include "X2ap-ABSInformationTDD.h" -#include "X2ap-ABS-Status.h" -#include "X2ap-ActivatedCellList.h" -#include "X2ap-AllocationAndRetentionPriority.h" -#include "X2ap-AreaScopeOfMDT.h" -#include "X2ap-AS-SecurityInformation.h" -#include "X2ap-BandInfo.h" -#include "X2ap-BitRate.h" -#include "X2ap-BroadcastPLMNs-Item.h" - -#include "X2ap-CapacityValue.h" -#include "X2ap-Cause.h" -#include "X2ap-CauseMisc.h" -#include "X2ap-CauseProtocol.h" -#include "X2ap-CauseRadioNetwork.h" -#include "X2ap-CauseTransport.h" -#include "X2ap-CellActivationFailure.h" -#include "X2ap-CellActivationRequest.h" -#include "X2ap-CellActivationResponse.h" -#include "X2ap-CellBasedMDT.h" -#include "X2ap-CellCapacityClassValue.h" -#include "X2ap-CellIdListforMDT.h" -#include "X2ap-CellInformation-Item.h" -#include "X2ap-CellInformation-List.h" -#include "X2ap-Cell-Size.h" -#include "X2ap-CellToReport-Item.h" -#include "X2ap-CellToReport-List.h" -#include "X2ap-CellType.h" -#include "X2ap-CellMeasurementResult-Item.h" -#include "X2ap-CellMeasurementResult-List.h" -#include "X2ap-CompleteFailureCauseInformation-Item.h" -#include "X2ap-CompleteFailureCauseInformation-List.h" -#include "X2ap-CompositeAvailableCapacityGroup.h" -#include "X2ap-CompositeAvailableCapacity.h" -#include "X2ap-COUNTvalue.h" -#include "X2ap-CriticalityDiagnostics.h" -#include "X2ap-CriticalityDiagnostics-IE-List.h" -#include "X2ap-Criticality.h" -#include "X2ap-CRNTI.h" -#include "X2ap-CSG-Id.h" -#include "X2ap-CSGMembershipStatus.h" -#include "X2ap-CyclicPrefixDL.h" -#include "X2ap-CyclicPrefixUL.h" -#include "X2ap-DeactivationIndication.h" -#include "X2ap-DL-ABS-status.h" -#include "X2ap-DL-Forwarding.h" -#include "X2ap-DL-GBR-PRB-usage.h" -#include "X2ap-DL-non-GBR-PRB-usage.h" -#include "X2ap-DL-Total-PRB-usage.h" -#include "X2ap-EARFCN.h" -#include "X2ap-ECGI.h" -#include "X2ap-ENB-ID.h" -#include "X2ap-ENBConfigurationUpdateFailure.h" -#include "X2ap-ENBConfigurationUpdateAcknowledge.h" -#include "X2ap-ENBConfigurationUpdate.h" -#include "X2ap-EncryptionAlgorithms.h" -#include "X2ap-EPLMNs.h" -#include "X2ap-E-RAB-ID.h" -#include "X2ap-E-RAB-Item.h" -#include "X2ap-E-RABs-Admitted-List.h" -#include "X2ap-E-RAB-Level-QoS-Parameters.h" -#include "X2ap-E-RAB-List.h" -#include "X2ap-E-RABs-SubjectToStatusTransfer-Item.h" -#include "X2ap-E-RABs-Admitted-Item.h" -#include "X2ap-E-RABs-SubjectToStatusTransfer-List.h" -#include "X2ap-ErrorIndication.h" -#include "X2ap-EUTRA-Mode-Info.h" -#include "X2ap-EUTRANCellIdentifier.h" -#include "X2ap-EUTRANTraceID.h" -#include "X2ap-EventType.h" - -#include "X2ap-FDD-Info.h" -#include "X2ap-ForbiddenInterRATs.h" -#include "X2ap-ForbiddenLACs.h" -#include "X2ap-ForbiddenLAs.h" -#include "X2ap-ForbiddenLAs-Item.h" -#include "X2ap-ForbiddenTACs.h" -#include "X2ap-ForbiddenTAs.h" -#include "X2ap-ForbiddenTAs-Item.h" -#include "X2ap-Fourframes.h" -#include "X2ap-FreqBandIndicator.h" -#include "X2ap-GBR-QosInformation.h" -#include "X2ap-GlobalENB-ID.h" -#include "X2ap-GTP-TEI.h" -#include "X2ap-GTPtunnelEndpoint.h" -#include "X2ap-GU-Group-ID.h" -#include "X2ap-GUGroupIDList.h" -#include "X2ap-GUMMEI.h" -#include "X2ap-HandoverCancel.h" -#include "X2ap-HandoverReportType.h" -#include "X2ap-HandoverRequest.h" -#include "X2ap-HandoverReport.h" -#include "X2ap-HandoverRestrictionList.h" -#include "X2ap-HandoverPreparationFailure.h" -#include "X2ap-HandoverRequestAcknowledge.h" - -#include "X2ap-HFN.h" -#include "X2ap-HWLoadIndicator.h" -#include "X2ap-IE-Extensions.h" -#include "X2ap-IE.h" -#include "X2ap-IntegrityProtectionAlgorithms.h" -#include "X2ap-InterfacesToTrace.h" -#include "X2ap-InvokeIndication.h" -#include "X2ap-Key-eNodeB-Star.h" -#include "X2ap-LAC.h" -#include "X2ap-LastVisitedCell-Item.h" -#include "X2ap-LastVisitedEUTRANCellInformation.h" -#include "X2ap-LastVisitedGERANCellInformation.h" -#include "X2ap-LastVisitedUTRANCellInformation.h" -#include "X2ap-LoadIndicator.h" -#include "X2ap-LoadInformation.h" -#include "X2ap-LocationReportingInformation.h" -#include "X2ap-ManagementBasedMDTallowed.h" -#include "X2ap-MBMS-Service-Area-Identity.h" -#include "X2ap-MBMS-Service-Area-Identity-List.h" -#include "X2ap-MBSFN-Subframe-Info.h" -#include "X2ap-MBSFN-Subframe-Infolist.h" -#include "X2ap-MDT-Activation.h" -#include "X2ap-MDT-Configuration.h" -#include "X2ap-Measurement-ID.h" -#include "X2ap-MeasurementsToActivate.h" -#include "X2ap-MeasurementThresholdA2.h" -#include "X2ap-MeasurementInitiationResult-Item.h" -#include "X2ap-MeasurementInitiationResult-List.h" - -#include "X2ap-MeasurementFailureCause-Item.h" -#include "X2ap-MME-Code.h" -#include "X2ap-MME-Group-ID.h" -#include "X2ap-MobilityChangeAcknowledge.h" -#include "X2ap-MobilityChangeFailure.h" -#include "X2ap-MobilityChangeRequest.h" -#include "X2ap-MobilityParametersInformation.h" -#include "X2ap-MobilityParametersModificationRange.h" -#include "X2ap-MultibandInfoList.h" -#include "X2ap-Neighbour-Information.h" -#include "X2ap-NextHopChainingCount.h" -#include "X2ap-Number-of-Antennaports.h" -#include "X2ap-Oneframe.h" -#include "X2ap-Old-ECGIs.h" -#include "X2ap-PartialSuccessIndicator.h" -#include "X2ap-PCI.h" -#include "X2ap-PDCP-SN.h" -#include "X2AP-PDU.h" -#include "X2ap-PeriodicReportingMDT.h" -#include "X2ap-PLMN-Identity.h" -#include "X2ap-PRACH-Configuration.h" -#include "X2ap-Pre-emptionCapability.h" -#include "X2ap-Pre-emptionVulnerability.h" -#include "X2ap-Presence.h" -#include "X2ap-PriorityLevel.h" -#include "X2ap-PrivateIE-ID.h" -#include "X2ap-ProcedureCode.h" -#include "X2ap-ProtocolIE-ID.h" -#include "X2ap-QCI.h" -#include "X2ap-RadioframeAllocationOffset.h" -#include "X2ap-RadioframeAllocationPeriod.h" -#include "X2ap-RadioResourceStatus.h" -#include "X2ap-ReceiveStatusofULPDCPSDUs.h" -#include "X2ap-Registration-Request.h" -#include "X2ap-RelativeNarrowbandTxPower.h" -#include "X2ap-ReportAmountMDT.h" -#include "X2ap-ReportArea.h" -#include "X2ap-ReportCharacteristics.h" -#include "X2ap-ReportingTriggerMDT.h" -#include "X2ap-ReportIntervalMDT.h" -#include "X2ap-ReportingPeriodicity.h" -#include "X2ap-ResourceStatusFailure.h" -#include "X2ap-ResourceStatusResponse.h" -#include "X2ap-ResourceStatusUpdate.h" - -#include "X2ap-RNTP-Threshold.h" -#include "X2ap-RRCConnReestabIndicator.h" -#include "X2ap-RRCConnSetupIndicator.h" -#include "X2ap-RRC-Context.h" -#include "X2ap-RLFIndication.h" -#include "X2ap-ResourceStatusRequest.h" -#include "X2ap-S1TNLLoadIndicator.h" -//nclude "X2ap-ServedCellInformation.h" -#include "X2ap-ServedCells.h" -#include "X2ap-ServedCellsToModify.h" -#include "X2ap-ServedCellsToActivate.h" -#include "X2ap-ShortMAC-I.h" -#include "X2ap-SpecialSubframe-Info.h" -#include "X2ap-SpecialSubframePatterns.h" -#include "X2ap-SRVCCOperationPossible.h" -#include "X2ap-SubframeAllocation.h" -#include "X2ap-SubframeAssignment.h" -#include "X2ap-SubscriberProfileIDforRFP.h" -#include "X2ap-SNStatusTransfer.h" - -#include "X2ap-TABasedMDT.h" -#include "X2ap-TAC.h" -#include "X2ap-TAListforMDT.h" -#include "X2ap-TargetCellInUTRAN.h" -#include "X2ap-TargeteNBtoSource-eNBTransparentContainer.h" -#include "X2ap-TDD-Info.h" -#include "X2ap-ThresholdEventA2.h" -#include "X2ap-Threshold-RSRP.h" -#include "X2ap-Threshold-RSRQ.h" -#include "X2ap-TimeToWait.h" -#include "X2ap-Time-UE-StayedInCell-EnhancedGranularity.h" -#include "X2ap-Time-UE-StayedInCell.h" -#include "X2ap-E-RABs-ToBeSetup-Item.h" -#include "X2ap-TraceActivation.h" -#include "X2ap-TraceCollectionEntityIPAddress.h" -#include "X2ap-TraceDepth.h" -#include "X2ap-Transmission-Bandwidth.h" -#include "X2ap-TransportLayerAddress.h" -#include "X2ap-TriggeringMessage.h" -#include "X2ap-TypeOfError.h" -#include "X2ap-UEAggregateMaximumBitRate.h" -#include "X2ap-UE-ContextInformation.h" -#include "X2ap-UE-HistoryInformation.h" -#include "X2ap-UE-RLF-Report-Container.h" -#include "X2ap-UE-S1AP-ID.h" -#include "X2ap-UE-X2AP-ID.h" -#include "X2ap-UEContextRelease.h" -#include "X2ap-UESecurityCapabilities.h" -#include "X2ap-UL-GBR-PRB-usage.h" -#include "X2ap-UL-HighInterferenceIndication.h" -#include "X2ap-UL-HighInterferenceIndicationInfo.h" -#include "X2ap-UL-HighInterferenceIndicationInfo-Item.h" -#include "X2ap-UL-InterferenceOverloadIndication.h" -#include "X2ap-UL-InterferenceOverloadIndication-Item.h" -#include "X2ap-UL-non-GBR-PRB-usage.h" -#include "X2ap-UL-Total-PRB-usage.h" -#include "X2ap-UsableABSInformationFDD.h" -#include "X2ap-UsableABSInformation.h" -#include "X2ap-UsableABSInformationTDD.h" - -#include "X2ap-ResetResponse.h" -#include "X2ap-ResetRequest.h" -#include "X2SetupFailure.h" -#include "X2SetupRequest.h" -#include "X2SetupResponse.h" - -#include "X2ap-Old-ECGIs.h" -#include "X2ap-Criticality.h" -#include "X2ap-ProcedureCode.h" +#include "X2AP_ProtocolIE-Field.h" +#include "X2AP_X2AP-PDU.h" +#include "X2AP_InitiatingMessage.h" +#include "X2AP_SuccessfulOutcome.h" +#include "X2AP_UnsuccessfulOutcome.h" +#include "X2AP_ProtocolIE-Field.h" +#include "X2AP_ProtocolIE-FieldPair.h" +#include "X2AP_ProtocolIE-ContainerPair.h" +#include "X2AP_ProtocolExtensionField.h" +#include "X2AP_ProtocolExtensionContainer.h" +#include "X2AP_asn_constant.h" #ifndef X2AP_COMMON_H_ #define X2AP_COMMON_H_ @@ -323,8 +93,8 @@ typedef int (*x2ap_message_decoded_callback)( ssize_t x2ap_generate_successfull_outcome( uint8_t **buffer, uint32_t *length, - X2ap_ProcedureCode_t procedureCode, - X2ap_Criticality_t criticality, + X2AP_ProcedureCode_t procedureCode, + X2AP_Criticality_t criticality, asn_TYPE_descriptor_t *td, void *sptr); @@ -340,8 +110,8 @@ ssize_t x2ap_generate_successfull_outcome( ssize_t x2ap_generate_initiating_message( uint8_t **buffer, uint32_t *length, - X2ap_ProcedureCode_t procedureCode, - X2ap_Criticality_t criticality, + X2AP_ProcedureCode_t procedureCode, + X2AP_Criticality_t criticality, asn_TYPE_descriptor_t *td, void *sptr); @@ -357,28 +127,15 @@ ssize_t x2ap_generate_initiating_message( ssize_t x2ap_generate_unsuccessfull_outcome( uint8_t **buffer, uint32_t *length, - X2ap_ProcedureCode_t procedureCode, - X2ap_Criticality_t criticality, + X2AP_ProcedureCode_t procedureCode, + X2AP_Criticality_t criticality, asn_TYPE_descriptor_t *td, void *sptr); -/** \brief Generate a new IE - \param id Protocol ie id of the IE - \param criticality Criticality of the IE - \param type ASN1 type descriptor of the IE value - \param sptr Structure to be encoded in the value field - @returns a pointer to the newly created IE structure or NULL in case of failure - **/ -X2ap_IE_t *x2ap_new_ie( - X2ap_ProtocolIE_ID_t id, - X2ap_Criticality_t criticality, - asn_TYPE_descriptor_t *type, - void *sptr); - /** \brief Handle criticality \param criticality Criticality of the IE @returns void **/ -void x2ap_handle_criticality(X2ap_Criticality_t criticality); +void x2ap_handle_criticality(X2AP_Criticality_t criticality); #endif /* X2AP_COMMON_H_ */ diff --git a/openair3/S1AP/MESSAGES/ASN1/R14.4/s1ap-14.4.0.asn1 b/openair3/S1AP/MESSAGES/ASN1/R14.4/s1ap-14.4.0.asn1 new file mode 100755 index 0000000000..83f486a1d4 --- /dev/null +++ b/openair3/S1AP/MESSAGES/ASN1/R14.4/s1ap-14.4.0.asn1 @@ -0,0 +1,6634 @@ +-- ************************************************************** +-- +-- Elementary Procedure definitions +-- +-- ************************************************************** + +S1AP-PDU-Descriptions { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +eps-Access (21) modules (3) s1ap (1) version1 (1) s1ap-PDU-Descriptions (0)} + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Criticality, + ProcedureCode +FROM S1AP-CommonDataTypes + + CellTrafficTrace, + DeactivateTrace, + DownlinkUEAssociatedLPPaTransport, + DownlinkNASTransport, + DownlinkNonUEAssociatedLPPaTransport, + DownlinkS1cdma2000tunnelling, + ENBDirectInformationTransfer, + ENBStatusTransfer, + ENBConfigurationUpdate, + ENBConfigurationUpdateAcknowledge, + ENBConfigurationUpdateFailure, + ErrorIndication, + HandoverCancel, + HandoverCancelAcknowledge, + HandoverCommand, + HandoverFailure, + HandoverNotify, + HandoverPreparationFailure, + HandoverRequest, + HandoverRequestAcknowledge, + HandoverRequired, + InitialContextSetupFailure, + InitialContextSetupRequest, + InitialContextSetupResponse, + InitialUEMessage, + KillRequest, + KillResponse, + LocationReportingControl, + LocationReportingFailureIndication, + LocationReport, + MMEConfigurationUpdate, + MMEConfigurationUpdateAcknowledge, + MMEConfigurationUpdateFailure, + MMEDirectInformationTransfer, + MMEStatusTransfer, + NASNonDeliveryIndication, + OverloadStart, + OverloadStop, + Paging, + PathSwitchRequest, + PathSwitchRequestAcknowledge, + PathSwitchRequestFailure, + PrivateMessage, + Reset, + ResetAcknowledge, + S1SetupFailure, + S1SetupRequest, + S1SetupResponse, + E-RABModifyRequest, + E-RABModifyResponse, + E-RABModificationIndication, + E-RABModificationConfirm, + E-RABReleaseCommand, + E-RABReleaseResponse, + E-RABReleaseIndication, + E-RABSetupRequest, + E-RABSetupResponse, + TraceFailureIndication, + TraceStart, + UECapabilityInfoIndication, + UEContextModificationFailure, + UEContextModificationRequest, + UEContextModificationResponse, + UEContextReleaseCommand, + UEContextReleaseComplete, + UEContextReleaseRequest, + UERadioCapabilityMatchRequest, + UERadioCapabilityMatchResponse, + UplinkUEAssociatedLPPaTransport, + UplinkNASTransport, + UplinkNonUEAssociatedLPPaTransport, + UplinkS1cdma2000tunnelling, + WriteReplaceWarningRequest, + WriteReplaceWarningResponse, + ENBConfigurationTransfer, + MMEConfigurationTransfer, + PWSRestartIndication, + UEContextModificationIndication, + UEContextModificationConfirm, + RerouteNASRequest, + PWSFailureIndication, + UEContextSuspendRequest, + UEContextSuspendResponse, + UEContextResumeRequest, + UEContextResumeResponse, + UEContextResumeFailure, + ConnectionEstablishmentIndication, + NASDeliveryIndication, + RetrieveUEInformation, + UEInformationTransfer, + ENBCPRelocationIndication, + MMECPRelocationIndication + + +FROM S1AP-PDU-Contents + + id-CellTrafficTrace, + id-DeactivateTrace, + id-downlinkUEAssociatedLPPaTransport, + id-downlinkNASTransport, + id-downlinkNonUEAssociatedLPPaTransport, + id-DownlinkS1cdma2000tunnelling, + id-eNBStatusTransfer, + id-ErrorIndication, + id-HandoverCancel, + id-HandoverNotification, + id-HandoverPreparation, + id-HandoverResourceAllocation, + id-InitialContextSetup, + id-initialUEMessage, + id-ENBConfigurationUpdate, + id-Kill, + id-LocationReportingControl, + id-LocationReportingFailureIndication, + id-LocationReport, + id-eNBDirectInformationTransfer, + id-MMEConfigurationUpdate, + id-MMEDirectInformationTransfer, + id-MMEStatusTransfer, + id-NASNonDeliveryIndication, + id-OverloadStart, + id-OverloadStop, + id-Paging, + id-PathSwitchRequest, + id-PrivateMessage, + id-Reset, + id-S1Setup, + id-E-RABModify, + id-E-RABModificationIndication, + id-E-RABRelease, + id-E-RABReleaseIndication, + id-E-RABSetup, + id-TraceFailureIndication, + id-TraceStart, + id-UECapabilityInfoIndication, + id-UEContextModification, + id-UEContextRelease, + id-UEContextReleaseRequest, + id-UERadioCapabilityMatch, + id-uplinkUEAssociatedLPPaTransport, + id-uplinkNASTransport, + id-uplinkNonUEAssociatedLPPaTransport, + id-UplinkS1cdma2000tunnelling, + id-WriteReplaceWarning, + id-eNBConfigurationTransfer, + id-MMEConfigurationTransfer, + id-PWSRestartIndication, + id-UEContextModificationIndication, + id-RerouteNASRequest, + id-PWSFailureIndication, + id-UEContextSuspend, + id-UEContextResume, + id-ConnectionEstablishmentIndication, + id-NASDeliveryIndication, + id-RetrieveUEInformation, + id-UEInformationTransfer, + id-eNBCPRelocationIndication, + id-MMECPRelocationIndication + + +FROM S1AP-Constants; + + +-- ************************************************************** +-- +-- Interface Elementary Procedure Class +-- +-- ************************************************************** + +S1AP-ELEMENTARY-PROCEDURE ::= CLASS { + &InitiatingMessage , + &SuccessfulOutcome OPTIONAL, + &UnsuccessfulOutcome OPTIONAL, + &procedureCode ProcedureCode UNIQUE, + &criticality Criticality DEFAULT ignore +} +WITH SYNTAX { + INITIATING MESSAGE &InitiatingMessage + [SUCCESSFUL OUTCOME &SuccessfulOutcome] + [UNSUCCESSFUL OUTCOME &UnsuccessfulOutcome] + PROCEDURE CODE &procedureCode + [CRITICALITY &criticality] +} + +-- ************************************************************** +-- +-- Interface PDU Definition +-- +-- ************************************************************** + +S1AP-PDU ::= CHOICE { + initiatingMessage InitiatingMessage, + successfulOutcome SuccessfulOutcome, + unsuccessfulOutcome UnsuccessfulOutcome, + ... +} + +InitiatingMessage ::= SEQUENCE { + procedureCode S1AP-ELEMENTARY-PROCEDURE.&procedureCode ({S1AP-ELEMENTARY-PROCEDURES}), + criticality S1AP-ELEMENTARY-PROCEDURE.&criticality ({S1AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value S1AP-ELEMENTARY-PROCEDURE.&InitiatingMessage ({S1AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +SuccessfulOutcome ::= SEQUENCE { + procedureCode S1AP-ELEMENTARY-PROCEDURE.&procedureCode ({S1AP-ELEMENTARY-PROCEDURES}), + criticality S1AP-ELEMENTARY-PROCEDURE.&criticality ({S1AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value S1AP-ELEMENTARY-PROCEDURE.&SuccessfulOutcome ({S1AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +UnsuccessfulOutcome ::= SEQUENCE { + procedureCode S1AP-ELEMENTARY-PROCEDURE.&procedureCode ({S1AP-ELEMENTARY-PROCEDURES}), + criticality S1AP-ELEMENTARY-PROCEDURE.&criticality ({S1AP-ELEMENTARY-PROCEDURES}{@procedureCode}), + value S1AP-ELEMENTARY-PROCEDURE.&UnsuccessfulOutcome ({S1AP-ELEMENTARY-PROCEDURES}{@procedureCode}) +} + +-- ************************************************************** +-- +-- Interface Elementary Procedure List +-- +-- ************************************************************** + +S1AP-ELEMENTARY-PROCEDURES S1AP-ELEMENTARY-PROCEDURE ::= { + S1AP-ELEMENTARY-PROCEDURES-CLASS-1 | + S1AP-ELEMENTARY-PROCEDURES-CLASS-2, + ... +} + + +S1AP-ELEMENTARY-PROCEDURES-CLASS-1 S1AP-ELEMENTARY-PROCEDURE ::= { + handoverPreparation | + handoverResourceAllocation | + pathSwitchRequest | + e-RABSetup | + e-RABModify | + e-RABRelease | + initialContextSetup | + handoverCancel | + kill | + reset | + s1Setup | + uEContextModification | + uEContextRelease | + eNBConfigurationUpdate | + mMEConfigurationUpdate | + writeReplaceWarning , + ..., + uERadioCapabilityMatch | + e-RABModificationIndication | + uEContextModificationIndication | + uEContextSuspend | + uEContextResume +} + +S1AP-ELEMENTARY-PROCEDURES-CLASS-2 S1AP-ELEMENTARY-PROCEDURE ::= { + handoverNotification | + e-RABReleaseIndication | + paging | + downlinkNASTransport | + initialUEMessage | + uplinkNASTransport | + errorIndication | + nASNonDeliveryIndication | + uEContextReleaseRequest | + downlinkS1cdma2000tunnelling | + uplinkS1cdma2000tunnelling | + uECapabilityInfoIndication | + eNBStatusTransfer | + mMEStatusTransfer | + deactivateTrace | + traceStart | + traceFailureIndication | + cellTrafficTrace | + locationReportingControl | + locationReportingFailureIndication | + locationReport | + overloadStart | + overloadStop | + eNBDirectInformationTransfer | + mMEDirectInformationTransfer | + eNBConfigurationTransfer | + mMEConfigurationTransfer | + privateMessage , + ..., + downlinkUEAssociatedLPPaTransport | + uplinkUEAssociatedLPPaTransport | + downlinkNonUEAssociatedLPPaTransport | + uplinkNonUEAssociatedLPPaTransport | + pWSRestartIndication | + rerouteNASRequest | + pWSFailureIndication | + connectionEstablishmentIndication | + nASDeliveryIndication | + retrieveUEInformation | + uEInformationTransfer | + eNBCPRelocationIndication | + mMECPRelocationIndication +} + +-- ************************************************************** +-- +-- Interface Elementary Procedures +-- +-- ************************************************************** + +handoverPreparation S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE HandoverRequired + SUCCESSFUL OUTCOME HandoverCommand + UNSUCCESSFUL OUTCOME HandoverPreparationFailure + PROCEDURE CODE id-HandoverPreparation + CRITICALITY reject +} + +handoverResourceAllocation S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE HandoverRequest + SUCCESSFUL OUTCOME HandoverRequestAcknowledge + UNSUCCESSFUL OUTCOME HandoverFailure + PROCEDURE CODE id-HandoverResourceAllocation + CRITICALITY reject +} + +handoverNotification S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE HandoverNotify + PROCEDURE CODE id-HandoverNotification + CRITICALITY ignore +} + +pathSwitchRequest S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PathSwitchRequest + SUCCESSFUL OUTCOME PathSwitchRequestAcknowledge + UNSUCCESSFUL OUTCOME PathSwitchRequestFailure + PROCEDURE CODE id-PathSwitchRequest + CRITICALITY reject +} + +e-RABSetup S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE E-RABSetupRequest + SUCCESSFUL OUTCOME E-RABSetupResponse + PROCEDURE CODE id-E-RABSetup + CRITICALITY reject +} + +e-RABModify S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE E-RABModifyRequest + SUCCESSFUL OUTCOME E-RABModifyResponse + PROCEDURE CODE id-E-RABModify + CRITICALITY reject +} + +e-RABRelease S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE E-RABReleaseCommand + SUCCESSFUL OUTCOME E-RABReleaseResponse + PROCEDURE CODE id-E-RABRelease + CRITICALITY reject +} + +e-RABReleaseIndication S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE E-RABReleaseIndication + PROCEDURE CODE id-E-RABReleaseIndication + CRITICALITY ignore +} + +initialContextSetup S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE InitialContextSetupRequest + SUCCESSFUL OUTCOME InitialContextSetupResponse + UNSUCCESSFUL OUTCOME InitialContextSetupFailure + PROCEDURE CODE id-InitialContextSetup + CRITICALITY reject +} + +uEContextReleaseRequest S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextReleaseRequest + PROCEDURE CODE id-UEContextReleaseRequest + CRITICALITY ignore +} + +paging S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE Paging + PROCEDURE CODE id-Paging + CRITICALITY ignore +} + +downlinkNASTransport S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DownlinkNASTransport + PROCEDURE CODE id-downlinkNASTransport + CRITICALITY ignore +} + +initialUEMessage S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE InitialUEMessage + PROCEDURE CODE id-initialUEMessage + CRITICALITY ignore +} + +uplinkNASTransport S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UplinkNASTransport + PROCEDURE CODE id-uplinkNASTransport + CRITICALITY ignore +} +nASNonDeliveryIndication S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE NASNonDeliveryIndication + PROCEDURE CODE id-NASNonDeliveryIndication + CRITICALITY ignore +} + +handoverCancel S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE HandoverCancel + SUCCESSFUL OUTCOME HandoverCancelAcknowledge + PROCEDURE CODE id-HandoverCancel + CRITICALITY reject +} + +reset S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE Reset + SUCCESSFUL OUTCOME ResetAcknowledge + PROCEDURE CODE id-Reset + CRITICALITY reject +} + +errorIndication S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ErrorIndication + PROCEDURE CODE id-ErrorIndication + CRITICALITY ignore +} + +s1Setup S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE S1SetupRequest + SUCCESSFUL OUTCOME S1SetupResponse + UNSUCCESSFUL OUTCOME S1SetupFailure + PROCEDURE CODE id-S1Setup + CRITICALITY reject +} + +eNBConfigurationUpdate S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ENBConfigurationUpdate + SUCCESSFUL OUTCOME ENBConfigurationUpdateAcknowledge + UNSUCCESSFUL OUTCOME ENBConfigurationUpdateFailure + PROCEDURE CODE id-ENBConfigurationUpdate + CRITICALITY reject +} + +mMEConfigurationUpdate S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE MMEConfigurationUpdate + SUCCESSFUL OUTCOME MMEConfigurationUpdateAcknowledge + UNSUCCESSFUL OUTCOME MMEConfigurationUpdateFailure + PROCEDURE CODE id-MMEConfigurationUpdate + CRITICALITY reject +} + +downlinkS1cdma2000tunnelling S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DownlinkS1cdma2000tunnelling + PROCEDURE CODE id-DownlinkS1cdma2000tunnelling + CRITICALITY ignore +} + +uplinkS1cdma2000tunnelling S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UplinkS1cdma2000tunnelling + PROCEDURE CODE id-UplinkS1cdma2000tunnelling + CRITICALITY ignore +} + +uEContextModification S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextModificationRequest + SUCCESSFUL OUTCOME UEContextModificationResponse + UNSUCCESSFUL OUTCOME UEContextModificationFailure + PROCEDURE CODE id-UEContextModification + CRITICALITY reject +} + +uECapabilityInfoIndication S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UECapabilityInfoIndication + PROCEDURE CODE id-UECapabilityInfoIndication + CRITICALITY ignore +} + +uEContextRelease S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextReleaseCommand + SUCCESSFUL OUTCOME UEContextReleaseComplete + PROCEDURE CODE id-UEContextRelease + CRITICALITY reject +} + +eNBStatusTransfer S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ENBStatusTransfer + PROCEDURE CODE id-eNBStatusTransfer + CRITICALITY ignore +} + +mMEStatusTransfer S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE MMEStatusTransfer + PROCEDURE CODE id-MMEStatusTransfer + CRITICALITY ignore +} + +deactivateTrace S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DeactivateTrace + PROCEDURE CODE id-DeactivateTrace + CRITICALITY ignore +} + +traceStart S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE TraceStart + PROCEDURE CODE id-TraceStart + CRITICALITY ignore +} + +traceFailureIndication S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE TraceFailureIndication + PROCEDURE CODE id-TraceFailureIndication + CRITICALITY ignore +} +cellTrafficTrace S1AP-ELEMENTARY-PROCEDURE ::={ + INITIATING MESSAGE CellTrafficTrace + PROCEDURE CODE id-CellTrafficTrace + CRITICALITY ignore +} + +locationReportingControl S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE LocationReportingControl + PROCEDURE CODE id-LocationReportingControl + CRITICALITY ignore +} + +locationReportingFailureIndication S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE LocationReportingFailureIndication + PROCEDURE CODE id-LocationReportingFailureIndication + CRITICALITY ignore +} + +locationReport S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE LocationReport + PROCEDURE CODE id-LocationReport + CRITICALITY ignore +} + +overloadStart S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE OverloadStart + PROCEDURE CODE id-OverloadStart + CRITICALITY ignore +} + +overloadStop S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE OverloadStop + PROCEDURE CODE id-OverloadStop + CRITICALITY reject +} + +writeReplaceWarning S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE WriteReplaceWarningRequest + SUCCESSFUL OUTCOME WriteReplaceWarningResponse + PROCEDURE CODE id-WriteReplaceWarning + CRITICALITY reject +} + +eNBDirectInformationTransfer S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ENBDirectInformationTransfer + PROCEDURE CODE id-eNBDirectInformationTransfer + CRITICALITY ignore +} + +mMEDirectInformationTransfer S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE MMEDirectInformationTransfer + PROCEDURE CODE id-MMEDirectInformationTransfer + CRITICALITY ignore +} + +eNBConfigurationTransfer S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ENBConfigurationTransfer + PROCEDURE CODE id-eNBConfigurationTransfer + CRITICALITY ignore +} + +mMEConfigurationTransfer S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE MMEConfigurationTransfer + PROCEDURE CODE id-MMEConfigurationTransfer + CRITICALITY ignore +} + + +privateMessage S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PrivateMessage + PROCEDURE CODE id-PrivateMessage + CRITICALITY ignore +} + +pWSRestartIndication S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PWSRestartIndication + PROCEDURE CODE id-PWSRestartIndication + CRITICALITY ignore +} + +kill S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE KillRequest + SUCCESSFUL OUTCOME KillResponse + PROCEDURE CODE id-Kill + CRITICALITY reject +} + +downlinkUEAssociatedLPPaTransport S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DownlinkUEAssociatedLPPaTransport + PROCEDURE CODE id-downlinkUEAssociatedLPPaTransport + CRITICALITY ignore +} + +uplinkUEAssociatedLPPaTransport S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UplinkUEAssociatedLPPaTransport + PROCEDURE CODE id-uplinkUEAssociatedLPPaTransport + CRITICALITY ignore +} +downlinkNonUEAssociatedLPPaTransport S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE DownlinkNonUEAssociatedLPPaTransport + PROCEDURE CODE id-downlinkNonUEAssociatedLPPaTransport + CRITICALITY ignore +} + +uplinkNonUEAssociatedLPPaTransport S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UplinkNonUEAssociatedLPPaTransport + PROCEDURE CODE id-uplinkNonUEAssociatedLPPaTransport + CRITICALITY ignore +} + +uERadioCapabilityMatch S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UERadioCapabilityMatchRequest + SUCCESSFUL OUTCOME UERadioCapabilityMatchResponse + PROCEDURE CODE id-UERadioCapabilityMatch + CRITICALITY reject +} + +e-RABModificationIndication S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE E-RABModificationIndication + SUCCESSFUL OUTCOME E-RABModificationConfirm + PROCEDURE CODE id-E-RABModificationIndication + CRITICALITY reject +} + +uEContextModificationIndication S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextModificationIndication + SUCCESSFUL OUTCOME UEContextModificationConfirm + PROCEDURE CODE id-UEContextModificationIndication + CRITICALITY reject +} + +rerouteNASRequest S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RerouteNASRequest + PROCEDURE CODE id-RerouteNASRequest + CRITICALITY reject +} + +pWSFailureIndication S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE PWSFailureIndication + PROCEDURE CODE id-PWSFailureIndication + CRITICALITY ignore +} + +uEContextSuspend S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextSuspendRequest + SUCCESSFUL OUTCOME UEContextSuspendResponse + PROCEDURE CODE id-UEContextSuspend + CRITICALITY reject +} + +uEContextResume S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEContextResumeRequest + SUCCESSFUL OUTCOME UEContextResumeResponse + UNSUCCESSFUL OUTCOME UEContextResumeFailure + PROCEDURE CODE id-UEContextResume + CRITICALITY reject +} + +connectionEstablishmentIndication S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ConnectionEstablishmentIndication + PROCEDURE CODE id-ConnectionEstablishmentIndication + CRITICALITY reject +} + +nASDeliveryIndication S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE NASDeliveryIndication + PROCEDURE CODE id-NASDeliveryIndication + CRITICALITY ignore +} + +retrieveUEInformation S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE RetrieveUEInformation + PROCEDURE CODE id-RetrieveUEInformation + CRITICALITY reject +} + +uEInformationTransfer S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE UEInformationTransfer + PROCEDURE CODE id-UEInformationTransfer + CRITICALITY reject +} + +eNBCPRelocationIndication S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE ENBCPRelocationIndication + PROCEDURE CODE id-eNBCPRelocationIndication + CRITICALITY reject +} + +mMECPRelocationIndication S1AP-ELEMENTARY-PROCEDURE ::= { + INITIATING MESSAGE MMECPRelocationIndication + PROCEDURE CODE id-MMECPRelocationIndication + CRITICALITY reject +} + + +END + + + +-- ************************************************************** +-- +-- PDU definitions for S1AP. +-- +-- ************************************************************** + +S1AP-PDU-Contents { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +eps-Access (21) modules (3) s1ap (1) version1 (1) s1ap-PDU-Contents (1) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + + UEAggregateMaximumBitrate, + BearerType, + Cause, + CellAccessMode, + Cdma2000HORequiredIndication, + Cdma2000HOStatus, + Cdma2000OneXSRVCCInfo, + Cdma2000OneXRAND, + Cdma2000PDU, + Cdma2000RATType, + Cdma2000SectorID, + EUTRANRoundTripDelayEstimationInfo, + CNDomain, + ConcurrentWarningMessageIndicator, + CriticalityDiagnostics, + CSFallbackIndicator, + CSG-Id, + CSG-IdList, + CSGMembershipStatus, + Data-Forwarding-Not-Possible, + Direct-Forwarding-Path-Availability, + Global-ENB-ID, + EUTRAN-CGI, + ENBname, + ENB-StatusTransfer-TransparentContainer, + ENB-UE-S1AP-ID, + ExtendedRepetitionPeriod, + GTP-TEID, + GUMMEI, + GUMMEIType, + HandoverRestrictionList, + HandoverType, + Masked-IMEISV, + LAI, + LPPa-PDU, + ManagementBasedMDTAllowed, + MDTPLMNList, + MMEname, + MMERelaySupportIndicator, + MME-UE-S1AP-ID, + MSClassmark2, + MSClassmark3, + NAS-PDU, + NASSecurityParametersfromE-UTRAN, + NASSecurityParameterstoE-UTRAN, + OverloadResponse, + PagingDRX, + PagingPriority, + PLMNidentity, + ProSeAuthorized, + RIMTransfer, + RelativeMMECapacity, + RequestType, + E-RAB-ID, + E-RABLevelQoSParameters, + E-RABList, + RelayNode-Indicator, + Routing-ID, + SecurityKey, + SecurityContext, + ServedGUMMEIs, + SONConfigurationTransfer, + Source-ToTarget-TransparentContainer, + SourceBSS-ToTargetBSS-TransparentContainer, + SourceeNB-ToTargeteNB-TransparentContainer, + SourceRNC-ToTargetRNC-TransparentContainer, + SubscriberProfileIDforRFP, + SRVCCOperationNotPossible, + SRVCCOperationPossible, + SRVCCHOIndication, + SupportedTAs, + TAI, + Target-ToSource-TransparentContainer, + TargetBSS-ToSourceBSS-TransparentContainer, + TargeteNB-ToSourceeNB-TransparentContainer, + TargetID, + TargetRNC-ToSourceRNC-TransparentContainer, + TimeToWait, + TraceActivation, + TrafficLoadReductionIndication, + E-UTRAN-Trace-ID, + TransportLayerAddress, + UEIdentityIndexValue, + UEPagingID, + UERadioCapability, + UERadioCapabilityForPaging, + UE-RetentionInformation, + UE-S1AP-IDs, + UE-associatedLogicalS1-ConnectionItem, + UESecurityCapabilities, + S-TMSI, + MessageIdentifier, + SerialNumber, + WarningAreaList, + RepetitionPeriod, + NumberofBroadcastRequest, + WarningType, + WarningSecurityInfo, + DataCodingScheme, + WarningMessageContents, + BroadcastCompletedAreaList, + RRC-Establishment-Cause, + BroadcastCancelledAreaList, + PS-ServiceNotAvailable, + GUMMEIList, + Correlation-ID, + GWContextReleaseIndication, + PrivacyIndicator, + VoiceSupportMatchIndicator, + TunnelInformation, + KillAllWarningMessages, + TransportInformation, + LHN-ID, + UserLocationInformation, + AdditionalCSFallbackIndicator, + ECGIListForRestart, + TAIListForRestart, + EmergencyAreaIDListForRestart, + ExpectedUEBehaviour, + Paging-eDRXInformation, + Extended-UEIdentityIndexValue, + MME-Group-ID, + Additional-GUTI, + PWSfailedECGIList, + CellIdentifierAndCELevelForCECapableUEs, + AssistanceDataForPaging, + InformationOnRecommendedCellsAndENBsForPaging, + UE-Usage-Type, + UEUserPlaneCIoTSupportIndicator, + NB-IoT-DefaultPagingDRX, + NB-IoT-Paging-eDRXInformation, + CE-mode-B-SupportIndicator, + NB-IoT-UEIdentityIndexValue, + V2XServicesAuthorized, + DCN-ID, + ServedDCNs, + UESidelinkAggregateMaximumBitrate, + DLNASPDUDeliveryAckRequest, + Coverage-Level, + EnhancedCoverageRestricted, + DL-CP-SecurityInformation, + UL-CP-SecurityInformation + + + +FROM S1AP-IEs + + PrivateIE-Container{}, + ProtocolExtensionContainer{}, + ProtocolIE-Container{}, + ProtocolIE-ContainerList{}, + ProtocolIE-ContainerPair{}, + ProtocolIE-ContainerPairList{}, + ProtocolIE-SingleContainer{}, + S1AP-PRIVATE-IES, + S1AP-PROTOCOL-EXTENSION, + S1AP-PROTOCOL-IES, + S1AP-PROTOCOL-IES-PAIR +FROM S1AP-Containers + + + id-AssistanceDataForPaging, + id-uEaggregateMaximumBitrate, + id-BearerType, + id-Cause, + id-CellAccessMode, + id-CellIdentifierAndCELevelForCECapableUEs, + id-cdma2000HORequiredIndication, + id-cdma2000HOStatus, + id-cdma2000OneXSRVCCInfo, + id-cdma2000OneXRAND, + id-cdma2000PDU, + id-cdma2000RATType, + id-cdma2000SectorID, + id-EUTRANRoundTripDelayEstimationInfo, + id-CNDomain, + id-ConcurrentWarningMessageIndicator, + id-CriticalityDiagnostics, + id-CSFallbackIndicator, + id-CSG-Id, + id-CSG-IdList, + id-CSGMembershipStatus, + id-Data-Forwarding-Not-Possible, + id-DefaultPagingDRX, + id-Direct-Forwarding-Path-Availability, + id-Global-ENB-ID, + id-EUTRAN-CGI, + id-eNBname, + id-eNB-StatusTransfer-TransparentContainer, + id-eNB-UE-S1AP-ID, + id-GERANtoLTEHOInformationRes, + id-GUMMEI-ID, + id-GUMMEIType, + id-HandoverRestrictionList, + id-HandoverType, + id-Masked-IMEISV, + id-InformationOnRecommendedCellsAndENBsForPaging, + id-InitialContextSetup, + id-Inter-SystemInformationTransferTypeEDT, + id-Inter-SystemInformationTransferTypeMDT, + id-LPPa-PDU, + id-NAS-DownlinkCount, + id-ManagementBasedMDTAllowed, + id-ManagementBasedMDTPLMNList, + id-MMEname, + id-MME-UE-S1AP-ID, + id-MSClassmark2, + id-MSClassmark3, + id-NAS-PDU, + id-NASSecurityParametersfromE-UTRAN, + id-NASSecurityParameterstoE-UTRAN, + id-OverloadResponse, + id-pagingDRX, + id-PagingPriority, + id-RelativeMMECapacity, + id-RequestType, + id-Routing-ID, + id-E-RABAdmittedItem, + id-E-RABAdmittedList, + id-E-RABDataForwardingItem, + id-E-RABFailedToModifyList, + id-E-RABFailedToReleaseList, + id-E-RABFailedtoSetupItemHOReqAck, + id-E-RABFailedToSetupListBearerSURes, + id-E-RABFailedToSetupListCtxtSURes, + id-E-RABFailedToSetupListHOReqAck, + id-E-RABFailedToBeReleasedList, + id-E-RABFailedToResumeListResumeReq, + id-E-RABFailedToResumeItemResumeReq, + id-E-RABFailedToResumeListResumeRes, + id-E-RABFailedToResumeItemResumeRes, + id-E-RABModify, + id-E-RABModifyItemBearerModRes, + id-E-RABModifyListBearerModRes, + id-E-RABRelease, + id-E-RABReleaseItemBearerRelComp, + id-E-RABReleaseItemHOCmd, + id-E-RABReleaseListBearerRelComp, + id-E-RABReleaseIndication, + id-E-RABSetup, + id-E-RABSetupItemBearerSURes, + id-E-RABSetupItemCtxtSURes, + id-E-RABSetupListBearerSURes, + id-E-RABSetupListCtxtSURes, + id-E-RABSubjecttoDataForwardingList, + id-E-RABToBeModifiedItemBearerModReq, + id-E-RABToBeModifiedListBearerModReq, + id-E-RABToBeModifiedListBearerModInd, + id-E-RABToBeModifiedItemBearerModInd, + id-E-RABNotToBeModifiedListBearerModInd, + id-E-RABNotToBeModifiedItemBearerModInd, + id-E-RABModifyListBearerModConf, + id-E-RABModifyItemBearerModConf, + id-E-RABFailedToModifyListBearerModConf, + id-E-RABToBeReleasedListBearerModConf, + id-E-RABToBeReleasedList, + id-E-RABReleasedList, + id-E-RABToBeSetupItemBearerSUReq, + id-E-RABToBeSetupItemCtxtSUReq, + id-E-RABToBeSetupItemHOReq, + id-E-RABToBeSetupListBearerSUReq, + id-E-RABToBeSetupListCtxtSUReq, + id-E-RABToBeSetupListHOReq, + id-E-RABToBeSwitchedDLItem, + id-E-RABToBeSwitchedDLList, + id-E-RABToBeSwitchedULList, + id-E-RABToBeSwitchedULItem, + id-E-RABtoReleaseListHOCmd, + id-ProSeAuthorized, + id-SecurityKey, + id-SecurityContext, + id-ServedGUMMEIs, + id-SONConfigurationTransferECT, + id-SONConfigurationTransferMCT, + id-Source-ToTarget-TransparentContainer, + id-Source-ToTarget-TransparentContainer-Secondary, + id-SourceMME-UE-S1AP-ID, + id-SRVCCOperationNotPossible, + id-SRVCCOperationPossible, + id-SRVCCHOIndication, + id-SubscriberProfileIDforRFP, + id-SupportedTAs, + id-S-TMSI, + id-TAI, + id-TAIItem, + id-TAIList, + id-Target-ToSource-TransparentContainer, + id-Target-ToSource-TransparentContainer-Secondary, + id-TargetID, + id-TimeToWait, + id-TraceActivation, + id-TrafficLoadReductionIndication, + id-E-UTRAN-Trace-ID, + id-UEIdentityIndexValue, + id-UEPagingID, + id-UERadioCapability, + id-UERadioCapabilityForPaging, + id-UTRANtoLTEHOInformationRes, + id-UE-associatedLogicalS1-ConnectionListResAck, + id-UE-associatedLogicalS1-ConnectionItem, + id-UE-RetentionInformation, + id-UESecurityCapabilities, + id-UE-S1AP-IDs, + id-V2XServicesAuthorized, + id-ResetType, + id-MessageIdentifier, + id-SerialNumber, + id-WarningAreaList, + id-RepetitionPeriod, + id-NumberofBroadcastRequest, + id-WarningType, + id-WarningSecurityInfo, + id-DataCodingScheme, + id-WarningMessageContents, + id-BroadcastCompletedAreaList, + id-BroadcastCancelledAreaList, + id-RRC-Establishment-Cause, + id-TraceCollectionEntityIPAddress, + maxnoofTAIs, + maxnoofErrors, + maxnoofE-RABs, + maxnoofIndividualS1ConnectionsToReset, + maxnoofEmergencyAreaID, + maxnoofCellID, + maxnoofTAIforWarning, + maxnoofCellinTAI, + maxnoofCellinEAI, + id-ExtendedRepetitionPeriod, + id-PS-ServiceNotAvailable, + id-RegisteredLAI, + id-GUMMEIList, + id-SourceMME-GUMMEI, + id-MME-UE-S1AP-ID-2, + id-GW-TransportLayerAddress, + id-RelayNode-Indicator, + id-Correlation-ID, + id-MMERelaySupportIndicator, + id-GWContextReleaseIndication, + id-PrivacyIndicator, + id-VoiceSupportMatchIndicator, + id-Tunnel-Information-for-BBF, + id-SIPTO-Correlation-ID, + id-SIPTO-L-GW-TransportLayerAddress, + id-KillAllWarningMessages, + id-TransportInformation, + id-LHN-ID, + id-UserLocationInformation, + id-AdditionalCSFallbackIndicator, + id-ECGIListForRestart, + id-TAIListForRestart, + id-EmergencyAreaIDListForRestart, + id-ExpectedUEBehaviour, + id-Paging-eDRXInformation, + id-extended-UEIdentityIndexValue, + id-CSGMembershipInfo, + id-MME-Group-ID, + id-Additional-GUTI, + id-S1-Message, + id-PWSfailedECGIList, + id-PWSFailureIndication, + id-UE-Usage-Type, + id-UEUserPlaneCIoTSupportIndicator, + id-NB-IoT-DefaultPagingDRX, + id-NB-IoT-Paging-eDRXInformation, + id-CE-mode-B-SupportIndicator, + id-NB-IoT-UEIdentityIndexValue, + id-RRC-Resume-Cause, + id-DCN-ID, + id-ServedDCNs, + id-UESidelinkAggregateMaximumBitrate, + id-DLNASPDUDeliveryAckRequest, + id-Coverage-Level, + id-EnhancedCoverageRestricted, + id-UE-Level-QoS-Parameters, + id-DL-CP-SecurityInformation, + id-UL-CP-SecurityInformation + + +FROM S1AP-Constants; + +-- ************************************************************** +-- +-- Common Container Lists +-- +-- ************************************************************** + +E-RAB-IE-ContainerList { S1AP-PROTOCOL-IES : IEsSetParam } ::= ProtocolIE-ContainerList { 1, maxnoofE-RABs, {IEsSetParam} } +E-RAB-IE-ContainerPairList { S1AP-PROTOCOL-IES-PAIR : IEsSetParam } ::= ProtocolIE-ContainerPairList { 1, maxnoofE-RABs, {IEsSetParam} } +ProtocolError-IE-ContainerList { S1AP-PROTOCOL-IES : IEsSetParam } ::= ProtocolIE-ContainerList { 1, maxnoofE-RABs, {IEsSetParam} } + +-- ************************************************************** +-- +-- HANDOVER PREPARATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Handover Required +-- +-- ************************************************************** + +HandoverRequired ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { HandoverRequiredIEs} }, + ... +} + +HandoverRequiredIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-HandoverType CRITICALITY reject TYPE HandoverType PRESENCE mandatory}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}| + { ID id-TargetID CRITICALITY reject TYPE TargetID PRESENCE mandatory}| + { ID id-Direct-Forwarding-Path-Availability CRITICALITY ignore TYPE Direct-Forwarding-Path-Availability PRESENCE optional}| + { ID id-SRVCCHOIndication CRITICALITY reject TYPE SRVCCHOIndication PRESENCE optional}| + { ID id-Source-ToTarget-TransparentContainer CRITICALITY reject TYPE Source-ToTarget-TransparentContainer PRESENCE mandatory}| + { ID id-Source-ToTarget-TransparentContainer-Secondary CRITICALITY reject TYPE Source-ToTarget-TransparentContainer PRESENCE optional}| + { ID id-MSClassmark2 CRITICALITY reject TYPE MSClassmark2 PRESENCE conditional}| + { ID id-MSClassmark3 CRITICALITY ignore TYPE MSClassmark3 PRESENCE conditional}| + { ID id-CSG-Id CRITICALITY reject TYPE CSG-Id PRESENCE optional}| + { ID id-CellAccessMode CRITICALITY reject TYPE CellAccessMode PRESENCE optional}| + { ID id-PS-ServiceNotAvailable CRITICALITY ignore TYPE PS-ServiceNotAvailable PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- Handover Command +-- +-- ************************************************************** + +HandoverCommand ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { HandoverCommandIEs} }, + ... +} + +HandoverCommandIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-HandoverType CRITICALITY reject TYPE HandoverType PRESENCE mandatory}| + { ID id-NASSecurityParametersfromE-UTRAN CRITICALITY reject TYPE NASSecurityParametersfromE-UTRAN PRESENCE conditional + -- This IE shall be present if HandoverType IE is set to value "LTEtoUTRAN" or "LTEtoGERAN" --}| + { ID id-E-RABSubjecttoDataForwardingList CRITICALITY ignore TYPE E-RABSubjecttoDataForwardingList PRESENCE optional}| + { ID id-E-RABtoReleaseListHOCmd CRITICALITY ignore TYPE E-RABList PRESENCE optional}| + { ID id-Target-ToSource-TransparentContainer CRITICALITY reject TYPE Target-ToSource-TransparentContainer PRESENCE mandatory}| + { ID id-Target-ToSource-TransparentContainer-Secondary CRITICALITY reject TYPE Target-ToSource-TransparentContainer PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + +E-RABSubjecttoDataForwardingList ::= E-RAB-IE-ContainerList { {E-RABDataForwardingItemIEs} } + +E-RABDataForwardingItemIEs S1AP-PROTOCOL-IES ::= { + { ID id-E-RABDataForwardingItem CRITICALITY ignore TYPE E-RABDataForwardingItem PRESENCE mandatory }, + ... +} + +E-RABDataForwardingItem ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + dL-transportLayerAddress TransportLayerAddress OPTIONAL, + dL-gTP-TEID GTP-TEID OPTIONAL, + uL-TransportLayerAddress TransportLayerAddress OPTIONAL, + uL-GTP-TEID GTP-TEID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { E-RABDataForwardingItem-ExtIEs} } OPTIONAL, + ... +} + +E-RABDataForwardingItem-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + + + +-- ************************************************************** +-- +-- Handover Preparation Failure +-- +-- ************************************************************** + +HandoverPreparationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { HandoverPreparationFailureIEs} }, + ... +} + +HandoverPreparationFailureIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY ignore TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- HANDOVER RESOURCE ALLOCATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Handover Request +-- +-- ************************************************************** + +HandoverRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {HandoverRequestIEs} }, + ... +} + +HandoverRequestIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-HandoverType CRITICALITY reject TYPE HandoverType PRESENCE mandatory}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}| + { ID id-uEaggregateMaximumBitrate CRITICALITY reject TYPE UEAggregateMaximumBitrate PRESENCE mandatory}| + { ID id-E-RABToBeSetupListHOReq CRITICALITY reject TYPE E-RABToBeSetupListHOReq PRESENCE mandatory}| + { ID id-Source-ToTarget-TransparentContainer CRITICALITY reject TYPE Source-ToTarget-TransparentContainer PRESENCE mandatory}| + { ID id-UESecurityCapabilities CRITICALITY reject TYPE UESecurityCapabilities PRESENCE mandatory}| + { ID id-HandoverRestrictionList CRITICALITY ignore TYPE HandoverRestrictionList PRESENCE optional}| + { ID id-TraceActivation CRITICALITY ignore TYPE TraceActivation PRESENCE optional}| + { ID id-RequestType CRITICALITY ignore TYPE RequestType PRESENCE optional}| + { ID id-SRVCCOperationPossible CRITICALITY ignore TYPE SRVCCOperationPossible PRESENCE optional}| + { ID id-SecurityContext CRITICALITY reject TYPE SecurityContext PRESENCE mandatory}| + { ID id-NASSecurityParameterstoE-UTRAN CRITICALITY reject TYPE NASSecurityParameterstoE-UTRAN PRESENCE conditional + -- This IE shall be present if the Handover Type IE is set to the value "UTRANtoLTE" or "GERANtoLTE" -- }| + { ID id-CSG-Id CRITICALITY reject TYPE CSG-Id PRESENCE optional}| + { ID id-CSGMembershipStatus CRITICALITY ignore TYPE CSGMembershipStatus PRESENCE optional}| + { ID id-GUMMEI-ID CRITICALITY ignore TYPE GUMMEI PRESENCE optional}| + { ID id-MME-UE-S1AP-ID-2 CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE optional}| + { ID id-ManagementBasedMDTAllowed CRITICALITY ignore TYPE ManagementBasedMDTAllowed PRESENCE optional}| + { ID id-ManagementBasedMDTPLMNList CRITICALITY ignore TYPE MDTPLMNList PRESENCE optional}| + { ID id-Masked-IMEISV CRITICALITY ignore TYPE Masked-IMEISV PRESENCE optional}| + { ID id-ExpectedUEBehaviour CRITICALITY ignore TYPE ExpectedUEBehaviour PRESENCE optional}| + { ID id-ProSeAuthorized CRITICALITY ignore TYPE ProSeAuthorized PRESENCE optional}| + { ID id-UEUserPlaneCIoTSupportIndicator CRITICALITY ignore TYPE UEUserPlaneCIoTSupportIndicator PRESENCE optional}| + { ID id-V2XServicesAuthorized CRITICALITY ignore TYPE V2XServicesAuthorized PRESENCE optional}| + { ID id-UESidelinkAggregateMaximumBitrate CRITICALITY ignore TYPE UESidelinkAggregateMaximumBitrate PRESENCE optional}| + { ID id-EnhancedCoverageRestricted CRITICALITY ignore TYPE EnhancedCoverageRestricted PRESENCE optional}, + ... +} + +E-RABToBeSetupListHOReq ::= E-RAB-IE-ContainerList { {E-RABToBeSetupItemHOReqIEs} } + +E-RABToBeSetupItemHOReqIEs S1AP-PROTOCOL-IES ::= { + { ID id-E-RABToBeSetupItemHOReq CRITICALITY reject TYPE E-RABToBeSetupItemHOReq PRESENCE mandatory }, + ... +} + +E-RABToBeSetupItemHOReq ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + transportLayerAddress TransportLayerAddress, + gTP-TEID GTP-TEID, + e-RABlevelQosParameters E-RABLevelQoSParameters, + iE-Extensions ProtocolExtensionContainer { {E-RABToBeSetupItemHOReq-ExtIEs} } OPTIONAL, + ... +} + +E-RABToBeSetupItemHOReq-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + { ID id-Data-Forwarding-Not-Possible CRITICALITY ignore EXTENSION Data-Forwarding-Not-Possible PRESENCE optional}| + { ID id-BearerType CRITICALITY reject EXTENSION BearerType PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- Handover Request Acknowledge +-- +-- ************************************************************** + +HandoverRequestAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {HandoverRequestAcknowledgeIEs} }, + ... +} + +HandoverRequestAcknowledgeIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY ignore TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-E-RABAdmittedList CRITICALITY ignore TYPE E-RABAdmittedList PRESENCE mandatory}| + { ID id-E-RABFailedToSetupListHOReqAck CRITICALITY ignore TYPE E-RABFailedtoSetupListHOReqAck PRESENCE optional}| + { ID id-Target-ToSource-TransparentContainer CRITICALITY reject TYPE Target-ToSource-TransparentContainer PRESENCE mandatory}| + { ID id-CSG-Id CRITICALITY ignore TYPE CSG-Id PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}| + { ID id-CellAccessMode CRITICALITY ignore TYPE CellAccessMode PRESENCE optional}| + { ID id-CE-mode-B-SupportIndicator CRITICALITY ignore TYPE CE-mode-B-SupportIndicator PRESENCE optional}, + ... +} + +E-RABAdmittedList ::= E-RAB-IE-ContainerList { {E-RABAdmittedItemIEs} } + +E-RABAdmittedItemIEs S1AP-PROTOCOL-IES ::= { + { ID id-E-RABAdmittedItem CRITICALITY ignore TYPE E-RABAdmittedItem PRESENCE mandatory }, + ... +} + +E-RABAdmittedItem ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + transportLayerAddress TransportLayerAddress, + gTP-TEID GTP-TEID, + dL-transportLayerAddress TransportLayerAddress OPTIONAL, + dL-gTP-TEID GTP-TEID OPTIONAL, + uL-TransportLayerAddress TransportLayerAddress OPTIONAL, + uL-GTP-TEID GTP-TEID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {E-RABAdmittedItem-ExtIEs} } OPTIONAL, + ... +} + +E-RABAdmittedItem-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-RABFailedtoSetupListHOReqAck ::= E-RAB-IE-ContainerList { {E-RABFailedtoSetupItemHOReqAckIEs} } + +E-RABFailedtoSetupItemHOReqAckIEs S1AP-PROTOCOL-IES ::= { + { ID id-E-RABFailedtoSetupItemHOReqAck CRITICALITY ignore TYPE E-RABFailedToSetupItemHOReqAck PRESENCE mandatory }, + ... +} + +E-RABFailedToSetupItemHOReqAck ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + cause Cause, + iE-Extensions ProtocolExtensionContainer { { E-RABFailedToSetupItemHOReqAckExtIEs} } OPTIONAL, + ... +} + +E-RABFailedToSetupItemHOReqAckExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +-- ************************************************************** +-- +-- Handover Failure +-- +-- ************************************************************** + +HandoverFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { HandoverFailureIEs} }, + ... +} + +HandoverFailureIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- HANDOVER NOTIFICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Handover Notify +-- +-- ************************************************************** + +HandoverNotify ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { HandoverNotifyIEs} }, + ... +} + +HandoverNotifyIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-EUTRAN-CGI CRITICALITY ignore TYPE EUTRAN-CGI PRESENCE mandatory}| + { ID id-TAI CRITICALITY ignore TYPE TAI PRESENCE mandatory}| +-- Extension for Release 11 to support BBAI -- + { ID id-Tunnel-Information-for-BBF CRITICALITY ignore TYPE TunnelInformation PRESENCE optional}| + { ID id-LHN-ID CRITICALITY ignore TYPE LHN-ID PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- PATH SWITCH REQUEST ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Path Switch Request +-- +-- ************************************************************** + +PathSwitchRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PathSwitchRequestIEs} }, + ... +} + +PathSwitchRequestIEs S1AP-PROTOCOL-IES ::= { + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-E-RABToBeSwitchedDLList CRITICALITY reject TYPE E-RABToBeSwitchedDLList PRESENCE mandatory}| + { ID id-SourceMME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-EUTRAN-CGI CRITICALITY ignore TYPE EUTRAN-CGI PRESENCE mandatory}| + { ID id-TAI CRITICALITY ignore TYPE TAI PRESENCE mandatory}| + { ID id-UESecurityCapabilities CRITICALITY ignore TYPE UESecurityCapabilities PRESENCE mandatory}| + { ID id-CSG-Id CRITICALITY ignore TYPE CSG-Id PRESENCE optional}| + { ID id-CellAccessMode CRITICALITY ignore TYPE CellAccessMode PRESENCE optional}| + { ID id-SourceMME-GUMMEI CRITICALITY ignore TYPE GUMMEI PRESENCE optional}| + { ID id-CSGMembershipStatus CRITICALITY ignore TYPE CSGMembershipStatus PRESENCE optional}| +-- Extension for Release 11 to support BBAI -- + { ID id-Tunnel-Information-for-BBF CRITICALITY ignore TYPE TunnelInformation PRESENCE optional}| + { ID id-LHN-ID CRITICALITY ignore TYPE LHN-ID PRESENCE optional}| + { ID id-RRC-Resume-Cause CRITICALITY ignore TYPE RRC-Establishment-Cause PRESENCE optional }, + ... +} + +E-RABToBeSwitchedDLList ::= E-RAB-IE-ContainerList { {E-RABToBeSwitchedDLItemIEs} } + +E-RABToBeSwitchedDLItemIEs S1AP-PROTOCOL-IES ::= { + { ID id-E-RABToBeSwitchedDLItem CRITICALITY reject TYPE E-RABToBeSwitchedDLItem PRESENCE mandatory }, + ... +} + +E-RABToBeSwitchedDLItem ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + transportLayerAddress TransportLayerAddress, + gTP-TEID GTP-TEID, + iE-Extensions ProtocolExtensionContainer { { E-RABToBeSwitchedDLItem-ExtIEs} } OPTIONAL, + ... +} + +E-RABToBeSwitchedDLItem-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- ************************************************************** +-- +-- Path Switch Request Acknowledge +-- +-- ************************************************************** + +PathSwitchRequestAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PathSwitchRequestAcknowledgeIEs} }, + ... +} + +PathSwitchRequestAcknowledgeIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY ignore TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-uEaggregateMaximumBitrate CRITICALITY ignore TYPE UEAggregateMaximumBitrate PRESENCE optional}| + { ID id-E-RABToBeSwitchedULList CRITICALITY ignore TYPE E-RABToBeSwitchedULList PRESENCE optional}| + { ID id-E-RABToBeReleasedList CRITICALITY ignore TYPE E-RABList PRESENCE optional}| + { ID id-SecurityContext CRITICALITY reject TYPE SecurityContext PRESENCE mandatory}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}| + { ID id-MME-UE-S1AP-ID-2 CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE optional}| + { ID id-CSGMembershipStatus CRITICALITY ignore TYPE CSGMembershipStatus PRESENCE optional}| + { ID id-ProSeAuthorized CRITICALITY ignore TYPE ProSeAuthorized PRESENCE optional}| + { ID id-UEUserPlaneCIoTSupportIndicator CRITICALITY ignore TYPE UEUserPlaneCIoTSupportIndicator PRESENCE optional}| + { ID id-V2XServicesAuthorized CRITICALITY ignore TYPE V2XServicesAuthorized PRESENCE optional}| + { ID id-UESidelinkAggregateMaximumBitrate CRITICALITY ignore TYPE UESidelinkAggregateMaximumBitrate PRESENCE optional}| + { ID id-EnhancedCoverageRestricted CRITICALITY ignore TYPE EnhancedCoverageRestricted PRESENCE optional}, + ... +} + +E-RABToBeSwitchedULList ::= E-RAB-IE-ContainerList { {E-RABToBeSwitchedULItemIEs} } + +E-RABToBeSwitchedULItemIEs S1AP-PROTOCOL-IES ::= { + { ID id-E-RABToBeSwitchedULItem CRITICALITY ignore TYPE E-RABToBeSwitchedULItem PRESENCE mandatory }, + ... +} + +E-RABToBeSwitchedULItem ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + transportLayerAddress TransportLayerAddress, + gTP-TEID GTP-TEID, + iE-Extensions ProtocolExtensionContainer { { E-RABToBeSwitchedULItem-ExtIEs} } OPTIONAL, + ... +} + +E-RABToBeSwitchedULItem-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +-- ************************************************************** +-- +-- Path Switch Request Failure +-- +-- ************************************************************** + +PathSwitchRequestFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { PathSwitchRequestFailureIEs} }, + ... +} + +PathSwitchRequestFailureIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY ignore TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- HANDOVER CANCEL ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Handover Cancel +-- +-- ************************************************************** + +HandoverCancel ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { HandoverCancelIEs} }, + ... +} + +HandoverCancelIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- Handover Cancel Request Acknowledge +-- +-- ************************************************************** + +HandoverCancelAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { HandoverCancelAcknowledgeIEs} }, + ... +} + +HandoverCancelAcknowledgeIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY ignore TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- E-RAB SETUP ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- E-RAB Setup Request +-- +-- ************************************************************** + +E-RABSetupRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {E-RABSetupRequestIEs} }, + ... +} + +E-RABSetupRequestIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-uEaggregateMaximumBitrate CRITICALITY reject TYPE UEAggregateMaximumBitrate PRESENCE optional }| + { ID id-E-RABToBeSetupListBearerSUReq CRITICALITY reject TYPE E-RABToBeSetupListBearerSUReq PRESENCE mandatory }, + ... +} + +E-RABToBeSetupListBearerSUReq ::= SEQUENCE (SIZE(1.. maxnoofE-RABs)) OF ProtocolIE-SingleContainer { {E-RABToBeSetupItemBearerSUReqIEs} } + +E-RABToBeSetupItemBearerSUReqIEs S1AP-PROTOCOL-IES ::= { + { ID id-E-RABToBeSetupItemBearerSUReq CRITICALITY reject TYPE E-RABToBeSetupItemBearerSUReq PRESENCE mandatory }, + ... +} + +E-RABToBeSetupItemBearerSUReq ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + e-RABlevelQoSParameters E-RABLevelQoSParameters, + transportLayerAddress TransportLayerAddress, + gTP-TEID GTP-TEID, + nAS-PDU NAS-PDU, + iE-Extensions ProtocolExtensionContainer { {E-RABToBeSetupItemBearerSUReqExtIEs} } OPTIONAL, + ... +} + + +E-RABToBeSetupItemBearerSUReqExtIEs S1AP-PROTOCOL-EXTENSION ::= { + { ID id-Correlation-ID CRITICALITY ignore EXTENSION Correlation-ID PRESENCE optional}| + { ID id-SIPTO-Correlation-ID CRITICALITY ignore EXTENSION Correlation-ID PRESENCE optional}| + { ID id-BearerType CRITICALITY reject EXTENSION BearerType PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- E-RAB Setup Response +-- +-- ************************************************************** + +E-RABSetupResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {E-RABSetupResponseIEs} }, + ... +} + +E-RABSetupResponseIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY ignore TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-E-RABSetupListBearerSURes CRITICALITY ignore TYPE E-RABSetupListBearerSURes PRESENCE optional }| + { ID id-E-RABFailedToSetupListBearerSURes CRITICALITY ignore TYPE E-RABList PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +E-RABSetupListBearerSURes ::= SEQUENCE (SIZE(1.. maxnoofE-RABs)) OF ProtocolIE-SingleContainer { {E-RABSetupItemBearerSUResIEs} } + +E-RABSetupItemBearerSUResIEs S1AP-PROTOCOL-IES ::= { + { ID id-E-RABSetupItemBearerSURes CRITICALITY ignore TYPE E-RABSetupItemBearerSURes PRESENCE mandatory }, + ... +} + +E-RABSetupItemBearerSURes ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + transportLayerAddress TransportLayerAddress, + gTP-TEID GTP-TEID, + iE-Extensions ProtocolExtensionContainer { {E-RABSetupItemBearerSUResExtIEs} } OPTIONAL, + ... +} + + +E-RABSetupItemBearerSUResExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + + + +-- ************************************************************** +-- +-- E-RAB MODIFY ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- E-RAB Modify Request +-- +-- ************************************************************** + +E-RABModifyRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {E-RABModifyRequestIEs} }, + ... +} + +E-RABModifyRequestIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-uEaggregateMaximumBitrate CRITICALITY reject TYPE UEAggregateMaximumBitrate PRESENCE optional }| + { ID id-E-RABToBeModifiedListBearerModReq CRITICALITY reject TYPE E-RABToBeModifiedListBearerModReq PRESENCE mandatory }, + ... +} + +E-RABToBeModifiedListBearerModReq ::= SEQUENCE (SIZE(1.. maxnoofE-RABs)) OF ProtocolIE-SingleContainer { {E-RABToBeModifiedItemBearerModReqIEs} } + +E-RABToBeModifiedItemBearerModReqIEs S1AP-PROTOCOL-IES ::= { + { ID id-E-RABToBeModifiedItemBearerModReq CRITICALITY reject TYPE E-RABToBeModifiedItemBearerModReq PRESENCE mandatory }, + ... +} + +E-RABToBeModifiedItemBearerModReq ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + e-RABLevelQoSParameters E-RABLevelQoSParameters, + nAS-PDU NAS-PDU, + iE-Extensions ProtocolExtensionContainer { {E-RABToBeModifyItemBearerModReqExtIEs} } OPTIONAL, + ... +} + + +E-RABToBeModifyItemBearerModReqExtIEs S1AP-PROTOCOL-EXTENSION ::= { + { ID id-TransportInformation CRITICALITY reject EXTENSION TransportInformation PRESENCE optional}, + ... +} + + + +-- ************************************************************** +-- +-- E-RAB Modify Response +-- +-- ************************************************************** + +E-RABModifyResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {E-RABModifyResponseIEs} }, + ... +} + +E-RABModifyResponseIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY ignore TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-E-RABModifyListBearerModRes CRITICALITY ignore TYPE E-RABModifyListBearerModRes PRESENCE optional }| + { ID id-E-RABFailedToModifyList CRITICALITY ignore TYPE E-RABList PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +E-RABModifyListBearerModRes ::= SEQUENCE (SIZE(1.. maxnoofE-RABs)) OF ProtocolIE-SingleContainer { {E-RABModifyItemBearerModResIEs} } + +E-RABModifyItemBearerModResIEs S1AP-PROTOCOL-IES ::= { + { ID id-E-RABModifyItemBearerModRes CRITICALITY ignore TYPE E-RABModifyItemBearerModRes PRESENCE mandatory}, + ... +} + +E-RABModifyItemBearerModRes ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + iE-Extensions ProtocolExtensionContainer { {E-RABModifyItemBearerModResExtIEs} } OPTIONAL, + ... +} + + +E-RABModifyItemBearerModResExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + + + + +-- ************************************************************** +-- +-- E-RAB RELEASE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- E-RAB Release Command +-- +-- ************************************************************** + +E-RABReleaseCommand ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {E-RABReleaseCommandIEs} }, + ... +} + +E-RABReleaseCommandIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-uEaggregateMaximumBitrate CRITICALITY reject TYPE UEAggregateMaximumBitrate PRESENCE optional }| + { ID id-E-RABToBeReleasedList CRITICALITY ignore TYPE E-RABList PRESENCE mandatory }| + { ID id-NAS-PDU CRITICALITY ignore TYPE NAS-PDU PRESENCE optional }, + ... +} + + +-- ************************************************************** +-- +-- E-RAB Release Response +-- +-- ************************************************************** + +E-RABReleaseResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { E-RABReleaseResponseIEs } }, + ... +} + +E-RABReleaseResponseIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY ignore TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-E-RABReleaseListBearerRelComp CRITICALITY ignore TYPE E-RABReleaseListBearerRelComp PRESENCE optional }| + { ID id-E-RABFailedToReleaseList CRITICALITY ignore TYPE E-RABList PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }| +-- Extension for Release 12 to support User Location Information -- + { ID id-UserLocationInformation CRITICALITY ignore TYPE UserLocationInformation PRESENCE optional }, + ... +} + + +E-RABReleaseListBearerRelComp ::= SEQUENCE (SIZE(1.. maxnoofE-RABs)) OF ProtocolIE-SingleContainer { {E-RABReleaseItemBearerRelCompIEs} } + +E-RABReleaseItemBearerRelCompIEs S1AP-PROTOCOL-IES ::= { + { ID id-E-RABReleaseItemBearerRelComp CRITICALITY ignore TYPE E-RABReleaseItemBearerRelComp PRESENCE mandatory }, + ... +} + +E-RABReleaseItemBearerRelComp ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + iE-Extensions ProtocolExtensionContainer { {E-RABReleaseItemBearerRelCompExtIEs} } OPTIONAL, + ... +} + + +E-RABReleaseItemBearerRelCompExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + + + +-- ************************************************************** +-- +-- E-RAB RELEASE INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- E-RAB Release Indication +-- +-- ************************************************************** + +E-RABReleaseIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {E-RABReleaseIndicationIEs} }, + ... +} + +E-RABReleaseIndicationIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-E-RABReleasedList CRITICALITY ignore TYPE E-RABList PRESENCE mandatory }| +-- Extension for Release 12 to support User Location Information -- + { ID id-UserLocationInformation CRITICALITY ignore TYPE UserLocationInformation PRESENCE optional }, + ... +} +-- ************************************************************** +-- +-- INITIAL CONTEXT SETUP ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Initial Context Setup Request +-- +-- ************************************************************** + +InitialContextSetupRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {InitialContextSetupRequestIEs} }, + ... +} + +InitialContextSetupRequestIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-uEaggregateMaximumBitrate CRITICALITY reject TYPE UEAggregateMaximumBitrate PRESENCE mandatory}| + { ID id-E-RABToBeSetupListCtxtSUReq CRITICALITY reject TYPE E-RABToBeSetupListCtxtSUReq PRESENCE mandatory}| + { ID id-UESecurityCapabilities CRITICALITY reject TYPE UESecurityCapabilities PRESENCE mandatory}| + { ID id-SecurityKey CRITICALITY reject TYPE SecurityKey PRESENCE mandatory}| + { ID id-TraceActivation CRITICALITY ignore TYPE TraceActivation PRESENCE optional}| + { ID id-HandoverRestrictionList CRITICALITY ignore TYPE HandoverRestrictionList PRESENCE optional}| + { ID id-UERadioCapability CRITICALITY ignore TYPE UERadioCapability PRESENCE optional}| + { ID id-SubscriberProfileIDforRFP CRITICALITY ignore TYPE SubscriberProfileIDforRFP PRESENCE optional}| + { ID id-CSFallbackIndicator CRITICALITY reject TYPE CSFallbackIndicator PRESENCE optional}| + { ID id-SRVCCOperationPossible CRITICALITY ignore TYPE SRVCCOperationPossible PRESENCE optional}| + { ID id-CSGMembershipStatus CRITICALITY ignore TYPE CSGMembershipStatus PRESENCE optional}| + { ID id-RegisteredLAI CRITICALITY ignore TYPE LAI PRESENCE optional}| + { ID id-GUMMEI-ID CRITICALITY ignore TYPE GUMMEI PRESENCE optional}| + { ID id-MME-UE-S1AP-ID-2 CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE optional}| + { ID id-ManagementBasedMDTAllowed CRITICALITY ignore TYPE ManagementBasedMDTAllowed PRESENCE optional}| + { ID id-ManagementBasedMDTPLMNList CRITICALITY ignore TYPE MDTPLMNList PRESENCE optional}| + { ID id-AdditionalCSFallbackIndicator CRITICALITY ignore TYPE AdditionalCSFallbackIndicator PRESENCE conditional}| + { ID id-Masked-IMEISV CRITICALITY ignore TYPE Masked-IMEISV PRESENCE optional}| + { ID id-ExpectedUEBehaviour CRITICALITY ignore TYPE ExpectedUEBehaviour PRESENCE optional}| + { ID id-ProSeAuthorized CRITICALITY ignore TYPE ProSeAuthorized PRESENCE optional}| + { ID id-UEUserPlaneCIoTSupportIndicator CRITICALITY ignore TYPE UEUserPlaneCIoTSupportIndicator PRESENCE optional}| + { ID id-V2XServicesAuthorized CRITICALITY ignore TYPE V2XServicesAuthorized PRESENCE optional}| + { ID id-UESidelinkAggregateMaximumBitrate CRITICALITY ignore TYPE UESidelinkAggregateMaximumBitrate PRESENCE optional}| + { ID id-EnhancedCoverageRestricted CRITICALITY ignore TYPE EnhancedCoverageRestricted PRESENCE optional}, + ... +} + + + + +E-RABToBeSetupListCtxtSUReq ::= SEQUENCE (SIZE(1.. maxnoofE-RABs)) OF ProtocolIE-SingleContainer { {E-RABToBeSetupItemCtxtSUReqIEs} } + +E-RABToBeSetupItemCtxtSUReqIEs S1AP-PROTOCOL-IES ::= { + { ID id-E-RABToBeSetupItemCtxtSUReq CRITICALITY reject TYPE E-RABToBeSetupItemCtxtSUReq PRESENCE mandatory }, + ... +} + +E-RABToBeSetupItemCtxtSUReq ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + e-RABlevelQoSParameters E-RABLevelQoSParameters, + transportLayerAddress TransportLayerAddress, + gTP-TEID GTP-TEID, + nAS-PDU NAS-PDU OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {E-RABToBeSetupItemCtxtSUReqExtIEs} } OPTIONAL, + ... +} + + +E-RABToBeSetupItemCtxtSUReqExtIEs S1AP-PROTOCOL-EXTENSION ::= { + { ID id-Correlation-ID CRITICALITY ignore EXTENSION Correlation-ID PRESENCE optional}| + { ID id-SIPTO-Correlation-ID CRITICALITY ignore EXTENSION Correlation-ID PRESENCE optional}| + { ID id-BearerType CRITICALITY reject EXTENSION BearerType PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- Initial Context Setup Response +-- +-- ************************************************************** + +InitialContextSetupResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {InitialContextSetupResponseIEs} }, + ... +} + +InitialContextSetupResponseIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY ignore TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-E-RABSetupListCtxtSURes CRITICALITY ignore TYPE E-RABSetupListCtxtSURes PRESENCE mandatory }| + { ID id-E-RABFailedToSetupListCtxtSURes CRITICALITY ignore TYPE E-RABList PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + + +E-RABSetupListCtxtSURes ::= SEQUENCE (SIZE(1.. maxnoofE-RABs)) OF ProtocolIE-SingleContainer { {E-RABSetupItemCtxtSUResIEs} } + +E-RABSetupItemCtxtSUResIEs S1AP-PROTOCOL-IES ::= { + { ID id-E-RABSetupItemCtxtSURes CRITICALITY ignore TYPE E-RABSetupItemCtxtSURes PRESENCE mandatory }, + ... +} + +E-RABSetupItemCtxtSURes ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + transportLayerAddress TransportLayerAddress, + gTP-TEID GTP-TEID, + iE-Extensions ProtocolExtensionContainer { {E-RABSetupItemCtxtSUResExtIEs} } OPTIONAL, + ... +} + + +E-RABSetupItemCtxtSUResExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +-- ************************************************************** +-- +-- Initial Context Setup Failure +-- +-- ************************************************************** + +InitialContextSetupFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {InitialContextSetupFailureIEs} }, + ... +} + +InitialContextSetupFailureIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY ignore TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- PAGING ELEMENTARY PROCEDURE +-- +-- ************************************************************** + + +-- ************************************************************** +-- +-- Paging +-- +-- ************************************************************** + +Paging ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{PagingIEs}}, + ... +} + +PagingIEs S1AP-PROTOCOL-IES ::= { + { ID id-UEIdentityIndexValue CRITICALITY ignore TYPE UEIdentityIndexValue PRESENCE mandatory}| + { ID id-UEPagingID CRITICALITY ignore TYPE UEPagingID PRESENCE mandatory}| + { ID id-pagingDRX CRITICALITY ignore TYPE PagingDRX PRESENCE optional}| + { ID id-CNDomain CRITICALITY ignore TYPE CNDomain PRESENCE mandatory}| + { ID id-TAIList CRITICALITY ignore TYPE TAIList PRESENCE mandatory}| + { ID id-CSG-IdList CRITICALITY ignore TYPE CSG-IdList PRESENCE optional}| + { ID id-PagingPriority CRITICALITY ignore TYPE PagingPriority PRESENCE optional}| + { ID id-UERadioCapabilityForPaging CRITICALITY ignore TYPE UERadioCapabilityForPaging PRESENCE optional}| +-- Extension for Release 13 to support Paging Optimisation and Coverage Enhancement paging –- + { ID id-AssistanceDataForPaging CRITICALITY ignore TYPE AssistanceDataForPaging PRESENCE optional}| + { ID id-Paging-eDRXInformation CRITICALITY ignore TYPE Paging-eDRXInformation PRESENCE optional}| + { ID id-extended-UEIdentityIndexValue CRITICALITY ignore TYPE Extended-UEIdentityIndexValue PRESENCE optional}| + { ID id-NB-IoT-Paging-eDRXInformation CRITICALITY ignore TYPE NB-IoT-Paging-eDRXInformation PRESENCE optional}| + { ID id-NB-IoT-UEIdentityIndexValue CRITICALITY ignore TYPE NB-IoT-UEIdentityIndexValue PRESENCE optional}, + ... +} + +TAIList::= SEQUENCE (SIZE(1.. maxnoofTAIs)) OF ProtocolIE-SingleContainer {{TAIItemIEs}} + +TAIItemIEs S1AP-PROTOCOL-IES ::= { + { ID id-TAIItem CRITICALITY ignore TYPE TAIItem PRESENCE mandatory }, + ... +} + +TAIItem ::= SEQUENCE { + tAI TAI, + iE-Extensions ProtocolExtensionContainer { {TAIItemExtIEs} } OPTIONAL, + ... +} + + +TAIItemExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT RELEASE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE Context Release Request +-- +-- ************************************************************** + +UEContextReleaseRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{UEContextReleaseRequest-IEs}}, + ... +} + +UEContextReleaseRequest-IEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-GWContextReleaseIndication CRITICALITY reject TYPE GWContextReleaseIndication PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- UE Context Release Command +-- +-- ************************************************************** + +UEContextReleaseCommand ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{UEContextReleaseCommand-IEs}}, + ... +} + +UEContextReleaseCommand-IEs S1AP-PROTOCOL-IES ::= { + { ID id-UE-S1AP-IDs CRITICALITY reject TYPE UE-S1AP-IDs PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- UE Context Release Complete +-- +-- ************************************************************** + +UEContextReleaseComplete ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{UEContextReleaseComplete-IEs}}, + ... +} + +UEContextReleaseComplete-IEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY ignore TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}| +-- Extension for Release 12 to support User Location Information -- + { ID id-UserLocationInformation CRITICALITY ignore TYPE UserLocationInformation PRESENCE optional}| +-- Extension for Release 13 to support Paging Optimisation + { ID id-InformationOnRecommendedCellsAndENBsForPaging CRITICALITY ignore TYPE InformationOnRecommendedCellsAndENBsForPaging PRESENCE optional}| +-- Extension for Release 13 to support coverage enhancement paging – + { ID id-CellIdentifierAndCELevelForCECapableUEs CRITICALITY ignore TYPE CellIdentifierAndCELevelForCECapableUEs PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE Context Modification Request +-- +-- ************************************************************** + +UEContextModificationRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationRequestIEs} }, + ... +} + +UEContextModificationRequestIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-SecurityKey CRITICALITY reject TYPE SecurityKey PRESENCE optional}| + { ID id-SubscriberProfileIDforRFP CRITICALITY ignore TYPE SubscriberProfileIDforRFP PRESENCE optional}| + { ID id-uEaggregateMaximumBitrate CRITICALITY ignore TYPE UEAggregateMaximumBitrate PRESENCE optional}| + { ID id-CSFallbackIndicator CRITICALITY reject TYPE CSFallbackIndicator PRESENCE optional}| + { ID id-UESecurityCapabilities CRITICALITY reject TYPE UESecurityCapabilities PRESENCE optional}| + { ID id-CSGMembershipStatus CRITICALITY ignore TYPE CSGMembershipStatus PRESENCE optional}| + { ID id-RegisteredLAI CRITICALITY ignore TYPE LAI PRESENCE optional}| + { ID id-AdditionalCSFallbackIndicator CRITICALITY ignore TYPE AdditionalCSFallbackIndicator PRESENCE conditional}| + { ID id-ProSeAuthorized CRITICALITY ignore TYPE ProSeAuthorized PRESENCE optional}| + { ID id-SRVCCOperationPossible CRITICALITY ignore TYPE SRVCCOperationPossible PRESENCE optional}| + { ID id-SRVCCOperationNotPossible CRITICALITY ignore TYPE SRVCCOperationNotPossible PRESENCE optional}| + { ID id-V2XServicesAuthorized CRITICALITY ignore TYPE V2XServicesAuthorized PRESENCE optional}| + { ID id-UESidelinkAggregateMaximumBitrate CRITICALITY ignore TYPE UESidelinkAggregateMaximumBitrate PRESENCE optional}, + ... +} +-- ************************************************************** +-- +-- UE Context Modification Response +-- +-- ************************************************************** + +UEContextModificationResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationResponseIEs} }, + ... +} + +UEContextModificationResponseIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY ignore TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} +-- ************************************************************** +-- +-- UE Context Modification Failure +-- +-- ************************************************************** + +UEContextModificationFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationFailureIEs} }, + ... +} + +UEContextModificationFailureIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY ignore TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- UE RADIO CAPABILITY MATCH ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE Radio Capability Match Request +-- +-- ************************************************************** + +UERadioCapabilityMatchRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UERadioCapabilityMatchRequestIEs} }, + ... +} + +UERadioCapabilityMatchRequestIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-UERadioCapability CRITICALITY ignore TYPE UERadioCapability PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- UE Radio Capability Match Response +-- +-- ************************************************************** + +UERadioCapabilityMatchResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UERadioCapabilityMatchResponseIEs} }, + ... +} + +UERadioCapabilityMatchResponseIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY ignore TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-VoiceSupportMatchIndicator CRITICALITY reject TYPE VoiceSupportMatchIndicator PRESENCE mandatory }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- NAS TRANSPORT ELEMENTARY PROCEDURES +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- DOWNLINK NAS TRANSPORT +-- +-- ************************************************************** + +DownlinkNASTransport ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{DownlinkNASTransport-IEs}}, + ... +} + +DownlinkNASTransport-IEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-NAS-PDU CRITICALITY reject TYPE NAS-PDU PRESENCE mandatory}| + { ID id-HandoverRestrictionList CRITICALITY ignore TYPE HandoverRestrictionList PRESENCE optional}| + { ID id-SubscriberProfileIDforRFP CRITICALITY ignore TYPE SubscriberProfileIDforRFP PRESENCE optional}| + { ID id-SRVCCOperationPossible CRITICALITY ignore TYPE SRVCCOperationPossible PRESENCE optional}| + { ID id-UERadioCapability CRITICALITY ignore TYPE UERadioCapability PRESENCE optional}| + { ID id-DLNASPDUDeliveryAckRequest CRITICALITY ignore TYPE DLNASPDUDeliveryAckRequest PRESENCE optional}| + { ID id-EnhancedCoverageRestricted CRITICALITY ignore TYPE EnhancedCoverageRestricted PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- INITIAL UE MESSAGE +-- +-- ************************************************************** + +InitialUEMessage ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{InitialUEMessage-IEs}}, + ... +} + +InitialUEMessage-IEs S1AP-PROTOCOL-IES ::= { + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-NAS-PDU CRITICALITY reject TYPE NAS-PDU PRESENCE mandatory}| + { ID id-TAI CRITICALITY reject TYPE TAI PRESENCE mandatory}| + { ID id-EUTRAN-CGI CRITICALITY ignore TYPE EUTRAN-CGI PRESENCE mandatory}| + { ID id-RRC-Establishment-Cause CRITICALITY ignore TYPE RRC-Establishment-Cause PRESENCE mandatory}| + { ID id-S-TMSI CRITICALITY reject TYPE S-TMSI PRESENCE optional}| + { ID id-CSG-Id CRITICALITY reject TYPE CSG-Id PRESENCE optional}| + { ID id-GUMMEI-ID CRITICALITY reject TYPE GUMMEI PRESENCE optional}| + { ID id-CellAccessMode CRITICALITY reject TYPE CellAccessMode PRESENCE optional}| + { ID id-GW-TransportLayerAddress CRITICALITY ignore TYPE TransportLayerAddress PRESENCE optional}| + { ID id-RelayNode-Indicator CRITICALITY reject TYPE RelayNode-Indicator PRESENCE optional}| + { ID id-GUMMEIType CRITICALITY ignore TYPE GUMMEIType PRESENCE optional}| +-- Extension for Release 11 to support BBAI -- + { ID id-Tunnel-Information-for-BBF CRITICALITY ignore TYPE TunnelInformation PRESENCE optional}| + { ID id-SIPTO-L-GW-TransportLayerAddress CRITICALITY ignore TYPE TransportLayerAddress PRESENCE optional}| + { ID id-LHN-ID CRITICALITY ignore TYPE LHN-ID PRESENCE optional}| + { ID id-MME-Group-ID CRITICALITY ignore TYPE MME-Group-ID PRESENCE optional}| + { ID id-UE-Usage-Type CRITICALITY ignore TYPE UE-Usage-Type PRESENCE optional}| + { ID id-CE-mode-B-SupportIndicator CRITICALITY ignore TYPE CE-mode-B-SupportIndicator PRESENCE optional}| + { ID id-DCN-ID CRITICALITY ignore TYPE DCN-ID PRESENCE optional}| + { ID id-Coverage-Level CRITICALITY ignore TYPE Coverage-Level PRESENCE optional}, + + ... +} + + +-- ************************************************************** +-- +-- UPLINK NAS TRANSPORT +-- +-- ************************************************************** + +UplinkNASTransport ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{UplinkNASTransport-IEs}}, + ... +} + +UplinkNASTransport-IEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-NAS-PDU CRITICALITY reject TYPE NAS-PDU PRESENCE mandatory}| + { ID id-EUTRAN-CGI CRITICALITY ignore TYPE EUTRAN-CGI PRESENCE mandatory}| + { ID id-TAI CRITICALITY ignore TYPE TAI PRESENCE mandatory}| + { ID id-GW-TransportLayerAddress CRITICALITY ignore TYPE TransportLayerAddress PRESENCE optional}| + { ID id-SIPTO-L-GW-TransportLayerAddress CRITICALITY ignore TYPE TransportLayerAddress PRESENCE optional}| + { ID id-LHN-ID CRITICALITY ignore TYPE LHN-ID PRESENCE optional}, + ... +} +-- ************************************************************** +-- +-- NAS NON DELIVERY INDICATION +-- +-- ************************************************************** + +NASNonDeliveryIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{NASNonDeliveryIndication-IEs}}, + ... +} + +NASNonDeliveryIndication-IEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-NAS-PDU CRITICALITY ignore TYPE NAS-PDU PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- REROUTE NAS REQUEST +-- +-- ************************************************************** + +RerouteNASRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{RerouteNASRequest-IEs}}, + ... +} + +RerouteNASRequest-IEs S1AP-PROTOCOL-IES ::= { + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE optional}| + { ID id-S1-Message CRITICALITY reject TYPE OCTET STRING PRESENCE mandatory}| + { ID id-MME-Group-ID CRITICALITY reject TYPE MME-Group-ID PRESENCE mandatory}| + { ID id-Additional-GUTI CRITICALITY ignore TYPE Additional-GUTI PRESENCE optional}| + { ID id-UE-Usage-Type CRITICALITY ignore TYPE UE-Usage-Type PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- NAS DELIVERY INDICATION +-- +-- ************************************************************** + +NASDeliveryIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { NASDeliveryIndicationIEs} }, + ... +} + +NASDeliveryIndicationIEs S1AP-PROTOCOL-IES ::= { + ... +} + +-- ************************************************************** +-- +-- RESET ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Reset +-- +-- ************************************************************** + +Reset ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ResetIEs} }, + ... +} + +ResetIEs S1AP-PROTOCOL-IES ::= { + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-ResetType CRITICALITY reject TYPE ResetType PRESENCE mandatory }, + ... +} + +ResetType ::= CHOICE { + s1-Interface ResetAll, + partOfS1-Interface UE-associatedLogicalS1-ConnectionListRes, + ... +} + + + +ResetAll ::= ENUMERATED { + reset-all, + ... +} + +UE-associatedLogicalS1-ConnectionListRes ::= SEQUENCE (SIZE(1.. maxnoofIndividualS1ConnectionsToReset)) OF ProtocolIE-SingleContainer { { UE-associatedLogicalS1-ConnectionItemRes } } + +UE-associatedLogicalS1-ConnectionItemRes S1AP-PROTOCOL-IES ::= { + { ID id-UE-associatedLogicalS1-ConnectionItem CRITICALITY reject TYPE UE-associatedLogicalS1-ConnectionItem PRESENCE mandatory}, + ... +} + + +-- ************************************************************** +-- +-- Reset Acknowledge +-- +-- ************************************************************** + +ResetAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ResetAcknowledgeIEs} }, + ... +} + +ResetAcknowledgeIEs S1AP-PROTOCOL-IES ::= { + { ID id-UE-associatedLogicalS1-ConnectionListResAck CRITICALITY ignore TYPE UE-associatedLogicalS1-ConnectionListResAck PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +UE-associatedLogicalS1-ConnectionListResAck ::= SEQUENCE (SIZE(1.. maxnoofIndividualS1ConnectionsToReset)) OF ProtocolIE-SingleContainer { { UE-associatedLogicalS1-ConnectionItemResAck } } + +UE-associatedLogicalS1-ConnectionItemResAck S1AP-PROTOCOL-IES ::= { + { ID id-UE-associatedLogicalS1-ConnectionItem CRITICALITY ignore TYPE UE-associatedLogicalS1-ConnectionItem PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- ERROR INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Error Indication +-- +-- ************************************************************** + +ErrorIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ErrorIndicationIEs}}, + ... +} + +ErrorIndicationIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE optional }| + { ID id-eNB-UE-S1AP-ID CRITICALITY ignore TYPE ENB-UE-S1AP-ID PRESENCE optional }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- S1 SETUP ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- S1 Setup Request +-- +-- ************************************************************** + +S1SetupRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {S1SetupRequestIEs} }, + ... +} + +S1SetupRequestIEs S1AP-PROTOCOL-IES ::= { + { ID id-Global-ENB-ID CRITICALITY reject TYPE Global-ENB-ID PRESENCE mandatory}| + { ID id-eNBname CRITICALITY ignore TYPE ENBname PRESENCE optional}| + { ID id-SupportedTAs CRITICALITY reject TYPE SupportedTAs PRESENCE mandatory}| + { ID id-DefaultPagingDRX CRITICALITY ignore TYPE PagingDRX PRESENCE mandatory}| + { ID id-CSG-IdList CRITICALITY reject TYPE CSG-IdList PRESENCE optional}| + { ID id-UE-RetentionInformation CRITICALITY ignore TYPE UE-RetentionInformation PRESENCE optional}| + { ID id-NB-IoT-DefaultPagingDRX CRITICALITY ignore TYPE NB-IoT-DefaultPagingDRX PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- S1 Setup Response +-- +-- ************************************************************** + +S1SetupResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {S1SetupResponseIEs} }, + ... +} + + +S1SetupResponseIEs S1AP-PROTOCOL-IES ::= { + { ID id-MMEname CRITICALITY ignore TYPE MMEname PRESENCE optional}| + { ID id-ServedGUMMEIs CRITICALITY reject TYPE ServedGUMMEIs PRESENCE mandatory}| + { ID id-RelativeMMECapacity CRITICALITY ignore TYPE RelativeMMECapacity PRESENCE mandatory}| + { ID id-MMERelaySupportIndicator CRITICALITY ignore TYPE MMERelaySupportIndicator PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}| + { ID id-UE-RetentionInformation CRITICALITY ignore TYPE UE-RetentionInformation PRESENCE optional}| + { ID id-ServedDCNs CRITICALITY ignore TYPE ServedDCNs PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- S1 Setup Failure +-- +-- ************************************************************** + +S1SetupFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {S1SetupFailureIEs} }, + ... +} + +S1SetupFailureIEs S1AP-PROTOCOL-IES ::= { + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- ENB CONFIGURATION UPDATE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- eNB Configuration Update +-- +-- ************************************************************** + +ENBConfigurationUpdate ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ENBConfigurationUpdateIEs} }, + ... +} + +ENBConfigurationUpdateIEs S1AP-PROTOCOL-IES ::= { + { ID id-eNBname CRITICALITY ignore TYPE ENBname PRESENCE optional}| + { ID id-SupportedTAs CRITICALITY reject TYPE SupportedTAs PRESENCE optional}| + { ID id-CSG-IdList CRITICALITY reject TYPE CSG-IdList PRESENCE optional}| + { ID id-DefaultPagingDRX CRITICALITY ignore TYPE PagingDRX PRESENCE optional}| + { ID id-NB-IoT-DefaultPagingDRX CRITICALITY ignore TYPE NB-IoT-DefaultPagingDRX PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- eNB Configuration Update Acknowledge +-- +-- ************************************************************** + +ENBConfigurationUpdateAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ENBConfigurationUpdateAcknowledgeIEs} }, + ... +} + + +ENBConfigurationUpdateAcknowledgeIEs S1AP-PROTOCOL-IES ::= { + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- eNB Configuration Update Failure +-- +-- ************************************************************** + +ENBConfigurationUpdateFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ENBConfigurationUpdateFailureIEs} }, + ... +} + +ENBConfigurationUpdateFailureIEs S1AP-PROTOCOL-IES ::= { + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, +... +} + + +-- ************************************************************** +-- +-- MME CONFIGURATION UPDATE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- MME Configuration Update +-- +-- ************************************************************** + +MMEConfigurationUpdate ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {MMEConfigurationUpdateIEs} }, + ... +} + +MMEConfigurationUpdateIEs S1AP-PROTOCOL-IES ::= { + { ID id-MMEname CRITICALITY ignore TYPE MMEname PRESENCE optional }| + { ID id-ServedGUMMEIs CRITICALITY reject TYPE ServedGUMMEIs PRESENCE optional }| + { ID id-RelativeMMECapacity CRITICALITY reject TYPE RelativeMMECapacity PRESENCE optional }| + { ID id-ServedDCNs CRITICALITY ignore TYPE ServedDCNs PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- MME Configuration Update Acknowledge +-- +-- ************************************************************** + +MMEConfigurationUpdateAcknowledge ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {MMEConfigurationUpdateAcknowledgeIEs} }, + ... +} + + +MMEConfigurationUpdateAcknowledgeIEs S1AP-PROTOCOL-IES ::= { + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- MME Configuration Update Failure +-- +-- ************************************************************** + +MMEConfigurationUpdateFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {MMEConfigurationUpdateFailureIEs} }, + ... +} + +MMEConfigurationUpdateFailureIEs S1AP-PROTOCOL-IES ::= { + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }| + { ID id-TimeToWait CRITICALITY ignore TYPE TimeToWait PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- DOWNLINK S1 CDMA2000 TUNNELLING ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Downlink S1 CDMA2000 Tunnelling +-- +-- ************************************************************** + +DownlinkS1cdma2000tunnelling ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {DownlinkS1cdma2000tunnellingIEs} }, + ... +} + +DownlinkS1cdma2000tunnellingIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-E-RABSubjecttoDataForwardingList CRITICALITY ignore TYPE E-RABSubjecttoDataForwardingList PRESENCE optional }| + { ID id-cdma2000HOStatus CRITICALITY ignore TYPE Cdma2000HOStatus PRESENCE optional }| + { ID id-cdma2000RATType CRITICALITY reject TYPE Cdma2000RATType PRESENCE mandatory }| + { ID id-cdma2000PDU CRITICALITY reject TYPE Cdma2000PDU PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- UPLINK S1 CDMA2000 TUNNELLING ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Uplink S1 CDMA2000 Tunnelling +-- +-- ************************************************************** + +UplinkS1cdma2000tunnelling ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {UplinkS1cdma2000tunnellingIEs} }, + ... +} + +UplinkS1cdma2000tunnellingIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-cdma2000RATType CRITICALITY reject TYPE Cdma2000RATType PRESENCE mandatory }| + { ID id-cdma2000SectorID CRITICALITY reject TYPE Cdma2000SectorID PRESENCE mandatory }| + { ID id-cdma2000HORequiredIndication CRITICALITY ignore TYPE Cdma2000HORequiredIndication PRESENCE optional }| + { ID id-cdma2000OneXSRVCCInfo CRITICALITY reject TYPE Cdma2000OneXSRVCCInfo PRESENCE optional }| + { ID id-cdma2000OneXRAND CRITICALITY reject TYPE Cdma2000OneXRAND PRESENCE optional }| + { ID id-cdma2000PDU CRITICALITY reject TYPE Cdma2000PDU PRESENCE mandatory }| + { ID id-EUTRANRoundTripDelayEstimationInfo CRITICALITY ignore TYPE EUTRANRoundTripDelayEstimationInfo PRESENCE optional }, + -- Extension for Release 9 to assist target HRPD access with the acquisition of the UE -- + ... +} + + +-- ************************************************************** +-- +-- UE CAPABILITY INFO INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE Capability Info Indication +-- +-- ************************************************************** + +UECapabilityInfoIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UECapabilityInfoIndicationIEs} }, + ... +} + +UECapabilityInfoIndicationIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-UERadioCapability CRITICALITY ignore TYPE UERadioCapability PRESENCE mandatory}| + { ID id-UERadioCapabilityForPaging CRITICALITY ignore TYPE UERadioCapabilityForPaging PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- eNB STATUS TRANSFER ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- eNB Status Transfer +-- +-- ************************************************************** + +ENBStatusTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ENBStatusTransferIEs} }, + ... +} + +ENBStatusTransferIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-StatusTransfer-TransparentContainer CRITICALITY reject TYPE ENB-StatusTransfer-TransparentContainer PRESENCE mandatory}, + ... +} + + +-- ************************************************************** +-- +-- MME STATUS TRANSFER ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- MME Status Transfer +-- +-- ************************************************************** + +MMEStatusTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {MMEStatusTransferIEs} }, + ... +} + +MMEStatusTransferIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-StatusTransfer-TransparentContainer CRITICALITY reject TYPE ENB-StatusTransfer-TransparentContainer PRESENCE mandatory}, + ... +} + + +-- ************************************************************** +-- +-- TRACE ELEMENTARY PROCEDURES +-- +-- ************************************************************** +-- ************************************************************** +-- +-- Trace Start +-- +-- ************************************************************** + +TraceStart ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {TraceStartIEs} }, + ... +} + +TraceStartIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-TraceActivation CRITICALITY ignore TYPE TraceActivation PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- Trace Failure Indication +-- +-- ************************************************************** + +TraceFailureIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {TraceFailureIndicationIEs} }, + ... +} + +TraceFailureIndicationIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-E-UTRAN-Trace-ID CRITICALITY ignore TYPE E-UTRAN-Trace-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- DEACTIVATE TRACE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Deactivate Trace +-- +-- ************************************************************** + +DeactivateTrace ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { DeactivateTraceIEs} }, + ... +} + +DeactivateTraceIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-E-UTRAN-Trace-ID CRITICALITY ignore TYPE E-UTRAN-Trace-ID PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- CELL TRAFFIC TRACE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Cell Traffic Trace +-- +-- ************************************************************** + +CellTrafficTrace ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { CellTrafficTraceIEs } }, + ... +} + +CellTrafficTraceIEs S1AP-PROTOCOL-IES ::= { + {ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + {ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + {ID id-E-UTRAN-Trace-ID CRITICALITY ignore TYPE E-UTRAN-Trace-ID PRESENCE mandatory }| + {ID id-EUTRAN-CGI CRITICALITY ignore TYPE EUTRAN-CGI PRESENCE mandatory }| + {ID id-TraceCollectionEntityIPAddress CRITICALITY ignore TYPE TransportLayerAddress PRESENCE mandatory }| + {ID id-PrivacyIndicator CRITICALITY ignore TYPE PrivacyIndicator PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- LOCATION ELEMENTARY PROCEDURES +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Location Reporting Control +-- +-- ************************************************************** + +LocationReportingControl ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { LocationReportingControlIEs} }, + ... +} + +LocationReportingControlIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-RequestType CRITICALITY ignore TYPE RequestType PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- Location Report Failure Indication +-- +-- ************************************************************** + +LocationReportingFailureIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { LocationReportingFailureIndicationIEs} }, + ... +} + +LocationReportingFailureIndicationIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- Location Report +-- +-- ************************************************************** + +LocationReport ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { LocationReportIEs} }, + ... +} + +LocationReportIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-EUTRAN-CGI CRITICALITY ignore TYPE EUTRAN-CGI PRESENCE mandatory }| + { ID id-TAI CRITICALITY ignore TYPE TAI PRESENCE mandatory }| + { ID id-RequestType CRITICALITY ignore TYPE RequestType PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- OVERLOAD ELEMENTARY PROCEDURES +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Overload Start +-- +-- ************************************************************** + +OverloadStart ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {OverloadStartIEs} }, + ... +} + +OverloadStartIEs S1AP-PROTOCOL-IES ::= { + { ID id-OverloadResponse CRITICALITY reject TYPE OverloadResponse PRESENCE mandatory }| + { ID id-GUMMEIList CRITICALITY ignore TYPE GUMMEIList PRESENCE optional }| + { ID id-TrafficLoadReductionIndication CRITICALITY ignore TYPE TrafficLoadReductionIndication PRESENCE optional }, + ... +} +-- ************************************************************** +-- +-- Overload Stop +-- +-- ************************************************************** + +OverloadStop ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {OverloadStopIEs} }, + ... +} + +OverloadStopIEs S1AP-PROTOCOL-IES ::= { +{ ID id-GUMMEIList CRITICALITY ignore TYPE GUMMEIList PRESENCE optional }, + ... +} +-- ************************************************************** +-- +-- WRITE-REPLACE WARNING ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Write-Replace Warning Request +-- +-- ************************************************************** + + +WriteReplaceWarningRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {WriteReplaceWarningRequestIEs} }, + ... +} + +WriteReplaceWarningRequestIEs S1AP-PROTOCOL-IES ::= { + { ID id-MessageIdentifier CRITICALITY reject TYPE MessageIdentifier PRESENCE mandatory }| + { ID id-SerialNumber CRITICALITY reject TYPE SerialNumber PRESENCE mandatory }| + { ID id-WarningAreaList CRITICALITY ignore TYPE WarningAreaList PRESENCE optional }| + { ID id-RepetitionPeriod CRITICALITY reject TYPE RepetitionPeriod PRESENCE mandatory }| + { ID id-ExtendedRepetitionPeriod CRITICALITY reject TYPE ExtendedRepetitionPeriod PRESENCE optional }| + { ID id-NumberofBroadcastRequest CRITICALITY reject TYPE NumberofBroadcastRequest PRESENCE mandatory }| + { ID id-WarningType CRITICALITY ignore TYPE WarningType PRESENCE optional }| + { ID id-WarningSecurityInfo CRITICALITY ignore TYPE WarningSecurityInfo PRESENCE optional }| + { ID id-DataCodingScheme CRITICALITY ignore TYPE DataCodingScheme PRESENCE optional }| + { ID id-WarningMessageContents CRITICALITY ignore TYPE WarningMessageContents PRESENCE optional }| + { ID id-ConcurrentWarningMessageIndicator CRITICALITY reject TYPE ConcurrentWarningMessageIndicator PRESENCE optional }, + ... +} +-- ************************************************************** +-- +-- Write-Replace Warning Response +-- +-- ************************************************************** + +WriteReplaceWarningResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {WriteReplaceWarningResponseIEs} }, + ... +} + +WriteReplaceWarningResponseIEs S1AP-PROTOCOL-IES ::= { + { ID id-MessageIdentifier CRITICALITY reject TYPE MessageIdentifier PRESENCE mandatory }| + { ID id-SerialNumber CRITICALITY reject TYPE SerialNumber PRESENCE mandatory }| + { ID id-BroadcastCompletedAreaList CRITICALITY ignore TYPE BroadcastCompletedAreaList PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- eNB DIRECT INFORMATION TRANSFER ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- eNB Direct Information Transfer +-- +-- ************************************************************** + +ENBDirectInformationTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ ENBDirectInformationTransferIEs}}, + ... +} + +ENBDirectInformationTransferIEs S1AP-PROTOCOL-IES ::= { + { ID id-Inter-SystemInformationTransferTypeEDT CRITICALITY reject TYPE Inter-SystemInformationTransferType PRESENCE mandatory }, + ... +} + +Inter-SystemInformationTransferType ::= CHOICE { + rIMTransfer RIMTransfer, + ... +} + +-- ************************************************************** +-- +-- MME DIRECT INFORMATION TRANSFER ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- MME Direct Information Transfer +-- +-- ************************************************************** + +MMEDirectInformationTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ MMEDirectInformationTransferIEs}}, + ... +} + +MMEDirectInformationTransferIEs S1AP-PROTOCOL-IES ::= { + { ID id-Inter-SystemInformationTransferTypeMDT CRITICALITY reject TYPE Inter-SystemInformationTransferType PRESENCE mandatory }, + ... +} +-- ************************************************************** +-- +-- eNB CONFIGURATION TRANSFER ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- eNB Configuration Transfer +-- +-- ************************************************************** + +ENBConfigurationTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ ENBConfigurationTransferIEs}}, + ... +} + +ENBConfigurationTransferIEs S1AP-PROTOCOL-IES ::= { + { ID id-SONConfigurationTransferECT CRITICALITY ignore TYPE SONConfigurationTransfer PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- MME CONFIGURATION TRANSFER ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- MME Configuration Transfer +-- +-- ************************************************************** + +MMEConfigurationTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ MMEConfigurationTransferIEs}}, + ... +} + +MMEConfigurationTransferIEs S1AP-PROTOCOL-IES ::= { + { ID id-SONConfigurationTransferMCT CRITICALITY ignore TYPE SONConfigurationTransfer PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- PRIVATE MESSAGE ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Private Message +-- +-- ************************************************************** + +PrivateMessage ::= SEQUENCE { + privateIEs PrivateIE-Container {{PrivateMessageIEs}}, + ... +} + +PrivateMessageIEs S1AP-PRIVATE-IES ::= { + ... +} + +-- ************************************************************** +-- +-- KILL PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- Kill Request +-- +-- ************************************************************** + + +KillRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {KillRequestIEs} }, + ... +} + +KillRequestIEs S1AP-PROTOCOL-IES ::= { + { ID id-MessageIdentifier CRITICALITY reject TYPE MessageIdentifier PRESENCE mandatory}| + { ID id-SerialNumber CRITICALITY reject TYPE SerialNumber PRESENCE mandatory}| + { ID id-WarningAreaList CRITICALITY ignore TYPE WarningAreaList PRESENCE optional}| + { ID id-KillAllWarningMessages CRITICALITY reject TYPE KillAllWarningMessages PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- Kill Response +-- +-- ************************************************************** + +KillResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {KillResponseIEs} }, + ... +} + +KillResponseIEs S1AP-PROTOCOL-IES ::= { + { ID id-MessageIdentifier CRITICALITY reject TYPE MessageIdentifier PRESENCE mandatory }| + { ID id-SerialNumber CRITICALITY reject TYPE SerialNumber PRESENCE mandatory }| + { ID id-BroadcastCancelledAreaList CRITICALITY ignore TYPE BroadcastCancelledAreaList PRESENCE optional }| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- PWS RESTART INDICATION PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- PWS Restart Indication +-- +-- ************************************************************** + +PWSRestartIndication::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ PWSRestartIndicationIEs}}, + ... +} + +PWSRestartIndicationIEs S1AP-PROTOCOL-IES ::= { + { ID id-ECGIListForRestart CRITICALITY reject TYPE ECGIListForRestart PRESENCE mandatory}| + { ID id-Global-ENB-ID CRITICALITY reject TYPE Global-ENB-ID PRESENCE mandatory}| + { ID id-TAIListForRestart CRITICALITY reject TYPE TAIListForRestart PRESENCE mandatory}| + { ID id-EmergencyAreaIDListForRestart CRITICALITY reject TYPE EmergencyAreaIDListForRestart PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- PWS Failure Indication +-- +-- ************************************************************** + +PWSFailureIndication::= SEQUENCE { + protocolIEs ProtocolIE-Container {{ PWSFailureIndicationIEs}}, + ... +} + +PWSFailureIndicationIEs S1AP-PROTOCOL-IES ::= { + { ID id-PWSfailedECGIList CRITICALITY reject TYPE PWSfailedECGIList PRESENCE mandatory}| + { ID id-Global-ENB-ID CRITICALITY reject TYPE Global-ENB-ID PRESENCE mandatory}, + ... +} + +-- ************************************************************** +-- +-- LPPA TRANSPORT ELEMENTARY PROCEDURES +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- DOWNLINK UE ASSOCIATED LPPA TRANSPORT +-- +-- ************************************************************** + +DownlinkUEAssociatedLPPaTransport ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{DownlinkUEAssociatedLPPaTransport-IEs}}, + ... +} + +DownlinkUEAssociatedLPPaTransport-IEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-Routing-ID CRITICALITY reject TYPE Routing-ID PRESENCE mandatory }| + { ID id-LPPa-PDU CRITICALITY reject TYPE LPPa-PDU PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- UPLINK UE ASSOCIATED LPPA TRANSPORT +-- +-- ************************************************************** + +UplinkUEAssociatedLPPaTransport ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{UplinkUEAssociatedLPPaTransport-IEs}}, + ... +} + +UplinkUEAssociatedLPPaTransport-IEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory }| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory }| + { ID id-Routing-ID CRITICALITY reject TYPE Routing-ID PRESENCE mandatory }| + { ID id-LPPa-PDU CRITICALITY reject TYPE LPPa-PDU PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- DOWNLINK NON UE ASSOCIATED LPPA TRANSPORT +-- +-- ************************************************************** + +DownlinkNonUEAssociatedLPPaTransport ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{DownlinkNonUEAssociatedLPPaTransport-IEs}}, + ... +} + +DownlinkNonUEAssociatedLPPaTransport-IEs S1AP-PROTOCOL-IES ::= { + { ID id-Routing-ID CRITICALITY reject TYPE Routing-ID PRESENCE mandatory }| + { ID id-LPPa-PDU CRITICALITY reject TYPE LPPa-PDU PRESENCE mandatory }, + ... +} + +-- ************************************************************** +-- +-- UPLINK NON UE ASSOCIATED LPPA TRANSPORT +-- +-- ************************************************************** + +UplinkNonUEAssociatedLPPaTransport ::= SEQUENCE { + protocolIEs ProtocolIE-Container {{UplinkNonUEAssociatedLPPaTransport-IEs}}, + ... +} + +UplinkNonUEAssociatedLPPaTransport-IEs S1AP-PROTOCOL-IES ::= { + { ID id-Routing-ID CRITICALITY reject TYPE Routing-ID PRESENCE mandatory }| + { ID id-LPPa-PDU CRITICALITY reject TYPE LPPa-PDU PRESENCE mandatory }, + ... +} + + +-- ************************************************************** +-- +-- E-RAB MODIFICATION INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- E-RAB Modification Indication +-- +-- ************************************************************** + +E-RABModificationIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { E-RABModificationIndicationIEs} }, + ... +} + +E-RABModificationIndicationIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-E-RABToBeModifiedListBearerModInd CRITICALITY reject TYPE E-RABToBeModifiedListBearerModInd PRESENCE mandatory}| + { ID id-E-RABNotToBeModifiedListBearerModInd CRITICALITY reject TYPE E-RABNotToBeModifiedListBearerModInd PRESENCE optional}| + { ID id-CSGMembershipInfo CRITICALITY reject TYPE CSGMembershipInfo PRESENCE optional}| +-- Extension for Release 11 to support BBAI -- + { ID id-Tunnel-Information-for-BBF CRITICALITY ignore TYPE TunnelInformation PRESENCE optional}, + ... +} + +E-RABToBeModifiedListBearerModInd ::= E-RAB-IE-ContainerList { {E-RABToBeModifiedItemBearerModIndIEs} } + +E-RABToBeModifiedItemBearerModIndIEs S1AP-PROTOCOL-IES ::= { + { ID id-E-RABToBeModifiedItemBearerModInd CRITICALITY reject TYPE E-RABToBeModifiedItemBearerModInd PRESENCE mandatory}, + ... +} + +E-RABToBeModifiedItemBearerModInd ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + transportLayerAddress TransportLayerAddress, + dL-GTP-TEID GTP-TEID, + iE-Extensions ProtocolExtensionContainer { { E-RABToBeModifiedItemBearerModInd-ExtIEs} } OPTIONAL, + ... +} + +E-RABToBeModifiedItemBearerModInd-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-RABNotToBeModifiedListBearerModInd ::= E-RAB-IE-ContainerList { {E-RABNotToBeModifiedItemBearerModIndIEs} } + +E-RABNotToBeModifiedItemBearerModIndIEs S1AP-PROTOCOL-IES ::= { + { ID id-E-RABNotToBeModifiedItemBearerModInd CRITICALITY reject TYPE E-RABNotToBeModifiedItemBearerModInd PRESENCE mandatory}, + ... +} + +E-RABNotToBeModifiedItemBearerModInd ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + transportLayerAddress TransportLayerAddress, + dL-GTP-TEID GTP-TEID, + iE-Extensions ProtocolExtensionContainer { { E-RABNotToBeModifiedItemBearerModInd-ExtIEs} } OPTIONAL, + ... +} + +E-RABNotToBeModifiedItemBearerModInd-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CSGMembershipInfo ::= SEQUENCE { + cSGMembershipStatus CSGMembershipStatus, + cSG-Id CSG-Id, + cellAccessMode CellAccessMode OPTIONAL, + pLMNidentity PLMNidentity OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { CSGMembershipInfo-ExtIEs} } OPTIONAL, + ... +} + +CSGMembershipInfo-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- ************************************************************** +-- +-- E-RAB Modification Confirm +-- +-- ************************************************************** + +E-RABModificationConfirm ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {E-RABModificationConfirmIEs} }, + ... +} + +E-RABModificationConfirmIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY ignore TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-E-RABModifyListBearerModConf CRITICALITY ignore TYPE E-RABModifyListBearerModConf PRESENCE optional}| + { ID id-E-RABFailedToModifyListBearerModConf CRITICALITY ignore TYPE E-RABList PRESENCE optional}| + { ID id-E-RABToBeReleasedListBearerModConf CRITICALITY ignore TYPE E-RABList PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}| + { ID id-CSGMembershipStatus CRITICALITY ignore TYPE CSGMembershipStatus PRESENCE optional}, + ... +} + +E-RABModifyListBearerModConf ::= SEQUENCE (SIZE(1.. maxnoofE-RABs)) OF ProtocolIE-SingleContainer { {E-RABModifyItemBearerModConfIEs} } + +E-RABModifyItemBearerModConfIEs S1AP-PROTOCOL-IES ::= { + { ID id-E-RABModifyItemBearerModConf CRITICALITY ignore TYPE E-RABModifyItemBearerModConf PRESENCE mandatory}, + ... +} + +E-RABModifyItemBearerModConf ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + iE-Extensions ProtocolExtensionContainer { {E-RABModifyItemBearerModConfExtIEs} } OPTIONAL, + ... +} + + +E-RABModifyItemBearerModConfExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +-- ************************************************************** +-- +-- UE CONTEXT MODIFICATION INDICATION ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE Context Modification Indication +-- +-- ************************************************************** + +UEContextModificationIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextModificationIndicationIEs} }, + ... +} + +UEContextModificationIndicationIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-CSGMembershipInfo CRITICALITY reject TYPE CSGMembershipInfo PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- UE Context Modification Confirm +-- +-- ************************************************************** + +UEContextModificationConfirm ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {UEContextModificationConfirmIEs} }, + ... +} + +UEContextModificationConfirmIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY ignore TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-CSGMembershipStatus CRITICALITY ignore TYPE CSGMembershipStatus PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT SUSPEND ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE Context Suspend Request +-- +-- ************************************************************** + +UEContextSuspendRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextSuspendRequestIEs} }, + ... +} + +UEContextSuspendRequestIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-InformationOnRecommendedCellsAndENBsForPaging CRITICALITY ignore TYPE InformationOnRecommendedCellsAndENBsForPaging PRESENCE optional}| + { ID id-CellIdentifierAndCELevelForCECapableUEs CRITICALITY ignore TYPE CellIdentifierAndCELevelForCECapableUEs PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- UE Context Suspend Response +-- +-- ************************************************************** + +UEContextSuspendResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { {UEContextSuspendResponseIEs} }, + ... +} + +UEContextSuspendResponseIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY ignore TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}| + { ID id-SecurityContext CRITICALITY reject TYPE SecurityContext PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- UE CONTEXT RESUME ELEMENTARY PROCEDURE +-- +-- ************************************************************** + +-- ************************************************************** +-- +-- UE Context Resume Request +-- +-- ************************************************************** + +UEContextResumeRequest ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextResumeRequestIEs} }, + ... +} + +UEContextResumeRequestIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-E-RABFailedToResumeListResumeReq CRITICALITY reject TYPE E-RABFailedToResumeListResumeReq PRESENCE optional}| + { ID id-RRC-Resume-Cause CRITICALITY ignore TYPE RRC-Establishment-Cause PRESENCE optional}, + ... +} + +E-RABFailedToResumeListResumeReq ::= E-RAB-IE-ContainerList { {E-RABFailedToResumeItemResumeReqIEs} } + +E-RABFailedToResumeItemResumeReqIEs S1AP-PROTOCOL-IES ::= { + { ID id-E-RABFailedToResumeItemResumeReq CRITICALITY reject TYPE E-RABFailedToResumeItemResumeReq PRESENCE mandatory}, + ... +} + +E-RABFailedToResumeItemResumeReq ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + cause Cause, + iE-Extensions ProtocolExtensionContainer { { E-RABFailedToResumeItemResumeReq-ExtIEs} } OPTIONAL, + ... +} + +E-RABFailedToResumeItemResumeReq-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- ************************************************************** +-- +-- UE Context Resume Response +-- +-- ************************************************************** + +UEContextResumeResponse ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextResumeResponseIEs} }, + ... +} + +UEContextResumeResponseIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY ignore TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-E-RABFailedToResumeListResumeRes CRITICALITY reject TYPE E-RABFailedToResumeListResumeRes PRESENCE optional}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}| + { ID id-SecurityContext CRITICALITY reject TYPE SecurityContext PRESENCE optional}, + ... +} + +E-RABFailedToResumeListResumeRes ::= E-RAB-IE-ContainerList { {E-RABFailedToResumeItemResumeResIEs} } + +E-RABFailedToResumeItemResumeResIEs S1AP-PROTOCOL-IES ::= { + { ID id-E-RABFailedToResumeItemResumeRes CRITICALITY reject TYPE E-RABFailedToResumeItemResumeRes PRESENCE mandatory}, + ... +} + +E-RABFailedToResumeItemResumeRes ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + cause Cause, + iE-Extensions ProtocolExtensionContainer { { E-RABFailedToResumeItemResumeRes-ExtIEs} } OPTIONAL, + ... +} + +E-RABFailedToResumeItemResumeRes-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- ************************************************************** +-- +-- UE Context Resume Failure +-- +-- ************************************************************** + +UEContextResumeFailure ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEContextResumeFailureIEs} }, + ... +} + +UEContextResumeFailureIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY ignore TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-Cause CRITICALITY ignore TYPE Cause PRESENCE mandatory}| + { ID id-CriticalityDiagnostics CRITICALITY ignore TYPE CriticalityDiagnostics PRESENCE optional}, + ... +} + +-- ************************************************************** +-- +-- Connection Establishment Indication +-- +-- ************************************************************** + +ConnectionEstablishmentIndication::= SEQUENCE { + protocolIEs ProtocolIE-Container { {ConnectionEstablishmentIndicationIEs} }, + ... +} + +ConnectionEstablishmentIndicationIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY ignore TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY ignore TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-UERadioCapability CRITICALITY ignore TYPE UERadioCapability PRESENCE optional }| + { ID id-EnhancedCoverageRestricted CRITICALITY ignore TYPE EnhancedCoverageRestricted PRESENCE optional }| + { ID id-DL-CP-SecurityInformation CRITICALITY ignore TYPE DL-CP-SecurityInformation PRESENCE optional }, + ... +} + +-- ************************************************************** +-- +-- Retrieve UE Information +-- +-- ************************************************************** + +RetrieveUEInformation ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { RetrieveUEInformationIEs} }, + ... +} + +RetrieveUEInformationIEs S1AP-PROTOCOL-IES ::= { + { ID id-S-TMSI CRITICALITY reject TYPE S-TMSI PRESENCE mandatory}, +... + +} + + +-- ************************************************************** + +-- UE Information Transfer +-- +-- ************************************************************** +UEInformationTransfer ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { UEInformationTransferIEs} }, + ... +} + +UEInformationTransferIEs S1AP-PROTOCOL-IES ::= { + { ID id-S-TMSI CRITICALITY reject TYPE S-TMSI PRESENCE mandatory}| + { ID id-UE-Level-QoS-Parameters CRITICALITY ignore TYPE E-RABLevelQoSParameters PRESENCE optional}| + { ID id-UERadioCapability CRITICALITY ignore TYPE UERadioCapability PRESENCE optional}, + ... +} + + +-- ************************************************************** +-- +-- eNB CP Relocation Indication +-- +-- ************************************************************** + +ENBCPRelocationIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { ENBCPRelocationIndicationIEs} }, + ... +} + +ENBCPRelocationIndicationIEs S1AP-PROTOCOL-IES ::= { + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory}| + { ID id-S-TMSI CRITICALITY reject TYPE S-TMSI PRESENCE mandatory}| + { ID id-EUTRAN-CGI CRITICALITY ignore TYPE EUTRAN-CGI PRESENCE mandatory}| + { ID id-TAI CRITICALITY ignore TYPE TAI PRESENCE mandatory}| + { ID id-UL-CP-SecurityInformation CRITICALITY reject TYPE UL-CP-SecurityInformation PRESENCE mandatory}, + ... +} + + +-- ************************************************************** +-- +-- MME CP Relocation Indication +-- +-- ************************************************************** + +MMECPRelocationIndication ::= SEQUENCE { + protocolIEs ProtocolIE-Container { { MMECPRelocationIndicationIEs} }, + ... +} + +MMECPRelocationIndicationIEs S1AP-PROTOCOL-IES ::= { + { ID id-MME-UE-S1AP-ID CRITICALITY reject TYPE MME-UE-S1AP-ID PRESENCE mandatory}| + { ID id-eNB-UE-S1AP-ID CRITICALITY reject TYPE ENB-UE-S1AP-ID PRESENCE mandatory}, + ... +} + +END + + + +-- ************************************************************** +-- +-- Information Element Definitions +-- +-- ************************************************************** + +S1AP-IEs { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +eps-Access (21) modules (3) s1ap (1) version1 (1) s1ap-IEs (2) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +IMPORTS + id-E-RABInformationListItem, + id-E-RABItem, + id-Bearers-SubjectToStatusTransfer-Item, + id-Time-Synchronisation-Info, + id-x2TNLConfigurationInfo, + id-eNBX2ExtendedTransportLayerAddresses, + id-MDTConfiguration, + id-Time-UE-StayedInCell-EnhancedGranularity, + id-HO-Cause, + id-M3Configuration, + id-M4Configuration, + id-M5Configuration, + id-MDT-Location-Info, + id-SignallingBasedMDTPLMNList, + id-MobilityInformation, + id-ULCOUNTValueExtended, + id-DLCOUNTValueExtended, + id-ReceiveStatusOfULPDCPSDUsExtended, + id-eNBIndirectX2TransportLayerAddresses, + id-Muting-Availability-Indication, + id-Muting-Pattern-Information, + id-Synchronisation-Information, + id-uE-HistoryInformationFromTheUE, + id-LoggedMBSFNMDT, + id-SON-Information-Report, + id-RecommendedCellItem, + id-RecommendedENBItem, + id-ProSeUEtoNetworkRelaying, + id-ULCOUNTValuePDCP-SNlength18, + id-DLCOUNTValuePDCP-SNlength18, + id-ReceiveStatusOfULPDCPSDUsPDCP-SNlength18, + id-M6Configuration, + id-M7Configuration, + id-RAT-Type, + maxnoofCSGs, + maxnoofE-RABs, + maxnoofErrors, + maxnoofBPLMNs, + maxnoofPLMNsPerMME, + maxnoofTACs, + maxnoofEPLMNs, + maxnoofEPLMNsPlusOne, + maxnoofForbLACs, + maxnoofForbTACs, + maxnoofCells, + maxnoofCellID, + maxnoofDCNs, + maxnoofEmergencyAreaID, + maxnoofTAIforWarning, + maxnoofCellinTAI, + maxnoofCellinEAI, + maxnoofeNBX2TLAs, + maxnoofeNBX2ExtTLAs, + maxnoofeNBX2GTPTLAs, + maxnoofRATs, + maxnoofGroupIDs, + maxnoofMMECs, + maxnoofTAforMDT, + maxnoofCellIDforMDT, + maxnoofMDTPLMNs, + maxnoofCellsforRestart, + maxnoofRestartTAIs, + maxnoofRestartEmergencyAreaIDs, + maxnoofMBSFNAreaMDT, + maxEARFCN, + maxnoofCellsineNB, + maxnoofRecommendedCells, + maxnoofRecommendedENBs + + + +FROM S1AP-Constants + + Criticality, + ProcedureCode, + ProtocolIE-ID, + TriggeringMessage +FROM S1AP-CommonDataTypes + + ProtocolExtensionContainer{}, + S1AP-PROTOCOL-EXTENSION, + ProtocolIE-SingleContainer{}, + S1AP-PROTOCOL-IES + +FROM S1AP-Containers; + +-- A + +Additional-GUTI::= SEQUENCE { + gUMMEI GUMMEI, + m-TMSI M-TMSI, + iE-Extensions ProtocolExtensionContainer { {Additional-GUTI-ExtIEs} } OPTIONAL, + ... +} + +Additional-GUTI-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AreaScopeOfMDT ::= CHOICE { + cellBased CellBasedMDT, + tABased TABasedMDT, + pLMNWide NULL, + ..., + tAIBased TAIBasedMDT +} + +AllocationAndRetentionPriority ::= SEQUENCE { + priorityLevel PriorityLevel, + pre-emptionCapability Pre-emptionCapability, + pre-emptionVulnerability Pre-emptionVulnerability, + iE-Extensions ProtocolExtensionContainer { {AllocationAndRetentionPriority-ExtIEs} } OPTIONAL, + ... +} + +AllocationAndRetentionPriority-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AssistanceDataForCECapableUEs ::= SEQUENCE { + cellIdentifierAndCELevelForCECapableUEs CellIdentifierAndCELevelForCECapableUEs, + iE-Extensions ProtocolExtensionContainer { { InformationForCECapableUEs-ExtIEs} } OPTIONAL, + ... +} + +InformationForCECapableUEs-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AssistanceDataForPaging ::= SEQUENCE { + assistanceDataForRecommendedCells AssistanceDataForRecommendedCells OPTIONAL, + assistanceDataForCECapableUEs AssistanceDataForCECapableUEs OPTIONAL, + pagingAttemptInformation PagingAttemptInformation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { AssistanceDataForPaging-ExtIEs} } OPTIONAL, + ... +} + +AssistanceDataForPaging-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +AssistanceDataForRecommendedCells ::= SEQUENCE { + recommendedCellsForPaging RecommendedCellsForPaging, + iE-Extensions ProtocolExtensionContainer { { AssistanceDataForRecommendedCells-ExtIEs} } OPTIONAL, + ... +} + +AssistanceDataForRecommendedCells-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- B + +Bearers-SubjectToStatusTransferList ::= SEQUENCE (SIZE(1.. maxnoofE-RABs)) OF ProtocolIE-SingleContainer { { Bearers-SubjectToStatusTransfer-ItemIEs } } + +Bearers-SubjectToStatusTransfer-ItemIEs S1AP-PROTOCOL-IES ::= { + { ID id-Bearers-SubjectToStatusTransfer-Item CRITICALITY ignore TYPE Bearers-SubjectToStatusTransfer-Item PRESENCE mandatory }, + ... +} + +Bearers-SubjectToStatusTransfer-Item ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + uL-COUNTvalue COUNTvalue, + dL-COUNTvalue COUNTvalue, + receiveStatusofULPDCPSDUs ReceiveStatusofULPDCPSDUs OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {Bearers-SubjectToStatusTransfer-ItemExtIEs} } OPTIONAL, + ... +} + +Bearers-SubjectToStatusTransfer-ItemExtIEs S1AP-PROTOCOL-EXTENSION ::= { + { ID id-ULCOUNTValueExtended CRITICALITY ignore EXTENSION COUNTValueExtended PRESENCE optional}| + { ID id-DLCOUNTValueExtended CRITICALITY ignore EXTENSION COUNTValueExtended PRESENCE optional}| + { ID id-ReceiveStatusOfULPDCPSDUsExtended CRITICALITY ignore EXTENSION ReceiveStatusOfULPDCPSDUsExtended PRESENCE optional}| + { ID id-ULCOUNTValuePDCP-SNlength18 CRITICALITY ignore EXTENSION COUNTvaluePDCP-SNlength18 PRESENCE optional}| + { ID id-DLCOUNTValuePDCP-SNlength18 CRITICALITY ignore EXTENSION COUNTvaluePDCP-SNlength18 PRESENCE optional}| + { ID id-ReceiveStatusOfULPDCPSDUsPDCP-SNlength18 CRITICALITY ignore EXTENSION ReceiveStatusOfULPDCPSDUsPDCP-SNlength18 PRESENCE optional}, + ... +} + +BearerType ::= ENUMERATED { + non-IP, + ... +} + +BitRate ::= INTEGER (0..10000000000) + +BPLMNs ::= SEQUENCE (SIZE(1.. maxnoofBPLMNs)) OF PLMNidentity + +BroadcastCancelledAreaList ::= CHOICE { + cellID-Cancelled CellID-Cancelled, + tAI-Cancelled TAI-Cancelled, + emergencyAreaID-Cancelled EmergencyAreaID-Cancelled, + ... +} + +BroadcastCompletedAreaList ::= CHOICE { + cellID-Broadcast CellID-Broadcast, + tAI-Broadcast TAI-Broadcast, + emergencyAreaID-Broadcast EmergencyAreaID-Broadcast, + ... +} + + +-- C + +CancelledCellinEAI ::= SEQUENCE (SIZE(1..maxnoofCellinEAI)) OF CancelledCellinEAI-Item + +CancelledCellinEAI-Item ::= SEQUENCE { + eCGI EUTRAN-CGI, + numberOfBroadcasts NumberOfBroadcasts, + iE-Extensions ProtocolExtensionContainer { {CancelledCellinEAI-Item-ExtIEs} } OPTIONAL, + ... +} + +CancelledCellinEAI-Item-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CancelledCellinTAI ::= SEQUENCE (SIZE(1..maxnoofCellinTAI)) OF CancelledCellinTAI-Item + +CancelledCellinTAI-Item ::= SEQUENCE{ + eCGI EUTRAN-CGI, + numberOfBroadcasts NumberOfBroadcasts, + iE-Extensions ProtocolExtensionContainer { {CancelledCellinTAI-Item-ExtIEs} } OPTIONAL, + ... +} + +CancelledCellinTAI-Item-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cause ::= CHOICE { + radioNetwork CauseRadioNetwork, + transport CauseTransport, + nas CauseNas, + protocol CauseProtocol, + misc CauseMisc, + ... +} + +CauseMisc ::= ENUMERATED { + control-processing-overload, + not-enough-user-plane-processing-resources, + hardware-failure, + om-intervention, + unspecified, + unknown-PLMN, +... +} + +CauseProtocol ::= ENUMERATED { + transfer-syntax-error, + abstract-syntax-error-reject, + abstract-syntax-error-ignore-and-notify, + message-not-compatible-with-receiver-state, + semantic-error, + abstract-syntax-error-falsely-constructed-message, + unspecified, + ... +} + +CauseRadioNetwork ::= ENUMERATED { + unspecified, + tx2relocoverall-expiry, + successful-handover, + release-due-to-eutran-generated-reason, + handover-cancelled, + partial-handover, + ho-failure-in-target-EPC-eNB-or-target-system, + ho-target-not-allowed, + tS1relocoverall-expiry, + tS1relocprep-expiry, + cell-not-available, + unknown-targetID, + no-radio-resources-available-in-target-cell, + unknown-mme-ue-s1ap-id, + unknown-enb-ue-s1ap-id, + unknown-pair-ue-s1ap-id, + handover-desirable-for-radio-reason, + time-critical-handover, + resource-optimisation-handover, + reduce-load-in-serving-cell, + user-inactivity, + radio-connection-with-ue-lost, + load-balancing-tau-required, + cs-fallback-triggered, + ue-not-available-for-ps-service, + radio-resources-not-available, + failure-in-radio-interface-procedure, + invalid-qos-combination, + interrat-redirection, + interaction-with-other-procedure, + unknown-E-RAB-ID, + multiple-E-RAB-ID-instances, + encryption-and-or-integrity-protection-algorithms-not-supported, + s1-intra-system-handover-triggered, + s1-inter-system-handover-triggered, + x2-handover-triggered, + ..., + redirection-towards-1xRTT, + not-supported-QCI-value, + invalid-CSG-Id, + release-due-to-pre-emption + +} + +CauseTransport ::= ENUMERATED { + transport-resource-unavailable, + unspecified, + ... +} + +CauseNas ::= ENUMERATED { + normal-release, + authentication-failure, + detach, + unspecified, + ..., + csg-subscription-expiry +} + +CellAccessMode ::= ENUMERATED { + hybrid, + ... +} + +CellIdentifierAndCELevelForCECapableUEs ::= SEQUENCE { + global-Cell-ID EUTRAN-CGI, + cELevel CELevel, + iE-Extensions ProtocolExtensionContainer { { CellIdentifierAndCELevelForCECapableUEs-ExtIEs} } OPTIONAL, + ... +} + +CellIdentifierAndCELevelForCECapableUEs-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- Coverage Enhancement level encoded according to TS 36.331 [16] -- +CELevel ::= OCTET STRING + +CE-mode-B-SupportIndicator ::= ENUMERATED { + supported, + ... +} + +CellIdentity ::= BIT STRING (SIZE (28)) + +CellID-Broadcast ::= SEQUENCE (SIZE(1..maxnoofCellID)) OF CellID-Broadcast-Item + +CellID-Broadcast-Item ::= SEQUENCE { + eCGI EUTRAN-CGI, + iE-Extensions ProtocolExtensionContainer { {CellID-Broadcast-Item-ExtIEs} } OPTIONAL, + ... +} + +CellID-Broadcast-Item-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CellID-Cancelled::= SEQUENCE (SIZE(1..maxnoofCellID)) OF CellID-Cancelled-Item + +CellID-Cancelled-Item ::= SEQUENCE { + eCGI EUTRAN-CGI, + numberOfBroadcasts NumberOfBroadcasts, + iE-Extensions ProtocolExtensionContainer { {CellID-Cancelled-Item-ExtIEs} } OPTIONAL, + ... +} + +CellID-Cancelled-Item-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CellBasedMDT::= SEQUENCE { + cellIdListforMDT CellIdListforMDT, + iE-Extensions ProtocolExtensionContainer { {CellBasedMDT-ExtIEs} } OPTIONAL, + ... +} + +CellBasedMDT-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CellIdListforMDT ::= SEQUENCE (SIZE(1..maxnoofCellIDforMDT)) OF EUTRAN-CGI + +Cdma2000PDU ::= OCTET STRING + +Cdma2000RATType ::= ENUMERATED { + hRPD, + onexRTT, + ... +} + +Cdma2000SectorID ::= OCTET STRING + +Cdma2000HOStatus ::= ENUMERATED { + hOSuccess, + hOFailure, + ... +} + +Cdma2000HORequiredIndication ::= ENUMERATED { + true, + ... +} + +Cdma2000OneXSRVCCInfo ::= SEQUENCE { + cdma2000OneXMEID Cdma2000OneXMEID, + cdma2000OneXMSI Cdma2000OneXMSI, + cdma2000OneXPilot Cdma2000OneXPilot, + iE-Extensions ProtocolExtensionContainer { {Cdma2000OneXSRVCCInfo-ExtIEs} } OPTIONAL, + ... +} + +Cdma2000OneXSRVCCInfo-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Cdma2000OneXMEID ::= OCTET STRING + +Cdma2000OneXMSI ::= OCTET STRING + +Cdma2000OneXPilot ::= OCTET STRING + +Cdma2000OneXRAND ::= OCTET STRING + + +Cell-Size ::= ENUMERATED {verysmall, small, medium, large, ...} + +CellType ::= SEQUENCE { + cell-Size Cell-Size, + iE-Extensions ProtocolExtensionContainer { { CellType-ExtIEs}} OPTIONAL, + ... +} + +CellType-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CGI ::= SEQUENCE { + pLMNidentity PLMNidentity, + lAC LAC, + cI CI, + rAC RAC OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {CGI-ExtIEs} } OPTIONAL, + ... + } + +CGI-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CI ::= OCTET STRING (SIZE (2)) + +CNDomain ::= ENUMERATED { + ps, + cs +} + +ConcurrentWarningMessageIndicator ::= ENUMERATED { + true +} + +Correlation-ID ::= OCTET STRING (SIZE (4)) + +CSFallbackIndicator ::= ENUMERATED { + cs-fallback-required, + ..., + cs-fallback-high-priority +} + +AdditionalCSFallbackIndicator ::= ENUMERATED { + no-restriction, + restriction, + ... +} + +CSG-Id ::= BIT STRING (SIZE (27)) + + +CSG-IdList ::= SEQUENCE (SIZE (1.. maxnoofCSGs)) OF CSG-IdList-Item + +CSG-IdList-Item ::= SEQUENCE { + cSG-Id CSG-Id, + iE-Extensions ProtocolExtensionContainer { {CSG-IdList-Item-ExtIEs} } OPTIONAL, + ... +} + +CSG-IdList-Item-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CSGMembershipStatus ::= ENUMERATED { + member, + not-member +} + + +COUNTvalue ::= SEQUENCE { + pDCP-SN PDCP-SN, + hFN HFN, + iE-Extensions ProtocolExtensionContainer { {COUNTvalue-ExtIEs} } OPTIONAL, + ... +} +COUNTvalue-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +COUNTValueExtended ::= SEQUENCE { + pDCP-SNExtended PDCP-SNExtended, + hFNModified HFNModified, + iE-Extensions ProtocolExtensionContainer { {COUNTValueExtended-ExtIEs} } OPTIONAL, + ... +} + +COUNTValueExtended-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +COUNTvaluePDCP-SNlength18 ::= SEQUENCE { + pDCP-SNlength18 PDCP-SNlength18, + hFNforPDCP-SNlength18 HFNforPDCP-SNlength18, + iE-Extensions ProtocolExtensionContainer { {COUNTvaluePDCP-SNlength18-ExtIEs} } OPTIONAL, + ... +} + +COUNTvaluePDCP-SNlength18-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Coverage-Level ::= ENUMERATED { + extendedcoverage, + ... +} + +CriticalityDiagnostics ::= SEQUENCE { + procedureCode ProcedureCode OPTIONAL, + triggeringMessage TriggeringMessage OPTIONAL, + procedureCriticality Criticality OPTIONAL, + iEsCriticalityDiagnostics CriticalityDiagnostics-IE-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer {{CriticalityDiagnostics-ExtIEs}} OPTIONAL, + ... +} + +CriticalityDiagnostics-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CriticalityDiagnostics-IE-List ::= SEQUENCE (SIZE (1.. maxnoofErrors)) OF CriticalityDiagnostics-IE-Item + +CriticalityDiagnostics-IE-Item ::= SEQUENCE { + iECriticality Criticality, + iE-ID ProtocolIE-ID, + typeOfError TypeOfError, + iE-Extensions ProtocolExtensionContainer {{CriticalityDiagnostics-IE-Item-ExtIEs}} OPTIONAL, + ... +} + +CriticalityDiagnostics-IE-Item-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +-- D + +DataCodingScheme ::= BIT STRING (SIZE (8)) + +DCN-ID ::= INTEGER (0..65535) + +ServedDCNs ::= SEQUENCE (SIZE(0..maxnoofDCNs)) OF ServedDCNsItem + +ServedDCNsItem ::= SEQUENCE { + dCN-ID DCN-ID, + relativeDCNCapacity RelativeMMECapacity, + iE-Extensions ProtocolExtensionContainer { {ServedDCNsItem-ExtIEs} } OPTIONAL, + ... +} + +ServedDCNsItem-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DL-CP-SecurityInformation ::= SEQUENCE { + dl-NAS-MAC DL-NAS-MAC, + iE-Extensions ProtocolExtensionContainer { { DL-CP-SecurityInformation-ExtIEs} } OPTIONAL, + ... +} + +DL-CP-SecurityInformation-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +DL-Forwarding ::= ENUMERATED { + dL-Forwarding-proposed, + ... +} + +DL-NAS-MAC ::= BIT STRING (SIZE (16)) + +Direct-Forwarding-Path-Availability ::= ENUMERATED { + directPathAvailable, + ... +} + +Data-Forwarding-Not-Possible ::= ENUMERATED { + data-Forwarding-not-Possible, + ... +} + +DLNASPDUDeliveryAckRequest ::= ENUMERATED { + requested, + ... +} + +-- E + +EARFCN ::= INTEGER(0..maxEARFCN, ...) + +ECGIList ::= SEQUENCE (SIZE(1..maxnoofCellID)) OF EUTRAN-CGI + +PWSfailedECGIList ::= SEQUENCE (SIZE(1..maxnoofCellsineNB)) OF EUTRAN-CGI + +EmergencyAreaIDList ::= SEQUENCE (SIZE(1..maxnoofEmergencyAreaID)) OF EmergencyAreaID + +EmergencyAreaID ::= OCTET STRING (SIZE (3)) + +EmergencyAreaID-Broadcast ::= SEQUENCE (SIZE(1..maxnoofEmergencyAreaID)) OF EmergencyAreaID-Broadcast-Item + +EmergencyAreaID-Broadcast-Item ::= SEQUENCE { + emergencyAreaID EmergencyAreaID, + completedCellinEAI CompletedCellinEAI, + iE-Extensions ProtocolExtensionContainer { {EmergencyAreaID-Broadcast-Item-ExtIEs} } OPTIONAL, + ... +} + +EmergencyAreaID-Broadcast-Item-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +EmergencyAreaID-Cancelled ::= SEQUENCE (SIZE(1..maxnoofEmergencyAreaID)) OF EmergencyAreaID-Cancelled-Item + +EmergencyAreaID-Cancelled-Item ::= SEQUENCE { + emergencyAreaID EmergencyAreaID, + cancelledCellinEAI CancelledCellinEAI, + iE-Extensions ProtocolExtensionContainer { {EmergencyAreaID-Cancelled-Item-ExtIEs} } OPTIONAL, + ... +} + +EmergencyAreaID-Cancelled-Item-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +CompletedCellinEAI ::= SEQUENCE (SIZE(1..maxnoofCellinEAI)) OF CompletedCellinEAI-Item + +CompletedCellinEAI-Item ::= SEQUENCE { + eCGI EUTRAN-CGI, + iE-Extensions ProtocolExtensionContainer { {CompletedCellinEAI-Item-ExtIEs} } OPTIONAL, + ... +} + +CompletedCellinEAI-Item-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ECGI-List ::= SEQUENCE (SIZE(1..maxnoofCellsineNB)) OF EUTRAN-CGI + +EmergencyAreaIDListForRestart ::= SEQUENCE (SIZE(1..maxnoofRestartEmergencyAreaIDs)) OF EmergencyAreaID + +ENB-ID ::= CHOICE { + macroENB-ID BIT STRING (SIZE(20)), + homeENB-ID BIT STRING (SIZE(28)), + ... , + short-macroENB-ID BIT STRING (SIZE(18)), + long-macroENB-ID BIT STRING (SIZE(21)) +} + +GERAN-Cell-ID ::= SEQUENCE { + lAI LAI, + rAC RAC, + cI CI, + iE-Extensions ProtocolExtensionContainer { { GERAN-Cell-ID-ExtIEs} } OPTIONAL, + ... +} + +GERAN-Cell-ID-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Global-ENB-ID ::= SEQUENCE { + pLMNidentity PLMNidentity, + eNB-ID ENB-ID, + iE-Extensions ProtocolExtensionContainer { {GlobalENB-ID-ExtIEs} } OPTIONAL, + ... +} + +GlobalENB-ID-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GUMMEIList::= SEQUENCE (SIZE (1.. maxnoofMMECs)) OF GUMMEI + +ENB-StatusTransfer-TransparentContainer ::= SEQUENCE { + bearers-SubjectToStatusTransferList Bearers-SubjectToStatusTransferList, + iE-Extensions ProtocolExtensionContainer { {ENB-StatusTransfer-TransparentContainer-ExtIEs} } OPTIONAL, + ... +} + +ENB-StatusTransfer-TransparentContainer-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ENB-UE-S1AP-ID ::= INTEGER (0..16777215) + +ENBname ::= PrintableString (SIZE (1..150,...)) + +ENBX2TLAs ::= SEQUENCE (SIZE(1.. maxnoofeNBX2TLAs)) OF TransportLayerAddress + +EncryptionAlgorithms ::= BIT STRING (SIZE (16,...)) + +EnhancedCoverageRestricted ::= ENUMERATED { + restricted, + ... +} + +EPLMNs ::= SEQUENCE (SIZE(1..maxnoofEPLMNs)) OF PLMNidentity +EventType ::= ENUMERATED { + direct, + change-of-serve-cell, + stop-change-of-serve-cell, + ... +} + +E-RAB-ID ::= INTEGER (0..15, ...) + +E-RABInformationList ::= SEQUENCE (SIZE (1.. maxnoofE-RABs)) OF ProtocolIE-SingleContainer { { E-RABInformationListIEs } } + +E-RABInformationListIEs S1AP-PROTOCOL-IES ::= { + { ID id-E-RABInformationListItem CRITICALITY ignore TYPE E-RABInformationListItem PRESENCE mandatory }, + ... +} + +E-RABInformationListItem ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + dL-Forwarding DL-Forwarding OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {E-RABInformationListItem-ExtIEs} } OPTIONAL, + ... +} + +E-RABInformationListItem-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +E-RABList ::= SEQUENCE (SIZE(1.. maxnoofE-RABs)) OF ProtocolIE-SingleContainer { {E-RABItemIEs} } + +E-RABItemIEs S1AP-PROTOCOL-IES ::= { + { ID id-E-RABItem CRITICALITY ignore TYPE E-RABItem PRESENCE mandatory }, + ... +} + +E-RABItem ::= SEQUENCE { + e-RAB-ID E-RAB-ID, + cause Cause, + iE-Extensions ProtocolExtensionContainer { {E-RABItem-ExtIEs} } OPTIONAL, + ... +} + +E-RABItem-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +E-RABLevelQoSParameters ::= SEQUENCE { + qCI QCI, + allocationRetentionPriority AllocationAndRetentionPriority, + gbrQosInformation GBR-QosInformation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {E-RABQoSParameters-ExtIEs} } OPTIONAL, + ... +} + +E-RABQoSParameters-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +EUTRAN-CGI ::= SEQUENCE { + pLMNidentity PLMNidentity, + cell-ID CellIdentity, + iE-Extensions ProtocolExtensionContainer { {EUTRAN-CGI-ExtIEs} } OPTIONAL, + ... +} + +EUTRAN-CGI-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +EUTRANRoundTripDelayEstimationInfo ::= INTEGER (0..2047) + +ExpectedUEBehaviour ::= SEQUENCE { + expectedActivity ExpectedUEActivityBehaviour OPTIONAL, + expectedHOInterval ExpectedHOInterval OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { ExpectedUEBehaviour-ExtIEs} } OPTIONAL, + ... +} + +ExpectedUEBehaviour-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ExpectedUEActivityBehaviour ::= SEQUENCE { + expectedActivityPeriod ExpectedActivityPeriod OPTIONAL, + expectedIdlePeriod ExpectedIdlePeriod OPTIONAL, + sourceofUEActivityBehaviourInformation SourceOfUEActivityBehaviourInformation OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { ExpectedUEActivityBehaviour-ExtIEs} } OPTIONAL, + ... +} + +ExpectedUEActivityBehaviour-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ExpectedActivityPeriod ::= INTEGER (1..30|40|50|60|80|100|120|150|180|181,...) + +ExpectedIdlePeriod ::= INTEGER (1..30|40|50|60|80|100|120|150|180|181,...) + +SourceOfUEActivityBehaviourInformation ::= ENUMERATED { + subscription-information, + statistics, + ... +} + +ExpectedHOInterval ::= ENUMERATED { + sec15, sec30, sec60, sec90, sec120, sec180, long-time, + ... +} + +ExtendedRNC-ID ::= INTEGER (4096..65535) + +ExtendedRepetitionPeriod ::= INTEGER (4096..131071) + +Extended-UEIdentityIndexValue ::= BIT STRING (SIZE (14)) + +-- F + +ForbiddenInterRATs ::= ENUMERATED { + all, + geran, + utran, + cdma2000, + ..., + geranandutran, + cdma2000andutran + +} + +ForbiddenTAs ::= SEQUENCE (SIZE(1.. maxnoofEPLMNsPlusOne)) OF ForbiddenTAs-Item + +ForbiddenTAs-Item ::= SEQUENCE { + pLMN-Identity PLMNidentity, + forbiddenTACs ForbiddenTACs, + iE-Extensions ProtocolExtensionContainer { {ForbiddenTAs-Item-ExtIEs} } OPTIONAL, + ... +} + +ForbiddenTAs-Item-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ForbiddenTACs ::= SEQUENCE (SIZE(1..maxnoofForbTACs)) OF TAC + +ForbiddenLAs ::= SEQUENCE (SIZE(1..maxnoofEPLMNsPlusOne)) OF ForbiddenLAs-Item + +ForbiddenLAs-Item ::= SEQUENCE { + pLMN-Identity PLMNidentity, + forbiddenLACs ForbiddenLACs, + iE-Extensions ProtocolExtensionContainer { {ForbiddenLAs-Item-ExtIEs} } OPTIONAL, + ... +} + +ForbiddenLAs-Item-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ForbiddenLACs ::= SEQUENCE (SIZE(1..maxnoofForbLACs)) OF LAC + +-- G + +GBR-QosInformation ::= SEQUENCE { + e-RAB-MaximumBitrateDL BitRate, + e-RAB-MaximumBitrateUL BitRate, + e-RAB-GuaranteedBitrateDL BitRate, + e-RAB-GuaranteedBitrateUL BitRate, + iE-Extensions ProtocolExtensionContainer { { GBR-QosInformation-ExtIEs} } OPTIONAL, + ... +} + +GBR-QosInformation-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +GTP-TEID ::= OCTET STRING (SIZE (4)) + +GUMMEI ::= SEQUENCE { + pLMN-Identity PLMNidentity, + mME-Group-ID MME-Group-ID, + mME-Code MME-Code, + iE-Extensions ProtocolExtensionContainer { {GUMMEI-ExtIEs} } OPTIONAL, + ... +} + +GUMMEI-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +GUMMEIType ::= ENUMERATED { + native, + mapped, + ... +} + +GWContextReleaseIndication ::= ENUMERATED { + true, + ... +} + +-- H + +HandoverRestrictionList ::= SEQUENCE { + servingPLMN PLMNidentity, + equivalentPLMNs EPLMNs OPTIONAL, + forbiddenTAs ForbiddenTAs OPTIONAL, + forbiddenLAs ForbiddenLAs OPTIONAL, + forbiddenInterRATs ForbiddenInterRATs OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {HandoverRestrictionList-ExtIEs} } OPTIONAL, + ... +} + +HandoverRestrictionList-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +HandoverType ::= ENUMERATED { + intralte, + ltetoutran, + ltetogeran, + utrantolte, + gerantolte, + ... +} + +HFN ::= INTEGER (0..1048575) + +HFNModified ::= INTEGER (0..131071) + +HFNforPDCP-SNlength18 ::= INTEGER (0..16383) + +-- I + +Masked-IMEISV ::= BIT STRING (SIZE (64)) + +ImmediateMDT ::= SEQUENCE { + measurementsToActivate MeasurementsToActivate, + m1reportingTrigger M1ReportingTrigger, + m1thresholdeventA2 M1ThresholdEventA2 OPTIONAL, +-- Included in case of event-triggered, or event-triggered periodic reporting for measurement M1 + m1periodicReporting M1PeriodicReporting OPTIONAL, +-- Included in case of periodic or event-triggered periodic reporting + iE-Extensions ProtocolExtensionContainer { { ImmediateMDT-ExtIEs} } OPTIONAL, + ... +} + +ImmediateMDT-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + { ID id-M3Configuration CRITICALITY ignore EXTENSION M3Configuration PRESENCE conditional}| + { ID id-M4Configuration CRITICALITY ignore EXTENSION M4Configuration PRESENCE conditional}| + { ID id-M5Configuration CRITICALITY ignore EXTENSION M5Configuration PRESENCE conditional}| + { ID id-MDT-Location-Info CRITICALITY ignore EXTENSION MDT-Location-Info PRESENCE optional}| + { ID id-M6Configuration CRITICALITY ignore EXTENSION M6Configuration PRESENCE conditional}| + { ID id-M7Configuration CRITICALITY ignore EXTENSION M7Configuration PRESENCE conditional}, + ... +} + +IMSI ::= OCTET STRING (SIZE (3..8)) + +InformationOnRecommendedCellsAndENBsForPaging ::= SEQUENCE { + recommendedCellsForPaging RecommendedCellsForPaging, + recommendENBsForPaging RecommendedENBsForPaging, + iE-Extensions ProtocolExtensionContainer { { InformationOnRecommendedCellsAndENBsForPaging-ExtIEs} } OPTIONAL, + ... +} + +InformationOnRecommendedCellsAndENBsForPaging-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +IntegrityProtectionAlgorithms ::= BIT STRING (SIZE (16,...)) + +IntendedNumberOfPagingAttempts ::= INTEGER (1..16, ...) + +InterfacesToTrace ::= BIT STRING (SIZE (8)) + + + +-- J +-- K + +KillAllWarningMessages ::= ENUMERATED {true} + +-- L + + +LAC ::= OCTET STRING (SIZE (2)) + +LAI ::= SEQUENCE { + pLMNidentity PLMNidentity, + lAC LAC, + iE-Extensions ProtocolExtensionContainer { {LAI-ExtIEs} } OPTIONAL, + ... +} + +LAI-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +LastVisitedCell-Item ::= CHOICE { + e-UTRAN-Cell LastVisitedEUTRANCellInformation, + uTRAN-Cell LastVisitedUTRANCellInformation, + gERAN-Cell LastVisitedGERANCellInformation, + ... +} +LastVisitedEUTRANCellInformation ::= SEQUENCE { + global-Cell-ID EUTRAN-CGI, + cellType CellType, + time-UE-StayedInCell Time-UE-StayedInCell, + iE-Extensions ProtocolExtensionContainer { { LastVisitedEUTRANCellInformation-ExtIEs} } OPTIONAL, + ... +} +LastVisitedEUTRANCellInformation-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { +-- Extension for Rel-11 to support enhanced granularity for time UE stayed in cell -- + { ID id-Time-UE-StayedInCell-EnhancedGranularity CRITICALITY ignore EXTENSION Time-UE-StayedInCell-EnhancedGranularity PRESENCE optional}| + { ID id-HO-Cause CRITICALITY ignore EXTENSION Cause PRESENCE optional}, + ... +} +LastVisitedUTRANCellInformation ::= OCTET STRING + +LastVisitedGERANCellInformation ::= CHOICE { + undefined NULL, + ... +} + +L3-Information ::= OCTET STRING +-- This is a dummy IE used only as a reference to the actual definition in relevant specification. + +LPPa-PDU ::= OCTET STRING + +LHN-ID ::= OCTET STRING(SIZE (32..256)) + +Links-to-log ::= ENUMERATED {uplink, downlink, both-uplink-and-downlink, ...} + +ListeningSubframePattern ::= SEQUENCE { + pattern-period ENUMERATED {ms1280, ms2560, ms5120, ms10240, ...}, + pattern-offset INTEGER (0..10239, ...), + iE-Extensions ProtocolExtensionContainer { { ListeningSubframePattern-ExtIEs} } OPTIONAL, + ... +} + +ListeningSubframePattern-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { +... +} + +LoggedMDT ::= SEQUENCE { + loggingInterval LoggingInterval, + loggingDuration LoggingDuration, + iE-Extensions ProtocolExtensionContainer { {LoggedMDT-ExtIEs} } OPTIONAL, + ... +} + +LoggedMDT-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { +... +} + +LoggingInterval ::= ENUMERATED {ms128, ms256, ms512, ms1024, ms2048, ms3072, ms4096, ms6144} + +LoggingDuration ::= ENUMERATED {m10, m20, m40, m60, m90, m120} + +LoggedMBSFNMDT ::= SEQUENCE { + loggingInterval LoggingInterval, + loggingDuration LoggingDuration, + mBSFN-ResultToLog MBSFN-ResultToLog OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { LoggedMBSFNMDT-ExtIEs } } OPTIONAL, + ... +} + +LoggedMBSFNMDT-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- M + +M3Configuration ::= SEQUENCE { + m3period M3period, + iE-Extensions ProtocolExtensionContainer { { M3Configuration-ExtIEs} } OPTIONAL, + ... +} + +M3Configuration-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +M3period ::= ENUMERATED {ms100, ms1000, ms10000, ... } + +M4Configuration ::= SEQUENCE { + m4period M4period, + m4-links-to-log Links-to-log, + iE-Extensions ProtocolExtensionContainer { { M4Configuration-ExtIEs} } OPTIONAL, + ... +} + +M4Configuration-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +M4period ::= ENUMERATED {ms1024, ms2048, ms5120, ms10240, min1, ... } + +M5Configuration ::= SEQUENCE { + m5period M5period, + m5-links-to-log Links-to-log, + iE-Extensions ProtocolExtensionContainer { { M5Configuration-ExtIEs} } OPTIONAL, + ... +} + +M5Configuration-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +M5period ::= ENUMERATED {ms1024, ms2048, ms5120, ms10240, min1, ... } + +M6Configuration ::= SEQUENCE { + m6report-Interval M6report-Interval, + m6delay-threshold M6delay-threshold OPTIONAL, +-- This IE shall be present if the M6 Links to log IE is set to “uplink” or to “both-uplink-and-downlink” -- + m6-links-to-log Links-to-log, + iE-Extensions ProtocolExtensionContainer { { M6Configuration-ExtIEs} } OPTIONAL, + ... +} + +M6Configuration-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +M6report-Interval ::= ENUMERATED { ms1024, ms2048, ms5120, ms10240, ... } + +M6delay-threshold ::= ENUMERATED { ms30, ms40, ms50, ms60, ms70, ms80, ms90, ms100, ms150, ms300, ms500, ms750, ... } + +M7Configuration ::= SEQUENCE { + m7period M7period, + m7-links-to-log Links-to-log, + iE-Extensions ProtocolExtensionContainer { { M7Configuration-ExtIEs} } OPTIONAL, + ... +} + +M7Configuration-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +M7period ::= INTEGER(1..60, ...) + +MDT-Activation ::= ENUMERATED { + immediate-MDT-only, + immediate-MDT-and-Trace, + logged-MDT-only, + ..., + logged-MBSFN-MDT +} + +MDT-Location-Info ::= BIT STRING (SIZE (8)) + +MDT-Configuration ::= SEQUENCE { + mdt-Activation MDT-Activation, + areaScopeOfMDT AreaScopeOfMDT, + mDTMode MDTMode, + iE-Extensions ProtocolExtensionContainer { { MDT-Configuration-ExtIEs} } OPTIONAL, + ... +} +MDT-Configuration-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + { ID id-SignallingBasedMDTPLMNList CRITICALITY ignore EXTENSION MDTPLMNList PRESENCE optional }, + ... +} + +ManagementBasedMDTAllowed ::= ENUMERATED {allowed, ...} + +MBSFN-ResultToLog ::= SEQUENCE (SIZE(1..maxnoofMBSFNAreaMDT)) OF MBSFN-ResultToLogInfo + +MBSFN-ResultToLogInfo ::= SEQUENCE { + mBSFN-AreaId INTEGER (0..255) OPTIONAL, + carrierFreq EARFCN, + iE-Extensions ProtocolExtensionContainer { { MBSFN-ResultToLogInfo-ExtIEs} } OPTIONAL, + ... +} + +MBSFN-ResultToLogInfo-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +MDTPLMNList ::= SEQUENCE (SIZE(1..maxnoofMDTPLMNs)) OF PLMNidentity + +PrivacyIndicator ::= ENUMERATED { + immediate-MDT, + logged-MDT, + ... +} + +MDTMode ::= CHOICE { + immediateMDT ImmediateMDT, + loggedMDT LoggedMDT, + ..., + mDTMode-Extension MDTMode-Extension +} + +MDTMode-Extension ::= ProtocolIE-SingleContainer {{ MDTMode-ExtensionIE }} + +MDTMode-ExtensionIE S1AP-PROTOCOL-IES ::= { + { ID id-LoggedMBSFNMDT CRITICALITY ignore TYPE LoggedMBSFNMDT PRESENCE mandatory} +} + +MeasurementsToActivate ::= BIT STRING (SIZE (8)) + +MeasurementThresholdA2 ::= CHOICE { + threshold-RSRP Threshold-RSRP, + threshold-RSRQ Threshold-RSRQ, + ... +} + +MessageIdentifier ::= BIT STRING (SIZE (16)) + +MobilityInformation ::= BIT STRING (SIZE(32)) + +MMEname ::= PrintableString (SIZE (1..150,...)) + +MMEPagingTarget ::= CHOICE { + global-ENB-ID Global-ENB-ID, + tAI TAI, + ... +} + +MMERelaySupportIndicator ::= ENUMERATED {true, ...} + +MME-Group-ID ::= OCTET STRING (SIZE (2)) + +MME-Code ::= OCTET STRING (SIZE (1)) + +MME-UE-S1AP-ID ::= INTEGER (0..4294967295) +M-TMSI ::= OCTET STRING (SIZE (4)) + +MSClassmark2 ::= OCTET STRING +MSClassmark3 ::= OCTET STRING + +MutingAvailabilityIndication ::= ENUMERATED { + available, + unavailable, + ... +} + + +MutingPatternInformation ::= SEQUENCE { + muting-pattern-period ENUMERATED {ms0, ms1280, ms2560, ms5120, ms10240, ...}, + muting-pattern-offset INTEGER (0..10239, ...) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {MutingPatternInformation-ExtIEs} } OPTIONAL, + ... +} + +MutingPatternInformation-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- N + +NAS-PDU ::= OCTET STRING + +NASSecurityParametersfromE-UTRAN ::= OCTET STRING + +NASSecurityParameterstoE-UTRAN ::= OCTET STRING + +NB-IoT-DefaultPagingDRX ::= ENUMERATED { + v128, + v256, + v512, + v1024, + ... + } + +NB-IoT-Paging-eDRXInformation ::= SEQUENCE { + nB-IoT-paging-eDRX-Cycle NB-IoT-Paging-eDRX-Cycle, + nB-IoT-pagingTimeWindow NB-IoT-PagingTimeWindow OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { NB-IoT-Paging-eDRXInformation-ExtIEs} } OPTIONAL, + ... +} + +NB-IoT-Paging-eDRXInformation-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +NB-IoT-Paging-eDRX-Cycle ::= ENUMERATED{hf2, hf4, hf6, hf8, hf10, hf12, hf14, hf16, hf32, hf64, hf128, hf256, hf512, hf1024, ...} + +NB-IoT-PagingTimeWindow ::= ENUMERATED{s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, ...} + +NB-IoT-UEIdentityIndexValue ::= BIT STRING (SIZE (12)) + +NextPagingAreaScope ::= ENUMERATED { + same, + changed, + ... +} + +NumberofBroadcastRequest ::= INTEGER (0..65535) + +NumberOfBroadcasts ::= INTEGER (0..65535) + +-- O +OldBSS-ToNewBSS-Information ::= OCTET STRING +-- This is a dummy IE used only as a reference to the actual definition in relevant specification. + +OverloadAction ::= ENUMERATED { + reject-non-emergency-mo-dt, + reject-rrc-cr-signalling, + permit-emergency-sessions-and-mobile-terminated-services-only, + ..., + permit-high-priority-sessions-and-mobile-terminated-services-only, + reject-delay-tolerant-access, + permit-high-priority-sessions-and-exception-reporting-and-mobile-terminated-services-only, + not-accept-mo-data-or-delay-tolerant-access-from-CP-CIoT + +} + +OverloadResponse ::= CHOICE { + overloadAction OverloadAction, + ... +} + + +-- P + +PagingAttemptInformation ::= SEQUENCE { + pagingAttemptCount PagingAttemptCount, + intendedNumberOfPagingAttempts IntendedNumberOfPagingAttempts, + nextPagingAreaScope NextPagingAreaScope OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { PagingAttemptInformation-ExtIEs} } OPTIONAL, + ... +} + +PagingAttemptInformation-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PagingAttemptCount ::= INTEGER (1..16, ...) + +Paging-eDRXInformation ::= SEQUENCE { + paging-eDRX-Cycle Paging-eDRX-Cycle, + pagingTimeWindow PagingTimeWindow OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { Paging-eDRXInformation-ExtIEs} } OPTIONAL, + ... +} + +Paging-eDRXInformation-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Paging-eDRX-Cycle ::= ENUMERATED{hfhalf, hf1, hf2, hf4, hf6, hf8, hf10, hf12, hf14, hf16, hf32, hf64, hf128, hf256, ...} + +PagingTimeWindow ::= ENUMERATED{s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, ...} + +PagingDRX ::= ENUMERATED { + v32, + v64, + v128, + v256, + ... + } + +PagingPriority ::= ENUMERATED { + priolevel1, + priolevel2, + priolevel3, + priolevel4, + priolevel5, + priolevel6, + priolevel7, + priolevel8, + ... +} + +PDCP-SN ::= INTEGER (0..4095) + +PDCP-SNExtended ::= INTEGER (0..32767) + +PDCP-SNlength18 ::= INTEGER (0..262143) + +M1PeriodicReporting ::= SEQUENCE { + reportInterval ReportIntervalMDT, + reportAmount ReportAmountMDT, + iE-Extensions ProtocolExtensionContainer { { M1PeriodicReporting-ExtIEs} } OPTIONAL, + ... +} + +M1PeriodicReporting-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +PLMNidentity ::= TBCD-STRING + +Port-Number ::= OCTET STRING (SIZE (2)) + +Pre-emptionCapability ::= ENUMERATED { + shall-not-trigger-pre-emption, + may-trigger-pre-emption +} + +Pre-emptionVulnerability ::= ENUMERATED { + not-pre-emptable, + pre-emptable +} + +PriorityLevel ::= INTEGER { spare (0), highest (1), lowest (14), no-priority (15) } (0..15) + +ProSeAuthorized ::= SEQUENCE { + proSeDirectDiscovery ProSeDirectDiscovery OPTIONAL, + proSeDirectCommunication ProSeDirectCommunication OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {ProSeAuthorized-ExtIEs} } OPTIONAL, + ... +} + +ProSeAuthorized-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + { ID id-ProSeUEtoNetworkRelaying CRITICALITY ignore EXTENSION ProSeUEtoNetworkRelaying PRESENCE optional}, + ... +} + +ProSeDirectDiscovery ::= ENUMERATED { + authorized, + not-authorized, + ... +} + +ProSeUEtoNetworkRelaying ::= ENUMERATED { + authorized, + not-authorized, + ... +} + +ProSeDirectCommunication ::= ENUMERATED { + authorized, + not-authorized, + ... +} + +PS-ServiceNotAvailable ::= ENUMERATED { + ps-service-not-available, + ... +} + +-- Q + +QCI ::= INTEGER (0..255) + +-- R + +ReceiveStatusofULPDCPSDUs ::= BIT STRING (SIZE(4096)) + +ReceiveStatusOfULPDCPSDUsExtended ::= BIT STRING (SIZE(1..16384)) + +ReceiveStatusOfULPDCPSDUsPDCP-SNlength18 ::= BIT STRING (SIZE(1..131072)) + +RecommendedCellsForPaging ::= SEQUENCE { + recommendedCellList RecommendedCellList, + iE-Extensions ProtocolExtensionContainer { { RecommendedCellsForPaging-ExtIEs} } OPTIONAL, + ... +} + +RecommendedCellsForPaging-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RecommendedCellList ::= SEQUENCE (SIZE(1.. maxnoofRecommendedCells)) OF ProtocolIE-SingleContainer { { RecommendedCellItemIEs } } + +RecommendedCellItemIEs S1AP-PROTOCOL-IES ::= { + { ID id-RecommendedCellItem CRITICALITY ignore TYPE RecommendedCellItem PRESENCE mandatory }, + ... +} + +RecommendedCellItem::= SEQUENCE { + eUTRAN-CGI EUTRAN-CGI, + timeStayedInCell INTEGER (0..4095) OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { RecommendedCellsForPagingItem-ExtIEs} } OPTIONAL, + ... +} + +RecommendedCellsForPagingItem-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RecommendedENBsForPaging ::= SEQUENCE { + recommendedENBList RecommendedENBList, + iE-Extensions ProtocolExtensionContainer { { RecommendedENBsForPaging-ExtIEs} } OPTIONAL, + ... +} + +RecommendedENBsForPaging-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RecommendedENBList::= SEQUENCE (SIZE(1.. maxnoofRecommendedENBs)) OF ProtocolIE-SingleContainer { { RecommendedENBItemIEs } } + +RecommendedENBItemIEs S1AP-PROTOCOL-IES ::= { + { ID id-RecommendedENBItem CRITICALITY ignore TYPE RecommendedENBItem PRESENCE mandatory }, + ... +} + +RecommendedENBItem ::= SEQUENCE { + mMEPagingTarget MMEPagingTarget, + iE-Extensions ProtocolExtensionContainer { { RecommendedENBItem-ExtIEs} } OPTIONAL, + ... +} + +RecommendedENBItem-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RelativeMMECapacity ::= INTEGER (0..255) + +RelayNode-Indicator ::= ENUMERATED { + true, + ... +} + +RAC ::= OCTET STRING (SIZE (1)) + +RAT-Type ::= ENUMERATED { + nbiot, + ... +} + +ReportAmountMDT ::= ENUMERATED{r1, r2, r4, r8, r16, r32, r64, rinfinity} + +ReportIntervalMDT ::= ENUMERATED {ms120, ms240, ms480, ms640, ms1024, ms2048, ms5120, ms10240, min1, min6, min12, min30, min60} + +M1ReportingTrigger ::= ENUMERATED{ + periodic, + a2eventtriggered, + ..., + a2eventtriggered-periodic +} + +RequestType ::= SEQUENCE { + eventType EventType, + reportArea ReportArea, + iE-Extensions ProtocolExtensionContainer { { RequestType-ExtIEs} } OPTIONAL, + ... +} + + +RequestType-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RIMTransfer ::= SEQUENCE { + rIMInformation RIMInformation, + rIMRoutingAddress RIMRoutingAddress OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { RIMTransfer-ExtIEs} } OPTIONAL, + ... +} + +RIMTransfer-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RIMInformation ::= OCTET STRING + +RIMRoutingAddress ::= CHOICE { + gERAN-Cell-ID GERAN-Cell-ID, + ..., + targetRNC-ID TargetRNC-ID, + eHRPD-Sector-ID OCTET STRING (SIZE(16)) +} + +ReportArea ::= ENUMERATED { + ecgi, + ... +} + +RepetitionPeriod ::= INTEGER (0..4095) + +RLFReportInformation ::= SEQUENCE { + uE-RLF-Report-Container UE-RLF-Report-Container, + uE-RLF-Report-Container-for-extended-bands UE-RLF-Report-Container-for-extended-bands OPTIONAL, + iE-Extensions ProtocolExtensionContainer {{ RLFReportInformation-ExtIEs}} OPTIONAL, + ... +} + +RLFReportInformation-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +RNC-ID ::= INTEGER (0..4095) + +RRC-Container ::= OCTET STRING + +RRC-Establishment-Cause ::= ENUMERATED { + emergency, + highPriorityAccess, + mt-Access, + mo-Signalling, + mo-Data, + ..., + delay-TolerantAccess, + mo-VoiceCall, + mo-ExceptionData +} + +ECGIListForRestart ::= SEQUENCE (SIZE(1..maxnoofCellsforRestart)) OF EUTRAN-CGI + +Routing-ID ::= INTEGER (0..255) + +-- S + + +SecurityKey ::= BIT STRING (SIZE(256)) + + + +SecurityContext ::= SEQUENCE { + nextHopChainingCount INTEGER (0..7), + nextHopParameter SecurityKey, + iE-Extensions ProtocolExtensionContainer { { SecurityContext-ExtIEs} } OPTIONAL, + ... +} + + +SecurityContext-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SerialNumber ::= BIT STRING (SIZE (16)) + +SONInformation ::= CHOICE{ + sONInformationRequest SONInformationRequest, + sONInformationReply SONInformationReply, + ... +-- ..., +-- sONInformation-Extension SONInformation-Extension +} + +SONInformation-Extension ::= ProtocolIE-SingleContainer {{ SONInformation-ExtensionIE }} + +SONInformation-ExtensionIE S1AP-PROTOCOL-IES ::= { + { ID id-SON-Information-Report CRITICALITY ignore TYPE SONInformationReport PRESENCE mandatory} +} + +SONInformationRequest ::= ENUMERATED { + x2TNL-Configuration-Info, + ..., + time-Synchronisation-Info, + activate-Muting, + deactivate-Muting} + +SONInformationReply ::= SEQUENCE { + x2TNLConfigurationInfo X2TNLConfigurationInfo OPTIONAL, + iE-Extensions ProtocolExtensionContainer {{SONInformationReply-ExtIEs}} OPTIONAL, + ... +} + +SONInformationReply-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { +-- Extension for Release 9 to transfer Time synchronisation information -- + {ID id-Time-Synchronisation-Info CRITICALITY ignore EXTENSION TimeSynchronisationInfo PRESENCE optional}, + ..., + {ID id-Muting-Pattern-Information CRITICALITY ignore EXTENSION MutingPatternInformation PRESENCE optional} +} + +SONInformationReport ::= CHOICE{ + rLFReportInformation RLFReportInformation, + ... +} + +SONConfigurationTransfer ::= SEQUENCE { + targeteNB-ID TargeteNB-ID, + sourceeNB-ID SourceeNB-ID, + sONInformation SONInformation, + iE-Extensions ProtocolExtensionContainer { { SONConfigurationTransfer-ExtIEs} } OPTIONAL, +... +} + +SONConfigurationTransfer-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { +-- Extension for Release 10 to transfer the IP addresses of the eNB initiating the ANR action -- + {ID id-x2TNLConfigurationInfo CRITICALITY ignore EXTENSION X2TNLConfigurationInfo PRESENCE conditional + -- This IE shall be present if the SON Information IE contains the SON Information Request IE and the SON Information Request IE is set to “X2TNL Configuration Info” --}| +-- Extension for Release 12 to transfer information concerning the source cell of synchronisation and the aggressor cell -- + {ID id-Synchronisation-Information CRITICALITY ignore EXTENSION SynchronisationInformation PRESENCE conditional + -- This IE shall be present if the SON Information IE contains the SON Information Request IE set to “ Activate Muting ” --}, + ... +} + + +SynchronisationInformation ::= SEQUENCE { + sourceStratumLevel StratumLevel OPTIONAL, + listeningSubframePattern ListeningSubframePattern OPTIONAL, + aggressoreCGI-List ECGI-List OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {SynchronisationInformation-ExtIEs} } OPTIONAL, + ... +} + +SynchronisationInformation-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +Source-ToTarget-TransparentContainer ::= OCTET STRING +-- This IE includes a transparent container from the source RAN node to the target RAN node. +-- The octets of the OCTET STRING are encoded according to the specifications of the target system. + +SourceBSS-ToTargetBSS-TransparentContainer ::= OCTET STRING +-- This is a dummy IE used only as a reference to the actual definition in relevant specification. + +SourceeNB-ID ::= SEQUENCE { + global-ENB-ID Global-ENB-ID, + selected-TAI TAI, + iE-Extensions ProtocolExtensionContainer { {SourceeNB-ID-ExtIEs} } OPTIONAL +} + +SourceeNB-ID-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +SRVCCOperationNotPossible ::= ENUMERATED { + notPossible, + ... +} + +SRVCCOperationPossible ::= ENUMERATED { + possible, + ... +} + +SRVCCHOIndication ::= ENUMERATED { + pSandCS, + cSonly, + ... +} + +SourceeNB-ToTargeteNB-TransparentContainer ::= SEQUENCE { + rRC-Container RRC-Container, + e-RABInformationList E-RABInformationList OPTIONAL, + targetCell-ID EUTRAN-CGI, + subscriberProfileIDforRFP SubscriberProfileIDforRFP OPTIONAL, + uE-HistoryInformation UE-HistoryInformation, + iE-Extensions ProtocolExtensionContainer { {SourceeNB-ToTargeteNB-TransparentContainer-ExtIEs} } OPTIONAL, + ... +} + +SourceeNB-ToTargeteNB-TransparentContainer-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + {ID id-MobilityInformation CRITICALITY ignore EXTENSION MobilityInformation PRESENCE optional}| + {ID id-uE-HistoryInformationFromTheUE CRITICALITY ignore EXTENSION UE-HistoryInformationFromTheUE PRESENCE optional}, + ... +} + + +SourceRNC-ToTargetRNC-TransparentContainer ::= OCTET STRING +-- This is a dummy IE used only as a reference to the actual definition in relevant specification. + + +ServedGUMMEIs ::= SEQUENCE (SIZE (1.. maxnoofRATs)) OF ServedGUMMEIsItem + +ServedGUMMEIsItem ::= SEQUENCE { + servedPLMNs ServedPLMNs, + servedGroupIDs ServedGroupIDs, + servedMMECs ServedMMECs, + iE-Extensions ProtocolExtensionContainer { {ServedGUMMEIsItem-ExtIEs} } OPTIONAL, + ... +} + +ServedGUMMEIsItem-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ServedGroupIDs ::= SEQUENCE (SIZE(1.. maxnoofGroupIDs)) OF MME-Group-ID +ServedMMECs ::= SEQUENCE (SIZE(1.. maxnoofMMECs)) OF MME-Code + +ServedPLMNs ::= SEQUENCE (SIZE(1.. maxnoofPLMNsPerMME)) OF PLMNidentity + +SubscriberProfileIDforRFP ::= INTEGER (1..256) + +SupportedTAs ::= SEQUENCE (SIZE(1.. maxnoofTACs)) OF SupportedTAs-Item + +SupportedTAs-Item ::= SEQUENCE { + tAC TAC, + broadcastPLMNs BPLMNs, + iE-Extensions ProtocolExtensionContainer { {SupportedTAs-Item-ExtIEs} } OPTIONAL, + ... +} + +SupportedTAs-Item-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + -- Extension for Release 13 to transfer RAT-Type per TAC -- + {ID id-RAT-Type CRITICALITY reject EXTENSION RAT-Type PRESENCE optional}, + ... +} + +StratumLevel ::= INTEGER (0..3, ...) + +SynchronisationStatus ::= ENUMERATED { synchronous, asynchronous, ... } + +TimeSynchronisationInfo ::= SEQUENCE { + stratumLevel StratumLevel, + synchronisationStatus SynchronisationStatus, + iE-Extensions ProtocolExtensionContainer { { TimeSynchronisationInfo-ExtIEs} } OPTIONAL, + ... +} + +TimeSynchronisationInfo-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + -- Extension for Release 12 to transfer Muting Availability Indication -- + {ID id-Muting-Availability-Indication CRITICALITY ignore EXTENSION MutingAvailabilityIndication PRESENCE optional}, + ... +} + +S-TMSI ::= SEQUENCE { + mMEC MME-Code, + m-TMSI M-TMSI, + iE-Extensions ProtocolExtensionContainer { {S-TMSI-ExtIEs} } OPTIONAL, + ... +} + +S-TMSI-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +-- T + +TAC ::= OCTET STRING (SIZE (2)) + +TAIBasedMDT ::= SEQUENCE { + tAIListforMDT TAIListforMDT, + iE-Extensions ProtocolExtensionContainer { {TAIBasedMDT-ExtIEs} } OPTIONAL, + ... +} + +TAIBasedMDT-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TAIListforMDT ::= SEQUENCE (SIZE(1..maxnoofTAforMDT)) OF TAI + +TAIListforWarning ::= SEQUENCE (SIZE(1..maxnoofTAIforWarning)) OF TAI + +TAI ::= SEQUENCE { + pLMNidentity PLMNidentity, + tAC TAC, + iE-Extensions ProtocolExtensionContainer { {TAI-ExtIEs} } OPTIONAL, + ... +} + +TAI-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TAI-Broadcast ::= SEQUENCE (SIZE(1..maxnoofTAIforWarning)) OF TAI-Broadcast-Item + +TAI-Broadcast-Item ::= SEQUENCE { + tAI TAI, + completedCellinTAI CompletedCellinTAI, + iE-Extensions ProtocolExtensionContainer { {TAI-Broadcast-Item-ExtIEs} } OPTIONAL, + ... +} + +TAI-Broadcast-Item-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TAI-Cancelled ::= SEQUENCE (SIZE(1..maxnoofTAIforWarning)) OF TAI-Cancelled-Item + +TAI-Cancelled-Item ::= SEQUENCE { + tAI TAI, + cancelledCellinTAI CancelledCellinTAI, + iE-Extensions ProtocolExtensionContainer { {TAI-Cancelled-Item-ExtIEs} } OPTIONAL, + ... +} + +TAI-Cancelled-Item-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TABasedMDT ::= SEQUENCE { + tAListforMDT TAListforMDT, + iE-Extensions ProtocolExtensionContainer { {TABasedMDT-ExtIEs} } OPTIONAL, + ... +} + +TABasedMDT-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TAListforMDT ::= SEQUENCE (SIZE(1..maxnoofTAforMDT)) OF TAC + +CompletedCellinTAI ::= SEQUENCE (SIZE(1..maxnoofCellinTAI)) OF CompletedCellinTAI-Item + +CompletedCellinTAI-Item ::= SEQUENCE{ + eCGI EUTRAN-CGI, + iE-Extensions ProtocolExtensionContainer { {CompletedCellinTAI-Item-ExtIEs} } OPTIONAL, + ... +} + +CompletedCellinTAI-Item-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TBCD-STRING ::= OCTET STRING (SIZE (3)) + +TargetID ::= CHOICE { + targeteNB-ID TargeteNB-ID, + targetRNC-ID TargetRNC-ID, + cGI CGI, + ... +} + +TargeteNB-ID ::= SEQUENCE { + global-ENB-ID Global-ENB-ID, + selected-TAI TAI, + iE-Extensions ProtocolExtensionContainer { {TargeteNB-ID-ExtIEs} } OPTIONAL, + ... +} + +TargeteNB-ID-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TargetRNC-ID ::= SEQUENCE { + lAI LAI, + rAC RAC OPTIONAL, + rNC-ID RNC-ID, + extendedRNC-ID ExtendedRNC-ID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {TargetRNC-ID-ExtIEs} } OPTIONAL, + ... + } + + +TargetRNC-ID-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +TargeteNB-ToSourceeNB-TransparentContainer ::= SEQUENCE { + rRC-Container RRC-Container, + iE-Extensions ProtocolExtensionContainer { {TargeteNB-ToSourceeNB-TransparentContainer-ExtIEs} } OPTIONAL, + ... +} + +TargeteNB-ToSourceeNB-TransparentContainer-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Target-ToSource-TransparentContainer ::= OCTET STRING +-- This IE includes a transparent container from the target RAN node to the source RAN node. +-- The octets of the OCTET STRING are coded according to the specifications of the target system. + +TargetRNC-ToSourceRNC-TransparentContainer ::= OCTET STRING +-- This is a dummy IE used only as a reference to the actual definition in relevant specification. + +TargetBSS-ToSourceBSS-TransparentContainer ::= OCTET STRING +-- This is a dummy IE used only as a reference to the actual definition in relevant specification. + +M1ThresholdEventA2 ::= SEQUENCE { + measurementThreshold MeasurementThresholdA2, + iE-Extensions ProtocolExtensionContainer { { M1ThresholdEventA2-ExtIEs} } OPTIONAL, + ... +} + +M1ThresholdEventA2-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +Threshold-RSRP ::= INTEGER(0..97) + +Threshold-RSRQ ::= INTEGER(0..34) + +TimeToWait ::= ENUMERATED {v1s, v2s, v5s, v10s, v20s, v60s, ...} + +Time-UE-StayedInCell ::= INTEGER (0..4095) + +Time-UE-StayedInCell-EnhancedGranularity ::= INTEGER (0..40950) + +TransportInformation ::= SEQUENCE { + transportLayerAddress TransportLayerAddress, + uL-GTP-TEID GTP-TEID, + ... +} + +TransportLayerAddress ::= BIT STRING (SIZE(1..160, ...)) + +TraceActivation ::= SEQUENCE { + e-UTRAN-Trace-ID E-UTRAN-Trace-ID, + interfacesToTrace InterfacesToTrace, + traceDepth TraceDepth, + traceCollectionEntityIPAddress TransportLayerAddress, + iE-Extensions ProtocolExtensionContainer { { TraceActivation-ExtIEs} } OPTIONAL, + ... +} + +TraceActivation-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { +-- Extension for Rel-10 to support MDT -- + { ID id-MDTConfiguration CRITICALITY ignore EXTENSION MDT-Configuration PRESENCE optional }, + ... +} + +TraceDepth ::= ENUMERATED { + minimum, + medium, + maximum, + minimumWithoutVendorSpecificExtension, + mediumWithoutVendorSpecificExtension, + maximumWithoutVendorSpecificExtension, + ... +} + +E-UTRAN-Trace-ID ::= OCTET STRING (SIZE (8)) + +TrafficLoadReductionIndication ::= INTEGER (1..99) + +TunnelInformation ::= SEQUENCE { + transportLayerAddress TransportLayerAddress, + uDP-Port-Number Port-Number OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {Tunnel-Information-ExtIEs} } OPTIONAL, + ... +} + +Tunnel-Information-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +TypeOfError ::= ENUMERATED { + not-understood, + missing, + ... +} + +TAIListForRestart ::= SEQUENCE (SIZE(1..maxnoofRestartTAIs)) OF TAI + +-- U + +UEAggregateMaximumBitrate ::= SEQUENCE { + uEaggregateMaximumBitRateDL BitRate, + uEaggregateMaximumBitRateUL BitRate, + iE-Extensions ProtocolExtensionContainer { {UEAggregate-MaximumBitrates-ExtIEs} } OPTIONAL, + ... +} + +UEAggregate-MaximumBitrates-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UE-RetentionInformation ::= ENUMERATED { + ues-retained, + ...} + +UE-S1AP-IDs ::= CHOICE{ + uE-S1AP-ID-pair UE-S1AP-ID-pair, + mME-UE-S1AP-ID MME-UE-S1AP-ID, + ... +} + +UE-S1AP-ID-pair ::= SEQUENCE{ + mME-UE-S1AP-ID MME-UE-S1AP-ID, + eNB-UE-S1AP-ID ENB-UE-S1AP-ID, + iE-Extensions ProtocolExtensionContainer { {UE-S1AP-ID-pair-ExtIEs} } OPTIONAL, + ... +} +UE-S1AP-ID-pair-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + + +UE-associatedLogicalS1-ConnectionItem ::= SEQUENCE { + mME-UE-S1AP-ID MME-UE-S1AP-ID OPTIONAL, + eNB-UE-S1AP-ID ENB-UE-S1AP-ID OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { UE-associatedLogicalS1-ConnectionItemExtIEs} } OPTIONAL, + ... +} + + +UE-associatedLogicalS1-ConnectionItemExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UEIdentityIndexValue ::= BIT STRING (SIZE (10)) + +UE-HistoryInformation ::= SEQUENCE (SIZE(1..maxnoofCells)) OF LastVisitedCell-Item + +UE-HistoryInformationFromTheUE ::= OCTET STRING +-- This IE is a transparent container and shall be encoded as the VisitedCellInfoList field contained in the UEInformationResponse message as defined in TS 36.331 [16] + +UEPagingID ::= CHOICE { + s-TMSI S-TMSI, + iMSI IMSI, + ... + } + +UERadioCapability ::= OCTET STRING + +UERadioCapabilityForPaging ::= OCTET STRING + +UE-RLF-Report-Container ::= OCTET STRING +-- This IE is a transparent container and shall be encoded as the rlf-Report-r9 field contained in the UEInformationResponse message as defined in TS 36.331 [16] + +UE-RLF-Report-Container-for-extended-bands ::= OCTET STRING +-- This IE is a transparent container and shall be encoded as the rlf-Report-v9e0 contained in the UEInformationResponse message as defined in TS 36.331 [16] + +UESecurityCapabilities ::= SEQUENCE { + encryptionAlgorithms EncryptionAlgorithms, + integrityProtectionAlgorithms IntegrityProtectionAlgorithms, + iE-Extensions ProtocolExtensionContainer { { UESecurityCapabilities-ExtIEs} } OPTIONAL, +... +} + +UESecurityCapabilities-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UESidelinkAggregateMaximumBitrate ::= SEQUENCE { + uESidelinkAggregateMaximumBitRate BitRate, + iE-Extensions ProtocolExtensionContainer { {UE-Sidelink-Aggregate-MaximumBitrates-ExtIEs} } OPTIONAL, + ... +} + +UE-Sidelink-Aggregate-MaximumBitrates-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UE-Usage-Type ::= INTEGER (0..255) + +UL-CP-SecurityInformation ::= SEQUENCE { + ul-NAS-MAC UL-NAS-MAC, + ul-NAS-Count UL-NAS-Count, + iE-Extensions ProtocolExtensionContainer { { UL-CP-SecurityInformation-ExtIEs} } OPTIONAL, + ... +} + +UL-CP-SecurityInformation-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UL-NAS-MAC ::= BIT STRING (SIZE (16)) + +UL-NAS-Count ::= BIT STRING (SIZE (5)) + + +UserLocationInformation ::= SEQUENCE { + eutran-cgi EUTRAN-CGI, + tai TAI, + iE-Extensions ProtocolExtensionContainer { { UserLocationInformation-ExtIEs} } OPTIONAL, + ... +} + +UserLocationInformation-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +UEUserPlaneCIoTSupportIndicator ::= ENUMERATED { + supported, + ... +} + +-- V + +VoiceSupportMatchIndicator ::= ENUMERATED { + supported, + not-supported, + ... +} + +V2XServicesAuthorized ::= SEQUENCE { + vehicleUE VehicleUE OPTIONAL, + pedestrianUE PedestrianUE OPTIONAL, + iE-Extensions ProtocolExtensionContainer { {V2XServicesAuthorized-ExtIEs} } OPTIONAL, + ... +} + +V2XServicesAuthorized-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +VehicleUE ::= ENUMERATED { + authorized, + not-authorized, + ... +} + +PedestrianUE ::= ENUMERATED { + authorized, + not-authorized, + ... +} + +-- W + +WarningAreaList ::= CHOICE { + cellIDList ECGIList, + trackingAreaListforWarning TAIListforWarning, + emergencyAreaIDList EmergencyAreaIDList, + ... +} + + +WarningType ::= OCTET STRING (SIZE (2)) + +WarningSecurityInfo ::= OCTET STRING (SIZE (50)) + + +WarningMessageContents ::= OCTET STRING (SIZE(1..9600)) + + +-- X + + +X2TNLConfigurationInfo ::= SEQUENCE { + eNBX2TransportLayerAddresses ENBX2TLAs, + iE-Extensions ProtocolExtensionContainer { { X2TNLConfigurationInfo-ExtIEs} } OPTIONAL, + ... +} + +X2TNLConfigurationInfo-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { +-- Extension for Release 10 to transfer the IPsec and U-plane addresses during ANR action -- + {ID id-eNBX2ExtendedTransportLayerAddresses CRITICALITY ignore EXTENSION ENBX2ExtTLAs PRESENCE optional}| +-- Extension for Release 12 to transfer the IP addresses of the X2 GW -- + {ID id-eNBIndirectX2TransportLayerAddresses CRITICALITY ignore EXTENSION ENBIndirectX2TransportLayerAddresses PRESENCE optional}, + ... +} + +ENBX2ExtTLAs ::= SEQUENCE (SIZE(1.. maxnoofeNBX2ExtTLAs)) OF ENBX2ExtTLA + +ENBX2ExtTLA ::= SEQUENCE { + iPsecTLA TransportLayerAddress OPTIONAL, + gTPTLAa ENBX2GTPTLAs OPTIONAL, + iE-Extensions ProtocolExtensionContainer { { ENBX2ExtTLA-ExtIEs} } OPTIONAL, + ... +} + +ENBX2ExtTLA-ExtIEs S1AP-PROTOCOL-EXTENSION ::= { + ... +} + +ENBX2GTPTLAs ::= SEQUENCE (SIZE(1.. maxnoofeNBX2GTPTLAs)) OF TransportLayerAddress + +ENBIndirectX2TransportLayerAddresses ::= SEQUENCE (SIZE(1..maxnoofeNBX2TLAs)) OF TransportLayerAddress + +-- Y +-- Z + +END + + + +-- ************************************************************** +-- +-- Common definitions +-- +-- ************************************************************** + +S1AP-CommonDataTypes { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +eps-Access (21) modules (3) s1ap (1) version1 (1) s1ap-CommonDataTypes (3) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +Criticality ::= ENUMERATED { reject, ignore, notify } + +Presence ::= ENUMERATED { optional, conditional, mandatory } + +PrivateIE-ID ::= CHOICE { + local INTEGER (0..65535), + global OBJECT IDENTIFIER +} + +ProcedureCode ::= INTEGER (0..255) + +ProtocolExtensionID ::= INTEGER (0..65535) + +ProtocolIE-ID ::= INTEGER (0..65535) + +TriggeringMessage ::= ENUMERATED { initiating-message, successful-outcome, unsuccessfull-outcome } + +END + + +-- ************************************************************** +-- +-- Constant definitions +-- +-- ************************************************************** + +S1AP-Constants { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +eps-Access (21) modules (3) s1ap (1) version1 (1) s1ap-Constants (4) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + ProcedureCode, + ProtocolIE-ID + +FROM S1AP-CommonDataTypes; + + +-- ************************************************************** +-- +-- Elementary Procedures +-- +-- ************************************************************** + +id-HandoverPreparation ProcedureCode ::= 0 +id-HandoverResourceAllocation ProcedureCode ::= 1 +id-HandoverNotification ProcedureCode ::= 2 +id-PathSwitchRequest ProcedureCode ::= 3 +id-HandoverCancel ProcedureCode ::= 4 +id-E-RABSetup ProcedureCode ::= 5 +id-E-RABModify ProcedureCode ::= 6 +id-E-RABRelease ProcedureCode ::= 7 +id-E-RABReleaseIndication ProcedureCode ::= 8 +id-InitialContextSetup ProcedureCode ::= 9 +id-Paging ProcedureCode ::= 10 +id-downlinkNASTransport ProcedureCode ::= 11 +id-initialUEMessage ProcedureCode ::= 12 +id-uplinkNASTransport ProcedureCode ::= 13 +id-Reset ProcedureCode ::= 14 +id-ErrorIndication ProcedureCode ::= 15 +id-NASNonDeliveryIndication ProcedureCode ::= 16 +id-S1Setup ProcedureCode ::= 17 +id-UEContextReleaseRequest ProcedureCode ::= 18 +id-DownlinkS1cdma2000tunnelling ProcedureCode ::= 19 +id-UplinkS1cdma2000tunnelling ProcedureCode ::= 20 +id-UEContextModification ProcedureCode ::= 21 +id-UECapabilityInfoIndication ProcedureCode ::= 22 +id-UEContextRelease ProcedureCode ::= 23 +id-eNBStatusTransfer ProcedureCode ::= 24 +id-MMEStatusTransfer ProcedureCode ::= 25 +id-DeactivateTrace ProcedureCode ::= 26 +id-TraceStart ProcedureCode ::= 27 +id-TraceFailureIndication ProcedureCode ::= 28 +id-ENBConfigurationUpdate ProcedureCode ::= 29 +id-MMEConfigurationUpdate ProcedureCode ::= 30 +id-LocationReportingControl ProcedureCode ::= 31 +id-LocationReportingFailureIndication ProcedureCode ::= 32 +id-LocationReport ProcedureCode ::= 33 +id-OverloadStart ProcedureCode ::= 34 +id-OverloadStop ProcedureCode ::= 35 +id-WriteReplaceWarning ProcedureCode ::= 36 +id-eNBDirectInformationTransfer ProcedureCode ::= 37 +id-MMEDirectInformationTransfer ProcedureCode ::= 38 +id-PrivateMessage ProcedureCode ::= 39 +id-eNBConfigurationTransfer ProcedureCode ::= 40 +id-MMEConfigurationTransfer ProcedureCode ::= 41 +id-CellTrafficTrace ProcedureCode ::= 42 +id-Kill ProcedureCode ::= 43 +id-downlinkUEAssociatedLPPaTransport ProcedureCode ::= 44 +id-uplinkUEAssociatedLPPaTransport ProcedureCode ::= 45 +id-downlinkNonUEAssociatedLPPaTransport ProcedureCode ::= 46 +id-uplinkNonUEAssociatedLPPaTransport ProcedureCode ::= 47 +id-UERadioCapabilityMatch ProcedureCode ::= 48 +id-PWSRestartIndication ProcedureCode ::= 49 +id-E-RABModificationIndication ProcedureCode ::= 50 +id-PWSFailureIndication ProcedureCode ::= 51 +id-RerouteNASRequest ProcedureCode ::= 52 +id-UEContextModificationIndication ProcedureCode ::= 53 +id-ConnectionEstablishmentIndication ProcedureCode ::= 54 +id-UEContextSuspend ProcedureCode ::= 55 +id-UEContextResume ProcedureCode ::= 56 +id-NASDeliveryIndication ProcedureCode ::= 57 +id-RetrieveUEInformation ProcedureCode ::= 58 +id-UEInformationTransfer ProcedureCode ::= 59 +id-eNBCPRelocationIndication ProcedureCode ::= 60 +id-MMECPRelocationIndication ProcedureCode ::= 61 + +-- ************************************************************** +-- +-- Extension constants +-- +-- ************************************************************** + +maxPrivateIEs INTEGER ::= 65535 +maxProtocolExtensions INTEGER ::= 65535 +maxProtocolIEs INTEGER ::= 65535 +-- ************************************************************** +-- +-- Lists +-- +-- ************************************************************** + +maxnoofCSGs INTEGER ::= 256 +maxnoofE-RABs INTEGER ::= 256 +maxnoofTAIs INTEGER ::= 256 +maxnoofTACs INTEGER ::= 256 +maxnoofErrors INTEGER ::= 256 +maxnoofBPLMNs INTEGER ::= 6 +maxnoofPLMNsPerMME INTEGER ::= 32 +maxnoofEPLMNs INTEGER ::= 15 +maxnoofEPLMNsPlusOne INTEGER ::= 16 +maxnoofForbLACs INTEGER ::= 4096 +maxnoofForbTACs INTEGER ::= 4096 +maxnoofIndividualS1ConnectionsToReset INTEGER ::= 256 +maxnoofCells INTEGER ::= 16 +maxnoofCellsineNB INTEGER ::= 256 +maxnoofTAIforWarning INTEGER ::= 65535 +maxnoofCellID INTEGER ::= 65535 +maxnoofDCNs INTEGER ::= 32 +maxnoofEmergencyAreaID INTEGER ::= 65535 +maxnoofCellinTAI INTEGER ::= 65535 +maxnoofCellinEAI INTEGER ::= 65535 +maxnoofeNBX2TLAs INTEGER ::= 2 +maxnoofeNBX2ExtTLAs INTEGER ::= 16 +maxnoofeNBX2GTPTLAs INTEGER ::= 16 +maxnoofRATs INTEGER ::= 8 +maxnoofGroupIDs INTEGER ::= 65535 +maxnoofMMECs INTEGER ::= 256 +maxnoofCellIDforMDT INTEGER ::= 32 +maxnoofTAforMDT INTEGER ::= 8 +maxnoofMDTPLMNs INTEGER ::= 16 +maxnoofCellsforRestart INTEGER ::= 256 +maxnoofRestartTAIs INTEGER ::= 2048 +maxnoofRestartEmergencyAreaIDs INTEGER ::= 256 +maxEARFCN INTEGER ::= 262143 +maxnoofMBSFNAreaMDT INTEGER ::= 8 +maxnoofRecommendedCells INTEGER ::= 16 +maxnoofRecommendedENBs INTEGER ::= 16 + +-- ************************************************************** +-- +-- IEs +-- +-- ************************************************************** + +id-MME-UE-S1AP-ID ProtocolIE-ID ::= 0 +id-HandoverType ProtocolIE-ID ::= 1 +id-Cause ProtocolIE-ID ::= 2 +id-SourceID ProtocolIE-ID ::= 3 +id-TargetID ProtocolIE-ID ::= 4 +id-eNB-UE-S1AP-ID ProtocolIE-ID ::= 8 +id-E-RABSubjecttoDataForwardingList ProtocolIE-ID ::= 12 +id-E-RABtoReleaseListHOCmd ProtocolIE-ID ::= 13 +id-E-RABDataForwardingItem ProtocolIE-ID ::= 14 +id-E-RABReleaseItemBearerRelComp ProtocolIE-ID ::= 15 +id-E-RABToBeSetupListBearerSUReq ProtocolIE-ID ::= 16 +id-E-RABToBeSetupItemBearerSUReq ProtocolIE-ID ::= 17 +id-E-RABAdmittedList ProtocolIE-ID ::= 18 +id-E-RABFailedToSetupListHOReqAck ProtocolIE-ID ::= 19 +id-E-RABAdmittedItem ProtocolIE-ID ::= 20 +id-E-RABFailedtoSetupItemHOReqAck ProtocolIE-ID ::= 21 +id-E-RABToBeSwitchedDLList ProtocolIE-ID ::= 22 +id-E-RABToBeSwitchedDLItem ProtocolIE-ID ::= 23 +id-E-RABToBeSetupListCtxtSUReq ProtocolIE-ID ::= 24 +id-TraceActivation ProtocolIE-ID ::= 25 +id-NAS-PDU ProtocolIE-ID ::= 26 +id-E-RABToBeSetupItemHOReq ProtocolIE-ID ::= 27 +id-E-RABSetupListBearerSURes ProtocolIE-ID ::= 28 +id-E-RABFailedToSetupListBearerSURes ProtocolIE-ID ::= 29 +id-E-RABToBeModifiedListBearerModReq ProtocolIE-ID ::= 30 +id-E-RABModifyListBearerModRes ProtocolIE-ID ::= 31 +id-E-RABFailedToModifyList ProtocolIE-ID ::= 32 +id-E-RABToBeReleasedList ProtocolIE-ID ::= 33 +id-E-RABFailedToReleaseList ProtocolIE-ID ::= 34 +id-E-RABItem ProtocolIE-ID ::= 35 +id-E-RABToBeModifiedItemBearerModReq ProtocolIE-ID ::= 36 +id-E-RABModifyItemBearerModRes ProtocolIE-ID ::= 37 +id-E-RABReleaseItem ProtocolIE-ID ::= 38 +id-E-RABSetupItemBearerSURes ProtocolIE-ID ::= 39 +id-SecurityContext ProtocolIE-ID ::= 40 +id-HandoverRestrictionList ProtocolIE-ID ::= 41 +id-UEPagingID ProtocolIE-ID ::= 43 +id-pagingDRX ProtocolIE-ID ::= 44 +id-TAIList ProtocolIE-ID ::= 46 +id-TAIItem ProtocolIE-ID ::= 47 +id-E-RABFailedToSetupListCtxtSURes ProtocolIE-ID ::= 48 +id-E-RABReleaseItemHOCmd ProtocolIE-ID ::= 49 +id-E-RABSetupItemCtxtSURes ProtocolIE-ID ::= 50 +id-E-RABSetupListCtxtSURes ProtocolIE-ID ::= 51 +id-E-RABToBeSetupItemCtxtSUReq ProtocolIE-ID ::= 52 +id-E-RABToBeSetupListHOReq ProtocolIE-ID ::= 53 +id-GERANtoLTEHOInformationRes ProtocolIE-ID ::= 55 +id-UTRANtoLTEHOInformationRes ProtocolIE-ID ::= 57 +id-CriticalityDiagnostics ProtocolIE-ID ::= 58 +id-Global-ENB-ID ProtocolIE-ID ::= 59 +id-eNBname ProtocolIE-ID ::= 60 +id-MMEname ProtocolIE-ID ::= 61 +id-ServedPLMNs ProtocolIE-ID ::= 63 +id-SupportedTAs ProtocolIE-ID ::= 64 +id-TimeToWait ProtocolIE-ID ::= 65 +id-uEaggregateMaximumBitrate ProtocolIE-ID ::= 66 +id-TAI ProtocolIE-ID ::= 67 +id-E-RABReleaseListBearerRelComp ProtocolIE-ID ::= 69 +id-cdma2000PDU ProtocolIE-ID ::= 70 +id-cdma2000RATType ProtocolIE-ID ::= 71 +id-cdma2000SectorID ProtocolIE-ID ::= 72 +id-SecurityKey ProtocolIE-ID ::= 73 +id-UERadioCapability ProtocolIE-ID ::= 74 +id-GUMMEI-ID ProtocolIE-ID ::= 75 +id-E-RABInformationListItem ProtocolIE-ID ::= 78 +id-Direct-Forwarding-Path-Availability ProtocolIE-ID ::= 79 +id-UEIdentityIndexValue ProtocolIE-ID ::= 80 +id-cdma2000HOStatus ProtocolIE-ID ::= 83 +id-cdma2000HORequiredIndication ProtocolIE-ID ::= 84 +id-E-UTRAN-Trace-ID ProtocolIE-ID ::= 86 +id-RelativeMMECapacity ProtocolIE-ID ::= 87 +id-SourceMME-UE-S1AP-ID ProtocolIE-ID ::= 88 +id-Bearers-SubjectToStatusTransfer-Item ProtocolIE-ID ::= 89 +id-eNB-StatusTransfer-TransparentContainer ProtocolIE-ID ::= 90 +id-UE-associatedLogicalS1-ConnectionItem ProtocolIE-ID ::= 91 +id-ResetType ProtocolIE-ID ::= 92 +id-UE-associatedLogicalS1-ConnectionListResAck ProtocolIE-ID ::= 93 +id-E-RABToBeSwitchedULItem ProtocolIE-ID ::= 94 +id-E-RABToBeSwitchedULList ProtocolIE-ID ::= 95 +id-S-TMSI ProtocolIE-ID ::= 96 +id-cdma2000OneXRAND ProtocolIE-ID ::= 97 +id-RequestType ProtocolIE-ID ::= 98 +id-UE-S1AP-IDs ProtocolIE-ID ::= 99 +id-EUTRAN-CGI ProtocolIE-ID ::= 100 +id-OverloadResponse ProtocolIE-ID ::= 101 +id-cdma2000OneXSRVCCInfo ProtocolIE-ID ::= 102 +id-E-RABFailedToBeReleasedList ProtocolIE-ID ::= 103 +id-Source-ToTarget-TransparentContainer ProtocolIE-ID ::= 104 +id-ServedGUMMEIs ProtocolIE-ID ::= 105 +id-SubscriberProfileIDforRFP ProtocolIE-ID ::= 106 +id-UESecurityCapabilities ProtocolIE-ID ::= 107 +id-CSFallbackIndicator ProtocolIE-ID ::= 108 +id-CNDomain ProtocolIE-ID ::= 109 +id-E-RABReleasedList ProtocolIE-ID ::= 110 +id-MessageIdentifier ProtocolIE-ID ::= 111 +id-SerialNumber ProtocolIE-ID ::= 112 +id-WarningAreaList ProtocolIE-ID ::= 113 +id-RepetitionPeriod ProtocolIE-ID ::= 114 +id-NumberofBroadcastRequest ProtocolIE-ID ::= 115 +id-WarningType ProtocolIE-ID ::= 116 +id-WarningSecurityInfo ProtocolIE-ID ::= 117 +id-DataCodingScheme ProtocolIE-ID ::= 118 +id-WarningMessageContents ProtocolIE-ID ::= 119 +id-BroadcastCompletedAreaList ProtocolIE-ID ::= 120 +id-Inter-SystemInformationTransferTypeEDT ProtocolIE-ID ::= 121 +id-Inter-SystemInformationTransferTypeMDT ProtocolIE-ID ::= 122 +id-Target-ToSource-TransparentContainer ProtocolIE-ID ::= 123 +id-SRVCCOperationPossible ProtocolIE-ID ::= 124 +id-SRVCCHOIndication ProtocolIE-ID ::= 125 +id-NAS-DownlinkCount ProtocolIE-ID ::= 126 +id-CSG-Id ProtocolIE-ID ::= 127 +id-CSG-IdList ProtocolIE-ID ::= 128 +id-SONConfigurationTransferECT ProtocolIE-ID ::= 129 +id-SONConfigurationTransferMCT ProtocolIE-ID ::= 130 +id-TraceCollectionEntityIPAddress ProtocolIE-ID ::= 131 +id-MSClassmark2 ProtocolIE-ID ::= 132 +id-MSClassmark3 ProtocolIE-ID ::= 133 +id-RRC-Establishment-Cause ProtocolIE-ID ::= 134 +id-NASSecurityParametersfromE-UTRAN ProtocolIE-ID ::= 135 +id-NASSecurityParameterstoE-UTRAN ProtocolIE-ID ::= 136 +id-DefaultPagingDRX ProtocolIE-ID ::= 137 +id-Source-ToTarget-TransparentContainer-Secondary ProtocolIE-ID ::= 138 +id-Target-ToSource-TransparentContainer-Secondary ProtocolIE-ID ::= 139 +id-EUTRANRoundTripDelayEstimationInfo ProtocolIE-ID ::= 140 +id-BroadcastCancelledAreaList ProtocolIE-ID ::= 141 +id-ConcurrentWarningMessageIndicator ProtocolIE-ID ::= 142 +id-Data-Forwarding-Not-Possible ProtocolIE-ID ::= 143 +id-ExtendedRepetitionPeriod ProtocolIE-ID ::= 144 +id-CellAccessMode ProtocolIE-ID ::= 145 +id-CSGMembershipStatus ProtocolIE-ID ::= 146 +id-LPPa-PDU ProtocolIE-ID ::= 147 +id-Routing-ID ProtocolIE-ID ::= 148 +id-Time-Synchronisation-Info ProtocolIE-ID ::= 149 +id-PS-ServiceNotAvailable ProtocolIE-ID ::= 150 +id-PagingPriority ProtocolIE-ID ::= 151 +id-x2TNLConfigurationInfo ProtocolIE-ID ::= 152 +id-eNBX2ExtendedTransportLayerAddresses ProtocolIE-ID ::= 153 +id-GUMMEIList ProtocolIE-ID ::= 154 +id-GW-TransportLayerAddress ProtocolIE-ID ::= 155 +id-Correlation-ID ProtocolIE-ID ::= 156 +id-SourceMME-GUMMEI ProtocolIE-ID ::= 157 +id-MME-UE-S1AP-ID-2 ProtocolIE-ID ::= 158 +id-RegisteredLAI ProtocolIE-ID ::= 159 +id-RelayNode-Indicator ProtocolIE-ID ::= 160 +id-TrafficLoadReductionIndication ProtocolIE-ID ::= 161 +id-MDTConfiguration ProtocolIE-ID ::= 162 +id-MMERelaySupportIndicator ProtocolIE-ID ::= 163 +id-GWContextReleaseIndication ProtocolIE-ID ::= 164 +id-ManagementBasedMDTAllowed ProtocolIE-ID ::= 165 +id-PrivacyIndicator ProtocolIE-ID ::= 166 +id-Time-UE-StayedInCell-EnhancedGranularity ProtocolIE-ID ::= 167 +id-HO-Cause ProtocolIE-ID ::= 168 +id-VoiceSupportMatchIndicator ProtocolIE-ID ::= 169 +id-GUMMEIType ProtocolIE-ID ::= 170 +id-M3Configuration ProtocolIE-ID ::= 171 +id-M4Configuration ProtocolIE-ID ::= 172 +id-M5Configuration ProtocolIE-ID ::= 173 +id-MDT-Location-Info ProtocolIE-ID ::= 174 +id-MobilityInformation ProtocolIE-ID ::= 175 +id-Tunnel-Information-for-BBF ProtocolIE-ID ::= 176 +id-ManagementBasedMDTPLMNList ProtocolIE-ID ::= 177 +id-SignallingBasedMDTPLMNList ProtocolIE-ID ::= 178 +id-ULCOUNTValueExtended ProtocolIE-ID ::= 179 +id-DLCOUNTValueExtended ProtocolIE-ID ::= 180 +id-ReceiveStatusOfULPDCPSDUsExtended ProtocolIE-ID ::= 181 +id-ECGIListForRestart ProtocolIE-ID ::= 182 +id-SIPTO-Correlation-ID ProtocolIE-ID ::= 183 +id-SIPTO-L-GW-TransportLayerAddress ProtocolIE-ID ::= 184 +id-TransportInformation ProtocolIE-ID ::= 185 +id-LHN-ID ProtocolIE-ID ::= 186 +id-AdditionalCSFallbackIndicator ProtocolIE-ID ::= 187 +id-TAIListForRestart ProtocolIE-ID ::= 188 +id-UserLocationInformation ProtocolIE-ID ::= 189 +id-EmergencyAreaIDListForRestart ProtocolIE-ID ::= 190 +id-KillAllWarningMessages ProtocolIE-ID ::= 191 +id-Masked-IMEISV ProtocolIE-ID ::= 192 +id-eNBIndirectX2TransportLayerAddresses ProtocolIE-ID ::= 193 +id-uE-HistoryInformationFromTheUE ProtocolIE-ID ::= 194 +id-ProSeAuthorized ProtocolIE-ID ::= 195 +id-ExpectedUEBehaviour ProtocolIE-ID ::= 196 +id-LoggedMBSFNMDT ProtocolIE-ID ::= 197 +id-UERadioCapabilityForPaging ProtocolIE-ID ::= 198 +id-E-RABToBeModifiedListBearerModInd ProtocolIE-ID ::= 199 +id-E-RABToBeModifiedItemBearerModInd ProtocolIE-ID ::= 200 +id-E-RABNotToBeModifiedListBearerModInd ProtocolIE-ID ::= 201 +id-E-RABNotToBeModifiedItemBearerModInd ProtocolIE-ID ::= 202 +id-E-RABModifyListBearerModConf ProtocolIE-ID ::= 203 +id-E-RABModifyItemBearerModConf ProtocolIE-ID ::= 204 +id-E-RABFailedToModifyListBearerModConf ProtocolIE-ID ::= 205 +id-SON-Information-Report ProtocolIE-ID ::= 206 +id-Muting-Availability-Indication ProtocolIE-ID ::= 207 +id-Muting-Pattern-Information ProtocolIE-ID ::= 208 +id-Synchronisation-Information ProtocolIE-ID ::= 209 +id-E-RABToBeReleasedListBearerModConf ProtocolIE-ID ::= 210 +id-AssistanceDataForPaging ProtocolIE-ID ::= 211 +id-CellIdentifierAndCELevelForCECapableUEs ProtocolIE-ID ::= 212 +id-InformationOnRecommendedCellsAndENBsForPaging ProtocolIE-ID ::= 213 +id-RecommendedCellItem ProtocolIE-ID ::= 214 +id-RecommendedENBItem ProtocolIE-ID ::= 215 +id-ProSeUEtoNetworkRelaying ProtocolIE-ID ::= 216 +id-ULCOUNTValuePDCP-SNlength18 ProtocolIE-ID ::= 217 +id-DLCOUNTValuePDCP-SNlength18 ProtocolIE-ID ::= 218 +id-ReceiveStatusOfULPDCPSDUsPDCP-SNlength18 ProtocolIE-ID ::= 219 +id-M6Configuration ProtocolIE-ID ::= 220 +id-M7Configuration ProtocolIE-ID ::= 221 +id-PWSfailedECGIList ProtocolIE-ID ::= 222 +id-MME-Group-ID ProtocolIE-ID ::= 223 +id-Additional-GUTI ProtocolIE-ID ::= 224 +id-S1-Message ProtocolIE-ID ::= 225 +id-CSGMembershipInfo ProtocolIE-ID ::= 226 +id-Paging-eDRXInformation ProtocolIE-ID ::= 227 +id-UE-RetentionInformation ProtocolIE-ID ::= 228 +id-UE-Usage-Type ProtocolIE-ID ::= 230 +id-extended-UEIdentityIndexValue ProtocolIE-ID ::= 231 +id-RAT-Type ProtocolIE-ID ::= 232 +id-BearerType ProtocolIE-ID ::= 233 +id-NB-IoT-DefaultPagingDRX ProtocolIE-ID ::= 234 +id-E-RABFailedToResumeListResumeReq ProtocolIE-ID ::= 235 +id-E-RABFailedToResumeItemResumeReq ProtocolIE-ID ::= 236 +id-E-RABFailedToResumeListResumeRes ProtocolIE-ID ::= 237 +id-E-RABFailedToResumeItemResumeRes ProtocolIE-ID ::= 238 +id-NB-IoT-Paging-eDRXInformation ProtocolIE-ID ::= 239 +id-V2XServicesAuthorized ProtocolIE-ID ::= 240 +id-UEUserPlaneCIoTSupportIndicator ProtocolIE-ID ::= 241 +id-CE-mode-B-SupportIndicator ProtocolIE-ID ::= 242 +id-SRVCCOperationNotPossible ProtocolIE-ID ::= 243 +id-NB-IoT-UEIdentityIndexValue ProtocolIE-ID ::= 244 +id-RRC-Resume-Cause ProtocolIE-ID ::= 245 +id-DCN-ID ProtocolIE-ID ::= 246 +id-ServedDCNs ProtocolIE-ID ::= 247 +id-UESidelinkAggregateMaximumBitrate ProtocolIE-ID ::= 248 +id-DLNASPDUDeliveryAckRequest ProtocolIE-ID ::= 249 +id-Coverage-Level ProtocolIE-ID ::= 250 +id-EnhancedCoverageRestricted ProtocolIE-ID ::= 251 +id-UE-Level-QoS-Parameters ProtocolIE-ID ::= 252 +id-DL-CP-SecurityInformation ProtocolIE-ID ::= 253 +id-UL-CP-SecurityInformation ProtocolIE-ID ::= 254 + +END + + +-- ************************************************************** +-- +-- Container definitions +-- +-- ************************************************************** + +S1AP-Containers { +itu-t (0) identified-organization (4) etsi (0) mobileDomain (0) +eps-Access (21) modules (3) s1ap (1) version1 (1) s1ap-Containers (5) } + +DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- ************************************************************** +-- +-- IE parameter types from other modules. +-- +-- ************************************************************** + +IMPORTS + Criticality, + Presence, + PrivateIE-ID, + ProtocolExtensionID, + ProtocolIE-ID +FROM S1AP-CommonDataTypes + + maxPrivateIEs, + maxProtocolExtensions, + maxProtocolIEs +FROM S1AP-Constants; + +-- ************************************************************** +-- +-- Class Definition for Protocol IEs +-- +-- ************************************************************** + +S1AP-PROTOCOL-IES ::= CLASS { + &id ProtocolIE-ID UNIQUE, + &criticality Criticality, + &Value, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + TYPE &Value + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Protocol IEs +-- +-- ************************************************************** + +S1AP-PROTOCOL-IES-PAIR ::= CLASS { + &id ProtocolIE-ID UNIQUE, + &firstCriticality Criticality, + &FirstValue, + &secondCriticality Criticality, + &SecondValue, + &presence Presence +} +WITH SYNTAX { + ID &id + FIRST CRITICALITY &firstCriticality + FIRST TYPE &FirstValue + SECOND CRITICALITY &secondCriticality + SECOND TYPE &SecondValue + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Protocol Extensions +-- +-- ************************************************************** + +S1AP-PROTOCOL-EXTENSION ::= CLASS { + &id ProtocolExtensionID UNIQUE, + &criticality Criticality, + &Extension, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + EXTENSION &Extension + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Class Definition for Private IEs +-- +-- ************************************************************** + +S1AP-PRIVATE-IES ::= CLASS { + &id PrivateIE-ID, + &criticality Criticality, + &Value, + &presence Presence +} +WITH SYNTAX { + ID &id + CRITICALITY &criticality + TYPE &Value + PRESENCE &presence +} + +-- ************************************************************** +-- +-- Container for Protocol IEs +-- +-- ************************************************************** + +ProtocolIE-Container {S1AP-PROTOCOL-IES : IEsSetParam} ::= + SEQUENCE (SIZE (0..maxProtocolIEs)) OF + ProtocolIE-Field {{IEsSetParam}} + +ProtocolIE-SingleContainer {S1AP-PROTOCOL-IES : IEsSetParam} ::= + ProtocolIE-Field {{IEsSetParam}} + +ProtocolIE-Field {S1AP-PROTOCOL-IES : IEsSetParam} ::= SEQUENCE { + id S1AP-PROTOCOL-IES.&id ({IEsSetParam}), + criticality S1AP-PROTOCOL-IES.&criticality ({IEsSetParam}{@id}), + value S1AP-PROTOCOL-IES.&Value ({IEsSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Protocol IE Pairs +-- +-- ************************************************************** + +ProtocolIE-ContainerPair {S1AP-PROTOCOL-IES-PAIR : IEsSetParam} ::= + SEQUENCE (SIZE (0..maxProtocolIEs)) OF + ProtocolIE-FieldPair {{IEsSetParam}} + +ProtocolIE-FieldPair {S1AP-PROTOCOL-IES-PAIR : IEsSetParam} ::= SEQUENCE { + id S1AP-PROTOCOL-IES-PAIR.&id ({IEsSetParam}), + firstCriticality S1AP-PROTOCOL-IES-PAIR.&firstCriticality ({IEsSetParam}{@id}), + firstValue S1AP-PROTOCOL-IES-PAIR.&FirstValue ({IEsSetParam}{@id}), + secondCriticality S1AP-PROTOCOL-IES-PAIR.&secondCriticality ({IEsSetParam}{@id}), + secondValue S1AP-PROTOCOL-IES-PAIR.&SecondValue ({IEsSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container Lists for Protocol IE Containers +-- +-- ************************************************************** + +ProtocolIE-ContainerList {INTEGER : lowerBound, INTEGER : upperBound, S1AP-PROTOCOL-IES : IEsSetParam} ::= + SEQUENCE (SIZE (lowerBound..upperBound)) OF + ProtocolIE-SingleContainer {{IEsSetParam}} + +ProtocolIE-ContainerPairList {INTEGER : lowerBound, INTEGER : upperBound, S1AP-PROTOCOL-IES-PAIR : IEsSetParam} ::= + SEQUENCE (SIZE (lowerBound..upperBound)) OF + ProtocolIE-ContainerPair {{IEsSetParam}} + +-- ************************************************************** +-- +-- Container for Protocol Extensions +-- +-- ************************************************************** + +ProtocolExtensionContainer {S1AP-PROTOCOL-EXTENSION : ExtensionSetParam} ::= + SEQUENCE (SIZE (1..maxProtocolExtensions)) OF + ProtocolExtensionField {{ExtensionSetParam}} + +ProtocolExtensionField {S1AP-PROTOCOL-EXTENSION : ExtensionSetParam} ::= SEQUENCE { + id S1AP-PROTOCOL-EXTENSION.&id ({ExtensionSetParam}), + criticality S1AP-PROTOCOL-EXTENSION.&criticality ({ExtensionSetParam}{@id}), + extensionValue S1AP-PROTOCOL-EXTENSION.&Extension ({ExtensionSetParam}{@id}) +} + +-- ************************************************************** +-- +-- Container for Private IEs +-- +-- ************************************************************** + +PrivateIE-Container {S1AP-PRIVATE-IES : IEsSetParam } ::= + SEQUENCE (SIZE (1.. maxPrivateIEs)) OF + PrivateIE-Field {{IEsSetParam}} + +PrivateIE-Field {S1AP-PRIVATE-IES : IEsSetParam} ::= SEQUENCE { + id S1AP-PRIVATE-IES.&id ({IEsSetParam}), + criticality S1AP-PRIVATE-IES.&criticality ({IEsSetParam}{@id}), + value S1AP-PRIVATE-IES.&Value ({IEsSetParam}{@id}) +} + +END diff --git a/openair3/S1AP/s1ap_common.c b/openair3/S1AP/s1ap_common.c index 0bd132a228..7c4f970af2 100644 --- a/openair3/S1AP/s1ap_common.c +++ b/openair3/S1AP/s1ap_common.c @@ -22,7 +22,7 @@ /*! \file s1ap_common.c * \brief s1ap procedures for both eNB and MME * \author Sebastien ROUX and Navid Nikaein - * \email navid.nikaein@eurecom.fr + * \email navid.nikaein@eurecom.fr * \date 2012-2015 * \version 0.1 */ @@ -30,7 +30,7 @@ #include #include "s1ap_common.h" -#include "S1AP-PDU.h" +#include "S1AP_S1AP-PDU.h" int asn_debug = 0; int asn1_xer_print = 0; @@ -53,144 +53,6 @@ inline void ASN_DEBUG(const char *fmt, ...) } #endif -ssize_t s1ap_generate_initiating_message( - uint8_t **buffer, - uint32_t *length, - e_S1ap_ProcedureCode procedureCode, - S1ap_Criticality_t criticality, - asn_TYPE_descriptor_t *td, - void *sptr) +void s1ap_handle_criticality(S1AP_Criticality_t criticality) { - S1AP_PDU_t pdu; - ssize_t encoded; - - memset(&pdu, 0, sizeof(S1AP_PDU_t)); - - pdu.present = S1AP_PDU_PR_initiatingMessage; - pdu.choice.initiatingMessage.procedureCode = procedureCode; - pdu.choice.initiatingMessage.criticality = criticality; - ANY_fromType_aper(&pdu.choice.initiatingMessage.value, td, sptr); - - if (asn1_xer_print) { - xer_fprint(stdout, &asn_DEF_S1AP_PDU, (void *)&pdu); - } - - /* We can safely free list of IE from sptr */ - ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr); - - if ((encoded = aper_encode_to_new_buffer(&asn_DEF_S1AP_PDU, 0, &pdu, - (void **)buffer)) < 0) { - return -1; - } - - *length = encoded; - return encoded; -} - -ssize_t s1ap_generate_successfull_outcome( - uint8_t **buffer, - uint32_t *length, - e_S1ap_ProcedureCode procedureCode, - S1ap_Criticality_t criticality, - asn_TYPE_descriptor_t *td, - void *sptr) -{ - S1AP_PDU_t pdu; - ssize_t encoded; - - memset(&pdu, 0, sizeof(S1AP_PDU_t)); - - pdu.present = S1AP_PDU_PR_successfulOutcome; - pdu.choice.successfulOutcome.procedureCode = procedureCode; - pdu.choice.successfulOutcome.criticality = criticality; - ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr); - - if (asn1_xer_print) { - xer_fprint(stdout, &asn_DEF_S1AP_PDU, (void *)&pdu); - } - - /* We can safely free list of IE from sptr */ - ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr); - - if ((encoded = aper_encode_to_new_buffer(&asn_DEF_S1AP_PDU, 0, &pdu, - (void **)buffer)) < 0) { - return -1; - } - - *length = encoded; - - return encoded; -} - -ssize_t s1ap_generate_unsuccessfull_outcome( - uint8_t **buffer, - uint32_t *length, - e_S1ap_ProcedureCode procedureCode, - S1ap_Criticality_t criticality, - asn_TYPE_descriptor_t *td, - void *sptr) -{ - S1AP_PDU_t pdu; - ssize_t encoded; - - memset(&pdu, 0, sizeof(S1AP_PDU_t)); - - pdu.present = S1AP_PDU_PR_unsuccessfulOutcome; - pdu.choice.successfulOutcome.procedureCode = procedureCode; - pdu.choice.successfulOutcome.criticality = criticality; - ANY_fromType_aper(&pdu.choice.successfulOutcome.value, td, sptr); - - if (asn1_xer_print) { - xer_fprint(stdout, &asn_DEF_S1AP_PDU, (void *)&pdu); - } - - /* We can safely free list of IE from sptr */ - ASN_STRUCT_FREE_CONTENTS_ONLY(*td, sptr); - - if ((encoded = aper_encode_to_new_buffer(&asn_DEF_S1AP_PDU, 0, &pdu, - (void **)buffer)) < 0) { - return -1; - } - - *length = encoded; - - return encoded; -} - -S1ap_IE_t *s1ap_new_ie( - S1ap_ProtocolIE_ID_t id, - S1ap_Criticality_t criticality, - asn_TYPE_descriptor_t *type, - void *sptr) -{ - S1ap_IE_t *buff; - - if ((buff = malloc(sizeof(S1ap_IE_t))) == NULL) { - // Possible error on malloc - return NULL; - } - - memset((void *)buff, 0, sizeof(S1ap_IE_t)); - - buff->id = id; - buff->criticality = criticality; - - if (ANY_fromType_aper(&buff->value, type, sptr) < 0) { - fprintf(stderr, "Encoding of %s failed\n", type->name); - free(buff); - return NULL; - } - - if (asn1_xer_print) - if (xer_fprint(stdout, &asn_DEF_S1ap_IE, buff) < 0) { - free(buff); - return NULL; - } - - return buff; -} - -void s1ap_handle_criticality(S1ap_Criticality_t criticality) -{ - } diff --git a/openair3/S1AP/s1ap_common.h b/openair3/S1AP/s1ap_common.h index 003bdd2d62..09e8de0a05 100644 --- a/openair3/S1AP/s1ap_common.h +++ b/openair3/S1AP/s1ap_common.h @@ -39,343 +39,19 @@ extern int asn_debug; inline void ASN_DEBUG(const char *fmt, ...); #endif -#include "S1ap-Criticality.h" -#include "S1ap-Presence.h" -#include "S1ap-PrivateIE-ID.h" -#include "S1ap-ProcedureCode.h" -#include "S1ap-ProtocolExtensionID.h" -#include "S1ap-ProtocolIE-ID.h" -#include "S1ap-TriggeringMessage.h" -#include "S1ap-AllocationAndRetentionPriority.h" -#include "S1ap-Bearers-SubjectToStatusTransfer-List.h" -#include "S1ap-Bearers-SubjectToStatusTransfer-Item.h" -#include "S1ap-BitRate.h" -#include "S1ap-BPLMNs.h" -#include "S1ap-BroadcastCompletedAreaList.h" -#include "S1ap-Cause.h" -#include "S1ap-CauseMisc.h" -#include "S1ap-CauseProtocol.h" -#include "S1ap-CauseRadioNetwork.h" -#include "S1ap-CauseTransport.h" -#include "S1ap-CauseNas.h" -#include "S1ap-CellIdentity.h" -#include "S1ap-CellID-Broadcast.h" -#include "S1ap-CellID-Broadcast-Item.h" -#include "S1ap-Cdma2000PDU.h" -#include "S1ap-Cdma2000RATType.h" -#include "S1ap-Cdma2000SectorID.h" -#include "S1ap-Cdma2000HOStatus.h" -#include "S1ap-Cdma2000HORequiredIndication.h" -#include "S1ap-Cdma2000OneXSRVCCInfo.h" -#include "S1ap-Cdma2000OneXMEID.h" -#include "S1ap-Cdma2000OneXMSI.h" -#include "S1ap-Cdma2000OneXPilot.h" -#include "S1ap-Cdma2000OneXRAND.h" -#include "S1ap-Cell-Size.h" -#include "S1ap-CellType.h" -#include "S1ap-CGI.h" -#include "S1ap-CI.h" -#include "S1ap-CNDomain.h" -#include "S1ap-CSFallbackIndicator.h" -#include "S1ap-CSG-Id.h" -#include "S1ap-CSG-IdList.h" -#include "S1ap-CSG-IdList-Item.h" -#include "S1ap-COUNTvalue.h" -#include "S1ap-DataCodingScheme.h" -#include "S1ap-DL-Forwarding.h" -#include "S1ap-Direct-Forwarding-Path-Availability.h" -#include "S1ap-ECGIList.h" -#include "S1ap-EmergencyAreaIDList.h" -#include "S1ap-EmergencyAreaID.h" -#include "S1ap-EmergencyAreaID-Broadcast.h" -#include "S1ap-EmergencyAreaID-Broadcast-Item.h" -#include "S1ap-CompletedCellinEAI.h" -#include "S1ap-CompletedCellinEAI-Item.h" -#include "S1ap-ENB-ID.h" -#include "S1ap-GERAN-Cell-ID.h" -#include "S1ap-Global-ENB-ID.h" -#include "S1ap-ENB-StatusTransfer-TransparentContainer.h" -#include "S1ap-ENBname.h" -#include "S1ap-ENBX2TLAs.h" -#include "S1ap-EncryptionAlgorithms.h" -#include "S1ap-EPLMNs.h" -#include "S1ap-EventType.h" -#include "S1ap-E-RAB-ID.h" -#include "S1ap-E-RABInformationList.h" -#include "S1ap-E-RABInformationListItem.h" -#include "S1ap-E-RABList.h" -#include "S1ap-E-RABItem.h" -#include "S1ap-E-RABLevelQoSParameters.h" -#include "S1ap-EUTRAN-CGI.h" -#include "S1ap-ExtendedRNC-ID.h" -#include "S1ap-ForbiddenInterRATs.h" -#include "S1ap-ForbiddenTAs.h" -#include "S1ap-ForbiddenTAs-Item.h" -#include "S1ap-ForbiddenTACs.h" -#include "S1ap-ForbiddenLAs.h" -#include "S1ap-ForbiddenLAs-Item.h" -#include "S1ap-ForbiddenLACs.h" -#include "S1ap-GBR-QosInformation.h" -#include "S1ap-GTP-TEID.h" -#include "S1ap-GUMMEI.h" -#include "S1ap-HandoverRestrictionList.h" -#include "S1ap-HandoverType.h" -#include "S1ap-HFN.h" -#include "S1ap-IMSI.h" -#include "S1ap-IntegrityProtectionAlgorithms.h" -#include "S1ap-InterfacesToTrace.h" -#include "S1ap-LAC.h" -#include "S1ap-LAI.h" -#include "S1ap-LastVisitedCell-Item.h" -#include "S1ap-LastVisitedEUTRANCellInformation.h" -#include "S1ap-LastVisitedUTRANCellInformation.h" -#include "S1ap-LastVisitedGERANCellInformation.h" -#include "S1ap-L3-Information.h" -#include "S1ap-MessageIdentifier.h" -#include "S1ap-MMEname.h" -#include "S1ap-MME-Group-ID.h" -#include "S1ap-MME-Code.h" -#include "S1ap-M-TMSI.h" -#include "S1ap-MSClassmark2.h" -#include "S1ap-MSClassmark3.h" -#include "S1ap-NAS-PDU.h" -#include "S1ap-NASSecurityParametersfromE-UTRAN.h" -#include "S1ap-NASSecurityParameterstoE-UTRAN.h" -#include "S1ap-NumberofBroadcastRequest.h" -#include "S1ap-NumberOfBroadcasts.h" -#include "S1ap-OldBSS-ToNewBSS-Information.h" -#include "S1ap-OverloadAction.h" -#include "S1ap-OverloadResponse.h" -#include "S1ap-PagingDRX.h" -#include "S1ap-PDCP-SN.h" -#include "S1ap-PLMNidentity.h" -#include "S1ap-Pre-emptionCapability.h" -#include "S1ap-Pre-emptionVulnerability.h" -#include "S1ap-PriorityLevel.h" -#include "S1ap-QCI.h" -#include "S1ap-ReceiveStatusofULPDCPSDUs.h" -#include "S1ap-RelativeMMECapacity.h" -#include "S1ap-RAC.h" -#include "S1ap-RequestType.h" -#include "S1ap-RIMTransfer.h" -#include "S1ap-RIMInformation.h" -#include "S1ap-RIMRoutingAddress.h" -#include "S1ap-ReportArea.h" -#include "S1ap-RepetitionPeriod.h" -#include "S1ap-RNC-ID.h" -#include "S1ap-RRC-Container.h" -#include "S1ap-RRC-Establishment-Cause.h" -#include "S1ap-SecurityKey.h" -#include "S1ap-SecurityContext.h" -#include "S1ap-SerialNumber.h" -#include "S1ap-SONInformation.h" -#include "S1ap-SONInformationRequest.h" -#include "S1ap-SONInformationReply.h" -#include "S1ap-SONConfigurationTransfer.h" -#include "S1ap-Source-ToTarget-TransparentContainer.h" -#include "S1ap-SourceBSS-ToTargetBSS-TransparentContainer.h" -#include "S1ap-SourceeNB-ID.h" -#include "S1ap-SRVCCOperationPossible.h" -#include "S1ap-SRVCCHOIndication.h" -#include "S1ap-SourceeNB-ToTargeteNB-TransparentContainer.h" -#include "S1ap-SourceRNC-ToTargetRNC-TransparentContainer.h" -#include "S1ap-ServedGUMMEIs.h" -#include "S1ap-ServedGUMMEIsItem.h" -#include "S1ap-ServedGroupIDs.h" -#include "S1ap-ServedMMECs.h" -#include "S1ap-ServedPLMNs.h" -#include "S1ap-SubscriberProfileIDforRFP.h" -#include "S1ap-SupportedTAs.h" -#include "S1ap-SupportedTAs-Item.h" -#include "S1ap-S-TMSI.h" -#include "S1ap-TAC.h" -#include "S1ap-TAIItem.h" -#include "S1ap-TAIList.h" -#include "S1ap-TAIListforWarning.h" -#include "S1ap-TAI.h" -#include "S1ap-TAI-Broadcast.h" -#include "S1ap-TAI-Broadcast-Item.h" -#include "S1ap-CompletedCellinTAI.h" -#include "S1ap-CompletedCellinTAI-Item.h" -#include "S1ap-TargetID.h" -#include "S1ap-TargeteNB-ID.h" -#include "S1ap-TargetRNC-ID.h" -#include "S1ap-TargeteNB-ToSourceeNB-TransparentContainer.h" -#include "S1ap-Target-ToSource-TransparentContainer.h" -#include "S1ap-TargetRNC-ToSourceRNC-TransparentContainer.h" -#include "S1ap-TargetBSS-ToSourceBSS-TransparentContainer.h" -#include "S1ap-TimeToWait.h" -#include "S1ap-Time-UE-StayedInCell.h" -#include "S1ap-TransportLayerAddress.h" -#include "S1ap-TraceActivation.h" -#include "S1ap-TraceDepth.h" -#include "S1ap-E-UTRAN-Trace-ID.h" -#include "S1ap-TypeOfError.h" -#include "S1ap-UEAggregateMaximumBitrate.h" -#include "S1ap-UE-associatedLogicalS1-ConnectionItem.h" -#include "S1ap-UEIdentityIndexValue.h" -#include "S1ap-UE-HistoryInformation.h" -#include "S1ap-UEPagingID.h" -#include "S1ap-UERadioCapability.h" -#include "S1ap-UESecurityCapabilities.h" -#include "S1ap-WarningAreaList.h" -#include "S1ap-WarningType.h" -#include "S1ap-WarningSecurityInfo.h" -#include "S1ap-WarningMessageContents.h" -#include "S1ap-X2TNLConfigurationInfo.h" -#include "S1ap-CriticalityDiagnostics.h" -#include "S1ap-CriticalityDiagnostics-IE-List.h" -#include "S1ap-CriticalityDiagnostics-IE-Item.h" -#include "S1ap-ResetType.h" -#include "S1ap-Inter-SystemInformationTransferType.h" -#include "S1ap-UE-S1AP-IDs.h" -#include "S1ap-UE-S1AP-ID-pair.h" -#include "S1ap-MME-UE-S1AP-ID.h" -#include "S1ap-ENB-UE-S1AP-ID.h" -#include "S1ap-TBCD-STRING.h" -#include "S1ap-InitiatingMessage.h" -#include "S1ap-SuccessfulOutcome.h" -#include "S1ap-UnsuccessfulOutcome.h" -#include "S1ap-HandoverRequired.h" -#include "S1ap-HandoverCommand.h" -#include "S1ap-HandoverNotify.h" -#include "S1ap-HandoverPreparationFailure.h" -#include "S1ap-HandoverRequest.h" -#include "S1ap-HandoverRequestAcknowledge.h" -#include "S1ap-HandoverFailure.h" -#include "S1ap-PathSwitchRequest.h" -#include "S1ap-PathSwitchRequestAcknowledge.h" -#include "S1ap-PathSwitchRequestFailure.h" -#include "S1ap-E-RABSetupRequest.h" -#include "S1ap-E-RABSetupResponse.h" -#include "S1ap-E-RABModifyRequest.h" -#include "S1ap-E-RABModifyResponse.h" -#include "S1ap-E-RABReleaseIndication.h" -#include "S1ap-E-RABReleaseCommand.h" -#include "S1ap-E-RABReleaseResponse.h" -#include "S1ap-InitialContextSetupRequest.h" -#include "S1ap-InitialContextSetupResponse.h" -#include "S1ap-InitialContextSetupFailure.h" -#include "S1ap-UEContextReleaseRequest.h" -#include "S1ap-Paging.h" -#include "S1ap-DownlinkNASTransport.h" -#include "S1ap-InitialUEMessage.h" -#include "S1ap-UplinkNASTransport.h" -#include "S1ap-NASNonDeliveryIndication.h" -#include "S1ap-HandoverCancel.h" -#include "S1ap-HandoverCancelAcknowledge.h" -#include "S1ap-Reset.h" -#include "S1ap-ResetAcknowledge.h" -#include "S1ap-S1SetupResponse.h" -#include "S1ap-S1SetupRequest.h" -#include "S1ap-S1SetupFailure.h" -#include "S1ap-ErrorIndication.h" -#include "S1ap-ENBConfigurationUpdate.h" -#include "S1ap-ENBConfigurationUpdateAcknowledge.h" -#include "S1ap-ENBConfigurationUpdateFailure.h" -#include "S1ap-MMEConfigurationUpdate.h" -#include "S1ap-MMEConfigurationUpdateAcknowledge.h" -#include "S1ap-MMEConfigurationUpdateFailure.h" -#include "S1ap-DownlinkS1cdma2000tunneling.h" -#include "S1ap-UplinkS1cdma2000tunneling.h" -#include "S1ap-UEContextModificationRequest.h" -#include "S1ap-UEContextModificationResponse.h" -#include "S1ap-UEContextModificationFailure.h" -#include "S1ap-UECapabilityInfoIndication.h" -#include "S1ap-UEContextReleaseCommand.h" -#include "S1ap-UEContextReleaseComplete.h" -#include "S1ap-ENBStatusTransfer.h" -#include "S1ap-MMEStatusTransfer.h" -#include "S1ap-DeactivateTrace.h" -#include "S1ap-TraceStart.h" -#include "S1ap-TraceFailureIndication.h" -#include "S1ap-CellTrafficTrace.h" -#include "S1ap-LocationReportingControl.h" -#include "S1ap-LocationReportingFailureIndication.h" -#include "S1ap-LocationReport.h" -#include "S1ap-OverloadStart.h" -#include "S1ap-OverloadStop.h" -#include "S1ap-WriteReplaceWarningRequest.h" -#include "S1ap-WriteReplaceWarningResponse.h" -#include "S1ap-ENBDirectInformationTransfer.h" -#include "S1ap-MMEDirectInformationTransfer.h" -#include "S1ap-ENBConfigurationTransfer.h" -#include "S1ap-MMEConfigurationTransfer.h" -#include "S1ap-PrivateMessage.h" -#include "S1ap-E-RABReleaseItemBearerRelComp.h" -#include "S1ap-E-RABToBeSwitchedDLList.h" -#include "S1ap-E-RABToBeSwitchedDLItem.h" -#include "S1ap-E-RABToBeSwitchedULList.h" -#include "S1ap-E-RABToBeSwitchedULItem.h" -#include "S1ap-E-RABToBeSetupListBearerSUReq.h" -#include "S1ap-E-RABToBeSetupItemBearerSUReq.h" -#include "S1ap-E-RABDataForwardingList.h" -#include "S1ap-E-RABDataForwardingItem.h" -#include "S1ap-E-RABToBeSetupListHOReq.h" -#include "S1ap-E-RABToBeSetupItemHOReq.h" -#include "S1ap-E-RABAdmittedList.h" -#include "S1ap-E-RABAdmittedItem.h" -#include "S1ap-E-RABFailedToSetupListHOReqAck.h" -#include "S1ap-E-RABToBeSetupItemCtxtSUReq.h" -#include "S1ap-E-RABToBeSetupListCtxtSUReq.h" -#include "S1ap-E-RABSetupItemBearerSURes.h" -#include "S1ap-E-RABSetupListBearerSURes.h" -#include "S1ap-E-RABSetupItemCtxtSURes.h" -#include "S1ap-E-RABSetupListCtxtSURes.h" -#include "S1ap-E-RABReleaseListBearerRelComp.h" -#include "S1ap-E-RABModifyItemBearerModRes.h" -#include "S1ap-E-RABModifyListBearerModRes.h" -#include "S1ap-E-RABFailedToSetupItemHOReqAck.h" -#include "S1ap-E-RABFailedToSetupListHOReqAck.h" -#include "S1ap-E-RABToBeModifiedItemBearerModReq.h" -#include "S1ap-E-RABToBeModifiedListBearerModReq.h" -#include "S1ap-UE-associatedLogicalS1-ConnectionListResAck.h" -#include "S1ap-IE.h" -#include "S1AP-PDU.h" - -#if defined (UPDATE_RELEASE_9) -# include "S1ap-BroadcastCancelledAreaList.h" -# include "S1ap-CancelledCellinEAI.h" -# include "S1ap-CancelledCellinEAI-Item.h" -# include "S1ap-CancelledCellinTAI.h" -# include "S1ap-CancelledCellinTAI-Item.h" -# include "S1ap-CellAccessMode.h" -# include "S1ap-CellID-Cancelled.h" -# include "S1ap-CellID-Cancelled-Item.h" -# include "S1ap-ConcurrentWarningMessageIndicator.h" -# include "S1ap-CSGMembershipStatus.h" -# include "S1ap-Data-Forwarding-Not-Possible.h" -# include "S1ap-EmergencyAreaID-Cancelled.h" -# include "S1ap-EmergencyAreaID-Cancelled-Item.h" -# include "S1ap-E-RABList.h" -# include "S1ap-EUTRANRoundTripDelayEstimationInfo.h" -# include "S1ap-ExtendedRepetitionPeriod.h" -# include "S1ap-LPPa-PDU.h" -# include "S1ap-PS-ServiceNotAvailable.h" -# include "S1ap-Routing-ID.h" -# include "S1ap-StratumLevel.h" -# include "S1ap-SynchronizationStatus.h" -# include "S1ap-TimeSynchronizationInfo.h" -# include "S1ap-TAI-Cancelled.h" -# include "S1ap-TAI-Cancelled-Item.h" -# include "S1ap-KillRequest.h" -# include "S1ap-KillResponse.h" -# include "S1ap-DownlinkUEAssociatedLPPaTransport.h" -# include "S1ap-UplinkUEAssociatedLPPaTransport.h" -# include "S1ap-DownlinkNonUEAssociatedLPPaTransport.h" -# include "S1ap-UplinkNonUEAssociatedLPPaTransport.h" -#endif /* (UPDATE_RELEASE_9) */ - -#if defined(UPDATE_RELEASE_10) -# include "S1ap-PagingPriority.h" -# include "S1ap-RelayNode-Indicator.h" -# include "S1ap-GWContextReleaseIndication.h" -# include "S1ap-MMERelaySupportIndicator.h" -# include "S1ap-ManagementBasedMDTAllowed.h" -# include "S1ap-PrivacyIndicator.h" -# include "S1ap-TrafficLoadReductionIndication.h" -# include "S1ap-GUMMEIList.h" -#endif /* (UPDATE_RELEASE_10) */ +#include "S1AP_ProtocolIE-Field.h" +#include "S1AP_S1AP-PDU.h" +#include "S1AP_InitiatingMessage.h" +#include "S1AP_SuccessfulOutcome.h" +#include "S1AP_UnsuccessfulOutcome.h" +#include "S1AP_ProtocolIE-Field.h" +#include "S1AP_ProtocolIE-FieldPair.h" +#include "S1AP_ProtocolIE-ContainerPair.h" +#include "S1AP_ProtocolExtensionField.h" +#include "S1AP_ProtocolExtensionContainer.h" +#include "S1AP_asn_constant.h" +#include "S1AP_SupportedTAs-Item.h" +#include "S1AP_ServedGUMMEIsItem.h" /* Checking version of ASN1C compiler */ #if (ASN1C_ENVIRONMENT_VERSION < ASN1C_MINIMUM_VERSION) @@ -411,84 +87,34 @@ extern int asn1_xer_print; # define S1AP_DEBUG(x, args...) do { fprintf(stdout, "[S1AP][D]"x, ##args); } while(0) #endif -//Forward declaration -struct s1ap_message_s; + +#define S1AP_FIND_PROTOCOLIE_BY_ID(IE_TYPE, ie, container, IE_ID, mandatory) \ + do {\ + IE_TYPE **ptr; \ + ie = NULL; \ + for (ptr = container->protocolIEs.list.array; \ + ptr < &container->protocolIEs.list.array[container->protocolIEs.list.count]; \ + ptr++) { \ + if((*ptr)->id == IE_ID) { \ + ie = *ptr; \ + break; \ + } \ + } \ + if (mandatory) DevAssert(ie != NULL); \ + } while(0) /** \brief Function callback prototype. **/ typedef int (*s1ap_message_decoded_callback)( - uint32_t assoc_id, - uint32_t stream, - struct s1ap_message_s *message_p + uint32_t assoc_id, + uint32_t stream, + S1AP_S1AP_PDU_t *pdu ); -/** \brief Encode a successfull outcome message - \param buffer pointer to buffer in which data will be encoded - \param length pointer to the length of buffer - \param procedureCode Procedure code for the message - \param criticality Criticality of the message - \param td ASN1C type descriptor of the sptr - \param sptr Deferenced pointer to the structure to encode - @returns size in bytes encded on success or 0 on failure - **/ -ssize_t s1ap_generate_successfull_outcome( - uint8_t **buffer, - uint32_t *length, - e_S1ap_ProcedureCode procedureCode, - S1ap_Criticality_t criticality, - asn_TYPE_descriptor_t *td, - void *sptr); - -/** \brief Encode an initiating message - \param buffer pointer to buffer in which data will be encoded - \param length pointer to the length of buffer - \param procedureCode Procedure code for the message - \param criticality Criticality of the message - \param td ASN1C type descriptor of the sptr - \param sptr Deferenced pointer to the structure to encode - @returns size in bytes encded on success or 0 on failure - **/ -ssize_t s1ap_generate_initiating_message( - uint8_t **buffer, - uint32_t *length, - e_S1ap_ProcedureCode procedureCode, - S1ap_Criticality_t criticality, - asn_TYPE_descriptor_t *td, - void *sptr); - -/** \brief Encode an unsuccessfull outcome message - \param buffer pointer to buffer in which data will be encoded - \param length pointer to the length of buffer - \param procedureCode Procedure code for the message - \param criticality Criticality of the message - \param td ASN1C type descriptor of the sptr - \param sptr Deferenced pointer to the structure to encode - @returns size in bytes encded on success or 0 on failure - **/ -ssize_t s1ap_generate_unsuccessfull_outcome( - uint8_t **buffer, - uint32_t *length, - e_S1ap_ProcedureCode procedureCode, - S1ap_Criticality_t criticality, - asn_TYPE_descriptor_t *td, - void *sptr); - -/** \brief Generate a new IE - \param id Protocol ie id of the IE - \param criticality Criticality of the IE - \param type ASN1 type descriptor of the IE value - \param sptr Structure to be encoded in the value field - @returns a pointer to the newly created IE structure or NULL in case of failure - **/ -S1ap_IE_t *s1ap_new_ie(S1ap_ProtocolIE_ID_t id, - S1ap_Criticality_t criticality, - asn_TYPE_descriptor_t *type, - void *sptr); - /** \brief Handle criticality \param criticality Criticality of the IE @returns void **/ -void s1ap_handle_criticality(S1ap_Criticality_t criticality); +void s1ap_handle_criticality(S1AP_Criticality_t criticality); #endif /* S1AP_COMMON_H_ */ diff --git a/openair3/S1AP/s1ap_eNB.c b/openair3/S1AP/s1ap_eNB.c index 8085c239c3..548603bee7 100644 --- a/openair3/S1AP/s1ap_eNB.c +++ b/openair3/S1AP/s1ap_eNB.c @@ -20,8 +20,8 @@ */ /*! \file s1ap_eNB.c - * \brief S1AP eNB task - * \author S. Roux and Navid Nikaein + * \brief S1AP eNB task + * \author S. Roux and Navid Nikaein * \date 2010 - 2015 * \email: navid.nikaein@eurecom.fr * \version 1.0 @@ -42,7 +42,6 @@ #include "s1ap_eNB_default_values.h" #include "s1ap_common.h" -#include "s1ap_ies_defs.h" #include "s1ap_eNB_defs.h" #include "s1ap_eNB.h" @@ -81,16 +80,12 @@ uint32_t s1ap_generate_eNB_id(void) char hostname[50]; int ret; uint32_t eNB_id; - /* Retrieve the host name */ ret = gethostname(hostname, sizeof(hostname)); DevAssert(ret == 0); - out = crypt(hostname, "eurecom"); DevAssert(out != NULL); - eNB_id = ((out[0] << 24) | (out[1] << 16) | (out[2] << 8) | out[3]); - return eNB_id; } @@ -104,46 +99,32 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, sctp_new_association_req_t *sctp_new_association_req_p = NULL; s1ap_eNB_mme_data_t *s1ap_mme_data_p = NULL; struct s1ap_eNB_mme_data_s *mme = NULL; - DevAssert(instance_p != NULL); DevAssert(mme_ip_address != NULL); - message_p = itti_alloc_new_message(TASK_S1AP, SCTP_NEW_ASSOCIATION_REQ); - sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req; - sctp_new_association_req_p->port = S1AP_PORT_NUMBER; sctp_new_association_req_p->ppid = S1AP_SCTP_PPID; - sctp_new_association_req_p->in_streams = in_streams; sctp_new_association_req_p->out_streams = out_streams; - memcpy(&sctp_new_association_req_p->remote_address, mme_ip_address, sizeof(*mme_ip_address)); - memcpy(&sctp_new_association_req_p->local_address, local_ip_addr, sizeof(*local_ip_addr)); - S1AP_INFO("[eNB %d] check the mme registration state\n",instance_p->instance); - mme = s1ap_eNB_get_MME_from_instance(instance_p); if ( mme == NULL ) { - /* Create new MME descriptor */ s1ap_mme_data_p = calloc(1, sizeof(*s1ap_mme_data_p)); DevAssert(s1ap_mme_data_p != NULL); - s1ap_mme_data_p->cnx_id = s1ap_eNB_fetch_add_global_cnx_id(); sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id; - s1ap_mme_data_p->assoc_id = -1; s1ap_mme_data_p->s1ap_eNB_instance = instance_p; - STAILQ_INIT(&s1ap_mme_data_p->served_gummei); - /* Insert the new descriptor in list of known MME * but not yet associated. */ @@ -154,27 +135,23 @@ static void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, } else if (mme->state == S1AP_ENB_STATE_WAITING) { instance_p->s1ap_mme_pending_nb ++; sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id; - S1AP_INFO("[eNB %d] MME already registered, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n", - instance_p->instance, - mme->state, mme->cnx_id, - instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb); - + instance_p->instance, + mme->state, mme->cnx_id, + instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb); /*s1ap_mme_data_p->cnx_id = mme->cnx_id; sctp_new_association_req_p->ulp_cnx_id = mme->cnx_id; - + s1ap_mme_data_p->assoc_id = -1; s1ap_mme_data_p->s1ap_eNB_instance = instance_p; - */ + */ } else { - S1AP_WARN("[eNB %d] MME already registered but not in the waiting state, retrive the data (state %d, cnx %d, mme_nb %d, mme_pending_nb %d)\n", - instance_p->instance, - mme->state, mme->cnx_id, - instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb); - + instance_p->instance, + mme->state, mme->cnx_id, + instance_p->s1ap_mme_nb, instance_p->s1ap_mme_pending_nb); } - + itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p); } @@ -183,14 +160,11 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t * { s1ap_eNB_instance_t *new_instance; uint8_t index; - DevAssert(s1ap_register_eNB != NULL); - /* Look if the provided instance already exists */ new_instance = s1ap_eNB_get_instance(instance); - - - if (new_instance != NULL) { + + if (new_instance != NULL) { /* Checks if it is a retry on the same eNB */ DevCheck(new_instance->eNB_id == s1ap_register_eNB->eNB_id, new_instance->eNB_id, s1ap_register_eNB->eNB_id, 0); DevCheck(new_instance->cell_type == s1ap_register_eNB->cell_type, new_instance->cell_type, s1ap_register_eNB->cell_type, 0); @@ -202,10 +176,8 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t * } else { new_instance = calloc(1, sizeof(s1ap_eNB_instance_t)); DevAssert(new_instance != NULL); - RB_INIT(&new_instance->s1ap_ue_head); RB_INIT(&new_instance->s1ap_mme_head); - /* Copy usefull parameters */ new_instance->instance = instance; new_instance->eNB_name = s1ap_register_eNB->eNB_name; @@ -216,14 +188,12 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t * new_instance->mnc = s1ap_register_eNB->mnc; new_instance->mnc_digit_length = s1ap_register_eNB->mnc_digit_length; new_instance->default_drx = s1ap_register_eNB->default_drx; - /* Add the new instance to the list of eNB (meaningfull in virtual mode) */ s1ap_eNB_insert_new_instance(new_instance); - S1AP_INFO("Registered new eNB[%d] and %s eNB id %u\n", - instance, - s1ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home", - s1ap_register_eNB->eNB_id); + instance, + s1ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home", + s1ap_register_eNB->eNB_id); } DevCheck(s1ap_register_eNB->nb_mme <= S1AP_MAX_NB_MME_IP_ADDRESS, @@ -232,7 +202,7 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t * /* Trying to connect to provided list of MME ip address */ for (index = 0; index < s1ap_register_eNB->nb_mme; index++) { s1ap_eNB_register_mme(new_instance, - &s1ap_register_eNB->mme_ip_address[index], + &s1ap_register_eNB->mme_ip_address[index], &s1ap_register_eNB->enb_ip_address, s1ap_register_eNB->sctp_in_streams, s1ap_register_eNB->sctp_out_streams); @@ -243,12 +213,9 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa { s1ap_eNB_instance_t *instance_p; s1ap_eNB_mme_data_t *s1ap_mme_data_p; - DevAssert(sctp_new_association_resp != NULL); - instance_p = s1ap_eNB_get_instance(instance); DevAssert(instance_p != NULL); - s1ap_mme_data_p = s1ap_eNB_get_MME(instance_p, -1, sctp_new_association_resp->ulp_cnx_id); DevAssert(s1ap_mme_data_p != NULL); @@ -258,9 +225,7 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa sctp_new_association_resp->sctp_state, instance, sctp_new_association_resp->ulp_cnx_id); - s1ap_handle_s1_setup_message(s1ap_mme_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); - return; } @@ -268,7 +233,6 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa s1ap_mme_data_p->assoc_id = sctp_new_association_resp->assoc_id; s1ap_mme_data_p->in_streams = sctp_new_association_resp->in_streams; s1ap_mme_data_p->out_streams = sctp_new_association_resp->out_streams; - /* Prepare new S1 Setup Request */ s1ap_eNB_generate_s1_setup_request(instance_p, s1ap_mme_data_p); } @@ -277,11 +241,10 @@ static void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) { int result; - DevAssert(sctp_data_ind != NULL); #if defined(TEST_S1C_MME) mme_test_s1_notify_sctp_data_ind(sctp_data_ind->assoc_id, sctp_data_ind->stream, - sctp_data_ind->buffer, sctp_data_ind->buffer_length); + sctp_data_ind->buffer, sctp_data_ind->buffer_length); #else s1ap_eNB_handle_message(sctp_data_ind->assoc_id, sctp_data_ind->stream, sctp_data_ind->buffer, sctp_data_ind->buffer_length); @@ -294,11 +257,8 @@ void *s1ap_eNB_task(void *arg) { MessageDef *received_msg = NULL; int result; - S1AP_DEBUG("Starting S1AP layer\n"); - s1ap_eNB_prepare_internal_data(); - itti_mark_task_ready(TASK_S1AP); MSC_START_USE(); @@ -306,116 +266,112 @@ void *s1ap_eNB_task(void *arg) itti_receive_msg(TASK_S1AP, &received_msg); switch (ITTI_MSG_ID(received_msg)) { - case TERMINATE_MESSAGE: - S1AP_WARN(" *** Exiting S1AP thread\n"); - itti_exit_task(); + case TERMINATE_MESSAGE: + S1AP_WARN(" *** Exiting S1AP thread\n"); + itti_exit_task(); + break; + + case S1AP_REGISTER_ENB_REQ: { + /* Register a new eNB. + * in Virtual mode eNBs will be distinguished using the mod_id/ + * Each eNB has to send an S1AP_REGISTER_ENB message with its + * own parameters. + */ + s1ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &S1AP_REGISTER_ENB_REQ(received_msg)); + } break; - case S1AP_REGISTER_ENB_REQ: { - /* Register a new eNB. - * in Virtual mode eNBs will be distinguished using the mod_id/ - * Each eNB has to send an S1AP_REGISTER_ENB message with its - * own parameters. - */ - s1ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &S1AP_REGISTER_ENB_REQ(received_msg)); - } - break; + case SCTP_NEW_ASSOCIATION_RESP: { + s1ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &received_msg->ittiMsg.sctp_new_association_resp); + } + break; - case SCTP_NEW_ASSOCIATION_RESP: { - s1ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &received_msg->ittiMsg.sctp_new_association_resp); - } - break; + case SCTP_DATA_IND: { + s1ap_eNB_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); + } + break; - case SCTP_DATA_IND: { - s1ap_eNB_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); - } - break; + case S1AP_NAS_FIRST_REQ: { + s1ap_eNB_handle_nas_first_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &S1AP_NAS_FIRST_REQ(received_msg)); + } + break; - case S1AP_NAS_FIRST_REQ: { - s1ap_eNB_handle_nas_first_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &S1AP_NAS_FIRST_REQ(received_msg)); - } - break; + case S1AP_UPLINK_NAS: { + s1ap_eNB_nas_uplink(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &S1AP_UPLINK_NAS(received_msg)); + } + break; - case S1AP_UPLINK_NAS: { - s1ap_eNB_nas_uplink(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &S1AP_UPLINK_NAS(received_msg)); - } - break; + case S1AP_UE_CAPABILITIES_IND: { + s1ap_eNB_ue_capabilities(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &S1AP_UE_CAPABILITIES_IND(received_msg)); + } + break; - case S1AP_UE_CAPABILITIES_IND: { - s1ap_eNB_ue_capabilities(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &S1AP_UE_CAPABILITIES_IND(received_msg)); - } - break; + case S1AP_INITIAL_CONTEXT_SETUP_RESP: { + s1ap_eNB_initial_ctxt_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &S1AP_INITIAL_CONTEXT_SETUP_RESP(received_msg)); + } + break; - case S1AP_INITIAL_CONTEXT_SETUP_RESP: { - s1ap_eNB_initial_ctxt_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &S1AP_INITIAL_CONTEXT_SETUP_RESP(received_msg)); - } - break; + case S1AP_E_RAB_SETUP_RESP: { + s1ap_eNB_e_rab_setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &S1AP_E_RAB_SETUP_RESP(received_msg)); + } + break; - case S1AP_E_RAB_SETUP_RESP: { - s1ap_eNB_e_rab_setup_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &S1AP_E_RAB_SETUP_RESP(received_msg)); - } - break; + case S1AP_E_RAB_MODIFY_RESP: { + s1ap_eNB_e_rab_modify_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &S1AP_E_RAB_MODIFY_RESP(received_msg)); + } + break; - case S1AP_E_RAB_MODIFY_RESP: { - s1ap_eNB_e_rab_modify_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &S1AP_E_RAB_MODIFY_RESP(received_msg)); - } - break; - - case S1AP_NAS_NON_DELIVERY_IND: { - s1ap_eNB_nas_non_delivery_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &S1AP_NAS_NON_DELIVERY_IND(received_msg)); - } - break; + case S1AP_NAS_NON_DELIVERY_IND: { + s1ap_eNB_nas_non_delivery_ind(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &S1AP_NAS_NON_DELIVERY_IND(received_msg)); + } + break; - case S1AP_UE_CONTEXT_RELEASE_COMPLETE: { - s1ap_ue_context_release_complete(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &S1AP_UE_CONTEXT_RELEASE_COMPLETE(received_msg)); - } - break; + case S1AP_UE_CONTEXT_RELEASE_COMPLETE: { + s1ap_ue_context_release_complete(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &S1AP_UE_CONTEXT_RELEASE_COMPLETE(received_msg)); + } + break; - case S1AP_UE_CONTEXT_RELEASE_REQ: { - s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; // test - struct s1ap_eNB_ue_context_s *ue_context_p = NULL; // test + case S1AP_UE_CONTEXT_RELEASE_REQ: { + s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; // test + struct s1ap_eNB_ue_context_s *ue_context_p = NULL; // test + s1ap_ue_context_release_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &S1AP_UE_CONTEXT_RELEASE_REQ(received_msg)); + s1ap_eNB_instance_p = s1ap_eNB_get_instance(ITTI_MESSAGE_GET_INSTANCE(received_msg)); // test + DevAssert(s1ap_eNB_instance_p != NULL); // test - s1ap_ue_context_release_req(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &S1AP_UE_CONTEXT_RELEASE_REQ(received_msg)); + if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p, + S1AP_UE_CONTEXT_RELEASE_REQ(received_msg).eNB_ue_s1ap_id)) == NULL) { // test + /* The context for this eNB ue s1ap id doesn't exist in the map of eNB UEs */ + S1AP_ERROR("Failed to find ue context associated with eNB ue s1ap id: %u\n", + S1AP_UE_CONTEXT_RELEASE_REQ(received_msg).eNB_ue_s1ap_id); // test + } // test + } + break; - - s1ap_eNB_instance_p = s1ap_eNB_get_instance(ITTI_MESSAGE_GET_INSTANCE(received_msg)); // test - DevAssert(s1ap_eNB_instance_p != NULL); // test - - if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p, - S1AP_UE_CONTEXT_RELEASE_REQ(received_msg).eNB_ue_s1ap_id)) == NULL) { // test - /* The context for this eNB ue s1ap id doesn't exist in the map of eNB UEs */ - S1AP_ERROR("Failed to find ue context associated with eNB ue s1ap id: %u\n", - S1AP_UE_CONTEXT_RELEASE_REQ(received_msg).eNB_ue_s1ap_id); // test - } // test - } - break; - - case S1AP_E_RAB_RELEASE_RESPONSE: { + case S1AP_E_RAB_RELEASE_RESPONSE: { s1ap_eNB_e_rab_release_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), &S1AP_E_RAB_RELEASE_RESPONSE(received_msg)); - } - break; - - default: - S1AP_ERROR("Received unhandled message: %d:%s\n", - ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); + } break; + + default: + S1AP_ERROR("Received unhandled message: %d:%s\n", + ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); + break; } result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg); AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - received_msg = NULL; } @@ -425,62 +381,102 @@ void *s1ap_eNB_task(void *arg) static int s1ap_eNB_generate_s1_setup_request( s1ap_eNB_instance_t *instance_p, s1ap_eNB_mme_data_t *s1ap_mme_data_p) { - s1ap_message message; - - S1ap_S1SetupRequestIEs_t *s1SetupRequest_p; - S1ap_PLMNidentity_t plmnIdentity; - S1ap_SupportedTAs_Item_t ta; - + S1AP_S1AP_PDU_t pdu; + S1AP_S1SetupRequest_t *out; + S1AP_S1SetupRequestIEs_t *ie; + S1AP_SupportedTAs_Item_t *ta; + S1AP_PLMNidentity_t *plmn; uint8_t *buffer; uint32_t len; int ret = 0; - - DevAssert(instance_p != NULL); - DevAssert(s1ap_mme_data_p != NULL); - - memset(&message, 0, sizeof(s1ap_message)); - - message.direction = S1AP_PDU_PR_initiatingMessage; - message.procedureCode = S1ap_ProcedureCode_id_S1Setup; - message.criticality = S1ap_Criticality_reject; - - s1SetupRequest_p = &message.msg.s1ap_S1SetupRequestIEs; - memset((void *)&plmnIdentity, 0, sizeof(S1ap_PLMNidentity_t)); - - memset((void *)&ta, 0, sizeof(S1ap_SupportedTAs_Item_t)); - s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING; - - s1SetupRequest_p->global_ENB_ID.eNB_ID.present = S1ap_ENB_ID_PR_macroENB_ID; - MACRO_ENB_ID_TO_BIT_STRING(instance_p->eNB_id, - &s1SetupRequest_p->global_ENB_ID.eNB_ID.choice.macroENB_ID); + /* Prepare the S1AP message to encode */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_S1Setup; + pdu.choice.initiatingMessage.criticality = S1AP_Criticality_reject; + pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_S1SetupRequest; + out = &pdu.choice.initiatingMessage.value.choice.S1SetupRequest; + ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_Global_ENB_ID; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_S1SetupRequestIEs__value_PR_Global_ENB_ID; MCC_MNC_TO_PLMNID(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length, - &s1SetupRequest_p->global_ENB_ID.pLMNidentity); + &ie->value.choice.Global_ENB_ID.pLMNidentity); + ie->value.choice.Global_ENB_ID.eNB_ID.present = S1AP_ENB_ID_PR_macroENB_ID; + MACRO_ENB_ID_TO_BIT_STRING(instance_p->eNB_id, + &ie->value.choice.Global_ENB_ID.eNB_ID.choice.macroENB_ID); + S1AP_INFO("%d -> %02x%02x%02x\n", instance_p->eNB_id, + ie->value.choice.Global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[0], + ie->value.choice.Global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[1], + ie->value.choice.Global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[2]); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - S1AP_INFO("%d -> %02x%02x%02x\n", instance_p->eNB_id, s1SetupRequest_p->global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[0], s1SetupRequest_p->global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[1], - s1SetupRequest_p->global_ENB_ID.eNB_ID.choice.macroENB_ID.buf[2]); - - INT16_TO_OCTET_STRING(instance_p->tac, &ta.tAC); - MCC_MNC_TO_TBCD(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length, &plmnIdentity); - - ASN_SEQUENCE_ADD(&ta.broadcastPLMNs.list, &plmnIdentity); - ASN_SEQUENCE_ADD(&s1SetupRequest_p->supportedTAs.list, &ta); - - s1SetupRequest_p->defaultPagingDRX = instance_p->default_drx; - - if (instance_p->eNB_name != NULL) { - s1SetupRequest_p->presenceMask |= S1AP_S1SETUPREQUESTIES_ENBNAME_PRESENT; - OCTET_STRING_fromBuf(&s1SetupRequest_p->eNBname, instance_p->eNB_name, + /* optional */ + if (instance_p->eNB_name) { + ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_eNBname; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_S1SetupRequestIEs__value_PR_ENBname; + OCTET_STRING_fromBuf(&ie->value.choice.ENBname, instance_p->eNB_name, strlen(instance_p->eNB_name)); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } - if (s1ap_eNB_encode_pdu(&message, &buffer, &len) < 0) { + ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_SupportedTAs; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_S1SetupRequestIEs__value_PR_SupportedTAs; + ta = (S1AP_SupportedTAs_Item_t *)calloc(1, sizeof(S1AP_SupportedTAs_Item_t)); + INT16_TO_OCTET_STRING(instance_p->tac, &ta->tAC); + plmn = (S1AP_PLMNidentity_t *)calloc(1, sizeof(S1AP_PLMNidentity_t)); + MCC_MNC_TO_TBCD(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length, plmn); + ASN_SEQUENCE_ADD(&ta->broadcastPLMNs.list, plmn); + ASN_SEQUENCE_ADD(&ie->value.choice.SupportedTAs.list, ta); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_DefaultPagingDRX; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_S1SetupRequestIEs__value_PR_PagingDRX; + ie->value.choice.PagingDRX = instance_p->default_drx; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + if (0) { + ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_CSG_IdList; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_S1SetupRequestIEs__value_PR_CSG_IdList; + // ie->value.choice.CSG_IdList = ; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + if (0) { + ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_UE_RetentionInformation ; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_S1SetupRequestIEs__value_PR_UE_RetentionInformation; + // ie->value.choice.UE_RetentionInformation = ; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + if (0) { + ie = (S1AP_S1SetupRequestIEs_t *)calloc(1, sizeof(S1AP_S1SetupRequestIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_NB_IoT_DefaultPagingDRX; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_S1SetupRequestIEs__value_PR_NB_IoT_DefaultPagingDRX; + // ie->value.choice.NB_IoT_DefaultPagingDRX = ; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + if (s1ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) { S1AP_ERROR("Failed to encode S1 setup request\n"); return -1; } /* Non UE-Associated signalling -> stream = 0 */ s1ap_eNB_itti_send_sctp_data_req(instance_p->instance, s1ap_mme_data_p->assoc_id, buffer, len, 0); - return ret; } diff --git a/openair3/S1AP/s1ap_eNB_context_management_procedures.c b/openair3/S1AP/s1ap_eNB_context_management_procedures.c index 49c5ed28ac..f10ccf58dd 100644 --- a/openair3/S1AP/s1ap_eNB_context_management_procedures.c +++ b/openair3/S1AP/s1ap_eNB_context_management_procedures.c @@ -20,8 +20,8 @@ */ /*! \file s1ap_eNB_context_management_procedures.c - * \brief S1AP context management procedures - * \author S. Roux and Navid Nikaein + * \brief S1AP context management procedures + * \author S. Roux and Navid Nikaein * \date 2010 - 2015 * \email: navid.nikaein@eurecom.fr * \version 1.0 @@ -41,7 +41,6 @@ #include "s1ap_eNB_itti_messaging.h" -#include "s1ap_ies_defs.h" #include "s1ap_eNB_encoder.h" #include "s1ap_eNB_nnsf.h" #include "s1ap_eNB_ue_context.h" @@ -54,27 +53,22 @@ int s1ap_ue_context_release_complete(instance_t instance, s1ap_ue_release_complete_t *ue_release_complete_p) { - s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; - struct s1ap_eNB_ue_context_s *ue_context_p = NULL; - - S1ap_UEContextReleaseCompleteIEs_t *ue_ctxt_release_complete_ies_p = NULL; - - s1ap_message message; - + s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; + struct s1ap_eNB_ue_context_s *ue_context_p = NULL; + S1AP_S1AP_PDU_t pdu; + S1AP_UEContextReleaseComplete_t *out; + S1AP_UEContextReleaseComplete_IEs_t *ie; uint8_t *buffer; uint32_t length; - int ret = -1; - /* Retrieve the S1AP eNB instance associated with Mod_id */ s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance); - DevAssert(ue_release_complete_p != NULL); DevAssert(s1ap_eNB_instance_p != NULL); /*RB_FOREACH(ue_context_p, s1ap_ue_map, &s1ap_eNB_instance_p->s1ap_ue_head) { - S1AP_WARN("in s1ap_ue_map: UE context eNB_ue_s1ap_id %u mme_ue_s1ap_id %u state %u\n", - ue_context_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id, - ue_context_p->ue_state); + S1AP_WARN("in s1ap_ue_map: UE context eNB_ue_s1ap_id %u mme_ue_s1ap_id %u state %u\n", + ue_context_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id, + ue_context_p->ue_state); }*/ if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p, ue_release_complete_p->eNB_ue_s1ap_id)) == NULL) { @@ -85,20 +79,62 @@ int s1ap_ue_context_release_complete(instance_t instance, } /* Prepare the S1AP message to encode */ - memset(&message, 0, sizeof(s1ap_message)); + memset(&pdu, 0, sizeof(pdu)); + pdu.present = S1AP_S1AP_PDU_PR_successfulOutcome; + pdu.choice.successfulOutcome.procedureCode = S1AP_ProcedureCode_id_UEContextRelease; + pdu.choice.successfulOutcome.criticality = S1AP_Criticality_reject; + pdu.choice.successfulOutcome.value.present = S1AP_SuccessfulOutcome__value_PR_UEContextReleaseComplete; + out = &pdu.choice.successfulOutcome.value.choice.UEContextReleaseComplete; + ie = (S1AP_UEContextReleaseComplete_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseComplete_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_UEContextReleaseComplete_IEs__value_PR_MME_UE_S1AP_ID; + ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + ie = (S1AP_UEContextReleaseComplete_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseComplete_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_UEContextReleaseComplete_IEs__value_PR_ENB_UE_S1AP_ID; + ie->value.choice.ENB_UE_S1AP_ID = ue_release_complete_p->eNB_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - message.direction = S1AP_PDU_PR_successfulOutcome; - message.procedureCode = S1ap_ProcedureCode_id_UEContextRelease; - //message.criticality = S1ap_Criticality_reject; + /* optional */ + if (0) { + ie = (S1AP_UEContextReleaseComplete_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseComplete_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_CriticalityDiagnostics; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_UEContextReleaseComplete_IEs__value_PR_CriticalityDiagnostics; + // ie->value.choice.CriticalityDiagnostics = ; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } - ue_ctxt_release_complete_ies_p = &message.msg.s1ap_UEContextReleaseCompleteIEs; + /* release 12 */ + if (0) { + ie = (S1AP_UEContextReleaseComplete_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseComplete_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_UserLocationInformation; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_UEContextReleaseComplete_IEs__value_PR_UserLocationInformation; + // ie->value.choice.UserLocationInformation = ; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } - ue_ctxt_release_complete_ies_p->eNB_UE_S1AP_ID = ue_release_complete_p->eNB_ue_s1ap_id; - ue_ctxt_release_complete_ies_p->mme_ue_s1ap_id = ue_context_p->mme_ue_s1ap_id; - //ue_ctxt_release_complete_ies_p->criticalityDiagnostics - //ue_ctxt_release_complete_ies_p->presenceMask + /* release 13 */ + if (0) { + ie = (S1AP_UEContextReleaseComplete_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseComplete_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_InformationOnRecommendedCellsAndENBsForPaging; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_UEContextReleaseComplete_IEs__value_PR_InformationOnRecommendedCellsAndENBsForPaging; + // ie->value.choice.InformationOnRecommendedCellsAndENBsForPaging = ; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + ie = (S1AP_UEContextReleaseComplete_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseComplete_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_CellIdentifierAndCELevelForCECapableUEs; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_UEContextReleaseComplete_IEs__value_PR_CellIdentifierAndCELevelForCECapableUEs; + // ie->value.choice.CellIdentifierAndCELevelForCECapableUEs = ; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } - if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) { + if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) { /* Encode procedure has failed... */ S1AP_ERROR("Failed to encode UE context release complete\n"); return -1; @@ -113,18 +149,12 @@ int s1ap_ue_context_release_complete(instance_t instance, 0,0, //MSC_AS_TIME_ARGS(ctxt_pP), ue_ctxt_release_complete_ies_p->eNB_UE_S1AP_ID, ue_ctxt_release_complete_ies_p->mme_ue_s1ap_id); - /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, length, ue_context_p->tx_stream); - - //LG s1ap_eNB_itti_send_sctp_close_association(s1ap_eNB_instance_p->instance, // ue_context_p->mme_ref->assoc_id); - - - // release UE context struct s1ap_eNB_ue_context_s *ue_context2_p = NULL; @@ -137,29 +167,28 @@ int s1ap_ue_context_release_complete(instance_t instance, S1AP_WARN("Removing UE context eNB_ue_s1ap_id %u: did not find context\n", ue_context_p->eNB_ue_s1ap_id); } - /*RB_FOREACH(ue_context_p, s1ap_ue_map, &s1ap_eNB_instance_p->s1ap_ue_head) { - S1AP_WARN("in s1ap_ue_map: UE context eNB_ue_s1ap_id %u mme_ue_s1ap_id %u state %u\n", - ue_context_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id, - ue_context_p->ue_state); - }*/ - return ret; + /*RB_FOREACH(ue_context_p, s1ap_ue_map, &s1ap_eNB_instance_p->s1ap_ue_head) { + S1AP_WARN("in s1ap_ue_map: UE context eNB_ue_s1ap_id %u mme_ue_s1ap_id %u state %u\n", + ue_context_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id, + ue_context_p->ue_state); + }*/ + return 0; } int s1ap_ue_context_release_req(instance_t instance, s1ap_ue_release_req_t *ue_release_req_p) { - s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; - struct s1ap_eNB_ue_context_s *ue_context_p = NULL; - S1ap_UEContextReleaseRequestIEs_t *ue_ctxt_release_request_ies_p = NULL; - s1ap_message message; - uint8_t *buffer = NULL; - uint32_t length; - + s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; + struct s1ap_eNB_ue_context_s *ue_context_p = NULL; + S1AP_S1AP_PDU_t pdu; + S1AP_UEContextReleaseRequest_t *out; + S1AP_UEContextReleaseRequest_IEs_t *ie; + uint8_t *buffer = NULL; + uint32_t length; /* Retrieve the S1AP eNB instance associated with Mod_id */ s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance); - DevAssert(ue_release_req_p != NULL); DevAssert(s1ap_eNB_instance_p != NULL); @@ -172,50 +201,74 @@ int s1ap_ue_context_release_req(instance_t instance, } /* Prepare the S1AP message to encode */ - memset(&message, 0, sizeof(s1ap_message)); - - message.direction = S1AP_PDU_PR_initiatingMessage; - message.procedureCode = S1ap_ProcedureCode_id_UEContextReleaseRequest; - //message.criticality = S1ap_Criticality_reject; - - ue_ctxt_release_request_ies_p = &message.msg.s1ap_UEContextReleaseRequestIEs; - - ue_ctxt_release_request_ies_p->eNB_UE_S1AP_ID = ue_release_req_p->eNB_ue_s1ap_id; - ue_ctxt_release_request_ies_p->mme_ue_s1ap_id = ue_context_p->mme_ue_s1ap_id; + memset(&pdu, 0, sizeof(pdu)); + pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_UEContextReleaseRequest; + pdu.choice.initiatingMessage.criticality = S1AP_Criticality_ignore; + pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_UEContextReleaseRequest; + out = &pdu.choice.initiatingMessage.value.choice.UEContextReleaseRequest; + ie = (S1AP_UEContextReleaseRequest_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseRequest_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_UEContextReleaseRequest_IEs__value_PR_MME_UE_S1AP_ID; + ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + ie = (S1AP_UEContextReleaseRequest_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseRequest_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_UEContextReleaseRequest_IEs__value_PR_ENB_UE_S1AP_ID; + ie->value.choice.ENB_UE_S1AP_ID = ue_release_req_p->eNB_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + ie = (S1AP_UEContextReleaseRequest_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseRequest_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_Cause; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_UEContextReleaseRequest_IEs__value_PR_Cause; switch (ue_release_req_p->cause) { - case S1AP_CAUSE_NOTHING: - ue_ctxt_release_request_ies_p->cause.present = S1ap_Cause_PR_NOTHING; - break; + case S1AP_Cause_PR_radioNetwork: + ie->value.choice.Cause.present = S1AP_Cause_PR_radioNetwork; + ie->value.choice.Cause.choice.radioNetwork = ue_release_req_p->cause_value; + break; - case S1AP_CAUSE_RADIO_NETWORK: - ue_ctxt_release_request_ies_p->cause.present = S1ap_Cause_PR_radioNetwork; - ue_ctxt_release_request_ies_p->cause.choice.radioNetwork = ue_release_req_p->cause_value; - break; + case S1AP_Cause_PR_transport: + ie->value.choice.Cause.present = S1AP_Cause_PR_transport; + ie->value.choice.Cause.choice.transport = ue_release_req_p->cause_value; + break; - case S1AP_CAUSE_TRANSPORT: - ue_ctxt_release_request_ies_p->cause.present = S1ap_Cause_PR_transport; - ue_ctxt_release_request_ies_p->cause.choice.transport = ue_release_req_p->cause_value; - break; + case S1AP_Cause_PR_nas: + ie->value.choice.Cause.present = S1AP_Cause_PR_nas; + ie->value.choice.Cause.choice.nas = ue_release_req_p->cause_value; + break; - case S1AP_CAUSE_NAS: - ue_ctxt_release_request_ies_p->cause.present = S1ap_Cause_PR_nas; - ue_ctxt_release_request_ies_p->cause.choice.nas = ue_release_req_p->cause_value; - break; + case S1AP_Cause_PR_protocol: + ie->value.choice.Cause.present = S1AP_Cause_PR_protocol; + ie->value.choice.Cause.choice.protocol = ue_release_req_p->cause_value; + break; - case S1AP_CAUSE_PROTOCOL: - ue_ctxt_release_request_ies_p->cause.present = S1ap_Cause_PR_protocol; - ue_ctxt_release_request_ies_p->cause.choice.protocol = ue_release_req_p->cause_value; - break; + case S1AP_Cause_PR_misc: + ie->value.choice.Cause.present = S1AP_Cause_PR_misc; + ie->value.choice.Cause.choice.misc = ue_release_req_p->cause_value; + break; - case S1AP_CAUSE_MISC: - default: - ue_ctxt_release_request_ies_p->cause.present = S1ap_Cause_PR_misc; - ue_ctxt_release_request_ies_p->cause.choice.misc = ue_release_req_p->cause_value; - break; + case S1AP_Cause_PR_NOTHING: + default: + ie->value.choice.Cause.present = S1AP_Cause_PR_NOTHING; + break; } - if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) { + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + if (0) { + ie = (S1AP_UEContextReleaseRequest_IEs_t *)calloc(1, sizeof(S1AP_UEContextReleaseRequest_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_GWContextReleaseIndication; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_UEContextReleaseRequest_IEs__value_PR_GWContextReleaseIndication; + ie->value.choice.GWContextReleaseIndication = TRUE; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) { /* Encode procedure has failed... */ S1AP_ERROR("Failed to encode UE context release complete\n"); return -1; @@ -230,12 +283,10 @@ int s1ap_ue_context_release_req(instance_t instance, 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), ue_ctxt_release_request_ies_p->eNB_UE_S1AP_ID, ue_ctxt_release_request_ies_p->mme_ue_s1ap_id); - /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, length, ue_context_p->tx_stream); - return 0; } diff --git a/openair3/S1AP/s1ap_eNB_decoder.c b/openair3/S1AP/s1ap_eNB_decoder.c index eac52c53ba..d3a2fad8f5 100644 --- a/openair3/S1AP/s1ap_eNB_decoder.c +++ b/openair3/S1AP/s1ap_eNB_decoder.c @@ -34,235 +34,172 @@ #include "intertask_interface.h" #include "s1ap_common.h" -#include "s1ap_ies_defs.h" #include "s1ap_eNB_decoder.h" -static int s1ap_eNB_decode_initiating_message(s1ap_message *message, - S1ap_InitiatingMessage_t *initiating_p) + +static int s1ap_eNB_decode_initiating_message(S1AP_S1AP_PDU_t *pdu) { - int ret = -1; MessageDef *message_p; - char *message_string = NULL; - size_t message_string_size; MessagesIds message_id; + asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} }; + DevAssert(pdu != NULL); - DevAssert(initiating_p != NULL); + switch(pdu->choice.initiatingMessage.procedureCode) { + case S1AP_ProcedureCode_id_downlinkNASTransport: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); + message_id = S1AP_DOWNLINK_NAS_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, + res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_downlink_nas_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_downlink_nas_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + break; - message_string = calloc(10000, sizeof(char)); + case S1AP_ProcedureCode_id_InitialContextSetup: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); + message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, + res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_initial_context_setup_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + break; - s1ap_string_total_size = 0; + case S1AP_ProcedureCode_id_UEContextRelease: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); + message_id = S1AP_UE_CONTEXT_RELEASE_COMMAND_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, + res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_ue_context_release_command_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_ue_context_release_command_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + break; - message->procedureCode = initiating_p->procedureCode; - message->criticality = initiating_p->criticality; + case S1AP_ProcedureCode_id_Paging: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); + message_id = S1AP_PAGING_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, + res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_paging_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_paging_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + S1AP_INFO("Paging initiating message\n"); + free(res.buffer); + break; - switch(initiating_p->procedureCode) { - case S1ap_ProcedureCode_id_downlinkNASTransport: - ret = s1ap_decode_s1ap_downlinknastransporties( - &message->msg.s1ap_DownlinkNASTransportIEs, - &initiating_p->value); - s1ap_xer_print_s1ap_downlinknastransport(s1ap_xer__print2sp, - message_string, - message); - message_id = S1AP_DOWNLINK_NAS_LOG; - message_string_size = strlen(message_string); - message_p = itti_alloc_new_message_sized(TASK_S1AP, - message_id, - message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.s1ap_downlink_nas_log.size = message_string_size; - memcpy(&message_p->ittiMsg.s1ap_downlink_nas_log.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - free(message_string); - break; + case S1AP_ProcedureCode_id_E_RABSetup: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); + message_id = S1AP_E_RAB_SETUP_REQUEST_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, + res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_e_rab_setup_request_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_e_rab_setup_request_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + S1AP_INFO("E_RABSetup initiating message\n"); + break; - case S1ap_ProcedureCode_id_InitialContextSetup: - ret = s1ap_decode_s1ap_initialcontextsetuprequesties( - &message->msg.s1ap_InitialContextSetupRequestIEs, &initiating_p->value); - s1ap_xer_print_s1ap_initialcontextsetuprequest(s1ap_xer__print2sp, message_string, message); - message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG; - message_string_size = strlen(message_string); - message_p = itti_alloc_new_message_sized(TASK_S1AP, - message_id, - message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.s1ap_initial_context_setup_log.size = message_string_size; - memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - free(message_string); - break; + case S1AP_ProcedureCode_id_E_RABModify: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); + message_id = S1AP_E_RAB_MODIFY_REQUEST_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, + res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_e_rab_modify_request_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_e_rab_modify_request_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + S1AP_INFO("E_RABModify initiating message\n"); + break; - case S1ap_ProcedureCode_id_UEContextRelease: - ret = s1ap_decode_s1ap_uecontextreleasecommandies( - &message->msg.s1ap_UEContextReleaseCommandIEs, &initiating_p->value); - s1ap_xer_print_s1ap_uecontextreleasecommand(s1ap_xer__print2sp, message_string, message); - message_id = S1AP_UE_CONTEXT_RELEASE_COMMAND_LOG; - message_string_size = strlen(message_string); - message_p = itti_alloc_new_message_sized(TASK_S1AP, - message_id, - message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.s1ap_ue_context_release_command_log.size = message_string_size; - memcpy(&message_p->ittiMsg.s1ap_ue_context_release_command_log.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - free(message_string); - break; + case S1AP_ProcedureCode_id_E_RABRelease: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); + message_id = S1AP_E_RAB_RELEASE_REQUEST_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, + res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_e_rab_release_request_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_e_rab_release_request_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + S1AP_INFO("TODO E_RABRelease nitiating message\n"); + break; - case S1ap_ProcedureCode_id_Paging: - ret = s1ap_decode_s1ap_pagingies( - &message->msg.s1ap_PagingIEs, &initiating_p->value); - s1ap_xer_print_s1ap_paging(s1ap_xer__print2sp, message_string, message); - message_id = S1AP_PAGING_LOG; - message_string_size = strlen(message_string); - message_p = itti_alloc_new_message_sized(TASK_S1AP, - message_id, - message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.s1ap_paging_log.size = message_string_size; - memcpy(&message_p->ittiMsg.s1ap_paging_log.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - S1AP_INFO("Paging initiating message\n"); - free(message_string); - break; - - - case S1ap_ProcedureCode_id_E_RABSetup: - ret = s1ap_decode_s1ap_e_rabsetuprequesties( - &message->msg.s1ap_E_RABSetupRequestIEs, &initiating_p->value); - //s1ap_xer_print_s1ap_e_rabsetuprequest(s1ap_xer__print2sp, message_string, message); - message_id = S1AP_E_RAB_SETUP_REQUEST_LOG; - message_string_size = strlen(message_string); - message_p = itti_alloc_new_message_sized(TASK_S1AP, - message_id, - message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.s1ap_e_rab_setup_request_log.size = message_string_size; - memcpy(&message_p->ittiMsg.s1ap_e_rab_setup_request_log.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - free(message_string); - S1AP_INFO("E_RABSetup initiating message\n"); - break; - - case S1ap_ProcedureCode_id_E_RABModify: - ret = s1ap_decode_s1ap_e_rabmodifyrequesties( - &message->msg.s1ap_E_RABModifyRequestIEs, &initiating_p->value); - message_id = S1AP_E_RAB_MODIFY_REQUEST_LOG; - message_string_size = strlen(message_string); - message_p = itti_alloc_new_message_sized(TASK_S1AP, - message_id, - message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.s1ap_e_rab_modify_request_log.size = message_string_size; - memcpy(&message_p->ittiMsg.s1ap_e_rab_modify_request_log.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - free(message_string); - S1AP_INFO("E_RABModify initiating message\n"); - break; - - case S1ap_ProcedureCode_id_E_RABRelease: - ret = s1ap_decode_s1ap_e_rabreleasecommandies( - &message->msg.s1ap_E_RABReleaseCommandIEs, &initiating_p->value); - s1ap_xer_print_s1ap_e_rabreleasecommand(s1ap_xer__print2sp, message_string, message); - message_id = S1AP_E_RAB_RELEASE_REQUEST_LOG; - message_string_size = strlen(message_string); - message_p = itti_alloc_new_message_sized(TASK_S1AP, - message_id, - message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.s1ap_e_rab_release_request_log.size = message_string_size; - memcpy(&message_p->ittiMsg.s1ap_e_rab_release_request_log.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - free(message_string); - S1AP_INFO("TODO E_RABRelease nitiating message\n"); - break; - - default: - S1AP_ERROR("Unknown procedure ID (%d) for initiating message\n", - (int)initiating_p->procedureCode); - AssertFatal( 0 , "Unknown procedure ID (%d) for initiating message\n", - (int)initiating_p->procedureCode); - return -1; + default: + S1AP_ERROR("Unknown procedure ID (%d) for initiating message\n", + (int)pdu->choice.initiatingMessage.procedureCode); + AssertFatal( 0, "Unknown procedure ID (%d) for initiating message\n", + (int)pdu->choice.initiatingMessage.procedureCode); + return -1; } - - return ret; + return 0; } -static int s1ap_eNB_decode_successful_outcome(s1ap_message *message, - S1ap_SuccessfulOutcome_t *successfullOutcome_p) +static int s1ap_eNB_decode_successful_outcome(S1AP_S1AP_PDU_t *pdu) { - int ret = -1; MessageDef *message_p; - char *message_string = NULL; - size_t message_string_size; MessagesIds message_id; + asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} }; + DevAssert(pdu != NULL); - DevAssert(successfullOutcome_p != NULL); + switch(pdu->choice.successfulOutcome.procedureCode) { + case S1AP_ProcedureCode_id_S1Setup: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); + message_id = S1AP_S1_SETUP_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_s1_setup_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + break; - message_string = malloc(sizeof(char) * 10000); - memset((void*)message_string,0,sizeof(char) * 10000); - - s1ap_string_total_size = 0; - - message->procedureCode = successfullOutcome_p->procedureCode; - message->criticality = successfullOutcome_p->criticality; - - switch(successfullOutcome_p->procedureCode) { - case S1ap_ProcedureCode_id_S1Setup: - ret = s1ap_decode_s1ap_s1setupresponseies( - &message->msg.s1ap_S1SetupResponseIEs, &successfullOutcome_p->value); - s1ap_xer_print_s1ap_s1setupresponse(s1ap_xer__print2sp, message_string, message); - message_id = S1AP_S1_SETUP_LOG; - break; - - default: - S1AP_ERROR("Unknown procedure ID (%d) for successfull outcome message\n", - (int)successfullOutcome_p->procedureCode); - return -1; + default: + S1AP_ERROR("Unknown procedure ID (%d) for successfull outcome message\n", + (int)pdu->choice.successfulOutcome.procedureCode); + return -1; } - message_string_size = strlen(message_string); - - message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.s1ap_s1_setup_log.size = message_string_size; - memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - - free(message_string); - - return ret; + return 0; } -static int s1ap_eNB_decode_unsuccessful_outcome(s1ap_message *message, - S1ap_UnsuccessfulOutcome_t *unSuccessfullOutcome_p) +static int s1ap_eNB_decode_unsuccessful_outcome(S1AP_S1AP_PDU_t *pdu) { - int ret = -1; - DevAssert(unSuccessfullOutcome_p != NULL); + MessageDef *message_p; + MessagesIds message_id; + asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} }; + DevAssert(pdu != NULL); - message->procedureCode = unSuccessfullOutcome_p->procedureCode; - message->criticality = unSuccessfullOutcome_p->criticality; + switch(pdu->choice.unsuccessfulOutcome.procedureCode) { + case S1AP_ProcedureCode_id_S1Setup: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); + message_id = S1AP_S1_SETUP_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_s1_setup_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + break; - switch(unSuccessfullOutcome_p->procedureCode) { - case S1ap_ProcedureCode_id_S1Setup: - return s1ap_decode_s1ap_s1setupfailureies( - &message->msg.s1ap_S1SetupFailureIEs, &unSuccessfullOutcome_p->value); - - default: - S1AP_ERROR("Unknown procedure ID (%d) for unsuccessfull outcome message\n", - (int)unSuccessfullOutcome_p->procedureCode); - break; + default: + S1AP_ERROR("Unknown procedure ID (%d) for unsuccessfull outcome message\n", + (int)pdu->choice.unsuccessfulOutcome.procedureCode); + return -1; } - return ret; + return 0; } -int s1ap_eNB_decode_pdu(s1ap_message *message, const uint8_t * const buffer, +int s1ap_eNB_decode_pdu(S1AP_S1AP_PDU_t *pdu, const uint8_t *const buffer, const uint32_t length) { - S1AP_PDU_t pdu; - S1AP_PDU_t *pdu_p = &pdu; asn_dec_rval_t dec_ret; - + DevAssert(pdu != NULL); DevAssert(buffer != NULL); - - memset((void *)pdu_p, 0, sizeof(S1AP_PDU_t)); - dec_ret = aper_decode(NULL, - &asn_DEF_S1AP_PDU, - (void **)&pdu_p, + &asn_DEF_S1AP_S1AP_PDU, + (void **)pdu, buffer, length, 0, @@ -273,24 +210,19 @@ int s1ap_eNB_decode_pdu(s1ap_message *message, const uint8_t * const buffer, return -1; } - message->direction = pdu_p->present; + switch(pdu->present) { + case S1AP_S1AP_PDU_PR_initiatingMessage: + return s1ap_eNB_decode_initiating_message(pdu); - switch(pdu_p->present) { - case S1AP_PDU_PR_initiatingMessage: - return s1ap_eNB_decode_initiating_message(message, - &pdu_p->choice.initiatingMessage); + case S1AP_S1AP_PDU_PR_successfulOutcome: + return s1ap_eNB_decode_successful_outcome(pdu); - case S1AP_PDU_PR_successfulOutcome: - return s1ap_eNB_decode_successful_outcome(message, - &pdu_p->choice.successfulOutcome); + case S1AP_S1AP_PDU_PR_unsuccessfulOutcome: + return s1ap_eNB_decode_unsuccessful_outcome(pdu); - case S1AP_PDU_PR_unsuccessfulOutcome: - return s1ap_eNB_decode_unsuccessful_outcome(message, - &pdu_p->choice.unsuccessfulOutcome); - - default: - S1AP_DEBUG("Unknown presence (%d) or not implemented\n", (int)pdu_p->present); - break; + default: + S1AP_DEBUG("Unknown presence (%d) or not implemented\n", (int)pdu->present); + break; } return -1; diff --git a/openair3/S1AP/s1ap_eNB_decoder.h b/openair3/S1AP/s1ap_eNB_decoder.h index f321f8227f..f8f58d8560 100644 --- a/openair3/S1AP/s1ap_eNB_decoder.h +++ b/openair3/S1AP/s1ap_eNB_decoder.h @@ -20,12 +20,12 @@ */ #include -#include "s1ap_ies_defs.h" + #ifndef S1AP_ENB_DECODER_H_ #define S1AP_ENB_DECODER_H_ -int s1ap_eNB_decode_pdu(s1ap_message *message, const uint8_t * const buffer, +int s1ap_eNB_decode_pdu(S1AP_S1AP_PDU_t *pdu, const uint8_t *const buffer, const uint32_t length) __attribute__ ((warn_unused_result)); #endif /* S1AP_ENB_DECODER_H_ */ diff --git a/openair3/S1AP/s1ap_eNB_encoder.c b/openair3/S1AP/s1ap_eNB_encoder.c index 7bd8bc09aa..bc0c69792d 100644 --- a/openair3/S1AP/s1ap_eNB_encoder.c +++ b/openair3/S1AP/s1ap_eNB_encoder.c @@ -32,615 +32,251 @@ #include #include "assertions.h" - #include "conversions.h" - #include "intertask_interface.h" - #include "s1ap_common.h" -#include "s1ap_ies_defs.h" #include "s1ap_eNB_encoder.h" -static inline int s1ap_eNB_encode_initiating(s1ap_message *message, +static inline int s1ap_eNB_encode_initiating(S1AP_S1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len); -static inline int s1ap_eNB_encode_successfull_outcome(s1ap_message *message, +static inline int s1ap_eNB_encode_successfull_outcome(S1AP_S1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len); -static inline int s1ap_eNB_encode_unsuccessfull_outcome(s1ap_message *message, +static inline int s1ap_eNB_encode_unsuccessfull_outcome(S1AP_S1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len); -static inline int s1ap_eNB_encode_s1_setup_request( - S1ap_S1SetupRequestIEs_t *s1SetupRequestIEs, uint8_t **buffer, uint32_t *length); - -static inline int s1ap_eNB_encode_trace_failure(S1ap_TraceFailureIndicationIEs_t - *trace_failure_ies_p, uint8_t **buffer, - uint32_t *length); - -static inline int s1ap_eNB_encode_initial_ue_message(S1ap_InitialUEMessageIEs_t - *initialUEmessageIEs_p, uint8_t **buffer, - uint32_t *length); - -static inline int s1ap_eNB_encode_uplink_nas_transport(S1ap_UplinkNASTransportIEs_t - *uplinkNASTransportIEs, - uint8_t **buffer, - uint32_t *length); - -static inline int s1ap_eNB_encode_ue_capability_info_indication( - S1ap_UECapabilityInfoIndicationIEs_t *ueCapabilityInfoIndicationIEs, - uint8_t **buffer, - uint32_t *length); - -static inline int s1ap_eNB_encode_initial_context_setup_response( - S1ap_InitialContextSetupResponseIEs_t *initialContextSetupResponseIEs, - uint8_t **buffer, - uint32_t *length); - -static inline -int s1ap_eNB_encode_nas_non_delivery( - S1ap_NASNonDeliveryIndication_IEs_t *nasNonDeliveryIndicationIEs, - uint8_t **buffer, - uint32_t *length); - -static inline -int s1ap_eNB_encode_ue_context_release_complete( - S1ap_UEContextReleaseCompleteIEs_t *s1ap_UEContextReleaseCompleteIEs, - uint8_t **buffer, - uint32_t *length); - -static inline -int s1ap_eNB_encode_ue_context_release_request( - S1ap_UEContextReleaseRequestIEs_t *s1ap_UEContextReleaseRequestIEs, - uint8_t **buffer, - uint32_t *length); - -static inline -int s1ap_eNB_encode_e_rab_setup_response(S1ap_E_RABSetupResponseIEs_t *E_RABSetupResponseIEs, - uint8_t **buffer, - uint32_t *length); - -static inline -int s1ap_eNB_encode_e_rab_modify_response(S1ap_E_RABModifyResponseIEs_t *E_RABModifyResponseIEs, - uint8_t **buffer, - uint32_t *length); - -static inline -int s1ap_eNB_encode_e_rab_release_response(S1ap_E_RABReleaseResponseIEs_t *s1ap_E_RABReleaseResponseIEs, - uint8_t **buffer, - uint32_t *length); - -int s1ap_eNB_encode_pdu(s1ap_message *message, uint8_t **buffer, uint32_t *len) +int s1ap_eNB_encode_pdu(S1AP_S1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len) { - DevAssert(message != NULL); + int ret = -1; + DevAssert(pdu != NULL); DevAssert(buffer != NULL); DevAssert(len != NULL); - switch(message->direction) { - case S1AP_PDU_PR_initiatingMessage: - return s1ap_eNB_encode_initiating(message, buffer, len); + switch(pdu->present) { + case S1AP_S1AP_PDU_PR_initiatingMessage: + ret = s1ap_eNB_encode_initiating(pdu, buffer, len); + break; - case S1AP_PDU_PR_successfulOutcome: - return s1ap_eNB_encode_successfull_outcome(message, buffer, len); + case S1AP_S1AP_PDU_PR_successfulOutcome: + ret = s1ap_eNB_encode_successfull_outcome(pdu, buffer, len); + break; - case S1AP_PDU_PR_unsuccessfulOutcome: - return s1ap_eNB_encode_unsuccessfull_outcome(message, buffer, len); + case S1AP_S1AP_PDU_PR_unsuccessfulOutcome: + ret = s1ap_eNB_encode_unsuccessfull_outcome(pdu, buffer, len); + break; - default: - S1AP_DEBUG("Unknown message outcome (%d) or not implemented", - (int)message->direction); - break; + default: + S1AP_DEBUG("Unknown message outcome (%d) or not implemented", + (int)pdu->present); + return -1; } - return -1; + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_S1AP_PDU, pdu); + return ret; } static inline -int s1ap_eNB_encode_initiating(s1ap_message *s1ap_message_p, +int s1ap_eNB_encode_initiating(S1AP_S1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len) { - int ret = -1; MessageDef *message_p; - char *message_string = NULL; - size_t message_string_size; MessagesIds message_id; + asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} }; + DevAssert(pdu != NULL); - DevAssert(s1ap_message_p != NULL); + switch(pdu->choice.initiatingMessage.procedureCode) { + case S1AP_ProcedureCode_id_S1Setup: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); + message_id = S1AP_S1_SETUP_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_s1_setup_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + break; - message_string = calloc(10000, sizeof(char)); + case S1AP_ProcedureCode_id_uplinkNASTransport: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); + message_id = S1AP_UPLINK_NAS_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_uplink_nas_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_uplink_nas_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + break; - s1ap_string_total_size = 0; + case S1AP_ProcedureCode_id_UECapabilityInfoIndication: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); + message_id = S1AP_UE_CAPABILITY_IND_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_ue_capability_ind_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_ue_capability_ind_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + break; - switch(s1ap_message_p->procedureCode) { - case S1ap_ProcedureCode_id_S1Setup: - ret = s1ap_eNB_encode_s1_setup_request( - &s1ap_message_p->msg.s1ap_S1SetupRequestIEs, buffer, len); - s1ap_xer_print_s1ap_s1setuprequest(s1ap_xer__print2sp, message_string, s1ap_message_p); - message_id = S1AP_S1_SETUP_LOG; - break; + case S1AP_ProcedureCode_id_initialUEMessage: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); + message_id = S1AP_INITIAL_UE_MESSAGE_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_initial_ue_message_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_initial_ue_message_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + break; - case S1ap_ProcedureCode_id_uplinkNASTransport: - ret = s1ap_eNB_encode_uplink_nas_transport( - &s1ap_message_p->msg.s1ap_UplinkNASTransportIEs, buffer, len); - s1ap_xer_print_s1ap_uplinknastransport(s1ap_xer__print2sp, message_string, s1ap_message_p); - message_id = S1AP_UPLINK_NAS_LOG; - break; + case S1AP_ProcedureCode_id_NASNonDeliveryIndication: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); + message_id = S1AP_NAS_NON_DELIVERY_IND_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_nas_non_delivery_ind_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_nas_non_delivery_ind_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + break; - case S1ap_ProcedureCode_id_UECapabilityInfoIndication: - ret = s1ap_eNB_encode_ue_capability_info_indication( - &s1ap_message_p->msg.s1ap_UECapabilityInfoIndicationIEs, buffer, len); - s1ap_xer_print_s1ap_uecapabilityinfoindication(s1ap_xer__print2sp, message_string, s1ap_message_p); - message_id = S1AP_UE_CAPABILITY_IND_LOG; - break; + case S1AP_ProcedureCode_id_UEContextReleaseRequest: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); + message_id = S1AP_UE_CONTEXT_RELEASE_REQ_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_ue_context_release_req_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_ue_context_release_req_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + break; - case S1ap_ProcedureCode_id_initialUEMessage: - ret = s1ap_eNB_encode_initial_ue_message( - &s1ap_message_p->msg.s1ap_InitialUEMessageIEs, buffer, len); - s1ap_xer_print_s1ap_initialuemessage(s1ap_xer__print2sp, message_string, s1ap_message_p); - message_id = S1AP_INITIAL_UE_MESSAGE_LOG; - break; - - case S1ap_ProcedureCode_id_NASNonDeliveryIndication: - ret = s1ap_eNB_encode_nas_non_delivery( - &s1ap_message_p->msg.s1ap_NASNonDeliveryIndication_IEs, buffer, len); - s1ap_xer_print_s1ap_nasnondeliveryindication_(s1ap_xer__print2sp, - message_string, s1ap_message_p); - message_id = S1AP_NAS_NON_DELIVERY_IND_LOG; - break; - - case S1ap_ProcedureCode_id_UEContextReleaseRequest: - ret = s1ap_eNB_encode_ue_context_release_request( - &s1ap_message_p->msg.s1ap_UEContextReleaseRequestIEs, buffer, len); - s1ap_xer_print_s1ap_uecontextreleaserequest(s1ap_xer__print2sp, - message_string, s1ap_message_p); - message_id = S1AP_UE_CONTEXT_RELEASE_REQ_LOG; - break; - - - default: - S1AP_DEBUG("Unknown procedure ID (%d) for initiating message\n", - (int)s1ap_message_p->procedureCode); - return ret; - break; + default: + S1AP_DEBUG("Unknown procedure ID (%d) for initiating message\n", + (int)pdu->choice.initiatingMessage.procedureCode); + return -1; } - message_string_size = strlen(message_string); + if (asn1_xer_print) { + xer_fprint(stdout, &asn_DEF_S1AP_S1AP_PDU, (void *)pdu); + } - message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.s1ap_s1_setup_log.size = message_string_size; - memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - - free(message_string); - - return ret; + memset(&res, 0, sizeof(res)); + res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_S1AP_S1AP_PDU, pdu); + *buffer = res.buffer; + *len = res.result.encoded; + return 0; } static inline -int s1ap_eNB_encode_successfull_outcome(s1ap_message *s1ap_message_p, +int s1ap_eNB_encode_successfull_outcome(S1AP_S1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len) { - int ret = -1; MessageDef *message_p; - char *message_string = NULL; - size_t message_string_size; MessagesIds message_id; + asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} }; + DevAssert(pdu != NULL); - DevAssert(s1ap_message_p != NULL); + switch(pdu->choice.successfulOutcome.procedureCode) { + case S1AP_ProcedureCode_id_InitialContextSetup: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); + message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_initial_context_setup_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + break; - message_string = calloc(10000, sizeof(char)); + case S1AP_ProcedureCode_id_UEContextRelease: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); + message_id = S1AP_UE_CONTEXT_RELEASE_COMPLETE_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_ue_context_release_complete_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_ue_context_release_complete_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + break; - s1ap_string_total_size = 0; - message_string_size = strlen(message_string); + case S1AP_ProcedureCode_id_E_RABSetup: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); + message_id = S1AP_E_RAB_SETUP_RESPONSE_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_e_rab_setup_response_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_e_rab_setup_response_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + S1AP_INFO("E_RABSetup successful message\n"); + break; + case S1AP_ProcedureCode_id_E_RABModify: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); + message_id = S1AP_E_RAB_MODIFY_RESPONSE_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_e_rab_modify_response_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_e_rab_modify_response_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + S1AP_INFO("E_RABModify successful message\n"); + break; - switch(s1ap_message_p->procedureCode) { - case S1ap_ProcedureCode_id_InitialContextSetup: - ret = s1ap_eNB_encode_initial_context_setup_response( - &s1ap_message_p->msg.s1ap_InitialContextSetupResponseIEs, buffer, len); + case S1AP_ProcedureCode_id_E_RABRelease: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); + message_id = S1AP_E_RAB_RELEASE_RESPONSE_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_e_rab_release_response_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_e_rab_release_response_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + S1AP_INFO("E_RAB Release successful message\n"); + break; - s1ap_xer_print_s1ap_initialcontextsetupresponse(s1ap_xer__print2sp, message_string, s1ap_message_p); - message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG; - message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.s1ap_initial_context_setup_log.size = message_string_size; - memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - free(message_string); - break; - - case S1ap_ProcedureCode_id_UEContextRelease: - ret = s1ap_eNB_encode_ue_context_release_complete( - &s1ap_message_p->msg.s1ap_UEContextReleaseCompleteIEs, buffer, len); - s1ap_xer_print_s1ap_uecontextreleasecomplete(s1ap_xer__print2sp, message_string, s1ap_message_p); - message_id = S1AP_UE_CONTEXT_RELEASE_COMPLETE_LOG; - message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.s1ap_ue_context_release_complete_log.size = message_string_size; - memcpy(&message_p->ittiMsg.s1ap_ue_context_release_complete_log.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - free(message_string); - break; - - case S1ap_ProcedureCode_id_E_RABSetup: - - ret = s1ap_eNB_encode_e_rab_setup_response ( - &s1ap_message_p->msg.s1ap_E_RABSetupResponseIEs, buffer, len); - //s1ap_xer_print_s1ap_e_rabsetupresponse (s1ap_xer__print2sp, message_string, s1ap_message_p); - message_id = S1AP_E_RAB_SETUP_RESPONSE_LOG ; - message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.s1ap_e_rab_setup_response_log.size = message_string_size; - memcpy(&message_p->ittiMsg.s1ap_e_rab_setup_response_log.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - free(message_string); - S1AP_INFO("E_RABSetup successful message\n"); - break; - - case S1ap_ProcedureCode_id_E_RABModify: - ret = s1ap_eNB_encode_e_rab_modify_response ( - &s1ap_message_p->msg.s1ap_E_RABModifyResponseIEs, buffer, len); - message_id = S1AP_E_RAB_MODIFY_RESPONSE_LOG ; - message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.s1ap_e_rab_modify_response_log.size = message_string_size; - memcpy(&message_p->ittiMsg.s1ap_e_rab_modify_response_log.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - free(message_string); - S1AP_INFO("E_RABModify successful message\n"); - break; - - case S1ap_ProcedureCode_id_E_RABRelease: - ret = s1ap_eNB_encode_e_rab_release_response ( - &s1ap_message_p->msg.s1ap_E_RABReleaseResponseIEs, buffer, len); - s1ap_xer_print_s1ap_e_rabreleaseresponse(s1ap_xer__print2sp, message_string, s1ap_message_p); - message_id = S1AP_E_RAB_RELEASE_RESPONSE_LOG ; - message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.s1ap_e_rab_release_response_log.size = message_string_size; - memcpy(&message_p->ittiMsg.s1ap_e_rab_release_response_log.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - free(message_string); - S1AP_INFO("E_RAB Release successful message\n"); - break; - - default: - S1AP_WARN("Unknown procedure ID (%d) for successfull outcome message\n", - (int)s1ap_message_p->procedureCode); - return ret; - break; + default: + S1AP_WARN("Unknown procedure ID (%d) for successfull outcome message\n", + (int)pdu->choice.successfulOutcome.procedureCode); + return -1; } + if (asn1_xer_print) { + xer_fprint(stdout, &asn_DEF_S1AP_S1AP_PDU, (void *)pdu); + } - return ret; + memset(&res, 0, sizeof(res)); + res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_S1AP_S1AP_PDU, pdu); + *buffer = res.buffer; + *len = res.result.encoded; + return 0; } static inline -int s1ap_eNB_encode_unsuccessfull_outcome(s1ap_message *s1ap_message_p, +int s1ap_eNB_encode_unsuccessfull_outcome(S1AP_S1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len) { - int ret = -1; MessageDef *message_p; - char *message_string = NULL; - size_t message_string_size; MessagesIds message_id; + asn_encode_to_new_buffer_result_t res = { NULL, {0, NULL, NULL} }; + DevAssert(pdu != NULL); - DevAssert(s1ap_message_p != NULL); + switch(pdu->choice.unsuccessfulOutcome.procedureCode) { + case S1AP_ProcedureCode_id_InitialContextSetup: + res = asn_encode_to_new_buffer(NULL, ATS_CANONICAL_XER, &asn_DEF_S1AP_S1AP_PDU, pdu); + message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG; + message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, res.result.encoded + sizeof (IttiMsgText)); + message_p->ittiMsg.s1ap_initial_context_setup_log.size = res.result.encoded; + memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, res.buffer, res.result.encoded); + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + free(res.buffer); + break; - message_string = calloc(10000, sizeof(char)); - - s1ap_string_total_size = 0; - - switch(s1ap_message_p->procedureCode) { - case S1ap_ProcedureCode_id_InitialContextSetup: - // ret = s1ap_encode_s1ap_initialcontextsetupfailureies( - // &s1ap_message_p->ittiMsg.s1ap_InitialContextSetupFailureIEs, buffer, len); - s1ap_xer_print_s1ap_initialcontextsetupfailure(s1ap_xer__print2sp, message_string, s1ap_message_p); - message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG; - break; - - default: - S1AP_DEBUG("Unknown procedure ID (%d) for unsuccessfull outcome message\n", - (int)s1ap_message_p->procedureCode); - return ret; - break; + default: + S1AP_DEBUG("Unknown procedure ID (%d) for unsuccessfull outcome message\n", + (int)pdu->choice.unsuccessfulOutcome.procedureCode); + return -1; } - message_string_size = strlen(message_string); - - message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText)); - message_p->ittiMsg.s1ap_initial_context_setup_log.size = message_string_size; - memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); - - free(message_string); - - return ret; -} - -static inline -int s1ap_eNB_encode_ue_capability_info_indication( - S1ap_UECapabilityInfoIndicationIEs_t *ueCapabilityInfoIndicationIEs, - uint8_t **buffer, - uint32_t *length) -{ - S1ap_UECapabilityInfoIndication_t ueCapabilityInfoIndication; - S1ap_UECapabilityInfoIndication_t *ueCapabilityInfoIndication_p = - &ueCapabilityInfoIndication; - - memset((void *)ueCapabilityInfoIndication_p, 0, sizeof(ueCapabilityInfoIndication)); - - if (s1ap_encode_s1ap_uecapabilityinfoindicationies( - ueCapabilityInfoIndication_p, ueCapabilityInfoIndicationIEs) < 0) { - return -1; + if (asn1_xer_print) { + xer_fprint(stdout, &asn_DEF_S1AP_S1AP_PDU, (void *)pdu); } - return s1ap_generate_initiating_message(buffer, - length, - S1ap_ProcedureCode_id_UECapabilityInfoIndication, - S1ap_Criticality_ignore, - &asn_DEF_S1ap_UECapabilityInfoIndication, - ueCapabilityInfoIndication_p); -} - -static inline -int s1ap_eNB_encode_uplink_nas_transport( - S1ap_UplinkNASTransportIEs_t *uplinkNASTransportIEs, - uint8_t **buffer, - uint32_t *length) -{ - S1ap_UplinkNASTransport_t uplinkNASTransport; - S1ap_UplinkNASTransport_t *uplinkNASTransport_p = &uplinkNASTransport; - - memset((void *)uplinkNASTransport_p, 0, sizeof(uplinkNASTransport)); - - if (s1ap_encode_s1ap_uplinknastransporties( - uplinkNASTransport_p, uplinkNASTransportIEs) < 0) { - return -1; - } - - return s1ap_generate_initiating_message(buffer, - length, - S1ap_ProcedureCode_id_uplinkNASTransport, - S1ap_Criticality_ignore, - &asn_DEF_S1ap_UplinkNASTransport, - uplinkNASTransport_p); -} - -static inline -int s1ap_eNB_encode_nas_non_delivery( - S1ap_NASNonDeliveryIndication_IEs_t *nasNonDeliveryIndicationIEs, - uint8_t **buffer, - uint32_t *length) -{ - S1ap_NASNonDeliveryIndication_t nasNonDeliveryIndication; - S1ap_NASNonDeliveryIndication_t *nasNonDeliveryIndication_p = &nasNonDeliveryIndication; - - memset((void *)nasNonDeliveryIndication_p, 0, sizeof(nasNonDeliveryIndication)); - - if (s1ap_encode_s1ap_nasnondeliveryindication_ies( - nasNonDeliveryIndication_p, nasNonDeliveryIndicationIEs) < 0) { - return -1; - } - - return s1ap_generate_initiating_message(buffer, - length, - S1ap_ProcedureCode_id_NASNonDeliveryIndication, - S1ap_Criticality_ignore, - &asn_DEF_S1ap_NASNonDeliveryIndication, - nasNonDeliveryIndication_p); -} - -static inline -int s1ap_eNB_encode_s1_setup_request( - S1ap_S1SetupRequestIEs_t *s1SetupRequestIEs, - uint8_t **buffer, - uint32_t *length) -{ - S1ap_S1SetupRequest_t s1SetupRequest; - S1ap_S1SetupRequest_t *s1SetupRequest_p = &s1SetupRequest; - - memset((void *)s1SetupRequest_p, 0, sizeof(s1SetupRequest)); - - if (s1ap_encode_s1ap_s1setuprequesties(s1SetupRequest_p, s1SetupRequestIEs) < 0) { - return -1; - } - - return s1ap_generate_initiating_message(buffer, - length, - S1ap_ProcedureCode_id_S1Setup, - S1ap_Criticality_reject, - &asn_DEF_S1ap_S1SetupRequest, - s1SetupRequest_p); -} - -static inline -int s1ap_eNB_encode_initial_ue_message( - S1ap_InitialUEMessageIEs_t *initialUEmessageIEs_p, - uint8_t **buffer, - uint32_t *length) -{ - S1ap_InitialUEMessage_t initialUEMessage; - S1ap_InitialUEMessage_t *initialUEMessage_p = &initialUEMessage; - - memset((void *)initialUEMessage_p, 0, sizeof(initialUEMessage)); - - if (s1ap_encode_s1ap_initialuemessageies( - initialUEMessage_p, initialUEmessageIEs_p) < 0) { - return -1; - } - - return s1ap_generate_initiating_message(buffer, - length, - S1ap_ProcedureCode_id_initialUEMessage, - S1ap_Criticality_ignore, - &asn_DEF_S1ap_InitialUEMessage, - initialUEMessage_p); -} - -static inline -int s1ap_eNB_encode_trace_failure( - S1ap_TraceFailureIndicationIEs_t *trace_failure_ies_p, - uint8_t **buffer, - uint32_t *length) -{ - S1ap_TraceFailureIndication_t trace_failure; - S1ap_TraceFailureIndication_t *trace_failure_p = &trace_failure; - - memset((void *)trace_failure_p, 0, sizeof(trace_failure)); - - if (s1ap_encode_s1ap_tracefailureindicationies( - trace_failure_p, trace_failure_ies_p) < 0) { - return -1; - } - - return s1ap_generate_initiating_message(buffer, - length, - S1ap_ProcedureCode_id_TraceFailureIndication, - S1ap_Criticality_reject, - &asn_DEF_S1ap_TraceFailureIndication, - trace_failure_p); -} - -static inline -int s1ap_eNB_encode_initial_context_setup_response( - S1ap_InitialContextSetupResponseIEs_t *initialContextSetupResponseIEs, - uint8_t **buffer, - uint32_t *length) -{ - S1ap_InitialContextSetupResponse_t initial_context_setup_response; - S1ap_InitialContextSetupResponse_t *initial_context_setup_response_p = - &initial_context_setup_response; - - memset((void *)initial_context_setup_response_p, 0, - sizeof(initial_context_setup_response)); - - if (s1ap_encode_s1ap_initialcontextsetupresponseies( - initial_context_setup_response_p, initialContextSetupResponseIEs) < 0) { - return -1; - } - - return s1ap_generate_successfull_outcome(buffer, - length, - S1ap_ProcedureCode_id_InitialContextSetup, - S1ap_Criticality_reject, - &asn_DEF_S1ap_InitialContextSetupResponse, - initial_context_setup_response_p); -} - -static inline -int s1ap_eNB_encode_ue_context_release_complete( - S1ap_UEContextReleaseCompleteIEs_t *s1ap_UEContextReleaseCompleteIEs, - uint8_t **buffer, - uint32_t *length) -{ - S1ap_UEContextReleaseComplete_t ue_context_release_complete; - S1ap_UEContextReleaseComplete_t *ue_context_release_complete_p = - &ue_context_release_complete; - - memset((void *)ue_context_release_complete_p, 0, - sizeof(ue_context_release_complete)); - - if (s1ap_encode_s1ap_uecontextreleasecompleteies( - ue_context_release_complete_p, s1ap_UEContextReleaseCompleteIEs) < 0) { - return -1; - } - - return s1ap_generate_successfull_outcome(buffer, - length, - S1ap_ProcedureCode_id_UEContextRelease, - S1ap_Criticality_reject, - &asn_DEF_S1ap_UEContextReleaseComplete, - ue_context_release_complete_p); -} - -static inline -int s1ap_eNB_encode_ue_context_release_request( - S1ap_UEContextReleaseRequestIEs_t *s1ap_UEContextReleaseRequestIEs, - uint8_t **buffer, - uint32_t *length) -{ - S1ap_UEContextReleaseRequest_t ue_context_release_request; - S1ap_UEContextReleaseRequest_t *ue_context_release_request_p = - &ue_context_release_request; - - memset((void *)ue_context_release_request_p, 0, - sizeof(ue_context_release_request)); - - if (s1ap_encode_s1ap_uecontextreleaserequesties( - ue_context_release_request_p, s1ap_UEContextReleaseRequestIEs) < 0) { - return -1; - } - - return s1ap_generate_initiating_message(buffer, - length, - S1ap_ProcedureCode_id_UEContextReleaseRequest, - S1ap_Criticality_reject, - &asn_DEF_S1ap_UEContextReleaseRequest, - ue_context_release_request_p); -} - -static inline -int s1ap_eNB_encode_e_rab_setup_response(S1ap_E_RABSetupResponseIEs_t *s1ap_E_RABSetupResponseIEs, - uint8_t **buffer, - uint32_t *length) -{ - S1ap_E_RABSetupResponse_t e_rab_setup_response; - S1ap_E_RABSetupResponse_t *e_rab_setup_response_p = &e_rab_setup_response; - - memset((void *)e_rab_setup_response_p, 0, - sizeof(e_rab_setup_response)); - - if (s1ap_encode_s1ap_e_rabsetupresponseies (e_rab_setup_response_p, s1ap_E_RABSetupResponseIEs) < 0) { - return -1; - } - - return s1ap_generate_successfull_outcome(buffer, - length, - S1ap_ProcedureCode_id_E_RABSetup, - S1ap_Criticality_reject, - &asn_DEF_S1ap_E_RABSetupResponse, - e_rab_setup_response_p); -} - -static inline -int s1ap_eNB_encode_e_rab_modify_response(S1ap_E_RABModifyResponseIEs_t *s1ap_E_RABModifyResponseIEs, - uint8_t **buffer, - uint32_t *length) -{ - S1ap_E_RABModifyResponse_t e_rab_modify_response; - S1ap_E_RABModifyResponse_t *e_rab_modify_response_p = &e_rab_modify_response; - - memset((void *)e_rab_modify_response_p, 0, - sizeof(e_rab_modify_response)); - - if (s1ap_encode_s1ap_e_rabmodifyresponseies (e_rab_modify_response_p, s1ap_E_RABModifyResponseIEs) < 0) { - return -1; - } - - return s1ap_generate_successfull_outcome(buffer, - length, - S1ap_ProcedureCode_id_E_RABModify, - S1ap_Criticality_reject, - &asn_DEF_S1ap_E_RABModifyResponse, - e_rab_modify_response_p); -} -static inline -int s1ap_eNB_encode_e_rab_release_response(S1ap_E_RABReleaseResponseIEs_t *s1ap_E_RABReleaseResponseIEs, - uint8_t **buffer, - uint32_t *length) -{ - S1ap_E_RABReleaseResponse_t e_rab_release_response; - S1ap_E_RABReleaseResponse_t *e_rab_release_response_p = &e_rab_release_response; - - memset((void *)e_rab_release_response_p, 0, - sizeof(e_rab_release_response)); - - if (s1ap_encode_s1ap_e_rabreleaseresponseies (e_rab_release_response_p, s1ap_E_RABReleaseResponseIEs) < 0) { - return -1; - } - - return s1ap_generate_successfull_outcome(buffer, - length, - S1ap_ProcedureCode_id_E_RABRelease, - S1ap_Criticality_reject, - &asn_DEF_S1ap_E_RABReleaseResponse, - e_rab_release_response_p); + memset(&res, 0, sizeof(res)); + res = asn_encode_to_new_buffer(NULL, ATS_ALIGNED_CANONICAL_PER, &asn_DEF_S1AP_S1AP_PDU, pdu); + *buffer = res.buffer; + *len = res.result.encoded; + return 0; } diff --git a/openair3/S1AP/s1ap_eNB_encoder.h b/openair3/S1AP/s1ap_eNB_encoder.h index 5b135a3f76..9ff5f032e7 100644 --- a/openair3/S1AP/s1ap_eNB_encoder.h +++ b/openair3/S1AP/s1ap_eNB_encoder.h @@ -22,7 +22,7 @@ #ifndef S1AP_ENB_ENCODER_H_ #define S1AP_ENB_ENCODER_H_ -int s1ap_eNB_encode_pdu(s1ap_message *message, uint8_t **buffer, uint32_t *len) +int s1ap_eNB_encode_pdu(S1AP_S1AP_PDU_t *pdu, uint8_t **buffer, uint32_t *len) __attribute__ ((warn_unused_result)); #endif /* S1AP_ENB_ENCODER_H_ */ diff --git a/openair3/S1AP/s1ap_eNB_handlers.c b/openair3/S1AP/s1ap_eNB_handlers.c index 0b02fc6db9..66277b1226 100644 --- a/openair3/S1AP/s1ap_eNB_handlers.c +++ b/openair3/S1AP/s1ap_eNB_handlers.c @@ -34,7 +34,6 @@ #include "asn1_conversions.h" #include "s1ap_common.h" -#include "s1ap_ies_defs.h" // #include "s1ap_eNB.h" #include "s1ap_eNB_defs.h" #include "s1ap_eNB_handlers.h" @@ -54,47 +53,47 @@ static int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, uint32_t stream, - struct s1ap_message_s *message_p); + S1AP_S1AP_PDU_t *pdu); static int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, uint32_t stream, - struct s1ap_message_s *message_p); + S1AP_S1AP_PDU_t *pdu); static int s1ap_eNB_handle_error_indication(uint32_t assoc_id, - uint32_t stream, - struct s1ap_message_s *message_p); + uint32_t stream, + S1AP_S1AP_PDU_t *pdu); static int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, uint32_t stream, - struct s1ap_message_s *message_p); + S1AP_S1AP_PDU_t *pdu); static int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, uint32_t stream, - struct s1ap_message_s *s1ap_message_p); + S1AP_S1AP_PDU_t *pdu); static int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, - uint32_t stream, - struct s1ap_message_s *s1ap_message_p); + uint32_t stream, + S1AP_S1AP_PDU_t *pdu); static int s1ap_eNB_handle_paging(uint32_t assoc_id, - uint32_t stream, - struct s1ap_message_s *message_p); + uint32_t stream, + S1AP_S1AP_PDU_t *pdu); static int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, uint32_t stream, - struct s1ap_message_s *s1ap_message_p); + S1AP_S1AP_PDU_t *pdu); static int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id, uint32_t stream, - struct s1ap_message_s *s1ap_message_p); + S1AP_S1AP_PDU_t *pdu); /* Handlers matrix. Only eNB related procedure present here */ s1ap_message_decoded_callback messages_callback[][3] = { @@ -174,7 +173,6 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shut /* If there are no more associated MME, inform eNB app */ if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb == 0) { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_DEREGISTERED_ENB_IND); S1AP_DEREGISTERED_ENB_IND(message_p).nb_mme = 0; itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p); @@ -193,7 +191,6 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shut /* If there are no more pending messages, inform eNB app */ if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb == 0) { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_REGISTER_ENB_CNF); S1AP_REGISTER_ENB_CNF(message_p).nb_mme = mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb; itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p); @@ -202,54 +199,56 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shut } int s1ap_eNB_handle_message(uint32_t assoc_id, int32_t stream, - const uint8_t * const data, const uint32_t data_length) + const uint8_t *const data, const uint32_t data_length) { - struct s1ap_message_s message; - + S1AP_S1AP_PDU_t pdu; + int ret = -1; DevAssert(data != NULL); + memset(&pdu, 0, sizeof(pdu)); - memset(&message, 0, sizeof(struct s1ap_message_s)); - - if (s1ap_eNB_decode_pdu(&message, data, data_length) < 0) { + if (s1ap_eNB_decode_pdu(&pdu, data, data_length) < 0) { S1AP_ERROR("Failed to decode PDU\n"); return -1; } /* Checking procedure Code and direction of message */ - if (message.procedureCode > sizeof(messages_callback) / (3 * sizeof( + if (pdu.choice.initiatingMessage.procedureCode > sizeof(messages_callback) / (3 * sizeof( s1ap_message_decoded_callback)) - || (message.direction > S1AP_PDU_PR_unsuccessfulOutcome)) { + || (pdu.present > S1AP_S1AP_PDU_PR_unsuccessfulOutcome)) { S1AP_ERROR("[SCTP %d] Either procedureCode %ld or direction %d exceed expected\n", - assoc_id, message.procedureCode, message.direction); + assoc_id, pdu.choice.initiatingMessage.procedureCode, pdu.present); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_S1AP_PDU, &pdu); return -1; } /* No handler present. * This can mean not implemented or no procedure for eNB (wrong direction). */ - if (messages_callback[message.procedureCode][message.direction-1] == NULL) { + if (messages_callback[pdu.choice.initiatingMessage.procedureCode][pdu.present - 1] == NULL) { S1AP_ERROR("[SCTP %d] No handler for procedureCode %ld in %s\n", - assoc_id, message.procedureCode, - s1ap_direction2String[message.direction]); + assoc_id, pdu.choice.initiatingMessage.procedureCode, + s1ap_direction2String[pdu.present - 1]); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_S1AP_PDU, &pdu); return -1; } /* Calling the right handler */ - return (*messages_callback[message.procedureCode][message.direction-1]) - (assoc_id, stream, &message); + ret = (*messages_callback[pdu.choice.initiatingMessage.procedureCode][pdu.present - 1]) + (assoc_id, stream, &pdu); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_S1AP_PDU, &pdu); + return ret; } static int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, uint32_t stream, - struct s1ap_message_s *message_p) + S1AP_S1AP_PDU_t *pdu) { - S1ap_S1SetupFailureIEs_t *s1_setup_failure_p; + S1AP_S1SetupFailure_t *container; + S1AP_S1SetupFailureIEs_t *ie; s1ap_eNB_mme_data_t *mme_desc_p; - - DevAssert(message_p != NULL); - - s1_setup_failure_p = &message_p->msg.s1ap_S1SetupFailureIEs; + DevAssert(pdu != NULL); + container = &pdu->choice.unsuccessfulOutcome.value.choice.S1SetupFailure; /* S1 Setup Failure == Non UE-related procedure -> stream 0 */ if (stream != 0) { @@ -263,8 +262,11 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, return -1; } - if ((s1_setup_failure_p->cause.present == S1ap_Cause_PR_misc) && - (s1_setup_failure_p->cause.choice.misc == S1ap_CauseMisc_unspecified)) { + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupFailureIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID, TRUE); + + if ((ie->value.choice.Cause.present == S1AP_Cause_PR_misc) && + (ie->value.choice.Cause.choice.misc == S1AP_CauseMisc_unspecified)) { S1AP_WARN("Received s1 setup failure for MME... MME is not ready\n"); } else { S1AP_ERROR("Received s1 setup failure for MME... please check your parameters\n"); @@ -272,22 +274,20 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, mme_desc_p->state = S1AP_ENB_STATE_WAITING; s1ap_handle_s1_setup_message(mme_desc_p, 0); - return 0; } static int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, uint32_t stream, - struct s1ap_message_s *message_p) + S1AP_S1AP_PDU_t *pdu) { - S1ap_S1SetupResponseIEs_t *s1SetupResponse_p; + S1AP_S1SetupResponse_t *container; + S1AP_S1SetupResponseIEs_t *ie; s1ap_eNB_mme_data_t *mme_desc_p; int i; - - DevAssert(message_p != NULL); - - s1SetupResponse_p = &message_p->msg.s1ap_S1SetupResponseIEs; + DevAssert(pdu != NULL); + container = &pdu->choice.successfulOutcome.value.choice.S1SetupResponse; /* S1 Setup Response == Non UE-related procedure -> stream 0 */ if (stream != 0) { @@ -302,32 +302,29 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, return -1; } + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_ServedGUMMEIs, TRUE); /* The list of served gummei can contain at most 8 elements. * LTE related gummei is the first element in the list, i.e with an id of 0. */ - S1AP_DEBUG("servedGUMMEIs.list.count %d\n",s1SetupResponse_p->servedGUMMEIs.list.count); - DevAssert(s1SetupResponse_p->servedGUMMEIs.list.count > 0); - DevAssert(s1SetupResponse_p->servedGUMMEIs.list.count <= 8); + S1AP_DEBUG("servedGUMMEIs.list.count %d\n", ie->value.choice.ServedGUMMEIs.list.count); + DevAssert(ie->value.choice.ServedGUMMEIs.list.count > 0); + DevAssert(ie->value.choice.ServedGUMMEIs.list.count <= S1AP_maxnoofRATs); - - for (i = 0; i < s1SetupResponse_p->servedGUMMEIs.list.count; i++) { - struct S1ap_ServedGUMMEIsItem *gummei_item_p; - struct served_gummei_s *new_gummei_p; + for (i = 0; i < ie->value.choice.ServedGUMMEIs.list.count; i++) { + S1AP_ServedGUMMEIsItem_t *gummei_item_p; + struct served_gummei_s *new_gummei_p; int j; - - gummei_item_p = (struct S1ap_ServedGUMMEIsItem *) - s1SetupResponse_p->servedGUMMEIs.list.array[i]; + gummei_item_p = ie->value.choice.ServedGUMMEIs.list.array[i]; new_gummei_p = calloc(1, sizeof(struct served_gummei_s)); - STAILQ_INIT(&new_gummei_p->served_plmns); STAILQ_INIT(&new_gummei_p->served_group_ids); STAILQ_INIT(&new_gummei_p->mme_codes); - - S1AP_DEBUG("servedPLMNs.list.count %d\n",gummei_item_p->servedPLMNs.list.count); + S1AP_DEBUG("servedPLMNs.list.count %d\n", gummei_item_p->servedPLMNs.list.count); + for (j = 0; j < gummei_item_p->servedPLMNs.list.count; j++) { - S1ap_PLMNidentity_t *plmn_identity_p; + S1AP_PLMNidentity_t *plmn_identity_p; struct plmn_identity_s *new_plmn_identity_p; - plmn_identity_p = gummei_item_p->servedPLMNs.list.array[j]; new_plmn_identity_p = calloc(1, sizeof(struct plmn_identity_s)); TBCD_TO_MCC_MNC(plmn_identity_p, new_plmn_identity_p->mcc, @@ -337,9 +334,8 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, } for (j = 0; j < gummei_item_p->servedGroupIDs.list.count; j++) { - S1ap_MME_Group_ID_t *mme_group_id_p; + S1AP_MME_Group_ID_t *mme_group_id_p; struct served_group_id_s *new_group_id_p; - mme_group_id_p = gummei_item_p->servedGroupIDs.list.array[j]; new_group_id_p = calloc(1, sizeof(struct served_group_id_s)); OCTET_STRING_TO_INT16(mme_group_id_p, new_group_id_p->mme_group_id); @@ -348,12 +344,10 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, } for (j = 0; j < gummei_item_p->servedMMECs.list.count; j++) { - S1ap_MME_Code_t *mme_code_p; + S1AP_MME_Code_t *mme_code_p; struct mme_code_s *new_mme_code_p; - mme_code_p = gummei_item_p->servedMMECs.list.array[j]; new_mme_code_p = calloc(1, sizeof(struct mme_code_s)); - OCTET_STRING_TO_INT8(mme_code_p, new_mme_code_p->mme_code); STAILQ_INSERT_TAIL(&new_gummei_p->mme_codes, new_mme_code_p, next); new_gummei_p->nb_mme_code++; @@ -362,19 +356,20 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, STAILQ_INSERT_TAIL(&mme_desc_p->served_gummei, new_gummei_p, next); } - /* Free contents of the list */ - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1ap_ServedGUMMEIs, - (void *)&s1SetupResponse_p->servedGUMMEIs); + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_RelativeMMECapacity, TRUE); /* Set the capacity of this MME */ - mme_desc_p->relative_mme_capacity = s1SetupResponse_p->relativeMMECapacity; + mme_desc_p->relative_mme_capacity = ie->value.choice.RelativeMMECapacity; + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_S1SetupResponseIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_MMEname, FALSE); /* Optionaly set the mme name */ - if (s1SetupResponse_p->presenceMask & S1AP_S1SETUPRESPONSEIES_MMENAME_PRESENT) { - mme_desc_p->mme_name = calloc(s1SetupResponse_p->mmEname.size + 1, sizeof(char)); - memcpy(mme_desc_p->mme_name, s1SetupResponse_p->mmEname.buf, - s1SetupResponse_p->mmEname.size); + if (ie) { + mme_desc_p->mme_name = calloc(ie->value.choice.MMEname.size + 1, sizeof(char)); + memcpy(mme_desc_p->mme_name, ie->value.choice.MMEname.buf, + ie->value.choice.MMEname.size); /* Convert the mme name to a printable string */ - mme_desc_p->mme_name[s1SetupResponse_p->mmEname.size] = '\0'; + mme_desc_p->mme_name[ie->value.choice.MMEname.size] = '\0'; } /* The association is now ready as eNB and MME know parameters of each other. @@ -383,25 +378,20 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, mme_desc_p->state = S1AP_ENB_STATE_CONNECTED; mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb ++; s1ap_handle_s1_setup_message(mme_desc_p, 0); - #if 0 /* We call back our self * -> generate a dummy initial UE message */ { s1ap_nas_first_req_t s1ap_nas_first_req; - memset(&s1ap_nas_first_req, 0, sizeof(s1ap_nas_first_req_t)); - s1ap_nas_first_req.rnti = 0xC03A; s1ap_nas_first_req.establishment_cause = RRC_CAUSE_MO_DATA; s1ap_nas_first_req.ue_identity.presenceMask = UE_IDENTITIES_gummei; - s1ap_nas_first_req.ue_identity.gummei.mcc = 208; s1ap_nas_first_req.ue_identity.gummei.mnc = 34; s1ap_nas_first_req.ue_identity.gummei.mme_code = 0; s1ap_nas_first_req.ue_identity.gummei.mme_group_id = 0; - /* NAS Attach request with IMSI */ static uint8_t nas_attach_req_imsi[] = { 0x07, 0x41, @@ -415,7 +405,6 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x0A, 0x00, 0x52, 0x12, 0xF2, 0x01, 0x27, 0x11, }; - /* NAS Attach request with GUTI */ static uint8_t nas_attach_req_guti[] = { 0x07, 0x41, @@ -429,30 +418,26 @@ int s1ap_eNB_handle_s1_setup_response(uint32_t assoc_id, 0x00, 0x00, 0x00, 0x0D, 0x00, 0x00, 0x0A, 0x00, 0x52, 0x12, 0xF2, 0x01, 0x27, 0x11, }; - s1ap_nas_first_req.nas_pdu.buffer = nas_attach_req_guti; s1ap_nas_first_req.nas_pdu.length = sizeof(nas_attach_req_guti); - s1ap_eNB_handle_nas_first_req(mme_desc_p->s1ap_eNB_instance->instance, &s1ap_nas_first_req); } #endif - return 0; } static -int s1ap_eNB_handle_error_indication(uint32_t assoc_id, - uint32_t stream, - struct s1ap_message_s *message_p) +int s1ap_eNB_handle_error_indication(uint32_t assoc_id, + uint32_t stream, + S1AP_S1AP_PDU_t *pdu) { - S1ap_ErrorIndicationIEs_t *s1_error_indication_p; + S1AP_ErrorIndication_t *container; + S1AP_ErrorIndicationIEs_t *ie; s1ap_eNB_mme_data_t *mme_desc_p; - - DevAssert(message_p != NULL); - - s1_error_indication_p = &message_p->msg.s1ap_ErrorIndicationIEs; + DevAssert(pdu != NULL); + container = &pdu->choice.initiatingMessage.value.choice.ErrorIndication; /* S1 Setup Failure == Non UE-related procedure -> stream 0 */ if (stream != 0) { @@ -465,255 +450,337 @@ int s1ap_eNB_handle_error_indication(uint32_t assoc_id, "MME context\n", assoc_id); return -1; } - if ( s1_error_indication_p->presenceMask & S1AP_ERRORINDICATIONIES_MME_UE_S1AP_ID_PRESENT) { - S1AP_WARN("Received S1 Error indication MME UE S1AP ID 0x%lx\n", s1_error_indication_p->mme_ue_s1ap_id); - } - if ( s1_error_indication_p->presenceMask & S1AP_ERRORINDICATIONIES_ENB_UE_S1AP_ID_PRESENT) { - S1AP_WARN("Received S1 Error indication eNB UE S1AP ID 0x%lx\n", s1_error_indication_p->eNB_UE_S1AP_ID); + + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_ErrorIndicationIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID, FALSE); + + /* optional */ + if (!ie) { + S1AP_WARN("Received S1 Error indication MME UE S1AP ID 0x%lx\n", ie->value.choice.MME_UE_S1AP_ID); } - if ( s1_error_indication_p->presenceMask & S1AP_ERRORINDICATIONIES_CAUSE_PRESENT) { - switch(s1_error_indication_p->cause.present) { - case S1ap_Cause_PR_NOTHING: - S1AP_WARN("Received S1 Error indication cause NOTHING\n"); - break; - case S1ap_Cause_PR_radioNetwork: - switch (s1_error_indication_p->cause.choice.radioNetwork) { - case S1ap_CauseRadioNetwork_unspecified: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_unspecified\n"); + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_ErrorIndicationIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, FALSE); + + /* optional */ + if (!ie) { + S1AP_WARN("Received S1 Error indication eNB UE S1AP ID 0x%lx\n", ie->value.choice.ENB_UE_S1AP_ID); + } + + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_ErrorIndicationIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_Cause, FALSE); + + /* optional */ + if (ie) { + switch(ie->value.choice.Cause.present) { + case S1AP_Cause_PR_NOTHING: + S1AP_WARN("Received S1 Error indication cause NOTHING\n"); + break; + + case S1AP_Cause_PR_radioNetwork: + switch (ie->value.choice.Cause.choice.radioNetwork) { + case S1AP_CauseRadioNetwork_unspecified: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_unspecified\n"); break; - case S1ap_CauseRadioNetwork_tx2relocoverall_expiry: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_tx2relocoverall_expiry\n"); + + case S1AP_CauseRadioNetwork_tx2relocoverall_expiry: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_tx2relocoverall_expiry\n"); break; - case S1ap_CauseRadioNetwork_successful_handover: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_successful_handover\n"); + + case S1AP_CauseRadioNetwork_successful_handover: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_successful_handover\n"); break; - case S1ap_CauseRadioNetwork_release_due_to_eutran_generated_reason: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_release_due_to_eutran_generated_reason\n"); + + case S1AP_CauseRadioNetwork_release_due_to_eutran_generated_reason: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_release_due_to_eutran_generated_reason\n"); break; - case S1ap_CauseRadioNetwork_handover_cancelled: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_handover_cancelled\n"); + + case S1AP_CauseRadioNetwork_handover_cancelled: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_handover_cancelled\n"); break; - case S1ap_CauseRadioNetwork_partial_handover: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_partial_handover\n"); + + case S1AP_CauseRadioNetwork_partial_handover: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_partial_handover\n"); break; - case S1ap_CauseRadioNetwork_ho_failure_in_target_EPC_eNB_or_target_system: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_ho_failure_in_target_EPC_eNB_or_target_system\n"); + + case S1AP_CauseRadioNetwork_ho_failure_in_target_EPC_eNB_or_target_system: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_ho_failure_in_target_EPC_eNB_or_target_system\n"); break; - case S1ap_CauseRadioNetwork_ho_target_not_allowed: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_ho_target_not_allowed\n"); + + case S1AP_CauseRadioNetwork_ho_target_not_allowed: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_ho_target_not_allowed\n"); break; - case S1ap_CauseRadioNetwork_tS1relocoverall_expiry: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_tS1relocoverall_expiry\n"); + + case S1AP_CauseRadioNetwork_tS1relocoverall_expiry: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_tS1relocoverall_expiry\n"); break; - case S1ap_CauseRadioNetwork_tS1relocprep_expiry: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_tS1relocprep_expiry\n"); + + case S1AP_CauseRadioNetwork_tS1relocprep_expiry: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_tS1relocprep_expiry\n"); break; - case S1ap_CauseRadioNetwork_cell_not_available: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_cell_not_available\n"); + + case S1AP_CauseRadioNetwork_cell_not_available: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_cell_not_available\n"); break; - case S1ap_CauseRadioNetwork_unknown_targetID: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_unknown_targetID\n"); + + case S1AP_CauseRadioNetwork_unknown_targetID: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_unknown_targetID\n"); break; - case S1ap_CauseRadioNetwork_no_radio_resources_available_in_target_cell: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_no_radio_resources_available_in_target_cell\n"); + + case S1AP_CauseRadioNetwork_no_radio_resources_available_in_target_cell: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_no_radio_resources_available_in_target_cell\n"); break; - case S1ap_CauseRadioNetwork_unknown_mme_ue_s1ap_id: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_unknown_mme_ue_s1ap_id\n"); + + case S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id\n"); break; - case S1ap_CauseRadioNetwork_unknown_enb_ue_s1ap_id: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_unknown_enb_ue_s1ap_id\n"); + + case S1AP_CauseRadioNetwork_unknown_enb_ue_s1ap_id: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_unknown_enb_ue_s1ap_id\n"); break; - case S1ap_CauseRadioNetwork_unknown_pair_ue_s1ap_id: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_unknown_pair_ue_s1ap_id\n"); + + case S1AP_CauseRadioNetwork_unknown_pair_ue_s1ap_id: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_unknown_pair_ue_s1ap_id\n"); break; - case S1ap_CauseRadioNetwork_handover_desirable_for_radio_reason: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_handover_desirable_for_radio_reason\n"); + + case S1AP_CauseRadioNetwork_handover_desirable_for_radio_reason: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_handover_desirable_for_radio_reason\n"); break; - case S1ap_CauseRadioNetwork_time_critical_handover: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_time_critical_handover\n"); + + case S1AP_CauseRadioNetwork_time_critical_handover: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_time_critical_handover\n"); break; - case S1ap_CauseRadioNetwork_resource_optimisation_handover: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_resource_optimisation_handover\n"); + + case S1AP_CauseRadioNetwork_resource_optimisation_handover: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_resource_optimisation_handover\n"); break; - case S1ap_CauseRadioNetwork_reduce_load_in_serving_cell: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_reduce_load_in_serving_cell\n"); + + case S1AP_CauseRadioNetwork_reduce_load_in_serving_cell: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_reduce_load_in_serving_cell\n"); break; - case S1ap_CauseRadioNetwork_user_inactivity: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_user_inactivity\n"); + + case S1AP_CauseRadioNetwork_user_inactivity: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_user_inactivity\n"); break; - case S1ap_CauseRadioNetwork_radio_connection_with_ue_lost: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_radio_connection_with_ue_lost\n"); + + case S1AP_CauseRadioNetwork_radio_connection_with_ue_lost: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_radio_connection_with_ue_lost\n"); break; - case S1ap_CauseRadioNetwork_load_balancing_tau_required: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_load_balancing_tau_required\n"); + + case S1AP_CauseRadioNetwork_load_balancing_tau_required: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_load_balancing_tau_required\n"); break; - case S1ap_CauseRadioNetwork_cs_fallback_triggered: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_cs_fallback_triggered\n"); + + case S1AP_CauseRadioNetwork_cs_fallback_triggered: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_cs_fallback_triggered\n"); break; - case S1ap_CauseRadioNetwork_ue_not_available_for_ps_service: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_ue_not_available_for_ps_service\n"); + + case S1AP_CauseRadioNetwork_ue_not_available_for_ps_service: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_ue_not_available_for_ps_service\n"); break; - case S1ap_CauseRadioNetwork_radio_resources_not_available: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_radio_resources_not_available\n"); + + case S1AP_CauseRadioNetwork_radio_resources_not_available: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_radio_resources_not_available\n"); break; - case S1ap_CauseRadioNetwork_failure_in_radio_interface_procedure: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_failure_in_radio_interface_procedure\n"); + + case S1AP_CauseRadioNetwork_failure_in_radio_interface_procedure: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_failure_in_radio_interface_procedure\n"); break; - case S1ap_CauseRadioNetwork_invals1ap_id_qos_combination: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_invals1ap_id_qos_combination\n"); + + case S1AP_CauseRadioNetwork_invalid_qos_combination: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_invals1ap_id_qos_combination\n"); break; - case S1ap_CauseRadioNetwork_interrat_redirection: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_interrat_redirection\n"); + + case S1AP_CauseRadioNetwork_interrat_redirection: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_interrat_redirection\n"); break; - case S1ap_CauseRadioNetwork_interaction_with_other_procedure: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_interaction_with_other_procedure\n"); + + case S1AP_CauseRadioNetwork_interaction_with_other_procedure: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_interaction_with_other_procedure\n"); break; - case S1ap_CauseRadioNetwork_unknown_E_RAB_ID: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_unknown_E_RAB_ID\n"); + + case S1AP_CauseRadioNetwork_unknown_E_RAB_ID: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_unknown_E_RAB_ID\n"); break; - case S1ap_CauseRadioNetwork_multiple_E_RAB_ID_instances: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_multiple_E_RAB_ID_instances\n"); + + case S1AP_CauseRadioNetwork_multiple_E_RAB_ID_instances: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_multiple_E_RAB_ID_instances\n"); break; - case S1ap_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported\n"); + + case S1AP_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_encryption_and_or_integrity_protection_algorithms_not_supported\n"); break; - case S1ap_CauseRadioNetwork_s1_intra_system_handover_triggered: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_s1_intra_system_handover_triggered\n"); + + case S1AP_CauseRadioNetwork_s1_intra_system_handover_triggered: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_s1_intra_system_handover_triggered\n"); break; - case S1ap_CauseRadioNetwork_s1_inter_system_handover_triggered: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_s1_inter_system_handover_triggered\n"); + + case S1AP_CauseRadioNetwork_s1_inter_system_handover_triggered: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_s1_inter_system_handover_triggered\n"); break; - case S1ap_CauseRadioNetwork_x2_handover_triggered: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_x2_handover_triggered\n"); + + case S1AP_CauseRadioNetwork_x2_handover_triggered: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_x2_handover_triggered\n"); break; - case S1ap_CauseRadioNetwork_redirection_towards_1xRTT: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_redirection_towards_1xRTT\n"); + + case S1AP_CauseRadioNetwork_redirection_towards_1xRTT: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_redirection_towards_1xRTT\n"); break; - case S1ap_CauseRadioNetwork_not_supported_QCI_value: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_not_supported_QCI_value\n"); + + case S1AP_CauseRadioNetwork_not_supported_QCI_value: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_not_supported_QCI_value\n"); break; - case S1ap_CauseRadioNetwork_invals1ap_id_CSG_Id: - S1AP_WARN("Received S1 Error indication S1ap_CauseRadioNetwork_invals1ap_id_CSG_Id\n"); + + case S1AP_CauseRadioNetwork_invalid_CSG_Id: + S1AP_WARN("Received S1 Error indication S1AP_CauseRadioNetwork_invals1ap_id_CSG_Id\n"); break; - default: + + default: S1AP_WARN("Received S1 Error indication cause radio network case not handled\n"); - } - break; + } - case S1ap_Cause_PR_transport: - switch (s1_error_indication_p->cause.choice.transport) { - case S1ap_CauseTransport_transport_resource_unavailable: - S1AP_WARN("Received S1 Error indication S1ap_CauseTransport_transport_resource_unavailable\n"); + break; + + case S1AP_Cause_PR_transport: + switch (ie->value.choice.Cause.choice.transport) { + case S1AP_CauseTransport_transport_resource_unavailable: + S1AP_WARN("Received S1 Error indication S1AP_CauseTransport_transport_resource_unavailable\n"); break; - case S1ap_CauseTransport_unspecified: - S1AP_WARN("Received S1 Error indication S1ap_CauseTransport_unspecified\n"); + + case S1AP_CauseTransport_unspecified: + S1AP_WARN("Received S1 Error indication S1AP_CauseTransport_unspecified\n"); break; - default: + + default: S1AP_WARN("Received S1 Error indication cause transport case not handled\n"); - } - break; + } - case S1ap_Cause_PR_nas: - switch (s1_error_indication_p->cause.choice.nas) { - case S1ap_CauseNas_normal_release: - S1AP_WARN("Received S1 Error indication S1ap_CauseNas_normal_release\n"); + break; + + case S1AP_Cause_PR_nas: + switch (ie->value.choice.Cause.choice.nas) { + case S1AP_CauseNas_normal_release: + S1AP_WARN("Received S1 Error indication S1AP_CauseNas_normal_release\n"); break; - case S1ap_CauseNas_authentication_failure: - S1AP_WARN("Received S1 Error indication S1ap_CauseNas_authentication_failure\n"); + + case S1AP_CauseNas_authentication_failure: + S1AP_WARN("Received S1 Error indication S1AP_CauseNas_authentication_failure\n"); break; - case S1ap_CauseNas_detach: - S1AP_WARN("Received S1 Error indication S1ap_CauseNas_detach\n"); + + case S1AP_CauseNas_detach: + S1AP_WARN("Received S1 Error indication S1AP_CauseNas_detach\n"); break; - case S1ap_CauseNas_unspecified: - S1AP_WARN("Received S1 Error indication S1ap_CauseNas_unspecified\n"); + + case S1AP_CauseNas_unspecified: + S1AP_WARN("Received S1 Error indication S1AP_CauseNas_unspecified\n"); break; - case S1ap_CauseNas_csg_subscription_expiry: - S1AP_WARN("Received S1 Error indication S1ap_CauseNas_csg_subscription_expiry\n"); + + case S1AP_CauseNas_csg_subscription_expiry: + S1AP_WARN("Received S1 Error indication S1AP_CauseNas_csg_subscription_expiry\n"); break; - default: + + default: S1AP_WARN("Received S1 Error indication cause nas case not handled\n"); - } - break; + } - case S1ap_Cause_PR_protocol: - switch (s1_error_indication_p->cause.choice.protocol) { - case S1ap_CauseProtocol_transfer_syntax_error: - S1AP_WARN("Received S1 Error indication S1ap_CauseProtocol_transfer_syntax_error\n"); + break; + + case S1AP_Cause_PR_protocol: + switch (ie->value.choice.Cause.choice.protocol) { + case S1AP_CauseProtocol_transfer_syntax_error: + S1AP_WARN("Received S1 Error indication S1AP_CauseProtocol_transfer_syntax_error\n"); break; - case S1ap_CauseProtocol_abstract_syntax_error_reject: - S1AP_WARN("Received S1 Error indication S1ap_CauseProtocol_abstract_syntax_error_reject\n"); + + case S1AP_CauseProtocol_abstract_syntax_error_reject: + S1AP_WARN("Received S1 Error indication S1AP_CauseProtocol_abstract_syntax_error_reject\n"); break; - case S1ap_CauseProtocol_abstract_syntax_error_ignore_and_notify: - S1AP_WARN("Received S1 Error indication S1ap_CauseProtocol_abstract_syntax_error_ignore_and_notify\n"); + + case S1AP_CauseProtocol_abstract_syntax_error_ignore_and_notify: + S1AP_WARN("Received S1 Error indication S1AP_CauseProtocol_abstract_syntax_error_ignore_and_notify\n"); break; - case S1ap_CauseProtocol_message_not_compatible_with_receiver_state: - S1AP_WARN("Received S1 Error indication S1ap_CauseProtocol_message_not_compatible_with_receiver_state\n"); + + case S1AP_CauseProtocol_message_not_compatible_with_receiver_state: + S1AP_WARN("Received S1 Error indication S1AP_CauseProtocol_message_not_compatible_with_receiver_state\n"); break; - case S1ap_CauseProtocol_semantic_error: - S1AP_WARN("Received S1 Error indication S1ap_CauseProtocol_semantic_error\n"); + + case S1AP_CauseProtocol_semantic_error: + S1AP_WARN("Received S1 Error indication S1AP_CauseProtocol_semantic_error\n"); break; - case S1ap_CauseProtocol_abstract_syntax_error_falsely_constructed_message: - S1AP_WARN("Received S1 Error indication S1ap_CauseProtocol_abstract_syntax_error_falsely_constructed_message\n"); + + case S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message: + S1AP_WARN("Received S1 Error indication S1AP_CauseProtocol_abstract_syntax_error_falsely_constructed_message\n"); break; - case S1ap_CauseProtocol_unspecified: - S1AP_WARN("Received S1 Error indication S1ap_CauseProtocol_unspecified\n"); + + case S1AP_CauseProtocol_unspecified: + S1AP_WARN("Received S1 Error indication S1AP_CauseProtocol_unspecified\n"); break; - default: + + default: S1AP_WARN("Received S1 Error indication cause protocol case not handled\n"); - } - break; + } - case S1ap_Cause_PR_misc: - switch (s1_error_indication_p->cause.choice.protocol) { - case S1ap_CauseMisc_control_processing_overload: - S1AP_WARN("Received S1 Error indication S1ap_CauseMisc_control_processing_overload\n"); + break; + + case S1AP_Cause_PR_misc: + switch (ie->value.choice.Cause.choice.protocol) { + case S1AP_CauseMisc_control_processing_overload: + S1AP_WARN("Received S1 Error indication S1AP_CauseMisc_control_processing_overload\n"); break; - case S1ap_CauseMisc_not_enough_user_plane_processing_resources: - S1AP_WARN("Received S1 Error indication S1ap_CauseMisc_not_enough_user_plane_processing_resources\n"); - break; - case S1ap_CauseMisc_hardware_failure: - S1AP_WARN("Received S1 Error indication S1ap_CauseMisc_hardware_failure\n"); - break; - case S1ap_CauseMisc_om_intervention: - S1AP_WARN("Received S1 Error indication S1ap_CauseMisc_om_intervention\n"); - break; - case S1ap_CauseMisc_unspecified: - S1AP_WARN("Received S1 Error indication S1ap_CauseMisc_unspecified\n"); - break; - case S1ap_CauseMisc_unknown_PLMN: - S1AP_WARN("Received S1 Error indication S1ap_CauseMisc_unknown_PLMN\n"); - break; + + case S1AP_CauseMisc_not_enough_user_plane_processing_resources: + S1AP_WARN("Received S1 Error indication S1AP_CauseMisc_not_enough_user_plane_processing_resources\n"); + break; + + case S1AP_CauseMisc_hardware_failure: + S1AP_WARN("Received S1 Error indication S1AP_CauseMisc_hardware_failure\n"); + break; + + case S1AP_CauseMisc_om_intervention: + S1AP_WARN("Received S1 Error indication S1AP_CauseMisc_om_intervention\n"); + break; + + case S1AP_CauseMisc_unspecified: + S1AP_WARN("Received S1 Error indication S1AP_CauseMisc_unspecified\n"); + break; + + case S1AP_CauseMisc_unknown_PLMN: + S1AP_WARN("Received S1 Error indication S1AP_CauseMisc_unknown_PLMN\n"); + break; + default: S1AP_WARN("Received S1 Error indication cause misc case not handled\n"); } - break; + + break; } } - if ( s1_error_indication_p->presenceMask & S1AP_ERRORINDICATIONIES_CRITICALITYDIAGNOSTICS_PRESENT) { + + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_ErrorIndicationIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_CriticalityDiagnostics, FALSE); + + if (ie) { // TODO continue } - // TODO continue + // TODO continue return 0; } static -int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, +int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, uint32_t stream, - struct s1ap_message_s *s1ap_message_p) + S1AP_S1AP_PDU_t *pdu) { int i; - s1ap_eNB_mme_data_t *mme_desc_p = NULL; s1ap_eNB_ue_context_t *ue_desc_p = NULL; MessageDef *message_p = NULL; - - S1ap_InitialContextSetupRequestIEs_t *initialContextSetupRequest_p; - DevAssert(s1ap_message_p != NULL); - - initialContextSetupRequest_p = &s1ap_message_p->msg.s1ap_InitialContextSetupRequestIEs; + S1AP_InitialContextSetupRequest_t *container; + S1AP_InitialContextSetupRequestIEs_t *ie; + S1AP_ENB_UE_S1AP_ID_t enb_ue_s1ap_id; + DevAssert(pdu != NULL); + container = &pdu->choice.initiatingMessage.value.choice.InitialContextSetupRequest; if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { S1AP_ERROR("[SCTP %d] Received initial context setup request for non " @@ -721,11 +788,15 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, return -1; } + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, FALSE); + enb_ue_s1ap_id = ie->value.choice.ENB_UE_S1AP_ID; + if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_desc_p->s1ap_eNB_instance, - initialContextSetupRequest_p->eNB_UE_S1AP_ID)) == NULL) { + enb_ue_s1ap_id)) == NULL) { S1AP_ERROR("[SCTP %d] Received initial context setup request for non " "existing UE context 0x%06lx\n", assoc_id, - initialContextSetupRequest_p->eNB_UE_S1AP_ID); + enb_ue_s1ap_id); return -1; } @@ -737,46 +808,52 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, } ue_desc_p->rx_stream = stream; - - ue_desc_p->mme_ue_s1ap_id = initialContextSetupRequest_p->mme_ue_s1ap_id; - + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID, TRUE); + ue_desc_p->mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID; message_p = itti_alloc_new_message(TASK_S1AP, S1AP_INITIAL_CONTEXT_SETUP_REQ); - S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; ue_desc_p->ue_initial_id = 0; + if (ue_desc_p->eNB_ue_s1ap_id != enb_ue_s1ap_id) { + /* TBD */ + } + S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).eNB_ue_s1ap_id = ue_desc_p->eNB_ue_s1ap_id; - S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).nb_of_e_rabs = - initialContextSetupRequest_p->e_RABToBeSetupListCtxtSUReq.s1ap_E_RABToBeSetupItemCtxtSUReq.count; - - S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_ambr.br_ul = 64;// TO DO(bitrate_t)(initialContextSetupRequest_p->uEaggregateMaximumBitrate.uEaggregateMaximumBitRateUL); - S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_ambr.br_dl = 1024;//(bitrate_t)(initialContextSetupRequest_p->uEaggregateMaximumBitrate.uEaggregateMaximumBitRateDL); - + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_uEaggregateMaximumBitrate, TRUE); + asn_INTEGER2ulong(&(ie->value.choice.UEAggregateMaximumBitrate.uEaggregateMaximumBitRateUL), + &(S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_ambr.br_ul)); + asn_INTEGER2ulong(&(ie->value.choice.UEAggregateMaximumBitrate.uEaggregateMaximumBitRateDL), + &(S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).ue_ambr.br_dl)); + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_UESecurityCapabilities, TRUE); S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.encryption_algorithms = - BIT_STRING_to_uint16(&initialContextSetupRequest_p->ueSecurityCapabilities.encryptionAlgorithms); + BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.encryptionAlgorithms); S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_capabilities.integrity_algorithms = - BIT_STRING_to_uint16(&initialContextSetupRequest_p->ueSecurityCapabilities.integrityProtectionAlgorithms); - + BIT_STRING_to_uint16(&ie->value.choice.UESecurityCapabilities.integrityProtectionAlgorithms); /* Copy the security key */ + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_SecurityKey, TRUE); memcpy(&S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).security_key, - initialContextSetupRequest_p->securityKey.buf, initialContextSetupRequest_p->securityKey.size); - - for (i = 0; i < initialContextSetupRequest_p->e_RABToBeSetupListCtxtSUReq.s1ap_E_RABToBeSetupItemCtxtSUReq.count; i++) { - S1ap_E_RABToBeSetupItemCtxtSUReq_t *item_p; - - item_p = (S1ap_E_RABToBeSetupItemCtxtSUReq_t *)initialContextSetupRequest_p->e_RABToBeSetupListCtxtSUReq.s1ap_E_RABToBeSetupItemCtxtSUReq.array[i]; + ie->value.choice.SecurityKey.buf, ie->value.choice.SecurityKey.size); + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_InitialContextSetupRequestIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_E_RABToBeSetupListCtxtSUReq, TRUE); + S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).nb_of_e_rabs = + ie->value.choice.E_RABToBeSetupListCtxtSUReq.list.count; + for (i = 0; i < ie->value.choice.E_RABToBeSetupListCtxtSUReq.list.count; i++) { + S1AP_E_RABToBeSetupItemCtxtSUReq_t *item_p; + item_p = &(((S1AP_E_RABToBeSetupItemCtxtSUReqIEs_t *)ie->value.choice.E_RABToBeSetupListCtxtSUReq.list.array[i])->value.choice.E_RABToBeSetupItemCtxtSUReq); S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].e_rab_id = item_p->e_RAB_ID; if (item_p->nAS_PDU != NULL) { /* Only copy NAS pdu if present */ S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.length = item_p->nAS_PDU->size; - S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU->size); - memcpy(S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.buffer, - item_p->nAS_PDU->buf, item_p->nAS_PDU->size); + item_p->nAS_PDU->buf, item_p->nAS_PDU->size); S1AP_DEBUG("Received NAS message with the E_RAB setup procedure\n"); } else { S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].nas_pdu.length = 0; @@ -788,13 +865,10 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, item_p->transportLayerAddress.buf, item_p->transportLayerAddress.size); S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].sgw_addr.length = item_p->transportLayerAddress.size * 8 - item_p->transportLayerAddress.bits_unused; - /* GTP tunnel endpoint ID */ OCTET_STRING_TO_INT32(&item_p->gTP_TEID, S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].gtp_teid); - /* Set the QOS informations */ S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.qci = item_p->e_RABlevelQoSParameters.qCI; - S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.allocation_retention_priority.priority_level = item_p->e_RABlevelQoSParameters.allocationRetentionPriority.priorityLevel; S1AP_INITIAL_CONTEXT_SETUP_REQ(message_p).e_rab_param[i].qos.allocation_retention_priority.pre_emp_capability = @@ -804,24 +878,24 @@ int s1ap_eNB_handle_initial_context_request(uint32_t assoc_id, } itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); - return 0; } static -int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, +int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, uint32_t stream, - struct s1ap_message_s *s1ap_message_p) + S1AP_S1AP_PDU_t *pdu) { s1ap_eNB_mme_data_t *mme_desc_p = NULL; s1ap_eNB_ue_context_t *ue_desc_p = NULL; MessageDef *message_p = NULL; - - S1ap_UEContextReleaseCommandIEs_t *ueContextReleaseCommand_p; - DevAssert(s1ap_message_p != NULL); - - ueContextReleaseCommand_p = &s1ap_message_p->msg.s1ap_UEContextReleaseCommandIEs; + S1AP_MME_UE_S1AP_ID_t mme_ue_s1ap_id; + S1AP_ENB_UE_S1AP_ID_t enb_ue_s1ap_id; + S1AP_UEContextReleaseCommand_t *container; + S1AP_UEContextReleaseCommand_IEs_t *ie; + DevAssert(pdu != NULL); + container = &pdu->choice.initiatingMessage.value.choice.UEContextReleaseCommand; if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { S1AP_ERROR("[SCTP %d] Received UE context release command for non " @@ -829,80 +903,81 @@ int s1ap_eNB_handle_ue_context_release_command(uint32_t assoc_id, return -1; } - S1ap_MME_UE_S1AP_ID_t mme_ue_s1ap_id; - S1ap_ENB_UE_S1AP_ID_t enb_ue_s1ap_id; + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_UEContextReleaseCommand_IEs_t, ie, container, + S1AP_ProtocolIE_ID_id_UE_S1AP_IDs, TRUE); - switch (ueContextReleaseCommand_p->uE_S1AP_IDs.present) { - case S1ap_UE_S1AP_IDs_PR_uE_S1AP_ID_pair: - enb_ue_s1ap_id = ueContextReleaseCommand_p->uE_S1AP_IDs.choice.uE_S1AP_ID_pair.eNB_UE_S1AP_ID; - mme_ue_s1ap_id = ueContextReleaseCommand_p->uE_S1AP_IDs.choice.uE_S1AP_ID_pair.mME_UE_S1AP_ID; + switch (ie->value.choice.UE_S1AP_IDs.present) { + case S1AP_UE_S1AP_IDs_PR_uE_S1AP_ID_pair: + enb_ue_s1ap_id = ie->value.choice.UE_S1AP_IDs.choice.uE_S1AP_ID_pair.eNB_UE_S1AP_ID; + mme_ue_s1ap_id = ie->value.choice.UE_S1AP_IDs.choice.uE_S1AP_ID_pair.mME_UE_S1AP_ID; + MSC_LOG_RX_MESSAGE( + MSC_S1AP_ENB, + MSC_S1AP_MME, + NULL,0, + "0 UEContextRelease/%s eNB_ue_s1ap_id "S1AP_UE_ID_FMT" mme_ue_s1ap_id "S1AP_UE_ID_FMT" len %u", + s1ap_direction2String[pdu->present - 1], + enb_ue_s1ap_id, + mme_ue_s1ap_id); - MSC_LOG_RX_MESSAGE( - MSC_S1AP_ENB, - MSC_S1AP_MME, - NULL,0, - "0 UEContextRelease/%s eNB_ue_s1ap_id "S1AP_UE_ID_FMT" mme_ue_s1ap_id "S1AP_UE_ID_FMT" len %u", - s1ap_direction2String[s1ap_message_p->direction], - enb_ue_s1ap_id, - mme_ue_s1ap_id); + if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_desc_p->s1ap_eNB_instance, + enb_ue_s1ap_id)) == NULL) { + S1AP_ERROR("[SCTP %d] Received UE context release command for non " + "existing UE context 0x%06lx\n", + assoc_id, + enb_ue_s1ap_id); + /*MessageDef *msg_complete_p; + msg_complete_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_COMPLETE); + S1AP_UE_CONTEXT_RELEASE_COMPLETE(msg_complete_p).eNB_ue_s1ap_id = enb_ue_s1ap_id; + itti_send_msg_to_task(TASK_S1AP, ue_desc_p->eNB_instance->instance <=> 0, msg_complete_p); + */ + return -1; + } else { + MSC_LOG_TX_MESSAGE( + MSC_S1AP_ENB, + MSC_RRC_ENB, + NULL,0, + "0 S1AP_UE_CONTEXT_RELEASE_COMMAND/%d eNB_ue_s1ap_id "S1AP_UE_ID_FMT" ", + enb_ue_s1ap_id); + message_p = itti_alloc_new_message(TASK_S1AP, S1AP_UE_CONTEXT_RELEASE_COMMAND); + S1AP_UE_CONTEXT_RELEASE_COMMAND(message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id; + itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); + return 0; + } - if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_desc_p->s1ap_eNB_instance, - enb_ue_s1ap_id)) == NULL) { - S1AP_ERROR("[SCTP %d] Received UE context release command for non " - "existing UE context 0x%06lx\n", - assoc_id, - enb_ue_s1ap_id); - /*MessageDef *msg_complete_p; - msg_complete_p = itti_alloc_new_message(TASK_RRC_ENB, S1AP_UE_CONTEXT_RELEASE_COMPLETE); - S1AP_UE_CONTEXT_RELEASE_COMPLETE(msg_complete_p).eNB_ue_s1ap_id = enb_ue_s1ap_id; - itti_send_msg_to_task(TASK_S1AP, ue_desc_p->eNB_instance->instance <=> 0, msg_complete_p); - */ + break; + + //#warning "TODO mapping mme_ue_s1ap_id enb_ue_s1ap_id?" + + case S1AP_UE_S1AP_IDs_PR_mME_UE_S1AP_ID: + mme_ue_s1ap_id = ie->value.choice.UE_S1AP_IDs.choice.uE_S1AP_ID_pair.mME_UE_S1AP_ID; + S1AP_ERROR("TO DO mapping mme_ue_s1ap_id enb_ue_s1ap_id"); + (void)mme_ue_s1ap_id; /* TODO: remove - it's to remove gcc warning about unused var */ + + case S1AP_UE_S1AP_IDs_PR_NOTHING: + default: + S1AP_ERROR("S1AP_UE_CONTEXT_RELEASE_COMMAND not processed, missing info elements"); return -1; - } else { - MSC_LOG_TX_MESSAGE( - MSC_S1AP_ENB, - MSC_RRC_ENB, - NULL,0, - "0 S1AP_UE_CONTEXT_RELEASE_COMMAND/%d eNB_ue_s1ap_id "S1AP_UE_ID_FMT" ", - enb_ue_s1ap_id); - - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_UE_CONTEXT_RELEASE_COMMAND); - S1AP_UE_CONTEXT_RELEASE_COMMAND(message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id; - itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); - return 0; - } - - break; - -//#warning "TODO mapping mme_ue_s1ap_id enb_ue_s1ap_id?" - - case S1ap_UE_S1AP_IDs_PR_mME_UE_S1AP_ID: - mme_ue_s1ap_id = ueContextReleaseCommand_p->uE_S1AP_IDs.choice.mME_UE_S1AP_ID; - S1AP_ERROR("TO DO mapping mme_ue_s1ap_id enb_ue_s1ap_id"); - (void)mme_ue_s1ap_id; /* TODO: remove - it's to remove gcc warning about unused var */ - - case S1ap_UE_S1AP_IDs_PR_NOTHING: - default: - S1AP_ERROR("S1AP_UE_CONTEXT_RELEASE_COMMAND not processed, missing info elements"); - return -1; } + + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_UEContextReleaseCommand_IEs_t, ie, container, + S1AP_ProtocolIE_ID_id_Cause, TRUE); + /* TBD */ } static -int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, - uint32_t stream, - struct s1ap_message_s *s1ap_message_p) { - +int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, + uint32_t stream, + S1AP_S1AP_PDU_t *pdu) +{ int i; - - s1ap_eNB_mme_data_t *mme_desc_p = NULL; - s1ap_eNB_ue_context_t *ue_desc_p = NULL; - MessageDef *message_p = NULL; - - S1ap_E_RABSetupRequestIEs_t *s1ap_E_RABSetupRequest; - DevAssert(s1ap_message_p != NULL); - - s1ap_E_RABSetupRequest = &s1ap_message_p->msg.s1ap_E_RABSetupRequestIEs; + S1AP_ENB_UE_S1AP_ID_t enb_ue_s1ap_id; + s1ap_eNB_mme_data_t *mme_desc_p = NULL; + s1ap_eNB_ue_context_t *ue_desc_p = NULL; + MessageDef *message_p = NULL; + S1AP_E_RABSetupRequest_t *container; + S1AP_E_RABSetupRequestIEs_t *ie; + DevAssert(pdu != NULL); + container = &pdu->choice.initiatingMessage.value.choice.E_RABSetupRequest; if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { S1AP_ERROR("[SCTP %d] Received initial context setup request for non " @@ -910,15 +985,19 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, return -1; } - + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABSetupRequestIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, TRUE); + if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_desc_p->s1ap_eNB_instance, - s1ap_E_RABSetupRequest->eNB_UE_S1AP_ID)) == NULL) { + ie->value.choice.ENB_UE_S1AP_ID)) == NULL) { S1AP_ERROR("[SCTP %d] Received initial context setup request for non " "existing UE context 0x%06lx\n", assoc_id, - s1ap_E_RABSetupRequest->eNB_UE_S1AP_ID); + ie->value.choice.ENB_UE_S1AP_ID); return -1; } + enb_ue_s1ap_id = ie->value.choice.ENB_UE_S1AP_ID; + /* Initial context request = UE-related procedure -> stream != 0 */ if (stream == 0) { S1AP_ERROR("[SCTP %d] Received UE-related procedure on stream (%d)\n", @@ -927,42 +1006,38 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, } ue_desc_p->rx_stream = stream; + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABSetupRequestIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID, TRUE); - if ( ue_desc_p->mme_ue_s1ap_id != s1ap_E_RABSetupRequest->mme_ue_s1ap_id){ - S1AP_WARN("UE context mme_ue_s1ap_id is different form that of the message (%d != %ld)", - ue_desc_p->mme_ue_s1ap_id, s1ap_E_RABSetupRequest->mme_ue_s1ap_id); - + if ( ue_desc_p->mme_ue_s1ap_id != ie->value.choice.MME_UE_S1AP_ID) { + S1AP_WARN("UE context mme_ue_s1ap_id is different form that of the message (%d != %ld)", + ue_desc_p->mme_ue_s1ap_id, ie->value.choice.MME_UE_S1AP_ID); } - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_E_RAB_SETUP_REQ); - - S1AP_E_RAB_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; - - S1AP_E_RAB_SETUP_REQ(message_p).mme_ue_s1ap_id = s1ap_E_RABSetupRequest->mme_ue_s1ap_id; - S1AP_E_RAB_SETUP_REQ(message_p).eNB_ue_s1ap_id = s1ap_E_RABSetupRequest->eNB_UE_S1AP_ID; - - S1AP_E_RAB_SETUP_REQ(message_p).nb_e_rabs_tosetup = - s1ap_E_RABSetupRequest->e_RABToBeSetupListBearerSUReq.s1ap_E_RABToBeSetupItemBearerSUReq.count; - - for (i = 0; i < s1ap_E_RABSetupRequest->e_RABToBeSetupListBearerSUReq.s1ap_E_RABToBeSetupItemBearerSUReq.count; i++) { - S1ap_E_RABToBeSetupItemBearerSUReq_t *item_p; - - item_p = (S1ap_E_RABToBeSetupItemBearerSUReq_t *)s1ap_E_RABSetupRequest->e_RABToBeSetupListBearerSUReq.s1ap_E_RABToBeSetupItemBearerSUReq.array[i]; + message_p = itti_alloc_new_message(TASK_S1AP, S1AP_E_RAB_SETUP_REQ); + S1AP_E_RAB_SETUP_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; + S1AP_E_RAB_SETUP_REQ(message_p).mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID; + S1AP_E_RAB_SETUP_REQ(message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id; + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABSetupRequestIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_E_RABToBeSetupListBearerSUReq, TRUE); + S1AP_E_RAB_SETUP_REQ(message_p).nb_e_rabs_tosetup = + ie->value.choice.E_RABToBeSetupListBearerSUReq.list.count; + + for (i = 0; i < ie->value.choice.E_RABToBeSetupListBearerSUReq.list.count; i++) { + S1AP_E_RABToBeSetupItemBearerSUReq_t *item_p; + item_p = &(((S1AP_E_RABToBeSetupItemBearerSUReqIEs_t *)ie->value.choice.E_RABToBeSetupListBearerSUReq.list.array[i])->value.choice.E_RABToBeSetupItemBearerSUReq); S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].e_rab_id = item_p->e_RAB_ID; // check for the NAS PDU if (item_p->nAS_PDU.size > 0 ) { S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length = item_p->nAS_PDU.size; - S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU.size); - memcpy(S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer, - item_p->nAS_PDU.buf, item_p->nAS_PDU.size); + item_p->nAS_PDU.buf, item_p->nAS_PDU.size); // S1AP_INFO("received a NAS PDU with size %d (%02x.%02x)\n",S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length, item_p->nAS_PDU.buf[0], item_p->nAS_PDU.buf[1]); } else { S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.length = 0; S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].nas_pdu.buffer = NULL; - S1AP_WARN("NAS PDU is not provided, generate a E_RAB_SETUP Failure (TBD) back to MME \n"); // return -1; } @@ -972,18 +1047,15 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, item_p->transportLayerAddress.buf, item_p->transportLayerAddress.size); S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.length = item_p->transportLayerAddress.size * 8 - item_p->transportLayerAddress.bits_unused; - - /* S1AP_INFO("sgw addr %s len: %d (size %d, index %d)\n", - S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.buffer, - S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.length, - item_p->transportLayerAddress.size, i); + /* S1AP_INFO("sgw addr %s len: %d (size %d, index %d)\n", + S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.buffer, + S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].sgw_addr.length, + item_p->transportLayerAddress.size, i); */ /* GTP tunnel endpoint ID */ OCTET_STRING_TO_INT32(&item_p->gTP_TEID, S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].gtp_teid); - /* Set the QOS informations */ S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.qci = item_p->e_RABlevelQoSParameters.qCI; - S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.allocation_retention_priority.priority_level = item_p->e_RABlevelQoSParameters.allocationRetentionPriority.priorityLevel; S1AP_E_RAB_SETUP_REQ(message_p).e_rab_setup_params[i].qos.allocation_retention_priority.pre_emp_capability = @@ -993,26 +1065,24 @@ int s1ap_eNB_handle_e_rab_setup_request(uint32_t assoc_id, } itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); - return 0; } static int s1ap_eNB_handle_paging(uint32_t assoc_id, - uint32_t stream, - struct s1ap_message_s *s1ap_message_p) + uint32_t stream, + S1AP_S1AP_PDU_t *pdu) { - S1ap_PagingIEs_t *paging_p; s1ap_eNB_mme_data_t *mme_desc_p = NULL; s1ap_eNB_instance_t *s1ap_eNB_instance = NULL; MessageDef *message_p = NULL; - - DevAssert(s1ap_message_p != NULL); + S1AP_Paging_t *container; + S1AP_PagingIEs_t *ie; + DevAssert(pdu != NULL); + container = &pdu->choice.initiatingMessage.value.choice.Paging; // received Paging Message from MME S1AP_DEBUG("[SCTP %d] Received Paging Message From MME\n",assoc_id); - paging_p = &s1ap_message_p->msg.s1ap_PagingIEs; - /* Paging procedure -> stream != 0 */ if (stream == 0) { S1AP_ERROR("[SCTP %d] Received Paging procedure on stream (%d)\n", @@ -1027,6 +1097,7 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, } s1ap_eNB_instance = mme_desc_p->s1ap_eNB_instance; + if (s1ap_eNB_instance == NULL) { S1AP_ERROR("[SCTP %d] Received Paging for non existing MME context : s1ap_eNB_instance is NULL\n", assoc_id); @@ -1034,178 +1105,208 @@ int s1ap_eNB_handle_paging(uint32_t assoc_id, } message_p = itti_alloc_new_message(TASK_S1AP, S1AP_PAGING_IND); - - /* convert S1ap_PagingIEs_t to s1ap_paging_ind_t */ + /* convert S1AP_PagingIEs_t to s1ap_paging_ind_t */ /* convert UE Identity Index value */ - S1AP_PAGING_IND(message_p).ue_index_value = BIT_STRING_to_uint32(&paging_p->ueIdentityIndexValue); + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_PagingIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_UEIdentityIndexValue, TRUE); + S1AP_PAGING_IND(message_p).ue_index_value = BIT_STRING_to_uint32(&ie->value.choice.UEIdentityIndexValue); S1AP_DEBUG("[SCTP %d] Received Paging ue_index_value (%d)\n", - assoc_id,(uint32_t)S1AP_PAGING_IND(message_p).ue_index_value); - + assoc_id,(uint32_t)S1AP_PAGING_IND(message_p).ue_index_value); S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code = 0; S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi = 0; + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_PagingIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_UEPagingID, TRUE); /* convert UE Paging Identity */ - if (paging_p->uePagingID.present == S1ap_UEPagingID_PR_s_TMSI) { - S1AP_PAGING_IND(message_p).ue_paging_identity.presenceMask = UE_PAGING_IDENTITY_s_tmsi; - OCTET_STRING_TO_INT8(&paging_p->uePagingID.choice.s_TMSI.mMEC, S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code); - OCTET_STRING_TO_INT32(&paging_p->uePagingID.choice.s_TMSI.m_TMSI, S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi); - } else if (paging_p->uePagingID.present == S1ap_UEPagingID_PR_iMSI) { - S1AP_PAGING_IND(message_p).ue_paging_identity.presenceMask = UE_PAGING_IDENTITY_imsi; - S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length = 0; - for (int i = 0; i < paging_p->uePagingID.choice.iMSI.size; i++) { - S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i] = (uint8_t)(paging_p->uePagingID.choice.iMSI.buf[i] & 0x0F ); - S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length++; - S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i+1] = (uint8_t)((paging_p->uePagingID.choice.iMSI.buf[i]>>4) & 0x0F); - LOG_D(S1AP,"paging : i %d %d imsi %d %d \n",2*i,2*i+1,S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i], S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i+1]); - if (S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i+1] == 0x0F) { - if(i != paging_p->uePagingID.choice.iMSI.size - 1){ - /* invalid paging_p->uePagingID.choise.iMSI.buffer */ - S1AP_ERROR("[SCTP %d] Received Paging : uePagingID.choise.iMSI error(i %d 0x0F)\n", assoc_id,i); - return -1; - } - } else { - S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length++; - } - } - if (S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length >= S1AP_IMSI_LENGTH) { - /* invalid paging_p->uePagingID.choise.iMSI.size */ - S1AP_ERROR("[SCTP %d] Received Paging : uePagingID.choise.iMSI.size(%d) is over IMSI length(%d)\n", assoc_id, S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length, S1AP_IMSI_LENGTH); + if (ie->value.choice.UEPagingID.present == S1AP_UEPagingID_PR_s_TMSI) { + S1AP_PAGING_IND(message_p).ue_paging_identity.presenceMask = UE_PAGING_IDENTITY_s_tmsi; + OCTET_STRING_TO_INT8(&ie->value.choice.UEPagingID.choice.s_TMSI.mMEC, S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code); + OCTET_STRING_TO_INT32(&ie->value.choice.UEPagingID.choice.s_TMSI.m_TMSI, S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi); + } else if (ie->value.choice.UEPagingID.present == S1AP_UEPagingID_PR_iMSI) { + S1AP_PAGING_IND(message_p).ue_paging_identity.presenceMask = UE_PAGING_IDENTITY_imsi; + S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length = 0; + + for (int i = 0; i < ie->value.choice.UEPagingID.choice.iMSI.size; i++) { + S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i] = (uint8_t)(ie->value.choice.UEPagingID.choice.iMSI.buf[i] & 0x0F ); + S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length++; + S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i+1] = (uint8_t)((ie->value.choice.UEPagingID.choice.iMSI.buf[i]>>4) & 0x0F); + LOG_D(S1AP,"paging : i %d %d imsi %d %d \n",2*i,2*i+1,S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i], S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i+1]); + + if (S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2*i+1] == 0x0F) { + if(i != ie->value.choice.UEPagingID.choice.iMSI.size - 1) { + /* invalid paging_p->uePagingID.choise.iMSI.buffer */ + S1AP_ERROR("[SCTP %d] Received Paging : uePagingID.choise.iMSI error(i %d 0x0F)\n", assoc_id,i); return -1; - } -} else { - /* invalid paging_p->uePagingID.present */ - S1AP_ERROR("[SCTP %d] Received Paging : uePagingID.present(%d) is unknown\n", assoc_id, paging_p->uePagingID.present); + } + } else { + S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length++; + } + } + + if (S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length >= S1AP_IMSI_LENGTH) { + /* invalid paging_p->uePagingID.choise.iMSI.size */ + S1AP_ERROR("[SCTP %d] Received Paging : uePagingID.choise.iMSI.size(%d) is over IMSI length(%d)\n", assoc_id, S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length, S1AP_IMSI_LENGTH); return -1; + } + } else { + /* invalid paging_p->uePagingID.present */ + S1AP_ERROR("[SCTP %d] Received Paging : uePagingID.present(%d) is unknown\n", assoc_id, ie->value.choice.UEPagingID.present); + return -1; } #if 0 + /* convert Paging DRX(optional) */ if (paging_p->presenceMask & S1AP_PAGINGIES_PAGINGDRX_PRESENT) { - switch(paging_p->pagingDRX) { - case S1ap_PagingDRX_v32: - S1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_32; - break; - case S1ap_PagingDRX_v64: - S1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_64; + switch(paging_p->pagingDRX) { + case S1AP_PagingDRX_v32: + S1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_32; break; - case S1ap_PagingDRX_v128: - S1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_128; + + case S1AP_PagingDRX_v64: + S1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_64; break; - case S1ap_PagingDRX_v256: - S1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_256; + + case S1AP_PagingDRX_v128: + S1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_128; break; - default: - // when UE Paging DRX is no value - S1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_256; + + case S1AP_PagingDRX_v256: + S1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_256; break; - } + + default: + // when UE Paging DRX is no value + S1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_256; + break; + } } + #endif - S1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_256; + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_PagingIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_pagingDRX, FALSE); + + /* optional */ + if (ie) { + S1AP_PAGING_IND(message_p).paging_drx = ie->value.choice.PagingDRX; + } else { + S1AP_PAGING_IND(message_p).paging_drx = PAGING_DRX_256; + } + + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_PagingIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_CNDomain, TRUE); /* convert cnDomain */ - if (paging_p->cnDomain == S1ap_CNDomain_ps) { - S1AP_PAGING_IND(message_p).cn_domain = CN_DOMAIN_PS; - } else if (paging_p->cnDomain == S1ap_CNDomain_cs) { - S1AP_PAGING_IND(message_p).cn_domain = CN_DOMAIN_CS; + if (ie->value.choice.CNDomain == S1AP_CNDomain_ps) { + S1AP_PAGING_IND(message_p).cn_domain = CN_DOMAIN_PS; + } else if (ie->value.choice.CNDomain == S1AP_CNDomain_cs) { + S1AP_PAGING_IND(message_p).cn_domain = CN_DOMAIN_CS; } else { - /* invalid paging_p->cnDomain */ - S1AP_ERROR("[SCTP %d] Received Paging : cnDomain(%ld) is unknown\n", assoc_id, paging_p->cnDomain); - return -1; + /* invalid paging_p->cnDomain */ + S1AP_ERROR("[SCTP %d] Received Paging : cnDomain(%ld) is unknown\n", assoc_id, ie->value.choice.CNDomain); + return -1; } memset (&S1AP_PAGING_IND(message_p).plmn_identity[0], 0, sizeof(plmn_identity_t)*256); memset (&S1AP_PAGING_IND(message_p).tac[0], 0, sizeof(int16_t)*256); S1AP_PAGING_IND(message_p).tai_size = 0; + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_PagingIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_TAIList, TRUE); + S1AP_INFO("[SCTP %d] Received Paging taiList: count %d\n", assoc_id, ie->value.choice.TAIList.list.count); - for (int i = 0; i < paging_p->taiList.s1ap_TAIItem.count; i++) { - S1AP_INFO("[SCTP %d] Received Paging taiList: i %d, count %d\n", assoc_id, i, paging_p->taiList.s1ap_TAIItem.count); - S1ap_TAIItem_t s1ap_TAIItem; - memset (&s1ap_TAIItem, 0, sizeof(S1ap_TAIItem_t)); - - memcpy(&s1ap_TAIItem, paging_p->taiList.s1ap_TAIItem.array[i], sizeof(S1ap_TAIItem_t)); - - TBCD_TO_MCC_MNC(&s1ap_TAIItem.tAI.pLMNidentity, S1AP_PAGING_IND(message_p).plmn_identity[i].mcc, - S1AP_PAGING_IND(message_p).plmn_identity[i].mnc, - S1AP_PAGING_IND(message_p).plmn_identity[i].mnc_digit_length); - OCTET_STRING_TO_INT16(&s1ap_TAIItem.tAI.tAC, S1AP_PAGING_IND(message_p).tac[i]); - S1AP_PAGING_IND(message_p).tai_size++; - S1AP_DEBUG("[SCTP %d] Received Paging: MCC %d, MNC %d, TAC %d\n", assoc_id, S1AP_PAGING_IND(message_p).plmn_identity[i].mcc, S1AP_PAGING_IND(message_p).plmn_identity[i].mnc, S1AP_PAGING_IND(message_p).tac[i]); + for (int i = 0; i < ie->value.choice.TAIList.list.count; i++) { + S1AP_TAIItem_t *item_p; + item_p = &(((S1AP_TAIItemIEs_t *)ie->value.choice.TAIList.list.array[i])->value.choice.TAIItem); + TBCD_TO_MCC_MNC(&(item_p->tAI.pLMNidentity), S1AP_PAGING_IND(message_p).plmn_identity[i].mcc, + S1AP_PAGING_IND(message_p).plmn_identity[i].mnc, + S1AP_PAGING_IND(message_p).plmn_identity[i].mnc_digit_length); + OCTET_STRING_TO_INT16(&(item_p->tAI.tAC), S1AP_PAGING_IND(message_p).tac[i]); + S1AP_PAGING_IND(message_p).tai_size++; + S1AP_DEBUG("[SCTP %d] Received Paging: MCC %d, MNC %d, TAC %d\n", assoc_id, + S1AP_PAGING_IND(message_p).plmn_identity[i].mcc, + S1AP_PAGING_IND(message_p).plmn_identity[i].mnc, + S1AP_PAGING_IND(message_p).tac[i]); } #if 0 - // CSG Id(optional) List is not used + + // CSG Id(optional) List is not used if (paging_p->presenceMask & S1AP_PAGINGIES_CSG_IDLIST_PRESENT) { - // TODO + // TODO } /* convert pagingPriority (optional) if has value */ if (paging_p->presenceMask & S1AP_PAGINGIES_PAGINGPRIORITY_PRESENT) { - switch(paging_p->pagingPriority) { - case S1ap_PagingPriority_priolevel1: - S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL1; + switch(paging_p->pagingPriority) { + case S1AP_PagingPriority_priolevel1: + S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL1; break; - case S1ap_PagingPriority_priolevel2: - S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL2; + + case S1AP_PagingPriority_priolevel2: + S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL2; break; - case S1ap_PagingPriority_priolevel3: - S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL3; + + case S1AP_PagingPriority_priolevel3: + S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL3; break; - case S1ap_PagingPriority_priolevel4: - S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL4; + + case S1AP_PagingPriority_priolevel4: + S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL4; break; - case S1ap_PagingPriority_priolevel5: - S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL5; + + case S1AP_PagingPriority_priolevel5: + S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL5; break; - case S1ap_PagingPriority_priolevel6: - S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL6; + + case S1AP_PagingPriority_priolevel6: + S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL6; break; - case S1ap_PagingPriority_priolevel7: - S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL7; + + case S1AP_PagingPriority_priolevel7: + S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL7; break; - case S1ap_PagingPriority_priolevel8: - S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL8; + + case S1AP_PagingPriority_priolevel8: + S1AP_PAGING_IND(message_p).paging_priority = PAGING_PRIO_LEVEL8; break; + default: /* invalid paging_p->pagingPriority */ S1AP_ERROR("[SCTP %d] Received paging : pagingPriority(%ld) is invalid\n", assoc_id, paging_p->pagingPriority); return -1; - } + } } + #endif //paging parameter values S1AP_DEBUG("[SCTP %d] Received Paging parameters: ue_index_value %d cn_domain %d paging_drx %d paging_priority %d\n",assoc_id, - S1AP_PAGING_IND(message_p).ue_index_value, S1AP_PAGING_IND(message_p).cn_domain, - S1AP_PAGING_IND(message_p).paging_drx, S1AP_PAGING_IND(message_p).paging_priority); + S1AP_PAGING_IND(message_p).ue_index_value, S1AP_PAGING_IND(message_p).cn_domain, + S1AP_PAGING_IND(message_p).paging_drx, S1AP_PAGING_IND(message_p).paging_priority); S1AP_DEBUG("[SCTP %d] Received Paging parameters(ue): presenceMask %d s_tmsi.m_tmsi %d s_tmsi.mme_code %d IMSI length %d (0-5) %d%d%d%d%d%d\n",assoc_id, - S1AP_PAGING_IND(message_p).ue_paging_identity.presenceMask, S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi, - S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code, S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length, - S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[0], S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[1], - S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2], S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[3], - S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[4], S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[5]); - + S1AP_PAGING_IND(message_p).ue_paging_identity.presenceMask, S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.m_tmsi, + S1AP_PAGING_IND(message_p).ue_paging_identity.choice.s_tmsi.mme_code, S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.length, + S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[0], S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[1], + S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[2], S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[3], + S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[4], S1AP_PAGING_IND(message_p).ue_paging_identity.choice.imsi.buffer[5]); /* send message to RRC */ itti_send_msg_to_task(TASK_RRC_ENB, s1ap_eNB_instance->instance, message_p); - - return 0; + return 0; } static int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, - uint32_t stream, - struct s1ap_message_s *s1ap_message_p) { - + uint32_t stream, + S1AP_S1AP_PDU_t *pdu) +{ int i; - - s1ap_eNB_mme_data_t *mme_desc_p = NULL; - s1ap_eNB_ue_context_t *ue_desc_p = NULL; - MessageDef *message_p = NULL; - int nb_of_e_rabs_failed = 0; - - S1ap_E_RABModifyRequestIEs_t *s1ap_E_RABModifyRequest; - DevAssert(s1ap_message_p != NULL); - - s1ap_E_RABModifyRequest = &s1ap_message_p->msg.s1ap_E_RABModifyRequestIEs; + s1ap_eNB_mme_data_t *mme_desc_p = NULL; + s1ap_eNB_ue_context_t *ue_desc_p = NULL; + MessageDef *message_p = NULL; + S1AP_E_RABModifyRequest_t *container; + S1AP_E_RABModifyRequestIEs_t *ie; + S1AP_ENB_UE_S1AP_ID_t enb_ue_s1ap_id; + DevAssert(pdu != NULL); + container = &pdu->choice.initiatingMessage.value.choice.E_RABModifyRequest; if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { S1AP_ERROR("[SCTP %d] Received E-RAB modify request for non " @@ -1213,12 +1314,15 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, return -1; } + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABModifyRequestIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, TRUE); + enb_ue_s1ap_id = ie->value.choice.ENB_UE_S1AP_ID; if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_desc_p->s1ap_eNB_instance, - s1ap_E_RABModifyRequest->eNB_UE_S1AP_ID)) == NULL) { + ie->value.choice.ENB_UE_S1AP_ID)) == NULL) { S1AP_ERROR("[SCTP %d] Received E-RAB modify request for non " "existing UE context 0x%06lx\n", assoc_id, - s1ap_E_RABModifyRequest->eNB_UE_S1AP_ID); + ie->value.choice.ENB_UE_S1AP_ID); return -1; } @@ -1230,54 +1334,51 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, } ue_desc_p->rx_stream = stream; + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABModifyRequestIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID, TRUE); - if ( ue_desc_p->mme_ue_s1ap_id != s1ap_E_RABModifyRequest->mme_ue_s1ap_id){ + if (ue_desc_p->mme_ue_s1ap_id != ie->value.choice.MME_UE_S1AP_ID) { S1AP_WARN("UE context mme_ue_s1ap_id is different form that of the message (%d != %ld)", - ue_desc_p->mme_ue_s1ap_id, s1ap_E_RABModifyRequest->mme_ue_s1ap_id); + ue_desc_p->mme_ue_s1ap_id, ie->value.choice.MME_UE_S1AP_ID); message_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_E_RAB_MODIFY_RESP); + S1AP_E_RAB_MODIFY_RESP (message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id; + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABModifyRequestIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_E_RABToBeModifiedListBearerModReq, TRUE); - S1AP_E_RAB_MODIFY_RESP (message_p).eNB_ue_s1ap_id = s1ap_E_RABModifyRequest->eNB_UE_S1AP_ID; -// S1AP_E_RAB_MODIFY_RESP (msg_fail_p).e_rabs[S1AP_MAX_E_RAB]; - S1AP_E_RAB_MODIFY_RESP (message_p).nb_of_e_rabs = 0; - - for(nb_of_e_rabs_failed = 0; nb_of_e_rabs_failed < s1ap_E_RABModifyRequest->e_RABToBeModifiedListBearerModReq.s1ap_E_RABToBeModifiedItemBearerModReq.count; nb_of_e_rabs_failed++) { - S1AP_E_RAB_MODIFY_RESP (message_p).e_rabs_failed[nb_of_e_rabs_failed].e_rab_id = - ((S1ap_E_RABToBeModifiedItemBearerModReq_t *)s1ap_E_RABModifyRequest->e_RABToBeModifiedListBearerModReq.s1ap_E_RABToBeModifiedItemBearerModReq.array[nb_of_e_rabs_failed])->e_RAB_ID; - S1AP_E_RAB_MODIFY_RESP (message_p).e_rabs_failed[nb_of_e_rabs_failed].cause = S1AP_CAUSE_RADIO_NETWORK; - S1AP_E_RAB_MODIFY_RESP (message_p).e_rabs_failed[nb_of_e_rabs_failed].cause_value = 13;//S1ap_CauseRadioNetwork_unknown_mme_ue_s1ap_id; + for(i = 0; i < ie->value.choice.E_RABToBeModifiedListBearerModReq.list.count; i++) { + S1AP_E_RABToBeModifiedItemBearerModReq_t *item_p; + item_p = &(((S1AP_E_RABToBeModifiedItemBearerModReqIEs_t *) + ie->value.choice.E_RABToBeModifiedListBearerModReq.list.array[i])->value.choice.E_RABToBeModifiedItemBearerModReq); + S1AP_E_RAB_MODIFY_RESP(message_p).e_rabs_failed[i].e_rab_id = item_p->e_RAB_ID; + S1AP_E_RAB_MODIFY_RESP(message_p).e_rabs_failed[i].cause = S1AP_Cause_PR_radioNetwork; + S1AP_E_RAB_MODIFY_RESP(message_p).e_rabs_failed[i].cause_value = S1AP_CauseRadioNetwork_unknown_mme_ue_s1ap_id; } - S1AP_E_RAB_MODIFY_RESP (message_p).nb_of_e_rabs_failed = nb_of_e_rabs_failed; + S1AP_E_RAB_MODIFY_RESP(message_p).nb_of_e_rabs_failed = ie->value.choice.E_RABToBeModifiedListBearerModReq.list.count; s1ap_eNB_e_rab_modify_resp(mme_desc_p->s1ap_eNB_instance->instance, &S1AP_E_RAB_MODIFY_RESP(message_p)); - message_p = NULL; return -1; } message_p = itti_alloc_new_message(TASK_S1AP, S1AP_E_RAB_MODIFY_REQ); - S1AP_E_RAB_MODIFY_REQ(message_p).ue_initial_id = ue_desc_p->ue_initial_id; - - S1AP_E_RAB_MODIFY_REQ(message_p).mme_ue_s1ap_id = s1ap_E_RABModifyRequest->mme_ue_s1ap_id; - S1AP_E_RAB_MODIFY_REQ(message_p).eNB_ue_s1ap_id = s1ap_E_RABModifyRequest->eNB_UE_S1AP_ID; - + S1AP_E_RAB_MODIFY_REQ(message_p).mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID; + S1AP_E_RAB_MODIFY_REQ(message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id; + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABModifyRequestIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_E_RABToBeModifiedListBearerModReq, TRUE); S1AP_E_RAB_MODIFY_REQ(message_p).nb_e_rabs_tomodify = - s1ap_E_RABModifyRequest->e_RABToBeModifiedListBearerModReq.s1ap_E_RABToBeModifiedItemBearerModReq.count; - - for (i = 0; i < s1ap_E_RABModifyRequest->e_RABToBeModifiedListBearerModReq.s1ap_E_RABToBeModifiedItemBearerModReq.count; i++) { - S1ap_E_RABToBeModifiedItemBearerModReq_t *item_p; - - item_p = (S1ap_E_RABToBeModifiedItemBearerModReq_t *)s1ap_E_RABModifyRequest->e_RABToBeModifiedListBearerModReq.s1ap_E_RABToBeModifiedItemBearerModReq.array[i]; + ie->value.choice.E_RABToBeModifiedListBearerModReq.list.count; + for (i = 0; i < ie->value.choice.E_RABToBeModifiedListBearerModReq.list.count; i++) { + S1AP_E_RABToBeModifiedItemBearerModReq_t *item_p; + item_p = &(((S1AP_E_RABToBeModifiedItemBearerModReqIEs_t *)ie->value.choice.E_RABToBeModifiedListBearerModReq.list.array[i])->value.choice.E_RABToBeModifiedItemBearerModReq); S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].e_rab_id = item_p->e_RAB_ID; // check for the NAS PDU if (item_p->nAS_PDU.size > 0 ) { S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.length = item_p->nAS_PDU.size; - S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.buffer = malloc(sizeof(uint8_t) * item_p->nAS_PDU.size); - memcpy(S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].nas_pdu.buffer, item_p->nAS_PDU.buf, item_p->nAS_PDU.size); } else { @@ -1288,44 +1389,46 @@ int s1ap_eNB_handle_e_rab_modify_request(uint32_t assoc_id, /* Set the QOS informations */ S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.qci = item_p->e_RABLevelQoSParameters.qCI; - S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.priority_level = item_p->e_RABLevelQoSParameters.allocationRetentionPriority.priorityLevel; S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.pre_emp_capability = item_p->e_RABLevelQoSParameters.allocationRetentionPriority.pre_emptionCapability; S1AP_E_RAB_MODIFY_REQ(message_p).e_rab_modify_params[i].qos.allocation_retention_priority.pre_emp_vulnerability = item_p->e_RABLevelQoSParameters.allocationRetentionPriority.pre_emptionVulnerability; - } itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); - return 0; } // handle e-rab release command and send it to rrc_end static int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id, - uint32_t stream, - struct s1ap_message_s *s1ap_message_p) { - + uint32_t stream, + S1AP_S1AP_PDU_t *pdu) +{ int i; - s1ap_eNB_mme_data_t *mme_desc_p = NULL; s1ap_eNB_ue_context_t *ue_desc_p = NULL; MessageDef *message_p = NULL; + S1AP_E_RABReleaseCommand_t *container; + S1AP_E_RABReleaseCommandIEs_t *ie; + S1AP_ENB_UE_S1AP_ID_t enb_ue_s1ap_id; + DevAssert(pdu != NULL); + container = &pdu->choice.initiatingMessage.value.choice.E_RABReleaseCommand; - S1ap_E_RABReleaseCommandIEs_t *s1ap_E_RABReleaseCommand; - DevAssert(s1ap_message_p != NULL); - s1ap_E_RABReleaseCommand = &s1ap_message_p->msg.s1ap_E_RABReleaseCommandIEs; - if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { S1AP_ERROR("[SCTP %d] Received E-RAB release command for non existing MME context\n", assoc_id); return -1; } + + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABReleaseCommandIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, TRUE); + enb_ue_s1ap_id = ie->value.choice.ENB_UE_S1AP_ID; + if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_desc_p->s1ap_eNB_instance, - s1ap_E_RABReleaseCommand->eNB_UE_S1AP_ID)) == NULL) { + ie->value.choice.ENB_UE_S1AP_ID)) == NULL) { S1AP_ERROR("[SCTP %d] Received E-RAB release command for non existing UE context 0x%06lx\n", assoc_id, - s1ap_E_RABReleaseCommand->eNB_UE_S1AP_ID); + ie->value.choice.ENB_UE_S1AP_ID); return -1; } @@ -1337,42 +1440,45 @@ int s1ap_eNB_handle_e_rab_release_command(uint32_t assoc_id, } ue_desc_p->rx_stream = stream; + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABReleaseCommandIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID, TRUE); - if ( ue_desc_p->mme_ue_s1ap_id != s1ap_E_RABReleaseCommand->mme_ue_s1ap_id){ + if (ue_desc_p->mme_ue_s1ap_id != ie->value.choice.MME_UE_S1AP_ID) { S1AP_WARN("UE context mme_ue_s1ap_id is different form that of the message (%d != %ld)", - ue_desc_p->mme_ue_s1ap_id, s1ap_E_RABReleaseCommand->mme_ue_s1ap_id); + ue_desc_p->mme_ue_s1ap_id, ie->value.choice.MME_UE_S1AP_ID); } S1AP_DEBUG("[SCTP %d] Received E-RAB release command for eNB_UE_S1AP_ID %ld mme_ue_s1ap_id %ld\n", - assoc_id, s1ap_E_RABReleaseCommand->eNB_UE_S1AP_ID, s1ap_E_RABReleaseCommand->mme_ue_s1ap_id); - - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_E_RAB_RELEASE_COMMAND); - - S1AP_E_RAB_RELEASE_COMMAND(message_p).eNB_ue_s1ap_id = s1ap_E_RABReleaseCommand->eNB_UE_S1AP_ID; - S1AP_E_RAB_RELEASE_COMMAND(message_p).mme_ue_s1ap_id = s1ap_E_RABReleaseCommand->mme_ue_s1ap_id; - if(s1ap_E_RABReleaseCommand->nas_pdu.size > 0 ){ - S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.length = s1ap_E_RABReleaseCommand->nas_pdu.size; + assoc_id, enb_ue_s1ap_id, ie->value.choice.MME_UE_S1AP_ID); + message_p = itti_alloc_new_message(TASK_S1AP, S1AP_E_RAB_RELEASE_COMMAND); + S1AP_E_RAB_RELEASE_COMMAND(message_p).eNB_ue_s1ap_id = enb_ue_s1ap_id; + S1AP_E_RAB_RELEASE_COMMAND(message_p).mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID; + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABReleaseCommandIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_NAS_PDU, FALSE); + if(ie && ie->value.choice.NAS_PDU.size > 0) { + S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.length = ie->value.choice.NAS_PDU.size; S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer = - malloc(sizeof(uint8_t) * s1ap_E_RABReleaseCommand->nas_pdu.size); - + malloc(sizeof(uint8_t) * ie->value.choice.NAS_PDU.size); memcpy(S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer, - s1ap_E_RABReleaseCommand->nas_pdu.buf, - s1ap_E_RABReleaseCommand->nas_pdu.size); + ie->value.choice.NAS_PDU.buf, + ie->value.choice.NAS_PDU.size); } else { - S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.length = 0; - S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer = NULL; + S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.length = 0; + S1AP_E_RAB_RELEASE_COMMAND(message_p).nas_pdu.buffer = NULL; } - S1AP_E_RAB_RELEASE_COMMAND(message_p).nb_e_rabs_torelease = s1ap_E_RABReleaseCommand->e_RABToBeReleasedList.s1ap_E_RABItem.count; - for(i=0; i < s1ap_E_RABReleaseCommand->e_RABToBeReleasedList.s1ap_E_RABItem.count; i++){ - S1ap_E_RABItem_t *item_p; - item_p = (S1ap_E_RABItem_t*)s1ap_E_RABReleaseCommand->e_RABToBeReleasedList.s1ap_E_RABItem.array[i]; - S1AP_E_RAB_RELEASE_COMMAND(message_p).e_rab_release_params[i].e_rab_id = item_p->e_RAB_ID; - S1AP_DEBUG("[SCTP] Received E-RAB release command for e-rab id %ld\n", item_p->e_RAB_ID); + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_E_RABReleaseCommandIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_E_RABToBeReleasedList, TRUE); + S1AP_E_RAB_RELEASE_COMMAND(message_p).nb_e_rabs_torelease = ie->value.choice.E_RABList.list.count; + + for (i = 0; i < ie->value.choice.E_RABList.list.count; i++) { + S1AP_E_RABItem_t *item_p; + item_p = &(((S1AP_E_RABItemIEs_t *)ie->value.choice.E_RABList.list.array[i])->value.choice.E_RABItem); + S1AP_E_RAB_RELEASE_COMMAND(message_p).e_rab_release_params[i].e_rab_id = item_p->e_RAB_ID; + S1AP_DEBUG("[SCTP] Received E-RAB release command for e-rab id %ld\n", item_p->e_RAB_ID); } itti_send_msg_to_task(TASK_RRC_ENB, ue_desc_p->eNB_instance->instance, message_p); - return 0; } diff --git a/openair3/S1AP/s1ap_eNB_nas_procedures.c b/openair3/S1AP/s1ap_eNB_nas_procedures.c index d6d9b52c07..3ce4eb17fb 100644 --- a/openair3/S1AP/s1ap_eNB_nas_procedures.c +++ b/openair3/S1AP/s1ap_eNB_nas_procedures.c @@ -21,7 +21,7 @@ /*! \file s1ap_eNB_nas_procedures.c * \brief S1AP eNb NAS procedure handler - * \author S. Roux and Navid Nikaein + * \author S. Roux and Navid Nikaein * \date 2010 - 2015 * \email: navid.nikaein@eurecom.fr * \version 1.0 @@ -41,7 +41,6 @@ #include "s1ap_eNB_itti_messaging.h" -#include "s1ap_ies_defs.h" #include "s1ap_eNB_encoder.h" #include "s1ap_eNB_nnsf.h" #include "s1ap_eNB_ue_context.h" @@ -57,26 +56,21 @@ int s1ap_eNB_handle_nas_first_req( s1ap_eNB_instance_t *instance_p = NULL; struct s1ap_eNB_mme_data_s *mme_desc_p = NULL; struct s1ap_eNB_ue_context_s *ue_desc_p = NULL; - - s1ap_message message; - - S1ap_InitialUEMessageIEs_t *initial_ue_message_p = NULL; - + S1AP_S1AP_PDU_t pdu; + S1AP_InitialUEMessage_t *out; + S1AP_InitialUEMessage_IEs_t *ie; uint8_t *buffer = NULL; uint32_t length = 0; - DevAssert(s1ap_nas_first_req_p != NULL); - /* Retrieve the S1AP eNB instance associated with Mod_id */ instance_p = s1ap_eNB_get_instance(instance); DevAssert(instance_p != NULL); - - memset(&message, 0, sizeof(s1ap_message)); - - message.direction = S1AP_PDU_PR_initiatingMessage; - message.procedureCode = S1ap_ProcedureCode_id_initialUEMessage; - - initial_ue_message_p = &message.msg.s1ap_InitialUEMessageIEs; + memset(&pdu, 0, sizeof(pdu)); + pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_initialUEMessage; + pdu.choice.initiatingMessage.criticality = S1AP_Criticality_ignore; + pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_InitialUEMessage; + out = &pdu.choice.initiatingMessage.value.choice.InitialUEMessage; /* Select the MME corresponding to the provided GUMMEI. */ if (s1ap_nas_first_req_p->ue_identity.presenceMask & UE_IDENTITIES_gummei) { @@ -111,7 +105,6 @@ int s1ap_eNB_handle_nas_first_req( * In case eNB has no MME associated, the eNB should inform RRC and discard * this request. */ - S1AP_WARN("No MME is associated to the eNB\n"); // TODO: Inform RRC return -1; @@ -122,7 +115,6 @@ int s1ap_eNB_handle_nas_first_req( */ ue_desc_p = s1ap_eNB_allocate_new_UE_context(); DevAssert(ue_desc_p != NULL); - /* Keep a reference to the selected MME */ ue_desc_p->mme_ref = mme_desc_p; ue_desc_p->ue_initial_id = s1ap_nas_first_req_p->ue_initial_id; @@ -130,7 +122,6 @@ int s1ap_eNB_handle_nas_first_req( do { struct s1ap_eNB_ue_context_s *collision_p; - /* Peek a random value for the eNB_ue_s1ap_id */ ue_desc_p->eNB_ue_s1ap_id = (random() + random()) & 0x00ffffff; @@ -144,70 +135,239 @@ int s1ap_eNB_handle_nas_first_req( } } while(1); - initial_ue_message_p->eNB_UE_S1AP_ID = ue_desc_p->eNB_ue_s1ap_id; - /* Prepare the NAS PDU */ - initial_ue_message_p->nas_pdu.buf = s1ap_nas_first_req_p->nas_pdu.buffer; - initial_ue_message_p->nas_pdu.size = s1ap_nas_first_req_p->nas_pdu.length; - - /* Set the establishment cause according to those provided by RRC */ - DevCheck(s1ap_nas_first_req_p->establishment_cause < RRC_CAUSE_LAST, - s1ap_nas_first_req_p->establishment_cause, RRC_CAUSE_LAST, 0); - initial_ue_message_p->rrC_Establishment_Cause = s1ap_nas_first_req_p->establishment_cause; - - if (s1ap_nas_first_req_p->ue_identity.presenceMask & UE_IDENTITIES_s_tmsi) { - S1AP_DEBUG("S_TMSI_PRESENT\n"); - initial_ue_message_p->presenceMask |= S1AP_INITIALUEMESSAGEIES_S_TMSI_PRESENT; - - MME_CODE_TO_OCTET_STRING(s1ap_nas_first_req_p->ue_identity.s_tmsi.mme_code, - &initial_ue_message_p->s_tmsi.mMEC); - M_TMSI_TO_OCTET_STRING(s1ap_nas_first_req_p->ue_identity.s_tmsi.m_tmsi, - &initial_ue_message_p->s_tmsi.m_TMSI); - } - - if (s1ap_nas_first_req_p->ue_identity.presenceMask & UE_IDENTITIES_gummei) { - S1AP_DEBUG("GUMMEI_ID_PRESENT\n"); - initial_ue_message_p->presenceMask |= S1AP_INITIALUEMESSAGEIES_GUMMEI_ID_PRESENT; - - MCC_MNC_TO_PLMNID( - s1ap_nas_first_req_p->ue_identity.gummei.mcc, - s1ap_nas_first_req_p->ue_identity.gummei.mnc, - s1ap_nas_first_req_p->ue_identity.gummei.mnc_len, - &initial_ue_message_p->gummei_id.pLMN_Identity); - - MME_GID_TO_OCTET_STRING(s1ap_nas_first_req_p->ue_identity.gummei.mme_group_id, - &initial_ue_message_p->gummei_id.mME_Group_ID); - MME_CODE_TO_OCTET_STRING(s1ap_nas_first_req_p->ue_identity.gummei.mme_code, - &initial_ue_message_p->gummei_id.mME_Code); - } - + /* mandatory */ + ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_ENB_UE_S1AP_ID; + ie->value.choice.ENB_UE_S1AP_ID = ue_desc_p->eNB_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* mandatory */ + ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_NAS_PDU; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_NAS_PDU; + ie->value.choice.NAS_PDU.buf = s1ap_nas_first_req_p->nas_pdu.buffer; + ie->value.choice.NAS_PDU.size = s1ap_nas_first_req_p->nas_pdu.length; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* mandatory */ + ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_ENB_UE_S1AP_ID; + ie->value.choice.ENB_UE_S1AP_ID = ue_desc_p->eNB_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* mandatory */ + ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_TAI; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_TAI; /* Assuming TAI is the TAI from the cell */ - INT16_TO_OCTET_STRING(instance_p->tac, &initial_ue_message_p->tai.tAC); + INT16_TO_OCTET_STRING(instance_p->tac, &ie->value.choice.TAI.tAC); MCC_MNC_TO_PLMNID(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length, - &initial_ue_message_p->tai.pLMNidentity); - + &ie->value.choice.TAI.pLMNidentity); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* mandatory */ + ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_EUTRAN_CGI; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_EUTRAN_CGI; /* Set the EUTRAN CGI * The cell identity is defined on 28 bits but as we use macro enb id, * we have to pad. */ -//#warning "TODO get cell id from RRC" + //#warning "TODO get cell id from RRC" MACRO_ENB_ID_TO_CELL_IDENTITY(instance_p->eNB_id, - 0, // Cell ID - &initial_ue_message_p->eutran_cgi.cell_ID); + 0, // Cell ID + &ie->value.choice.EUTRAN_CGI.cell_ID); MCC_MNC_TO_TBCD(instance_p->mcc, instance_p->mnc, instance_p->mnc_digit_length, - &initial_ue_message_p->eutran_cgi.pLMNidentity); + &ie->value.choice.EUTRAN_CGI.pLMNidentity); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* Set the establishment cause according to those provided by RRC */ + DevCheck(s1ap_nas_first_req_p->establishment_cause < RRC_CAUSE_LAST, + s1ap_nas_first_req_p->establishment_cause, RRC_CAUSE_LAST, 0); + /* mandatory */ + ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_RRC_Establishment_Cause; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_RRC_Establishment_Cause; + ie->value.choice.RRC_Establishment_Cause = s1ap_nas_first_req_p->establishment_cause; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) { + /* optional */ + if (s1ap_nas_first_req_p->ue_identity.presenceMask & UE_IDENTITIES_s_tmsi) { + S1AP_DEBUG("S_TMSI_PRESENT\n"); + ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_S_TMSI; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_S_TMSI; + MME_CODE_TO_OCTET_STRING(s1ap_nas_first_req_p->ue_identity.s_tmsi.mme_code, + &ie->value.choice.S_TMSI.mMEC); + M_TMSI_TO_OCTET_STRING(s1ap_nas_first_req_p->ue_identity.s_tmsi.m_tmsi, + &ie->value.choice.S_TMSI.m_TMSI); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + if (0) { + ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_CSG_Id; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_CSG_Id; + // ie->value.choice.CSG_Id = ; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + if (s1ap_nas_first_req_p->ue_identity.presenceMask & UE_IDENTITIES_gummei) { + S1AP_DEBUG("GUMMEI_ID_PRESENT\n"); + ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_GUMMEI_ID; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_GUMMEI; + MCC_MNC_TO_PLMNID( + s1ap_nas_first_req_p->ue_identity.gummei.mcc, + s1ap_nas_first_req_p->ue_identity.gummei.mnc, + s1ap_nas_first_req_p->ue_identity.gummei.mnc_len, + &ie->value.choice.GUMMEI.pLMN_Identity); + MME_GID_TO_OCTET_STRING(s1ap_nas_first_req_p->ue_identity.gummei.mme_group_id, + &ie->value.choice.GUMMEI.mME_Group_ID); + MME_CODE_TO_OCTET_STRING(s1ap_nas_first_req_p->ue_identity.gummei.mme_code, + &ie->value.choice.GUMMEI.mME_Code); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + if (0) { + ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_CellAccessMode; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_CellAccessMode; + // ie->value.choice.CellAccessMode = ; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + if (0) { + ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_GW_TransportLayerAddress; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_TransportLayerAddress; + // ie->value.choice.TransportLayerAddress =; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + if (0) { + ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_RelayNode_Indicator; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_RelayNode_Indicator; + // ie->value.choice.RelayNode_Indicator =; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + if (0) { + ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_GUMMEIType; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_GUMMEIType; + // ie->value.choice.GUMMEIType =; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ /* release 11 */ + if (0) { + ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_Tunnel_Information_for_BBF; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_TunnelInformation; + // ie->value.choice.TunnelInformation =; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + if (0) { + ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_SIPTO_L_GW_TransportLayerAddress; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_TransportLayerAddress; + // ie->value.choice.TransportLayerAddress = ; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + if (0) { + ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_LHN_ID; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_LHN_ID; + // ie->value.choice.LHN_ID = ue_release_req_p->eNB_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + if (0) { + ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_MME_Group_ID; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_MME_Group_ID; + // ie->value.choice.MME_Group_ID =; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + if (0) { + ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_UE_Usage_Type; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_UE_Usage_Type; + // ie->value.choice.UE_Usage_Type =; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + if (0) { + ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_CE_mode_B_SupportIndicator; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_CE_mode_B_SupportIndicator; + // ie->value.choice.CE_mode_B_SupportIndicator = ; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + if (0) { + ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_DCN_ID; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_DCN_ID; + // ie->value.choice.DCN_ID = ; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + if (0) { + ie = (S1AP_InitialUEMessage_IEs_t *)calloc(1, sizeof(S1AP_InitialUEMessage_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_Coverage_Level; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_InitialUEMessage_IEs__value_PR_Coverage_Level; + // ie->value.choice.Coverage_Level = ue_release_req_p->eNB_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) { /* Failed to encode message */ DevMessage("Failed to encode initial UE message\n"); } /* Update the current S1AP UE state */ ue_desc_p->ue_state = S1AP_UE_WAITING_CSR; - /* Assign a stream for this UE : * From 3GPP 36.412 7)Transport layers: * Within the SCTP association established between one MME and eNB pair: @@ -227,7 +387,6 @@ int s1ap_eNB_handle_nas_first_req( } ue_desc_p->tx_stream = mme_desc_p->nextstream; - MSC_LOG_TX_MESSAGE( MSC_S1AP_ENB, MSC_S1AP_MME, @@ -236,29 +395,26 @@ int s1ap_eNB_handle_nas_first_req( MSC_AS_TIME_FMT" initialUEMessage initiatingMessage eNB_ue_s1ap_id %u", 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), initial_ue_message_p->eNB_UE_S1AP_ID); - /* Send encoded message over sctp */ s1ap_eNB_itti_send_sctp_data_req(instance_p->instance, mme_desc_p->assoc_id, buffer, length, ue_desc_p->tx_stream); - return 0; } //------------------------------------------------------------------------------ -int s1ap_eNB_handle_nas_downlink(const uint32_t assoc_id, - const uint32_t stream, - struct s1ap_message_s* message_p) +int s1ap_eNB_handle_nas_downlink(uint32_t assoc_id, + uint32_t stream, + S1AP_S1AP_PDU_t *pdu) //------------------------------------------------------------------------------ { - const S1ap_DownlinkNASTransportIEs_t *downlink_NAS_transport_p = NULL; - - s1ap_eNB_mme_data_t *mme_desc_p = NULL; - s1ap_eNB_ue_context_t *ue_desc_p = NULL; - s1ap_eNB_instance_t *s1ap_eNB_instance = NULL; - - DevAssert(message_p != NULL); - - downlink_NAS_transport_p = &message_p->msg.s1ap_DownlinkNASTransportIEs; + s1ap_eNB_mme_data_t *mme_desc_p = NULL; + s1ap_eNB_ue_context_t *ue_desc_p = NULL; + s1ap_eNB_instance_t *s1ap_eNB_instance = NULL; + S1AP_DownlinkNASTransport_t *container; + S1AP_DownlinkNASTransport_IEs_t *ie; + S1AP_ENB_UE_S1AP_ID_t enb_ue_s1ap_id; + S1AP_MME_UE_S1AP_ID_t mme_ue_s1ap_id; + DevAssert(pdu != NULL); /* UE-related procedure -> stream != 0 */ if (stream == 0) { @@ -275,19 +431,26 @@ int s1ap_eNB_handle_nas_downlink(const uint32_t assoc_id, } s1ap_eNB_instance = mme_desc_p->s1ap_eNB_instance; + /* Prepare the S1AP message to encode */ + container = &pdu->choice.initiatingMessage.value.choice.DownlinkNASTransport; + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_DownlinkNASTransport_IEs_t, ie, container, + S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID, TRUE); + mme_ue_s1ap_id = ie->value.choice.MME_UE_S1AP_ID; + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_DownlinkNASTransport_IEs_t, ie, container, + S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, TRUE); + enb_ue_s1ap_id = ie->value.choice.ENB_UE_S1AP_ID; if ((ue_desc_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance, - downlink_NAS_transport_p->eNB_UE_S1AP_ID)) == NULL) { + ie->value.choice.ENB_UE_S1AP_ID)) == NULL) { MSC_LOG_RX_DISCARDED_MESSAGE( MSC_S1AP_ENB, MSC_S1AP_MME, (const char *)downlink_NAS_transport_p, - sizeof(S1ap_DownlinkNASTransportIEs_t), + sizeof(S1AP_DownlinkNASTransportIEs_t), MSC_AS_TIME_FMT" downlinkNASTransport eNB_ue_s1ap_id %u mme_ue_s1ap_id %u", 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - downlink_NAS_transport_p->eNB_UE_S1AP_ID, - downlink_NAS_transport_p->mme_ue_s1ap_id); - + enb_ue_s1ap_id + mme_ue_s1ap_id); /* TODO: fix this log - the original version is suspicious (twice downlink_NAS_transport_p->eNB_UE_S1AP_ID?) */ /*S1AP_ERROR("[SCTP %d] Received NAS downlink message for non existing UE context eNB_UE_S1AP_ID: 0x%"PRIx32" %u\n", assoc_id, @@ -295,12 +458,12 @@ int s1ap_eNB_handle_nas_downlink(const uint32_t assoc_id, downlink_NAS_transport_p->eNB_UE_S1AP_ID);*/ S1AP_ERROR("[SCTP %d] Received NAS downlink message for non existing UE context eNB_UE_S1AP_ID: 0x%lx\n", assoc_id, - downlink_NAS_transport_p->eNB_UE_S1AP_ID); + enb_ue_s1ap_id); return -1; } if (0 == ue_desc_p->rx_stream) { - ue_desc_p->rx_stream = stream; + ue_desc_p->rx_stream = stream; } else if (stream != ue_desc_p->rx_stream) { S1AP_ERROR("[SCTP %d] Received UE-related procedure on stream %u, expecting %u\n", assoc_id, stream, ue_desc_p->rx_stream); @@ -311,13 +474,13 @@ int s1ap_eNB_handle_nas_downlink(const uint32_t assoc_id, * UE s1ap id. */ if (ue_desc_p->mme_ue_s1ap_id == 0) { - ue_desc_p->mme_ue_s1ap_id = downlink_NAS_transport_p->mme_ue_s1ap_id; + ue_desc_p->mme_ue_s1ap_id = mme_ue_s1ap_id; } else { /* We already have a mme ue s1ap id check the received is the same */ - if (ue_desc_p->mme_ue_s1ap_id != downlink_NAS_transport_p->mme_ue_s1ap_id) { + if (ue_desc_p->mme_ue_s1ap_id != mme_ue_s1ap_id) { S1AP_ERROR("[SCTP %d] Mismatch in MME UE S1AP ID (0x%lx != 0x%"PRIx32"\n", assoc_id, - downlink_NAS_transport_p->mme_ue_s1ap_id, + mme_ue_s1ap_id, ue_desc_p->mme_ue_s1ap_id ); return -1; @@ -328,22 +491,21 @@ int s1ap_eNB_handle_nas_downlink(const uint32_t assoc_id, MSC_S1AP_ENB, MSC_S1AP_MME, (const char *)downlink_NAS_transport_p, - sizeof(S1ap_DownlinkNASTransportIEs_t), + sizeof(S1AP_DownlinkNASTransportIEs_t), MSC_AS_TIME_FMT" downlinkNASTransport eNB_ue_s1ap_id %u mme_ue_s1ap_id %u", 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), - downlink_NAS_transport_p->eNB_UE_S1AP_ID, - downlink_NAS_transport_p->mme_ue_s1ap_id); - + enb_ue_s1ap_id, + mme_ue_s1ap_id); + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_DownlinkNASTransport_IEs_t, ie, container, + S1AP_ProtocolIE_ID_id_NAS_PDU, TRUE); /* Forward the NAS PDU to RRC */ s1ap_eNB_itti_send_nas_downlink_ind(s1ap_eNB_instance->instance, ue_desc_p->ue_initial_id, ue_desc_p->eNB_ue_s1ap_id, - downlink_NAS_transport_p->nas_pdu.buf, - downlink_NAS_transport_p->nas_pdu.size); - + ie->value.choice.NAS_PDU.buf, + ie->value.choice.NAS_PDU.size); // LG: Why set to 0 ?? //ue_desc_p->ue_initial_id = 0; - return 0; } @@ -351,17 +513,14 @@ int s1ap_eNB_handle_nas_downlink(const uint32_t assoc_id, int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_p) //------------------------------------------------------------------------------ { - struct s1ap_eNB_ue_context_s *ue_context_p; - s1ap_eNB_instance_t *s1ap_eNB_instance_p; - S1ap_UplinkNASTransportIEs_t *uplink_NAS_transport_p; - - s1ap_message message; - + struct s1ap_eNB_ue_context_s *ue_context_p; + s1ap_eNB_instance_t *s1ap_eNB_instance_p; + S1AP_S1AP_PDU_t pdu; + S1AP_UplinkNASTransport_t *out; + S1AP_UplinkNASTransport_IEs_t *ie; uint8_t *buffer; - uint32_t length; - + uint32_t length; DevAssert(s1ap_uplink_nas_p != NULL); - /* Retrieve the S1AP eNB instance associated with Mod_id */ s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance); DevAssert(s1ap_eNB_instance_p != NULL); @@ -385,40 +544,93 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_ } /* Prepare the S1AP message to encode */ - memset(&message, 0, sizeof(s1ap_message)); - - message.direction = S1AP_PDU_PR_initiatingMessage; - message.procedureCode = S1ap_ProcedureCode_id_uplinkNASTransport; - - uplink_NAS_transport_p = &message.msg.s1ap_UplinkNASTransportIEs; - - uplink_NAS_transport_p->mme_ue_s1ap_id = ue_context_p->mme_ue_s1ap_id; - uplink_NAS_transport_p->eNB_UE_S1AP_ID = ue_context_p->eNB_ue_s1ap_id; - - uplink_NAS_transport_p->nas_pdu.buf = s1ap_uplink_nas_p->nas_pdu.buffer; - uplink_NAS_transport_p->nas_pdu.size = s1ap_uplink_nas_p->nas_pdu.length; - + memset(&pdu, 0, sizeof(pdu)); + pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_uplinkNASTransport; + pdu.choice.initiatingMessage.criticality = S1AP_Criticality_ignore; + pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_UplinkNASTransport; + out = &pdu.choice.initiatingMessage.value.choice.UplinkNASTransport; + /* mandatory */ + ie = (S1AP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(S1AP_UplinkNASTransport_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_UplinkNASTransport_IEs__value_PR_MME_UE_S1AP_ID; + ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* mandatory */ + ie = (S1AP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(S1AP_UplinkNASTransport_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_UplinkNASTransport_IEs__value_PR_ENB_UE_S1AP_ID; + ie->value.choice.ENB_UE_S1AP_ID = ue_context_p->eNB_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* mandatory */ + ie = (S1AP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(S1AP_UplinkNASTransport_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_NAS_PDU; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_UplinkNASTransport_IEs__value_PR_NAS_PDU; + ie->value.choice.NAS_PDU.buf = s1ap_uplink_nas_p->nas_pdu.buffer; + ie->value.choice.NAS_PDU.size = s1ap_uplink_nas_p->nas_pdu.length; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* mandatory */ + ie = (S1AP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(S1AP_UplinkNASTransport_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_EUTRAN_CGI; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_UplinkNASTransport_IEs__value_PR_EUTRAN_CGI; MCC_MNC_TO_PLMNID( s1ap_eNB_instance_p->mcc, s1ap_eNB_instance_p->mnc, s1ap_eNB_instance_p->mnc_digit_length, - &uplink_NAS_transport_p->eutran_cgi.pLMNidentity); - -//#warning "TODO get cell id from RRC" + &ie->value.choice.EUTRAN_CGI.pLMNidentity); + //#warning "TODO get cell id from RRC" MACRO_ENB_ID_TO_CELL_IDENTITY(s1ap_eNB_instance_p->eNB_id, - 0, - &uplink_NAS_transport_p->eutran_cgi.cell_ID); - - /* MCC/MNC should be repeated in TAI and EUTRAN CGI */ + 0, + &ie->value.choice.EUTRAN_CGI.cell_ID); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* mandatory */ + ie = (S1AP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(S1AP_UplinkNASTransport_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_TAI; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_UplinkNASTransport_IEs__value_PR_TAI; MCC_MNC_TO_PLMNID( s1ap_eNB_instance_p->mcc, s1ap_eNB_instance_p->mnc, s1ap_eNB_instance_p->mnc_digit_length, - &uplink_NAS_transport_p->tai.pLMNidentity); + &ie->value.choice.TAI.pLMNidentity); + TAC_TO_ASN1(s1ap_eNB_instance_p->tac, &ie->value.choice.TAI.tAC); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - TAC_TO_ASN1(s1ap_eNB_instance_p->tac, &uplink_NAS_transport_p->tai.tAC); + /* optional */ + if (0) { + ie = (S1AP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(S1AP_UplinkNASTransport_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_GW_TransportLayerAddress; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_UplinkNASTransport_IEs__value_PR_TransportLayerAddress; + // ie->value.choice.TransportLayerAddress = ; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } - if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) { + /* optional */ + if (0) { + ie = (S1AP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(S1AP_UplinkNASTransport_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_SIPTO_L_GW_TransportLayerAddress; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_UplinkNASTransport_IEs__value_PR_TransportLayerAddress; + // ie->value.choice.TransportLayerAddress = ; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + if (0) { + ie = (S1AP_UplinkNASTransport_IEs_t *)calloc(1, sizeof(S1AP_UplinkNASTransport_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_LHN_ID; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_UplinkNASTransport_IEs__value_PR_LHN_ID; + // ie->value.choice.LHN_ID =; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) { S1AP_ERROR("Failed to encode uplink NAS transport\n"); /* Encode procedure has failed... */ return -1; @@ -433,34 +645,27 @@ int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_ 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), uplink_NAS_transport_p->eNB_UE_S1AP_ID, uplink_NAS_transport_p->mme_ue_s1ap_id); - - /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, length, ue_context_p->tx_stream); - return 0; } //------------------------------------------------------------------------------ -void s1ap_eNB_nas_non_delivery_ind(instance_t instance, - s1ap_nas_non_delivery_ind_t *s1ap_nas_non_delivery_ind) +int s1ap_eNB_nas_non_delivery_ind(instance_t instance, + s1ap_nas_non_delivery_ind_t *s1ap_nas_non_delivery_ind) //------------------------------------------------------------------------------ { - struct s1ap_eNB_ue_context_s *ue_context_p; - s1ap_eNB_instance_t *s1ap_eNB_instance_p; - - S1ap_NASNonDeliveryIndication_IEs_t *nas_non_delivery_p; - - s1ap_message message; - + struct s1ap_eNB_ue_context_s *ue_context_p; + s1ap_eNB_instance_t *s1ap_eNB_instance_p; + S1AP_S1AP_PDU_t pdu; + S1AP_NASNonDeliveryIndication_t *out; + S1AP_NASNonDeliveryIndication_IEs_t *ie; uint8_t *buffer; - uint32_t length; - + uint32_t length; DevAssert(s1ap_nas_non_delivery_ind != NULL); - /* Retrieve the S1AP eNB instance associated with Mod_id */ s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance); DevAssert(s1ap_eNB_instance_p != NULL); @@ -473,35 +678,57 @@ void s1ap_eNB_nas_non_delivery_ind(instance_t instance, MSC_S1AP_ENB, MSC_AS_TIME_FMT" Sent of NAS_NON_DELIVERY_IND to MME failed, no context for eNB_ue_s1ap_id %06x", s1ap_nas_non_delivery_ind->eNB_ue_s1ap_id); - return; + return -1; } /* Prepare the S1AP message to encode */ - memset(&message, 0, sizeof(s1ap_message)); - - message.direction = S1AP_PDU_PR_initiatingMessage; - message.procedureCode = S1ap_ProcedureCode_id_NASNonDeliveryIndication; - - nas_non_delivery_p = &message.msg.s1ap_NASNonDeliveryIndication_IEs; - nas_non_delivery_p->eNB_UE_S1AP_ID = ue_context_p->eNB_ue_s1ap_id; - nas_non_delivery_p->mme_ue_s1ap_id = ue_context_p->mme_ue_s1ap_id; - nas_non_delivery_p->nas_pdu.buf = s1ap_nas_non_delivery_ind->nas_pdu.buffer; - nas_non_delivery_p->nas_pdu.size = s1ap_nas_non_delivery_ind->nas_pdu.length; - + memset(&pdu, 0, sizeof(pdu)); + pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_NASNonDeliveryIndication; + pdu.choice.initiatingMessage.criticality = S1AP_Criticality_ignore; + pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_NASNonDeliveryIndication; + out = &pdu.choice.initiatingMessage.value.choice.NASNonDeliveryIndication; + /* mandatory */ + ie = (S1AP_NASNonDeliveryIndication_IEs_t *)calloc(1, sizeof(S1AP_NASNonDeliveryIndication_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_NASNonDeliveryIndication_IEs__value_PR_MME_UE_S1AP_ID; + ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* mandatory */ + ie = (S1AP_NASNonDeliveryIndication_IEs_t *)calloc(1, sizeof(S1AP_NASNonDeliveryIndication_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_NASNonDeliveryIndication_IEs__value_PR_ENB_UE_S1AP_ID; + ie->value.choice.ENB_UE_S1AP_ID = ue_context_p->eNB_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* mandatory */ + ie = (S1AP_NASNonDeliveryIndication_IEs_t *)calloc(1, sizeof(S1AP_NASNonDeliveryIndication_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_NASNonDeliveryIndication_IEs__value_PR_NAS_PDU; + ie->value.choice.NAS_PDU.buf = s1ap_nas_non_delivery_ind->nas_pdu.buffer; + ie->value.choice.NAS_PDU.size = s1ap_nas_non_delivery_ind->nas_pdu.length; + /* mandatory */ + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + ie = (S1AP_NASNonDeliveryIndication_IEs_t *)calloc(1, sizeof(S1AP_NASNonDeliveryIndication_IEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_ignore; /* Send a dummy cause */ - nas_non_delivery_p->cause.present = S1ap_Cause_PR_radioNetwork; - nas_non_delivery_p->cause.choice.radioNetwork = S1ap_CauseRadioNetwork_radio_connection_with_ue_lost; + ie->value.present = S1AP_NASNonDeliveryIndication_IEs__value_PR_Cause; + ie->value.choice.Cause.present = S1AP_Cause_PR_radioNetwork; + ie->value.choice.Cause.choice.radioNetwork = S1AP_CauseRadioNetwork_radio_connection_with_ue_lost; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) { + if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) { S1AP_ERROR("Failed to encode NAS NON delivery indication\n"); /* Encode procedure has failed... */ MSC_LOG_EVENT( MSC_S1AP_ENB, MSC_AS_TIME_FMT" Sent of NAS_NON_DELIVERY_IND to MME failed (encoding)"); - return; + return -1; } - MSC_LOG_TX_MESSAGE( MSC_S1AP_ENB, MSC_S1AP_MME, @@ -511,12 +738,11 @@ void s1ap_eNB_nas_non_delivery_ind(instance_t instance, 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), nas_non_delivery_p->eNB_UE_S1AP_ID, nas_non_delivery_p->mme_ue_s1ap_id); - - /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, length, ue_context_p->tx_stream); + return 0; } //------------------------------------------------------------------------------ @@ -524,21 +750,16 @@ int s1ap_eNB_initial_ctxt_resp( instance_t instance, s1ap_initial_context_setup_resp_t *initial_ctxt_resp_p) //------------------------------------------------------------------------------ { - s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; - struct s1ap_eNB_ue_context_s *ue_context_p = NULL; - - S1ap_InitialContextSetupResponseIEs_t *initial_ies_p = NULL; - - s1ap_message message; - - uint8_t *buffer = NULL; + s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; + struct s1ap_eNB_ue_context_s *ue_context_p = NULL; + S1AP_S1AP_PDU_t pdu; + S1AP_InitialContextSetupResponse_t *out; + S1AP_InitialContextSetupResponseIEs_t *ie; + uint8_t *buffer = NULL; uint32_t length; - int ret = -1; int i; - /* Retrieve the S1AP eNB instance associated with Mod_id */ s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance); - DevAssert(initial_ctxt_resp_p != NULL); DevAssert(s1ap_eNB_instance_p != NULL); @@ -562,40 +783,118 @@ int s1ap_eNB_initial_ctxt_resp( } /* Prepare the S1AP message to encode */ - memset(&message, 0, sizeof(s1ap_message)); - - message.direction = S1AP_PDU_PR_successfulOutcome; - message.procedureCode = S1ap_ProcedureCode_id_InitialContextSetup; - - initial_ies_p = &message.msg.s1ap_InitialContextSetupResponseIEs; - - initial_ies_p->eNB_UE_S1AP_ID = initial_ctxt_resp_p->eNB_ue_s1ap_id; - initial_ies_p->mme_ue_s1ap_id = ue_context_p->mme_ue_s1ap_id; + memset(&pdu, 0, sizeof(pdu)); + pdu.present = S1AP_S1AP_PDU_PR_successfulOutcome; + pdu.choice.successfulOutcome.procedureCode = S1AP_ProcedureCode_id_InitialContextSetup; + pdu.choice.successfulOutcome.criticality = S1AP_Criticality_reject; + pdu.choice.successfulOutcome.value.present = S1AP_SuccessfulOutcome__value_PR_InitialContextSetupResponse; + out = &pdu.choice.successfulOutcome.value.choice.InitialContextSetupResponse; + /* mandatory */ + ie = (S1AP_InitialContextSetupResponseIEs_t *)calloc(1, sizeof(S1AP_InitialContextSetupResponseIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_InitialContextSetupResponseIEs__value_PR_MME_UE_S1AP_ID; + ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* mandatory */ + ie = (S1AP_InitialContextSetupResponseIEs_t *)calloc(1, sizeof(S1AP_InitialContextSetupResponseIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_InitialContextSetupResponseIEs__value_PR_ENB_UE_S1AP_ID; + ie->value.choice.ENB_UE_S1AP_ID = initial_ctxt_resp_p->eNB_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* mandatory */ + ie = (S1AP_InitialContextSetupResponseIEs_t *)calloc(1, sizeof(S1AP_InitialContextSetupResponseIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_InitialContextSetupResponseIEs__value_PR_E_RABSetupListCtxtSURes; for (i = 0; i < initial_ctxt_resp_p->nb_of_e_rabs; i++) { - S1ap_E_RABSetupItemCtxtSURes_t *new_item; - - new_item = calloc(1, sizeof(S1ap_E_RABSetupItemCtxtSURes_t)); - - new_item->e_RAB_ID = initial_ctxt_resp_p->e_rabs[i].e_rab_id; - GTP_TEID_TO_ASN1(initial_ctxt_resp_p->e_rabs[i].gtp_teid, &new_item->gTP_TEID); - new_item->transportLayerAddress.buf = initial_ctxt_resp_p->e_rabs[i].eNB_addr.buffer; - new_item->transportLayerAddress.size = initial_ctxt_resp_p->e_rabs[i].eNB_addr.length; - new_item->transportLayerAddress.bits_unused = 0; - - S1AP_DEBUG("initial_ctxt_resp_p: e_rab ID %ld, enb_addr %d.%d.%d.%d, SIZE %d \n", - new_item->e_RAB_ID, - new_item->transportLayerAddress.buf[0], - new_item->transportLayerAddress.buf[1], - new_item->transportLayerAddress.buf[2], - new_item->transportLayerAddress.buf[3], - new_item->transportLayerAddress.size); - - ASN_SEQUENCE_ADD(&initial_ies_p->e_RABSetupListCtxtSURes.s1ap_E_RABSetupItemCtxtSURes, - new_item); + S1AP_E_RABSetupItemCtxtSUResIEs_t *item; + /* mandatory */ + item = calloc(1, sizeof(S1AP_E_RABSetupItemCtxtSUResIEs_t)); + item->id = S1AP_ProtocolIE_ID_id_E_RABSetupItemBearerSURes; + item->criticality = S1AP_Criticality_ignore; + item->value.present = S1AP_E_RABSetupItemBearerSUResIEs__value_PR_E_RABSetupItemBearerSURes; + item->value.choice.E_RABSetupItemCtxtSURes.e_RAB_ID = initial_ctxt_resp_p->e_rabs[i].e_rab_id; + GTP_TEID_TO_ASN1(initial_ctxt_resp_p->e_rabs[i].gtp_teid, &item->value.choice.E_RABSetupItemCtxtSURes.gTP_TEID); + item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.buf = initial_ctxt_resp_p->e_rabs[i].eNB_addr.buffer; + item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.size = initial_ctxt_resp_p->e_rabs[i].eNB_addr.length; + item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.bits_unused = 0; + S1AP_DEBUG("initial_ctxt_resp_p: e_rab ID %ld, enb_addr %d.%d.%d.%d, SIZE %ld \n", + item->value.choice.E_RABSetupItemCtxtSURes.e_RAB_ID, + item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.buf[0], + item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.buf[1], + item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.buf[2], + item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.buf[3], + item->value.choice.E_RABSetupItemCtxtSURes.transportLayerAddress.size); + ASN_SEQUENCE_ADD(&ie->value.choice.E_RABSetupListCtxtSURes.list, item); } - if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) { + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + + /* optional */ + if (initial_ctxt_resp_p->nb_of_e_rabs_failed) { + ie = (S1AP_InitialContextSetupResponseIEs_t *)calloc(1, sizeof(S1AP_InitialContextSetupResponseIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_E_RABFailedToSetupListCtxtSURes; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_InitialContextSetupResponseIEs__value_PR_E_RABList; + + for (i = 0; i < initial_ctxt_resp_p->nb_of_e_rabs_failed; i++) { + S1AP_E_RABItemIEs_t *item; + /* mandatory */ + item = calloc(1, sizeof(S1AP_E_RABItemIEs_t)); + item->id = S1AP_ProtocolIE_ID_id_E_RABItem; + item->criticality = S1AP_Criticality_ignore; + item->value.present = S1AP_E_RABItemIEs__value_PR_E_RABItem; + item->value.choice.E_RABItem.e_RAB_ID = initial_ctxt_resp_p->e_rabs_failed[i].e_rab_id; + item->value.choice.E_RABItem.cause.present = initial_ctxt_resp_p->e_rabs_failed[i].cause; + + switch(item->value.choice.E_RABItem.cause.present) + { + case S1AP_Cause_PR_radioNetwork: + item->value.choice.E_RABItem.cause.choice.radioNetwork = initial_ctxt_resp_p->e_rabs_failed[i].cause_value; + break; + + case S1AP_Cause_PR_transport: + item->value.choice.E_RABItem.cause.choice.transport = initial_ctxt_resp_p->e_rabs_failed[i].cause_value; + break; + + case S1AP_Cause_PR_nas: + item->value.choice.E_RABItem.cause.choice.nas = initial_ctxt_resp_p->e_rabs_failed[i].cause_value; + break; + + case S1AP_Cause_PR_protocol: + item->value.choice.E_RABItem.cause.choice.protocol = initial_ctxt_resp_p->e_rabs_failed[i].cause_value; + break; + + case S1AP_Cause_PR_misc: + item->value.choice.E_RABItem.cause.choice.misc = initial_ctxt_resp_p->e_rabs_failed[i].cause_value; + break; + + case S1AP_Cause_PR_NOTHING: + default: + break; + } + + S1AP_DEBUG("initial context setup response: failed e_rab ID %ld\n", item->value.choice.E_RABItem.e_RAB_ID); + ASN_SEQUENCE_ADD(&ie->value.choice.E_RABList.list, item); + } + + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + if (0) { + ie = (S1AP_InitialContextSetupResponseIEs_t *)calloc(1, sizeof(S1AP_InitialContextSetupResponseIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_CriticalityDiagnostics; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_InitialContextSetupResponseIEs__value_PR_CriticalityDiagnostics; + // ie->value.choice.CriticalityDiagnostics =; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) { S1AP_ERROR("Failed to encode uplink NAS transport\n"); /* Encode procedure has failed... */ return -1; @@ -610,13 +909,11 @@ int s1ap_eNB_initial_ctxt_resp( 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), initial_ies_p->eNB_UE_S1AP_ID, initial_ies_p->mme_ue_s1ap_id); - /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, length, ue_context_p->tx_stream); - - return ret; + return 0; } //------------------------------------------------------------------------------ @@ -626,18 +923,13 @@ int s1ap_eNB_ue_capabilities(instance_t instance, { s1ap_eNB_instance_t *s1ap_eNB_instance_p; struct s1ap_eNB_ue_context_s *ue_context_p; - - S1ap_UECapabilityInfoIndicationIEs_t *ue_cap_info_ind_ies_p; - - s1ap_message message; - + S1AP_S1AP_PDU_t pdu; + S1AP_UECapabilityInfoIndication_t *out; + S1AP_UECapabilityInfoIndicationIEs_t *ie; uint8_t *buffer; uint32_t length; - int ret = -1; - /* Retrieve the S1AP eNB instance associated with Mod_id */ s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance); - DevAssert(ue_cap_info_ind_p != NULL); DevAssert(s1ap_eNB_instance_p != NULL); @@ -661,27 +953,51 @@ int s1ap_eNB_ue_capabilities(instance_t instance, } /* Prepare the S1AP message to encode */ - memset(&message, 0, sizeof(s1ap_message)); + memset(&pdu, 0, sizeof(pdu)); + pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_UECapabilityInfoIndication; + pdu.choice.initiatingMessage.criticality = S1AP_Criticality_ignore; + pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_UECapabilityInfoIndication; + out = &pdu.choice.initiatingMessage.value.choice.UECapabilityInfoIndication; + /* mandatory */ + ie = (S1AP_UECapabilityInfoIndicationIEs_t *)calloc(1, sizeof(S1AP_UECapabilityInfoIndicationIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_UECapabilityInfoIndicationIEs__value_PR_MME_UE_S1AP_ID; + ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* mandatory */ + ie = (S1AP_UECapabilityInfoIndicationIEs_t *)calloc(1, sizeof(S1AP_UECapabilityInfoIndicationIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_UECapabilityInfoIndicationIEs__value_PR_ENB_UE_S1AP_ID; + ie->value.choice.ENB_UE_S1AP_ID = ue_cap_info_ind_p->eNB_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* mandatory */ + ie = (S1AP_UECapabilityInfoIndicationIEs_t *)calloc(1, sizeof(S1AP_UECapabilityInfoIndicationIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_UERadioCapability; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_UECapabilityInfoIndicationIEs__value_PR_UERadioCapability; + ie->value.choice.UERadioCapability.buf = ue_cap_info_ind_p->ue_radio_cap.buffer; + ie->value.choice.UERadioCapability.size = ue_cap_info_ind_p->ue_radio_cap.length; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - message.direction = S1AP_PDU_PR_initiatingMessage; - message.procedureCode = S1ap_ProcedureCode_id_UECapabilityInfoIndication; + /* optional */ + if (0) { + ie = (S1AP_UECapabilityInfoIndicationIEs_t *)calloc(1, sizeof(S1AP_UECapabilityInfoIndicationIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_UERadioCapabilityForPaging; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_UECapabilityInfoIndicationIEs__value_PR_UERadioCapabilityForPaging; + // ie->value.choice.UERadioCapabilityForPaging = ; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } - ue_cap_info_ind_ies_p = &message.msg.s1ap_UECapabilityInfoIndicationIEs; - - ue_cap_info_ind_ies_p->ueRadioCapability.buf = ue_cap_info_ind_p->ue_radio_cap.buffer; - ue_cap_info_ind_ies_p->ueRadioCapability.size = ue_cap_info_ind_p->ue_radio_cap.length; - - ue_cap_info_ind_ies_p->eNB_UE_S1AP_ID = ue_cap_info_ind_p->eNB_ue_s1ap_id; - ue_cap_info_ind_ies_p->mme_ue_s1ap_id = ue_context_p->mme_ue_s1ap_id; - - if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) { + if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) { /* Encode procedure has failed... */ S1AP_ERROR("Failed to encode UE capabilities indication\n"); return -1; } - free(ue_cap_info_ind_p->ue_radio_cap.buffer); - MSC_LOG_TX_MESSAGE( MSC_S1AP_ENB, MSC_S1AP_MME, @@ -691,40 +1007,33 @@ int s1ap_eNB_ue_capabilities(instance_t instance, 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), ue_cap_info_ind_ies_p->eNB_UE_S1AP_ID, ue_cap_info_ind_ies_p->mme_ue_s1ap_id); - /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, length, ue_context_p->tx_stream); - - return ret; + return 0; } //------------------------------------------------------------------------------ -int s1ap_eNB_e_rab_setup_resp(instance_t instance, - s1ap_e_rab_setup_resp_t *e_rab_setup_resp_p) +int s1ap_eNB_e_rab_setup_resp(instance_t instance, + s1ap_e_rab_setup_resp_t *e_rab_setup_resp_p) //------------------------------------------------------------------------------ { s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; struct s1ap_eNB_ue_context_s *ue_context_p = NULL; - - S1ap_E_RABSetupResponseIEs_t *initial_ies_p = NULL; - - s1ap_message message; - + S1AP_S1AP_PDU_t pdu; + S1AP_E_RABSetupResponse_t *out; + S1AP_E_RABSetupResponseIEs_t *ie; uint8_t *buffer = NULL; uint32_t length; - int ret = -1; int i; - /* Retrieve the S1AP eNB instance associated with Mod_id */ s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance); - DevAssert(e_rab_setup_resp_p != NULL); DevAssert(s1ap_eNB_instance_p != NULL); if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p, - e_rab_setup_resp_p->eNB_ue_s1ap_id)) == NULL) { + e_rab_setup_resp_p->eNB_ue_s1ap_id)) == NULL) { /* The context for this eNB ue s1ap id doesn't exist in the map of eNB UEs */ S1AP_WARN("Failed to find ue context associated with eNB ue s1ap id: 0x%06x\n", e_rab_setup_resp_p->eNB_ue_s1ap_id); @@ -741,85 +1050,136 @@ int s1ap_eNB_e_rab_setup_resp(instance_t instance, e_rab_setup_resp_p->eNB_ue_s1ap_id, ue_context_p->ue_state); return -1; } - + /* Prepare the S1AP message to encode */ - memset(&message, 0, sizeof(s1ap_message)); + memset(&pdu, 0, sizeof(pdu)); + pdu.present = S1AP_S1AP_PDU_PR_successfulOutcome; + pdu.choice.successfulOutcome.procedureCode = S1AP_ProcedureCode_id_E_RABModify; + pdu.choice.successfulOutcome.criticality = S1AP_Criticality_reject; + pdu.choice.successfulOutcome.value.present = S1AP_SuccessfulOutcome__value_PR_E_RABSetupResponse; + out = &pdu.choice.successfulOutcome.value.choice.E_RABSetupResponse; + /* mandatory */ + ie = (S1AP_E_RABSetupResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABSetupResponseIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_E_RABSetupResponseIEs__value_PR_MME_UE_S1AP_ID; + ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* mandatory */ + ie = (S1AP_E_RABSetupResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABSetupResponseIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_E_RABSetupResponseIEs__value_PR_ENB_UE_S1AP_ID; + ie->value.choice.ENB_UE_S1AP_ID = e_rab_setup_resp_p->eNB_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - message.direction = S1AP_PDU_PR_successfulOutcome; - message.procedureCode = S1ap_ProcedureCode_id_E_RABSetup; - message.criticality = S1ap_Criticality_reject; + /* optional */ + if (e_rab_setup_resp_p->nb_of_e_rabs > 0) { + ie = (S1AP_E_RABSetupResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABSetupResponseIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_E_RABSetupListBearerSURes; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_E_RABSetupResponseIEs__value_PR_E_RABSetupListBearerSURes; - initial_ies_p = &message.msg.s1ap_E_RABSetupResponseIEs; - - initial_ies_p->eNB_UE_S1AP_ID = e_rab_setup_resp_p->eNB_ue_s1ap_id; - initial_ies_p->mme_ue_s1ap_id = ue_context_p->mme_ue_s1ap_id; - - if ( e_rab_setup_resp_p->nb_of_e_rabs >= 1 ) - initial_ies_p->presenceMask |= S1AP_E_RABSETUPRESPONSEIES_E_RABSETUPLISTBEARERSURES_PRESENT; - - for (i = 0; i < e_rab_setup_resp_p->nb_of_e_rabs; i++) { - S1ap_E_RABSetupItemBearerSURes_t *new_item; + for (i = 0; i < e_rab_setup_resp_p->nb_of_e_rabs; i++) { + S1AP_E_RABSetupItemBearerSUResIEs_t *item; + /* mandatory */ + item = calloc(1, sizeof(S1AP_E_RABSetupItemBearerSUResIEs_t)); + item->id = S1AP_ProtocolIE_ID_id_E_RABSetupItemBearerSURes; + item->criticality = S1AP_Criticality_ignore; + item->value.present = S1AP_E_RABSetupItemBearerSUResIEs__value_PR_E_RABSetupItemBearerSURes; + item->value.choice.E_RABSetupItemBearerSURes.e_RAB_ID = e_rab_setup_resp_p->e_rabs[i].e_rab_id; + GTP_TEID_TO_ASN1(e_rab_setup_resp_p->e_rabs[i].gtp_teid, &item->value.choice.E_RABSetupItemBearerSURes.gTP_TEID); + item->value.choice.E_RABSetupItemBearerSURes.transportLayerAddress.buf = e_rab_setup_resp_p->e_rabs[i].eNB_addr.buffer; + item->value.choice.E_RABSetupItemBearerSURes.transportLayerAddress.size = e_rab_setup_resp_p->e_rabs[i].eNB_addr.length; + item->value.choice.E_RABSetupItemBearerSURes.transportLayerAddress.bits_unused = 0; + S1AP_DEBUG("e_rab_setup_resp: e_rab ID %ld, teid %u, enb_addr %d.%d.%d.%d, SIZE %ld\n", + item->value.choice.E_RABSetupItemBearerSURes.e_RAB_ID, + e_rab_setup_resp_p->e_rabs[i].gtp_teid, + item->value.choice.E_RABSetupItemBearerSURes.transportLayerAddress.buf[0], + item->value.choice.E_RABSetupItemBearerSURes.transportLayerAddress.buf[1], + item->value.choice.E_RABSetupItemBearerSURes.transportLayerAddress.buf[2], + item->value.choice.E_RABSetupItemBearerSURes.transportLayerAddress.buf[3], + item->value.choice.E_RABSetupItemBearerSURes.transportLayerAddress.size); + ASN_SEQUENCE_ADD(&ie->value.choice.E_RABSetupListBearerSURes.list, item); + } - new_item = calloc(1, sizeof(S1ap_E_RABSetupItemBearerSURes_t)); - - new_item->e_RAB_ID = e_rab_setup_resp_p->e_rabs[i].e_rab_id; - GTP_TEID_TO_ASN1(e_rab_setup_resp_p->e_rabs[i].gtp_teid, &new_item->gTP_TEID); - - /* - new_item->transportLayerAddress.buf = MALLOC(e_rab_setup_resp_p->e_rabs[i].eNB_addr.length); - memcpy (new_item->transportLayerAddress.buf, - e_rab_setup_resp_p->e_rabs[i].eNB_addr.buffer, - e_rab_setup_resp_p->e_rabs[i].eNB_addr.length); - - */ - /* - new_item->transportLayerAddress.buf[0] = e_rab_setup_resp_p->e_rabs[i].eNB_addr.buffer[0]; - new_item->transportLayerAddress.buf[1] = e_rab_setup_resp_p->e_rabs[i].eNB_addr.buffer[1]; - new_item->transportLayerAddress.buf[2] = e_rab_setup_resp_p->e_rabs[i].eNB_addr.buffer[2]; - new_item->transportLayerAddress.buf[3] = e_rab_setup_resp_p->e_rabs[i].eNB_addr.buffer[3]; - */ - new_item->transportLayerAddress.buf = e_rab_setup_resp_p->e_rabs[i].eNB_addr.buffer; - new_item->transportLayerAddress.size = e_rab_setup_resp_p->e_rabs[i].eNB_addr.length; - new_item->transportLayerAddress.bits_unused = 0; - - S1AP_DEBUG("e_rab_setup_resp: e_rab ID %ld, teid %u, enb_addr %d.%d.%d.%d, SIZE %d\n", - new_item->e_RAB_ID, - e_rab_setup_resp_p->e_rabs[i].gtp_teid, - new_item->transportLayerAddress.buf[0], - new_item->transportLayerAddress.buf[1], - new_item->transportLayerAddress.buf[2], - new_item->transportLayerAddress.buf[3], - new_item->transportLayerAddress.size); - - S1ap_IE_t *ie = s1ap_new_ie(S1ap_ProtocolIE_ID_id_E_RABSetupItemBearerSURes, - S1ap_Criticality_ignore, - &asn_DEF_S1ap_E_RABSetupItemBearerSURes, - new_item); - /* - S1ap_IE_t *ie = s1ap_new_ie(S1ap_ProtocolIE_ID_id_E_RABSetupListBearerSURes, - S1ap_Criticality_ignore, - &asn_DEF_S1ap_E_RABSetupListBearerSURes, - new_item); - */ - ASN_SEQUENCE_ADD(&initial_ies_p->e_RABSetupListBearerSURes.s1ap_E_RABSetupItemBearerSURes, - ie); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } - - /* S1ap_E_RABSetupListBearerSURes_t e_RABSetupListBearerSURes; - memset(&e_RABSetupListBearerSURes, 0, sizeof(S1ap_E_RABSetupListBearerSURes_t)); + + /* optional */ + if (e_rab_setup_resp_p->nb_of_e_rabs_failed > 0) { + ie = (S1AP_E_RABSetupResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABSetupResponseIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_E_RABFailedToSetupListBearerSURes; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_E_RABSetupResponseIEs__value_PR_E_RABList; + + for (i = 0; i < e_rab_setup_resp_p->nb_of_e_rabs_failed; i++) { + S1AP_E_RABItemIEs_t *item; + item = calloc(1, sizeof(S1AP_E_RABItemIEs_t)); + item->id = S1AP_ProtocolIE_ID_id_E_RABItem; + item->criticality = S1AP_Criticality_ignore; + item->value.present = S1AP_E_RABItemIEs__value_PR_E_RABItem; + item->value.choice.E_RABItem.e_RAB_ID = e_rab_setup_resp_p->e_rabs_failed[i].e_rab_id; + item->value.choice.E_RABItem.cause.present = e_rab_setup_resp_p->e_rabs_failed[i].cause; + + switch(item->value.choice.E_RABItem.cause.present) + { + case S1AP_Cause_PR_radioNetwork: + item->value.choice.E_RABItem.cause.choice.radioNetwork = e_rab_setup_resp_p->e_rabs_failed[i].cause_value; + break; + + case S1AP_Cause_PR_transport: + item->value.choice.E_RABItem.cause.choice.transport = e_rab_setup_resp_p->e_rabs_failed[i].cause_value; + break; + + case S1AP_Cause_PR_nas: + item->value.choice.E_RABItem.cause.choice.nas = e_rab_setup_resp_p->e_rabs_failed[i].cause_value; + break; + + case S1AP_Cause_PR_protocol: + item->value.choice.E_RABItem.cause.choice.protocol = e_rab_setup_resp_p->e_rabs_failed[i].cause_value; + break; + + case S1AP_Cause_PR_misc: + item->value.choice.E_RABItem.cause.choice.misc = e_rab_setup_resp_p->e_rabs_failed[i].cause_value; + break; + + case S1AP_Cause_PR_NOTHING: + default: + break; + } + + S1AP_DEBUG("e_rab_modify_resp: failed e_rab ID %ld\n", item->value.choice.E_RABItem.e_RAB_ID); + ASN_SEQUENCE_ADD(&ie->value.choice.E_RABList.list, item); + } + + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + if (0) { + ie = (S1AP_E_RABSetupResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABSetupResponseIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_CriticalityDiagnostics; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_E_RABSetupResponseIEs__value_PR_CriticalityDiagnostics; + // ie->value.choice.CriticalityDiagnostics = ; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* S1AP_E_RABSetupListBearerSURes_t e_RABSetupListBearerSURes; + memset(&e_RABSetupListBearerSURes, 0, sizeof(S1AP_E_RABSetupListBearerSURes_t)); if (s1ap_encode_s1ap_e_rabsetuplistbearersures(&e_RABSetupListBearerSURes, &initial_ies_p->e_RABSetupListBearerSURes.s1ap_E_RABSetupItemBearerSURes) < 0 ) return -1; - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1ap_E_RABSetupListBearerSURes, &e_RABSetupListBearerSURes); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_S1AP_E_RABSetupListBearerSURes, &e_RABSetupListBearerSURes); */ fprintf(stderr, "start encode\n"); - if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) { + + if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) { S1AP_ERROR("Failed to encode uplink transport\n"); /* Encode procedure has failed... */ return -1; } - - MSC_LOG_TX_MESSAGE( MSC_S1AP_ENB, MSC_S1AP_MME, @@ -829,40 +1189,33 @@ int s1ap_eNB_e_rab_setup_resp(instance_t instance, 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), initial_ies_p->eNB_UE_S1AP_ID, initial_ies_p->mme_ue_s1ap_id); - /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, length, ue_context_p->tx_stream); - - return ret; + return 0; } //------------------------------------------------------------------------------ int s1ap_eNB_e_rab_modify_resp(instance_t instance, - s1ap_e_rab_modify_resp_t *e_rab_modify_resp_p) + s1ap_e_rab_modify_resp_t *e_rab_modify_resp_p) //------------------------------------------------------------------------------ { - s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; - struct s1ap_eNB_ue_context_s *ue_context_p = NULL; - - S1ap_E_RABModifyResponseIEs_t *initial_ies_p = NULL; - - s1ap_message message; - + s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; + struct s1ap_eNB_ue_context_s *ue_context_p = NULL; + S1AP_S1AP_PDU_t pdu; + S1AP_E_RABModifyResponse_t *out; + S1AP_E_RABModifyResponseIEs_t *ie; uint8_t *buffer = NULL; uint32_t length; - int ret = -1; int i; - /* Retrieve the S1AP eNB instance associated with Mod_id */ s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance); - DevAssert(e_rab_modify_resp_p != NULL); DevAssert(s1ap_eNB_instance_p != NULL); if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p, - e_rab_modify_resp_p->eNB_ue_s1ap_id)) == NULL) { + e_rab_modify_resp_p->eNB_ue_s1ap_id)) == NULL) { /* The context for this eNB ue s1ap id doesn't exist in the map of eNB UEs */ S1AP_WARN("Failed to find ue context associated with eNB ue s1ap id: 0x%06x\n", e_rab_modify_resp_p->eNB_ue_s1ap_id); @@ -881,87 +1234,111 @@ int s1ap_eNB_e_rab_modify_resp(instance_t instance, } /* Prepare the S1AP message to encode */ - memset(&message, 0, sizeof(s1ap_message)); + memset(&pdu, 0, sizeof(pdu)); + pdu.present = S1AP_S1AP_PDU_PR_successfulOutcome; + pdu.choice.successfulOutcome.procedureCode = S1AP_ProcedureCode_id_E_RABModify; + pdu.choice.successfulOutcome.criticality = S1AP_Criticality_reject; + pdu.choice.successfulOutcome.value.present = S1AP_SuccessfulOutcome__value_PR_E_RABModifyResponse; + out = &pdu.choice.successfulOutcome.value.choice.E_RABModifyResponse; + /* mandatory */ + ie = (S1AP_E_RABModifyResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABModifyResponseIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_E_RABModifyResponseIEs__value_PR_MME_UE_S1AP_ID; + ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* mandatory */ + ie = (S1AP_E_RABModifyResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABModifyResponseIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_E_RABModifyResponseIEs__value_PR_ENB_UE_S1AP_ID; + ie->value.choice.ENB_UE_S1AP_ID = e_rab_modify_resp_p->eNB_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - message.direction = S1AP_PDU_PR_successfulOutcome; - message.procedureCode = S1ap_ProcedureCode_id_E_RABModify; - message.criticality = S1ap_Criticality_reject; + /* optional */ + if (e_rab_modify_resp_p->nb_of_e_rabs > 0) { + ie = (S1AP_E_RABModifyResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABModifyResponseIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_E_RABModifyListBearerModRes; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_E_RABModifyResponseIEs__value_PR_E_RABModifyListBearerModRes; - initial_ies_p = &message.msg.s1ap_E_RABModifyResponseIEs; + for (i = 0; i < e_rab_modify_resp_p->nb_of_e_rabs; i++) { + S1AP_E_RABModifyItemBearerModResIEs_t *item; + item = calloc(1, sizeof(S1AP_E_RABModifyItemBearerModResIEs_t)); + item->id = S1AP_ProtocolIE_ID_id_E_RABModifyItemBearerModRes; + item->criticality = S1AP_Criticality_ignore; + item->value.present = S1AP_E_RABModifyItemBearerModResIEs__value_PR_E_RABModifyItemBearerModRes; + item->value.choice.E_RABModifyItemBearerModRes.e_RAB_ID = e_rab_modify_resp_p->e_rabs[i].e_rab_id; + S1AP_DEBUG("e_rab_modify_resp: modified e_rab ID %ld\n", item->value.choice.E_RABModifyItemBearerModRes.e_RAB_ID); + ASN_SEQUENCE_ADD(&ie->value.choice.E_RABModifyListBearerModRes.list, item); + } - initial_ies_p->eNB_UE_S1AP_ID = e_rab_modify_resp_p->eNB_ue_s1ap_id; - initial_ies_p->mme_ue_s1ap_id = ue_context_p->mme_ue_s1ap_id; - - if ( e_rab_modify_resp_p->nb_of_e_rabs >= 1 ) - initial_ies_p->presenceMask |= S1AP_E_RABMODIFYRESPONSEIES_E_RABMODIFYLISTBEARERMODRES_PRESENT; - - for (i = 0; i < e_rab_modify_resp_p->nb_of_e_rabs; i++) { - S1ap_E_RABModifyItemBearerModRes_t *modify_item; - - modify_item = calloc(1, sizeof(S1ap_E_RABModifyItemBearerModRes_t)); - - modify_item->e_RAB_ID = e_rab_modify_resp_p->e_rabs[i].e_rab_id; - - S1AP_DEBUG("e_rab_modify_resp: modified e_rab ID %ld\n", - modify_item->e_RAB_ID); - - S1ap_IE_t *ie = s1ap_new_ie(S1ap_ProtocolIE_ID_id_E_RABModifyItemBearerModRes, - S1ap_Criticality_ignore, - &asn_DEF_S1ap_E_RABModifyItemBearerModRes, - modify_item); - - ASN_SEQUENCE_ADD(&initial_ies_p->e_RABModifyListBearerModRes.s1ap_E_RABModifyItemBearerModRes, - ie); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } - if ( e_rab_modify_resp_p->nb_of_e_rabs_failed >= 1 ) - initial_ies_p->presenceMask |= S1AP_E_RABMODIFYRESPONSEIES_E_RABFAILEDTOMODIFYLIST_PRESENT; + /* optional */ + if (e_rab_modify_resp_p->nb_of_e_rabs_failed > 0) { + ie = (S1AP_E_RABModifyResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABModifyResponseIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_E_RABFailedToModifyList; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_E_RABModifyResponseIEs__value_PR_E_RABList; - for (i = 0; i < e_rab_modify_resp_p->nb_of_e_rabs_failed; i++) { - S1ap_E_RABItem_t *failed_item; + for (i = 0; i < e_rab_modify_resp_p->nb_of_e_rabs_failed; i++) { + S1AP_E_RABItemIEs_t *item; + item = calloc(1, sizeof(S1AP_E_RABItemIEs_t)); + item->id = S1AP_ProtocolIE_ID_id_E_RABItem; + item->criticality = S1AP_Criticality_ignore; + item->value.present = S1AP_E_RABItemIEs__value_PR_E_RABItem; + item->value.choice.E_RABItem.e_RAB_ID = e_rab_modify_resp_p->e_rabs_failed[i].e_rab_id; + item->value.choice.E_RABItem.cause.present = e_rab_modify_resp_p->e_rabs_failed[i].cause; - failed_item = calloc(1, sizeof(S1ap_E_RABItem_t)); + switch(item->value.choice.E_RABItem.cause.present) + { + case S1AP_Cause_PR_radioNetwork: + item->value.choice.E_RABItem.cause.choice.radioNetwork = e_rab_modify_resp_p->e_rabs_failed[i].cause_value; + break; - failed_item->e_RAB_ID = e_rab_modify_resp_p->e_rabs_failed[i].e_rab_id; - switch(e_rab_modify_resp_p->e_rabs_failed[i].cause) - { - case S1AP_CAUSE_RADIO_NETWORK: - failed_item->cause.present = S1ap_Cause_PR_radioNetwork; - failed_item->cause.choice.radioNetwork = e_rab_modify_resp_p->e_rabs_failed[i].cause_value; - break; - case S1AP_CAUSE_TRANSPORT: - failed_item->cause.present = S1ap_Cause_PR_transport; - failed_item->cause.choice.transport = e_rab_modify_resp_p->e_rabs_failed[i].cause_value; - break; - case S1AP_CAUSE_NAS: - failed_item->cause.present = S1ap_Cause_PR_nas; - failed_item->cause.choice.nas = e_rab_modify_resp_p->e_rabs_failed[i].cause_value; - break; - case S1AP_CAUSE_PROTOCOL: - failed_item->cause.present = S1ap_Cause_PR_protocol; - failed_item->cause.choice.protocol = e_rab_modify_resp_p->e_rabs_failed[i].cause_value; - break; - case S1AP_CAUSE_MISC: - failed_item->cause.present = S1ap_Cause_PR_misc; - failed_item->cause.choice.misc = e_rab_modify_resp_p->e_rabs_failed[i].cause_value; - break; - default: - break; + case S1AP_Cause_PR_transport: + item->value.choice.E_RABItem.cause.choice.transport = e_rab_modify_resp_p->e_rabs_failed[i].cause_value; + break; + + case S1AP_Cause_PR_nas: + item->value.choice.E_RABItem.cause.choice.nas = e_rab_modify_resp_p->e_rabs_failed[i].cause_value; + break; + + case S1AP_Cause_PR_protocol: + item->value.choice.E_RABItem.cause.choice.protocol = e_rab_modify_resp_p->e_rabs_failed[i].cause_value; + break; + + case S1AP_Cause_PR_misc: + item->value.choice.E_RABItem.cause.choice.misc = e_rab_modify_resp_p->e_rabs_failed[i].cause_value; + break; + + case S1AP_Cause_PR_NOTHING: + default: + break; + } + + S1AP_DEBUG("e_rab_modify_resp: failed e_rab ID %ld\n", item->value.choice.E_RABItem.e_RAB_ID); + ASN_SEQUENCE_ADD(&ie->value.choice.E_RABList.list, item); } - S1AP_DEBUG("e_rab_modify_resp: failed e_rab ID %ld\n", - failed_item->e_RAB_ID); - S1ap_IE_t *ie = s1ap_new_ie(S1ap_ProtocolIE_ID_id_E_RABItem, - S1ap_Criticality_ignore, - &asn_DEF_S1ap_E_RABItem, - failed_item); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } - ASN_SEQUENCE_ADD(&initial_ies_p->e_RABFailedToModifyList.s1ap_E_RABItem, - ie); + /* optional */ + if (0) { + ie = (S1AP_E_RABModifyResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABModifyResponseIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_CriticalityDiagnostics; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_E_RABModifyResponseIEs__value_PR_CriticalityDiagnostics; + // ie->value.choice.CriticalityDiagnostics = ; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } fprintf(stderr, "start encode\n"); - if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) { + + if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) { S1AP_ERROR("Failed to encode uplink transport\n"); /* Encode procedure has failed... */ return -1; @@ -976,121 +1353,153 @@ int s1ap_eNB_e_rab_modify_resp(instance_t instance, 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), initial_ies_p->eNB_UE_S1AP_ID, initial_ies_p->mme_ue_s1ap_id); - /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, length, ue_context_p->tx_stream); - - return ret; + return 0; } //------------------------------------------------------------------------------ int s1ap_eNB_e_rab_release_resp(instance_t instance, - s1ap_e_rab_release_resp_t *e_rab_release_resp_p) + s1ap_e_rab_release_resp_t *e_rab_release_resp_p) //------------------------------------------------------------------------------ { s1ap_eNB_instance_t *s1ap_eNB_instance_p = NULL; struct s1ap_eNB_ue_context_s *ue_context_p = NULL; - - S1ap_E_RABReleaseResponseIEs_t *release_response_ies_p = NULL; - - s1ap_message message; - + S1AP_S1AP_PDU_t pdu; + S1AP_E_RABReleaseResponse_t *out; + S1AP_E_RABReleaseResponseIEs_t *ie; uint8_t *buffer = NULL; uint32_t length; - int ret = -1; int i; /* Retrieve the S1AP eNB instance associated with Mod_id */ s1ap_eNB_instance_p = s1ap_eNB_get_instance(instance); DevAssert(e_rab_release_resp_p != NULL); DevAssert(s1ap_eNB_instance_p != NULL); - /* Prepare the S1AP message to encode */ - memset(&message, 0, sizeof(s1ap_message)); - - message.direction = S1AP_PDU_PR_successfulOutcome; - message.procedureCode = S1ap_ProcedureCode_id_E_RABRelease; - message.criticality = S1ap_Criticality_ignore; - if ((ue_context_p = s1ap_eNB_get_ue_context(s1ap_eNB_instance_p, - e_rab_release_resp_p->eNB_ue_s1ap_id)) == NULL) { + e_rab_release_resp_p->eNB_ue_s1ap_id)) == NULL) { /* The context for this eNB ue s1ap id doesn't exist in the map of eNB UEs */ S1AP_WARN("Failed to find ue context associated with eNB ue s1ap id: %u\n", - e_rab_release_resp_p->eNB_ue_s1ap_id); + e_rab_release_resp_p->eNB_ue_s1ap_id); return -1; } - release_response_ies_p = &message.msg.s1ap_E_RABReleaseResponseIEs; - release_response_ies_p->eNB_UE_S1AP_ID = e_rab_release_resp_p->eNB_ue_s1ap_id; - release_response_ies_p->mme_ue_s1ap_id = ue_context_p->mme_ue_s1ap_id; + /* Prepare the S1AP message to encode */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = S1AP_S1AP_PDU_PR_successfulOutcome; + pdu.choice.successfulOutcome.procedureCode = S1AP_ProcedureCode_id_E_RABRelease; + pdu.choice.successfulOutcome.criticality = S1AP_Criticality_reject; + pdu.choice.successfulOutcome.value.present = S1AP_SuccessfulOutcome__value_PR_E_RABReleaseResponse; + out = &pdu.choice.successfulOutcome.value.choice.E_RABReleaseResponse; + /* mandatory */ + ie = (S1AP_E_RABReleaseResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABReleaseResponseIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_E_RABReleaseResponseIEs__value_PR_MME_UE_S1AP_ID; + ie->value.choice.MME_UE_S1AP_ID = ue_context_p->mme_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + /* mandatory */ + ie = (S1AP_E_RABReleaseResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABReleaseResponseIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_E_RABReleaseResponseIEs__value_PR_ENB_UE_S1AP_ID; + ie->value.choice.ENB_UE_S1AP_ID = e_rab_release_resp_p->eNB_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - if ( e_rab_release_resp_p->nb_of_e_rabs_released > 0 ) - release_response_ies_p->presenceMask |= S1AP_E_RABRELEASERESPONSEIES_E_RABRELEASELISTBEARERRELCOMP_PRESENT; + /* optional */ + if (e_rab_release_resp_p->nb_of_e_rabs_released > 0) { + ie = (S1AP_E_RABReleaseResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABReleaseResponseIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_E_RABReleaseListBearerRelComp; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_E_RABReleaseResponseIEs__value_PR_E_RABReleaseListBearerRelComp; - //release - for (i = 0; i < e_rab_release_resp_p->nb_of_e_rabs_released; i++) { - - S1ap_E_RABReleaseItemBearerRelComp_t *new_item; - - new_item = calloc(1, sizeof(S1ap_E_RABReleaseItemBearerRelComp_t)); - - new_item->e_RAB_ID = e_rab_release_resp_p->e_rab_release[i].e_rab_id; - - S1AP_DEBUG("e_rab_release_resp: e_rab ID %ld\n",new_item->e_RAB_ID); - - ASN_SEQUENCE_ADD(&release_response_ies_p->e_RABReleaseListBearerRelComp.s1ap_E_RABReleaseItemBearerRelComp, - new_item); + for (i = 0; i < e_rab_release_resp_p->nb_of_e_rabs_released; i++) { + S1AP_E_RABReleaseItemBearerRelCompIEs_t *item; + item = calloc(1, sizeof(S1AP_E_RABReleaseItemBearerRelCompIEs_t)); + item->id = S1AP_ProtocolIE_ID_id_E_RABReleaseItemBearerRelComp; + item->criticality = S1AP_Criticality_ignore; + item->value.present = S1AP_E_RABReleaseItemBearerRelCompIEs__value_PR_E_RABReleaseItemBearerRelComp; + item->value.choice.E_RABReleaseItemBearerRelComp.e_RAB_ID = e_rab_release_resp_p->e_rab_release[i].e_rab_id; + S1AP_DEBUG("e_rab_release_resp: e_rab ID %ld\n", item->value.choice.E_RABReleaseItemBearerRelComp.e_RAB_ID); + ASN_SEQUENCE_ADD(&ie->value.choice.E_RABReleaseListBearerRelComp.list, item); + } + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } - if ( e_rab_release_resp_p->nb_of_e_rabs_failed > 0 ) - release_response_ies_p->presenceMask |= S1AP_E_RABRELEASERESPONSEIES_E_RABFAILEDTORELEASELIST_PRESENT; + /* optional */ + if (e_rab_release_resp_p->nb_of_e_rabs_failed > 0) { + ie = (S1AP_E_RABReleaseResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABReleaseResponseIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_E_RABFailedToReleaseList; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_E_RABReleaseResponseIEs__value_PR_E_RABList; - //release failed - for (i = 0; i < e_rab_release_resp_p->nb_of_e_rabs_failed; i++) { - S1ap_E_RABItem_t *new_rabitem; - new_rabitem = calloc(1, sizeof(S1ap_E_RABItem_t)); - //e_rab_id - new_rabitem->e_RAB_ID = e_rab_release_resp_p->e_rabs_failed[i].e_rab_id; - //cause - switch(e_rab_release_resp_p->e_rabs_failed[i].cause) + for (i = 0; i < e_rab_release_resp_p->nb_of_e_rabs_failed; i++) { + S1AP_E_RABItemIEs_t *item; + item = calloc(1, sizeof(S1AP_E_RABItemIEs_t)); + item->id = S1AP_ProtocolIE_ID_id_E_RABItem; + item->criticality = S1AP_Criticality_ignore; + item->value.present = S1AP_E_RABItemIEs__value_PR_E_RABItem; + item->value.choice.E_RABItem.e_RAB_ID = e_rab_release_resp_p->e_rabs_failed[i].e_rab_id; + item->value.choice.E_RABItem.cause.present = e_rab_release_resp_p->e_rabs_failed[i].cause; + + switch(item->value.choice.E_RABItem.cause.present) { - case S1AP_CAUSE_NOTHING: - new_rabitem->cause.present = S1ap_Cause_PR_NOTHING; - break; + case S1AP_Cause_PR_radioNetwork: + item->value.choice.E_RABItem.cause.choice.radioNetwork = e_rab_release_resp_p->e_rabs_failed[i].cause_value; + break; - case S1AP_CAUSE_RADIO_NETWORK: - new_rabitem->cause.present = S1ap_Cause_PR_radioNetwork; - new_rabitem->cause.choice.radioNetwork = e_rab_release_resp_p->e_rabs_failed[i].cause_value; - break; + case S1AP_Cause_PR_transport: + item->value.choice.E_RABItem.cause.choice.transport = e_rab_release_resp_p->e_rabs_failed[i].cause_value; + break; - case S1AP_CAUSE_TRANSPORT: - new_rabitem->cause.present = S1ap_Cause_PR_transport; - new_rabitem->cause.choice.transport = e_rab_release_resp_p->e_rabs_failed[i].cause_value; - break; + case S1AP_Cause_PR_nas: + item->value.choice.E_RABItem.cause.choice.nas = e_rab_release_resp_p->e_rabs_failed[i].cause_value; + break; - case S1AP_CAUSE_NAS: - new_rabitem->cause.present = S1ap_Cause_PR_nas; - new_rabitem->cause.choice.nas = e_rab_release_resp_p->e_rabs_failed[i].cause_value; - break; + case S1AP_Cause_PR_protocol: + item->value.choice.E_RABItem.cause.choice.protocol = e_rab_release_resp_p->e_rabs_failed[i].cause_value; + break; - case S1AP_CAUSE_PROTOCOL: - new_rabitem->cause.present = S1ap_Cause_PR_protocol; - new_rabitem->cause.choice.protocol = e_rab_release_resp_p->e_rabs_failed[i].cause_value; - break; + case S1AP_Cause_PR_misc: + item->value.choice.E_RABItem.cause.choice.misc = e_rab_release_resp_p->e_rabs_failed[i].cause_value; + break; - case S1AP_CAUSE_MISC: + case S1AP_Cause_PR_NOTHING: default: - new_rabitem->cause.present = S1ap_Cause_PR_misc; - new_rabitem->cause.choice.misc = e_rab_release_resp_p->e_rabs_failed[i].cause_value; - break; + break; } - S1AP_DEBUG("e_rab_release_resp: failed e_rab ID %ld\n",new_rabitem->e_RAB_ID); - ASN_SEQUENCE_ADD(&release_response_ies_p->e_RABFailedToReleaseList.s1ap_E_RABItem, new_rabitem); + + ASN_SEQUENCE_ADD(&ie->value.choice.E_RABList.list, item); + } + + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + if (0) { + ie = (S1AP_E_RABReleaseResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABReleaseResponseIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_CriticalityDiagnostics; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_E_RABReleaseResponseIEs__value_PR_CriticalityDiagnostics; + // ie->value.choice.CriticalityDiagnostics = ; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + } + + /* optional */ + if(0) { + ie = (S1AP_E_RABReleaseResponseIEs_t *)calloc(1, sizeof(S1AP_E_RABReleaseResponseIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_UserLocationInformation; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_E_RABReleaseResponseIEs__value_PR_UserLocationInformation; + // ie->value.choice.UserLocationInformation = ; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); } fprintf(stderr, "start encode\n"); - if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) { + + if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) { S1AP_ERROR("Failed to encode release response\n"); /* Encode procedure has failed... */ return -1; @@ -1105,14 +1514,11 @@ int s1ap_eNB_e_rab_release_resp(instance_t instance, 0,0,//MSC_AS_TIME_ARGS(ctxt_pP), e_rab_release_resp_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id); - /* UE associated signalling -> use the allocated stream */ s1ap_eNB_itti_send_sctp_data_req(s1ap_eNB_instance_p->instance, ue_context_p->mme_ref->assoc_id, buffer, length, ue_context_p->tx_stream); - S1AP_INFO("e_rab_release_response sended eNB_UE_S1AP_ID %d mme_ue_s1ap_id %d nb_of_e_rabs_released %d nb_of_e_rabs_failed %d\n", - e_rab_release_resp_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id,e_rab_release_resp_p->nb_of_e_rabs_released,e_rab_release_resp_p->nb_of_e_rabs_failed); - - return ret; + e_rab_release_resp_p->eNB_ue_s1ap_id, ue_context_p->mme_ue_s1ap_id,e_rab_release_resp_p->nb_of_e_rabs_released,e_rab_release_resp_p->nb_of_e_rabs_failed); + return 0; } diff --git a/openair3/S1AP/s1ap_eNB_nas_procedures.h b/openair3/S1AP/s1ap_eNB_nas_procedures.h index bb2a0488bf..a7f144c0ca 100644 --- a/openair3/S1AP/s1ap_eNB_nas_procedures.h +++ b/openair3/S1AP/s1ap_eNB_nas_procedures.h @@ -23,14 +23,14 @@ #define S1AP_ENB_NAS_PROCEDURES_H_ int s1ap_eNB_handle_nas_downlink( - const uint32_t assoc_id, - const uint32_t stream, - struct s1ap_message_s* message_p); + uint32_t assoc_id, + uint32_t stream, + S1AP_S1AP_PDU_t *pdu); int s1ap_eNB_nas_uplink(instance_t instance, s1ap_uplink_nas_t *s1ap_uplink_nas_p); -void s1ap_eNB_nas_non_delivery_ind(instance_t instance, - s1ap_nas_non_delivery_ind_t *s1ap_nas_non_delivery_ind); +int s1ap_eNB_nas_non_delivery_ind(instance_t instance, + s1ap_nas_non_delivery_ind_t *s1ap_nas_non_delivery_ind); int s1ap_eNB_handle_nas_first_req( instance_t instance, s1ap_nas_first_req_t *s1ap_nas_first_req_p); @@ -45,8 +45,8 @@ int s1ap_eNB_e_rab_setup_resp(instance_t instance, s1ap_e_rab_setup_resp_t *e_rab_setup_resp_p); int s1ap_eNB_e_rab_modify_resp(instance_t instance, - s1ap_e_rab_modify_resp_t *e_rab_modify_resp_p); + s1ap_e_rab_modify_resp_t *e_rab_modify_resp_p); int s1ap_eNB_e_rab_release_resp(instance_t instance, - s1ap_e_rab_release_resp_t *e_rab_release_resp_p); + s1ap_e_rab_release_resp_t *e_rab_release_resp_p); #endif /* S1AP_ENB_NAS_PROCEDURES_H_ */ diff --git a/openair3/S1AP/s1ap_eNB_overload.c b/openair3/S1AP/s1ap_eNB_overload.c index 82167bfeeb..e4066b7108 100644 --- a/openair3/S1AP/s1ap_eNB_overload.c +++ b/openair3/S1AP/s1ap_eNB_overload.c @@ -33,7 +33,6 @@ #include "intertask_interface.h" #include "s1ap_common.h" -#include "s1ap_ies_defs.h" #include "s1ap_eNB_defs.h" #include "s1ap_eNB.h" @@ -44,21 +43,20 @@ #include "assertions.h" -int s1ap_eNB_handle_overload_start(uint32_t assoc_id, - uint32_t stream, - struct s1ap_message_s *message_p) +int s1ap_eNB_handle_overload_start(uint32_t assoc_id, + uint32_t stream, + S1AP_S1AP_PDU_t *pdu) { - S1ap_OverloadStartIEs_t *overload_start_p; s1ap_eNB_mme_data_t *mme_desc_p; - - DevAssert(message_p != NULL); - - overload_start_p = &message_p->msg.s1ap_OverloadStartIEs; - - DevCheck(overload_start_p->overloadResponse.present == - S1ap_OverloadResponse_PR_overloadAction, - S1ap_OverloadResponse_PR_overloadAction, 0, 0); - + S1AP_OverloadStart_t *container; + S1AP_OverloadStartIEs_t *ie; + DevAssert(pdu != NULL); + container = &pdu->choice.initiatingMessage.value.choice.OverloadStart; + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_OverloadStartIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_OverloadResponse, TRUE); + DevCheck(ie->value.choice.OverloadResponse.present == + S1AP_OverloadResponse_PR_overloadAction, + S1AP_OverloadResponse_PR_overloadAction, 0, 0); /* Non UE-associated signalling -> stream 0 */ DevCheck(stream == 0, stream, 0, 0); @@ -72,24 +70,20 @@ int s1ap_eNB_handle_overload_start(uint32_t assoc_id, */ mme_desc_p->state = S1AP_ENB_OVERLOAD; mme_desc_p->overload_state = - overload_start_p->overloadResponse.choice.overloadAction; - + ie->value.choice.OverloadResponse.choice.overloadAction; return 0; } -int s1ap_eNB_handle_overload_stop(uint32_t assoc_id, - uint32_t stream, - struct s1ap_message_s *message_p) +int s1ap_eNB_handle_overload_stop(uint32_t assoc_id, + uint32_t stream, + S1AP_S1AP_PDU_t *pdu) { /* We received Overload stop message, meaning that the MME is no more * overloaded. This is an empty message, with only message header and no * Information Element. */ - - DevAssert(message_p != NULL); - + DevAssert(pdu != NULL); s1ap_eNB_mme_data_t *mme_desc_p; - /* Non UE-associated signalling -> stream 0 */ DevCheck(stream == 0, stream, 0, 0); diff --git a/openair3/S1AP/s1ap_eNB_overload.h b/openair3/S1AP/s1ap_eNB_overload.h index 1b0ee443de..8133345dee 100644 --- a/openair3/S1AP/s1ap_eNB_overload.h +++ b/openair3/S1AP/s1ap_eNB_overload.h @@ -28,9 +28,9 @@ // int s1ap_eNB_handle_overload_start(eNB_mme_desc_t *eNB_desc_p, // sctp_queue_item_t *packet_p, // struct s1ap_message_s *message_p); -int s1ap_eNB_handle_overload_start(uint32_t assoc_id, - uint32_t stream, - struct s1ap_message_s *message_p); +int s1ap_eNB_handle_overload_start(uint32_t assoc_id, + uint32_t stream, + S1AP_S1AP_PDU_t *pdu); /** * \brief Handle an overload stop message @@ -38,8 +38,8 @@ int s1ap_eNB_handle_overload_start(uint32_t assoc_id, // int s1ap_eNB_handle_overload_stop(eNB_mme_desc_t *eNB_desc_p, // sctp_queue_item_t *packet_p, // struct s1ap_message_s *message_p); -int s1ap_eNB_handle_overload_stop(uint32_t assoc_id, - uint32_t stream, - struct s1ap_message_s *message_p); +int s1ap_eNB_handle_overload_stop(uint32_t assoc_id, + uint32_t stream, + S1AP_S1AP_PDU_t *pdu); #endif /* S1AP_ENB_OVERLOAD_H_ */ diff --git a/openair3/S1AP/s1ap_eNB_trace.c b/openair3/S1AP/s1ap_eNB_trace.c index e640c9292a..a04bd4ce93 100644 --- a/openair3/S1AP/s1ap_eNB_trace.c +++ b/openair3/S1AP/s1ap_eNB_trace.c @@ -28,7 +28,6 @@ #include "s1ap_eNB_default_values.h" #include "s1ap_common.h" -#include "s1ap_ies_defs.h" #include "s1ap_eNB_defs.h" #include "s1ap_eNB.h" @@ -40,29 +39,50 @@ static void s1ap_eNB_generate_trace_failure(struct s1ap_eNB_ue_context_s *ue_desc_p, - S1ap_E_UTRAN_Trace_ID_t *trace_id, - S1ap_Cause_t *cause_p) + S1AP_E_UTRAN_Trace_ID_t *trace_id, + S1AP_Cause_t *cause_p) { - s1ap_message message; - S1ap_TraceFailureIndicationIEs_t *trace_failure_p; - uint8_t *buffer; - uint32_t length; - + S1AP_S1AP_PDU_t pdu; + S1AP_TraceFailureIndication_t *out; + S1AP_TraceFailureIndicationIEs_t *ie; + uint8_t *buffer = NULL; + uint32_t length; DevAssert(ue_desc_p != NULL); DevAssert(trace_id != NULL); DevAssert(cause_p != NULL); + /* Prepare the S1AP message to encode */ + memset(&pdu, 0, sizeof(pdu)); + pdu.present = S1AP_S1AP_PDU_PR_initiatingMessage; + pdu.choice.initiatingMessage.procedureCode = S1AP_ProcedureCode_id_TraceFailureIndication; + pdu.choice.initiatingMessage.criticality = S1AP_Criticality_ignore; + pdu.choice.initiatingMessage.value.present = S1AP_InitiatingMessage__value_PR_TraceFailureIndication; + out = &pdu.choice.initiatingMessage.value.choice.TraceFailureIndication; + ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_MME_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_MME_UE_S1AP_ID; + ie->value.choice.MME_UE_S1AP_ID = ue_desc_p->mme_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID; + ie->criticality = S1AP_Criticality_reject; + ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_ENB_UE_S1AP_ID; + ie->value.choice.ENB_UE_S1AP_ID = ue_desc_p->eNB_ue_s1ap_id; + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_E_UTRAN_Trace_ID; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_E_UTRAN_Trace_ID; + memcpy(&ie->value.choice.E_UTRAN_Trace_ID, trace_id, sizeof(S1AP_E_UTRAN_Trace_ID_t)); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); + ie = (S1AP_TraceFailureIndicationIEs_t *)calloc(1, sizeof(S1AP_TraceFailureIndicationIEs_t)); + ie->id = S1AP_ProtocolIE_ID_id_Cause; + ie->criticality = S1AP_Criticality_ignore; + ie->value.present = S1AP_TraceFailureIndicationIEs__value_PR_Cause; + memcpy(&ie->value.choice.Cause, cause_p, sizeof(S1AP_Cause_t)); + ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); - memset(&message, 0, sizeof(s1ap_message)); - - trace_failure_p = &message.msg.s1ap_TraceFailureIndicationIEs; - - trace_failure_p->mme_ue_s1ap_id = ue_desc_p->mme_ue_s1ap_id; - trace_failure_p->eNB_UE_S1AP_ID = ue_desc_p->eNB_ue_s1ap_id; - - memcpy(&trace_failure_p->e_UTRAN_Trace_ID, trace_id, sizeof(S1ap_E_UTRAN_Trace_ID_t)); - memcpy(&trace_failure_p->cause, cause_p, sizeof(S1ap_Cause_t)); - - if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) { + if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) { return; } @@ -71,48 +91,44 @@ void s1ap_eNB_generate_trace_failure(struct s1ap_eNB_ue_context_s *ue_desc_p, length, ue_desc_p->tx_stream); } -int s1ap_eNB_handle_trace_start(uint32_t assoc_id, - uint32_t stream, - struct s1ap_message_s *message_p) +int s1ap_eNB_handle_trace_start(uint32_t assoc_id, + uint32_t stream, + S1AP_S1AP_PDU_t *pdu) { - S1ap_TraceStartIEs_t *trace_start_p; + S1AP_TraceStart_t *container; + S1AP_TraceStartIEs_t *ie; struct s1ap_eNB_ue_context_s *ue_desc_p; struct s1ap_eNB_mme_data_s *mme_ref_p; - - DevAssert(message_p != NULL); - - trace_start_p = &message_p->msg.s1ap_TraceStartIEs; - + DevAssert(pdu != NULL); + container = &pdu->choice.initiatingMessage.value.choice.TraceStart; + S1AP_FIND_PROTOCOLIE_BY_ID(S1AP_TraceStartIEs_t, ie, container, + S1AP_ProtocolIE_ID_id_eNB_UE_S1AP_ID, TRUE); mme_ref_p = s1ap_eNB_get_MME(NULL, assoc_id, 0); DevAssert(mme_ref_p != NULL); if ((ue_desc_p = s1ap_eNB_get_ue_context(mme_ref_p->s1ap_eNB_instance, - trace_start_p->eNB_UE_S1AP_ID)) == NULL) { + ie->value.choice.ENB_UE_S1AP_ID)) == NULL) { /* Could not find context associated with this eNB_ue_s1ap_id -> generate * trace failure indication. */ - S1ap_E_UTRAN_Trace_ID_t trace_id; - S1ap_Cause_t cause; - - memset(&trace_id, 0, sizeof(S1ap_E_UTRAN_Trace_ID_t)); - memset(&cause, 0, sizeof(S1ap_Cause_t)); - - cause.present = S1ap_Cause_PR_radioNetwork; - cause.choice.radioNetwork = S1ap_CauseRadioNetwork_unknown_pair_ue_s1ap_id; - + S1AP_E_UTRAN_Trace_ID_t trace_id; + S1AP_Cause_t cause; + memset(&trace_id, 0, sizeof(S1AP_E_UTRAN_Trace_ID_t)); + memset(&cause, 0, sizeof(S1AP_Cause_t)); + cause.present = S1AP_Cause_PR_radioNetwork; + cause.choice.radioNetwork = S1AP_CauseRadioNetwork_unknown_pair_ue_s1ap_id; s1ap_eNB_generate_trace_failure(ue_desc_p, &trace_id, &cause); } return 0; } -int s1ap_eNB_handle_deactivate_trace(uint32_t assoc_id, - uint32_t stream, - struct s1ap_message_s *message_p) +int s1ap_eNB_handle_deactivate_trace(uint32_t assoc_id, + uint32_t stream, + S1AP_S1AP_PDU_t *message_p) { - // S1ap_DeactivateTraceIEs_t *deactivate_trace_p; + // S1AP_DeactivateTraceIEs_t *deactivate_trace_p; // // deactivate_trace_p = &message_p->msg.deactivateTraceIEs; - return 0; } diff --git a/openair3/S1AP/s1ap_eNB_trace.h b/openair3/S1AP/s1ap_eNB_trace.h index 922197afb4..75f7a59dc4 100644 --- a/openair3/S1AP/s1ap_eNB_trace.h +++ b/openair3/S1AP/s1ap_eNB_trace.h @@ -32,15 +32,15 @@ // int s1ap_eNB_handle_trace_start(eNB_mme_desc_t *eNB_desc_p, // sctp_queue_item_t *packet_p, // struct s1ap_message_s *message_p); -int s1ap_eNB_handle_trace_start(uint32_t assoc_id, - uint32_t stream, - struct s1ap_message_s *message_p); +int s1ap_eNB_handle_trace_start(uint32_t assoc_id, + uint32_t stream, + S1AP_S1AP_PDU_t *pdu); // int s1ap_eNB_handle_deactivate_trace(eNB_mme_desc_t *eNB_desc_p, // sctp_queue_item_t *packet_p, // struct s1ap_message_s *message_p); -int s1ap_eNB_handle_deactivate_trace(uint32_t assoc_id, - uint32_t stream, - struct s1ap_message_s *message_p); +int s1ap_eNB_handle_deactivate_trace(uint32_t assoc_id, + uint32_t stream, + S1AP_S1AP_PDU_t *pdu); #endif /* S1AP_ENB_TRACE_H_ */ diff --git a/openair3/TEST/EPC_TEST/play_scenario.h b/openair3/TEST/EPC_TEST/play_scenario.h index f9601fe904..a18bad230b 100644 --- a/openair3/TEST/EPC_TEST/play_scenario.h +++ b/openair3/TEST/EPC_TEST/play_scenario.h @@ -252,12 +252,11 @@ typedef enum { typedef struct et_s1ap_s { //et_s1ap_pdu_type_t pdu_type; - S1AP_PDU_t pdu; // decoded ASN1 C type: choice of initiatingMessage, successfulOutcome, unsuccessfulOutcome + S1AP_S1AP_PDU_t pdu; // decoded ASN1 C type: choice of initiatingMessage, successfulOutcome, unsuccessfulOutcome uint16_t xml_stream_pos_offset; uint16_t binary_stream_pos; uint16_t binary_stream_allocated_size; uint8_t *binary_stream; - s1ap_message message; // decoded message: information elements xmlDocPtr doc; // XML representation of the S1AP PDU } et_s1ap_t; @@ -300,9 +299,9 @@ typedef struct et_ip_s { union { struct in6_addr ipv6; in_addr_t ipv4; - }address; + } address; char str[INET6_ADDRSTRLEN+1]; -}et_ip_t; +} et_ip_t; typedef struct et_ip_hdr_s { et_ip_t src; @@ -325,7 +324,7 @@ typedef struct et_packet_s { et_packet_status_t status; long timer_id; // ITTI timer id for waiting rx packets struct timeval timestamp_packet; // timestamp when rx or tx packet -}et_packet_t; +} et_packet_t; typedef struct sctp_epoll_s { @@ -401,23 +400,23 @@ typedef struct et_event_s { inline void et_free_pointer(void *p) {if (NULL != p) {free(p); p=NULL;}}; //------------------------- -void et_free_packet(et_packet_t* packet); -void et_free_scenario(et_scenario_t* scenario); +void et_free_packet(et_packet_t *packet); +void et_free_scenario(et_scenario_t *scenario); //------------------------- -void et_display_packet_s1ap_data(const et_s1ap_t * const s1ap); -void et_display_packet_sctp_init(const sctp_inithdr_t * const sctp); -void et_display_packet_sctp_initack(const sctp_initackhdr_t * const sctp); -void et_display_packet_sctp_data(const sctp_datahdr_t * const sctp); -void et_display_packet_sctp(const et_sctp_hdr_t * const sctp); -void et_display_packet_ip(const et_ip_hdr_t * const ip); -void et_display_packet(const et_packet_t * const packet); -void et_display_scenario(const et_scenario_t * const scenario); +void et_display_packet_s1ap_data(const et_s1ap_t *const s1ap); +void et_display_packet_sctp_init(const sctp_inithdr_t *const sctp); +void et_display_packet_sctp_initack(const sctp_initackhdr_t *const sctp); +void et_display_packet_sctp_data(const sctp_datahdr_t *const sctp); +void et_display_packet_sctp(const et_sctp_hdr_t *const sctp); +void et_display_packet_ip(const et_ip_hdr_t *const ip); +void et_display_packet(const et_packet_t *const packet); +void et_display_scenario(const et_scenario_t *const scenario); //------------------------- -int et_s1ap_decode_initiating_message(s1ap_message *message, S1ap_InitiatingMessage_t *initiating_p); -int et_s1ap_decode_successful_outcome(s1ap_message *message, S1ap_SuccessfulOutcome_t *successfullOutcome_p); -int et_s1ap_decode_unsuccessful_outcome(s1ap_message *message, S1ap_UnsuccessfulOutcome_t *unSuccessfullOutcome_p); -int et_s1ap_decode_pdu(S1AP_PDU_t * const pdu, s1ap_message * const message, const uint8_t * const buffer, const uint32_t length); -void et_decode_s1ap(et_s1ap_t * const s1ap); +int et_s1ap_decode_initiating_message(s1ap_message *message, S1AP_InitiatingMessage_t *initiating_p); +int et_s1ap_decode_successful_outcome(s1ap_message *message, S1AP_SuccessfulOutcome_t *successfullOutcome_p); +int et_s1ap_decode_unsuccessful_outcome(s1ap_message *message, S1AP_UnsuccessfulOutcome_t *unSuccessfullOutcome_p); +int et_s1ap_decode_pdu(S1AP_PDU_t *const pdu, s1ap_message *const message, const uint8_t *const buffer, const uint32_t length); +void et_decode_s1ap(et_s1ap_t *const s1ap); //------------------------- int et_s1ap_eNB_compare_assoc_id( struct s1ap_eNB_mme_data_s *p1, struct s1ap_eNB_mme_data_s *p2); uint32_t et_s1ap_generate_eNB_id(void); @@ -427,32 +426,32 @@ void et_s1ap_eNB_insert_new_instance(s1ap_eNB_instance_t *new_instance_p); struct s1ap_eNB_mme_data_s *et_s1ap_eNB_get_MME(s1ap_eNB_instance_t *instance_p,int32_t assoc_id, uint16_t cnx_id); s1ap_eNB_instance_t *et_s1ap_eNB_get_instance(instance_t instance); void et_s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer,uint32_t buffer_length, uint16_t stream); -int et_handle_s1ap_mismatch_mme_ue_s1ap_id(et_packet_t * const spacket, et_packet_t * const rx_packet); -asn_comp_rval_t* et_s1ap_is_matching(et_s1ap_t * const s1ap1, et_s1ap_t * const s1ap2, const uint32_t constraints); -et_packet_t* et_build_packet_from_s1ap_data_ind(et_event_s1ap_data_ind_t * const s1ap_data_ind); -int et_scenario_set_packet_received(et_packet_t * const packet); -int et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t * const sctp_data_ind); -void et_s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t * const sctp_data_ind); +int et_handle_s1ap_mismatch_mme_ue_s1ap_id(et_packet_t *const spacket, et_packet_t *const rx_packet); +asn_comp_rval_t *et_s1ap_is_matching(et_s1ap_t *const s1ap1, et_s1ap_t *const s1ap2, const uint32_t constraints); +et_packet_t *et_build_packet_from_s1ap_data_ind(et_event_s1ap_data_ind_t *const s1ap_data_ind); +int et_scenario_set_packet_received(et_packet_t *const packet); +int et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t *const sctp_data_ind); +void et_s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *const sctp_data_ind); void et_s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, - net_ip_address_t *mme_ip_address, - net_ip_address_t *local_ip_addr, - uint16_t in_streams, - uint16_t out_streams); + net_ip_address_t *mme_ip_address, + net_ip_address_t *local_ip_addr, + uint16_t in_streams, + uint16_t out_streams); void et_s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shutdown); void et_s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t *s1ap_register_eNB); void et_s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp); -void * et_s1ap_eNB_task(void *arg); +void *et_s1ap_eNB_task(void *arg); //------------------------- int et_generate_xml_scenario( - const char const * xml_in_dir_name, - const char const * xml_in_scenario_filename, - const char const * enb_config_filename, - char const * tsml_out_scenario_filename); + const char const *xml_in_dir_name, + const char const *xml_in_scenario_filename, + const char const *enb_config_filename, + char const *tsml_out_scenario_filename); //------------------------- -void timeval_add (struct timeval * const result, const struct timeval * const a, const struct timeval * const b); -int timeval_subtract (struct timeval * const result, struct timeval * const a, struct timeval * const b); -void et_scenario_wait_rx_packet(et_packet_t * const packet); -void et_scenario_schedule_tx_packet(et_packet_t * packet); +void timeval_add (struct timeval *const result, const struct timeval *const a, const struct timeval *const b); +int timeval_subtract (struct timeval *const result, struct timeval *const a, struct timeval *const b); +void et_scenario_wait_rx_packet(et_packet_t *const packet); +void et_scenario_schedule_tx_packet(et_packet_t *packet); et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event); et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event); et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_rx(et_event_t event); @@ -460,41 +459,41 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event); et_fsm_state_t et_scenario_fsm_notify_event(et_event_t event); //------------------------- -void et_parse_s1ap(xmlDocPtr doc, const xmlNode const *s1ap_node, et_s1ap_t * const s1ap); -void et_parse_sctp_data_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_datahdr_t * const sctp_hdr); -void et_parse_sctp_init_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_inithdr_t * const sctp_hdr); -void et_parse_sctp_init_ack_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_initackhdr_t * const sctp_hdr); -void et_parse_sctp(xmlDocPtr doc, const xmlNode const *sctp_node, et_sctp_hdr_t * const sctp_hdr); -et_packet_t* et_parse_xml_packet(xmlDocPtr doc, xmlNodePtr node); -et_scenario_t* et_generate_scenario(const char * const et_scenario_filename); +void et_parse_s1ap(xmlDocPtr doc, const xmlNode const *s1ap_node, et_s1ap_t *const s1ap); +void et_parse_sctp_data_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_datahdr_t *const sctp_hdr); +void et_parse_sctp_init_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_inithdr_t *const sctp_hdr); +void et_parse_sctp_init_ack_chunk(xmlDocPtr doc, const xmlNode const *sctp_node, sctp_initackhdr_t *const sctp_hdr); +void et_parse_sctp(xmlDocPtr doc, const xmlNode const *sctp_node, et_sctp_hdr_t *const sctp_hdr); +et_packet_t *et_parse_xml_packet(xmlDocPtr doc, xmlNodePtr node); +et_scenario_t *et_generate_scenario(const char *const et_scenario_filename); //------------------------- -asn_comp_rval_t * et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message * const m1, s1ap_message * const m2, const uint32_t constraints); -void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, const S1ap_MME_UE_S1AP_ID_t new_id); -void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t * const s1ap_payload, xmlNodeSetPtr nodes, const S1ap_MME_UE_S1AP_ID_t new_id); -int et_s1ap_update_mme_ue_s1ap_id(et_packet_t * const packet, const S1ap_MME_UE_S1AP_ID_t old_id, const S1ap_MME_UE_S1AP_ID_t new_id); +asn_comp_rval_t *et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message *const m1, s1ap_message *const m2, const uint32_t constraints); +void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t *const s1ap, xmlNode *node, const S1AP_MME_UE_S1AP_ID_t new_id); +void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t *const s1ap_payload, xmlNodeSetPtr nodes, const S1AP_MME_UE_S1AP_ID_t new_id); +int et_s1ap_update_mme_ue_s1ap_id(et_packet_t *const packet, const S1AP_MME_UE_S1AP_ID_t old_id, const S1AP_MME_UE_S1AP_ID_t new_id); //------------------------- -asn_comp_rval_t * et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_datahdr_t * const sctp2, const uint32_t constraints); -asn_comp_rval_t * et_sctp_is_matching(et_sctp_hdr_t * const sctp1, et_sctp_hdr_t * const sctp2, const uint32_t constraints); +asn_comp_rval_t *et_sctp_data_is_matching(sctp_datahdr_t *const sctp1, sctp_datahdr_t *const sctp2, const uint32_t constraints); +asn_comp_rval_t *et_sctp_is_matching(et_sctp_hdr_t *const sctp1, et_sctp_hdr_t *const sctp2, const uint32_t constraints); //------------------------------------------------------------------------------ -void et_print_hex_octets(const unsigned char * const byte_stream, const unsigned long int num); -int et_is_file_exists ( const char const * file_nameP, const char const *file_roleP); +void et_print_hex_octets(const unsigned char *const byte_stream, const unsigned long int num); +int et_is_file_exists ( const char const *file_nameP, const char const *file_roleP); int et_strip_extension( char *in_filename); -void et_get_shift_arg( char * line_argument, shift_packet_t * const shift); -int et_split_path ( char * pathP, char *** resP); +void et_get_shift_arg( char *line_argument, shift_packet_t *const shift); +int et_split_path ( char *pathP, char *** resP); void et_display_node ( xmlNodePtr node, unsigned int indent); void et_display_tree ( xmlNodePtr node, unsigned int indent); -char * et_ip2ip_str(const et_ip_t * const ip); -int et_compare_et_ip_to_net_ip_address(const et_ip_t * const ip, const net_ip_address_t * const net_ip); -int et_hex2data(unsigned char * const data, const unsigned char * const hexstring, const unsigned int len); -sctp_cid_t et_chunk_type_str2cid(const xmlChar * const chunk_type_str); -const char * const et_chunk_type_cid2str(const sctp_cid_t chunk_type); -const char * const et_error_match2str(const int err); -et_packet_action_t et_action_str2et_action_t(const xmlChar * const action); -void et_ip_str2et_ip(const xmlChar * const ip_str, et_ip_t * const ip); -void et_enb_config_init(const char const * lib_config_file_name_pP); +char *et_ip2ip_str(const et_ip_t *const ip); +int et_compare_et_ip_to_net_ip_address(const et_ip_t *const ip, const net_ip_address_t *const net_ip); +int et_hex2data(unsigned char *const data, const unsigned char *const hexstring, const unsigned int len); +sctp_cid_t et_chunk_type_str2cid(const xmlChar *const chunk_type_str); +const char *const et_chunk_type_cid2str(const sctp_cid_t chunk_type); +const char *const et_error_match2str(const int err); +et_packet_action_t et_action_str2et_action_t(const xmlChar *const action); +void et_ip_str2et_ip(const xmlChar *const ip_str, et_ip_t *const ip); +void et_enb_config_init(const char const *lib_config_file_name_pP); const Enb_properties_array_t *et_enb_config_get(void); void et_eNB_app_register(const Enb_properties_array_t *enb_properties); void *et_eNB_app_task(void *args_p); -int et_play_scenario(et_scenario_t* const scenario, const struct shift_packet_s *shifts); +int et_play_scenario(et_scenario_t *const scenario, const struct shift_packet_s *shifts); #endif /* PLAY_SCENARIO_H_ */ diff --git a/openair3/TEST/EPC_TEST/play_scenario_decode.c b/openair3/TEST/EPC_TEST/play_scenario_decode.c index be63a171c5..cbf1fbd7e9 100644 --- a/openair3/TEST/EPC_TEST/play_scenario_decode.c +++ b/openair3/TEST/EPC_TEST/play_scenario_decode.c @@ -29,140 +29,18 @@ #include "intertask_interface.h" #include "platform_types.h" -#include "s1ap_ies_defs.h" #include "s1ap_eNB_decoder.h" #include "assertions.h" #include "play_scenario.h" //------------------------------------------------------------------------------ -int et_s1ap_decode_initiating_message(s1ap_message *message, S1ap_InitiatingMessage_t *initiating_p) -{ - int ret = -1; - - DevAssert(initiating_p != NULL); - - message->procedureCode = initiating_p->procedureCode; - message->criticality = initiating_p->criticality; - - switch(initiating_p->procedureCode) { - case S1ap_ProcedureCode_id_downlinkNASTransport: - ret = s1ap_decode_s1ap_downlinknastransporties(&message->msg.s1ap_DownlinkNASTransportIEs,&initiating_p->value); - break; - - case S1ap_ProcedureCode_id_InitialContextSetup: - ret = s1ap_decode_s1ap_initialcontextsetuprequesties(&message->msg.s1ap_InitialContextSetupRequestIEs, &initiating_p->value); - break; - - case S1ap_ProcedureCode_id_UEContextRelease: - ret = s1ap_decode_s1ap_uecontextreleasecommandies(&message->msg.s1ap_UEContextReleaseCommandIEs, &initiating_p->value); - break; - - case S1ap_ProcedureCode_id_Paging: - ret = s1ap_decode_s1ap_pagingies(&message->msg.s1ap_PagingIEs, &initiating_p->value); - break; - - case S1ap_ProcedureCode_id_uplinkNASTransport: - ret = s1ap_decode_s1ap_uplinknastransporties (&message->msg.s1ap_UplinkNASTransportIEs, &initiating_p->value); - break; - - case S1ap_ProcedureCode_id_S1Setup: - ret = s1ap_decode_s1ap_s1setuprequesties (&message->msg.s1ap_S1SetupRequestIEs, &initiating_p->value); - break; - - case S1ap_ProcedureCode_id_initialUEMessage: - ret = s1ap_decode_s1ap_initialuemessageies (&message->msg.s1ap_InitialUEMessageIEs, &initiating_p->value); - break; - - case S1ap_ProcedureCode_id_UEContextReleaseRequest: - ret = s1ap_decode_s1ap_uecontextreleaserequesties (&message->msg.s1ap_UEContextReleaseRequestIEs, &initiating_p->value); - break; - - case S1ap_ProcedureCode_id_UECapabilityInfoIndication: - ret = s1ap_decode_s1ap_uecapabilityinfoindicationies (&message->msg.s1ap_UECapabilityInfoIndicationIEs, &initiating_p->value); - break; - - case S1ap_ProcedureCode_id_NASNonDeliveryIndication: - ret = s1ap_decode_s1ap_nasnondeliveryindication_ies (&message->msg.s1ap_NASNonDeliveryIndication_IEs, &initiating_p->value); - break; - - default: - AssertFatal( 0 , "Unknown procedure ID (%d) for initiating message\n", - (int)initiating_p->procedureCode); - return -1; - } - return ret; -} - -//------------------------------------------------------------------------------ -int et_s1ap_decode_successful_outcome(s1ap_message *message, S1ap_SuccessfulOutcome_t *successfullOutcome_p) -{ - int ret = -1; - - DevAssert(successfullOutcome_p != NULL); - - message->procedureCode = successfullOutcome_p->procedureCode; - message->criticality = successfullOutcome_p->criticality; - - switch(successfullOutcome_p->procedureCode) { - case S1ap_ProcedureCode_id_S1Setup: - ret = s1ap_decode_s1ap_s1setupresponseies( - &message->msg.s1ap_S1SetupResponseIEs, &successfullOutcome_p->value); - break; - - case S1ap_ProcedureCode_id_InitialContextSetup: - ret = s1ap_decode_s1ap_initialcontextsetupresponseies (&message->msg.s1ap_InitialContextSetupResponseIEs, &successfullOutcome_p->value); - break; - - case S1ap_ProcedureCode_id_UEContextRelease: - ret = s1ap_decode_s1ap_uecontextreleasecompleteies (&message->msg.s1ap_UEContextReleaseCompleteIEs, &successfullOutcome_p->value); - break; - - default: - AssertFatal(0, "Unknown procedure ID (%d) for successfull outcome message\n", - (int)successfullOutcome_p->procedureCode); - return -1; - } - return ret; -} - -//------------------------------------------------------------------------------ -int et_s1ap_decode_unsuccessful_outcome(s1ap_message *message, S1ap_UnsuccessfulOutcome_t *unSuccessfullOutcome_p) -{ - int ret = -1; - - DevAssert(unSuccessfullOutcome_p != NULL); - - message->procedureCode = unSuccessfullOutcome_p->procedureCode; - message->criticality = unSuccessfullOutcome_p->criticality; - - switch(unSuccessfullOutcome_p->procedureCode) { - case S1ap_ProcedureCode_id_S1Setup: - ret = s1ap_decode_s1ap_s1setupfailureies(&message->msg.s1ap_S1SetupFailureIEs, &unSuccessfullOutcome_p->value); - break; - - case S1ap_ProcedureCode_id_InitialContextSetup: - ret = s1ap_decode_s1ap_initialcontextsetupfailureies (&message->msg.s1ap_InitialContextSetupFailureIEs, &unSuccessfullOutcome_p->value); - break; - - default: - AssertFatal(0,"Unknown procedure ID (%d) for unsuccessfull outcome message\n", - (int)unSuccessfullOutcome_p->procedureCode); - break; - } - return ret; -} - -//------------------------------------------------------------------------------ -int et_s1ap_decode_pdu(S1AP_PDU_t * const pdu, s1ap_message * const message, const uint8_t * const buffer, const uint32_t length) +int et_s1ap_decode_pdu(S1AP_PDU_t *const pdu, const uint8_t *const buffer, const uint32_t length) { asn_dec_rval_t dec_ret; - DevAssert(buffer != NULL); - - memset((void *)pdu, 0, sizeof(S1AP_PDU_t)); - + memset((void *)pdu, 0, sizeof(S1AP_S1AP_PDU_t)); dec_ret = aper_decode(NULL, - &asn_DEF_S1AP_PDU, + &asn_DEF_S1AP_S1AP_PDU, (void **)&pdu, buffer, length, @@ -174,32 +52,14 @@ int et_s1ap_decode_pdu(S1AP_PDU_t * const pdu, s1ap_message * const message, con return -1; } - message->direction = pdu->present; - - switch(pdu->present) { - case S1AP_PDU_PR_initiatingMessage: - return et_s1ap_decode_initiating_message(message, - &pdu->choice.initiatingMessage); - - case S1AP_PDU_PR_successfulOutcome: - return et_s1ap_decode_successful_outcome(message, - &pdu->choice.successfulOutcome); - - case S1AP_PDU_PR_unsuccessfulOutcome: - return et_s1ap_decode_unsuccessful_outcome(message, - &pdu->choice.unsuccessfulOutcome); - - default: - AssertFatal(0, "Unknown presence (%d) or not implemented\n", (int)pdu->present); - break; - } - return -1; + return dec_ret.code; } + //------------------------------------------------------------------------------ -void et_decode_s1ap(et_s1ap_t * const s1ap) +void et_decode_s1ap(et_s1ap_t *const s1ap) { if (NULL != s1ap) { - if (et_s1ap_decode_pdu(&s1ap->pdu, &s1ap->message, s1ap->binary_stream, s1ap->binary_stream_allocated_size) < 0) { + if (et_s1ap_decode_pdu(&s1ap->pdu, s1ap->binary_stream, s1ap->binary_stream_allocated_size) < 0) { AssertFatal (0, "ERROR %s() Cannot decode S1AP message!\n", __FUNCTION__); } } diff --git a/openair3/TEST/EPC_TEST/play_scenario_display.c b/openair3/TEST/EPC_TEST/play_scenario_display.c index e10cbdf9bf..ef238dc3ec 100644 --- a/openair3/TEST/EPC_TEST/play_scenario_display.c +++ b/openair3/TEST/EPC_TEST/play_scenario_display.c @@ -32,11 +32,10 @@ #include "intertask_interface.h" #include "platform_types.h" #include "assertions.h" -#include "s1ap_ies_defs.h" #include "s1ap_eNB_decoder.h" #include "play_scenario.h" //----------------------------------------------------------------------------- -void et_print_hex_octets(const unsigned char * const byte_stream, const unsigned long int num) +void et_print_hex_octets(const unsigned char *const byte_stream, const unsigned long int num) { unsigned long octet_index = 0; @@ -82,11 +81,14 @@ void et_print_hex_octets(const unsigned char * const byte_stream, const unsigned void et_display_node(xmlNodePtr node, unsigned int indent) { int i = 0; + if (node->type == XML_ELEMENT_NODE) { xmlChar *path = xmlGetNodePath(node); + for (i=0; ichildren != NULL && node->children->type == XML_TEXT_NODE) { xmlChar *content = xmlNodeGetContent(node); printf("%s -> %s\n", path, content); @@ -94,6 +96,7 @@ void et_display_node(xmlNodePtr node, unsigned int indent) } else { printf("%s\n", path); } + xmlFree(path); } } @@ -106,70 +109,91 @@ void et_display_tree(xmlNodePtr node, unsigned int indent) if (cur_node->type == XML_ELEMENT_NODE) { et_display_node(cur_node, indent); } + et_display_tree(cur_node->children, indent++); } } //------------------------------------------------------------------------------ -void et_display_packet_s1ap_data(const et_s1ap_t * const s1ap) +void et_display_packet_S1AP_data(const et_S1AP_t *const s1ap) { char *message_string = NULL; if (s1ap) { message_string = calloc(20000, sizeof(char)); AssertFatal (NULL != message_string, "ERROR malloc()failed!\n"); - s1ap_string_total_size = 0; - switch(s1ap->pdu.present) { - case S1AP_PDU_PR_initiatingMessage: - switch(s1ap->pdu.choice.initiatingMessage.procedureCode) { - case S1ap_ProcedureCode_id_downlinkNASTransport: s1ap_xer_print_s1ap_downlinknastransport(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break; - case S1ap_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetuprequest(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break; - case S1ap_ProcedureCode_id_UEContextRelease: s1ap_xer_print_s1ap_uecontextreleasecommand(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break; - case S1ap_ProcedureCode_id_Paging: s1ap_xer_print_s1ap_paging(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break; - case S1ap_ProcedureCode_id_uplinkNASTransport: s1ap_xer_print_s1ap_uplinknastransport(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break; - case S1ap_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setuprequest(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break; - case S1ap_ProcedureCode_id_initialUEMessage: s1ap_xer_print_s1ap_initialuemessage(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break; - case S1ap_ProcedureCode_id_UEContextReleaseRequest: s1ap_xer_print_s1ap_uecontextreleaserequest(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break; - case S1ap_ProcedureCode_id_UECapabilityInfoIndication:s1ap_xer_print_s1ap_uecapabilityinfoindication(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break; - case S1ap_ProcedureCode_id_NASNonDeliveryIndication: s1ap_xer_print_s1ap_nasnondeliveryindication_(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break; - default: - AssertFatal( 0 , "Unknown procedure ID (%d) for initiating message\n", - (int)s1ap->pdu.choice.initiatingMessage.procedureCode); - } - break; - case S1AP_PDU_PR_successfulOutcome: - switch(s1ap->pdu.choice.successfulOutcome.procedureCode) { - case S1ap_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setupresponse(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break; - case S1ap_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetupresponse(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break; - case S1ap_ProcedureCode_id_UEContextRelease: s1ap_xer_print_s1ap_uecontextreleasecomplete(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break; - default: - AssertFatal(0, "Unknown procedure ID (%d) for successfull outcome message\n", - (int)s1ap->pdu.choice.successfulOutcome.procedureCode); - } - break; - case S1AP_PDU_PR_unsuccessfulOutcome: - switch(s1ap->pdu.choice.unsuccessfulOutcome.procedureCode) { - case S1ap_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setupfailure(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break; - case S1ap_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetupfailure(s1ap_xer__print2sp, message_string, (s1ap_message *)&s1ap->message);break; + switch(s1ap->pdu.present) { + case S1AP_S1AP_PDU_PR_initiatingMessage: + switch(s1ap->pdu.choice.initiatingMessage.procedureCode) { + case S1AP_ProcedureCode_id_downlinkNASTransport: s1ap_xer_print_s1ap_downlinknastransport(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; + + case S1AP_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetuprequest(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; + + case S1AP_ProcedureCode_id_UEContextRelease: s1ap_xer_print_s1ap_uecontextreleasecommand(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; + + case S1AP_ProcedureCode_id_Paging: s1ap_xer_print_s1ap_paging(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; + + case S1AP_ProcedureCode_id_uplinkNASTransport: s1ap_xer_print_s1ap_uplinknastransport(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; + + case S1AP_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setuprequest(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; + + case S1AP_ProcedureCode_id_initialUEMessage: s1ap_xer_print_s1ap_initialuemessage(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; + + case S1AP_ProcedureCode_id_UEContextReleaseRequest: s1ap_xer_print_s1ap_uecontextreleaserequest(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; + + case S1AP_ProcedureCode_id_UECapabilityInfoIndication:s1ap_xer_print_s1ap_uecapabilityinfoindication(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; + + case S1AP_ProcedureCode_id_NASNonDeliveryIndication: s1ap_xer_print_s1ap_nasnondeliveryindication_(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; + + default: + AssertFatal( 0, "Unknown procedure ID (%d) for initiating message\n", + (int)s1ap->pdu.choice.initiatingMessage.procedureCode); + } + + break; + + case S1AP_S1AP_PDU_PR_successfulOutcome: + switch(s1ap->pdu.choice.successfulOutcome.procedureCode) { + case S1AP_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setupresponse(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; + + case S1AP_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetupresponse(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; + + case S1AP_ProcedureCode_id_UEContextRelease: s1ap_xer_print_s1ap_uecontextreleasecomplete(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; + + default: + AssertFatal(0, "Unknown procedure ID (%d) for successfull outcome message\n", + (int)s1ap->pdu.choice.successfulOutcome.procedureCode); + } + + break; + + case S1AP_S1AP_PDU_PR_unsuccessfulOutcome: + switch(s1ap->pdu.choice.unsuccessfulOutcome.procedureCode) { + case S1AP_ProcedureCode_id_S1Setup: s1ap_xer_print_s1ap_s1setupfailure(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; + + case S1AP_ProcedureCode_id_InitialContextSetup: s1ap_xer_print_s1ap_initialcontextsetupfailure(s1ap_xer__print2sp, message_string, (S1AP_message *)&s1ap->message); break; + + default: + et_free_pointer(message_string); + AssertFatal(0,"Unknown procedure ID (%d) for unsuccessfull outcome message\n", + (int)s1ap->pdu.choice.unsuccessfulOutcome.procedureCode); + break; + } + + break; + default: - et_free_pointer(message_string); - AssertFatal(0,"Unknown procedure ID (%d) for unsuccessfull outcome message\n", - (int)s1ap->pdu.choice.unsuccessfulOutcome.procedureCode); + AssertFatal(0, "Unknown presence (%d) or not implemented\n", (int)s1ap->pdu.present); break; - } - break; - default: - AssertFatal(0, "Unknown presence (%d) or not implemented\n", (int)s1ap->pdu.present); - break; } + fprintf(stdout, "\t\tSCTP.data XML dump:\n%s\n", message_string); et_free_pointer(message_string); } } //------------------------------------------------------------------------------ -void et_display_packet_sctp_init(const sctp_inithdr_t * const sctp) +void et_display_packet_sctp_init(const sctp_inithdr_t *const sctp) { - if (sctp) { fprintf(stdout, "\t\tSCTP.init.init_tag : %u\n", sctp->init_tag); fprintf(stdout, "\t\tSCTP.init.a_rwnd : %u\n", sctp->a_rwnd); @@ -179,9 +203,8 @@ void et_display_packet_sctp_init(const sctp_inithdr_t * const sctp) } } //------------------------------------------------------------------------------ -void et_display_packet_sctp_initack(const sctp_initackhdr_t * const sctp) +void et_display_packet_sctp_initack(const sctp_initackhdr_t *const sctp) { - if (sctp) { fprintf(stdout, "\t\tSCTP.initack.init_tag : %u\n", sctp->init_tag); fprintf(stdout, "\t\tSCTP.initack.a_rwnd : %u\n", sctp->a_rwnd); @@ -191,17 +214,20 @@ void et_display_packet_sctp_initack(const sctp_initackhdr_t * const sctp) } } //------------------------------------------------------------------------------ -void et_display_packet_sctp_data(const sctp_datahdr_t * const sctp) +void et_display_packet_sctp_data(const sctp_datahdr_t *const sctp) { if (sctp) { fprintf(stdout, "\t\tSCTP.data.tsn : %u\n", sctp->tsn); fprintf(stdout, "\t\tSCTP.data.stream : %u\n", sctp->stream); fprintf(stdout, "\t\tSCTP.data.ssn : %u\n", sctp->ssn); fprintf(stdout, "\t\tSCTP.data.ppid : %u\n", sctp->ppid); + if (sctp->ppid == 18) { et_display_packet_s1ap_data(&sctp->payload); } + fprintf(stdout, "\t\tSCTP.data.binary_stream_allocated_size : %u\n", sctp->payload.binary_stream_allocated_size); + if (NULL != sctp->payload.binary_stream) { fprintf(stdout, "\t\tSCTP.data.binary_stream :\n"); et_print_hex_octets(sctp->payload.binary_stream, sctp->payload.binary_stream_allocated_size); @@ -212,29 +238,33 @@ void et_display_packet_sctp_data(const sctp_datahdr_t * const sctp) } //------------------------------------------------------------------------------ -void et_display_packet_sctp(const et_sctp_hdr_t * const sctp) +void et_display_packet_sctp(const et_sctp_hdr_t *const sctp) { if (sctp) { fprintf(stdout, "\t\tSCTP.src_port : %u\n", sctp->src_port); fprintf(stdout, "\t\tSCTP.dst_port : %u\n", sctp->dst_port); fprintf(stdout, "\t\tSCTP.chunk_type : %s\n", et_chunk_type_cid2str(sctp->chunk_type)); + switch (sctp->chunk_type) { case SCTP_CID_DATA: et_display_packet_sctp_data(&sctp->u.data_hdr); break; + case SCTP_CID_INIT: et_display_packet_sctp_initack(&sctp->u.init_hdr); break; + case SCTP_CID_INIT_ACK: et_display_packet_sctp_initack(&sctp->u.init_ack_hdr); break; + default: ; } } } //------------------------------------------------------------------------------ -void et_display_packet_ip(const et_ip_hdr_t * const ip) +void et_display_packet_ip(const et_ip_hdr_t *const ip) { if (ip) { fprintf(stdout, "\t\tSource address : %s\n", et_ip2ip_str(&ip->src)); @@ -243,61 +273,73 @@ void et_display_packet_ip(const et_ip_hdr_t * const ip) } //------------------------------------------------------------------------------ -void et_display_packet(const et_packet_t * const packet) +void et_display_packet(const et_packet_t *const packet) { if (packet) { fprintf(stdout, "-------------------------------------------------------------------------------\n"); fprintf(stdout, "\tPacket:\tnum %u | original frame number %u \n", packet->packet_number, packet->original_frame_number); fprintf(stdout, "\tPacket:\ttime relative to 1st packet %ld.%06lu\n", - packet->time_relative_to_first_packet.tv_sec, packet->time_relative_to_first_packet.tv_usec); + packet->time_relative_to_first_packet.tv_sec, packet->time_relative_to_first_packet.tv_usec); fprintf(stdout, "\tPacket:\ttime relative to last tx packet %ld.%06lu\n", - packet->time_relative_to_last_sent_packet.tv_sec, packet->time_relative_to_last_sent_packet.tv_usec); + packet->time_relative_to_last_sent_packet.tv_sec, packet->time_relative_to_last_sent_packet.tv_usec); fprintf(stdout, "\tPacket:\ttime relative to last_received packet %ld.%06lu\n", - packet->time_relative_to_last_received_packet.tv_sec, packet->time_relative_to_last_received_packet.tv_usec); + packet->time_relative_to_last_received_packet.tv_sec, packet->time_relative_to_last_received_packet.tv_usec); switch(packet->action) { - case ET_PACKET_ACTION_S1C_SEND: - fprintf(stdout, "\tPacket:\tAction SEND\n"); - break; - case ET_PACKET_ACTION_S1C_RECEIVE: - fprintf(stdout, "\tPacket:\tAction RECEIVE\n"); - break; - default: - fprintf(stdout, "\tPacket:\tAction UNKNOWN\n"); + case ET_PACKET_ACTION_S1C_SEND: + fprintf(stdout, "\tPacket:\tAction SEND\n"); + break; + + case ET_PACKET_ACTION_S1C_RECEIVE: + fprintf(stdout, "\tPacket:\tAction RECEIVE\n"); + break; + + default: + fprintf(stdout, "\tPacket:\tAction UNKNOWN\n"); } + switch(packet->status) { - case ET_PACKET_STATUS_NONE: - fprintf(stdout, "\tPacket:\tStatus NONE\n"); - break; - case ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT: - fprintf(stdout, "\tPacket:\tStatus NOT_TAKEN_IN_ACCOUNT\n"); - break; - case ET_PACKET_STATUS_SCHEDULED_FOR_SENDING: - fprintf(stdout, "\tPacket:\tStatus SCHEDULED_FOR_SENDING\n"); - break; - case ET_PACKET_STATUS_SENT: - fprintf(stdout, "\tPacket:\tStatus SENT\n"); - break; - case ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING: - fprintf(stdout, "\tPacket:\tStatus SCHEDULED_FOR_RECEIVING\n"); - break; - case ET_PACKET_STATUS_RECEIVED: - fprintf(stdout, "\tPacket:\tStatus RECEIVED\n"); - break; - default: - fprintf(stdout, "\tPacket:\tStatus UNKNOWN\n"); + case ET_PACKET_STATUS_NONE: + fprintf(stdout, "\tPacket:\tStatus NONE\n"); + break; + + case ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT: + fprintf(stdout, "\tPacket:\tStatus NOT_TAKEN_IN_ACCOUNT\n"); + break; + + case ET_PACKET_STATUS_SCHEDULED_FOR_SENDING: + fprintf(stdout, "\tPacket:\tStatus SCHEDULED_FOR_SENDING\n"); + break; + + case ET_PACKET_STATUS_SENT: + fprintf(stdout, "\tPacket:\tStatus SENT\n"); + break; + + case ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING: + fprintf(stdout, "\tPacket:\tStatus SCHEDULED_FOR_RECEIVING\n"); + break; + + case ET_PACKET_STATUS_RECEIVED: + fprintf(stdout, "\tPacket:\tStatus RECEIVED\n"); + break; + + default: + fprintf(stdout, "\tPacket:\tStatus UNKNOWN\n"); } + et_display_packet_ip(&packet->ip_hdr); et_display_packet_sctp(&packet->sctp_hdr); } } //------------------------------------------------------------------------------ -void et_display_scenario(const et_scenario_t * const scenario) +void et_display_scenario(const et_scenario_t *const scenario) { et_packet_t *packet = NULL; + if (scenario) { - fprintf(stdout, "Scenario: %s\n", (scenario->name != NULL) ? (char*)scenario->name:"UNKNOWN NAME"); + fprintf(stdout, "Scenario: %s\n", (scenario->name != NULL) ? (char *)scenario->name:"UNKNOWN NAME"); packet = scenario->list_packet; + while (packet) { et_display_packet(packet); packet = packet->next; diff --git a/openair3/TEST/EPC_TEST/play_scenario_fsm.c b/openair3/TEST/EPC_TEST/play_scenario_fsm.c index 1589b83cae..8d8f5ec921 100644 --- a/openair3/TEST/EPC_TEST/play_scenario_fsm.c +++ b/openair3/TEST/EPC_TEST/play_scenario_fsm.c @@ -34,7 +34,6 @@ #include "platform_types.h" #include "assertions.h" #include "play_scenario.h" -#include "s1ap_ies_defs.h" #include "play_scenario_s1ap_eNB_defs.h" #include "timer.h" @@ -47,7 +46,7 @@ et_fsm_state_t g_fsm_state = ET_FSM_STATE_NULL; uint32_t g_constraints = ET_BIT_MASK_MATCH_SCTP_STREAM | ET_BIT_MASK_MATCH_SCTP_SSN; //------------------------------------------------------------------------------ // it is assumed that if a time is negative tv_sec and tv_usec are both negative -void timeval_add (struct timeval * const result, const struct timeval * const a, const struct timeval * const b) +void timeval_add (struct timeval *const result, const struct timeval *const a, const struct timeval *const b) { AssertFatal(((a->tv_sec <= 0) && (a->tv_usec <= 0)) || ((a->tv_sec >= 0) && (a->tv_usec >= 0)), " Bad time format arg a\n"); AssertFatal(((b->tv_sec <= 0) && (b->tv_usec <= 0)) || ((b->tv_sec >= 0) && (b->tv_usec >= 0)), " Bad time format arg b\n"); @@ -55,6 +54,7 @@ void timeval_add (struct timeval * const result, const struct timeval * const a, long long int r = a->tv_usec + b->tv_usec + (a->tv_sec + b->tv_sec) * 1000000; result->tv_sec = r / (long long int)1000000; result->tv_usec = r % (long long int)1000000; + if ((result != a) && (result != b)) { LOG_D(ENB_APP, "timeval_add(%ld.%06d, %ld.%06d)=%ld.%06d\n", a->tv_sec, a->tv_usec, b->tv_sec, b->tv_usec, result->tv_sec, result->tv_usec); } @@ -63,7 +63,7 @@ void timeval_add (struct timeval * const result, const struct timeval * const a, //------------------------------------------------------------------------------ // it is assumed that if a time is negative tv_sec and tv_usec are both negative // return true if result is positive -int timeval_subtract (struct timeval * const result, struct timeval * const a, struct timeval * const b) +int timeval_subtract (struct timeval *const result, struct timeval *const a, struct timeval *const b) { AssertFatal(((a->tv_sec <= 0) && (a->tv_usec <= 0)) || ((a->tv_sec >= 0) && (a->tv_usec >= 0)), " Bad time format arg a\n"); AssertFatal(((b->tv_sec <= 0) && (b->tv_usec <= 0)) || ((b->tv_sec >= 0) && (b->tv_usec >= 0)), " Bad time format arg b\n"); @@ -71,26 +71,30 @@ int timeval_subtract (struct timeval * const result, struct timeval * const a, s long long int r = a->tv_usec - b->tv_usec + (a->tv_sec - b->tv_sec) * 1000000; result->tv_sec = r / (long long int)1000000; result->tv_usec = r % (long long int)1000000; + if ((result != a) && (result != b)) { LOG_D(ENB_APP, "timeval_subtract(%ld.%06d, %ld.%06d)=%ld.%06d\n", a->tv_sec, a->tv_usec, b->tv_sec, b->tv_usec, result->tv_sec, result->tv_usec); } + return (result->tv_sec >= 0) && (result->tv_usec >= 0); } //------------------------------------------------------------------------------ -void et_scenario_wait_rx_packet(et_packet_t * const packet) +void et_scenario_wait_rx_packet(et_packet_t *const packet) { packet->status = ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING; g_fsm_state = ET_FSM_STATE_WAITING_RX_EVENT; + if (timer_setup (ET_FSM_STATE_WAITING_RX_EVENT_DELAY_SEC, 0, TASK_S1AP, INSTANCE_DEFAULT, TIMER_ONE_SHOT, - packet, &packet->timer_id) < 0) { + packet, &packet->timer_id) < 0) { AssertFatal(0, " Can not start waiting RX event timer\n"); } + g_scenario->timer_count++; LOG_D(ENB_APP, "Waiting RX packet num %d original frame number %u\n", packet->packet_number, packet->original_frame_number); } //------------------------------------------------------------------------------ -void et_scenario_schedule_tx_packet(et_packet_t * packet) +void et_scenario_schedule_tx_packet(et_packet_t *packet) { s1ap_eNB_instance_t *s1ap_eNB_instance = NULL; struct timeval now = { .tv_sec = 0, .tv_usec = 0 }; @@ -101,11 +105,9 @@ void et_scenario_schedule_tx_packet(et_packet_t * packet) int last_packet_was_rx = 0; int we_are_too_late = 0; int original_frame_number = -1; - AssertFatal(NULL != packet, "packet argument is NULL"); s1ap_eNB_instance = et_s1ap_eNB_get_instance(packet->enb_instance); AssertFatal(NULL != s1ap_eNB_instance, "Cannot get s1ap_eNB_instance_t for eNB instance %d", packet->enb_instance); - LOG_D(ENB_APP, "%s\n", __FUNCTION__); g_fsm_state = ET_FSM_STATE_WAITING_TX_EVENT; @@ -118,8 +120,8 @@ void et_scenario_schedule_tx_packet(et_packet_t * packet) timeval_subtract(&offset_last_rx_packet,&now,&g_scenario->time_last_rx_packet); LOG_D(ENB_APP, "offset_last_tx_packet=%ld.%06d\n", offset_last_tx_packet.tv_sec, offset_last_tx_packet.tv_usec); LOG_D(ENB_APP, "offset_last_rx_packet=%ld.%06d\n", offset_last_rx_packet.tv_sec, offset_last_rx_packet.tv_usec); - last_packet_was_rx = timeval_subtract(&offset_tx_rx,&offset_last_tx_packet,&offset_last_rx_packet); + if (last_packet_was_rx) { LOG_D(ENB_APP, "last_packet_was_rx\n"); we_are_too_late = timeval_subtract(&offset,&offset_last_rx_packet,&packet->time_relative_to_last_received_packet); @@ -129,30 +131,32 @@ void et_scenario_schedule_tx_packet(et_packet_t * packet) we_are_too_late = timeval_subtract(&offset,&offset_last_tx_packet,&packet->time_relative_to_last_sent_packet); LOG_D(ENB_APP, "we_are_too_late=%d, offset=%ld.%06d\n", we_are_too_late, offset.tv_sec, offset.tv_usec); } - if ((0 == we_are_too_late) && (0 == g_max_speed)){ + + if ((0 == we_are_too_late) && (0 == g_max_speed)) { // set timer - if ((offset.tv_sec <= 0) || (offset.tv_usec <= 0)){ + if ((offset.tv_sec <= 0) || (offset.tv_usec <= 0)) { offset.tv_sec = -offset.tv_sec; offset.tv_usec = -offset.tv_usec; } LOG_D(ENB_APP, "Send packet num %u original frame number %u in %ld.%06d sec\n", - packet->packet_number, packet->original_frame_number, offset.tv_sec, offset.tv_usec); - + packet->packet_number, packet->original_frame_number, offset.tv_sec, offset.tv_usec); packet->status = ET_PACKET_STATUS_SCHEDULED_FOR_SENDING; + if (timer_setup (offset.tv_sec, offset.tv_usec, TASK_S1AP, INSTANCE_DEFAULT, TIMER_ONE_SHOT,packet, &packet->timer_id) < 0) { AssertFatal(0, " Can not start TX event timer\n"); } + g_scenario->timer_count++; // Done g_fsm_state = ET_FSM_STATE_WAITING_TX_EVENT; } else { // send immediately AssertFatal(0 == gettimeofday(&packet->timestamp_packet, NULL), "gettimeofday() Failed"); original_frame_number = packet->original_frame_number; + do { g_scenario->time_last_tx_packet.tv_sec = packet->timestamp_packet.tv_sec; g_scenario->time_last_tx_packet.tv_usec = packet->timestamp_packet.tv_usec; - LOG_D(ENB_APP, "Sending packet num %d original frame number %u immediately\n",packet->packet_number, packet->original_frame_number); et_s1ap_eNB_itti_send_sctp_data_req( packet->enb_instance, @@ -164,13 +168,17 @@ void et_scenario_schedule_tx_packet(et_packet_t * packet) g_scenario->next_packet = g_scenario->next_packet->next; packet = packet->next; } while ((NULL != packet) && (packet->original_frame_number == original_frame_number)); + g_fsm_state = ET_FSM_STATE_RUNNING; } + break; + case SCTP_CID_INIT: case SCTP_CID_INIT_ACK: AssertFatal(0, "Invalid case TX packet SCTP_CID_INIT or SCTP_CID_INIT_ACK"); break; + default: AssertFatal(0, "Invalid case TX packet SCTP_CID %d", packet->sctp_hdr.chunk_type); } @@ -178,23 +186,22 @@ void et_scenario_schedule_tx_packet(et_packet_t * packet) //------------------------------------------------------------------------------ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event) { - - switch (event.code){ + switch (event.code) { case ET_EVENT_TICK: while (NULL != g_scenario->next_packet) { LOG_D(ENB_APP, "EVENT_TICK: Considering packet num %d original frame number %u\n", g_scenario->next_packet->packet_number, g_scenario->next_packet->original_frame_number); + switch (g_scenario->next_packet->sctp_hdr.chunk_type) { case SCTP_CID_DATA : + // no init in this scenario, may be sub-scenario if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_SEND) { if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) { et_scenario_schedule_tx_packet(g_scenario->next_packet); pthread_mutex_unlock(&g_fsm_lock); - et_event_t continue_event; continue_event.code = ET_EVENT_TICK; et_scenario_fsm_notify_event(continue_event); - return g_fsm_state; } else if (g_scenario->next_packet->status != ET_PACKET_STATUS_SCHEDULED_FOR_SENDING) { AssertFatal(0, "Invalid packet status %d", g_scenario->next_packet->status); @@ -202,7 +209,6 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event) } else if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_RECEIVE) { if (g_scenario->next_packet->status == ET_PACKET_STATUS_RECEIVED) { g_scenario->next_packet = g_scenario->next_packet->next; - } else if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) { et_scenario_wait_rx_packet(g_scenario->next_packet); pthread_mutex_unlock(&g_fsm_lock); @@ -213,6 +219,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event) } else { AssertFatal(0, "Invalid packet action %d", g_scenario->next_packet->action); } + break; case SCTP_CID_INIT: @@ -224,8 +231,8 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event) case SCTP_CID_ECN_ECNE: case SCTP_CID_ECN_CWR: LOG_D(ENB_APP, "EVENT_TICK: Ignoring packet num %d SCTP CID %s\n", - g_scenario->next_packet->packet_number, - et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type)); + g_scenario->next_packet->packet_number, + et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type)); g_scenario->next_packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT; g_scenario->next_packet = g_scenario->next_packet->next; break; @@ -236,20 +243,22 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event) case SCTP_CID_ERROR: case SCTP_CID_SHUTDOWN_COMPLETE: AssertFatal(0, "The scenario should be cleaned (packet %s cannot be processed at this time)", - et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type)); + et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type)); break; default: LOG_D(ENB_APP, "EVENT_TICK: Ignoring packet num %d SCTP CID %s\n", - g_scenario->next_packet->packet_number, - et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type)); + g_scenario->next_packet->packet_number, + et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type)); g_scenario->next_packet->status = ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT; g_scenario->next_packet = g_scenario->next_packet->next; } } + fprintf(stderr, "No Packet found in this scenario: %s\n", g_scenario->name); g_fsm_state = ET_FSM_STATE_NULL; pthread_mutex_unlock(&g_fsm_lock); + if (0 == g_scenario->timer_count) { fprintf(stderr, "End of scenario: %s\n", g_scenario->name); fflush(stderr); @@ -257,21 +266,27 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_running(et_event_t event) return 0; //exit(0); } + fprintf(stderr, "Remaining timers running: %d\n", g_scenario->timer_count); return g_fsm_state; break; + case ET_EVENT_RX_PACKET_TIME_OUT: AssertFatal(0, "Event ET_EVENT_RX_PACKET_TIME_OUT not handled in FSM state ET_FSM_STATE_RUNNING"); break; + case ET_EVENT_TX_TIMED_PACKET: AssertFatal(0, "Event ET_EVENT_TX_TIMED_PACKET not handled in FSM state ET_FSM_STATE_RUNNING"); break; + case ET_EVENT_RX_S1AP: et_s1ap_process_rx_packet(&event.u.s1ap_data_ind); break; + default: AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_RUNNING", event.code); } + pthread_mutex_unlock(&g_fsm_lock); return 0; } @@ -283,7 +298,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event) int original_frame_number = -1; et_packet_t *packet = NULL; - switch (event.code){ + switch (event.code) { case ET_EVENT_TICK: fprintf(stdout, "EVENT_TICK: waiting for tx event\n"); break; @@ -296,23 +311,23 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event) // send immediately packet = event.u.tx_timed_packet; AssertFatal(0 == gettimeofday(&packet->timestamp_packet, NULL), "gettimeofday() Failed"); - original_frame_number = packet->original_frame_number; + do { g_scenario->time_last_tx_packet.tv_sec = packet->timestamp_packet.tv_sec; g_scenario->time_last_tx_packet.tv_usec = packet->timestamp_packet.tv_usec; - LOG_D(ENB_APP, "Sending packet num %d original frame number %u immediately\n",packet->packet_number, packet->original_frame_number); et_s1ap_eNB_itti_send_sctp_data_req( - packet->enb_instance, - packet->sctp_hdr.u.data_hdr.assoc_id, - packet->sctp_hdr.u.data_hdr.payload.binary_stream, - packet->sctp_hdr.u.data_hdr.payload.binary_stream_allocated_size, - packet->sctp_hdr.u.data_hdr.stream); + packet->enb_instance, + packet->sctp_hdr.u.data_hdr.assoc_id, + packet->sctp_hdr.u.data_hdr.payload.binary_stream, + packet->sctp_hdr.u.data_hdr.payload.binary_stream_allocated_size, + packet->sctp_hdr.u.data_hdr.stream); packet->status = ET_PACKET_STATUS_SENT; packet = packet->next; g_scenario->next_packet = packet; } while ( (NULL != packet) && (packet->original_frame_number == original_frame_number)); + g_fsm_state = ET_FSM_STATE_RUNNING; break; @@ -320,6 +335,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event) default: AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_WAITING_TX", event.code); } + pthread_mutex_unlock(&g_fsm_lock); return 0; } @@ -328,7 +344,8 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_tx(et_event_t event) et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_rx(et_event_t event) { int rv = 0; - switch (event.code){ + + switch (event.code) { case ET_EVENT_TICK: fprintf(stdout, "EVENT_TICK: waiting for rx event\n"); break; @@ -341,16 +358,19 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_rx(et_event_t event) case ET_EVENT_RX_S1AP: rv = et_s1ap_process_rx_packet(&event.u.s1ap_data_ind); + // waited packet if (rv == 0) { g_fsm_state = ET_FSM_STATE_RUNNING; } + break; case ET_EVENT_TX_TIMED_PACKET: default: AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_WAITING_RX", event.code); } + pthread_mutex_unlock(&g_fsm_lock); return 0; } @@ -358,8 +378,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_waiting_rx(et_event_t event) //------------------------------------------------------------------------------ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t event) { - - switch (event.code){ + switch (event.code) { case ET_EVENT_TICK: break; @@ -370,22 +389,20 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even while (NULL != g_scenario->next_packet) { switch (g_scenario->next_packet->sctp_hdr.chunk_type) { case SCTP_CID_DATA : + // no init in this scenario, may be sub-scenario if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_SEND) { et_scenario_schedule_tx_packet(g_scenario->next_packet); pthread_mutex_unlock(&g_fsm_lock); - et_event_t continue_event; continue_event.code = ET_EVENT_TICK; et_scenario_fsm_notify_event(continue_event); - return g_fsm_state; } else if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_RECEIVE) { if (g_scenario->next_packet->status == ET_PACKET_STATUS_RECEIVED) { g_scenario->last_rx_packet = g_scenario->next_packet; g_scenario->time_last_rx_packet = g_scenario->last_rx_packet->timestamp_packet; g_scenario->next_packet = g_scenario->next_packet->next; - } else if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) { et_scenario_wait_rx_packet(g_scenario->next_packet); pthread_mutex_unlock(&g_fsm_lock); @@ -396,7 +413,8 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even } else { AssertFatal(0, "Invalid packet action %d", g_scenario->next_packet->action); } - break; + + break; case SCTP_CID_INIT: case SCTP_CID_INIT_ACK: @@ -416,7 +434,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even case SCTP_CID_ERROR: case SCTP_CID_SHUTDOWN_COMPLETE: AssertFatal(0, "The scenario should be cleaned (packet %s cannot be processed at this time)", - et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type)); + et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type)); break; default: @@ -424,15 +442,18 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even g_scenario->next_packet = g_scenario->next_packet->next; } } + fprintf(stderr, "No Packet found in this scenario: %s\n", g_scenario->name); g_fsm_state = ET_FSM_STATE_NULL; pthread_mutex_unlock(&g_fsm_lock); + if (0 == g_scenario->timer_count) { fprintf(stderr, "End of scenario: %s\n", g_scenario->name); fflush(stderr); fflush(stdout); exit(0); } + fprintf(stderr, "Remaining timers running: %d\n", g_scenario->timer_count); return g_fsm_state; break; @@ -440,13 +461,14 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_connecting_s1c(et_event_t even default: AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_CONNECTING_S1C", event.code); } + pthread_mutex_unlock(&g_fsm_lock); return 0; } //------------------------------------------------------------------------------ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event) { - switch (event.code){ + switch (event.code) { case ET_EVENT_TICK: break; @@ -459,24 +481,21 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event) while (NULL != g_scenario->next_packet) { switch (g_scenario->next_packet->sctp_hdr.chunk_type) { - case SCTP_CID_DATA : + // no init in this scenario, may be sub-scenario, ... if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_SEND) { et_scenario_schedule_tx_packet(g_scenario->next_packet); pthread_mutex_unlock(&g_fsm_lock); - et_event_t continue_event; continue_event.code = ET_EVENT_TICK; et_scenario_fsm_notify_event(continue_event); - return g_fsm_state; } else if (g_scenario->next_packet->action == ET_PACKET_ACTION_S1C_RECEIVE) { if (g_scenario->next_packet->status == ET_PACKET_STATUS_RECEIVED) { g_scenario->last_rx_packet = g_scenario->next_packet; g_scenario->time_last_rx_packet = g_scenario->last_rx_packet->timestamp_packet; g_scenario->next_packet = g_scenario->next_packet->next; - } else if (g_scenario->next_packet->status == ET_PACKET_STATUS_NONE) { et_scenario_wait_rx_packet(g_scenario->next_packet); pthread_mutex_unlock(&g_fsm_lock); @@ -487,6 +506,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event) } else { AssertFatal(0, "Invalid packet action %d", g_scenario->next_packet->action); } + break; case SCTP_CID_INIT: @@ -519,7 +539,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event) case SCTP_CID_ERROR: case SCTP_CID_SHUTDOWN_COMPLETE: AssertFatal(0, "The scenario should be cleaned (packet %s cannot be processed at this time)", - et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type)); + et_chunk_type_cid2str(g_scenario->next_packet->sctp_hdr.chunk_type)); break; default: @@ -527,6 +547,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event) g_scenario->next_packet = g_scenario->next_packet->next; } } + fprintf(stderr, "No Useful packet found in this scenario: %s\n", g_scenario->name); g_fsm_state = ET_FSM_STATE_NULL; pthread_mutex_unlock(&g_fsm_lock); @@ -536,6 +557,7 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event) default: AssertFatal(0, "Case event %d not handled in ET_FSM_STATE_NULL", event.code); } + return 0; } @@ -543,17 +565,23 @@ et_fsm_state_t et_scenario_fsm_notify_event_state_null(et_event_t event) et_fsm_state_t et_scenario_fsm_notify_event(et_event_t event) { AssertFatal((event.code >= ET_EVENT_START) && (event.code < ET_EVENT_END), "Unknown et_event_t.code %d", event.code); - pthread_mutex_lock(&g_fsm_lock); - switch (g_fsm_state){ + + switch (g_fsm_state) { case ET_FSM_STATE_NULL: return et_scenario_fsm_notify_event_state_null(event); break; + case ET_FSM_STATE_CONNECTING_S1C: return et_scenario_fsm_notify_event_state_connecting_s1c(event); break; + case ET_FSM_STATE_WAITING_TX_EVENT: return et_scenario_fsm_notify_event_state_waiting_tx(event); break; + case ET_FSM_STATE_WAITING_RX_EVENT: return et_scenario_fsm_notify_event_state_waiting_rx(event); break; + case ET_FSM_STATE_RUNNING: return et_scenario_fsm_notify_event_state_running(event); break; + default: AssertFatal(0, "Case fsm_state %d not handled", g_fsm_state); } + pthread_mutex_unlock(&g_fsm_lock); return g_fsm_state; } diff --git a/openair3/TEST/EPC_TEST/play_scenario_s1ap.c b/openair3/TEST/EPC_TEST/play_scenario_s1ap.c index 95df0fc306..aca2b66bca 100644 --- a/openair3/TEST/EPC_TEST/play_scenario_s1ap.c +++ b/openair3/TEST/EPC_TEST/play_scenario_s1ap.c @@ -60,6 +60,7 @@ int et_s1ap_eNB_compare_assoc_id( if (p1->cnx_id < p2->cnx_id) { return -1; } + if (p1->cnx_id > p2->cnx_id) { return 1; } @@ -67,6 +68,7 @@ int et_s1ap_eNB_compare_assoc_id( if (p1->assoc_id < p2->assoc_id) { return -1; } + if (p1->assoc_id > p2->assoc_id) { return 1; } @@ -82,16 +84,12 @@ uint32_t et_s1ap_generate_eNB_id(void) char hostname[50]; int ret; uint32_t eNB_id; - /* Retrieve the host name */ ret = gethostname(hostname, sizeof(hostname)); DevAssert(ret == 0); - out = crypt(hostname, "eurecom"); DevAssert(out != NULL); - eNB_id = ((out[0] << 24) | (out[1] << 16) | (out[2] << 8) | out[3]); - return eNB_id; } //------------------------------------------------------------------------------ @@ -111,7 +109,6 @@ void et_s1ap_eNB_prepare_internal_data(void) void et_s1ap_eNB_insert_new_instance(s1ap_eNB_instance_t *new_instance_p) { DevAssert(new_instance_p != NULL); - STAILQ_INSERT_TAIL(&s1ap_eNB_internal_data.s1ap_eNB_instances_head, new_instance_p, s1ap_eNB_entries); } @@ -123,9 +120,7 @@ struct s1ap_eNB_mme_data_s *et_s1ap_eNB_get_MME( { struct s1ap_eNB_mme_data_s temp; struct s1ap_eNB_mme_data_s *found; - memset(&temp, 0, sizeof(struct s1ap_eNB_mme_data_s)); - temp.assoc_id = assoc_id; temp.cnx_id = cnx_id; @@ -149,7 +144,6 @@ struct s1ap_eNB_mme_data_s *et_s1ap_eNB_get_MME( s1ap_eNB_instance_t *et_s1ap_eNB_get_instance(instance_t instance) { s1ap_eNB_instance_t *temp = NULL; - STAILQ_FOREACH(temp, &s1ap_eNB_internal_data.s1ap_eNB_instances_head, s1ap_eNB_entries) { if (temp->instance == instance) { @@ -157,208 +151,210 @@ s1ap_eNB_instance_t *et_s1ap_eNB_get_instance(instance_t instance) return temp; } } - return NULL; } //------------------------------------------------------------------------------ void et_s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uint8_t *buffer, - uint32_t buffer_length, uint16_t stream) + uint32_t buffer_length, uint16_t stream) { MessageDef *message_p; sctp_data_req_t *sctp_data_req; - message_p = itti_alloc_new_message(TASK_S1AP, SCTP_DATA_REQ); - sctp_data_req = &message_p->ittiMsg.sctp_data_req; - sctp_data_req->assoc_id = assoc_id; sctp_data_req->buffer = buffer; sctp_data_req->buffer_length = buffer_length; sctp_data_req->stream = stream; - itti_send_msg_to_task(TASK_SCTP, instance, message_p); } //------------------------------------------------------------------------------ -int et_handle_s1ap_mismatch_mme_ue_s1ap_id(et_packet_t * const spacket, et_packet_t * const rx_packet) +int et_handle_s1ap_mismatch_mme_ue_s1ap_id(et_packet_t *const spacket, et_packet_t *const rx_packet) { S1ap_MME_UE_S1AP_ID_t scenario_mme_ue_s1ap_id = 0; S1ap_MME_UE_S1AP_ID_t rx_mme_ue_s1ap_id = 0; S1AP_PDU_PR present; - present = rx_packet->sctp_hdr.u.data_hdr.payload.pdu.present; switch (rx_packet->sctp_hdr.u.data_hdr.payload.message.procedureCode) { - case S1ap_ProcedureCode_id_HandoverPreparation: - if (present == S1AP_PDU_PR_initiatingMessage) { + case S1AP_ProcedureCode_id_HandoverPreparation: + if (present == S1AP_S1AP_PDU_PR_initiatingMessage) { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverRequiredIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverRequiredIEs.mme_ue_s1ap_id; } else { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverCommandIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverCommandIEs.mme_ue_s1ap_id; } + break; - case S1ap_ProcedureCode_id_HandoverResourceAllocation: - if (present == S1AP_PDU_PR_initiatingMessage) { + case S1AP_ProcedureCode_id_HandoverResourceAllocation: + if (present == S1AP_S1AP_PDU_PR_initiatingMessage) { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverRequestIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverRequestIEs.mme_ue_s1ap_id; - } else if (present == S1AP_PDU_PR_successfulOutcome) { + } else if (present == S1AP_S1AP_PDU_PR_successfulOutcome) { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverRequestAcknowledgeIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverRequestAcknowledgeIEs.mme_ue_s1ap_id; - } else if (present == S1AP_PDU_PR_unsuccessfulOutcome) { + } else if (present == S1AP_S1AP_PDU_PR_unsuccessfulOutcome) { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverFailureIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverFailureIEs.mme_ue_s1ap_id; } + break; - case S1ap_ProcedureCode_id_HandoverNotification: + case S1AP_ProcedureCode_id_HandoverNotification: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverNotifyIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverNotifyIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_PathSwitchRequest: + case S1AP_ProcedureCode_id_PathSwitchRequest: //rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_PathSwitchRequestIEs.mme_ue_s1ap_id; //scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_PathSwitchRequestIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_HandoverCancel: + case S1AP_ProcedureCode_id_HandoverCancel: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverCancelIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_HandoverCancelIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_E_RABSetup: - if (present == S1AP_PDU_PR_initiatingMessage) { + case S1AP_ProcedureCode_id_E_RABSetup: + if (present == S1AP_S1AP_PDU_PR_initiatingMessage) { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABSetupRequestIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABSetupRequestIEs.mme_ue_s1ap_id; } else { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABSetupResponseIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABSetupResponseIEs.mme_ue_s1ap_id; } + break; - case S1ap_ProcedureCode_id_E_RABModify: - if (present == S1AP_PDU_PR_initiatingMessage) { + case S1AP_ProcedureCode_id_E_RABModify: + if (present == S1AP_S1AP_PDU_PR_initiatingMessage) { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABModifyRequestIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABModifyRequestIEs.mme_ue_s1ap_id; } else { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABModifyResponseIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABModifyResponseIEs.mme_ue_s1ap_id; } + break; - case S1ap_ProcedureCode_id_E_RABRelease: - if (present == S1AP_PDU_PR_initiatingMessage) { + case S1AP_ProcedureCode_id_E_RABRelease: + if (present == S1AP_S1AP_PDU_PR_initiatingMessage) { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABReleaseCommandIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABReleaseCommandIEs.mme_ue_s1ap_id; } else { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABReleaseResponseIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABReleaseResponseIEs.mme_ue_s1ap_id; } + break; - case S1ap_ProcedureCode_id_E_RABReleaseIndication: + case S1AP_ProcedureCode_id_E_RABReleaseIndication: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABReleaseIndicationIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_E_RABReleaseIndicationIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_InitialContextSetup: - if (present == S1AP_PDU_PR_initiatingMessage) { + case S1AP_ProcedureCode_id_InitialContextSetup: + if (present == S1AP_S1AP_PDU_PR_initiatingMessage) { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_InitialContextSetupRequestIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_InitialContextSetupRequestIEs.mme_ue_s1ap_id; } else { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_InitialContextSetupResponseIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_InitialContextSetupResponseIEs.mme_ue_s1ap_id; } + break; - case S1ap_ProcedureCode_id_Paging: + case S1AP_ProcedureCode_id_Paging: //rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_PagingIEs.mme_ue_s1ap_id; //scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_PagingIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_downlinkNASTransport: + case S1AP_ProcedureCode_id_downlinkNASTransport: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkNASTransportIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkNASTransportIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_initialUEMessage: + case S1AP_ProcedureCode_id_initialUEMessage: //rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_InitialUEMessageIEs.mme_ue_s1ap_id; //scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_InitialUEMessageIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_uplinkNASTransport: + case S1AP_ProcedureCode_id_uplinkNASTransport: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkNASTransportIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkNASTransportIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_Reset: + case S1AP_ProcedureCode_id_Reset: //rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ResetIEs.mme_ue_s1ap_id; //scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ResetIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_ErrorIndication: + case S1AP_ProcedureCode_id_ErrorIndication: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ErrorIndicationIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ErrorIndicationIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_NASNonDeliveryIndication: + case S1AP_ProcedureCode_id_NASNonDeliveryIndication: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_NASNonDeliveryIndication_IEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_NASNonDeliveryIndication_IEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_S1Setup: - /*if (present == S1AP_PDU_PR_initiatingMessage) { + case S1AP_ProcedureCode_id_S1Setup: + /*if (present == S1AP_S1AP_PDU_PR_initiatingMessage) { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_S1SetupRequestIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_S1SetupRequestIEs.mme_ue_s1ap_id; - } else if (present == S1AP_PDU_PR_successfulOutcome) { + } else if (present == S1AP_S1AP_PDU_PR_successfulOutcome) { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_S1SetupResponseIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_S1SetupResponseIEs.mme_ue_s1ap_id; - } else if (present == S1AP_PDU_PR_unsuccessfulOutcome) { + } else if (present == S1AP_S1AP_PDU_PR_unsuccessfulOutcome) { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_S1SetupFailureIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_S1SetupFailureIEs.mme_ue_s1ap_id; }*/ break; - case S1ap_ProcedureCode_id_UEContextReleaseRequest: + case S1AP_ProcedureCode_id_UEContextReleaseRequest: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextReleaseRequestIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextReleaseRequestIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_DownlinkS1cdma2000tunneling: + case S1AP_ProcedureCode_id_DownlinkS1cdma2000tunneling: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkS1cdma2000tunnelingIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkS1cdma2000tunnelingIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_UplinkS1cdma2000tunneling: + case S1AP_ProcedureCode_id_UplinkS1cdma2000tunneling: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkS1cdma2000tunnelingIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkS1cdma2000tunnelingIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_UEContextModification: - if (present == S1AP_PDU_PR_initiatingMessage) { + case S1AP_ProcedureCode_id_UEContextModification: + if (present == S1AP_S1AP_PDU_PR_initiatingMessage) { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextModificationRequestIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextModificationRequestIEs.mme_ue_s1ap_id; - } else if (present == S1AP_PDU_PR_successfulOutcome) { + } else if (present == S1AP_S1AP_PDU_PR_successfulOutcome) { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextModificationResponseIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextModificationResponseIEs.mme_ue_s1ap_id; - } else if (present == S1AP_PDU_PR_unsuccessfulOutcome) { + } else if (present == S1AP_S1AP_PDU_PR_unsuccessfulOutcome) { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextModificationFailureIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextModificationFailureIEs.mme_ue_s1ap_id; } + break; - case S1ap_ProcedureCode_id_UECapabilityInfoIndication: + case S1AP_ProcedureCode_id_UECapabilityInfoIndication: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UECapabilityInfoIndicationIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UECapabilityInfoIndicationIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_UEContextRelease: - if (present == S1AP_PDU_PR_initiatingMessage) { + case S1AP_ProcedureCode_id_UEContextRelease: + if (present == S1AP_S1AP_PDU_PR_initiatingMessage) { switch (rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextReleaseCommandIEs.uE_S1AP_IDs.present) { case S1ap_UE_S1AP_IDs_PR_uE_S1AP_ID_pair: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextReleaseCommandIEs.uE_S1AP_IDs.choice.uE_S1AP_ID_pair.mME_UE_S1AP_ID; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextReleaseCommandIEs.uE_S1AP_IDs.choice.uE_S1AP_ID_pair.mME_UE_S1AP_ID; break; + case S1ap_UE_S1AP_IDs_PR_mME_UE_S1AP_ID: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextReleaseCommandIEs.uE_S1AP_IDs.choice.mME_UE_S1AP_ID; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextReleaseCommandIEs.uE_S1AP_IDs.choice.mME_UE_S1AP_ID; @@ -368,38 +364,39 @@ int et_handle_s1ap_mismatch_mme_ue_s1ap_id(et_packet_t * const spacket, et_packe rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextReleaseCompleteIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UEContextReleaseCompleteIEs.mme_ue_s1ap_id; } + break; - case S1ap_ProcedureCode_id_eNBStatusTransfer: + case S1AP_ProcedureCode_id_eNBStatusTransfer: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBStatusTransferIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBStatusTransferIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_MMEStatusTransfer: + case S1AP_ProcedureCode_id_MMEStatusTransfer: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEStatusTransferIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEStatusTransferIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_DeactivateTrace: + case S1AP_ProcedureCode_id_DeactivateTrace: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DeactivateTraceIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DeactivateTraceIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_TraceStart: + case S1AP_ProcedureCode_id_TraceStart: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_TraceStartIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_TraceStartIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_TraceFailureIndication: + case S1AP_ProcedureCode_id_TraceFailureIndication: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_TraceFailureIndicationIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_TraceFailureIndicationIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_ENBConfigurationUpdate: - /*if (present == S1AP_PDU_PR_initiatingMessage) { + case S1AP_ProcedureCode_id_ENBConfigurationUpdate: + /*if (present == S1AP_S1AP_PDU_PR_initiatingMessage) { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBConfigurationUpdateIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBConfigurationUpdateIEs.mme_ue_s1ap_id; - } else if (present == S1AP_PDU_PR_successfulOutcome) { + } else if (present == S1AP_S1AP_PDU_PR_successfulOutcome) { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBConfigurationUpdateAcknowledgeIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBConfigurationUpdateAcknowledgeIEs.mme_ue_s1ap_id; } else { @@ -408,11 +405,11 @@ int et_handle_s1ap_mismatch_mme_ue_s1ap_id(et_packet_t * const spacket, et_packe }*/ break; - case S1ap_ProcedureCode_id_MMEConfigurationUpdate: - /*if (present == S1AP_PDU_PR_initiatingMessage) { + case S1AP_ProcedureCode_id_MMEConfigurationUpdate: + /*if (present == S1AP_S1AP_PDU_PR_initiatingMessage) { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEConfigurationUpdateIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEConfigurationUpdateIEs.mme_ue_s1ap_id; - } else if (present == S1AP_PDU_PR_successfulOutcome) { + } else if (present == S1AP_S1AP_PDU_PR_successfulOutcome) { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEConfigurationUpdateAcknowledgeIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEConfigurationUpdateAcknowledgeIEs.mme_ue_s1ap_id; } else { @@ -421,33 +418,33 @@ int et_handle_s1ap_mismatch_mme_ue_s1ap_id(et_packet_t * const spacket, et_packe }*/ break; - case S1ap_ProcedureCode_id_LocationReportingControl: + case S1AP_ProcedureCode_id_LocationReportingControl: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_LocationReportingControlIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_LocationReportingControlIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_LocationReportingFailureIndication: + case S1AP_ProcedureCode_id_LocationReportingFailureIndication: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_LocationReportingFailureIndicationIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_LocationReportingFailureIndicationIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_LocationReport: + case S1AP_ProcedureCode_id_LocationReport: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_LocationReportIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_LocationReportIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_OverloadStart: + case S1AP_ProcedureCode_id_OverloadStart: //rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_OverloadStartIEs.mme_ue_s1ap_id; //scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_OverloadStartIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_OverloadStop: + case S1AP_ProcedureCode_id_OverloadStop: //rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_OverloadStopIEs.mme_ue_s1ap_id; //scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_OverloadStopIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_WriteReplaceWarning: - /*if (present == S1AP_PDU_PR_initiatingMessage) { + case S1AP_ProcedureCode_id_WriteReplaceWarning: + /*if (present == S1AP_S1AP_PDU_PR_initiatingMessage) { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_WriteReplaceWarningRequestIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_WriteReplaceWarningRequestIEs.mme_ue_s1ap_id; } else { @@ -456,29 +453,29 @@ int et_handle_s1ap_mismatch_mme_ue_s1ap_id(et_packet_t * const spacket, et_packe }*/ break; - case S1ap_ProcedureCode_id_eNBDirectInformationTransfer: + case S1AP_ProcedureCode_id_eNBDirectInformationTransfer: //rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBDirectInformationTransferIEs.mme_ue_s1ap_id; //scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_ENBDirectInformationTransferIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_MMEDirectInformationTransfer: + case S1AP_ProcedureCode_id_MMEDirectInformationTransfer: //rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEDirectInformationTransferIEs.mme_ue_s1ap_id; //scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_MMEDirectInformationTransferIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_PrivateMessage: - case S1ap_ProcedureCode_id_eNBConfigurationTransfer: - case S1ap_ProcedureCode_id_MMEConfigurationTransfer: + case S1AP_ProcedureCode_id_PrivateMessage: + case S1AP_ProcedureCode_id_eNBConfigurationTransfer: + case S1AP_ProcedureCode_id_MMEConfigurationTransfer: AssertFatal(0, "TODO"); break; - case S1ap_ProcedureCode_id_CellTrafficTrace: + case S1AP_ProcedureCode_id_CellTrafficTrace: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_CellTrafficTraceIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_CellTrafficTraceIEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_Kill: - /*if (present == S1AP_PDU_PR_initiatingMessage) { + case S1AP_ProcedureCode_id_Kill: + /*if (present == S1AP_S1AP_PDU_PR_initiatingMessage) { rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_KillRequestIEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_KillRequestIEs.mme_ue_s1ap_id; } else { @@ -487,22 +484,22 @@ int et_handle_s1ap_mismatch_mme_ue_s1ap_id(et_packet_t * const spacket, et_packe }*/ break; - case S1ap_ProcedureCode_id_downlinkUEAssociatedLPPaTransport: + case S1AP_ProcedureCode_id_downlinkUEAssociatedLPPaTransport: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkUEAssociatedLPPaTransport_IEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkUEAssociatedLPPaTransport_IEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_uplinkUEAssociatedLPPaTransport: + case S1AP_ProcedureCode_id_uplinkUEAssociatedLPPaTransport: rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkUEAssociatedLPPaTransport_IEs.mme_ue_s1ap_id; scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkUEAssociatedLPPaTransport_IEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_downlinkNonUEAssociatedLPPaTransport: + case S1AP_ProcedureCode_id_downlinkNonUEAssociatedLPPaTransport: //rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkNonUEAssociatedLPPaTransport_IEs.mme_ue_s1ap_id; //scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_DownlinkNonUEAssociatedLPPaTransport_IEs.mme_ue_s1ap_id; break; - case S1ap_ProcedureCode_id_uplinkNonUEAssociatedLPPaTransport: + case S1AP_ProcedureCode_id_uplinkNonUEAssociatedLPPaTransport: //rx_mme_ue_s1ap_id = rx_packet->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkNonUEAssociatedLPPaTransport_IEs.mme_ue_s1ap_id; //scenario_mme_ue_s1ap_id = spacket->sctp_hdr.u.data_hdr.payload.message.msg.s1ap_UplinkNonUEAssociatedLPPaTransport_IEs.mme_ue_s1ap_id; break; @@ -510,58 +507,83 @@ int et_handle_s1ap_mismatch_mme_ue_s1ap_id(et_packet_t * const spacket, et_packe default: AssertFatal(0, "Unknown procedure code %ld", rx_packet->sctp_hdr.u.data_hdr.payload.message.procedureCode); } + if (scenario_mme_ue_s1ap_id != rx_mme_ue_s1ap_id) { S1AP_DEBUG("%s() Updating mme_ue_s1ap_id %u -> %u \n", __FUNCTION__, scenario_mme_ue_s1ap_id, rx_mme_ue_s1ap_id); - et_packet_t * p = spacket; + et_packet_t *p = spacket; + while (p) { et_s1ap_update_mme_ue_s1ap_id(p, scenario_mme_ue_s1ap_id, rx_mme_ue_s1ap_id); p = p->next; } + return 0; } + return 1; } //------------------------------------------------------------------------------ -asn_comp_rval_t * et_s1ap_is_matching(et_s1ap_t * const s1ap1, et_s1ap_t * const s1ap2, const uint32_t constraints) +asn_comp_rval_t *et_s1ap_is_matching(et_s1ap_t *const s1ap1, et_s1ap_t *const s1ap2, const uint32_t constraints) { +#if 1 + + if (Choice_compare(&asn_DEF_S1AP_S1AP_PDU, &s1ap1->pdu, &s1ap2->pdu) != 0) { + return 0; + } + +#else asn_comp_rval_t *rv = NULL; + if (s1ap1->pdu.present != s1ap2->pdu.present) {rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_S1AP_PRESENT; return rv;} + switch (s1ap1->pdu.present) { - case S1AP_PDU_PR_NOTHING: + case S1AP_S1AP_PDU_PR_NOTHING: break; - case S1AP_PDU_PR_initiatingMessage: + + case S1AP_S1AP_PDU_PR_initiatingMessage: if (s1ap1->pdu.choice.initiatingMessage.procedureCode != s1ap2->pdu.choice.initiatingMessage.procedureCode) - {rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_S1AP_PROCEDURE_CODE; return rv;} + {rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_S1AP_PROCEDURE_CODE; return rv;} + if (s1ap1->pdu.choice.initiatingMessage.criticality != s1ap2->pdu.choice.initiatingMessage.criticality) - {rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_S1AP_CRITICALITY; return rv;} + {rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_S1AP_CRITICALITY; return rv;} + break; - case S1AP_PDU_PR_successfulOutcome: + + case S1AP_S1AP_PDU_PR_successfulOutcome: if (s1ap1->pdu.choice.successfulOutcome.procedureCode != s1ap2->pdu.choice.successfulOutcome.procedureCode) - {rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_S1AP_PROCEDURE_CODE; return rv;} + {rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_S1AP_PROCEDURE_CODE; return rv;} + if (s1ap1->pdu.choice.successfulOutcome.criticality != s1ap2->pdu.choice.successfulOutcome.criticality) - {rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_S1AP_CRITICALITY; return rv;} + {rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_S1AP_CRITICALITY; return rv;} + break; - case S1AP_PDU_PR_unsuccessfulOutcome: + + case S1AP_S1AP_PDU_PR_unsuccessfulOutcome: if (s1ap1->pdu.choice.unsuccessfulOutcome.procedureCode != s1ap2->pdu.choice.unsuccessfulOutcome.procedureCode) - {rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_S1AP_PROCEDURE_CODE; return rv;} + {rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_S1AP_PROCEDURE_CODE; return rv;} + if (s1ap1->pdu.choice.unsuccessfulOutcome.criticality != s1ap2->pdu.choice.unsuccessfulOutcome.criticality) - {rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_S1AP_CRITICALITY; return rv;} + {rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_S1AP_CRITICALITY; return rv;} + break; + default: AssertFatal(0, "Unknown pdu.present %d", s1ap1->pdu.present); } if (s1ap1->binary_stream_allocated_size == s1ap2->binary_stream_allocated_size) { - if (memcmp((void*)s1ap1->binary_stream, (void*)s1ap2->binary_stream, s1ap1->binary_stream_allocated_size) == 0) return NULL; + if (memcmp((void *)s1ap1->binary_stream, (void *)s1ap2->binary_stream, s1ap1->binary_stream_allocated_size) == 0) return NULL; } + // if no matching, may be the scenario need minor corrections (same enb_ue_s1ap_id but need to update mme_ue_s1ap_id) return et_s1ap_ies_is_matching(s1ap1->pdu.present, &s1ap1->message, &s1ap2->message, constraints); +#endif } //------------------------------------------------------------------------------ -et_packet_t* et_build_packet_from_s1ap_data_ind(et_event_s1ap_data_ind_t * const s1ap_data_ind) +et_packet_t *et_build_packet_from_s1ap_data_ind(et_event_s1ap_data_ind_t *const s1ap_data_ind) { - et_packet_t * packet = NULL; + et_packet_t *packet = NULL; AssertFatal (NULL != s1ap_data_ind, "Bad parameter sctp_data_ind\n"); packet = calloc(1, sizeof(*packet)); packet->action = ET_PACKET_ACTION_S1C_NULL; @@ -577,7 +599,7 @@ et_packet_t* et_build_packet_from_s1ap_data_ind(et_event_s1ap_data_ind_t * const //packet->ip_hdr; // keep in mind: allocated buffer: sctp_datahdr.payload.binary_stream packet->sctp_hdr.chunk_type = SCTP_CID_DATA; - memcpy((void*)&packet->sctp_hdr.u.data_hdr, (void*)&s1ap_data_ind->sctp_datahdr, sizeof(packet->sctp_hdr)); + memcpy((void *)&packet->sctp_hdr.u.data_hdr, (void *)&s1ap_data_ind->sctp_datahdr, sizeof(packet->sctp_hdr)); //packet->next = NULL; packet->status = ET_PACKET_STATUS_RECEIVED; //packet->timer_id = 0; @@ -588,16 +610,15 @@ et_packet_t* et_build_packet_from_s1ap_data_ind(et_event_s1ap_data_ind_t * const //------------------------------------------------------------------------------ // return 0 if packet was waited -int et_scenario_set_packet_received(et_packet_t * const packet) +int et_scenario_set_packet_received(et_packet_t *const packet) { - et_packet_t * p = NULL; + et_packet_t *p = NULL; int rc = 0; - packet->status = ET_PACKET_STATUS_RECEIVED; S1AP_DEBUG("Packet received: num %u | original frame number %u \n", packet->packet_number, packet->original_frame_number); S1AP_DEBUG("Last Packet received: num %u | original frame number %u \n", g_scenario->last_rx_packet->packet_number, g_scenario->last_rx_packet->original_frame_number); - p = g_scenario->last_rx_packet; + while (NULL != p) { if (ET_PACKET_ACTION_S1C_RECEIVE == p->action) { if ((ET_PACKET_STATUS_RECEIVED == p->status) || (ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT == p->status)) { @@ -610,6 +631,7 @@ int et_scenario_set_packet_received(et_packet_t * const packet) break; } } + p = p->next; } @@ -619,11 +641,12 @@ int et_scenario_set_packet_received(et_packet_t * const packet) g_scenario->timer_count--; return rc; } + return 1; } //------------------------------------------------------------------------------ -int et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t * const s1ap_data_ind) +int et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t *const s1ap_data_ind) { et_packet_t *packet = NULL; et_packet_t *rx_packet = NULL; @@ -631,37 +654,44 @@ int et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t * const s1ap_data_ind) asn_comp_rval_t *comp_results = NULL; asn_comp_rval_t *comp_results2 = NULL; unsigned char error_code = 0; - AssertFatal (NULL != s1ap_data_ind, "Bad parameter sctp_data_ind\n"); rx_packet = et_build_packet_from_s1ap_data_ind(s1ap_data_ind); if (NULL == g_scenario->last_rx_packet) { packet = g_scenario->list_packet; + while (NULL != packet) { if (packet->action == ET_PACKET_ACTION_S1C_RECEIVE) { if ((ET_PACKET_STATUS_RECEIVED == packet->status) || (ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT == packet->status)) { g_scenario->last_rx_packet = packet; + if (ET_PACKET_STATUS_NOT_TAKEN_IN_ACCOUNT != packet->status) { g_scenario->time_last_rx_packet.tv_sec = packet->timestamp_packet.tv_sec; g_scenario->time_last_rx_packet.tv_usec = packet->timestamp_packet.tv_usec; } + S1AP_DEBUG("Set Last Packet received: num %u | original frame number %u \n", g_scenario->last_rx_packet->packet_number, g_scenario->last_rx_packet->original_frame_number); S1AP_DEBUG("Set time_last_rx_packet %ld.%06d\n", g_scenario->time_last_rx_packet.tv_sec, g_scenario->time_last_rx_packet.tv_usec); } else { break; } } + packet = packet->next; } + packet = g_scenario->list_packet; } else { packet = g_scenario->last_rx_packet->next; } + // not_found threshold may sure depend on number of mme, may be not sure on number of UE while ((NULL != packet) && (not_found < 9)) { S1AP_DEBUG("%s() Considering packet num %d original frame number %u\n", __FUNCTION__, packet->packet_number, packet->original_frame_number); + if (packet->action == ET_PACKET_ACTION_S1C_RECEIVE) { comp_results = et_sctp_is_matching(&packet->sctp_hdr, &rx_packet->sctp_hdr, g_constraints); + if (NULL == comp_results) { S1AP_DEBUG("Compare RX packet with packet: num %u | original frame number %u \n", packet->packet_number, packet->original_frame_number); packet->timestamp_packet.tv_sec = rx_packet->timestamp_packet.tv_sec; @@ -669,10 +699,12 @@ int et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t * const s1ap_data_ind) return et_scenario_set_packet_received(packet); } else { S1AP_DEBUG("Compare RX packet with packet: num %u | original frame number %u failed\n", - packet->packet_number, packet->original_frame_number); + packet->packet_number, packet->original_frame_number); + while (comp_results) { S1AP_DEBUG("Result err code %s(%u) ASN1 struct name %s\n", - et_error_match2str(comp_results->err_code), comp_results->err_code, comp_results->name); + et_error_match2str(comp_results->err_code), comp_results->err_code, comp_results->name); + // (each asn1 rc <= 166 (enum e_S1ap_ProtocolIE_ID, in generated file S1ap_ProtocolIE_ID.h)) if (comp_results->err_code == COMPARE_ERR_CODE_NO_MATCH) { //TODO MME_UE_S1AP_ID, etc. @@ -696,40 +728,40 @@ int et_s1ap_process_rx_packet(et_event_s1ap_data_ind_t * const s1ap_data_ind) AssertFatal(0,"Some work needed there"); } } + comp_results2 = comp_results; comp_results = comp_results2->next; et_free_pointer(comp_results2); } } } + not_found += 1; packet = packet->next; } + et_display_packet_sctp(&rx_packet->sctp_hdr); AssertFatal(0, "Rx packet not found in scenario (see dump above)"); return -1; } //------------------------------------------------------------------------------ -void et_s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t * const sctp_data_ind) +void et_s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *const sctp_data_ind) { int result = 0; et_event_t event; - DevAssert(sctp_data_ind != NULL); - - memset((void*)&event, 0, sizeof(event)); - + memset((void *)&event, 0, sizeof(event)); event.code = ET_EVENT_RX_S1AP; event.u.s1ap_data_ind.sctp_datahdr.tsn = 0; event.u.s1ap_data_ind.sctp_datahdr.stream = sctp_data_ind->stream; event.u.s1ap_data_ind.sctp_datahdr.ssn = 0; event.u.s1ap_data_ind.sctp_datahdr.ppid = S1AP_SCTP_PPID; event.u.s1ap_data_ind.sctp_datahdr.assoc_id = sctp_data_ind->assoc_id; - event.u.s1ap_data_ind.sctp_datahdr.payload.binary_stream_pos = 0; event.u.s1ap_data_ind.sctp_datahdr.payload.binary_stream_allocated_size = sctp_data_ind->buffer_length; event.u.s1ap_data_ind.sctp_datahdr.payload.binary_stream = NULL; + if ((sctp_data_ind->buffer_length > 0) && (NULL != sctp_data_ind->buffer)) { event.u.s1ap_data_ind.sctp_datahdr.payload.binary_stream = calloc(1, sctp_data_ind->buffer_length); memcpy(event.u.s1ap_data_ind.sctp_datahdr.payload.binary_stream, @@ -737,72 +769,54 @@ void et_s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t * const sctp_data_ind) sctp_data_ind->buffer_length); if (et_s1ap_decode_pdu( - &event.u.s1ap_data_ind.sctp_datahdr.payload.pdu, - &event.u.s1ap_data_ind.sctp_datahdr.payload.message, - event.u.s1ap_data_ind.sctp_datahdr.payload.binary_stream, - event.u.s1ap_data_ind.sctp_datahdr.payload.binary_stream_allocated_size) < 0) { + &event.u.s1ap_data_ind.sctp_datahdr.payload.pdu, + &event.u.s1ap_data_ind.sctp_datahdr.payload.message, + event.u.s1ap_data_ind.sctp_datahdr.payload.binary_stream, + event.u.s1ap_data_ind.sctp_datahdr.payload.binary_stream_allocated_size) < 0) { AssertFatal (0, "ERROR Cannot decode RX S1AP message!\n"); } - } result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer); AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - et_scenario_fsm_notify_event(event); - - memset((void*)&event, 0, sizeof(event)); + memset((void *)&event, 0, sizeof(event)); event.code = ET_EVENT_TICK; et_scenario_fsm_notify_event(event); - } //------------------------------------------------------------------------------ void et_s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, - net_ip_address_t *mme_ip_address, - net_ip_address_t *local_ip_addr, - uint16_t in_streams, - uint16_t out_streams) + net_ip_address_t *mme_ip_address, + net_ip_address_t *local_ip_addr, + uint16_t in_streams, + uint16_t out_streams) { MessageDef *message_p = NULL; sctp_new_association_req_t *sctp_new_association_req_p = NULL; s1ap_eNB_mme_data_t *s1ap_mme_data_p = NULL; - DevAssert(instance_p != NULL); DevAssert(mme_ip_address != NULL); - message_p = itti_alloc_new_message(TASK_S1AP, SCTP_NEW_ASSOCIATION_REQ); - sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req; - sctp_new_association_req_p->port = S1AP_PORT_NUMBER; sctp_new_association_req_p->ppid = S1AP_SCTP_PPID; - sctp_new_association_req_p->in_streams = in_streams; sctp_new_association_req_p->out_streams = out_streams; - memcpy(&sctp_new_association_req_p->remote_address, mme_ip_address, sizeof(*mme_ip_address)); - memcpy(&sctp_new_association_req_p->local_address, local_ip_addr, sizeof(*local_ip_addr)); - /* Create new MME descriptor */ s1ap_mme_data_p = calloc(1, sizeof(*s1ap_mme_data_p)); DevAssert(s1ap_mme_data_p != NULL); - s1ap_mme_data_p->cnx_id = et_s1ap_eNB_fetch_add_global_cnx_id(); sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id; - s1ap_mme_data_p->assoc_id = -1; s1ap_mme_data_p->s1ap_eNB_instance = instance_p; - - memcpy((void*)&s1ap_mme_data_p->mme_net_ip_address, mme_ip_address, sizeof(*mme_ip_address)); - - + memcpy((void *)&s1ap_mme_data_p->mme_net_ip_address, mme_ip_address, sizeof(*mme_ip_address)); STAILQ_INIT(&s1ap_mme_data_p->served_gummei); - /* Insert the new descriptor in list of known MME * but not yet associated. */ @@ -810,33 +824,33 @@ void et_s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING; instance_p->s1ap_mme_nb ++; instance_p->s1ap_mme_pending_nb ++; - itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p); } //------------------------------------------------------------------------------ void et_s1ap_update_assoc_id_of_packets(const int32_t assoc_id, - struct s1ap_eNB_instance_s * const s1ap_eNB_instance, - s1ap_eNB_mme_data_t * const mme_desc_p) + struct s1ap_eNB_instance_s *const s1ap_eNB_instance, + s1ap_eNB_mme_data_t *const mme_desc_p) { et_packet_t *packet = NULL; int ret; unsigned int old_enb_port = 0; unsigned int old_mme_port = 0; - S1AP_DEBUG("%s for SCTP association (%u)\n",__FUNCTION__,assoc_id); - packet = g_scenario->list_packet; + while (NULL != packet) { switch (packet->sctp_hdr.chunk_type) { - case SCTP_CID_DATA : S1AP_DEBUG("%s for SCTP association (%u) SCTP_CID_DATA\n",__FUNCTION__,assoc_id); + if ((ET_PACKET_STATUS_NONE == packet->status) || (ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING == packet->status)) { if (0 < old_mme_port) { if (packet->action == ET_PACKET_ACTION_S1C_SEND) { ret = et_compare_et_ip_to_net_ip_address(&packet->ip_hdr.dst, &mme_desc_p->mme_net_ip_address); + if (0 == ret) { ret = et_compare_et_ip_to_net_ip_address(&packet->ip_hdr.src, &s1ap_eNB_instance->s1c_net_ip_address); + if (0 == ret) { // same IP src, same IP dst if ((packet->sctp_hdr.dst_port == old_mme_port) && (packet->sctp_hdr.src_port == old_enb_port)) { @@ -848,8 +862,10 @@ void et_s1ap_update_assoc_id_of_packets(const int32_t assoc_id, } } else if (packet->action == ET_PACKET_ACTION_S1C_RECEIVE) { ret = et_compare_et_ip_to_net_ip_address(&packet->ip_hdr.src, &mme_desc_p->mme_net_ip_address); + if (0 == ret) { ret = et_compare_et_ip_to_net_ip_address(&packet->ip_hdr.dst, &s1ap_eNB_instance->s1c_net_ip_address); + if (0 == ret) { // same IP src, same IP dst if ((packet->sctp_hdr.src_port == old_mme_port) && (packet->sctp_hdr.dst_port == old_enb_port)) { @@ -862,15 +878,18 @@ void et_s1ap_update_assoc_id_of_packets(const int32_t assoc_id, } } } + break; - // Strong assumption - // in replayed scenario, the order of SCTP INIT packets is supposed to be the same as in the catched scenario + // Strong assumption + // in replayed scenario, the order of SCTP INIT packets is supposed to be the same as in the catched scenario case SCTP_CID_INIT: S1AP_DEBUG("%s for SCTP association (%u) SCTP_CID_INIT\n",__FUNCTION__,assoc_id); ret = et_compare_et_ip_to_net_ip_address(&packet->ip_hdr.dst, &mme_desc_p->mme_net_ip_address); + if (0 == ret) { ret = et_compare_et_ip_to_net_ip_address(&packet->ip_hdr.src, &s1ap_eNB_instance->s1c_net_ip_address); + if (0 == ret) { if (0 == old_enb_port) { if (ET_PACKET_STATUS_NONE == packet->status) { @@ -881,13 +900,16 @@ void et_s1ap_update_assoc_id_of_packets(const int32_t assoc_id, } } } + break; case SCTP_CID_INIT_ACK: S1AP_DEBUG("%s for SCTP association (%u) SCTP_CID_INIT_ACK\n",__FUNCTION__,assoc_id); ret = et_compare_et_ip_to_net_ip_address(&packet->ip_hdr.src, &mme_desc_p->mme_net_ip_address); + if (0 == ret) { ret = et_compare_et_ip_to_net_ip_address(&packet->ip_hdr.dst, &s1ap_eNB_instance->s1c_net_ip_address); + if (0 == ret) { if (old_enb_port == packet->sctp_hdr.dst_port) { if (ET_PACKET_STATUS_NONE == packet->status) { @@ -898,6 +920,7 @@ void et_s1ap_update_assoc_id_of_packets(const int32_t assoc_id, } } } + break; case SCTP_CID_HEARTBEAT: @@ -920,6 +943,7 @@ void et_s1ap_update_assoc_id_of_packets(const int32_t assoc_id, AssertFatal(0, "Unknown chunk_type %d packet num %d", packet->sctp_hdr.chunk_type, packet->packet_number); ; } + packet = packet->next; } } @@ -941,7 +965,6 @@ void et_s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_s /* If there are no more associated MME, inform eNB app */ if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb == 0) { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_DEREGISTERED_ENB_IND); S1AP_DEREGISTERED_ENB_IND(message_p).nb_mme = 0; itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p); @@ -959,14 +982,12 @@ void et_s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_s } et_s1ap_update_assoc_id_of_packets(mme_desc_p->assoc_id, - mme_desc_p->s1ap_eNB_instance, - mme_desc_p); - + mme_desc_p->s1ap_eNB_instance, + mme_desc_p); /* If there are no more pending messages, inform eNB app */ if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb == 0) { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_REGISTER_ENB_CNF); S1AP_REGISTER_ENB_CNF(message_p).nb_mme = mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb; itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p); @@ -978,9 +999,7 @@ void et_s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_ { s1ap_eNB_instance_t *new_instance; uint8_t index; - DevAssert(s1ap_register_eNB != NULL); - /* Look if the provided instance already exists */ new_instance = et_s1ap_eNB_get_instance(instance); @@ -992,14 +1011,12 @@ void et_s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_ DevCheck(new_instance->mcc == s1ap_register_eNB->mcc, new_instance->mcc, s1ap_register_eNB->mcc, 0); DevCheck(new_instance->mnc == s1ap_register_eNB->mnc, new_instance->mnc, s1ap_register_eNB->mnc, 0); DevCheck(new_instance->mnc_digit_length == s1ap_register_eNB->mnc_digit_length, new_instance->mnc_digit_length, s1ap_register_eNB->mnc_digit_length, 0); - DevCheck(memcmp((void*)&new_instance->s1c_net_ip_address, (void*)&s1ap_register_eNB->enb_ip_address, sizeof(new_instance->s1c_net_ip_address)) == 0, 0,0,0); + DevCheck(memcmp((void *)&new_instance->s1c_net_ip_address, (void *)&s1ap_register_eNB->enb_ip_address, sizeof(new_instance->s1c_net_ip_address)) == 0, 0,0,0); } else { new_instance = calloc(1, sizeof(s1ap_eNB_instance_t)); DevAssert(new_instance != NULL); - RB_INIT(&new_instance->s1ap_ue_head); RB_INIT(&new_instance->s1ap_mme_head); - /* Copy usefull parameters */ new_instance->instance = instance; new_instance->eNB_name = s1ap_register_eNB->eNB_name; @@ -1009,11 +1026,9 @@ void et_s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_ new_instance->mcc = s1ap_register_eNB->mcc; new_instance->mnc = s1ap_register_eNB->mnc; new_instance->mnc_digit_length = s1ap_register_eNB->mnc_digit_length; - memcpy((void*)&new_instance->s1c_net_ip_address, (void*)&s1ap_register_eNB->enb_ip_address, sizeof(new_instance->s1c_net_ip_address)); - + memcpy((void *)&new_instance->s1c_net_ip_address, (void *)&s1ap_register_eNB->enb_ip_address, sizeof(new_instance->s1c_net_ip_address)); /* Add the new instance to the list of eNB (meaningfull in virtual mode) */ et_s1ap_eNB_insert_new_instance(new_instance); - S1AP_DEBUG("Registered new eNB[%d] and %s eNB id %u\n", instance, s1ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home", @@ -1026,10 +1041,10 @@ void et_s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_ /* Trying to connect to provided list of MME ip address */ for (index = 0; index < s1ap_register_eNB->nb_mme; index++) { et_s1ap_eNB_register_mme(new_instance, - &s1ap_register_eNB->mme_ip_address[index], - &s1ap_register_eNB->enb_ip_address, - s1ap_register_eNB->sctp_in_streams, - s1ap_register_eNB->sctp_out_streams); + &s1ap_register_eNB->mme_ip_address[index], + &s1ap_register_eNB->enb_ip_address, + s1ap_register_eNB->sctp_in_streams, + s1ap_register_eNB->sctp_out_streams); } } @@ -1038,14 +1053,11 @@ void et_s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_asso { s1ap_eNB_instance_t *instance_p = NULL; s1ap_eNB_mme_data_t *s1ap_mme_data_p = NULL; - DevAssert(sctp_new_association_resp != NULL); - instance_p = et_s1ap_eNB_get_instance(instance); DevAssert(instance_p != NULL); - s1ap_mme_data_p = et_s1ap_eNB_get_MME(instance_p, -1, - sctp_new_association_resp->ulp_cnx_id); + sctp_new_association_resp->ulp_cnx_id); DevAssert(s1ap_mme_data_p != NULL); if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) { @@ -1053,9 +1065,7 @@ void et_s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_asso sctp_new_association_resp->sctp_state, instance, sctp_new_association_resp->ulp_cnx_id); - et_s1ap_handle_s1_setup_message(s1ap_mme_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); - return; } @@ -1067,7 +1077,6 @@ void et_s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_asso s1ap_mme_data_p->assoc_id = sctp_new_association_resp->assoc_id; s1ap_mme_data_p->in_streams = sctp_new_association_resp->in_streams; s1ap_mme_data_p->out_streams = sctp_new_association_resp->out_streams; - et_s1ap_handle_s1_setup_message(s1ap_mme_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); } @@ -1076,11 +1085,8 @@ void *et_s1ap_eNB_task(void *arg) { MessageDef *received_msg = NULL; int result; - S1AP_DEBUG("Starting S1AP layer\n"); - et_s1ap_eNB_prepare_internal_data(); - itti_mark_task_ready(TASK_S1AP); MSC_START_USE(); @@ -1088,77 +1094,78 @@ void *et_s1ap_eNB_task(void *arg) itti_receive_msg(TASK_S1AP, &received_msg); switch (ITTI_MSG_ID(received_msg)) { - case TERMINATE_MESSAGE: - S1AP_WARN("*** Exiting S1AP thread\n"); - itti_exit_task(); + case TERMINATE_MESSAGE: + S1AP_WARN("*** Exiting S1AP thread\n"); + itti_exit_task(); + break; + + case S1AP_REGISTER_ENB_REQ: { + /* Register a new eNB. + * in Virtual mode eNBs will be distinguished using the mod_id/ + * Each eNB has to send an S1AP_REGISTER_ENB message with its + * own parameters. + */ + et_s1ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &S1AP_REGISTER_ENB_REQ(received_msg)); + } break; - case S1AP_REGISTER_ENB_REQ: { - /* Register a new eNB. - * in Virtual mode eNBs will be distinguished using the mod_id/ - * Each eNB has to send an S1AP_REGISTER_ENB message with its - * own parameters. - */ - et_s1ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &S1AP_REGISTER_ENB_REQ(received_msg)); - } - break; + case SCTP_NEW_ASSOCIATION_RESP: { + et_s1ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &received_msg->ittiMsg.sctp_new_association_resp); + } + break; - case SCTP_NEW_ASSOCIATION_RESP: { - et_s1ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &received_msg->ittiMsg.sctp_new_association_resp); - } - break; + case SCTP_DATA_IND: { + et_s1ap_eNB_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); + } + break; - case SCTP_DATA_IND: { - et_s1ap_eNB_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); - } - break; + case TIMER_HAS_EXPIRED: + LOG_I(S1AP, " Received TIMER_HAS_EXPIRED: timer_id %d\n", TIMER_HAS_EXPIRED(received_msg).timer_id); + { + et_packet_t *packet = (et_packet_t *)TIMER_HAS_EXPIRED (received_msg).arg; + et_event_t event; + g_scenario->timer_count--; - case TIMER_HAS_EXPIRED: - LOG_I(S1AP, " Received TIMER_HAS_EXPIRED: timer_id %d\n", TIMER_HAS_EXPIRED(received_msg).timer_id); - { - et_packet_t * packet = (et_packet_t*)TIMER_HAS_EXPIRED (received_msg).arg; - et_event_t event; - g_scenario->timer_count--; - if (NULL != packet) { - if (packet->status == ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING) { - memset((void*)&event, 0, sizeof(event)); - event.code = ET_EVENT_RX_PACKET_TIME_OUT; - event.u.rx_packet_time_out = packet; - et_scenario_fsm_notify_event(event); - } else if (packet->status == ET_PACKET_STATUS_SCHEDULED_FOR_SENDING) { - memset((void*)&event, 0, sizeof(event)); - event.code = ET_EVENT_TX_TIMED_PACKET; - event.u.tx_timed_packet = packet; - et_scenario_fsm_notify_event(event); - - et_event_t continue_event; - continue_event.code = ET_EVENT_TICK; - et_scenario_fsm_notify_event(continue_event); - } else if ((packet->status != ET_PACKET_STATUS_SENT) && ((packet->status != ET_PACKET_STATUS_RECEIVED))) { - AssertFatal (0, "Bad status %d of packet timed out!\n", packet->status); + if (NULL != packet) { + if (packet->status == ET_PACKET_STATUS_SCHEDULED_FOR_RECEIVING) { + memset((void *)&event, 0, sizeof(event)); + event.code = ET_EVENT_RX_PACKET_TIME_OUT; + event.u.rx_packet_time_out = packet; + et_scenario_fsm_notify_event(event); + } else if (packet->status == ET_PACKET_STATUS_SCHEDULED_FOR_SENDING) { + memset((void *)&event, 0, sizeof(event)); + event.code = ET_EVENT_TX_TIMED_PACKET; + event.u.tx_timed_packet = packet; + et_scenario_fsm_notify_event(event); + et_event_t continue_event; + continue_event.code = ET_EVENT_TICK; + et_scenario_fsm_notify_event(continue_event); + } else if ((packet->status != ET_PACKET_STATUS_SENT) && ((packet->status != ET_PACKET_STATUS_RECEIVED))) { + AssertFatal (0, "Bad status %d of packet timed out!\n", packet->status); + } + } else { + LOG_W(S1AP, " Received TIMER_HAS_EXPIRED: timer_id %d, no packet attached to timer\n", TIMER_HAS_EXPIRED(received_msg).timer_id); } - } else { - LOG_W(S1AP, " Received TIMER_HAS_EXPIRED: timer_id %d, no packet attached to timer\n", TIMER_HAS_EXPIRED(received_msg).timer_id); } - } - if (TIMER_HAS_EXPIRED (received_msg).timer_id == g_scenario->enb_register_retry_timer_id) { - /* Restart the registration process */ - g_scenario->registered_enb = 0; - et_eNB_app_register (g_scenario->enb_properties); - } - break; - default: - S1AP_ERROR("Received unhandled message: %d:%s\n", - ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); - break; + if (TIMER_HAS_EXPIRED (received_msg).timer_id == g_scenario->enb_register_retry_timer_id) { + /* Restart the registration process */ + g_scenario->registered_enb = 0; + et_eNB_app_register (g_scenario->enb_properties); + } + + break; + + default: + S1AP_ERROR("Received unhandled message: %d:%s\n", + ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); + break; } result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg); AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - received_msg = NULL; } diff --git a/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c b/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c index 08f79ef206..59cb1cdac9 100644 --- a/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c +++ b/openair3/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c @@ -56,402 +56,11 @@ extern et_scenario_t *g_scenario; extern uint32_t g_constraints; //------------------------------------------------------------------------------ -asn_comp_rval_t * et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message * const m1, s1ap_message * const m2, const uint32_t constraints) -{ - asn_comp_rval_t *ret = NULL; - AssertFatal(m1 != NULL, "bad parameter m1"); - AssertFatal(m2 != NULL, "bad parameter m2"); - AssertFatal((present == S1AP_PDU_PR_initiatingMessage) || - (present == S1AP_PDU_PR_successfulOutcome) || - (present == S1AP_PDU_PR_unsuccessfulOutcome) , "Bad parameter S1AP_PDU_PR present "); - AssertFatal( m1->procedureCode == m2->procedureCode, "Bad parameters: no matching procedure codes"); +//asn_comp_rval_t * et_s1ap_ies_is_matching(const S1AP_PDU_PR present, s1ap_message * const m1, s1ap_message * const m2, const uint32_t constraints) +//{ +//} - - // some cases can never occur since uplink only. - switch (m1->procedureCode) { - case S1ap_ProcedureCode_id_HandoverPreparation: - if (present == S1AP_PDU_PR_initiatingMessage) { - ret = s1ap_compare_s1ap_handoverrequiredies( - &m1->msg.s1ap_HandoverRequiredIEs, - &m2->msg.s1ap_HandoverRequiredIEs); - } else { - ret = s1ap_compare_s1ap_handovercommandies( - &m1->msg.s1ap_HandoverCommandIEs, - &m2->msg.s1ap_HandoverCommandIEs); - } - break; - - case S1ap_ProcedureCode_id_HandoverResourceAllocation: - if (present == S1AP_PDU_PR_initiatingMessage) { - ret = s1ap_compare_s1ap_handoverrequesties( - &m1->msg.s1ap_HandoverRequestIEs, - &m2->msg.s1ap_HandoverRequestIEs); - } else if (present == S1AP_PDU_PR_successfulOutcome) { - ret = s1ap_compare_s1ap_handoverrequestacknowledgeies( - &m1->msg.s1ap_HandoverRequestAcknowledgeIEs, - &m2->msg.s1ap_HandoverRequestAcknowledgeIEs); - } else if (present == S1AP_PDU_PR_unsuccessfulOutcome) { - ret = s1ap_compare_s1ap_handoverfailureies( - &m1->msg.s1ap_HandoverFailureIEs, - &m2->msg.s1ap_HandoverFailureIEs); - } - break; - - case S1ap_ProcedureCode_id_HandoverNotification: - ret = s1ap_compare_s1ap_handovernotifyies( - &m1->msg.s1ap_HandoverNotifyIEs, - &m2->msg.s1ap_HandoverNotifyIEs); - break; - - case S1ap_ProcedureCode_id_PathSwitchRequest: - ret = s1ap_compare_s1ap_pathswitchrequesties( - &m1->msg.s1ap_PathSwitchRequestIEs, - &m2->msg.s1ap_PathSwitchRequestIEs); - break; - - case S1ap_ProcedureCode_id_HandoverCancel: - ret = s1ap_compare_s1ap_handovercancelies( - &m1->msg.s1ap_HandoverCancelIEs, - &m2->msg.s1ap_HandoverCancelIEs); - break; - - case S1ap_ProcedureCode_id_E_RABSetup: - if (present == S1AP_PDU_PR_initiatingMessage) { - ret = s1ap_compare_s1ap_e_rabsetuprequesties( - &m1->msg.s1ap_E_RABSetupRequestIEs, - &m2->msg.s1ap_E_RABSetupRequestIEs); - } else { - ret = s1ap_compare_s1ap_e_rabsetupresponseies( - &m1->msg.s1ap_E_RABSetupResponseIEs, - &m2->msg.s1ap_E_RABSetupResponseIEs); - } - break; - - case S1ap_ProcedureCode_id_E_RABModify: - if (present == S1AP_PDU_PR_initiatingMessage) { - ret = s1ap_compare_s1ap_e_rabmodifyrequesties( - &m1->msg.s1ap_E_RABModifyRequestIEs, - &m2->msg.s1ap_E_RABModifyRequestIEs); - } else { - ret = s1ap_compare_s1ap_e_rabmodifyresponseies( - &m1->msg.s1ap_E_RABModifyResponseIEs, - &m2->msg.s1ap_E_RABModifyResponseIEs); - } - break; - - case S1ap_ProcedureCode_id_E_RABRelease: - if (present == S1AP_PDU_PR_initiatingMessage) { - ret = s1ap_compare_s1ap_e_rabreleasecommandies( - &m1->msg.s1ap_E_RABReleaseCommandIEs, - &m2->msg.s1ap_E_RABReleaseCommandIEs); - } else { - ret = s1ap_compare_s1ap_e_rabreleaseresponseies( - &m1->msg.s1ap_E_RABReleaseResponseIEs, - &m2->msg.s1ap_E_RABReleaseResponseIEs); - } - break; - - case S1ap_ProcedureCode_id_E_RABReleaseIndication: - ret = s1ap_compare_s1ap_e_rabreleaseindicationies( - &m1->msg.s1ap_E_RABReleaseIndicationIEs, - &m2->msg.s1ap_E_RABReleaseIndicationIEs); - break; - - case S1ap_ProcedureCode_id_InitialContextSetup: - if (present == S1AP_PDU_PR_initiatingMessage) { - ret = s1ap_compare_s1ap_initialcontextsetuprequesties( - &m1->msg.s1ap_InitialContextSetupRequestIEs, - &m2->msg.s1ap_InitialContextSetupRequestIEs); - } else { - ret = s1ap_compare_s1ap_initialcontextsetupresponseies( - &m1->msg.s1ap_InitialContextSetupResponseIEs, - &m2->msg.s1ap_InitialContextSetupResponseIEs); - } - break; - - case S1ap_ProcedureCode_id_Paging: - ret = s1ap_compare_s1ap_pagingies( - &m1->msg.s1ap_PagingIEs, - &m2->msg.s1ap_PagingIEs); - break; - - case S1ap_ProcedureCode_id_downlinkNASTransport: - ret = s1ap_compare_s1ap_downlinknastransporties( - &m1->msg.s1ap_DownlinkNASTransportIEs, - &m2->msg.s1ap_DownlinkNASTransportIEs); - break; - - case S1ap_ProcedureCode_id_initialUEMessage: - ret = s1ap_compare_s1ap_initialuemessageies( - &m1->msg.s1ap_InitialUEMessageIEs, - &m2->msg.s1ap_InitialUEMessageIEs); - break; - - case S1ap_ProcedureCode_id_uplinkNASTransport: - ret = s1ap_compare_s1ap_uplinknastransporties( - &m1->msg.s1ap_UplinkNASTransportIEs, - &m2->msg.s1ap_UplinkNASTransportIEs); - break; - - case S1ap_ProcedureCode_id_Reset: - ret = s1ap_compare_s1ap_reseties( - &m1->msg.s1ap_ResetIEs, - &m2->msg.s1ap_ResetIEs); - break; - - case S1ap_ProcedureCode_id_ErrorIndication: - ret = s1ap_compare_s1ap_errorindicationies( - &m1->msg.s1ap_ErrorIndicationIEs, - &m2->msg.s1ap_ErrorIndicationIEs); - break; - - case S1ap_ProcedureCode_id_NASNonDeliveryIndication: - ret = s1ap_compare_s1ap_nasnondeliveryindication_ies( - &m1->msg.s1ap_NASNonDeliveryIndication_IEs, - &m2->msg.s1ap_NASNonDeliveryIndication_IEs); - break; - - case S1ap_ProcedureCode_id_S1Setup: - if (present == S1AP_PDU_PR_initiatingMessage) { - ret = s1ap_compare_s1ap_s1setuprequesties( - &m1->msg.s1ap_S1SetupRequestIEs, - &m2->msg.s1ap_S1SetupRequestIEs); - } else if (present == S1AP_PDU_PR_successfulOutcome) { - ret = s1ap_compare_s1ap_s1setupresponseies( - &m1->msg.s1ap_S1SetupResponseIEs, - &m2->msg.s1ap_S1SetupResponseIEs); - } else if (present == S1AP_PDU_PR_unsuccessfulOutcome) { - ret = s1ap_compare_s1ap_s1setupfailureies( - &m1->msg.s1ap_S1SetupFailureIEs, - &m2->msg.s1ap_S1SetupFailureIEs); - } - break; - - case S1ap_ProcedureCode_id_UEContextReleaseRequest: - ret = s1ap_compare_s1ap_uecontextreleaserequesties( - &m1->msg.s1ap_UEContextReleaseRequestIEs, - &m2->msg.s1ap_UEContextReleaseRequestIEs); - break; - - case S1ap_ProcedureCode_id_DownlinkS1cdma2000tunneling: - ret = s1ap_compare_s1ap_downlinks1cdma2000tunnelingies( - &m1->msg.s1ap_DownlinkS1cdma2000tunnelingIEs, - &m2->msg.s1ap_DownlinkS1cdma2000tunnelingIEs); - break; - - case S1ap_ProcedureCode_id_UplinkS1cdma2000tunneling: - ret = s1ap_compare_s1ap_uplinks1cdma2000tunnelingies( - &m1->msg.s1ap_UplinkS1cdma2000tunnelingIEs, - &m2->msg.s1ap_UplinkS1cdma2000tunnelingIEs); - break; - - case S1ap_ProcedureCode_id_UEContextModification: - if (present == S1AP_PDU_PR_initiatingMessage) { - ret = s1ap_compare_s1ap_uecontextmodificationrequesties( - &m1->msg.s1ap_UEContextModificationRequestIEs, - &m2->msg.s1ap_UEContextModificationRequestIEs); - } else if (present == S1AP_PDU_PR_successfulOutcome) { - ret = s1ap_compare_s1ap_uecontextmodificationresponseies( - &m1->msg.s1ap_UEContextModificationResponseIEs, - &m2->msg.s1ap_UEContextModificationResponseIEs); - } else if (present == S1AP_PDU_PR_unsuccessfulOutcome) { - ret = s1ap_compare_s1ap_uecontextmodificationfailureies( - &m1->msg.s1ap_UEContextModificationFailureIEs, - &m2->msg.s1ap_UEContextModificationFailureIEs); - } - break; - - case S1ap_ProcedureCode_id_UECapabilityInfoIndication: - ret = s1ap_compare_s1ap_uecapabilityinfoindicationies( - &m1->msg.s1ap_UECapabilityInfoIndicationIEs, - &m2->msg.s1ap_UECapabilityInfoIndicationIEs); - break; - - case S1ap_ProcedureCode_id_UEContextRelease: - if (present == S1AP_PDU_PR_initiatingMessage) { - ret = s1ap_compare_s1ap_uecontextreleasecommandies( - &m1->msg.s1ap_UEContextReleaseCommandIEs, - &m2->msg.s1ap_UEContextReleaseCommandIEs); - } else { - ret = s1ap_compare_s1ap_uecontextreleasecompleteies( - &m1->msg.s1ap_UEContextReleaseCompleteIEs, - &m2->msg.s1ap_UEContextReleaseCompleteIEs); - } - break; - - case S1ap_ProcedureCode_id_eNBStatusTransfer: - ret = s1ap_compare_s1ap_enbstatustransferies( - &m1->msg.s1ap_ENBStatusTransferIEs, - &m2->msg.s1ap_ENBStatusTransferIEs); - break; - - case S1ap_ProcedureCode_id_MMEStatusTransfer: - ret = s1ap_compare_s1ap_mmestatustransferies( - &m1->msg.s1ap_MMEStatusTransferIEs, - &m2->msg.s1ap_MMEStatusTransferIEs); - break; - - case S1ap_ProcedureCode_id_DeactivateTrace: - ret = s1ap_compare_s1ap_deactivatetraceies( - &m1->msg.s1ap_DeactivateTraceIEs, - &m2->msg.s1ap_DeactivateTraceIEs); - break; - - case S1ap_ProcedureCode_id_TraceStart: - ret = s1ap_compare_s1ap_tracestarties( - &m1->msg.s1ap_TraceStartIEs, - &m2->msg.s1ap_TraceStartIEs); - break; - - case S1ap_ProcedureCode_id_TraceFailureIndication: - ret = s1ap_compare_s1ap_tracefailureindicationies( - &m1->msg.s1ap_TraceFailureIndicationIEs, - &m2->msg.s1ap_TraceFailureIndicationIEs); - break; - - case S1ap_ProcedureCode_id_ENBConfigurationUpdate: - if (present == S1AP_PDU_PR_initiatingMessage) { - ret = s1ap_compare_s1ap_enbconfigurationupdateies( - &m1->msg.s1ap_ENBConfigurationUpdateIEs, - &m2->msg.s1ap_ENBConfigurationUpdateIEs); - } else if (present == S1AP_PDU_PR_successfulOutcome) { - ret = s1ap_compare_s1ap_enbconfigurationupdateacknowledgeies( - &m1->msg.s1ap_ENBConfigurationUpdateAcknowledgeIEs, - &m2->msg.s1ap_ENBConfigurationUpdateAcknowledgeIEs); - } else { - ret = s1ap_compare_s1ap_enbconfigurationupdatefailureies( - &m1->msg.s1ap_ENBConfigurationUpdateFailureIEs, - &m2->msg.s1ap_ENBConfigurationUpdateFailureIEs); - } - break; - - case S1ap_ProcedureCode_id_MMEConfigurationUpdate: - if (present == S1AP_PDU_PR_initiatingMessage) { - ret = s1ap_compare_s1ap_mmeconfigurationupdateies( - &m1->msg.s1ap_MMEConfigurationUpdateIEs, - &m2->msg.s1ap_MMEConfigurationUpdateIEs); - } else if (present == S1AP_PDU_PR_successfulOutcome) { - ret = s1ap_compare_s1ap_mmeconfigurationupdateacknowledgeies( - &m1->msg.s1ap_MMEConfigurationUpdateAcknowledgeIEs, - &m2->msg.s1ap_MMEConfigurationUpdateAcknowledgeIEs); - } else { - ret = s1ap_compare_s1ap_mmeconfigurationupdatefailureies( - &m1->msg.s1ap_MMEConfigurationUpdateFailureIEs, - &m2->msg.s1ap_MMEConfigurationUpdateFailureIEs); - } - break; - - case S1ap_ProcedureCode_id_LocationReportingControl: - ret = s1ap_compare_s1ap_locationreportingcontrolies( - &m1->msg.s1ap_LocationReportingControlIEs, - &m2->msg.s1ap_LocationReportingControlIEs); - break; - - case S1ap_ProcedureCode_id_LocationReportingFailureIndication: - ret = s1ap_compare_s1ap_locationreportingfailureindicationies( - &m1->msg.s1ap_LocationReportingFailureIndicationIEs, - &m2->msg.s1ap_LocationReportingFailureIndicationIEs); - break; - - case S1ap_ProcedureCode_id_LocationReport: - ret = s1ap_compare_s1ap_locationreporties( - &m1->msg.s1ap_LocationReportIEs, - &m2->msg.s1ap_LocationReportIEs); - break; - - case S1ap_ProcedureCode_id_OverloadStart: - ret = s1ap_compare_s1ap_overloadstarties( - &m1->msg.s1ap_OverloadStartIEs, - &m2->msg.s1ap_OverloadStartIEs); - break; - - case S1ap_ProcedureCode_id_OverloadStop: - ret = s1ap_compare_s1ap_overloadstopies( - &m1->msg.s1ap_OverloadStopIEs, - &m2->msg.s1ap_OverloadStopIEs); - break; - - case S1ap_ProcedureCode_id_WriteReplaceWarning: - if (present == S1AP_PDU_PR_initiatingMessage) { - ret = s1ap_compare_s1ap_writereplacewarningrequesties( - &m1->msg.s1ap_WriteReplaceWarningRequestIEs, - &m2->msg.s1ap_WriteReplaceWarningRequestIEs); - } else { - ret = s1ap_compare_s1ap_writereplacewarningresponseies( - &m1->msg.s1ap_WriteReplaceWarningResponseIEs, - &m2->msg.s1ap_WriteReplaceWarningResponseIEs); - } - break; - - case S1ap_ProcedureCode_id_eNBDirectInformationTransfer: - ret = s1ap_compare_s1ap_enbdirectinformationtransferies( - &m1->msg.s1ap_ENBDirectInformationTransferIEs, - &m2->msg.s1ap_ENBDirectInformationTransferIEs); - break; - - case S1ap_ProcedureCode_id_MMEDirectInformationTransfer: - - ret = s1ap_compare_s1ap_mmedirectinformationtransferies( - &m1->msg.s1ap_MMEDirectInformationTransferIEs, - &m2->msg.s1ap_MMEDirectInformationTransferIEs); - break; - - case S1ap_ProcedureCode_id_PrivateMessage: - case S1ap_ProcedureCode_id_eNBConfigurationTransfer: - case S1ap_ProcedureCode_id_MMEConfigurationTransfer: - AssertFatal(0, "TODO"); - break; - - case S1ap_ProcedureCode_id_CellTrafficTrace: - ret = s1ap_compare_s1ap_celltraffictraceies( - &m1->msg.s1ap_CellTrafficTraceIEs, - &m2->msg.s1ap_CellTrafficTraceIEs); - break; - - case S1ap_ProcedureCode_id_Kill: - if (present == S1AP_PDU_PR_initiatingMessage) { - ret = s1ap_compare_s1ap_killrequesties( - &m1->msg.s1ap_KillRequestIEs, - &m2->msg.s1ap_KillRequestIEs); - } else { - ret = s1ap_compare_s1ap_killresponseies( - &m1->msg.s1ap_KillResponseIEs, - &m2->msg.s1ap_KillResponseIEs); - } - break; - - case S1ap_ProcedureCode_id_downlinkUEAssociatedLPPaTransport: - ret = s1ap_compare_s1ap_downlinkueassociatedlppatransport_ies( - &m1->msg.s1ap_DownlinkUEAssociatedLPPaTransport_IEs, - &m2->msg.s1ap_DownlinkUEAssociatedLPPaTransport_IEs); - break; - - case S1ap_ProcedureCode_id_uplinkUEAssociatedLPPaTransport: - ret = s1ap_compare_s1ap_uplinkueassociatedlppatransport_ies( - &m1->msg.s1ap_UplinkUEAssociatedLPPaTransport_IEs, - &m2->msg.s1ap_UplinkUEAssociatedLPPaTransport_IEs); - break; - - case S1ap_ProcedureCode_id_downlinkNonUEAssociatedLPPaTransport: - ret = s1ap_compare_s1ap_downlinknonueassociatedlppatransport_ies( - &m1->msg.s1ap_DownlinkNonUEAssociatedLPPaTransport_IEs, - &m2->msg.s1ap_DownlinkNonUEAssociatedLPPaTransport_IEs); - break; - - case S1ap_ProcedureCode_id_uplinkNonUEAssociatedLPPaTransport: - ret = s1ap_compare_s1ap_uplinknonueassociatedlppatransport_ies( - &m1->msg.s1ap_UplinkNonUEAssociatedLPPaTransport_IEs, - &m2->msg.s1ap_UplinkNonUEAssociatedLPPaTransport_IEs); - break; - - default: - AssertFatal(0, "Unknown procedure code %ld", m1->procedureCode); - } - return ret; -} - - -void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, const S1ap_MME_UE_S1AP_ID_t new_id) +void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t *const s1ap, xmlNode *node, const S1AP_MME_UE_S1AP_ID_t new_id) { xmlNode *cur_node = NULL; xmlAttrPtr attr = NULL; @@ -464,24 +73,30 @@ void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, con // modify for (cur_node = (xmlNode *)node; cur_node; cur_node = cur_node->next) { go_deeper_in_tree = 1; + if ((!xmlStrcmp(cur_node->name, (const xmlChar *)"field"))) { // do not get hidden fields xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"hide"); + if (NULL != xml_char) { if ((!xmlStrcmp(xml_char, (const xmlChar *)"yes"))) { go_deeper_in_tree = 0; } + xmlFree(xml_char); } + if (0 < go_deeper_in_tree) { // first get size xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"pos"); + if (NULL != xml_char) { pos = strtoul((const char *)xml_char, NULL, 0); pos -= s1ap->xml_stream_pos_offset; AssertFatal(pos >= 0, "Bad pos %d xml_stream_pos_offset %d", pos, s1ap->xml_stream_pos_offset); xmlFree(xml_char); xml_char = xmlGetProp((xmlNode *)cur_node, (const xmlChar *)"size"); + if (NULL != xml_char) { const xmlChar value_d[32]; const xmlChar value_h[20]; @@ -491,7 +106,6 @@ void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, con unsigned long int uli = 0; char hex[3] = {0,0,0}; char *end_ptr = NULL; - size = strtoul((const char *)xml_char, NULL, 0); xmlFree(xml_char); // second: try to set value (always hex) @@ -501,12 +115,12 @@ void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, con AssertFatal((ret > 0) && (ret < 20), "Could not convert int to hex str"); ret = snprintf((char *)showname, 64, "MME-UE-S1AP-ID: %d", new_id); AssertFatal((ret > 0) && (ret < 64), "Could not convert int to dec str"); - attr = xmlSetProp((xmlNode *)cur_node, (const xmlChar *)"value", value_h); attr = xmlSetProp((xmlNode *)cur_node, (const xmlChar *)"show", value_d); attr = xmlSetProp((xmlNode *)cur_node, (const xmlChar *)"showname", showname); //TODO update s1ap->binary_stream @pos with new_id_hex, size AssertFatal((pos+size) < s1ap->binary_stream_allocated_size, "Rewrite of mme_ue_s1ap_id out of bounds of binary_stream"); + //avoid endianess issues do { hex[0] = value_h[pos2++]; @@ -517,6 +131,7 @@ void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, con AssertFatal((uli != ULONG_MAX) && (end_ptr != NULL) && (*end_ptr == '\0'), "Conversion of hexstring %s failed returned %ld errno %d", hex, uli, errno); s1ap->binary_stream[pos++] = (unsigned char)uli; } while (pos2 < (2*5)); + // update ASN1 et_decode_s1ap(s1ap); //S1AP_INFO("Updated ASN1 for %s\n", showname); @@ -524,6 +139,7 @@ void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, con } } } + if (0 < go_deeper_in_tree) { update_xpath_node_mme_ue_s1ap_id(s1ap, cur_node->children, new_id); } @@ -538,12 +154,11 @@ void update_xpath_node_mme_ue_s1ap_id(et_s1ap_t * const s1ap, xmlNode *node, con * Prints the @nodes content to @output. * From http://www.xmlsoft.org/examples/#xpath2.c */ -void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t * const s1ap_payload, xmlNodeSetPtr nodes, const S1ap_MME_UE_S1AP_ID_t new_id) +void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t *const s1ap_payload, xmlNodeSetPtr nodes, const S1AP_MME_UE_S1AP_ID_t new_id) { int size = 0; int i = 0; xmlNode *s1ap_node = NULL; - size = (nodes) ? nodes->nodeNr : 0; //S1AP_DEBUG("%s() num nodes %u\n", __FUNCTION__, size); @@ -559,6 +174,7 @@ void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t * const s1ap_payload, xmlNodeSe s1ap_node = nodes->nodeTab[i]; AssertFatal(NULL != s1ap_node, "One element of resultset of XPATH expression is NULL\n"); update_xpath_node_mme_ue_s1ap_id(s1ap_payload, s1ap_node, new_id); + /* * All the elements returned by an XPath query are pointers to * elements from the tree *except* namespace nodes where the XPath @@ -581,28 +197,24 @@ void update_xpath_nodes_mme_ue_s1ap_id(et_s1ap_t * const s1ap_payload, xmlNodeSe } } //------------------------------------------------------------------------------ -int et_s1ap_update_mme_ue_s1ap_id(et_packet_t * const packet, const S1ap_MME_UE_S1AP_ID_t old_id, const S1ap_MME_UE_S1AP_ID_t new_id) +int et_s1ap_update_mme_ue_s1ap_id(et_packet_t *const packet, const S1AP_MME_UE_S1AP_ID_t old_id, const S1AP_MME_UE_S1AP_ID_t new_id) { - - xmlChar xpath_expression[ET_XPATH_EXPRESSION_MAX_LENGTH]; int ret = 0; xmlDocPtr doc = NULL; xmlXPathContextPtr xpath_ctx = NULL; xmlXPathObjectPtr xpath_obj = NULL; - //S1AP_DEBUG("%s() packet num %u original frame number %u, mme_ue_s1ap_id %u -> %u\n", __FUNCTION__, packet->packet_number, packet->original_frame_number, old_id, new_id); - ret = snprintf(xpath_expression, ET_XPATH_EXPRESSION_MAX_LENGTH, "//field[@name=\"s1ap.MME_UE_S1AP_ID\"][@show=\"%u\"]", old_id); AssertFatal((ret > 0) && (ret < ET_XPATH_EXPRESSION_MAX_LENGTH), "Could not build XPATH expression err=%d", ret); - doc = packet->sctp_hdr.u.data_hdr.payload.doc; // Create xpath evaluation context xpath_ctx = xmlXPathNewContext(doc); + if(xpath_ctx == NULL) { - fprintf(stderr,"Error: unable to create new XPath context\n"); - xmlFreeDoc(doc); - return(-1); + fprintf(stderr,"Error: unable to create new XPath context\n"); + xmlFreeDoc(doc); + return(-1); } // Evaluate xpath expression @@ -610,17 +222,16 @@ int et_s1ap_update_mme_ue_s1ap_id(et_packet_t * const packet, const S1ap_MME_UE_ xmlXPathFreeContext(xpath_ctx); AssertFatal(xpath_obj != NULL, "Unable to evaluate XPATH expression \"%s\"\n", xpath_expression); - if(xmlXPathNodeSetIsEmpty(xpath_obj->nodesetval)){ + if(xmlXPathNodeSetIsEmpty(xpath_obj->nodesetval)) { xmlXPathFreeObject(xpath_obj); S1AP_DEBUG("%s() No match \"%s\"packet num %u original frame number %u, mme_ue_s1ap_id %u -> %u\n", - __FUNCTION__, xpath_expression, packet->packet_number, packet->original_frame_number, old_id, new_id); + __FUNCTION__, xpath_expression, packet->packet_number, packet->original_frame_number, old_id, new_id); return -1; } + // update selected nodes update_xpath_nodes_mme_ue_s1ap_id(&packet->sctp_hdr.u.data_hdr.payload, xpath_obj->nodesetval, new_id); - // Cleanup of XPath data xmlXPathFreeObject(xpath_obj); - return 0; } diff --git a/openair3/TEST/EPC_TEST/play_scenario_sctp.c b/openair3/TEST/EPC_TEST/play_scenario_sctp.c index 8a9bc491c8..c126608598 100644 --- a/openair3/TEST/EPC_TEST/play_scenario_sctp.c +++ b/openair3/TEST/EPC_TEST/play_scenario_sctp.c @@ -36,22 +36,25 @@ #include "play_scenario.h" //------------------------------------------------------------------------------ -asn_comp_rval_t * et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_datahdr_t * const sctp2, const uint32_t constraints) +asn_comp_rval_t *et_sctp_data_is_matching(sctp_datahdr_t *const sctp1, sctp_datahdr_t *const sctp2, const uint32_t constraints) { asn_comp_rval_t *rv = NULL; + // no comparison for ports - if (sctp1->ppid != sctp2->ppid) { + if (sctp1->ppid != sctp2->ppid) { S1AP_WARN("No Matching SCTP PPID %u %u\n", sctp1->ppid, sctp2->ppid); rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_PPID; return rv; } + if (sctp1->assoc_id != sctp2->assoc_id) { S1AP_WARN("No Matching SCTP assoc id %u %u\n", sctp1->assoc_id, sctp2->assoc_id); rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_ASSOC_ID; return rv; } + if (sctp1->stream != sctp2->stream) { if (constraints & ET_BIT_MASK_MATCH_SCTP_STREAM) { rv = calloc(1, sizeof(asn_comp_rval_t)); @@ -61,30 +64,33 @@ asn_comp_rval_t * et_sctp_data_is_matching(sctp_datahdr_t * const sctp1, sctp_da S1AP_WARN("No Matching SCTP stream %u %u\n", sctp1->stream, sctp2->stream); } } + // We do not have SSN from lower layers -// if (sctp1->ssn != sctp2->ssn) { -// if (constraints & ET_BIT_MASK_MATCH_SCTP_SSN) { -// rv = calloc(1, sizeof(asn_comp_rval_t)); -// rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_SSN; -// return rv; -// } else { -// S1AP_WARN("No Matching SCTP STREAM SN %u %u\n", sctp1->ssn, sctp2->ssn); -// } -// } + // if (sctp1->ssn != sctp2->ssn) { + // if (constraints & ET_BIT_MASK_MATCH_SCTP_SSN) { + // rv = calloc(1, sizeof(asn_comp_rval_t)); + // rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_SSN; + // return rv; + // } else { + // S1AP_WARN("No Matching SCTP STREAM SN %u %u\n", sctp1->ssn, sctp2->ssn); + // } + // } return et_s1ap_is_matching(&sctp1->payload, &sctp2->payload, constraints); } //------------------------------------------------------------------------------ -asn_comp_rval_t * et_sctp_is_matching(et_sctp_hdr_t * const sctp1, et_sctp_hdr_t * const sctp2, const uint32_t constraints) +asn_comp_rval_t *et_sctp_is_matching(et_sctp_hdr_t *const sctp1, et_sctp_hdr_t *const sctp2, const uint32_t constraints) { // no comparison for ports asn_comp_rval_t *rv = NULL; - if (sctp1->chunk_type != sctp2->chunk_type){ + + if (sctp1->chunk_type != sctp2->chunk_type) { S1AP_WARN("No Matching chunk_type %u %u\n", sctp1->chunk_type, sctp2->chunk_type); rv = calloc(1, sizeof(asn_comp_rval_t)); rv->err_code = ET_ERROR_MATCH_PACKET_SCTP_CHUNK_TYPE; return rv; } + switch (sctp1->chunk_type) { case SCTP_CID_DATA: return et_sctp_data_is_matching(&sctp1->u.data_hdr, &sctp2->u.data_hdr, constraints); @@ -93,9 +99,11 @@ asn_comp_rval_t * et_sctp_is_matching(et_sctp_hdr_t * const sctp1, et_sctp_hdr_ case SCTP_CID_INIT: AssertFatal(0, "Not needed now"); break; + case SCTP_CID_INIT_ACK: AssertFatal(0, "Not needed now"); break; + default: AssertFatal(0, "Not needed now cid %d", sctp1->chunk_type); } diff --git a/openair3/TEST/oaisim_mme_client_test.c b/openair3/TEST/oaisim_mme_client_test.c index 0e89511865..8fcda8a5ad 100644 --- a/openair3/TEST/oaisim_mme_client_test.c +++ b/openair3/TEST/oaisim_mme_client_test.c @@ -35,7 +35,6 @@ #include "s1ap_common.h" #include "s1ap_eNB.h" #include "s1ap_mme.h" -#include "s1ap_ies_defs.h" char ip_addr[] = "127.0.0.1"; @@ -60,13 +59,10 @@ int s1ap_eNB_generate_initial_ue_message(uint8_t **buffer, { InitialUEMessageIEs initialUEmessageIEs; InitialUEMessageIEs *initialUEmessageIEs_p = &initialUEmessageIEs; - memset(initialUEmessageIEs_p, 0, sizeof(InitialUEMessageIEs)); - initialUEmessageIEs.eNB_UE_S1AP_ID = eNB_UE_S1AP_ID; initialUEmessageIEs.nas_pdu.buf = infoNAS; initialUEmessageIEs.nas_pdu.size = sizeof(infoNAS); - initialUEmessageIEs.tai.tAC.buf = tac; initialUEmessageIEs.tai.tAC.size = 2; initialUEmessageIEs.tai.pLMNidentity.buf = identity; @@ -76,9 +72,7 @@ int s1ap_eNB_generate_initial_ue_message(uint8_t **buffer, initialUEmessageIEs.eutran_cgi.cell_ID.buf = id; initialUEmessageIEs.eutran_cgi.cell_ID.size = 4; initialUEmessageIEs.eutran_cgi.cell_ID.bits_unused = 4; - initialUEmessageIEs.rrC_Establishment_Cause = RRC_Establishment_Cause_mo_Data; - return s1ap_eNB_encode_initial_ue_message(initialUEmessageIEs_p, buffer, length); } @@ -95,13 +89,10 @@ int main(int argc, char *argv[]) asn_enc_rval_t retVal; uint8_t *buffer; uint32_t len; - SupportedTAs_Item_t ta; PLMNidentity_t plmnIdentity; - asn_debug = 0; asn1_xer_print = 0; - S1SetupRequestIEs s1SetupRequest; memset(&s1SetupRequest, 0, sizeof(S1SetupRequestIEs)); s1SetupRequest.global_ENB_ID.eNB_ID.present = ENB_ID_PR_macroENB_ID; @@ -109,32 +100,23 @@ int main(int argc, char *argv[]) s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.size = 3; s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.bits_unused = 4; OCTET_STRING_fromBuf(&s1SetupRequest.global_ENB_ID.pLMNidentity, identity, 3); - s1SetupRequest.presenceMask |= S1SETUPREQUESTIES_ENBNAME_PRESENT; OCTET_STRING_fromBuf(&s1SetupRequest.eNBname, "ENB 1 eurecom", strlen("ENB 1 eurecom")); - memset(&ta, 0, sizeof(SupportedTAs_Item_t)); memset(&plmnIdentity, 0, sizeof(PLMNidentity_t)); OCTET_STRING_fromBuf(&ta.tAC, tac, 2); OCTET_STRING_fromBuf(&plmnIdentity, identity, 3); ASN_SEQUENCE_ADD(&ta.broadcastPLMNs, &plmnIdentity); ASN_SEQUENCE_ADD(&s1SetupRequest.supportedTAs, &ta); - s1SetupRequest.defaultPagingDRX = PagingDRX_v64; - s1ap_eNB_encode_s1setuprequest(&s1SetupRequest, &buffer, &len); - assoc[0] = sctp_connect_to_remote_host(ip_addr, 36412, &recv_callback); sctp_send_msg(0, 0, buffer, len); - free(buffer); - // generateUplinkNASTransport(&buffer, &len); // sctp_send_msg(assoc[0], 0, buffer, len); // s1ap_mme_decode_pdu(buffer, len); - pthread_join(sctp_get_receiver_thread(assoc[0]), NULL); - return(0); } diff --git a/openair3/TEST/oaisim_mme_list_benchmark.c b/openair3/TEST/oaisim_mme_list_benchmark.c index bfd9274b8a..633e83aace 100644 --- a/openair3/TEST/oaisim_mme_list_benchmark.c +++ b/openair3/TEST/oaisim_mme_list_benchmark.c @@ -35,7 +35,6 @@ #include "s1ap_common.h" #include "s1ap_eNB.h" #include "s1ap_mme.h" -#include "s1ap_ies_defs.h" #include "s1ap_eNB_encoder.h" #include "s1ap_eNB_decoder.h" @@ -79,27 +78,22 @@ void s1ap_test_generate_s1_setup_request(uint32_t eNB_id, uint8_t **buffer, SupportedTAs_Item_t ta; PLMNidentity_t plmnIdentity; uint8_t *id_p = (uint8_t *)(&eNB_id + 1); - memset(&s1SetupRequest, 0, sizeof(S1SetupRequestIEs_t)); s1SetupRequest.global_ENB_ID.eNB_ID.present = ENB_ID_PR_macroENB_ID; s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.buf = id_p; s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.size = 3; s1SetupRequest.global_ENB_ID.eNB_ID.choice.macroENB_ID.bits_unused = 4; OCTET_STRING_fromBuf(&s1SetupRequest.global_ENB_ID.pLMNidentity, identity, 3); - s1SetupRequest.presenceMask |= S1SETUPREQUESTIES_ENBNAME_PRESENT; OCTET_STRING_fromBuf(&s1SetupRequest.eNBname, "ENB 1 eurecom", strlen("ENB 1 eurecom")); - memset(&ta, 0, sizeof(SupportedTAs_Item_t)); memset(&plmnIdentity, 0, sizeof(PLMNidentity_t)); OCTET_STRING_fromBuf(&ta.tAC, tac, 2); OCTET_STRING_fromBuf(&plmnIdentity, identity, 3); ASN_SEQUENCE_ADD(&ta.broadcastPLMNs, &plmnIdentity); ASN_SEQUENCE_ADD(&s1SetupRequest.supportedTAs, &ta); - s1SetupRequest.defaultPagingDRX = PagingDRX_v64; - s1ap_eNB_encode_s1_setup_request(&s1SetupRequest, buffer, length); } @@ -109,13 +103,10 @@ int s1ap_test_generate_initial_ue_message(uint32_t eNB_UE_S1AP_ID, { InitialUEMessageIEs_t initialUEmessageIEs; InitialUEMessageIEs_t *initialUEmessageIEs_p = &initialUEmessageIEs; - memset(initialUEmessageIEs_p, 0, sizeof(InitialUEMessageIEs_t)); - initialUEmessageIEs.eNB_UE_S1AP_ID = eNB_UE_S1AP_ID & 0x00ffffff; initialUEmessageIEs.nas_pdu.buf = (uint8_t *)infoNAS; initialUEmessageIEs.nas_pdu.size = sizeof(infoNAS); - initialUEmessageIEs.tai.tAC.buf = (uint8_t *)tac; initialUEmessageIEs.tai.tAC.size = 2; initialUEmessageIEs.tai.pLMNidentity.buf = (uint8_t *)identity; @@ -125,9 +116,7 @@ int s1ap_test_generate_initial_ue_message(uint32_t eNB_UE_S1AP_ID, initialUEmessageIEs.eutran_cgi.cell_ID.buf = (uint8_t *)id; initialUEmessageIEs.eutran_cgi.cell_ID.size = 4; initialUEmessageIEs.eutran_cgi.cell_ID.bits_unused = 4; - initialUEmessageIEs.rrC_Establishment_Cause = RRC_Establishment_Cause_mo_Data; - return s1ap_eNB_encode_initial_ue_message(initialUEmessageIEs_p, buffer, length); } @@ -140,26 +129,19 @@ int s1ap_test_generate_initial_setup_resp(uint32_t eNB_UE_S1AP_ID, { InitialContextSetupResponseIEs_t initialResponseIEs; InitialContextSetupResponseIEs_t *initialResponseIEs_p = &initialResponseIEs; - E_RABSetupItemCtxtSURes_t e_RABSetupItemCtxtSURes; - memset(initialResponseIEs_p, 0, sizeof(InitialContextSetupResponseIEs_t)); memset(&e_RABSetupItemCtxtSURes, 0, sizeof(E_RABSetupItemCtxtSURes_t)); - initialResponseIEs_p->mme_ue_s1ap_id = mme_UE_S1AP_ID; initialResponseIEs_p->eNB_UE_S1AP_ID = eNB_UE_S1AP_ID; - e_RABSetupItemCtxtSURes.e_RAB_ID = eRAB_id; e_RABSetupItemCtxtSURes.transportLayerAddress.buf = (uint8_t *)&ipv4_local; e_RABSetupItemCtxtSURes.transportLayerAddress.size = 4; - e_RABSetupItemCtxtSURes.gTP_TEID.buf = (uint8_t *)&teid; e_RABSetupItemCtxtSURes.gTP_TEID.size = 4; - ASN_SEQUENCE_ADD( &initialResponseIEs_p->e_RABSetupListCtxtSURes.e_RABSetupItemCtxtSURes, &e_RABSetupItemCtxtSURes); - return s1ap_eNB_encode_initial_context_setup_response(initialResponseIEs_p, buffer, length); } @@ -169,19 +151,19 @@ int recv_callback(uint32_t assocId, uint8_t *buffer, uint32_t length) { - s1ap_message message; + S1AP_S1AP_PDU_t pdu; uint8_t *buffer2; uint32_t len; int j; - if (s1ap_eNB_decode_pdu(&message, buffer, length) < 0) { + if (s1ap_eNB_decode_pdu(&pdu, buffer, length) < 0) { fprintf(stderr, "s1ap_eNB_decode_pdu returned status < 0\n"); free(buffer); return -1; } - if (message.procedureCode == ProcedureCode_id_S1Setup - && message.direction == S1AP_PDU_PR_successfulOutcome) { + if (pdu.initiatingMessage.procedureCode == S1AP_ProcedureCode_id_S1Setup + && pdu.present == S1AP_S1AP_PDU_PR_successfulOutcome) { for (j = 0; j < nb_ue; j++) { s1ap_test_generate_initial_ue_message(j, &buffer2, &len); @@ -194,8 +176,8 @@ int recv_callback(uint32_t assocId, free(buffer2); } - } else if (message.procedureCode == ProcedureCode_id_InitialContextSetup - && message.direction == S1AP_PDU_PR_initiatingMessage) { + } else if (pdu.initiatingMessage.procedureCode == S1AP_ProcedureCode_id_InitialContextSetup + && pdu.present == S1AP_PDU_PR_initiatingMessage) { fprintf(stdout, "Received InitialContextSetup request\n"); s1ap_test_generate_initial_setup_resp( message.msg.initialContextSetupRequestIEs.eNB_UE_S1AP_ID, @@ -220,7 +202,6 @@ int recv_callback(uint32_t assocId, } free(buffer); - return 0; } @@ -231,9 +212,7 @@ int sctp_connected(void *args, { uint8_t *buffer; uint32_t len; - fprintf(stdout, "New association %d\n", assocId); - s1ap_test_generate_s1_setup_request(assocId * nb_eNB, &buffer, &len); if (sctp_send_msg(assocId, 0, buffer, len) < 0) { @@ -244,7 +223,6 @@ int sctp_connected(void *args, } free(buffer); - connected_eNB++; return 0; } @@ -252,12 +230,9 @@ int sctp_connected(void *args, int main(int argc, char *argv[]) { asn_enc_rval_t retVal; - int i; - SupportedTAs_Item_t ta; PLMNidentity_t plmnIdentity; - asn_debug = 0; asn1_xer_print = 0; @@ -278,12 +253,9 @@ int main(int argc, char *argv[]) sleep(1); } - // generateUplinkNASTransport(&buffer, &len); // sctp_send_msg(assoc[0], 0, buffer, len); // s1ap_mme_decode_pdu(buffer, len); - sctp_terminate(); - return(0); } diff --git a/openair3/TEST/oaisim_mme_s1ap_test.c b/openair3/TEST/oaisim_mme_s1ap_test.c index 1f7c1d3bbf..aa8f92aee1 100644 --- a/openair3/TEST/oaisim_mme_s1ap_test.c +++ b/openair3/TEST/oaisim_mme_s1ap_test.c @@ -145,16 +145,16 @@ int main(int argc, char *argv[]) } for (i = 0; i < sizeof(s1ap_test) / sizeof(s1ap_test_t); i++) { - struct s1ap_message_s message; + S1AP_S1AP_PDU_t pdu; uint8_t *buffer; uint32_t length; - memset(&message, 0, sizeof(struct s1ap_message_s)); + memset(&pdu, 0, sizeof(pdu)); printf("Trying to decode %s procedure with asn1c decoder\n", s1ap_test[i].procedure_name); - if (s1ap_mme_decode_pdu(&message, s1ap_test[i].buffer, + if (s1ap_mme_decode_pdu(&pdu, s1ap_test[i].buffer, s1ap_test[i].buf_len) < 0) { - if (s1ap_eNB_decode_pdu(&message, s1ap_test[i].buffer, + if (s1ap_eNB_decode_pdu(&pdu, s1ap_test[i].buffer, s1ap_test[i].buf_len) < 0) { printf("Failed to decode this message\n"); } else { @@ -167,7 +167,7 @@ int main(int argc, char *argv[]) printf("Trying to encode %s procedure with asn1c encoder\n", s1ap_test[i].procedure_name); - if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) { + if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) { printf("Failed to encode this message on MME side, trying eNB side\n"); } else { compare_buffer(buffer, length, s1ap_test[i].buffer, s1ap_test[i].buf_len); diff --git a/openair3/TEST/oaisim_mme_sctp_test.c b/openair3/TEST/oaisim_mme_sctp_test.c index d810f9ee8f..b8be3e185c 100644 --- a/openair3/TEST/oaisim_mme_sctp_test.c +++ b/openair3/TEST/oaisim_mme_sctp_test.c @@ -35,7 +35,6 @@ #include "s1ap_common.h" #include "s1ap_eNB.h" #include "s1ap_mme.h" -#include "s1ap_ies_defs.h" #include "s1ap_eNB_encoder.h" #include "s1ap_eNB_decoder.h" @@ -45,9 +44,7 @@ int recv_callback(uint32_t assocId, uint8_t *buffer, uint32_t length) { - free(buffer); - return 0; } @@ -56,14 +53,12 @@ int sctp_connected(void *args, uint32_t instreams, uint32_t outstreams) { - return 0; } int main(int argc, char *argv[]) { asn_enc_rval_t retVal; - int i; for (i = 0; i < nb_eNB; i++) { @@ -75,6 +70,5 @@ int main(int argc, char *argv[]) } sctp_terminate(); - return(0); } diff --git a/openair3/TEST/oaisim_mme_test_s1c_s1ap.c b/openair3/TEST/oaisim_mme_test_s1c_s1ap.c index 993fad2f89..10d43d595d 100644 --- a/openair3/TEST/oaisim_mme_test_s1c_s1ap.c +++ b/openair3/TEST/oaisim_mme_test_s1c_s1ap.c @@ -43,7 +43,6 @@ #include "intertask_interface.h" #include "s1ap_eNB_default_values.h" #include "s1ap_common.h" -#include "s1ap_ies_defs.h" #include "s1ap_eNB_defs.h" #include "s1ap_eNB_management_procedures.h" #include "assertions.h" @@ -55,11 +54,9 @@ void s1ap_eNB_handle_sctp_data_ind(sctp_data_ind_t *sctp_data_ind) { int result; - DevAssert(sctp_data_ind != NULL); mme_test_s1_notify_sctp_data_ind(sctp_data_ind->assoc_id, sctp_data_ind->stream, - sctp_data_ind->buffer, sctp_data_ind->buffer_length); - + sctp_data_ind->buffer, sctp_data_ind->buffer_length); result = itti_free(TASK_UNKNOWN, sctp_data_ind->buffer); AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); } @@ -70,16 +67,12 @@ void s1ap_eNB_itti_send_sctp_data_req(instance_t instance, int32_t assoc_id, uin { MessageDef *message_p; sctp_data_req_t *sctp_data_req; - message_p = itti_alloc_new_message(TASK_S1AP, SCTP_DATA_REQ); - sctp_data_req = &message_p->ittiMsg.sctp_data_req; - sctp_data_req->assoc_id = assoc_id; sctp_data_req->buffer = buffer; sctp_data_req->buffer_length = buffer_length; sctp_data_req->stream = stream; - itti_send_msg_to_task(TASK_SCTP, instance, message_p); } @@ -100,7 +93,6 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shut /* If there are no more associated MME, inform eNB app */ if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb == 0) { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_DEREGISTERED_ENB_IND); S1AP_DEREGISTERED_ENB_IND(message_p).nb_mme = 0; itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p); @@ -119,7 +111,6 @@ void s1ap_handle_s1_setup_message(s1ap_eNB_mme_data_t *mme_desc_p, int sctp_shut /* If there are no more pending messages, inform eNB app */ if (mme_desc_p->s1ap_eNB_instance->s1ap_mme_pending_nb == 0) { MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_S1AP, S1AP_REGISTER_ENB_CNF); S1AP_REGISTER_ENB_CNF(message_p).nb_mme = mme_desc_p->s1ap_eNB_instance->s1ap_mme_associated_nb; itti_send_msg_to_task(TASK_ENB_APP, mme_desc_p->s1ap_eNB_instance->instance, message_p); @@ -131,12 +122,9 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa { s1ap_eNB_instance_t *instance_p; s1ap_eNB_mme_data_t *s1ap_mme_data_p; - DevAssert(sctp_new_association_resp != NULL); - instance_p = s1ap_eNB_get_instance(instance); DevAssert(instance_p != NULL); - s1ap_mme_data_p = s1ap_eNB_get_MME(instance_p, -1, sctp_new_association_resp->ulp_cnx_id); DevAssert(s1ap_mme_data_p != NULL); @@ -146,9 +134,7 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa sctp_new_association_resp->sctp_state, instance, sctp_new_association_resp->ulp_cnx_id); - s1ap_handle_s1_setup_message(s1ap_mme_data_p, sctp_new_association_resp->sctp_state == SCTP_STATE_SHUTDOWN); - return; } @@ -156,49 +142,37 @@ void s1ap_eNB_handle_sctp_association_resp(instance_t instance, sctp_new_associa s1ap_mme_data_p->assoc_id = sctp_new_association_resp->assoc_id; s1ap_mme_data_p->in_streams = sctp_new_association_resp->in_streams; s1ap_mme_data_p->out_streams = sctp_new_association_resp->out_streams; - /* Prepare new S1 Setup Request */ mme_test_s1_start_test(instance_p, s1ap_mme_data_p); } void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, - net_ip_address_t *mme_ip_address, - net_ip_address_t *local_ip_addr) + net_ip_address_t *mme_ip_address, + net_ip_address_t *local_ip_addr) { MessageDef *message_p = NULL; sctp_new_association_req_t *sctp_new_association_req_p = NULL; s1ap_eNB_mme_data_t *s1ap_mme_data_p = NULL; - DevAssert(instance_p != NULL); DevAssert(mme_ip_address != NULL); - message_p = itti_alloc_new_message(TASK_S1AP, SCTP_NEW_ASSOCIATION_REQ); - sctp_new_association_req_p = &message_p->ittiMsg.sctp_new_association_req; - sctp_new_association_req_p->port = S1AP_PORT_NUMBER; sctp_new_association_req_p->ppid = S1AP_SCTP_PPID; - memcpy(&sctp_new_association_req_p->remote_address, mme_ip_address, sizeof(*mme_ip_address)); - memcpy(&sctp_new_association_req_p->local_address, local_ip_addr, sizeof(*local_ip_addr)); - /* Create new MME descriptor */ s1ap_mme_data_p = calloc(1, sizeof(*s1ap_mme_data_p)); DevAssert(s1ap_mme_data_p != NULL); - s1ap_mme_data_p->cnx_id = s1ap_eNB_fetch_add_global_cnx_id(); sctp_new_association_req_p->ulp_cnx_id = s1ap_mme_data_p->cnx_id; - s1ap_mme_data_p->assoc_id = -1; s1ap_mme_data_p->s1ap_eNB_instance = instance_p; - STAILQ_INIT(&s1ap_mme_data_p->served_gummei); - /* Insert the new descriptor in list of known MME * but not yet associated. */ @@ -206,7 +180,6 @@ void s1ap_eNB_register_mme(s1ap_eNB_instance_t *instance_p, s1ap_mme_data_p->state = S1AP_ENB_STATE_WAITING; instance_p->s1ap_mme_nb ++; instance_p->s1ap_mme_pending_nb ++; - itti_send_msg_to_task(TASK_SCTP, instance_p->instance, message_p); } @@ -216,9 +189,7 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t * { s1ap_eNB_instance_t *new_instance; uint8_t index; - DevAssert(s1ap_register_eNB != NULL); - /* Look if the provided instance already exists */ new_instance = s1ap_eNB_get_instance(instance); @@ -234,10 +205,8 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t * } else { new_instance = calloc(1, sizeof(s1ap_eNB_instance_t)); DevAssert(new_instance != NULL); - RB_INIT(&new_instance->s1ap_ue_head); RB_INIT(&new_instance->s1ap_mme_head); - /* Copy usefull parameters */ new_instance->instance = instance; new_instance->eNB_name = s1ap_register_eNB->eNB_name; @@ -248,10 +217,8 @@ void s1ap_eNB_handle_register_eNB(instance_t instance, s1ap_register_enb_req_t * new_instance->mnc = s1ap_register_eNB->mnc; new_instance->mnc_digit_length = s1ap_register_eNB->mnc_digit_length; new_instance->default_drx = s1ap_register_eNB->default_drx; - /* Add the new instance to the list of eNB (meaningfull in virtual mode) */ s1ap_eNB_insert_new_instance(new_instance); - S1AP_DEBUG("Registered new eNB[%d] and %s eNB id %u\n", instance, s1ap_register_eNB->cell_type == CELL_MACRO_ENB ? "macro" : "home", @@ -275,54 +242,48 @@ void *s1ap_eNB_task(void *arg) { MessageDef *received_msg = NULL; int result; - S1AP_DEBUG("Starting S1AP layer\n"); - s1ap_eNB_prepare_internal_data(); - itti_mark_task_ready(TASK_S1AP); while (1) { itti_receive_msg(TASK_S1AP, &received_msg); switch (ITTI_MSG_ID(received_msg)) { - case TERMINATE_MESSAGE: - itti_exit_task(); + case TERMINATE_MESSAGE: + itti_exit_task(); + break; + + case S1AP_REGISTER_ENB_REQ: { + /* Register a new eNB. + * in Virtual mode eNBs will be distinguished using the mod_id/ + * Each eNB has to send an S1AP_REGISTER_ENB message with its + * own parameters. + */ + s1ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &S1AP_REGISTER_ENB_REQ(received_msg)); + } break; - case S1AP_REGISTER_ENB_REQ: { - /* Register a new eNB. - * in Virtual mode eNBs will be distinguished using the mod_id/ - * Each eNB has to send an S1AP_REGISTER_ENB message with its - * own parameters. - */ - s1ap_eNB_handle_register_eNB(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &S1AP_REGISTER_ENB_REQ(received_msg)); - } - break; - - case SCTP_NEW_ASSOCIATION_RESP: { - s1ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), - &received_msg->ittiMsg.sctp_new_association_resp); - } - break; - - case SCTP_DATA_IND: { - s1ap_eNB_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); - } - break; - - - - default: - S1AP_ERROR("Received unhandled message: %d:%s\n", - ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); + case SCTP_NEW_ASSOCIATION_RESP: { + s1ap_eNB_handle_sctp_association_resp(ITTI_MESSAGE_GET_INSTANCE(received_msg), + &received_msg->ittiMsg.sctp_new_association_resp); + } break; + + case SCTP_DATA_IND: { + s1ap_eNB_handle_sctp_data_ind(&received_msg->ittiMsg.sctp_data_ind); + } + break; + + default: + S1AP_ERROR("Received unhandled message: %d:%s\n", + ITTI_MSG_ID(received_msg), ITTI_MSG_NAME(received_msg)); + break; } result = itti_free (ITTI_MSG_ORIGIN_ID(received_msg), received_msg); AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - received_msg = NULL; } diff --git a/openair3/TEST/test_s1ap.c b/openair3/TEST/test_s1ap.c index a366796f77..a040822155 100644 --- a/openair3/TEST/test_s1ap.c +++ b/openair3/TEST/test_s1ap.c @@ -153,22 +153,20 @@ static int compare_buffer(uint8_t *buffer, uint32_t length_buffer, void doit (void) { int i; - break_on_error = 1; // asn1_xer_print = 1; // asn_debug = 1; for (i = 0; i < sizeof(s1ap_test) / sizeof(s1ap_test_t); i++) { - struct s1ap_message_s message; + S1AP_S1AP_PDU_t pdu; uint8_t *buffer; uint32_t length; - - memset(&message, 0, sizeof(struct s1ap_message_s)); + memset(&pdu, 0, sizeof(pdu)); if (s1ap_test[i].originating == ENB) { /* eNB originated procedure -> USE MME decoder */ - if (s1ap_mme_decode_pdu(&message, s1ap_test[i].buffer, + if (s1ap_mme_decode_pdu(&pdu, s1ap_test[i].buffer, s1ap_test[i].buf_len) < 0) { fail("Failed to decode %s\n", s1ap_test[i].procedure_name); } else { @@ -176,7 +174,7 @@ void doit (void) } } else { /* MME originated procedure -> USE eNB decoder */ - if (s1ap_eNB_decode_pdu(&message, s1ap_test[i].buffer, + if (s1ap_eNB_decode_pdu(&pdu, s1ap_test[i].buffer, s1ap_test[i].buf_len) < 0) { fail("Failed to decode %s\n", s1ap_test[i].procedure_name); } else { @@ -186,14 +184,14 @@ void doit (void) if (s1ap_test[i].originating == ENB) { /* eNB originated procedure -> USE eNB encoder */ - if (s1ap_eNB_encode_pdu(&message, &buffer, &length) < 0) { + if (s1ap_eNB_encode_pdu(&pdu, &buffer, &length) < 0) { fail("Failed to decode %s\n", s1ap_test[i].procedure_name); } else { success("Encoded %s correctly\n", s1ap_test[i].procedure_name); } } else { /* MME originated procedure -> USE mme encoder */ - if (s1ap_mme_encode_pdu(&message, &buffer, &length) < 0) { + if (s1ap_mme_encode_pdu(&pdu, &buffer, &length) < 0) { fail("Failed to encode %s\n", s1ap_test[i].procedure_name); } else { success("Encoded %s correctly\n", s1ap_test[i].procedure_name); From 0339b49bdf8971ba040c8ce91f16b7bebb55ff06 Mon Sep 17 00:00:00 2001 From: WEI-TAI CHEN Date: Fri, 13 Apr 2018 01:37:04 -0700 Subject: [PATCH 02/13] RRC .ans1 file and test asn1c --- cmake_targets/CMakeLists.txt | 51 ++++++++++++++++ cmake_targets/build_oai | 2 + cmake_targets/tools/fix_asn1 | 19 ++++++ openair2/COMMON/rrc_messages_types.h | 87 ++++++++++++++++++++++++++++ 4 files changed, 159 insertions(+) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index f1ffda9119..d18a7a40bd 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -327,6 +327,57 @@ add_custom_command ( DEPENDS ${RRC_GRAMMAR} ) + +#NR RRC + +add_list2_option(NR_RRC_ASN1_VERSION "Rel15" "ASN.1 version of NR_RRC interface") + +if (${NR_RRC_ASN1_VERSION} STREQUAL "Rel15") + set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-RRC-Definitions.asn) +endif (${NR_RRC_ASN1_VERSION} STREQUAL "Rel15") + +set (NR_RRC_FULL_DIR ${asn1_generated_dir}/${NR_RRC_ASN1_VERSION}) + +if(NOT EXISTS ${asn1c_call}) + message( FATAL_ERROR "The script ${asn1c_call} must be present" ) +endif(NOT EXISTS ${asn1c_call}) + +execute_process(COMMAND ${asn1c_call} + ${NR_RRC_FULL_DIR} + ${RRC_GRAMMAR} + RESULT_VARIABLE ret) + +if (NOT ${ret} STREQUAL 0) + message(FATAL_ERROR "${asn1c_call}: error") +endif (NOT ${ret} STREQUAL 0) + +if(NOT EXISTS ${fix_asn1c_call}) + message( FATAL_ERROR "The script ${fix_asn1c_call} must be present" ) +endif(NOT EXISTS ${fix_asn1c_call}) +execute_process(COMMAND ${fix_asn1c_call} ${NR_RRC_FULL_DIR} NR_RRC ${NR_RRC_ASN1_VERSION} + RESULT_VARIABLE ret) +if (NOT ${ret} STREQUAL 0) + message(FATAL_ERROR "${fix_asn1c_call}: error") +endif (NOT ${ret} STREQUAL 0) + +file(GLOB nr_rrc_source ${NR_RRC_FULL_DIR}/*.c) +file(GLOB nr_rrc_h ${NR_RRC_FULL_DIR}/*.h) +set(nr_rrc_h ${nr_rrc_h} ${NR_RRC_FULL_DIR}/asn1_constants.h) +set_source_files_properties(${nr_rrc_source} PROPERTIES COMPILE_FLAGS -w) # suppress warnings from generated code +add_library(NR_RRC_LIB ${nr_rrc_h} ${nr_rrc_source} + ${OPENAIR2_DIR}/RRC/NR/MESSAGES/asn1_msg.c) +include_directories ("${NR_RRC_FULL_DIR}") + +# add the command to generate the source code +# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make +add_custom_command ( + OUTPUT ${NR_RRC_FULL_DIR}/asn1_constants.h + COMMAND ${asn1c_call} ${NR_RRC_FULL_DIR} ${RRC_GRAMMAR} + COMMAND ${fix_asn1c_call} ${NR_RRC_FULL_DIR} RRC ${NR_RRC_ASN1_VERSION} + DEPENDS ${RRC_GRAMMAR} + ) + + # S1AP # Same limitation as described in RRC: unknown generated file list # so we generate it at cmake time diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index b41e53ea90..5af5499074 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -48,6 +48,7 @@ DEADLINE_SCHEDULER_FLAG_USER="False" FORCE_DEADLINE_SCHEDULER_FLAG_USER="" CPU_AFFINITY_FLAG_USER="False" #Only valid when lowlatecy flag is set to False REL="Rel14" +NR_REL="Rel15" HW="None" TP="None" NOS1=0 @@ -574,6 +575,7 @@ function main() { echo "set ( CFLAGS_PROCESSOR_USER \"$CFLAGS_PROCESSOR_USER\" )" >> $cmake_file echo "set ( XFORMS $XFORMS )" >> $cmake_file echo "set ( RRC_ASN1_VERSION \"${REL}\")" >> $cmake_file + echo "set ( NR_RRC_ASN1_VERSION \"${NR_REL}\")" >> $cmake_file echo "set ( ENABLE_VCD_FIFO $VCD_TIMING )" >> $cmake_file echo "set ( RF_BOARD \"${HW}\")" >> $cmake_file echo "set ( TRANSP_PRO \"${TP}\")" >> $cmake_file diff --git a/cmake_targets/tools/fix_asn1 b/cmake_targets/tools/fix_asn1 index fe819c2716..14e4d3262c 100755 --- a/cmake_targets/tools/fix_asn1 +++ b/cmake_targets/tools/fix_asn1 @@ -109,6 +109,22 @@ function patch_rrc() esac } +function patch_nr_rrc() +{ + local directory="$1" + local version="$2" + + case "$version" in + Rel15 ) + echo "patching NR_RRC files release 15" + apply_patches "$directory" NR_RRC_Rel15 ${#NR_RRC_Rel15[*]} + ;; + * ) + error unknwon/unhandled NR_RRC version \'"$version"\' + ;; + esac +} + function patch_x2ap() { local directory="$1" @@ -161,6 +177,9 @@ function main() RRC ) patch_rrc "$directory" "$version" ;; + NR_RRC ) + patch_nr_rrc "$directory" "$version" + ;; X2AP ) patch_x2ap "$directory" "$version" ;; diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 9bd25d3b3a..efb63eb70b 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -240,6 +240,93 @@ typedef struct NbIoTRrcConfigurationReq_s { long ue_TimersAndConstants_n311_NB; } NbIoTRrcConfigurationReq; +// eNB: ENB_APP -> RRC messages +typedef struct RrcConfigurationReq_s { + uint32_t cell_identity; + + uint16_t tac; + + uint16_t mcc; + uint16_t mnc; + uint8_t mnc_digit_length; + + /* + paging_drx_t default_drx; + int16_t nb_cc; + lte_frame_type_t frame_type[MAX_NUM_CCs]; + uint8_t tdd_config[MAX_NUM_CCs]; + uint8_t tdd_config_s[MAX_NUM_CCs]; + lte_prefix_type_t prefix_type[MAX_NUM_CCs]; + uint8_t pbch_repetition[MAX_NUM_CCs]; + int16_t eutra_band[MAX_NUM_CCs]; + uint32_t downlink_frequency[MAX_NUM_CCs]; + int32_t uplink_frequency_offset[MAX_NUM_CCs]; + int16_t Nid_cell[MAX_NUM_CCs];// for testing, change later + int16_t N_RB_DL[MAX_NUM_CCs];// for testing, change later + int nb_antenna_ports[MAX_NUM_CCs]; + long prach_root[MAX_NUM_CCs]; + long prach_config_index[MAX_NUM_CCs]; + BOOLEAN_t prach_high_speed[MAX_NUM_CCs]; + long prach_zero_correlation[MAX_NUM_CCs]; + long prach_freq_offset[MAX_NUM_CCs]; + long pucch_delta_shift[MAX_NUM_CCs]; + long pucch_nRB_CQI[MAX_NUM_CCs]; + long pucch_nCS_AN[MAX_NUM_CCs]; +#if !defined(Rel10) && !defined(Rel14) + long pucch_n1_AN[MAX_NUM_CCs]; +#endif + long pdsch_referenceSignalPower[MAX_NUM_CCs]; + long pdsch_p_b[MAX_NUM_CCs]; + long pusch_n_SB[MAX_NUM_CCs]; + long pusch_hoppingMode[MAX_NUM_CCs]; + long pusch_hoppingOffset[MAX_NUM_CCs]; + BOOLEAN_t pusch_enable64QAM[MAX_NUM_CCs]; + BOOLEAN_t pusch_groupHoppingEnabled[MAX_NUM_CCs]; + long pusch_groupAssignment[MAX_NUM_CCs]; + BOOLEAN_t pusch_sequenceHoppingEnabled[MAX_NUM_CCs]; + long pusch_nDMRS1[MAX_NUM_CCs]; + long phich_duration[MAX_NUM_CCs]; + long phich_resource[MAX_NUM_CCs]; + BOOLEAN_t srs_enable[MAX_NUM_CCs]; + long srs_BandwidthConfig[MAX_NUM_CCs]; + long srs_SubframeConfig[MAX_NUM_CCs]; + BOOLEAN_t srs_ackNackST[MAX_NUM_CCs]; + BOOLEAN_t srs_MaxUpPts[MAX_NUM_CCs]; + long pusch_p0_Nominal[MAX_NUM_CCs]; + long pusch_alpha[MAX_NUM_CCs]; + long pucch_p0_Nominal[MAX_NUM_CCs]; + long msg3_delta_Preamble[MAX_NUM_CCs]; + long ul_CyclicPrefixLength[MAX_NUM_CCs]; + e_DeltaFList_PUCCH__deltaF_PUCCH_Format1 pucch_deltaF_Format1[MAX_NUM_CCs]; + e_DeltaFList_PUCCH__deltaF_PUCCH_Format1b pucch_deltaF_Format1b[MAX_NUM_CCs]; + e_DeltaFList_PUCCH__deltaF_PUCCH_Format2 pucch_deltaF_Format2[MAX_NUM_CCs]; + e_DeltaFList_PUCCH__deltaF_PUCCH_Format2a pucch_deltaF_Format2a[MAX_NUM_CCs]; + e_DeltaFList_PUCCH__deltaF_PUCCH_Format2b pucch_deltaF_Format2b[MAX_NUM_CCs]; + long rach_numberOfRA_Preambles[MAX_NUM_CCs]; + BOOLEAN_t rach_preamblesGroupAConfig[MAX_NUM_CCs]; + long rach_sizeOfRA_PreamblesGroupA[MAX_NUM_CCs]; + long rach_messageSizeGroupA[MAX_NUM_CCs]; + e_RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB rach_messagePowerOffsetGroupB[MAX_NUM_CCs]; + long rach_powerRampingStep[MAX_NUM_CCs]; + long rach_preambleInitialReceivedTargetPower[MAX_NUM_CCs]; + long rach_preambleTransMax[MAX_NUM_CCs]; + long rach_raResponseWindowSize[MAX_NUM_CCs]; + long rach_macContentionResolutionTimer[MAX_NUM_CCs]; + long rach_maxHARQ_Msg3Tx[MAX_NUM_CCs]; + long bcch_modificationPeriodCoeff[MAX_NUM_CCs]; + long pcch_defaultPagingCycle[MAX_NUM_CCs]; + long pcch_nB[MAX_NUM_CCs]; + long ue_TimersAndConstants_t300[MAX_NUM_CCs]; + long ue_TimersAndConstants_t301[MAX_NUM_CCs]; + long ue_TimersAndConstants_t310[MAX_NUM_CCs]; + long ue_TimersAndConstants_t311[MAX_NUM_CCs]; + long ue_TimersAndConstants_n310[MAX_NUM_CCs]; + long ue_TimersAndConstants_n311[MAX_NUM_CCs]; + long ue_TransmissionMode[MAX_NUM_CCs]; + */ + +} gNB_RrcConfigurationReq; + // UE: NAS -> RRC messages typedef kenb_refresh_req_t NasKenbRefreshReq; From c4e0f47570208927b174464abc8b1dabcd968ac7 Mon Sep 17 00:00:00 2001 From: WEI-TAI CHEN Date: Fri, 13 Apr 2018 01:52:05 -0700 Subject: [PATCH 03/13] upload RRC file --- common/ran_context.h | 11 +- openair2/RRC/NR/L2_interface_NR.c | 519 ++ .../ASN1_files/NR-InterNodeDefinitions.asn | 282 + .../ans1c/ASN1_files/NR-RRC-Definitions.asn | 5480 ++++++++++++ .../ans1c/ASN1_files/NR-UE-Variables.asn | 46 + .../ASN1_files/extract_asn1_from_spce.pl | 82 + openair2/RRC/NR/MESSAGES/asn1_msg.c | 2667 ++++++ openair2/RRC/NR/defs_NR.h | 616 ++ openair2/RRC/NR/extern_NR.h | 87 + openair2/RRC/NR/rrc_gNB.c | 7428 +++++++++++++++++ openair2/RRC/NR/rrc_types_NR.h | 64 + 11 files changed, 17280 insertions(+), 2 deletions(-) create mode 100644 openair2/RRC/NR/L2_interface_NR.c create mode 100755 openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-InterNodeDefinitions.asn create mode 100755 openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-RRC-Definitions.asn create mode 100755 openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-UE-Variables.asn create mode 100755 openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/extract_asn1_from_spce.pl create mode 100644 openair2/RRC/NR/MESSAGES/asn1_msg.c create mode 100644 openair2/RRC/NR/defs_NR.h create mode 100644 openair2/RRC/NR/extern_NR.h create mode 100644 openair2/RRC/NR/rrc_gNB.c create mode 100644 openair2/RRC/NR/rrc_types_NR.h diff --git a/common/ran_context.h b/common/ran_context.h index 8d6b02a31e..76f1b63e3d 100644 --- a/common/ran_context.h +++ b/common/ran_context.h @@ -50,15 +50,20 @@ #include "PHY/defs_L1_NB_IoT.h" #include "RRC/LITE/defs_NB_IoT.h" +#include "RRC/NR/defs_NR.h" typedef struct { /// RAN context config file name char *config_file_name; /// Number of RRC instances in this node int nb_inst; + /// Number of NB_IoT RRC instances in this node + int nb_nb_iot_rrc_inst; + /// Number of NR RRC instances in this node + int nb_nr_inst; /// Number of Component Carriers per instance in this node int *nb_CC; - /// Number of NB_IoT instances in this node - int nb_nb_iot_rrc_inst; + /// Number of NR Component Carriers per instance in this node + int *nb_nr_CC; /// Number of MACRLC instances in this node int nb_macrlc_inst; /// Number of NB_IoT MACRLC instances in this node @@ -85,6 +90,8 @@ typedef struct { struct eNB_RRC_INST_s **rrc; /// NB_IoT RRC context variables //struct eNB_RRC_INST_NB_IoT_s **nb_iot_rrc; + /// NR RRC context variables + struct gNB_RRC_INST_s **nr_rrc; /// MAC context variables struct eNB_MAC_INST_s **mac; /// NB_IoT MAC context variables diff --git a/openair2/RRC/NR/L2_interface_NR.c b/openair2/RRC/NR/L2_interface_NR.c new file mode 100644 index 0000000000..91834d9c9d --- /dev/null +++ b/openair2/RRC/NR/L2_interface_NR.c @@ -0,0 +1,519 @@ +/* + * 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 + */ + +/*! \file l2_interface.c + * \brief layer 2 interface, used to support different RRC sublayer + * \author Raymond Knopp and Navid Nikaein + * \date 2010-2014 + * \version 1.0 + * \company Eurecom + * \email: raymond.knopp@eurecom.fr + */ + +#include "platform_types.h" +//#include "openair_defs.h" +//#include "openair_proto.h" +#include "defs.h" +#include "extern.h" +//#include "mac_lchan_interface.h" +//#include "openair_rrc_utils.h" +//#include "openair_rrc_main.h" +#include "UTIL/LOG/log.h" +#include "rrc_eNB_UE_context.h" +#include "pdcp.h" +#include "msc.h" +#include "common/ran_context.h" + +#ifdef PHY_EMUL +#include "SIMULATION/simulation_defs.h" +extern EMULATION_VARS *Emul_vars; +extern eNB_MAC_INST *eNB_mac_inst; +extern UE_MAC_INST *UE_mac_inst; +#endif + +#if defined(ENABLE_ITTI) +# include "intertask_interface.h" +#endif + +#include "flexran_agent_extern.h" + +//#define RRC_DATA_REQ_DEBUG +//#define DEBUG_RRC 1 + + +extern RAN_CONTEXT_t RC; + +//------------------------------------------------------------------------------ +int8_t +mac_rrc_data_req( + const module_id_t Mod_idP, + const int CC_id, + const frame_t frameP, + const rb_id_t Srb_id, + const uint8_t Nb_tb, + uint8_t* const buffer_pP, + const uint8_t mbsfn_sync_area +) +//-------------------------------------------------------------------------- +{ + asn_enc_rval_t enc_rval; + SRB_INFO *Srb_info; + uint8_t Sdu_size = 0; + uint8_t sfn = (uint8_t)((frameP>>2)&0xff); + + +#ifdef DEBUG_RRC + int i; + LOG_I(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_idP,Srb_id); +#endif + + eNB_RRC_INST *rrc; + rrc_eNB_carrier_data_t *carrier; + BCCH_BCH_Message_t *mib; + + + rrc = RC.rrc[Mod_idP]; + carrier = &rrc->carrier[0]; + mib = &carrier->mib; + + if((Srb_id & RAB_OFFSET) == BCCH) { + if(RC.rrc[Mod_idP]->carrier[CC_id].SI.Active==0) { + return 0; + } + + // All even frames transmit SIB in SF 5 + AssertFatal(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1 != 255, + "[eNB %d] MAC Request for SIB1 and SIB1 not initialized\n",Mod_idP); + + if ((frameP%2) == 0) { + memcpy(&buffer_pP[0], + RC.rrc[Mod_idP]->carrier[CC_id].SIB1, + RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1); + +#if 0 //defined(ENABLE_ITTI) + { + MessageDef *message_p; + int sib1_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1; + int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu); + + if (sib1_size > sdu_size) { + LOG_E(RRC, "SIB1 SDU larger than BCCH SDU buffer size (%d, %d)", sib1_size, sdu_size); + sib1_size = sdu_size; + } + + message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ); + RRC_MAC_BCCH_DATA_REQ (message_p).frame = frameP; + RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib1_size; + memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, BCCH_SDU_SIZE); + memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, + RC.rrc[Mod_idP]->carrier[CC_id].SIB1, + sib1_size); + RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index; + + itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p); + } +#endif + +#ifdef DEBUG_RRC + LOG_T(RRC,"[eNB %d] Frame %d : BCCH request => SIB 1\n",Mod_idP,frameP); + + for (i=0; icarrier[CC_id].sizeof_SIB1; i++) { + LOG_T(RRC,"%x.",buffer_pP[i]); + } + + LOG_T(RRC,"\n"); +#endif + + return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1); + } // All RFN mod 8 transmit SIB2-3 in SF 5 + else if ((frameP%8) == 1) { + memcpy(&buffer_pP[0], + RC.rrc[Mod_idP]->carrier[CC_id].SIB23, + RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23); + +#if 0 //defined(ENABLE_ITTI) + { + MessageDef *message_p; + int sib23_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23; + int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu); + + if (sib23_size > sdu_size) { + LOG_E(RRC, "SIB23 SDU larger than BCCH SDU buffer size (%d, %d)", sib23_size, sdu_size); + sib23_size = sdu_size; + } + + message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ); + RRC_MAC_BCCH_DATA_REQ (message_p).frame = frameP; + RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib23_size; + memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, BCCH_SDU_SIZE); + memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, + RC.rrc[Mod_idP]->carrier[CC_id].SIB23, + sib23_size); + RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index; + + itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p); + } +#endif + +#ifdef DEBUG_RRC + LOG_T(RRC,"[eNB %d] Frame %d BCCH request => SIB 2-3\n",Mod_idP,frameP); + + for (i=0; icarrier[CC_id].sizeof_SIB23; i++) { + LOG_T(RRC,"%x.",buffer_pP[i]); + } + + LOG_T(RRC,"\n"); +#endif + return(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23); + } else { + return(0); + } + } + if( (Srb_id & RAB_OFFSET ) == MIBCH) { + + mib->message.systemFrameNumber.buf = &sfn; + enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message, + (void*)mib, + carrier->MIB, + 24); + LOG_D(RRC,"Encoded MIB for frame %d (%p), bits %lu\n",sfn,carrier->MIB,enc_rval.encoded); + buffer_pP[0]=carrier->MIB[0]; + buffer_pP[1]=carrier->MIB[1]; + buffer_pP[2]=carrier->MIB[2]; + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + return(3); + } + + if( (Srb_id & RAB_OFFSET ) == CCCH) { + LOG_T(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id); + + if(RC.rrc[Mod_idP]->carrier[CC_id].Srb0.Active==0) { + LOG_E(RRC,"[eNB %d] CCCH Not active\n",Mod_idP); + return -1; + } + + Srb_info=&RC.rrc[Mod_idP]->carrier[CC_id].Srb0; + + // check if data is there for MAC + if(Srb_info->Tx_buffer.payload_size>0) { //Fill buffer + LOG_D(RRC,"[eNB %d] CCCH (%p) has %d bytes (dest: %p, src %p)\n",Mod_idP,Srb_info,Srb_info->Tx_buffer.payload_size,buffer_pP,Srb_info->Tx_buffer.Payload); + +#if 0 // defined(ENABLE_ITTI) + { + MessageDef *message_p; + int ccch_size = Srb_info->Tx_buffer.payload_size; + int sdu_size = sizeof(RRC_MAC_CCCH_DATA_REQ (message_p).sdu); + + if (ccch_size > sdu_size) { + LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", ccch_size, sdu_size); + ccch_size = sdu_size; + } + + message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_CCCH_DATA_REQ); + RRC_MAC_CCCH_DATA_REQ (message_p).frame = frameP; + RRC_MAC_CCCH_DATA_REQ (message_p).sdu_size = ccch_size; + memset (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, 0, CCCH_SDU_SIZE); + memcpy (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, Srb_info->Tx_buffer.Payload, ccch_size); + RRC_MAC_CCCH_DATA_REQ (message_p).enb_index = eNB_index; + + itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p); + } +#endif + + memcpy(buffer_pP,Srb_info->Tx_buffer.Payload,Srb_info->Tx_buffer.payload_size); + Sdu_size = Srb_info->Tx_buffer.payload_size; + Srb_info->Tx_buffer.payload_size=0; + } + + return (Sdu_size); + } + + if( (Srb_id & RAB_OFFSET ) == PCCH) { + LOG_T(RRC,"[eNB %d] Frame %d PCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id); + + // check if data is there for MAC + if(RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] > 0) { //Fill buffer + LOG_D(RRC,"[eNB %d] PCCH (%p) has %d bytes\n",Mod_idP,&RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], + RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]); + +#if 0 //defined(ENABLE_ITTI) + { + MessageDef *message_p; + int pcch_size = RC.rrc[Mod_idP]->arrier[CC_id].sizeof_paging[mbsfn_sync_area]; + int sdu_size = sizeof(RRC_MAC_PCCH_DATA_REQ (message_p).sdu); + + if (pcch_size > sdu_size) { + LOG_E(RRC, "SDU larger than PCCH SDU buffer size (%d, %d)", pcch_size, sdu_size); + pcch_size = sdu_size; + } + + message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_PCCH_DATA_REQ); + RRC_MAC_PCCH_DATA_REQ (message_p).frame = frameP; + RRC_MAC_PCCH_DATA_REQ (message_p).sdu_size = pcch_size; + memset (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, 0, PCCH_SDU_SIZE); + memcpy (RRC_MAC_PCCH_DATA_REQ (message_p).sdu, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], pcch_size); + RRC_MAC_PCCH_DATA_REQ (message_p).enb_index = eNB_index; + + itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p); + } +#endif + + memcpy(buffer_pP, RC.rrc[Mod_idP]->carrier[CC_id].paging[mbsfn_sync_area], RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]); + Sdu_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area]; + RC.rrc[Mod_idP]->carrier[CC_id].sizeof_paging[mbsfn_sync_area] = 0; + } + + return (Sdu_size); + } + +#if defined(Rel10) || defined(Rel14) + + if((Srb_id & RAB_OFFSET) == MCCH) { + if(RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESS[mbsfn_sync_area].Active==0) { + return 0; // this parameter is set in function init_mcch in rrc_eNB.c + } + + +#if 0 // defined(ENABLE_ITTI) + { + MessageDef *message_p; + int mcch_size = RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]; + int sdu_size = sizeof(RRC_MAC_MCCH_DATA_REQ (message_p).sdu); + + if (mcch_size > sdu_size) { + LOG_E(RRC, "SDU larger than MCCH SDU buffer size (%d, %d)", mcch_size, sdu_size); + mcch_size = sdu_size; + } + + message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_MCCH_DATA_REQ); + RRC_MAC_MCCH_DATA_REQ (message_p).frame = frameP; + RRC_MAC_MCCH_DATA_REQ (message_p).sdu_size = mcch_size; + memset (RRC_MAC_MCCH_DATA_REQ (message_p).sdu, 0, MCCH_SDU_SIZE); + memcpy (RRC_MAC_MCCH_DATA_REQ (message_p).sdu, + RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area], + mcch_size); + RRC_MAC_MCCH_DATA_REQ (message_p).enb_index = eNB_index; + RRC_MAC_MCCH_DATA_REQ (message_p).mbsfn_sync_area = mbsfn_sync_area; + + itti_send_msg_to_task (TASK_MAC_ENB, ENB_MODULE_ID_TO_INSTANCE(Mod_idP), message_p); + } +#endif + + memcpy(&buffer_pP[0], + RC.rrc[Mod_idP]->carrier[CC_id].MCCH_MESSAGE[mbsfn_sync_area], + RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]); + +#ifdef DEBUG_RRC + LOG_D(RRC,"[eNB %d] Frame %d : MCCH request => MCCH_MESSAGE \n",Mod_idP,frameP); + + for (i=0; icarrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]; i++) { + LOG_T(RRC,"%x.",buffer_pP[i]); + } + + LOG_T(RRC,"\n"); +#endif + + return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area]); + // } + //else + //return(0); + } + +#endif //Rel10 || Rel14 + +#ifdef Rel14 + if ((Srb_id & RAB_OFFSET) == BCCH_SIB1_BR){ + memcpy(&buffer_pP[0], + RC.rrc[Mod_idP]->carrier[CC_id].SIB1_BR, + RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR); + return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB1_BR); + } + + if ((Srb_id & RAB_OFFSET) == BCCH_SI_BR){ // First SI message with SIB2/3 + memcpy(&buffer_pP[0], + RC.rrc[Mod_idP]->carrier[CC_id].SIB23_BR, + RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR); + return (RC.rrc[Mod_idP]->carrier[CC_id].sizeof_SIB23_BR); + } + +#endif + + + return(0); +} + +//------------------------------------------------------------------------------ +int8_t +mac_rrc_data_ind( + const module_id_t module_idP, + const int CC_id, + const frame_t frameP, + const sub_frame_t sub_frameP, + const rnti_t rntiP, + const rb_id_t srb_idP, + const uint8_t* sduP, + const sdu_size_t sdu_lenP, + const uint8_t mbsfn_sync_areaP +) +//-------------------------------------------------------------------------- +{ + SRB_INFO *Srb_info; + protocol_ctxt_t ctxt; + sdu_size_t sdu_size = 0; + + /* for no gcc warnings */ + (void)sdu_size; + + /* + int si_window; + */ + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, module_idP, ENB_FLAG_YES, rntiP, frameP, sub_frameP,0); + + Srb_info = &RC.rrc[module_idP]->carrier[CC_id].Srb0; + LOG_D(RRC,"[eNB %d] Received SDU for CCCH on SRB %d\n",module_idP,Srb_info->Srb_id); + +#if 0 //defined(ENABLE_ITTI) + { + MessageDef *message_p; + int msg_sdu_size = sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu); + + if (sdu_lenP > msg_sdu_size) { + LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_lenP, msg_sdu_size); + sdu_size = msg_sdu_size; + } else { + sdu_size = sdu_lenP; + } + + message_p = itti_alloc_new_message (TASK_MAC_ENB, RRC_MAC_CCCH_DATA_IND); + RRC_MAC_CCCH_DATA_IND (message_p).frame = frameP; + RRC_MAC_CCCH_DATA_IND (message_p).sub_frame = sub_frameP; + RRC_MAC_CCCH_DATA_IND (message_p).rnti = rntiP; + RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size; + RRC_MAC_CCCH_DATA_IND (message_p).CC_id = CC_id; + memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, CCCH_SDU_SIZE); + memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, sduP, sdu_size); + LOG_D(RRC,"[eNB %d] Sending message to RRC task\n",module_idP); + itti_send_msg_to_task (TASK_RRC_ENB, ctxt.instance, message_p); + } +#else + + // msg("\n******INST %d Srb_info %p, Srb_id=%d****\n\n",Mod_id,Srb_info,Srb_info->Srb_id); + if (sdu_lenP > 0) { + memcpy(Srb_info->Rx_buffer.Payload,sduP,sdu_lenP); + Srb_info->Rx_buffer.payload_size = sdu_lenP; + rrc_eNB_decode_ccch(&ctxt, Srb_info, CC_id); + } + +#endif + + return(0); + +} + +//------------------------------------------------------------------------------ +int +mac_eNB_get_rrc_status( + const module_id_t Mod_idP, + const rnti_t rntiP +) +//------------------------------------------------------------------------------ +{ + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + ue_context_p = rrc_eNB_get_ue_context( + RC.rrc[Mod_idP], + rntiP); + + if (ue_context_p != NULL) { + return(ue_context_p->ue_context.Status); + } else { + return RRC_INACTIVE; + } +} + +void mac_eNB_rrc_ul_failure(const module_id_t Mod_instP, + const int CC_idP, + const frame_t frameP, + const sub_frame_t subframeP, + const rnti_t rntiP) +{ + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + ue_context_p = rrc_eNB_get_ue_context( + RC.rrc[Mod_instP], + rntiP); + + if (ue_context_p != NULL) { + LOG_I(RRC,"Frame %d, Subframe %d: UE %x UL failure, activating timer\n",frameP,subframeP,rntiP); + if(ue_context_p->ue_context.ul_failure_timer == 0) + ue_context_p->ue_context.ul_failure_timer=1; + } + else { + LOG_W(RRC,"Frame %d, Subframe %d: UL failure: UE %x unknown \n",frameP,subframeP,rntiP); + } + if (rrc_agent_registered[Mod_instP]) { + agent_rrc_xface[Mod_instP]->flexran_agent_notify_ue_state_change(Mod_instP, + rntiP, + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); + } +// rrc_mac_remove_ue(Mod_instP,rntiP); +} + +void mac_eNB_rrc_uplane_failure(const module_id_t Mod_instP, + const int CC_idP, + const frame_t frameP, + const sub_frame_t subframeP, + const rnti_t rntiP) +{ + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + ue_context_p = rrc_eNB_get_ue_context( + RC.rrc[Mod_instP], + rntiP); + if (ue_context_p != NULL) { + LOG_I(RRC,"Frame %d, Subframe %d: UE %x U-Plane failure, activating timer\n",frameP,subframeP,rntiP); + + if(ue_context_p->ue_context.ul_failure_timer == 0) + ue_context_p->ue_context.ul_failure_timer=19999; + } + else { + LOG_W(RRC,"Frame %d, Subframe %d: U-Plane failure: UE %x unknown \n",frameP,subframeP,rntiP); + } +} + +void mac_eNB_rrc_ul_in_sync(const module_id_t Mod_instP, + const int CC_idP, + const frame_t frameP, + const sub_frame_t subframeP, + const rnti_t rntiP) +{ + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + ue_context_p = rrc_eNB_get_ue_context( + RC.rrc[Mod_instP], + rntiP); + + if (ue_context_p != NULL) { + LOG_I(RRC,"Frame %d, Subframe %d: UE %x to UL in synch\n", + frameP, subframeP, rntiP); + ue_context_p->ue_context.ul_failure_timer = 0; + } else { + LOG_E(RRC,"Frame %d, Subframe %d: UE %x unknown \n", + frameP, subframeP, rntiP); + } +} diff --git a/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-InterNodeDefinitions.asn b/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-InterNodeDefinitions.asn new file mode 100755 index 0000000000..13cbb92584 --- /dev/null +++ b/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-InterNodeDefinitions.asn @@ -0,0 +1,282 @@ +NR-InterNodeDefinitions DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- TAG-HANDOVER-COMMAND-START + +HandoverCommand ::= SEQUENCE { + criticalExtensions CHOICE { + c1 CHOICE{ + handoverCommand HandoverCommand-IEs, + spare3 NULL, spare2 NULL, spare1 NULL + }, + criticalExtensionsFuture SEQUENCE {} + } +} + +HandoverCommand-IEs ::= SEQUENCE { + handoverCommandMessage OCTET STRING (CONTAINING RRCReconfiguration), + nonCriticalExtension SEQUENCE {} OPTIONAL +} + +-- TAG-HANDOVER-COMMAND-STOP +-- TAG-HANDOVER-PREPARATION-INFORMATION-START + +HandoverPreparationInformation ::= SEQUENCE { + criticalExtensions CHOICE { + c1 CHOICE{ + handoverPreparationInformation HandoverPreparationInformation-IEs, + spare3 NULL, spare2 NULL, spare1 NULL + }, + criticalExtensionsFuture SEQUENCE {} + } +} + +HandoverPreparationInformation-IEs ::= SEQUENCE { + ue-CapabilityRAT-List UE-CapabilityRAT-ContainerList, + sourceConfig OCTET STRING (CONTAINING RRCReconfiguration), + rrm-Config RRM-Config OPTIONAL, + as-Context AS-Context OPTIONAL, + nonCriticalExtension SEQUENCE {} OPTIONAL +} + +AS-Context ::= SEQUENCE { + reestablishmentInfo SEQUENCE { + sourcePhysCellId PhysCellId, + targetCellShortMAC-I ShortMAC-I, + additionalReestabInfoList ReestabNCellInfoList OPTIONAL + } OPTIONAL, + -- FFS Whether to change e.g. move all re-establishment info to Xx + configRestrictInfo ConfigRestrictInfoSCG OPTIONAL, + ... +} + +ReestabNCellInfoList ::= SEQUENCE ( SIZE (1..maxCellPrep) ) OF ReestabNCellInfo + +ReestabNCellInfo::= SEQUENCE{ + cellIdentity CellIdentity, + key-gNodeB-Star BIT STRING (SIZE (256)), + shortMAC-I ShortMAC-I +} + +RRM-Config ::= SEQUENCE { + ue-InactiveTime ENUMERATED { + s1, s2, s3, s5, s7, s10, s15, s20, + s25, s30, s40, s50, min1, min1s20c, min1s40, + min2, min2s30, min3, min3s30, min4, min5, min6, + min7, min8, min9, min10, min12, min14, min17, min20, + min24, min28, min33, min38, min44, min50, hr1, + hr1min30, hr2, hr2min30, hr3, hr3min30, hr4, hr5, hr6, + hr8, hr10, hr13, hr16, hr20, day1, day1hr12, day2, + day2hr12, day3, day4, day5, day7, day10, day14, day19, + day24, day30, dayMoreThan30} OPTIONAL , + candidateCellInfoList CandidateCellInfoList OPTIONAL, + ... +} + +-- TAG-HANDOVER-PREPARATION-INFORMATION-STOP +-- TAG-CG-CONFIG-START + +CG-Config ::= SEQUENCE { + criticalExtensions CHOICE { + c1 CHOICE{ + cg-Config CG-Config-IEs, + spare3 NULL, spare2 NULL, spare1 NULL + }, + criticalExtensionsFuture SEQUENCE {} + } +} + +CG-Config-IEs ::= SEQUENCE { + scg-CellGroupConfig OCTET STRING (CONTAINING RRCReconfiguration) OPTIONAL, + scg-RB-Config OCTET STRING (CONTAINING RadioBearerConfig) OPTIONAL, + configRestrictModReq ConfigRestrictModReqSCG OPTIONAL, + drx-InfoSCG DRX-Info OPTIONAL, + candidateCellInfoListSN OCTET STRING (CONTAINING CandidateCellInfoList) OPTIONAL, + measConfigSN MeasConfigSN OPTIONAL, + selectedBandCombinationNR BandCombinationIndex OPTIONAL, + nonCriticalExtension SEQUENCE {} OPTIONAL +} + +MeasConfigSN ::= SEQUENCE { + measuredFrequenciesFR1 SEQUENCE (SIZE (1..maxMeasFreqsMN)) OF NR-FreqInfo OPTIONAL, + ... +} + +NR-FreqInfo ::= SEQUENCE { + measuredFrequency ARFCN-ValueNR OPTIONAL, + ... +} + +ConfigRestrictModReqSCG ::= SEQUENCE { + requestedBC-MRDC BandCombinationIndex OPTIONAL, + requestedBPC-ListMRDC BPC-IndexList OPTIONAL, + requestedP-MaxFR1 P-Max OPTIONAL, + ... +} + +BandCombinationIndex ::= INTEGER (1..maxBandComb) + +-- TAG-CG-CONFIG-STOP +-- TAG-CG-CONFIG-INFO-START + +CG-ConfigInfo ::= SEQUENCE { + criticalExtensions CHOICE { + c1 CHOICE{ + cg-ConfigInfo CG-ConfigInfo-IEs, + spare3 NULL, spare2 NULL, spare1 NULL + }, + criticalExtensionsFuture SEQUENCE {} + } +} + +CG-ConfigInfo-IEs ::= SEQUENCE { + ue-CapabilityInfo OCTET STRING (CONTAINING UE-CapabilityRAT-ContainerList) OPTIONAL,-- Cond SN-Addition + candidateCellInfoListMN CandidateCellInfoList OPTIONAL, + candidateCellInfoListSN OCTET STRING (CONTAINING CandidateCellInfoList) OPTIONAL, + measResultCellListSFTD MeasResultCellListSFTD OPTIONAL, + scgFailureInfo SEQUENCE { + failureType ENUMERATED { t310-Expiry, randomAccessProblem, + rlc-MaxNumRetx, scg-ChangeFailure, + scg-reconfigFailure, + srb3-IntegrityFailure}, + measResultSCG OCTET STRING (CONTAINING MeasResultSCG-Failure) + } OPTIONAL, + configRestrictInfo ConfigRestrictInfoSCG OPTIONAL, + drx-InfoMCG DRX-Info OPTIONAL, + measConfigMN MeasConfigMN OPTIONAL, + sourceConfigSCG OCTET STRING (CONTAINING RRCReconfiguration) OPTIONAL, + scg-RB-Config OCTET STRING (CONTAINING RadioBearerConfig) OPTIONAL, + mcg-RB-Config OCTET STRING (CONTAINING RadioBearerConfig) OPTIONAL, + nonCriticalExtension SEQUENCE {} OPTIONAL +} + +ConfigRestrictInfoSCG ::= SEQUENCE { + allowedBC-ListMRDC BandCombinationIndexList OPTIONAL, + allowedBPC-ListMRDC BPC-IndexList OPTIONAL, + powerCoordination-FR1 SEQUENCE { + p-maxNR P-Max OPTIONAL, + p-maxEUTRA P-Max OPTIONAL + } OPTIONAL, + servCellIndexRangeSCG SEQUENCE { + lowBound ServCellIndex, + upBound ServCellIndex + } OPTIONAL, -- Cond SN-Addition + maxMeasFreqsSCG-NR INTEGER(1..maxMeasFreqsMN) OPTIONAL, + ... +} + +BandCombinationIndexList ::= SEQUENCE (SIZE (1..maxBandComb)) OF BandCombinationIndex + +BPC-IndexList ::= SEQUENCE (SIZE (1..maxBasebandProcComb)) OF BPC-Index +BPC-Index ::= INTEGER (1..maxBasebandProcComb) + +DRX-Info ::= SEQUENCE { + drx-LongCycleStartOffset CHOICE { + ms10 INTEGER(0..9), + ms20 INTEGER(0..19), + ms32 INTEGER(0..31), + ms40 INTEGER(0..39), + ms60 INTEGER(0..59), + ms64 INTEGER(0..63), + ms70 INTEGER(0..69), + ms80 INTEGER(0..79), + ms128 INTEGER(0..127), + ms160 INTEGER(0..159), + ms256 INTEGER(0..255), + ms320 INTEGER(0..319), + ms512 INTEGER(0..511), + ms640 INTEGER(0..639), + ms1024 INTEGER(0..1023), + ms1280 INTEGER(0..1279), + ms2048 INTEGER(0..2047), + ms2560 INTEGER(0..2559), + ms5120 INTEGER(0..5119), + ms10240 INTEGER(0..10239) + }, + shortDRX SEQUENCE { + drx-ShortCycle ENUMERATED { + ms2, ms3, ms4, ms5, ms6, ms7, ms8, ms10, ms14, ms16, ms20, ms30, ms32, + ms35, ms40, ms64, ms80, ms128, ms160, ms256, ms320, ms512, ms640, spare9, + spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 }, + drx-ShortCycleTimer INTEGER (1..16) + } OPTIONAL +} + +MeasConfigMN ::= SEQUENCE { + measuredFrequenciesMN SEQUENCE (SIZE (1..maxMeasFreqsMN)) OF NR-FreqInfo OPTIONAL, + measGapConfigFR1 GapConfig OPTIONAL, + gapPurpose ENUMERATED {perUE, perFR1} OPTIONAL, + ... +} + + +-- TAG-CG-CONFIG-INFO-STOP +-- TAG-MEASUREMENT-TIMING-CONFIGURATION-START + +MeasurementTimingConfiguration ::= SEQUENCE { + criticalExtensions CHOICE { + c1 CHOICE{ + measTimingConf MeasurementTimingConfiguration-IEs, + spare3 NULL, spare2 NULL, spare1 NULL + }, + criticalExtensionsFuture SEQUENCE {} + } +} + +MeasurementTimingConfiguration-IEs ::= SEQUENCE { + measTiming MeasTimingList OPTIONAL, + nonCriticalExtension SEQUENCE {} OPTIONAL +} + +MeasTimingList ::= SEQUENCE (SIZE (1..maxMeasFreqsMN)) OF MeasTiming + +MeasTiming ::= SEQUENCE { + carrierFreq ARFCN-ValueNR OPTIONAL, + ssb-MeasurementTimingConfiguration ENUMERATED {ffsTypeAndValue} OPTIONAL, + ... +} + +-- TAG-MEASUREMENT-TIMING-CONFIGURATION-STOP +-- TAG-CANDIDATE-CELL-INFO-LIST-START + +CandidateCellInfoList ::= SEQUENCE (SIZE (1.. maxNrofSCells)) OF CandidateCellInfo + +CandidateCellInfo ::= SEQUENCE { + cellIdentification SEQUENCE { + physCellId PhysCellId, + dl-CarrierFreq ARFCN-ValueNR + }, + measResultCell MeasQuantityResults OPTIONAL, + candidateRS-IndexListSSB CandidateRS-IndexInfoListSSB OPTIONAL, + candidateRS-IndexListCSI-RS CandidateRS-IndexInfoListCSI-RS OPTIONAL, + ... +} + +CandidateRS-IndexInfoListSSB ::= SEQUENCE (SIZE (1..maxNrofIndexesToReport)) OF CandidateRS-IndexInfoSSB + +CandidateRS-IndexInfoSSB ::= SEQUENCE { + ssb-Index SSB-Index, + measResultSSB MeasQuantityResults OPTIONAL, + ... +} + +CandidateRS-IndexInfoListCSI-RS ::= SEQUENCE (SIZE (1..maxNrofIndexesToReport)) OF CandidateRS-IndexInfoCSI-RS + +CandidateRS-IndexInfoCSI-RS ::= SEQUENCE { + csi-RS-Index CSI-RS-Index, + measResultCSI-RS MeasQuantityResults OPTIONAL, + ... +} + +-- TAG-CANDIDATE-CELL-INFO-LIST-STOP +-- TAG_NR-MULTIPLICITY-AND-CONSTRAINTS-START + +maxMeasFreqsMN INTEGER ::= 32 -- Maximum number of MN-configured measurement frequencies +maxCellPrep INTEGER ::= 32 -- Maximum number of cells prepared for handover + +-- TAG_NR-MULTIPLICITY-AND-CONSTRAINTS-STOP +-- TAG_NR-INTER-NODE-DEFINITIONS-END-START + +END + diff --git a/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-RRC-Definitions.asn b/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-RRC-Definitions.asn new file mode 100755 index 0000000000..84426f50bb --- /dev/null +++ b/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-RRC-Definitions.asn @@ -0,0 +1,5480 @@ +NR-RRC-Definitions DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- TAG-BCCH-BCH-MESSAGE-START + +BCCH-BCH-Message ::= SEQUENCE { + message BCCH-BCH-MessageType +} + +BCCH-BCH-MessageType ::= CHOICE { + mib MIB, + messageClassExtension SEQUENCE {} +} + +-- TAG-BCCH-BCH-MESSAGE-STOP +-- TAG-DL-DCCH-MESSAGE-START + +DL-DCCH-Message ::= SEQUENCE { + message DL-DCCH-MessageType +} + +DL-DCCH-MessageType ::= CHOICE { + c1 CHOICE { + rrcReconfiguration RRCReconfiguration, + spare15 NULL, spare14 NULL, spare13 NULL, + spare12 NULL, spare11 NULL, spare10 NULL, + spare9 NULL, spare8 NULL, spare7 NULL, + spare6 NULL, spare5 NULL, spare4 NULL, + spare3 NULL, spare2 NULL, spare1 NULL + }, + messageClassExtension SEQUENCE {} +} + +-- TAG-DL-DCCH-MESSAGE-STOP +-- TAG-UL-DCCH-MESSAGE-START + +UL-DCCH-Message ::= SEQUENCE { + message UL-DCCH-MessageType +} + +UL-DCCH-MessageType ::= CHOICE { + c1 CHOICE { + measurementReport MeasurementReport, + rrcReconfigurationComplete RRCReconfigurationComplete, + spare14 NULL, spare13 NULL, spare12 NULL, + spare11 NULL, spare10 NULL, spare9 NULL, + spare8 NULL, spare7 NULL, spare6 NULL, + spare5 NULL, spare4 NULL, spare3 NULL, + spare2 NULL, spare1 NULL + }, + messageClassExtension SEQUENCE {} +} + +-- TAG-UL-DCCH-MESSAGE-STOP +-- TAG-MIB-START + +MIB ::= SEQUENCE { + -- The 6 most significant bit (MSB) of the 10 bit System Frame Number. The 4 LSB of the SFN are conveyed in the PBCH transport block + -- as well but outside the MIB. + systemFrameNumber BIT STRING (SIZE (6)), + + -- Subcarrier spacing for SIB1, Msg.2/4 for initial access and broadcast SI-messages. + -- If the UE acquires this MIB on a carrier frequency <6GHz, the values 15 and 30 kHz are applicable. + -- If the UE acquires this MIB on a carrier frequency >6GHz, the values 60 and 120 kHz are applicable. + subCarrierSpacingCommon ENUMERATED {scs15or60, scs30or120}, + + -- The frequency domain offset between SSB and the overall resource block grid in number of subcarriers. (See 38.211, section 7.4.3.1) + -- Note: For frequencies <6 GHz a fith, this field may comprise only the 4 least significant bits of the ssb-SubcarrierOffset. + -- The codepoint "FFS_RAN1" indicates that this cell does not provide SIB1 and that there is hence no common CORESET. + ssb-SubcarrierOffset INTEGER (0..15), + + -- Position of (first) DL DM-RS. Corresponds to L1 parameter 'DL-DMRS-typeA-pos' (see 38.211, section 7.4.1.1.1) + dmrs-TypeA-Position ENUMERATED {pos2, pos3}, + + -- Determines a bandwidth for PDCCH/SIB, a common ControlResourceSet (CORESET) a common search space and necessary PDCCH parameters. + -- Corresponds to L1 parameter 'RMSI-PDCCH-Config' (see FFS_Specification, section FFS_Section) + pdcch-ConfigSIB1 INTEGER (0..255), + + -- Indicates that UE shall not camp on this cell + cellBarred ENUMERATED {barred, notBarred}, + + -- Controls cell reselection to intra-frequency cells when the highest ranked cell is barred, or treated as barred by the UE, + -- as specified in TS 38.304. + intraFreqReselection ENUMERATED {allowed, notAllowed}, + spare BIT STRING (SIZE (1)) +} + +-- TAG-MIB-STOP +-- TAG-MEASUREMENTREPORT-START + +MeasurementReport ::= SEQUENCE { + criticalExtensions CHOICE { + measurementReport MeasurementReport-IEs, + criticalExtensionsFuture SEQUENCE {} + } +} + +MeasurementReport-IEs ::= SEQUENCE { + measResults MeasResults, + + lateNonCriticalExtension OCTET STRING OPTIONAL, + nonCriticalExtension SEQUENCE{} OPTIONAL +} + +-- TAG-MEASUREMENTREPORT-STOP +-- TAG-RRCRECONFIGURATION-START + +RRCReconfiguration ::= SEQUENCE { + rrc-TransactionIdentifier RRC-TransactionIdentifier, + criticalExtensions CHOICE { + rrcReconfiguration RRCReconfiguration-IEs, + criticalExtensionsFuture SEQUENCE {} + } +} + +RRCReconfiguration-IEs ::= SEQUENCE { + -- Configuration of Radio Bearers (DRBs, SRBs) including SDAP/PDCP. + -- In EN-DC this field may only be present if the RRCReconfiguration + -- is transmitted over SRB3. + radioBearerConfig RadioBearerConfig OPTIONAL, -- Need M + + -- Configuration of secondary cell group (EN-DC): + secondaryCellGroup OCTET STRING (CONTAINING CellGroupConfig) OPTIONAL, -- Need M + + measConfig MeasConfig OPTIONAL, -- Need M + + lateNonCriticalExtension OCTET STRING OPTIONAL, + nonCriticalExtension SEQUENCE {} OPTIONAL +} + +-- TAG-RRCRECONFIGURATION-STOP +-- TAG-RRCRECONFIGURATIONCOMPLETE-START + +RRCReconfigurationComplete ::= SEQUENCE { + rrc-TransactionIdentifier RRC-TransactionIdentifier, + criticalExtensions CHOICE { + rrcReconfigurationComplete RRCReconfigurationComplete-IEs, + criticalExtensionsFuture SEQUENCE {} + } +} + +RRCReconfigurationComplete-IEs ::= SEQUENCE { + lateNonCriticalExtension OCTET STRING OPTIONAL, + nonCriticalExtension SEQUENCE {} OPTIONAL +} + +-- TAG-RRCRECONFIGURATIONCOMPLETE-STOP +-- TAG-SIB1-START + +SIB1 ::= SEQUENCE { + + -- FFS / TODO: Add other parameters. + + -- Frequency offset for the SSB of -5kHz (M=-1) or +5kHz (M=1). When the field is absent, the UE applies no offset (M=0). + -- The offset is only applicable for the frequency range 0-2.65GHz. Corresponds to parameter 'M' (see 38.101, section FFS_Section) + frequencyOffsetSSB ENUMERATED {khz-5, khz5} OPTIONAL, -- Need R + + -- Time domain positions of the transmitted SS-blocks in an SS-Burst-Set (see 38.213, section 4.1) + ssb-PositionsInBurst SEQUENCE { + -- Indicates the presence of the up to 8 SSBs in one group + inOneGroup BIT STRING (SIZE (8)), + -- For above 6 GHz: indicates which groups of SSBs is present + groupPresence BIT STRING (SIZE (8)) OPTIONAL -- Cond above6GHzOnly + }, + + -- The SSB periodicity in msec for the rate matching purpose (see 38.211, section [7.4.3.1]) + ssb-PeriodicityServingCell ENUMERATED {ms5, ms10, ms20, ms40, ms80, ms160, spare1, spare2}, + + -- TX power that the NW used for SSB transmission. The UE uses it to estimate the RA preamble TX power. + -- (see 38.213, section 7.4) + ss-PBCH-BlockPower INTEGER (-60..50), + + uplinkConfigCommon UplinkConfigCommon OPTIONAL, + -- FFS: How to indicate the FrequencyInfoUL for the SUL + supplementaryUplink SEQUENCE { + uplinkConfigCommon UplinkConfigCommon OPTIONAL + -- FFS: Add additional (selection) criteria determining when/whether the UE shall use the SUL frequency + } OPTIONAL, -- Cond SUL + + tdd-UL-DL-Configuration TDD-UL-DL-ConfigCommon OPTIONAL, -- Cond TDD + tdd-UL-DL-configurationCommon2 TDD-UL-DL-ConfigCommon OPTIONAL, -- Cond TDD + + pdcch-ConfigCommon PDCCH-ConfigCommon OPTIONAL, + pucch-ConfigCommon PUCCH-ConfigCommon OPTIONAL, + + lateNonCriticalExtension OCTET STRING OPTIONAL, + nonCriticalExtension SEQUENCE{} OPTIONAL +} + +-- TAG-SIB1-STOP +-- TAG-SETUP-RELEASE-START + +SetupRelease { ElementTypeParam } ::= CHOICE { + release NULL, + setup ElementTypeParam +} + +-- TAG-SETUP-RELEASE-STOP +-- TAG-ADDITIONALSPECTRUMEMISSION-START + +AdditionalSpectrumEmission ::= INTEGER (0..7) + +-- TAG-ADDITIONALSPECTRUMEMISSION-STOP +-- TAG-ALPHA-START + +Alpha ::= ENUMERATED {alpha0, alpha04, alpha05, alpha06, alpha07, alpha08, alpha09, alpha1} + +-- TAG-ALPHA-STOP +-- TAG-ARFCN-VALUE-NR-START + +ARFCN-ValueNR ::= INTEGER (0..3279165) + +-- TAG-ARFCN-VALUE-NR-STOP +-- TAG-BANDWIDTH-PART-START + + +-- Generic parameters used in Uplink- and Downlink bandwidth parts +BWP ::= SEQUENCE { + -- Frequency domain location and bandwidth of this bandwidth part defined commonly in a table (FFS_Section). The location is given as + -- distance (in number of PRBs) to point A (absoluteFrequencyPointA in FrequencyInfoDL). + -- Corresponds to L1 parameter 'DL-BWP-loc'. (see 38.211, section FFS_Section). + -- In case of TDD, a BWP-pair (UL BWP and DL BWP with the same bwp-Id) must have the same location (see 38.211, section REF) + locationAndBandwidth INTEGER (0..37949), + -- Subcarrier spacing to be used in this BWP for all channels and + -- reference signals unless explicitly configured elsewhere. + -- Corresponds to subcarrier spacing according to 38.211, Table 4.2-1. + -- The value kHz15 corresponds to µ=0, kHz30 to µ=1, and so on. Only the values 15 or 30 kHz (<6GHz), 60 or 120 kHz (>6GHz) are + -- applicable. + subcarrierSpacing SubcarrierSpacing, + -- Indicates whether to use the extended cyclic prefix for this bandwidth part. If not set, the UE uses the normal cyclic prefix. + -- Normal CP is supported for all numerologies and slot formats. Extended CP is supported only for 60 kHz subcarrier spacing. + -- (see 38.211, section 4.2.2) + cyclicPrefix ENUMERATED { extended } OPTIONAL -- Need R +} + +BWP-Uplink ::= SEQUENCE { + -- An identifier for this bandwidth part. Other parts of the RRC configuration use the BWP-Id to associate themselves with a particular + -- bandwidth part. The BWP ID=0 is always associated with the initial BWP and may hence not be used here (in other bandwidth parts). + -- The NW may trigger the UE to swtich UL or DL BWP using a DCI field. The four code points in that DCI field map to the RRC-configured + -- BWP-ID as follows: For up to 3 configured BWPs (in addition to the initial BWP) the DCI code point is equivalent to the BWP ID + -- (initial = 0, first dedicated = 1, ...). If the NW configures 4 dedicated bandwidth parts, they are identified by DCI code + -- points 0 to 3. In this case it is not possible to switch to the initial BWP using the DCI field. + -- Corresponds to L1 parameter 'UL-BWP-index'. (see 38.211, 38.213, section 12) + bwp-Id BWP-Id, + bwp-Common BWP-UplinkCommon OPTIONAL, -- Need M + bwp-Dedicated BWP-UplinkDedicated OPTIONAL, -- Need M + ... +} + +BWP-UplinkCommon ::= SEQUENCE { + genericParameters BWP, + -- Configuration of cell specific random access parameters which the UE uses for contention based and contention free random access + -- as well as for contention based beam failure recovery. + rach-ConfigCommon SetupRelease { RACH-ConfigCommon } OPTIONAL, -- Need M + -- Cell specific parameters for the PUSCH + pusch-ConfigCommon SetupRelease { PUSCH-ConfigCommon } OPTIONAL, -- Need M + + -- Cell specific parameters for the PUCCH + pucch-ConfigCommon SetupRelease { PUCCH-ConfigCommon } OPTIONAL, -- Need M + ... +} + +BWP-UplinkDedicated ::= SEQUENCE { + -- PUCCH configuration for one BWP of the regular UL or SUL of a serving cell. If the UE is configured with SUL, the network + -- configures PUCCH only on the BWPs of one of the uplinks (UL or SUL). + pucch-Config SetupRelease { PUCCH-Config } OPTIONAL, -- Need M + -- PUSCH configuration for one BWP of the regular UL or SUL of a serving cell. If the UE is configured with SUL and + -- if it has a PUSCH-Config for both UL and SUL, a carrier indicator field in DCI indicates for which of the two to use an UL grant. + -- See also L1 parameter 'dynamicPUSCHSUL' (see 38.213, section FFS_Section) + pusch-Config SetupRelease { PUSCH-Config } OPTIONAL, -- Need M + -- A Configured-Grant of typ1 or type2. It may be configured for Ul or SUL but in case of type1 [FFS also type2] not for both at a time. + configuredGrantConfig SetupRelease { ConfiguredGrantConfig } OPTIONAL, -- Need M + -- Uplink sounding reference signal configuration + srs-Config SetupRelease { SRS-Config } OPTIONAL, -- Need M + -- Determines how the UE performs Beam Failure Recovery upon detection of a Beam Failure (see RadioLinkMonitoringConfig) + beamFailureRecoveryConfig SetupRelease { BeamFailureRecoveryConfig } OPTIONAL, -- Need M + ... +} + + +BWP-Downlink ::= SEQUENCE { + -- An identifier for this bandwidth part. Other parts of the RRC configuration use the BWP-Id to associate themselves with a particular + -- bandwidth part. The BWP ID=0 is always associated with the initial BWP and may hence not be used here. (in other bandwidth parts). + -- The NW may trigger the UE to swtich UL or DL BWP using a DCI field. The four code points in that DCI field map to the RRC-configured + -- BWP-ID as follows: For up to 3 configured BWPs (in addition to the initial BWP) the DCI code point is equivalent to the BWP ID + -- (initial = 0, first dedicated = 1, ...). If the NW configures 4 dedicated bandwidth parts, they are identified by DCI code + -- points 0 to 3. In this case it is not possible to switch to the initial BWP using the DCI field. + -- Corresponds to L1 parameter 'DL-BWP-index'. (see 38.211, 38.213, section 12) + bwp-Id BWP-Id, + bwp-Common BWP-DownlinkCommon OPTIONAL, -- Need M + bwp-Dedicated BWP-DownlinkDedicated OPTIONAL, -- Need M + ... +} + + +BWP-DownlinkCommon ::= SEQUENCE { + genericParameters BWP, + pdcch-ConfigCommon SetupRelease { PDCCH-ConfigCommon } OPTIONAL, -- Need M + pdsch-ConfigCommon SetupRelease { PDSCH-ConfigCommon } OPTIONAL, -- Need M + ... +} + +BWP-DownlinkDedicated ::= SEQUENCE { + pdcch-Config SetupRelease { PDCCH-Config } OPTIONAL, -- Need M + pdsch-Config SetupRelease { PDSCH-Config } OPTIONAL, -- Need M + sps-Config SetupRelease { SPS-Config } OPTIONAL, -- Need M + radioLinkMonitoringConfig SetupRelease { RadioLinkMonitoringConfig } OPTIONAL, -- Need M + ... +} + + +-- TAG-BANDWIDTH-PART-STOP +-- TAG-BWP-ID-START + +BWP-Id ::= INTEGER (0..maxNrofBWPs) + +-- TAG-BWP-ID-STOP +-- TAG-BEAM-FAILURE-RECOVERY-CONFIG-START + +BeamFailureRecoveryConfig ::= SEQUENCE { + rootSequenceIndex-BFR INTEGER (0..137) OPTIONAL, -- Need M + -- Configuration of contention free random access occasions for BFR + rach-ConfigBFR RACH-ConfigGeneric OPTIONAL, -- Need M + -- L1-RSRP threshold used for determining whether a candidate beam may be used by the UE to attempt contention free + -- Random Access to recover from beam failure. The signalled threshold is applied directly for SSB, a threshold for + -- CSI-RS is determined by linearly scaling singalled value based on Pc_ss corresponding to the CSI-RS resource. + -- (see FFS_Specification, FFS_Section) + candidateBeamThreshold RSRP-Range OPTIONAL, -- Need M + -- A list of reference signals (CSI-RS and/or SSB) identifying the candidate beams for recover and the associated RA parameters + candidateBeamRSList SEQUENCE (SIZE(1..maxNrofCandidateBeams)) OF PRACH-ResourceDedicatedBFR OPTIONAL, -- Need M + -- Explicitly signalled PRACH Mask Index for RA Resource selection in TS 36.321. The mask is valid for all SSB resources + ra-ssb-OccasionMaskIndex INTEGER (0..15) OPTIONAL, -- Need M + -- Control Resource Set that the UE uses to receive the random access response for beam failure recovery. + -- If the field is absent the UE uses the initial CORESET (ControlResourceSetId = 0) + recoveryControlResourceSetId ControlResourceSetId OPTIONAL , -- Need S + -- Search space to use for BFR RAR. If the field is absent, the UE uses the initial Serach Space (SearchSpaceId = 0). + recoverySearchSpaceId SearchSpaceId OPTIONAL, -- Need S + ... +} + +PRACH-ResourceDedicatedBFR ::= CHOICE { + ssb BFR-SSB-Resource, + csi-RS BFR-CSIRS-Resource +} + +BFR-SSB-Resource ::= SEQUENCE { + -- The ID of an SSB transmitted by this serving cell. It determines a candidate beam for beam failure recovery (BFR) + ssb SSB-Index, + -- The preamble index that the UE shall use when performing BFR upon selecting the candidate beams identified by this SSB. + ra-PreambleIndex INTEGER (0..63), + ... +} + +BFR-CSIRS-Resource ::= SEQUENCE { + -- The ID of a NZP-CSI-RS-Resource configured in the CSI-MeasConfig of this serving cell. This reference signal determines a candidate beam + -- for beam failure recovery (BFR). + csi-RS NZP-CSI-RS-ResourceId, + -- RA occasions that the UE shall use when performing BFR upon selecting the candidate beam identified by this CSI-RS. If the field is absent + -- the UE uses the RA occasion associated with the SSB that is QCLed with this CSI-RS. + -- The RA preamble index to use in the RA occasions associated with this CSI-RS. If the field is absent, the UE uses the preamble index + -- associated with the SSB that is QCLed with this CSI-RS. + ra-PreambleIndex INTEGER (0..63) OPTIONAL, -- Need R + ... +} + +-- TAG-BEAM-FAILURE-RECOVERY-CONFIG-STOP +-- TAG-CELL-GROUP-CONFIG-START + +-- Configuration of one Cell-Group: +CellGroupConfig ::= SEQUENCE { + cellGroupId CellGroupId, + + -- Logical Channel configuration and association with radio bearers: + rlc-BearerToAddModList SEQUENCE (SIZE(1..maxLC-ID)) OF RLC-Bearer-Config OPTIONAL, -- Need N + rlc-BearerToReleaseList SEQUENCE (SIZE(1..maxLC-ID)) OF LogicalChannelIdentity OPTIONAL, -- Need N + + -- Parameters applicable for the entire cell group: + mac-CellGroupConfig MAC-CellGroupConfig OPTIONAL, -- Need M + physicalCellGroupConfig PhysicalCellGroupConfig OPTIONAL, -- Need M + + -- Serving Cell specific parameters (SpCell and SCells) + spCellConfig SpCellConfig OPTIONAL, -- Need M + sCellToAddModList SEQUENCE (SIZE (1..maxNrofSCells)) OF SCellConfig OPTIONAL, -- Need N + -- List of seconary serving cells to be released (not applicable for SpCells) + sCellToReleaseList SEQUENCE (SIZE (1..maxNrofSCells)) OF SCellIndex OPTIONAL, -- Need N + ... +} + +-- The ID of a cell group. 0 identifies the master cell group. Other values identify secondary cell groups. +-- In this version of the specification only values 0 and 1 are supported. +-- FFS: This should be moved to be own IE section +CellGroupId ::= INTEGER (0.. maxSecondaryCellGroups) + + +RLC-Bearer-Config ::= SEQUENCE { + -- ID used commonly for the MAC logical channel and for the RLC bearer. + logicalChannelIdentity LogicalChannelIdentity, + + -- Associates the RLC Bearer with an SRB or a DRB. The UE shall deliver DL RLC SDUs received via the RLC entity of this + -- RLC bearer to the PDCP entity of the servedRadioBearer. Furthermore, the UE shall advertise and deliver uplink PDCP PDUs of the + -- uplink PDCP entity of the servedRadioBearer to the uplink RLC entity of this RLC bearer unless the uplink scheduling + -- restrictions ('moreThanOneRLC' in PDCP-Config and the restrictions in LogicalChannelConfig) forbid it to do so. + servedRadioBearer CHOICE { + srb-Identity SRB-Identity, + drb-Identity DRB-Identity + } OPTIONAL, -- Cond LCH-SetupOnly + + reestablishRLC ENUMERATED {true} OPTIONAL, -- Need N + rlc-Config RLC-Config OPTIONAL, -- Cond LCH-Setup + + mac-LogicalChannelConfig LogicalChannelConfig OPTIONAL, -- Cond LCH-Setup + ... +} + +LogicalChannelIdentity ::= INTEGER (1..maxLC-ID) + +-- Cell-Group specific L1 parameters +PhysicalCellGroupConfig ::= SEQUENCE { + -- Enables spatial bundling of HARQ ACKs. It is configured per cell group (i.e. for all the cells within the cell group) for PUCCH + -- reporting of HARQ-ACK. It is only applicable when more than 4 layers are possible to schedule. + -- Corresponds to L1 parameter 'HARQ-ACK-spatial-bundling' (see 38.213, section FFS_Section) + -- Absence indicates that spatial bundling is disabled. + harq-ACK-SpatialBundlingPUCCH ENUMERATED {true} OPTIONAL, -- Need R + + -- Enables spatial bundling of HARQ ACKs. It is configured per cell group (i.e. for all the cells within the cell group) for PUSCH + -- reporting of HARQ-ACK. It is only applicable when more than 4 layers are possible to schedule. + -- Corresponds to L1 parameter 'HARQ-ACK-spatial-bundling' (see 38.213, section FFS_Section) + -- Absence indicates that spatial bundling is disabled. + harq-ACK-SpatialBundlingPUSCH ENUMERATED {true} OPTIONAL, -- Need R + -- The maximum transmit power to be used by the UE in this NR cell group. + p-NR P-Max OPTIONAL, -- Need R + -- The PDSCH HARQ-ACK codebook is either semi-static of dynamic. This is applicable to both CA and none CA operation. + -- Corresponds to L1 parameter 'HARQ-ACK-codebook' (see 38.213, section FFS_Section) + pdsch-HARQ-ACK-Codebook ENUMERATED {semiStatic, dynamic}, + -- RNTI used for SRS TPC commands on DCI. Corresponds to L1 parameter 'TPC-SRS-RNTI' (see 38.213, section 10) + tpc-SRS-RNTI RNTI-Value OPTIONAL, -- Need R + -- RNTI used for PUCCH TPC commands on DCI. Corresponds to L1 parameter 'TPC-PUCCH-RNTI' (see 38.213, section 10). + tpc-PUCCH-RNTI RNTI-Value OPTIONAL, -- Need R + -- RNTI used for PUSCH TPC commands on DCI. Corresponds to L1 parameter 'TPC-PUSCH-RNTI' (see 38.213, section 10) + tpc-PUSCH-RNTI RNTI-Value OPTIONAL,-- Need R + ... +} + + +-- Serving cell specific MAC and PHY parameters for a SpCell: +SpCellConfig ::= SEQUENCE { + -- Serving cell ID of a PSCell (the PCell of the Master Cell Group uses ID = 0) + servCellIndex ServCellIndex OPTIONAL, -- Cond SCG + -- Parameters for the synchronous reconfiguration to the target SpCell: + reconfigurationWithSync ReconfigurationWithSync OPTIONAL, -- Cond ReconfWithSync + rlf-TimersAndConstants SetupRelease { RLF-TimersAndConstants } OPTIONAL, -- Need M + rlmInSyncOutOfSyncThreshold INTEGER (0..1) OPTIONAL, -- Need M + spCellConfigDedicated ServingCellConfig OPTIONAL, -- Need M + ... +} + +ReconfigurationWithSync ::= SEQUENCE { + spCellConfigCommon ServingCellConfigCommon OPTIONAL, -- Need M + newUE-Identity RNTI-Value, + t304 ENUMERATED {ms50, ms100, ms150, ms200, ms500, ms1000, ms2000, ms10000}, + rach-ConfigDedicated CHOICE { + uplink RACH-ConfigDedicated, + supplementaryUplink RACH-ConfigDedicated + } OPTIONAL, -- Need N + ... +} + +SCellConfig ::= SEQUENCE { + sCellIndex SCellIndex, + sCellConfigCommon ServingCellConfigCommon OPTIONAL, -- Cond SCellAdd + sCellConfigDedicated ServingCellConfig OPTIONAL, -- Cond SCellAddMod + ... +} + +-- TAG-CELL-GROUP-CONFIG-STOP +-- TAG-CODEBOOKCONFIG-START +CodebookConfig ::= SEQUENCE { + -- CodebookType including possibly sub-types and the corresponding parameters for each. Corresponds to L1 parameter 'CodebookType' + -- (see 38.214, section 5.2.2.2) + codebookType CHOICE { + type1 SEQUENCE { + subType CHOICE { + typeI-SinglePanel SEQUENCE { + nrOfAntennaPorts CHOICE { + two SEQUENCE { + -- Codebook subset restriction for 2TX codebook + -- Corresponds to L1 parameter ' TypeI-SinglePanel-2Tx-CodebookSubsetRestriction' (see 38.214 section 5.2.2.2.1) + twoTX-CodebookSubsetRestriction BIT STRING (SIZE (6)) + }, + moreThanTwo SEQUENCE { + -- Number of antenna ports in first (n1) and second (n2) dimension and codebook subset restriction + -- Corresponds to L1 parameters 'CodebookConfig-N1', 'CodebookConfig-N2' + -- 'TypeI-SinglePanel-CodebookSubsetRestriction ' (see 38.214 section 5.2.2.2.1) + n1-n2 CHOICE { + two-one-TypeI-SinglePanel-Restriction BIT STRING (SIZE (8)), + two-two-TypeI-SinglePanel-Restriction BIT STRING (SIZE (64)), + four-one-TypeI-SinglePanel-Restriction BIT STRING (SIZE (16)), + three-two-TypeI-SinglePanel-Restriction BIT STRING (SIZE (96)), + six-one-TypeI-SinglePanel-Restriction BIT STRING (SIZE (24)), + four-two-TypeI-SinglePanel-Restriction BIT STRING (SIZE (128)), + eight-one-TypeI-SinglePanel-Restriction BIT STRING (SIZE (32)), + four-three-TypeI-SinglePanel-Restriction BIT STRING (SIZE (192)), + six-two-TypeI-SinglePanel-Restriction BIT STRING (SIZE (192)), + twelve-one-TypeI-SinglePanel-Restriction BIT STRING (SIZE (48)), + four-four-TypeI-SinglePanel-Restriction BIT STRING (SIZE (256)), + eight-two-TypeI-SinglePanel-Restriction BIT STRING (SIZE (256)), + sixteen-one-TypeI-SinglePanel-Restriction BIT STRING (SIZE (64)) + }, + -- i2 codebook subset restriction for Type I Single-panel codebook used when reportQuantity is CRI/Ri/i1/CQI + -- Corresponds to L1 parameter 'TypeI-SinglePanel-CodebookSubsetRestriction-i2' (see 38.214 section 5.2.2.2.1) + typeI-SinglePanel-codebookSubsetRestriction-i2 BIT STRING (SIZE (16)) OPTIONAL + } + }, + -- Restriction for RI for TypeI-SinglePanel-RI-Restriction + -- Corresponds to L1 parameter 'TypeI-SinglePanel-RI-Restriction' (see 38.214, section 5.2.2.2.1) + typeI-SinglePanel-ri-Restriction BIT STRING (SIZE (8)) + }, + typeI-MultiPanel SEQUENCE { + -- Codebook subset restriction for Type I Multi-panel codebook + -- Corresponds to L1 parameter 'TypeI-MultiPanel-CodebookSubsetRestriction' (see 38.214, section 5.2.2.2.2) + ng-n1-n2 CHOICE { + two-two-one-TypeI-MultiPanel-Restriction BIT STRING (SIZE (8)), + two-four-one-TypeI-MultiPanel-Restriction BIT STRING (SIZE (32)), + four-two-one-TypeI-MultiPanel-Restriction BIT STRING (SIZE (32)), + two-two-two-TypeI-MultiPanel-Restriction BIT STRING (SIZE (128)), + two-eight-one-TypeI-MultiPanel-Restriction BIT STRING (SIZE (64)), + four-four-one-TypeI-MultiPanel-Restriction BIT STRING (SIZE (64)), + two-four-two-TypeI-MultiPanel-Restriction BIT STRING (SIZE (256)), + four-two-two-TypeI-MultiPanel-Restriction BIT STRING (SIZE (256)) + }, + -- Restriction for RI for TypeI-MultiPanel-RI-Restriction + -- Corresponds to L1 parameter 'TypeI-MultiPanel-RI-Restriction' (see 38.214, section 5.2.2.2.2) + ri-Restriction BIT STRING (SIZE (4)) + } + }, + -- CodebookMode as specified in 38.214 section 5.2.2.2.2 + codebookMode INTEGER (1..2) + + }, + type2 SEQUENCE { + subType CHOICE { + typeII SEQUENCE { + -- Number of antenna ports in first (n1) and second (n2) dimension and codebook subset restriction + -- Corresponds to L1 parameters 'CodebookConfig-N1', 'CodebookConfig-N2' + -- The CHOICE name indicates the value of n1 and n2, the CHOICE contents is the codebook subset restriction bitmap + -- Corresponds to L1 parameter ' TypeII-CodebookSubsetRestriction' (see 38.214 section 5.2.2.2.3) + -- Number of bits for codebook subset restriction is ceil(log2(nchoosek(O1*O2,4)))+8*n1*n2 where nchoosek(a,b) = a!/(b!(a-b)!) + n1-n2-codebookSubsetRestriction CHOICE { + two-one BIT STRING (SIZE (16)), + two-two BIT STRING (SIZE (139)), + four-one BIT STRING (SIZE (32)), + three-two BIT STRING (SIZE (59)), + six-one BIT STRING (SIZE (49)), + four-two BIT STRING (SIZE (75)), + eight-one BIT STRING (SIZE (65)), + four-three BIT STRING (SIZE (107)), + six-two BIT STRING (SIZE (107)), + twelve-one BIT STRING (SIZE (129)), + four-four BIT STRING (SIZE (139)), + eight-two BIT STRING (SIZE (139)), + sixteen-one BIT STRING (SIZE (129)) + }, + -- Restriction for RI for TypeII-RI-Restriction + -- Corresponds to L1 parameter 'TypeII-RI-Restriction' (see 38.214, section 5.2.2.2.3) + typeII-RI-Restriction BIT STRING (SIZE (2)) + }, + typeII-PortSelection SEQUENCE { + -- The size of the port selection codebook (parameter d) + portSelectionSamplingSize ENUMERATED {n1, n2, n3, n4} OPTIONAL, -- Cond TypeII-PortSelection + -- Restriction for RI for TypeII-PortSelection-RI-Restriction + -- Corresponds to L1 parameter 'TypeII-PortSelection-RI-Restriction' (see 38.214, section 5.2.2.4) + typeII-PortSelectionRI-Restriction BIT STRING (SIZE (2)) + } + }, + -- The size of the PSK alphabet, QPSK or 8-PSK + phaseAlphabetSize ENUMERATED {n4, n8}, + -- If subband amplitude reporting is activated (true) + subbandAmplitude BOOLEAN, + -- Number of beams, L, used for linear combination + numberOfBeams ENUMERATED {two, three, four} + } + } +} + +-- TAG-CODEBOOKCONFIG-STOP +-- TAG-CONFIGUREDGRANTCONFIG-START + +ConfiguredGrantConfig ::= SEQUENCE { + + -- Frequency hopping as agreed in RAN1-AH18776 + frequencyHopping ENUMERATED {mode1, mode2}, + -- DMRS configuration, as agreed in RAN1-AH18776 + cg-DMRS-Configuration DMRS-UplinkConfig, + + -- Indicates the MCS table the UE shall use for PUSCH without transform precoding, as agreed in RAN1-AH18776 + mcs-Table ENUMERATED {qam64, qam256}, + -- Indicates the MCS table the UE shall use for PUSCH with transform precoding, as agreed in RAN1-AH18776 + -- When the field is absent the UE applies the value 64QAM + mcs-TableTransformPrecoder ENUMERATED {qam256} OPTIONAL, -- Need S + -- Selection between and configuration of dynamic and semi-static beta-offset, as agreed in RAN1-AH18776 + -- Note: For Type 1 UL data transmission without grant, "uci-on-PUSCH" should be set to semiStatic + uci-OnPUSCH SetupRelease { CG-UCI-OnPUSCH }, + -- Configuration of resource allocation type 0 and resource allocation type 1, as agreed in RAN1-AH18776 + -- Note: For Type 1 UL data transmission without grant, "resourceAllocation" should be resourceAllocationType0 or resourceAllocationType1 + resourceAllocation ENUMERATED { resourceAllocationType0, resourceAllocationType1, dynamicSwitch }, + -- Selection between config 1 and config 2 for RBG size for PUSCH. When the field is absent the UE applies the value config1. + -- Note: rbg-Size is used when the transformPrecoder parameter is disabled. + rbg-Size ENUMERATED {config2} OPTIONAL, -- Need S + + -- Closed control loop to apply. Corresponds to L1 parameter 'PUSCH-closed-loop-index' (see 38.213, section FFS_Section) + powerControlLoopToUse ENUMERATED {n0, n1}, + -- Index of the P0-PUSCH-AlphaSet to be used for this configuration + p0-PUSCH-Alpha P0-PUSCH-AlphaSetId, + -- Enable transformer precoder for type1 and type2. Absence indicates that it is disabled. + -- Corresponds to L1 parameter 'UL-TWG-tp' (see 38.214, section 6.1.3) + transformPrecoder ENUMERATED {enabled} OPTIONAL, -- Need R + -- The number of HARQ processes configured. It applies for both Type 1 and Type 2 + -- Corresponds to L1 parameter 'UL-TWG-numbHARQproc' (see 38.321, section 5.8.2) + nrofHARQ-Processes INTEGER(1..16), + -- The number or repetitions of K: + repK ENUMERATED {n1, n2, n4, n8}, + -- If repetitions is used, this field indicates the redundancy version (RV) sequence to use. + -- Corresponds to L1 parameter 'UL-TWG-RV-rep' (see 38.321, section 5.8.2) + repK-RV ENUMERATED {s1-0231, s2-0303, s3-0000} OPTIONAL, -- Cond RepK + -- Periodicity for UL transmission without UL grant for type 1 and type 2 + -- Corresponds to L1 parameter 'UL-TWG-periodicity' (see 38.321, section 5.8.2) + + -- The following periodicities are supported depending on the configured subcarrier spacing [symbols]: + -- 15kHz: 2, 7, n*14, where n={1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 320, 640} + -- 30kHz: 2, 7, n*14, where n={1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 256, 320, 640, 1280} + -- 60kHz with normal CP: 2, 7, n*14, where n={1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 256, 320, 512, 640, 1280, 2560} + -- 60kHz with ECP: 2, 6, n*12, where n={1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 256, 320, 512, 640, 1280, 2560} + -- 120kHz: 2, 7, n*14, where n={1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 256, 320, 512, 640, 1024, 1280, 2560, 5120} + -- (see 38.214, Table 6.1.2.3-1) + periodicity ENUMERATED { + sym2, sym7, sym1x14, sym2x14, sym4x14, sym5x14, sym8x14, sym10x14, sym16x14, sym20x14, + sym32x14, sym40x14, sym64x14, sym80x14, sym128x14, sym160x14, sym256x14, sym320x14, sym512x14, + sym640x14, sym1024x14, sym1280x14, sym2560x14, sym5120x14, + + sym6, sym1x12, sym2x12, sym4x12, sym5x12, sym8x12, sym10x12, sym16x12, sym20x12, sym32x12, + sym40x12, sym64x12, sym80x12, sym128x12, sym160x12, sym256x12, sym320x12, sym512x12, sym640x12, + sym1280x12, sym2560x12 + }, + + -- If configured, the UE uses the configured grant timer (see 38.321, section 5.8.2) with this initial timer value. + -- Supported values are as follows in units of symbols: + -- For normal CP: 2, 7, {1, 2, 4, 5, 8, 10, 20, 32, 40, 64, 80, 128, 160, 256, 512, 640 } x 14 + -- For extended CP: 2, 6, {1, 2, 4, 8, 20, 40, 80, 128, 160, 256, 320, 512, 640 } x 12 + configuredGrantTimer ENUMERATED { + sym2, sym7, sym1x14, sym2x14, sym4x14, sym5x14, sym8x14, sym10x14, sym16x14, sym20x14, sym32x14, + sym40x14, sym64x14, sym80x14, sym128x14, sym160x14, sym256x14, sym512x14, sym640x14, + + sym6, sym1x12, sym2x12, sym4x12, sym5x12, sym8x12, sym10x12, sym16x12, sym20x12, sym32x12, + sym40x12, sym64x12, sym80x12, sym128x12, sym256x12, sym320x12, sym512x12, sym640x12 + } OPTIONAL, -- Need R + -- Selection between "configured grant" transmission with fully RRC-configured UL grant (Type1) + -- or with UL grant configured by DCI addressed to CS-RNTI (Type2). + rrc-ConfiguredUplinkGrant SEQUENCE { + -- Offset related to SFN=0 + timeDomainOffset INTEGER (0..5119), + -- Corresponding to the DCI field of time domain resource assignment, and the maximum bit width is 4. + --(see 38.214, section 6.1.2 and 38.212, section 7.3.1) + timeDomainAllocation INTEGER (0..15), -- RAN1 indicated just "Mapping-type,Index-start-len" + -- Corresponding to the DCI field of freq domain resource assignment. + -- (see 38.214, section 6.1.2, and 38.212, section 7.3.1) + frequencyDomainAllocation BIT STRING (SIZE(18)), + -- UE-specific DMRS configuration: corresponding to the DCI field of antenna ports, and the maximum bitwidth is 5. + -- (see 38.214, section 6.1.2, and 38.212, section 7.3.1) + antennaPort INTEGER (0..31), + dmrs-SeqInitialization INTEGER (0..1) OPTIONAL, -- Cond NoTransformPrecoder + precodingAndNumberOfLayers INTEGER (0..63), + srs-ResourceIndicator INTEGER (0..15), + -- The modulation order, target code rate and TB size (see 38.214, section 6.1.2) + mcsAndTBS INTEGER (0..31), + -- Enables intra-slot frequency hopping with the given frequency hopping offset + -- Corresponds to L1 parameter 'UL-TWG-hopping' (see 38.214, section FFS_Section) + + frequencyHoppingOffset INTEGER (1.. maxNrofPhysicalResourceBlocks-1), + pathlossReferenceIndex INTEGER (0..maxNrofPUSCH-PathlossReferenceRSs-1), + ... + } OPTIONAL -- Cond Type1 +} + +CG-UCI-OnPUSCH ::= CHOICE { + dynamic SEQUENCE (SIZE (1..4)) OF BetaOffsets, + semiStatic BetaOffsets +} + +-- TAG-CONFIGUREDGRANTCONFIG-STOP +-- TAG-CONTROLRESOURCESET-START + +ControlResourceSet ::= SEQUENCE { + -- Corresponds to L1 parameter 'CORESET-ID' + -- Value 0 identifies the common CORESET configured in MIB and in ServingCellConfigCommon + -- Values 1..maxNrofControlResourceSets-1 identify CORESETs configured by dedicated signalling + -- The controlResourceSetId is unique among the BWPs of a ServingCell. + controlResourceSetId ControlResourceSetId, + + + -- Frequency domain resources for the CORESET. Each bit corresponds a group of 6 RBs, with grouping starting from PRB 0, which is fully + -- contained in the bandwidth part within which the CORESET is configured. + -- The most significant bit corresponds to the group of lowest frequency which is fully contained in the bandwidth part within which the + -- CORESET is configured, each next subsequent lower significance bit corresponds to the next lowest frequency group fully contained within + -- the bandwidth part within which the CORESET is configured, if any. + -- Bits corresponding to a group not fully contained within the bandwidth part within which the CORESET is configured are set to zero. + -- Corresponds to L1 parameter 'CORESET-freq-dom'(see 38.211, section 7.3.2.2) + frequencyDomainResources BIT STRING (SIZE (45)), + -- Contiguous time duration of the CORESET in number of symbols + -- Corresponds to L1 parameter 'CORESET-time-duration' (see 38.211, section 7.3.2.2FFS_Section) + duration INTEGER (1..maxCoReSetDuration), + -- Mapping of Control Channel Elements (CCE) to Resource Element Groups (REG). + -- Corresponds to L1 parameter 'CORESET-CCE-REG-mapping-type' (see 38.211Section sections 7.3.2.2 and 7.4.1.3.2) + cce-REG-MappingType CHOICE { + interleaved SEQUENCE { + -- Resource Element Groups (REGs) can be bundled to create REG bundles. This parameter defines the size of such bundles. + -- Corresponds to L1 parameter 'CORESET-REG-bundle-size' (see 38.211, section FFS_Section) + reg-BundleSize ENUMERATED {n2, n3, n6}, + -- Corresponds to L1 parameter 'CORESET-interleaver-size' (see 38.211, 38.213, section FFS_Section) + interleaverSize ENUMERATED {n2, n3, n6}, + -- Corresponds to L1 parameter 'CORESET-shift-index' (see 38.211, section 7.3.2.2) + shiftIndex INTEGER(0..maxNrofPhysicalResourceBlocks-1) + }, + nonInterleaved NULL + }, + -- Precoder granularity in frequency domain. + -- Corresponds to L1 parameter 'CORESET-precoder-granuality' (see 38.211, sections 7.3.2.2 and 7.4.1.3.2) + precoderGranularity ENUMERATED {sameAsREG-bundle, allContiguousRBs}, + + -- A subset of the TCI states defined in TCI-States used for providing QCL relationships between the DL RS(s) in one RS Set + -- (TCI-State) and the PDCCH DMRS ports. Corresponds to L1 parameter 'TCI-StatesPDCCH' (see 38.214, section FFS_Section) + tci-StatesPDCCH SEQUENCE(SIZE (1..maxNrofTCI-StatesPDCCH)) OF TCI-StateId OPTIONAL, -- Need R + + -- If at least spatial QCL is configured/indicated, this field indicates if TCI field is present or not present in DL-related DCI. + -- When the field is absent the UE considers the TCI to be absent/disabled. + -- Corresponds to L1 parameter 'TCI-PresentInDCI' (see 38,213, section 5.1.5) + tci-PresentInDCI ENUMERATED {enabled} OPTIONAL, -- Need S + + -- PDCCH DMRS scrambling initalization. Corresponds to L1 parameter 'PDCCH-DMRS-Scrambling-ID' (see 38.214, section 5.1) + -- When the field is absent the UE applies the value '0'. + pdcch-DMRS-ScramblingID BIT STRING (SIZE (16)) OPTIONAL -- Need S +} + +-- TAG-CONTROLRESOURCESET-STOP +-- TAG-CONTROL-RESOURCE-SET-ID-START + +ControlResourceSetId ::= INTEGER (0..maxNrofControlResourceSets-1) + +-- TAG-CONTROL-RESOURCE-SET-ID-STOP + +CrossCarrierSchedulingConfig ::= SEQUENCE { + schedulingCellInfo CHOICE { + own SEQUENCE { -- No cross carrier scheduling + cif-Presence BOOLEAN + }, + other SEQUENCE { -- Cross carrier scheduling + schedulingCellId ServCellIndex, + cif-InSchedulingCell INTEGER (1..7) + } -- Cond SCellOnly + }, + ... +} + +-- TAG-CSI-APERIODICTRIGGERSTATELIST-START + +CSI-AperiodicTriggerStateList ::= SEQUENCE (SIZE (1..maxNrOfCSI-AperiodicTriggers)) OF CSI-AperiodicTriggerState + +CSI-AperiodicTriggerState ::= SEQUENCE { + associatedReportConfigInfoList SEQUENCE (SIZE(1..maxNrofReportConfigPerAperiodicTrigger)) OF CSI-AssociatedReportConfigInfo, + ... +} + +CSI-AssociatedReportConfigInfo ::= SEQUENCE { + -- The reportConfigId of one of the CSI-ReportConfigToAddMod configured in CSI-MeasConfig + reportConfigId CSI-ReportConfigId, + + resourcesForChannel CHOICE { + nzp-CSI-RS SEQUENCE { + -- NZP-CSI-RS-ResourceSet for channel measurements. Entry number in nzp-CSI-RS-ResourceSetList in the CSI-ResourceConfig + -- indicated by resourcesForChannelMeasurement in the CSI-ReportConfig indicated by reportConfigId above + -- (1 corresponds to the first entry, 2 to thesecond entry, and so on). + resourceSet INTEGER (1..maxNrofNZP-CSI-RS-ResourceSetsPerConfig), + + -- List of references to TCI-States for providing the QCL source and QCL type for for each NZP-CSI-RS-Resource + -- listed in nzp-CSI-RS-Resources of the NZP-CSI-RS-ResourceSet indicated by nzp-CSI-RS-ResourcesforChannel. + -- First entry in qcl-info-forChannel corresponds to first entry in nzp-CSI-RS-Resources of that NZP-CSI-RS-ResourceSet, + -- second entry in qcl-info-forChannel corresponds to second entry in nzp-CSI-RS-Resources, + -- and so on. Corresponds to L1 parameter 'QCL-Info-aPeriodicReportingTrigger' (see 38.214, section 5.2.1.5.1) + qcl-info SEQUENCE (SIZE(1..maxNrofAP-CSI-RS-ResourcesPerSet)) OF TCI-StateId + }, + -- CSI-SSB-ResourceSet for channel measurements. Entry number in csi-SSB-ResourceSetList in the CSI-ResourceConfig indicated by + -- resourcesForChannelMeasurement in the CSI-ReportConfig indicated by reportConfigId above (1 corresponds to the first entry, 2 to + -- the second entry, and so on). + csi-SSB-ResourceSet INTEGER (1..maxNrofCSI-SSB-ResourceSetsPerConfig) + }, + + -- CSI-IM-ResourceSet for interference measurement. Entry number in csi-IM-ResourceSetList in the CSI-ResourceConfig indicated by + -- csi-IM-ResourcesForInterference in the CSI-ReportConfig indicated by reportConfigId above (1 corresponds to the first entry, 2 to the second + -- entry, and so on). + -- The indicated CSI-IM-ResourceSet should have exactly the same number of resources like the NZP-CSI-RS-ResourceSet indicated in + -- nzp-CSI-RS-ResourcesforChannel. + -- This field can only be present if the CSI-ReportConfig identified by reportConfigId includes csi-IM-ResourcesForInterference. + csi-IM-ResourcesforInteference INTEGER(1..maxNrofCSI-IM-ResourceSetsPerConfig) OPTIONAL, --Cond CSI-IM-forInterference + + + -- NZP-CSI-RS-ResourceSet for interference measurement. Entry number in nzp-CSI-RS-ResourceSetList in the CSI-ResourceConfig indicated by + -- nzp-CSI-RS-ResourcesForInterference in the CSI-ReportConfig indicated by reportConfigId above (1 corresponds to the first entry, + -- 2 to the second entry, and so on). + -- The indicated NZP-CSI-RS-ResourceSet should have exactly the same number of resources like the NZP-CSI-RS-ResourceSet indicated in + -- nzp-CSI-RS-ResourcesforChannel. + -- This field can only be present if the CSI-ReportConfig identified by reportConfigId includes nzp-CSI-RS-ResourcesForInterference. + nzp-CSI-RS-ResourcesforInterference INTEGER (1..maxNrofNZP-CSI-RS-ResourceSetsPerConfig) OPTIONAL, --Cond LinkedNZP-CSI-RS-forInterference + ... +} + +-- TAG-CSI-APERIODICTRIGGERSTATELIST-STOP +-- TAG-CSI-FREQUENCYOCCUPATION-START + +CSI-FrequencyOccupation ::= SEQUENCE { + -- PRB where this CSI resource starts in relation to PRB 0 of the associated BWP. + -- Only multiples of 4 are allowed (0, 4, ...) + startingRB INTEGER (0..maxNrofPhysicalResourceBlocks-1), + -- Number of PRBs across which this CSI resource spans. Only multiples of 4 are allowed. The smallest configurable + -- number is the minimum of 24 and the width of the associated BWP. + nrofRBs INTEGER (24..maxNrofPhysicalResourceBlocks), + ... +} + +-- TAG-CSI-FREQUENCYOCCUPATION-STOP +-- TAG-CSI-IM-RESOURCE-START +CSI-IM-Resource ::= SEQUENCE { + csi-IM-ResourceId CSI-IM-ResourceId, + + -- The resource element pattern (Pattern0 (2,2) or Pattern1 (4,1)) with corresponding parameters. + -- Corresponds to L1 parameter 'CSI-IM-RE-pattern' (see 38.214, section 5.2.2.3.4) + csi-IM-ResourceElementPattern CHOICE { + pattern0 SEQUENCE { + -- OFDM subcarrier occupancy of the CSI-IM resource for Pattern0 + -- Corresponds to L1 parameter 'CSI-IM-ResourceMapping' (see 38.214, section 5.2.2.3.4) + subcarrierLocation-p0 ENUMERATED { s0, s2, s4, s6, s8, s10 }, + -- OFDM symbol location of the CSI-IM resource for Pattern0 + -- Corresponds to L1 parameter 'CSI-IM-ResourceMapping' (see 38.214, section 5.2.2.3.4) + symbolLocation-p0 INTEGER (0..12) + }, + pattern1 SEQUENCE { + -- OFDM subcarrier occupancy of the CSI-IM resource for Pattern1 + -- Corresponds to L1 parameter 'CSI-IM-ResourceMapping' (see 38.214, section 5.2.2.3.4) + subcarrierLocation-p1 ENUMERATED { s0, s4, s8 }, + -- OFDM symbol location of the CSI-IM resource for Pattern1 + -- Corresponds to L1 parameter 'CSI-IM-ResourceMapping' (see 38.214, section 5.2.2.3.4) + symbolLocation-p1 INTEGER (0..13) + } + } OPTIONAL, --Need M + + -- Frequency-occupancy of CSI-IM. Corresponds to L1 parameter 'CSI-IM-FreqBand' (see 38.214, section 5.2.2.3.2) + freqBand CSI-FrequencyOccupation OPTIONAL, -- Need M + + -- Periodicity and slot offset for periodic/semi-persistent CSI-IM. Corresponds to L1 parameter 'CSI-IM-timeConfig' + periodicityAndOffset CSI-ResourcePeriodicityAndOffset OPTIONAL, --Cond PeriodicOrSemiPersistent + ... +} + +-- TAG-CSI-IM-RESOURCE-STOP +-- TAG-CSI-IM-RESOURCEID-START +CSI-IM-ResourceId ::= INTEGER (0..maxNrofCSI-IM-Resources-1) + +-- TAG-CSI-IM-RESOURCEID-STOP +-- TAG-CSI-IM-RESOURCESET-START +CSI-IM-ResourceSet ::= SEQUENCE { + + csi-IM-ResourceSetId CSI-IM-ResourceSetId, + -- CSI-IM-Resources associated with this CSI-IM-ResourceSet + -- Corresponds to L1 parameter 'CSI-IM-ResourceConfigList' (see 38.214, section 5.2) + csi-IM-Resources SEQUENCE (SIZE(1..maxNrofCSI-IM-ResourcesPerSet)) OF CSI-IM-ResourceId, + ... +} +-- TAG-CSI-IM-RESOURCESET-STOP +-- TAG-CSI-IM-RESOURCESETID-START + +CSI-IM-ResourceSetId ::= INTEGER (0..maxNrofCSI-IM-ResourceSets-1) + +-- TAG-CSI-IM-RESOURCESETID-STOP +-- TAG-CSI-MEAS-CONFIG-START + +CSI-MeasConfig ::= SEQUENCE { + -- Pool of NZP-CSI-RS-Resource which can be referred to from NZP-CSI-RS-ResourceSet + nzp-CSI-RS-ResourceToAddModList SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-Resources)) OF NZP-CSI-RS-Resource OPTIONAL, -- Need N + nzp-CSI-RS-ResourceToReleaseList SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-Resources)) OF NZP-CSI-RS-ResourceId OPTIONAL, -- Need N + + -- Pool of NZP-CSI-RS-ResourceSet which can be referred to from CSI-ResourceConfig or from MAC CEs + nzp-CSI-RS-ResourceSetToAddModList SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-ResourceSets)) OF NZP-CSI-RS-ResourceSet OPTIONAL, -- Need N + nzp-CSI-RS-ResourceSetToReleaseList SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-ResourceSets)) OF NZP-CSI-RS-ResourceSetId OPTIONAL, -- Need N + + -- Pool of CSI-IM-Resource which can be referred to from CSI-IM-ResourceSet + csi-IM-ResourceToAddModList SEQUENCE (SIZE (1..maxNrofCSI-IM-Resources)) OF CSI-IM-Resource OPTIONAL, -- Need N + csi-IM-ResourceToReleaseList SEQUENCE (SIZE (1..maxNrofCSI-IM-Resources)) OF CSI-IM-ResourceId OPTIONAL, -- Need N + + -- Pool of CSI-IM-ResourceSet which can be referred to from CSI-ResourceConfig or from MAC CEs + csi-IM-ResourceSetToAddModList SEQUENCE (SIZE (1..maxNrofCSI-IM-ResourceSets)) OF CSI-IM-ResourceSet OPTIONAL, -- Need N + csi-IM-ResourceSetToReleaseList SEQUENCE (SIZE (1..maxNrofCSI-IM-ResourceSets)) OF CSI-IM-ResourceSetId OPTIONAL, -- Need N + + -- Pool of CSI-SSB-ResourceSet which can be referred to from CSI-ResourceConfig + csi-SSB-ResourceSetToAddModList SEQUENCE (SIZE (1..maxNrofCSI-SSB-ResourceSets)) OF CSI-SSB-ResourceSet OPTIONAL, -- Need N + csi-SSB-ResourceSetToAddReleaseList SEQUENCE (SIZE (1..maxNrofCSI-SSB-ResourceSets)) OF CSI-SSB-ResourceSetId OPTIONAL, -- Need N + + -- Configured CSI resource settings as specified in TS 38.214 section 5.2.1.2 + csi-ResourceConfigToAddModList SEQUENCE (SIZE (1..maxNrofCSI-ResourceConfigurations)) OF CSI-ResourceConfig OPTIONAL, -- Need N + csi-ResourceConfigToReleaseList SEQUENCE (SIZE (1..maxNrofCSI-ResourceConfigurations)) OF CSI-ResourceConfigId OPTIONAL, -- Need N + + -- Configured CSI report settings as specified in TS 38.214 section 5.2.1.1 + csi-ReportConfigToAddModList SEQUENCE (SIZE (1..maxNrofCSI-ReportConfigurations)) OF CSI-ReportConfig OPTIONAL, -- Need N + csi-ReportConfigToReleaseList SEQUENCE (SIZE (1..maxNrofCSI-ReportConfigurations)) OF CSI-ReportConfigId OPTIONAL, -- Need N + + + -- Size of CSI request field in DCI (bits). Corresponds to L1 parameter 'ReportTriggerSize' (see 38.214, section 5.2) + reportTriggerSize INTEGER (0..6) OPTIONAL, + + -- Contains trigger states for dynamically selecting one or more aperiodic and semi-persistent reporting configurations + -- and/or triggering one or more aperiodic CSI-RS resource sets for channel and/or interference measurement. + -- FFS: How to address the MAC-CE configuration + aperiodicTriggerStateList SetupRelease { CSI-AperiodicTriggerStateList } OPTIONAL, -- Need M + semiPersistentOnPUSCH-TriggerStateList SetupRelease { CSI-SemiPersistentOnPUSCH-TriggerStateList } OPTIONAL, -- Need M + ... +} + +maxNrofNZP-CSI-RS-ResourceSets INTEGER ::= 64 +maxNrofNZP-CSI-RS-ResourceSets-1 INTEGER ::= 63 + +maxNrofCSI-SSB-ResourceSets INTEGER ::= 64 +maxNrofCSI-SSB-ResourceSets-1 INTEGER ::= 63 + +maxNrofCSI-IM-ResourceSets INTEGER ::= 64 +maxNrofCSI-IM-ResourceSets-1 INTEGER ::= 63 + +-- TAG-CSI-MEAS-CONFIG-STOP +-- TAG-CSI-REPORTCONFIG-START +-- Configuration of a CSI-Report sent on L1 (e.g. PUCCH) (see 38.214, section 5.2.1) +CSI-ReportConfig ::= SEQUENCE { + reportConfigId CSI-ReportConfigId, + + -- Indicates in which serving cell the CSI-ResourceConfigToAddMod(s) below are to be found. + -- If the field is absent, the resources are on the same serving cell as this report configuration. + carrier ServCellIndex OPTIONAL, -- Need S + + -- Resources for channel measurement. csi-ResourceConfigId of a CSI-ResourceConfig included in the configuration of the serving cell + -- indicated with the field "carrier" above. This CSI-ReportConfig is associated with the DL BWP indicated by bwp-Id in that CSI-ResourceConfig. + resourcesForChannelMeasurement CSI-ResourceConfigId, + + -- CSI IM resources for interference measurement. csi-ResourceConfigId of a CSI-ResourceConfig included in the configuration of the serving cell + -- indicated with the field "carrier" above. The bwp-Id in that CSI-ResourceConfigToAddMod is the same value like the bwp-Id in the + -- CSI-ResourceConfig indicated by resourcesForChannelMeasurement. + csi-IM-ResourcesForInterference CSI-ResourceConfigId OPTIONAL, -- Need R + + -- NZP CSI RS resources for interference measurement. csi-ResourceConfigId of a CSI-ResourceConfigToAddMod included in the configuration of the + -- serving cell indicated with the field "carrier" above. The bwp-Id in that CSI-ResourceConfigToAddMod is the same value like the bwp-Id in the + -- CSI-ResourceConfigToAddMod indicated by resourcesForChannelMeasurement. + nzp-CSI-RS-ResourcesForInterference CSI-ResourceConfigId OPTIONAL, -- Need R + + -- Time domain behavior of reporting configuration + reportConfigType CHOICE { + periodic SEQUENCE { + -- Periodicity and slot offset. Corresponds to L1 parameter 'ReportPeriodicity'and 'ReportSlotOffset' + -- (see 38.214, section section 5.2.1.4). + reportSlotConfig CSI-ReportPeriodicityAndOffset, + -- Indicates which PUCCH resource to use for reporting on PUCCH. + pucch-CSI-ResourceList SEQUENCE (SIZE (1..maxNrofBWPs)) OF PUCCH-CSI-Resource + }, + semiPersistentOnPUCCH SEQUENCE { + -- Periodicity and slot offset. Corresponds to L1 parameter 'ReportPeriodicity' and 'ReportSlotOffset' + -- (see 38.214, section section 5.2.1.4). + reportSlotConfig CSI-ReportPeriodicityAndOffset, + -- Indicates which PUCCH resource to use for reporting on PUCCH. + pucch-CSI-ResourceList SEQUENCE (SIZE (1..maxNrofBWPs)) OF PUCCH-CSI-Resource + }, + semiPersistentOnPUSCH SEQUENCE { + -- Periodicity. Corresponds to L1 parameter 'Reportperiodicity-spCSI'. (see 38.214, section 5.2.1.1?FFS_Section) + reportSlotConfig ENUMERATED {sl5, sl10, sl20, sl40, sl80, sl160, sl320}, + -- Timing offset Y for aperiodic reporting using PUSCH. This field lists the allowed offset values. + -- A particular value is indicated in DCI. The first report is transmitted in slot n+Y, second report in n+Y+P, + -- where P is the configured periodicity. + reportSlotOffsetList SEQUENCE (SIZE (1..4)) OF INTEGER (0..7), + -- RNTI for SP CSI-RNTI, Corresponds to L1 parameter 'SPCSI-RNTI' (see 38.214, section 5.2.1.5.2) + -- FFS: RAN1 models different RNTIs as different Search Spaces with independent configurations. Align the configuration + -- of this one (e.g. group with monitoring periodicity, PDCCH candidate configuration, DCI-Payload size...)? + csi-RNTI RNTI-Value, + -- Index of the p0-alpha set determining the power control for this CSI report transmission. + -- Corresponds to L1 parameter 'SPCSI-p0alpha' (see 38.214, section FFS_Section) + p0alpha P0-PUSCH-AlphaSetId + }, + aperiodic SEQUENCE { + -- Timing offset Y for aperiodic reporting using PUSCH. This field lists the allowed offset values. A particular value is indicated in DCI. + -- (see 38.214, section 5.2.3) + -- FFS_Value: Range wasn’t final in RAN1 table. + -- FFS_FIXME: How are the DCI codepoints mapped to the allowed offsets? + reportSlotOffsetList SEQUENCE (SIZE (1..16)) OF INTEGER (0..7) + } + }, + -- The CSI related quanities to report. Corresponds to L1 parameter 'ReportQuantity' (see 38.214, section REF) + reportQuantity CHOICE { + none NULL, + cri-RI-PMI-CQI NULL, + cri-RI-i1 NULL, + cri-RI-i1-CQI SEQUENCE { + -- PRB bundling size to assume for CQI calcuation when reportQuantity is CRI/RI/i1/CQI + -- Corresponds to L1 parameter 'PDSCH-bundle-size-for-CSI' (see 38.214, section 5.2.1.4) + pdsch-BundleSizeForCSI ENUMERATED {n2, n4} OPTIONAL + }, + cri-RI-CQI NULL, + cri-RSRP NULL, + ssb-Index-RSRP NULL, + cri-RI-LI-PMI-CQI NULL + }, + -- Reporting configuration in the frequency domain. (see 38.214, section 5.2.1.4) + reportFreqConfiguration SEQUENCE { + -- Indicates whether the UE shall report a single (wideband) or multiple (subband) CQI. (see 38.214, section 5.2.1.4) + cqi-FormatIndicator ENUMERATED { widebandCQI, subbandCQI }, + -- Indicates whether the UE shall report a single (wideband) or multiple (subband) PMI. (see 38.214, section 5.2.1.4) + pmi-FormatIndicator ENUMERATED { widebandPMI, subbandPMI }, + -- Indicates a contiguous or non-contigous subset of subbands in the bandwidth part which CSI shall be reported + -- for. Each bit in the bit-string represents one subband. The right-most bit in the bit string represents the + -- lowest subband in the BWP. (see 38.214, section 5.2.1.4) + -- The number of subbands is determined according to 38.214 section 5.2.1.4. It is absent if there are less than 24 PRBs (no sub band) + -- and present otherwise, the number of sub bands can be from 3 (24 PRBs, sub band size 8) to 18 (72 PRBs, sub band size 4). + csi-ReportingBand CHOICE { + subbands3 BIT STRING(SIZE(3)), + subbands4 BIT STRING(SIZE(4)), + subbands5 BIT STRING(SIZE(5)), + subbands6 BIT STRING(SIZE(6)), + subbands7 BIT STRING(SIZE(7)), + subbands8 BIT STRING(SIZE(8)), + subbands9 BIT STRING(SIZE(9)), + subbands10 BIT STRING(SIZE(10)), + subbands11 BIT STRING(SIZE(11)), + subbands12 BIT STRING(SIZE(12)), + subbands13 BIT STRING(SIZE(13)), + subbands14 BIT STRING(SIZE(14)), + subbands15 BIT STRING(SIZE(15)), + subbands16 BIT STRING(SIZE(16)), + subbands17 BIT STRING(SIZE(17)), + subbands18 BIT STRING(SIZE(18)), + ... + } OPTIONAL -- Need S + + }, + -- Time domain measurement restriction for the channel (signal) measurements. + -- Corresponds to L1 parameter 'MeasRestrictionConfig-time-channel' (see 38.214, section 5.2.1.1) + timeRestrictionForChannelMeasurements ENUMERATED {configured, notConfigured}, + -- Time domain measurement restriction for interference measurements. + -- Corresponds to L1 parameter 'MeasRestrictionConfig-time-interference' (see 38.214, section 5.2.1.1) + timeRestrictionForInterferenceMeasurements ENUMERATED {configured, notConfigured}, + -- Codebook configuration for Type-1 or Type-II including codebook subset restriction + codebookConfig CodebookConfig, + -- Maximum number of CQIs per CSI report (cf. 1 for 1-CW, 2 for 2-CW) + nrofCQIsPerReport ENUMERATED {n1, n2}, + -- Turning on/off group beam based reporting (see 38.214, section 5.2.1.4) + groupBasedBeamReporting CHOICE { + enabled NULL, + disabled SEQUENCE { + -- The number (N) of measured RS resources to be reported per report setting in a non-group-based report. + -- N <= N_max, where N_max is either 2 or 4 depending on UE capability. + -- FFS: The signaling mechanism for the gNB to select a subset of N beams for the UE to measure and report. + -- FFS: Note: this parameter may not be needed for certain resource and/or report settings + -- FFS_ASN1: Change groupBasedBeamReporting into a CHOICE and include this field into the "no" option? + -- (see 38.214, section FFS_Section) + -- When the field is absent the UE applies the value 1 + nrofReportedRS ENUMERATED {n1, n2, n3, n4} OPTIONAL -- Need S + } + }, + + -- Which CQI table to use for CQI calculation. Corresponds to L1 parameter 'CQI-table' (see 38.214, section 5.2.2.1) + cqi-Table ENUMERATED {table1, table2, spare2, spare1} OPTIONAL, + -- Indicates one out of two possible BWP-dependent values for the subband size as indicated in 38.214 table 5.2.1.4-2 + -- Corresponds to L1 parameter 'SubbandSize' (see 38.214, section 5.2.1.4) + subbandSize ENUMERATED {value1, value2}, + -- BLER target that the UE shall be assume in its CQI calculation. + -- Corresponds to L1 parameter 'BLER-Target' (see 38.214, section 5.2.2.1) + -- FFS_Values (now filled with spares) + bler-Target ENUMERATED {zerodot1, spare3, space2, spare1} OPTIONAL, + -- Port indication for RI/CQI calculation. For each CSI-RS resource in the linked ResourceConfig for channel measurement, + -- a port indication for each rank R, indicating which R ports to use. Applicable only for non-PMI feedback. + -- Corresponds to L1 parameter 'Non-PMI-PortIndication' (see 38.214, section FFS_Section) + -- The first entry in non-PMI-PortIndication corresponds to the NZP-CSI-RS-Resource indicated by the first entry in + -- nzp-CSI-RS-Resources in the NZP-CSI-RS-ResourceSet indicated in the first entry of nzp-CSI-RS-ResourceSetList of the + -- CSI-ResourceConfig whose CSI-ResourceConfigId is indicated in a CSI-MeasId together with the above CSI-ReportConfigId, + -- the second entry in non-PMI-PortIndication corresponds to the NZP-CSI-RS-Resource indicated by the second entry in + -- nzp-CSI-RS-Resources in the NZP-CSI-RS-ResourceSet indicated in the first entry of nzp-CSI-RS-ResourceSetList of the + -- same CSI-ResourceConfig, and so on until the NZP-CSI-RS-Resource indicated by the last entry in nzp-CSI-RS-Resources + -- in the in the NZP-CSI-RS-ResourceSet indicated in the first entry of nzp-CSI-RS-ResourceSetList of the + -- same CSI-ResourceConfig, then the next entry corresponds to the NZP-CSI-RS-Resource indicated by the first entry + -- in nzp-CSI-RS-Resources in the NZP-CSI-RS-ResourceSet indicated in the second entry of nzp-CSI-RS-ResourceSetList of the + -- same CSI-ResourceConfig and so on. + non-PMI-PortIndication SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-ResourcesPerConfig)) OF PortIndexFor8Ranks OPTIONAL, ... +} + +CSI-ReportPeriodicityAndOffset ::= CHOICE { + slots4 INTEGER(0..3), + slots5 INTEGER(0..4), + slots8 INTEGER(0..7), + slots10 INTEGER(0..9), + slots16 INTEGER(0..15), + slots20 INTEGER(0..19), + slots40 INTEGER(0..39), + slots80 INTEGER(0..79), + slots160 INTEGER(0..159), + slots320 INTEGER(0..319) +} + +PUCCH-CSI-Resource ::= CHOICE { + uplinkBandwidthPartId BWP-Id, + -- PUCCH resource for the associated uplink BWP. Only PUCCH-Resource of format 2, 3 and 4 is supported. + pucch-Resource PUCCH-Resource +} + +-- The PortIndexFor8Ranks allows to indicate port indexes for 1 to 8 ranks using a port index ranges from 0 to 31, or from 0 to 15, or from 0 +-- to 7, or from 0 to 3, or from 0 to 1, or with 0 only. + +PortIndexFor8Ranks ::= CHOICE { + portIndex8 SEQUENCE{ + rank1-8 PortIndex8, + rank2-8 SEQUENCE(SIZE(1..2)) OF PortIndex8, + rank3-8 SEQUENCE(SIZE(1..3)) OF PortIndex8, + rank4-8 SEQUENCE(SIZE(1..4)) OF PortIndex8, + rank5-8 SEQUENCE(SIZE(1..5)) OF PortIndex8, + rank6-8 SEQUENCE(SIZE(1..6)) OF PortIndex8, + rank7-8 SEQUENCE(SIZE(1..7)) OF PortIndex8, + rank8-8 SEQUENCE(SIZE(1..8)) OF PortIndex8 + }, + portIndex4 SEQUENCE{ + rank1-4 PortIndex4, + rank2-4 SEQUENCE(SIZE(1..2)) OF PortIndex4, + rank3-4 SEQUENCE(SIZE(1..3)) OF PortIndex4, + rank4-4 SEQUENCE(SIZE(1..4)) OF PortIndex4 + }, + portIndex2 SEQUENCE{ + rank1-2 PortIndex2, + rank2-2 SEQUENCE(SIZE(1..2)) OF PortIndex2 + }, + portIndex1 NULL +} + +PortIndex8::= INTEGER (0..7) +PortIndex4::= INTEGER (0..3) +PortIndex2::= INTEGER (0..1) + +maxNrofNZP-CSI-RS-ResourcesPerConfig INTEGER ::= 128 +-- TAG-CSI-REPORTCONFIG-STOP +-- TAG-CSI-REPORTCONFIGID-START +CSI-ReportConfigId ::= INTEGER (0..maxNrofCSI-ReportConfigurations-1) + +-- TAG-CSI-REPORTCONFIGID-STOP +-- TAG-CSI-RESOURCECONFIG-START + +-- One CSI resource configuration comprising of one or more resource sets +CSI-ResourceConfig ::= SEQUENCE { + + -- Used in CSI-ReportConfig to refer to an instance of CSI-ResourceConfig + csi-ResourceConfigId CSI-ResourceConfigId, + + -- Contains up to maxNrofNZP-CSI-RS-ResourceSetsPerConfig resource sets if ResourceConfigType is 'aperiodic' and 1 otherwise. + -- Corresponds to L1 parameter 'ResourceSetConfigList' (see 38.214, section 5.2.1.3.1) + csi-RS-ResourceSetList CHOICE { + nzp-CSI-RS-SSB SEQUENCE { + nzp-CSI-RS-ResourceSetList SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-ResourceSetsPerConfig)) OF NZP-CSI-RS-ResourceSetId OPTIONAL, + -- List of SSB resources used for beam measurement and reporting in a resource set + -- Corresponds to L1 parameter 'resource-config-SS-list' (see 38,214, section FFS_Section) + csi-SSB-ResourceSetList SEQUENCE (SIZE (1..maxNrofCSI-SSB-ResourceSetsPerConfig)) OF CSI-SSB-ResourceSetId OPTIONAL + }, + csi-IM-ResourceSetList SEQUENCE (SIZE (1..maxNrofCSI-IM-ResourceSetsPerConfig)) OF CSI-IM-ResourceSetId + }, + + + -- The DL BWP which the CSI-RS associated with this CSI-ResourceConfig are located in. + -- Corresponds to L1 parameter 'BWP-Info' (see 38.214, section 5.2.1.2 + bwp-Id BWP-Id, + + -- Time domain behavior of resource configuration. Corresponds to L1 parameter 'ResourceConfigType' (see 38.214, section 5.2.2.3.5) + resourceType ENUMERATED { aperiodic, semiPersistent, periodic }, + ... +} + +-- TAG-CSI-RESOURCECONFIGTOADDMOD-STOP +-- TAG-CSI-RESOURCECONFIGID-START +CSI-ResourceConfigId ::= INTEGER (0..maxNrofCSI-ResourceConfigurations-1) + +-- TAG-CSI-RESOURCECONFIGID-STOP +-- TAG-CSI-RESOURCEPERIODICITYANDOFFSET-START + +CSI-ResourcePeriodicityAndOffset ::= CHOICE { + slots4 INTEGER (0..3), + slots5 INTEGER (0..4), + slots8 INTEGER (0..7), + slots10 INTEGER (0..9), + slots16 INTEGER (0..15), + slots20 INTEGER (0..19), + slots32 INTEGER (0..31), + slots40 INTEGER (0..39), + slots64 INTEGER (0..63), + slots80 INTEGER (0..79), + slots160 INTEGER (0..159), + slots320 INTEGER (0..319), + slots640 INTEGER (0..639) +} + +-- TAG-CSI-RESIYRCEPERIODICITYANDOFFSET-STOP +-- TAG-CSI-RS-RESOURCEMAPPING-START + +CSI-RS-ResourceMapping ::= SEQUENCE { + -- Frequency domain allocation within a physical resource block in accordance with 38.211, section 7.4.1.5.3 including table 7.4.1.5.2-1. + -- The number of bits that may be set to one depend on the chosen row in that table. For the choice "other", the row can be determined from + -- the parmeters below and from the number of bits set to 1 in frequencyDomainAllocation. + frequencyDomainAllocation CHOICE { + row1 BIT STRING (SIZE (4)), + row2 BIT STRING (SIZE (12)), + row4 BIT STRING (SIZE (3)), + other BIT STRING (SIZE (6)) + }, + -- Number of ports (see 38.214, section 5.2.2.3.1) + nrofPorts ENUMERATED {p1,p2,p4,p8,p12,p16,p24,p32}, + -- Time domain allocation within a physical resource block. The field indicates the first OFDM symbol in the PRB used for CSI-RS. + -- Parameter l0 in 38.211, section 7.4.1.5.3. Value 2 is supported only when DL-DMRS-typeA-pos equals 3. + firstOFDMSymbolInTimeDomain INTEGER (0..13), + -- Time domain allocation within a physical resource block. Parameter l1 in 38.211, section 7.4.1.5.3. + firstOFDMSymbolInTimeDomain2 INTEGER (0..13) OPTIONAL, -- Need R + -- CDM type (see 38.214, section 5.2.2.3.1) + cdm-Type ENUMERATED {noCDM, fd-CDM2, cdm4-FD2-TD2, cdm8-FD2-TD4}, + -- Density of CSI-RS resource measured in RE/port/PRB. Corresponds to L1 parameter 'CSI-RS-Density' (see 38.211, section 7.4.1.5.3) + -- Values 0.5 (dot5), 1 (one) and 3 (three) are allowed for X=1, + -- values 0.5 (dot5) and 1 (one) are allowed for X=2, 16, 24 and 32, + -- value 1 (one) is allowed for X=4, 8, 12. + -- For density = 1/2, includes 1 bit indication for RB level comb offset indicating whether odd or even RBs are occupied by CSI-RS + density CHOICE { + dot5 ENUMERATED {evenPRBs, oddPRBs}, + one NULL, + three NULL, + spare NULL + }, + -- Wideband or partial band CSI-RS. Corresponds to L1 parameter 'CSI-RS-FreqBand' (see 38.214, section 5.2.2.3.1) + freqBand CSI-FrequencyOccupation, + ... +} + +-- TAG-CSI-RS-RESOURCEMAPPING-STOP +-- TAG-CSI-SEMIPERSISTENTONPUSCHTRIGGERSTATELIST-START + +CSI-SemiPersistentOnPUSCH-TriggerStateList ::= SEQUENCE(SIZE (1..maxNrOfSemiPersistentPUSCH-Triggers)) OF CSI-SemiPersistentOnPUSCH-TriggerState +CSI-SemiPersistentOnPUSCH-TriggerState ::= SEQUENCE { + associatedReportConfigInfo CSI-ReportConfigId, + ... +} + +maxNrOfSemiPersistentPUSCH-Triggers INTEGER ::= 64 -- Maximum number of triggers for semi persistent reporting on PUSCH + +-- TAG-CSI-SEMIPERSISTENTONPUSCHTRIGGERSTATELIST-STOP +-- TAG-CSI-SSB-RESOURCESETID-START + +CSI-SSB-ResourceSetId ::= INTEGER (0..maxNrofCSI-SSB-ResourceSets-1) + +-- TAG-CSI-SSB-RESOURCESETID-STOP +-- TAG-CSI-SSB-RESOURCESET-START + +CSI-SSB-ResourceSet ::= SEQUENCE { + csi-SSB-ResourceSetId CSI-SSB-ResourceSetId, + csi-SSB-ResourceList SEQUENCE (SIZE(1..maxNrofCSI-SSB-ResourcePerSet)) OF SSB-Index, + ... +} + +-- TAG-CSI-SSB-RESOURCESET-STOP +-- TAG-DMRS-DOWNLINKCONFIG-START + +DMRS-DownlinkConfig ::= SEQUENCE { + -- Selection of the DMRS type to be used for DL (see 38.211, section 7.4.1.1.1). + -- If the field is absent, the UE uses DMRS type 1. + dmrs-Type ENUMERATED {type2} OPTIONAL, -- Need R + -- Position for additional DM-RS in DL, see Table 7.4.1.1.2-4 in 38.211. + -- The four values represent the cases of 1+0, 1+1, 1+1+1. 1+1+1+1 non-adjacent OFDM symbols for DL. + -- If the field is absent, the UE applies the value pos2. + dmrs-AdditionalPosition ENUMERATED {pos0, pos1, pos3} OPTIONAL, -- Need R + -- DM-RS groups that are QCL:ed, i.e. group 1 (see 38.214, section 5.1) + dmrs-group1 BIT STRING (SIZE (12)) OPTIONAL, -- Need R + -- DM-RS groups that are QCL:ed, i.e. group 2 (see 38.214, section 5.1) + dmrs-group2 BIT STRING (SIZE (12)) OPTIONAL, -- Need R + -- The maximum number of OFDM symbols for DL front loaded DMRS. 'len1' corresponds to value 1. 'len2 corresponds to value 2. + -- If the field is absent, the UE applies value len1. + -- Corresponds to L1 parameter 'DL-DMRS-max-len' (see 38.214, section 5.1) + maxLength ENUMERATED {len2} OPTIONAL, -- Need R + -- DL DMRS scrambling initalization + -- Corresponds to L1 parameter 'n_SCID 0' (see 38.211, section 7.4.1) + -- When the field is absent the UE applies the value Physical cell ID (physCellId) configured for this serving cell." + scramblingID0 INTEGER (0..65535) OPTIONAL, -- Need S + -- DL DMRS scrambling initalization. Corresponds to L1 parameter 'n_SCID 1' (see 38.211, section 7.4.1) + -- When the field is absent the UE applies the value (physCellId) configured for this serving cell. + scramblingID1 INTEGER (0..65535) OPTIONAL, -- Need S + + -- Configures downlink PTRS. If absent of released, the UE assumes that downlink PTRS are not present. See 38.214 section 5.1.6.3 + phaseTrackingRS SetupRelease { PTRS-DownlinkConfig } OPTIONAL, -- Need M + + ... +} + +-- TAG-DMRS-DOWNLINKCONFIG-STOP +-- TAG-DMRS-UPLINKCONFIG-START + +DMRS-UplinkConfig ::= SEQUENCE { + -- Selection of the DMRS type to be used for UL (see section 38.211, section 6.4.1.1.3) + -- If the field is absent, the UE uses DMRS type 1. + dmrs-Type ENUMERATED {type2} OPTIONAL, -- Need R + -- Position for additional DM-RS in UL. Corresponds to L1 parameter 'UL-DMRS-add-pos' (see Table 7.4.1.1.2-4 in 38.211) + -- The four values represent the cases of 1+0, 1+1, 1+1+1. 1+1+1+1 non-adjacent OFDM symbols for UL. + -- If the field is absent, the UE applies the value pos2. + dmrs-AdditionalPosition ENUMERATED {pos0, pos1, pos3} OPTIONAL, -- Need R + -- Configures uplink PTRS (see 38.211, section x.x.x.x) FFS_Ref + phaseTrackingRS SetupRelease { PTRS-UplinkConfig } OPTIONAL, -- Need M + -- The maximum number of OFDM symbols for UL front loaded DMRS. 'len1' corresponds to value 1. 'len2 corresponds to value 2. + -- If the field is absent, the UE applies value len1. + -- Corresponds to L1 parameter 'UL-DMRS-max-len' (see 38.214, section 6.4.1.1.2) + maxLength ENUMERATED {len2} OPTIONAL, -- Need R + + transformPrecoding CHOICE { + -- DMRS related parameters for Cyclic Prefix OFDM + disabled SEQUENCE { + -- UL DMRS scrambling initalization for CP-OFDM + -- Corresponds to L1 parameter 'n_SCID 0' (see 38.214, section 6.4.1.1.2) + -- When the field is absent the UE applies the value Physical cell ID (physCellId) + scramblingID0 INTEGER (0..65535) OPTIONAL, -- Need S + -- UL DMRS scrambling initalization for CP-OFDM. + -- Corresponds to L1 parameter 'n_SCID 1' (see 38.214, section 6.4.1.1.2) + -- When the field is absent the UE applies the value Physical cell ID (physCellId) + scramblingID1 INTEGER (0..65535) OPTIONAL -- Need S + + }, + -- DMRS related parameters for DFT-s-OFDM (Transform Precoding) + enabled SEQUENCE { + -- Parameter: N_ID^(PUSCH) for DFT-s-OFDM DMRS. If the value is absent or released, the UE uses the Physical cell ID. + -- Corresponds to L1 parameter 'nPUSCH-Identity-Transform precoding' (see 38.211, section FFS_Section) + nPUSCH-Identity INTEGER(0..1007) OPTIONAL, -- Need S + -- Sequence-group hopping for PUSCH can be disabled for a certain UE despite being enabled on a cell basis. For DFT-s-OFDM DMRS + -- If the field is released, the UE considers group hopping to be enabled. + -- Corresponds to L1 parameter 'Disable-sequence-group-hopping-Transform-precoding' (see 38.211, section FFS_Section) + disableSequenceGroupHopping ENUMERATED {disabled} OPTIONAL, -- Need S + -- Determines if sequence hopping is enabled or not. For DFT-s-OFDM DMRS. + -- If the field is released, the UE considers sequence hopping to be disabled. + -- Corresponds to L1 parameter 'Sequence-hopping-enabled-Transform-precoding' (see 38.211, section FFS_Section) + sequenceHoppingEnabled ENUMERATED {enabled} OPTIONAL -- Need S + } + }, + ... +} + +-- TAG-DMRS-UPLINKCONFIG-STOP +-- TAG-DOWNLINKPREEMPTION-START + +-- Configuration of downlink preemption indication on PDCCH. +DownlinkPreemption ::= SEQUENCE { + -- RNTI used for indication pre-emption in DL. + -- Corresponds to L1 parameter 'INT-RNTI', where ”INT” stands for ”interruption” (see 38.213, section 10) + int-RNTI RNTI-Value, + + -- Set selection for DL-preemption indication. Corresponds to L1 parameter 'int-TF-unit' (see 38.213, section 10.1) + -- The set determines how the UE interprets the DL preemption DCI payload. + timeFrequencySet ENUMERATED {set0, set1}, + + -- Total length of the DCI payload scrambled with INT-RNTI. The value must be an integer multiple of 14 bit. + -- Corresponds to L1 parameter 'INT-DCI-payload-length' (see 38.213, section 11.2) + dci-PayloadSize INTEGER (0..maxINT-DCI-PayloadSize), + + -- Indicates (per serving cell) the position of the 14 bit INT values inside the DCI payload. + -- Corresponds to L1 parameter 'INT-cell-to-INT' and 'cell-to-INT' (see 38.213, section 11.2) + int-ConfigurationPerServingCell SEQUENCE (SIZE (1..maxNrofServingCells)) OF INT-ConfigurationPerServingCell, + ... +} + +INT-ConfigurationPerServingCell ::= SEQUENCE { + servingCellId ServCellIndex, + -- Starting position (in number of bit) of the 14 bit INT value applicable for this serving cell (servingCellId) within the DCI + -- payload. Must be multiples of 14 (bit). Corresponds to L1 parameter 'INT-values' (see 38.213, section 11.2) + positionInDCI INTEGER (0..maxINT-DCI-PayloadSize-1) +} + +-- TAG-DOWNLINKPREEMPTION-STOP +-- TAG-DRB-IDENTITY-START + +DRB-Identity ::= INTEGER (1..32) + +-- TAG-DRB-IDENTITY-STOP +-- TAG-EUTRA-MBSFN-SUBFRAMECONFIGLIST-START + +EUTRA-MBSFN-SubframeConfigList ::= SEQUENCE (SIZE (1..maxMBSFN-Allocations)) OF EUTRA-MBSFN-SubframeConfig + +EUTRA-MBSFN-SubframeConfig ::= SEQUENCE { + -- Field as defined in MBSFN-SubframeConfig in 36.331 + radioframeAllocationPeriod ENUMERATED {n1, n2, n4, n8, n16, n32}, + -- Field as defined in MBSFN-SubframeConfig in 36.331 + radioframeAllocationOffset INTEGER (0..7), + -- Field as defined in MBSFN-SubframeConfig in 36.331 + subframeAllocation CHOICE { + -- Field as defined in MBSFN-SubframeConfig in 36.331 + oneFrame BIT STRING (SIZE(6)), + -- Field as defined in MBSFN-SubframeConfig in 36.331 + fourFrames BIT STRING (SIZE(24)) + }, + subframeAllocation-v1430 CHOICE { + -- Field as defined in MBSFN-SubframeConfig in 36.331 + oneFrame-v1430 BIT STRING (SIZE(2)), + -- Field as defined in MBSFN-SubframeConfig in 36.331 + fourFrames-v1430 BIT STRING (SIZE(8)) + } OPTIONAL, -- Need R + ... +} + +-- TAG-EUTRA-MBSFN-SUBFRAMECONFIGLIST-STOP + +FilterCoefficient ::= ENUMERATED { + fc0, fc1, fc2, fc3, fc4, fc5, + fc6, fc7, fc8, fc9, fc11, fc13, + fc15, fc17, fc19, spare1, ...} + +-- TAG-FREQBANDINDICATORNR-START + +FreqBandIndicatorNR ::= INTEGER (1..1024) + +-- TAG-FREQBANDINDICATORNR-STOP +-- TAG-FREQUENCY-INFO-DL-START + +FrequencyInfoDL ::= SEQUENCE { + -- Frequency of the SSB to be used for this serving cell. The frequency provided in this field identifies the position of + -- resource element RE=#0 (subcarrier #0) of resource block RB#10 of the SS block. The cell-defining SSB of an SpCell is always on + -- the sync raster. Frequencies are considered to be on the sync raster if they are also identifiable with a GSCN value (see 38.101). + absoluteFrequencySSB ARFCN-ValueNR, + -- The frequency domain offset between SSB and the overall resource block grid in number of subcarriers. + -- Absence of the field indicates that no offset is applied (offset = 0). For FR2 only values up to 11 are applicable. + -- Corresponds to L1 parameter kssb (See 38.211, section 7.4.3.1) + ssb-SubcarrierOffset INTEGER (1..23) OPTIONAL, -- Need S + -- List of one or multiple frequency bands to which this carrier(s) belongs. Multiple values are only supported in + -- system information but not when the FrequencyInfoDL is provided in dedicated signalling (HO or S(p)Cell addition). + frequencyBandList MultiFrequencyBandListNR, + -- Absolute frequency position of the reference resource block (Common RB 0). Its lowest subcarrier is also known as Point A. + -- Note that the lower edge of the actual carrier is not defined by this field but rather in the scs-SpecificCarrierList. + -- Corresponds to L1 parameter 'offset-ref-low-scs-ref-PRB' (see 38.211, section FFS_Section) + absoluteFrequencyPointA ARFCN-ValueNR, + + -- A set of carriers for different subcarrier spacings (numerologies). Defined in relation to Point A. + -- Corresponds to L1 parameter 'offset-pointA-set' (see 38.211, section FFS_Section) + scs-SpecificCarrierList SEQUENCE (SIZE (1..maxSCSs)) OF SCS-SpecificCarrier, + ... +} + +-- TAG-FREQUENCY-INFO-UL-STOP +-- TAG-FREQUENCY-INFO-UL-START + +FrequencyInfoUL ::= SEQUENCE { + -- List of one or multiple frequency bands to which this carrier(s) belongs. Multiple values are only supported in + -- system information but not when the FrequencyInfoDL is provided in dedicated signalling (HO or S(p)Cell addition). + frequencyBandList MultiFrequencyBandListNR OPTIONAL, -- Cond FDD-OrSUL + -- Absolute frequency of the reference resource block (Common RB 0). Its lowest subcarrier is also known as Point A. + -- Corresponds to L1 parameter 'offset-ref-low-scs-ref-PRB' (see 38.211, section FFS_Section) + absoluteFrequencyPointA ARFCN-ValueNR OPTIONAL, -- Cond FDD-OrSUL + -- A set of virtual carriers for different subcarrier spacings (numerologies). Defined in relation to Point A. + -- Note that the lower edge of the actual carrier is not defined by this field but rather in the scs-SpecificCarrierList. + -- Corresponds to L1 parameter 'offset-pointA-set' (see 38.211, section FFS_Section) + scs-SpecificCarriers SEQUENCE (SIZE (1..maxSCSs)) OF SCS-SpecificCarrier, + + -- The additional spectrum emission requirements to be applied by the UE on this uplink. + -- If the field is absent, the UE applies the value FFS_RAN4. (see FFS_section, section FFS_Section) + additionalSpectrumEmission AdditionalSpectrumEmission OPTIONAL, -- Need S + -- FFS_Definition. Corresponds to parameter FFS_RAN4. (see FFS_Spec, section FFS_Section) + -- If the field is absent, the UE applies the value FFS_RAN4. + p-Max P-Max OPTIONAL, -- Need S + -- Enable the NR UL transmission with a 7.5KHz shift to the LTE raster. If the field is absent, the frequency shift is disabled. + frequencyShift7p5khz ENUMERATED {true} OPTIONAL, -- Cond FDD-OrSUL-Optional + ... +} + +-- TAG-FREQUENCY-INFO-UL-STOP +-- TAG-GSCN-VALUE-NR-START + +GSCN-ValueNR ::= INTEGER (1..28557) + + +-- TAG-GSCN-VALUE-NR-STOP + +Hysteresis ::= INTEGER (0..30) + +-- TAG-LOGICAL-CHANNEL-CONFIG-START + +LogicalChannelConfig ::= SEQUENCE { + ul-SpecificParameters SEQUENCE { + priority INTEGER (1..16), + prioritisedBitRate ENUMERATED {kBps0, kBps8, kBps16, kBps32, kBps64, kBps128, kBps256, kBps512, + kBps1024, kBps2048, kBps4096, kBps8192, kBps16384, kBps32768, kBps65536, infinity}, + bucketSizeDuration ENUMERATED {ms50, ms100, ms150, ms300, ms500, ms1000, spare2, spare1}, + + allowedServingCells SEQUENCE (SIZE (1..maxNrofServingCells-1)) OF ServCellIndex OPTIONAL, -- Need R + allowedSCS-List SEQUENCE (SIZE (1..maxSCSs)) OF SubcarrierSpacing OPTIONAL, -- Need R + maxPUSCH-Duration ENUMERATED { ms0p02, ms0p04, ms0p0625, ms0p125, ms0p25, ms0p5, spare2, spare1 } OPTIONAL, -- Need R + configuredGrantType1Allowed ENUMERATED {true} OPTIONAL, -- Need R + + logicalChannelGroup INTEGER (0..maxLCG-ID) OPTIONAL, -- Need R + schedulingRequestID SchedulingRequestId OPTIONAL, -- Need R + logicalChannelSR-Mask BOOLEAN, + logicalChannelSR-DelayTimerApplied BOOLEAN + } OPTIONAL, -- Cond UL + + -- other parameters + ... +} + +-- TAG-LOGICAL-CHANNEL-CONFIG-STOP +-- TAG-MAC-CELL-GROUP-CONFIG-START + +MAC-CellGroupConfig ::= SEQUENCE { + drx-Config SetupRelease { DRX-Config } OPTIONAL, -- Need M + + schedulingRequestConfig SchedulingRequestConfig OPTIONAL, -- Need M + bsr-Config BSR-Config OPTIONAL, -- Need M + tag-Config TAG-Config OPTIONAL, -- Need M + phr-Config SetupRelease { PHR-Config } OPTIONAL, -- Need M + -- FFS : configurable per SCell? + skipUplinkTxDynamic BOOLEAN, + -- RNTI value for downlink SPS (see SPS-config) and uplink configured scheduling (see ConfiguredSchedulingConfig). + cs-RNTI SetupRelease { RNTI-Value } OPTIONAL -- Need M +} + +DRX-Config ::= SEQUENCE { + drx-onDurationTimer CHOICE { + subMilliSeconds INTEGER (1..31), + milliSeconds ENUMERATED { + ms1, ms2, ms3, ms4, ms5, ms6, ms8, ms10, ms20, ms30, ms40, ms50, ms60, + ms80, ms100, ms200, ms300, ms400, ms500, ms600, ms800, ms1000, ms1200, + ms1600, spare9, spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 } + }, + drx-InactivityTimer ENUMERATED { + ms0, ms1, ms2, ms3, ms4, ms5, ms6, ms8, ms10, ms20, ms30, ms40, ms50, ms60, ms80, + ms100, ms200, ms300, ms500, ms750, ms1280, ms1920, ms2560, spare9, spare8, + spare7, spare6, spare5, spare4, spare3, spare2, spare1}, + drx-HARQ-RTT-TimerDL INTEGER (0..56), + drx-HARQ-RTT-TimerUL INTEGER (0..56), + drx-RetransmissionTimerDL ENUMERATED { + sl0, sl1, sl2, sl4, sl6, sl8, sl16, sl24, sl33, sl40, sl64, sl80, sl96, sl112, sl128, + sl160, sl320, spare15, spare14, spare13, spare12, spare11, spare10, spare9, + spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1}, + drx-RetransmissionTimerUL ENUMERATED { + sl0, sl1, sl2, sl4, sl6, sl8, sl16, sl24, sl33, sl40, sl64, sl80, sl96, sl112, sl128, + sl160, sl320, spare15, spare14, spare13, spare12, spare11, spare10, spare9, + spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 }, + drx-LongCycleStartOffset CHOICE { + ms10 INTEGER(0..9), + ms20 INTEGER(0..19), + ms32 INTEGER(0..31), + ms40 INTEGER(0..39), + ms60 INTEGER(0..59), + ms64 INTEGER(0..63), + ms70 INTEGER(0..69), + ms80 INTEGER(0..79), + ms128 INTEGER(0..127), + ms160 INTEGER(0..159), + ms256 INTEGER(0..255), + ms320 INTEGER(0..319), + ms512 INTEGER(0..511), + ms640 INTEGER(0..639), + ms1024 INTEGER(0..1023), + ms1280 INTEGER(0..1279), + ms2048 INTEGER(0..2047), + ms2560 INTEGER(0..2559), + ms5120 INTEGER(0..5119), + ms10240 INTEGER(0..10239) + }, + -- FFS need for finer offset granulary + -- FFS need for shorter values for long and short cycles + shortDRX SEQUENCE { + drx-ShortCycle ENUMERATED { + ms2, ms3, ms4, ms5, ms6, ms7, ms8, ms10, ms14, ms16, ms20, ms30, ms32, + ms35, ms40, ms64, ms80, ms128, ms160, ms256, ms320, ms512, ms640, spare9, + spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 }, + drx-ShortCycleTimer INTEGER (1..16) + } OPTIONAL, -- Need R + drx-SlotOffset INTEGER (0..31) + +} + +PHR-Config ::= SEQUENCE { + phr-PeriodicTimer ENUMERATED {sf10, sf20, sf50, sf100, sf200,sf500, sf1000, infinity}, + phr-ProhibitTimer ENUMERATED {sf0, sf10, sf20, sf50, sf100,sf200, sf500, sf1000}, + phr-Tx-PowerFactorChange ENUMERATED {dB1, dB3, dB6, infinity}, + multiplePHR BOOLEAN, + phr-Type2PCell BOOLEAN, + phr-Type2OtherCell BOOLEAN, + phr-ModeOtherCG ENUMERATED {real, virtual} + +} + + +TAG-Config ::= SEQUENCE { + tag-ToReleaseList SEQUENCE (SIZE (1..maxNrofTAGs)) OF TAG-Id OPTIONAL, -- Need N + tag-ToAddModList SEQUENCE (SIZE (1..maxNrofTAGs)) OF TAG-ToAddMod OPTIONAL -- Need N +} + +TAG-ToAddMod ::= SEQUENCE { + tag-Id TAG-Id, + timeAlignmentTimer TimeAlignmentTimer, + ... +} + +TAG-Id ::= INTEGER (0..maxNrofTAGs-1) + +TimeAlignmentTimer ::= ENUMERATED {ms500, ms750, ms1280, ms1920, ms2560, ms5120, ms10240, infinity} + +BSR-Config ::= SEQUENCE { + periodicBSR-Timer ENUMERATED { + sf1, sf5, sf10, sf16, sf20, sf32, sf40, sf64, sf80, sf128, sf160, sf320, sf640, sf1280, sf2560, infinity}, + retxBSR-Timer ENUMERATED { sf10, sf20, sf40, sf80, sf160, sf320, sf640, sf1280, sf2560, sf5120, sf10240, spare5, spare4, + spare3, spare2, spare1}, + logicalChannelSR-DelayTimer ENUMERATED { sf20, sf40, sf64, sf128, sf512, sf1024, sf2560, spare1} OPTIONAL -- Need R +} + + + +-- TAG-MAC-CELL-GROUP-CONFIG-STOP +-- TAG-MEAS-CONFIG-START + +MeasConfig ::= SEQUENCE { + -- Measurement objects + measObjectToRemoveList MeasObjectToRemoveList OPTIONAL, -- Need N + measObjectToAddModList MeasObjectToAddModList OPTIONAL, -- Need N + + -- Reporting configurations + reportConfigToRemoveList ReportConfigToRemoveList OPTIONAL, -- Need N + reportConfigToAddModList ReportConfigToAddModList OPTIONAL, -- Need N + + -- Measurement identities + measIdToRemoveList MeasIdToRemoveList OPTIONAL, -- Need N + measIdToAddModList MeasIdToAddModList OPTIONAL, -- Need N + + -- Other parameters + --s-Measure config + s-MeasureConfig CHOICE { + ssb-RSRP RSRP-Range, + csi-RSRP RSRP-Range + } OPTIONAL, -- Need M + + quantityConfig QuantityConfig OPTIONAL, -- Need M + + --Placehold for measGapConfig + measGapConfig MeasGapConfig OPTIONAL, -- Need M + ... +} + +MeasObjectToRemoveList ::= SEQUENCE (SIZE (1..maxNrofObjectId)) OF MeasObjectId + +MeasIdToRemoveList ::= SEQUENCE (SIZE (1..maxNrofMeasId)) OF MeasId + +ReportConfigToRemoveList ::= SEQUENCE (SIZE (1..maxReportConfigId)) OF ReportConfigId + +-- TAG-MEAS-CONFIG-STOP +--TAG-MEAS-GAP-CONFIG-START + +MeasGapConfig ::= SEQUENCE { + gapFR2 SetupRelease { GapConfig } OPTIONAL, + ... +} + +GapConfig ::= SEQUENCE { + gapOffset INTEGER (0..159), + mgl ENUMERATED {ms1dot5, ms3, ms3dot5, ms4, ms5dot5, ms6}, + mgrp ENUMERATED {ms20, ms40, ms80, ms160}, + mgta ENUMERATED {ms0, ms0dot25, ms0dot5}, + ... +} + +-- TAG-MEAS-GAP-CONFIG-STOP +-- TAG-MEAS-ID-START + +MeasId ::= INTEGER (1..maxNrofMeasId) + +-- TAG-MEAS-ID-STOP +-- TAG-MEAS-ID-TO-ADD-MOD-LIST-START + +MeasIdToAddModList ::= SEQUENCE (SIZE (1..maxNrofMeasId)) OF MeasIdToAddMod + +MeasIdToAddMod ::= SEQUENCE { + measId MeasId, + measObjectId MeasObjectId, + reportConfigId ReportConfigId +} + +-- TAG-MEAS-ID-TO-ADD-MOD-LIST-STOP +-- TAG-MEAS-OBJECT-ID-START + +MeasObjectId ::= INTEGER (1..maxNrofObjectId) + +-- TAG-MEAS-OBJECT-ID-STOP +-- TAG-MEAS-OBJECT-NR-START + +MeasObjectNR ::= SEQUENCE { + ssbFrequency ARFCN-ValueNR OPTIONAL, + refFreqCSI-RS ARFCN-ValueNR OPTIONAL, + + --RS configuration (e.g. SMTC window, CSI-RS resource, etc.) + referenceSignalConfig ReferenceSignalConfig, + + --Consolidation of L1 measurements per RS index + absThreshSS-BlocksConsolidation ThresholdNR OPTIONAL, -- Need R + absThreshCSI-RS-Consolidation ThresholdNR OPTIONAL, -- Need R + + --Config for cell measurement derivation + nrofSS-BlocksToAverage INTEGER (2..maxNrofSS-BlocksToAverage) OPTIONAL, -- Need R + nrofCSI-RS-ResourcesToAverage INTEGER (2..maxNrofCSI-RS-ResourcesToAverage) OPTIONAL, -- Need R + + -- Filter coefficients applicable to this measurement object + quantityConfigIndex INTEGER (1..maxNrofQuantityConfig), + + --Frequency-specific offsets + offsetFreq Q-OffsetRangeList, + + -- Cell list + cellsToRemoveList PCI-List OPTIONAL, -- Need N + cellsToAddModList CellsToAddModList OPTIONAL, -- Need N + + -- Black list + blackCellsToRemoveList PCI-RangeIndexList OPTIONAL, -- Need N + blackCellsToAddModList BlackCellsToAddModList OPTIONAL, -- Need N + + -- White list + whiteCellsToRemoveList PCI-RangeIndexList OPTIONAL, -- Need N + whiteCellsToAddModList WhiteCellsToAddModList OPTIONAL, -- Need N + ... +} + +ReferenceSignalConfig::= SEQUENCE { + + + -- SSB configuration for mobility (nominal SSBs, timing configuration) + ssb-ConfigMobility SSB-ConfigMobility OPTIONAL, -- Need M + -- CSI-RS resources to be used for CSI-RS based RRM measurements + csi-rs-ResourceConfigMobility SetupRelease { CSI-RS-ResourceConfigMobility } OPTIONAL-- Need M + +} + +-- A measurement timing configuration +SSB-ConfigMobility::= SEQUENCE { + --Only the values 15, 30 or 60 kHz (<6GHz), 60 or 120 kHz (>6GHz) are applicable + subcarrierSpacing SubcarrierSpacing, + -- The set of SS blocks to be measured within the SMTC measurement duration. + -- Corresponds to L1 parameter 'SSB-measured' (see FFS_Spec, section FFS_Section) + -- When the field is absent the UE measures on all SS-blocks + -- FFS_CHECK: Is this IE placed correctly. + ssb-ToMeasure SetupRelease { SSB-ToMeasure } OPTIONAL, -- Need M + + -- Indicates whether the UE can utilize serving cell timing to derive the index of SS block transmitted by neighbour cell: + useServingCellTimingForSync BOOLEAN, + + -- Primary measurement timing configuration. Applicable for intra- and inter-frequency measurements. + smtc1 SEQUENCE { + -- Periodicity and offset of the measurement window in which to receive SS/PBCH blocks. + -- Periodicity and offset are given in number of subframes. + -- FFS_FIXME: This does not match the L1 parameter table! They seem to intend an index to a hidden table in L1 specs. + -- (see 38.213, section REF): + periodicityAndOffset CHOICE { + sf5 INTEGER (0..4), + sf10 INTEGER (0..9), + sf20 INTEGER (0..19), + sf40 INTEGER (0..39), + sf80 INTEGER (0..79), + sf160 INTEGER (0..159) + }, + -- Duration of the measurement window in which to receive SS/PBCH blocks. It is given in number of subframes + -- (see 38.213, section 4.1) + duration ENUMERATED { sf1, sf2, sf3, sf4, sf5 } + }, + + -- Secondary measurement timing confguration for explicitly signalled PCIs. It uses the offset and duration from smtc1. + -- It is supported only for intra-frequency measurements in RRC CONNECTED. + smtc2 SEQUENCE { + -- PCIs that are known to follow this SMTC. + pci-List SEQUENCE (SIZE (1..maxNrofPCIsPerSMTC)) OF PhysCellId OPTIONAL, -- Need M + -- Periodicity for the given PCIs. Timing offset and Duration as provided in smtc1. + periodicity ENUMERATED {sf5, sf10, sf20, sf40, sf80, sf160, spare2, spare1} + } OPTIONAL,-- Cond IntraFreqConnected + ss-RSSI-Measurement SEQUENCE { + measurementSlots CHOICE { + kHz15 BIT STRING (SIZE(1)), + kHz30 BIT STRING (SIZE(2)), + kHz60 BIT STRING (SIZE(4)), + kHz120 BIT STRING (SIZE(8)) + }, + endSymbol INTEGER(0..13) + } OPTIONAL +} + +CSI-RS-ResourceConfigMobility ::= SEQUENCE { + -- MO specific values + isServingCellMO BOOLEAN, + -- Subcarrier spacing of CSI-RS. + -- Only the values 15, 30 or 60 kHz (<6GHz), 60 or 120 kHz (>6GHz) are applicable. + -- Corresponds to L1 parameter 'Numerology' (see 38.211, section FFS_Section) + subcarrierSpacing SubcarrierSpacing, + -- List of cells + csi-RS-CellList-Mobility SEQUENCE (SIZE (1..maxNrofCSI-RS-CellsRRM)) OF CSI-RS-CellMobility + +} + +CSI-RS-CellMobility ::= SEQUENCE { + cellId PhysCellId, + + csi-rs-MeasurementBW SEQUENCE { + -- Allowed size of the measurement BW in PRBs + -- Corresponds to L1 parameter 'CSI-RS-measurementBW-size' (see FFS_Spec, section FFS_Section) + nrofPRBs ENUMERATED { size24, size48, size96, size192, size264}, + -- Starting PRB index of the measurement bandwidth + -- Corresponds to L1 parameter 'CSI-RS-measurement-BW-start' (see FFS_Spec, section FFS_Section) + -- FFS_Value: Upper edge of value range unclear in RAN1 + startPRB INTEGER(0..2169) + }, + + -- Frequency domain density for the 1-port CSI-RS for L3 mobility + -- Corresponds to L1 parameter 'Density' (see FFS_Spec, section FFS_Section) + density ENUMERATED {d1,d3} OPTIONAL, + + +-- List of resources + csi-rs-ResourceList-Mobility SEQUENCE (SIZE (1..maxNrofCSI-RS-ResourcesRRM)) OF CSI-RS-Resource-Mobility +} + + +CSI-RS-Resource-Mobility ::= SEQUENCE { + csi-RS-Index CSI-RS-Index, + -- Contains periodicity and slot offset for periodic/semi-persistent CSI-RS (see 38.211, section x.x.x.x)FFS_Ref + slotConfig CHOICE { + ms4 INTEGER (0..31), + ms5 INTEGER (0..39), + ms10 INTEGER (0..79), + ms20 INTEGER (0..159), + ms40 INTEGER (0..319) + }, + -- Each CSI-RS resource may be associated with one SSB. If such SSB is indicated, the NW also indicates whether the UE may assume + -- quasi-colocation of this SSB with this CSI-RS reosurce. + -- Corresponds to L1 parameter 'Associated-SSB' (see FFS_Spec, section FFS_Section) + + associatedSSB SEQUENCE { + ssb-Index SSB-Index, + -- The CSI-RS resource is either QCL’ed not QCL’ed with the associated SSB in spatial parameters + -- Corresponds to L1 parameter 'QCLed-SSB' (see FFS_Spec, section FFS_Section) + isQuasiColocated BOOLEAN + } OPTIONAL, -- Cond AssociatedSSB + + + -- Frequency domain allocation within a physical resource block in accordance with 38.211, section 7.4.1.5.3 including table 7.4.1.5.2-1. + -- The number of bits that may be set to one depend on the chosen row in that table. For the choice "other", the row can be determined from + -- the parmeters below and from the number of bits set to 1 in frequencyDomainAllocation. + frequencyDomainAllocation CHOICE { + row1 BIT STRING (SIZE (4)), + row2 BIT STRING (SIZE (12)) + }, + + + -- Time domain allocation within a physical resource block. The field indicates the first OFDM symbol in the PRB used for CSI-RS. + -- Parameter l0 in 38.211, section 7.4.1.5.3. Value 2 is supported only when DL-DMRS-typeA-pos equals 3. + firstOFDMSymbolInTimeDomain INTEGER (0..13), + -- Scrambling ID for CSI-RS(see 38.211, section 7.4.1.5.2) + sequenceGenerationConfig INTEGER (0..1023), + ... +} + +CSI-RS-Index ::= INTEGER (0..maxNrofCSI-RS-ResourcesRRM-1) + +Q-OffsetRangeList ::= SEQUENCE { + rsrpOffsetSSB Q-OffsetRange DEFAULT dB0, + rsrqOffsetSSB Q-OffsetRange DEFAULT dB0, + sinrOffsetSSB Q-OffsetRange DEFAULT dB0, + rsrpOffsetCSI-RS Q-OffsetRange DEFAULT dB0, + rsrqOffsetCSI-RS Q-OffsetRange DEFAULT dB0, + sinrOffsetCSI-RS Q-OffsetRange DEFAULT dB0 +} + +SSB-ToMeasure ::= CHOICE { + -- bitmap for sub 3 GHz + shortBitmap BIT STRING (SIZE (4)), + -- bitmap for 3-6 GHz + mediumBitmap BIT STRING (SIZE (8)), + -- bitmap for above 6 GHz + longBitmap BIT STRING (SIZE (64)) +} + + +ThresholdNR ::= SEQUENCE{ + thresholdRSRP RSRP-Range OPTIONAL, + thresholdRSRQ RSRQ-Range OPTIONAL, + thresholdSINR SINR-Range OPTIONAL +} + +CellsToAddModList ::= SEQUENCE (SIZE (1..maxNrofCellMeas)) OF CellsToAddMod + +CellsToAddMod ::= SEQUENCE { + physCellId PhysCellId, + cellIndividualOffset Q-OffsetRangeList +} + +BlackCellsToAddModList ::= SEQUENCE (SIZE (1..maxNrofPCI-Ranges)) OF BlackCellsToAddMod + +BlackCellsToAddMod ::= SEQUENCE { + pci-RangeIndex PCI-RangeIndex, + pci-Range PCI-Range +} + + +WhiteCellsToAddModList ::= SEQUENCE (SIZE (1..maxNrofPCI-Ranges)) OF WhiteCellsToAddMod + +WhiteCellsToAddMod ::= SEQUENCE { + pci-RangeIndex PCI-RangeIndex, + pci-Range PCI-Range +} + +-- TAG-MEAS-OBJECT-NR-STOP +-- TAG-MEAS-OBJECT-TO-ADD-MOD-LIST-START + +MeasObjectToAddModList ::= SEQUENCE (SIZE (1..maxNrofObjectId)) OF MeasObjectToAddMod + +MeasObjectToAddMod ::= SEQUENCE { + measObjectId MeasObjectId, + measObject CHOICE { + measObjectNR MeasObjectNR, + ... + } +} + +-- TAG-MEAS-OBJECT-TO-ADD-MOD-LIST-STOP +-- TAG-MEAS-RESULTS-START + +MeasResults ::= SEQUENCE { + measId MeasId, + measResultServingFreqList MeasResultServFreqList, + measResultNeighCells CHOICE { + measResultListNR MeasResultListNR, + ... + } OPTIONAL, + ... +} + +MeasResultServFreqList ::= SEQUENCE (SIZE (1..maxNrofServingCells)) OF MeasResultServFreq + +MeasResultServFreq ::= SEQUENCE { + servFreqId ServCellIndex, + measResultServingCell MeasResultNR, + measResultBestNeighCell MeasResultNR, + ... +} + +MeasResultListNR ::= SEQUENCE (SIZE (1..maxCellReport)) OF MeasResultNR + +MeasResultNR ::= SEQUENCE { + physCellId PhysCellId OPTIONAL, + --FFS: Details of cgi info + cgi-Info ENUMERATED {ffsTypeAndValue} OPTIONAL, + measResult SEQUENCE { + cellResults SEQUENCE{ + resultsSSB-Cell MeasQuantityResults OPTIONAL, + resultsCSI-RS-Cell MeasQuantityResults OPTIONAL + }, + rsIndexResults SEQUENCE{ + resultsSSB-Indexes ResultsPerSSB-IndexList OPTIONAL, + resultsCSI-RS-Indexes ResultsPerCSI-RS-IndexList OPTIONAL + } OPTIONAL + }, + ... +} + + +MeasQuantityResults ::= SEQUENCE { + rsrp RSRP-Range OPTIONAL, + rsrq RSRQ-Range OPTIONAL, + sinr SINR-Range OPTIONAL +} + +ResultsPerSSB-IndexList::= SEQUENCE (SIZE (1..maxNrofSSBs)) OF ResultsPerSSB-Index + +ResultsPerSSB-Index ::= SEQUENCE { + ssb-Index SSB-Index, + ssb-Results MeasQuantityResults OPTIONAL +} + +ResultsPerCSI-RS-IndexList::= SEQUENCE (SIZE (1..maxNrofCSI-RS)) OF ResultsPerCSI-RS-Index + +ResultsPerCSI-RS-Index ::= SEQUENCE { + csi-RS-Index CSI-RS-Index, + csi-RS-Results MeasQuantityResults OPTIONAL +} + +-- TAG-MEAS-RESULTS-STOP +-- TAG-MEAS-RESULT-SCG-FAILURE-START + +MeasResultSCG-Failure ::= SEQUENCE { + measResultServFreqList MeasResultServFreqList2NR, + measResultNeighCells MeasResultList2NR, + ... +} + +MeasResultServFreqList2NR ::= SEQUENCE (SIZE (1..maxNrofServingCells)) OF MeasResultServFreq2NR + +MeasResultServFreq2NR ::= SEQUENCE { + ssbFrequency ARFCN-ValueNR OPTIONAL, + refFreqCSI-RS ARFCN-ValueNR OPTIONAL, + measResultServingCell MeasResultNR, + measResultBestNeighCell MeasResultNR OPTIONAL +} + +MeasResultList2NR ::= SEQUENCE (SIZE (1..maxFreq)) OF MeasResult2NR + +MeasResult2NR ::= SEQUENCE { + ssbFrequency ARFCN-ValueNR OPTIONAL, + refFreqCSI-RS ARFCN-ValueNR OPTIONAL, + measResultListNR MeasResultListNR +} + +-- TAG-MEAS-RESULT-SCG-FAILURE-STOP +-- TAG-MEASRESULT-CELL-LIST-SFTD-START + +MeasResultCellListSFTD ::= SEQUENCE (SIZE (1..maxCellSFTD)) OF MeasResultCellSFTD + +MeasResultCellSFTD ::= SEQUENCE { + physCellId PhysCellId, + sfn-OffsetResult INTEGER (0..1023), + frameBoundaryOffsetResult INTEGER (-30720..30719), + rsrp-Result RSRP-Range OPTIONAL +} + +-- TAG-MEASRESULT-CELL-LIST-SFTD-STOP +-- TAG-MULTIFREQUENCYBANDLISTNR-START + +MultiFrequencyBandListNR ::= SEQUENCE (SIZE (1..maxNrofMultiBands)) OF FreqBandIndicatorNR + +-- TAG-MULTIFREQUENCYBANDLISTNR-STOP +-- TAG-NZP-CSI-RS-RESOURCESET-START +NZP-CSI-RS-ResourceSet ::= SEQUENCE { + nzp-CSI-ResourceSetId NZP-CSI-RS-ResourceSetId, + + -- NZP-CSI-RS-Resources assocaited with this NZP-CSI-RS resource set. + -- Corresponds to L1 parameter 'CSI-RS-ResourceConfigList' (see 38.214, section 5.2) + -- For CSI, there are at most 8 NZP CSI RS resources per resource set + nzp-CSI-RS-Resources SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-ResourcesPerSet)) OF NZP-CSI-RS-ResourceId, + + -- Indicates whether repetition is on/off. If set to set to 'OFF', the UE may not assume that the + -- NZP-CSI-RS resources within the resource set are transmitted with the same downlink spatial domain transmission filter + -- and with same NrofPorts in every symbol. + -- Corresponds to L1 parameter 'CSI-RS-ResourceRep' (see 38.214, sections 5.2.2.3.1 and 5.1.6.1.2) + -- Can only be configured for CSI-RS resource sets which are associated with CSI-ReportConfig with report of L1 RSRP or “no report” + repetition ENUMERATED { on, off } OPTIONAL, + + -- Offset X between the slot containing the DCI that triggers a set of aperiodic NZP CSI-RS resources and the slot in which the + -- CSI-RS resource set is transmitted. When the field is absent the UE applies the value 0. + -- Corresponds to L1 parameter 'Aperiodic-NZP-CSI-RS-TriggeringOffset' (see 38,214, section FFS_Section) + aperiodicTriggeringOffset INTEGER(0..4) OPTIONAL, -- Need S + + -- Indicates that the antenna port for all NZP-CSI-RS resources in the CSI-RS resource set is same. + -- Corresponds to L1 parameter 'TRS-Info' (see 38.214, section 5.2.2.3.1) + trs-Info ENUMERATED {true} OPTIONAL, + ... +} + +-- TAG-NZP-CSI-RS-RESOURCESET-STOP +-- TAG-NZP-CSI-RS-RESOURCESETID-START +NZP-CSI-RS-ResourceSetId ::= INTEGER (0..maxNrofNZP-CSI-RS-ResourceSets-1) + +-- TAG-NZP-CSI-RS-RESOURCESETID-STOP +-- TAG-NZP-CSI-RS-RESOURCE-START +NZP-CSI-RS-Resource ::= SEQUENCE { + nzp-CSI-RS-ResourceId NZP-CSI-RS-ResourceId, + + -- OFDM symbol location(s) in a slot and subcarrier occupancy in a PRB of the CSI-RS resource + resourceMapping CSI-RS-ResourceMapping, + -- Power offset of NZP CSI-RS RE to PDSCH RE. Value in dB. Corresponds to L1 parameter Pc (see 38.214, sections 5.2.2.3.1 and 4.1) + powerControlOffset INTEGER(-8..15), + -- Power offset of NZP CSI-RS RE to SS RE. Value in dB. Corresponds to L1 parameter 'Pc_SS' (see 38.214, section 5.2.2.3.1) + powerControlOffsetSS ENUMERATED{db-3, db0, db3, db6} OPTIONAL, + -- Scrambling ID (see 38.214, section 5.2.2.3.1) + scramblingID ScramblingId, + + -- Periodicity and slot offset sl1 corresponds to a periodicity of 1 slot, sl2 to a periodicity of two slots, and so on. + -- The corresponding offset is also given in number of slots. Corresponds to L1 parameter 'CSI-RS-timeConfig' (see 38.214, section 5.2.2.3.1) + periodicityAndOffset CSI-ResourcePeriodicityAndOffset OPTIONAL, --Cond PeriodicOrSemiPersistent + + -- For a target periodic CSI-RS, contains a reference to one TCI-State in TCI-States for providing the QCL source and + -- QCL type. For periodic CSI-RS, the source can be SSB or another periodic-CSI-RS. + -- Corresponds to L1 parameter 'QCL-Info-PeriodicCSI-RS' (see 38.214, section 5.2.2.3.1) + qcl-InfoPeriodicCSI-RS TCI-StateId OPTIONAL, --Cond Periodic + ... +} + +-- TAG-NZP-CSI-RS-RESOURCE-STOP +-- TAG-NZP-CSI-RS-RESOURCEID-START +NZP-CSI-RS-ResourceId ::= INTEGER (0..maxNrofNZP-CSI-RS-Resources-1) + +-- TAG-NZP-CSI-RS-RESOURCEID-STOP +-- TAG-P-MAX-START + +P-Max ::= INTEGER (-30..33) + +-- TAG-P-MAX-STOP +-- TAG-PCI-LIST-START + +PCI-List ::= SEQUENCE (SIZE (1..maxNrofCellMeas)) OF PhysCellId + +-- TAG-PCI-LIST-STOP +-- TAG-PCI-RANGE-START + +PCI-Range ::= SEQUENCE { + start PhysCellId, + range ENUMERATED { + n4, n8, n12, n16, n24, n32, n48, n64, n84, + n96, n128, n168, n252, n504, n1008, + spare1} OPTIONAL -- Need Nss +} + +-- TAG-PCI-RANGE-STOP +-- TAG-PCI-RANGE-INDEX-START + +PCI-RangeIndex ::= INTEGER (1..maxNrofPCI-Ranges) + + +-- TAG-PCI-RANGE-INDEX-STOP +-- TAG-PCI-RANGE-INDEX-LIST-START + +PCI-RangeIndexList ::= SEQUENCE (SIZE (1..maxNrofPCI-Ranges)) OF PCI-RangeIndex + +-- TAG-PCI-Range-INDEX-LIST-STOP +-- TAG-PDCCH-CONFIG-START + +PDCCH-Config ::= SEQUENCE { + -- List of UE specifically configured Control Resource Sets (CORESETs) to be used by the UE. + -- The network configures at most 3 CORESETs per BWP per cell (including the initial CORESET). + controlResourceSetToAddModList SEQUENCE(SIZE (1..3)) OF ControlResourceSet OPTIONAL, + controlResourceSetToReleaseList SEQUENCE(SIZE (1..3)) OF ControlResourceSetId OPTIONAL, + + -- List of UE specifically configured Control Resource Sets (CORESETs). + -- The network configures at most 10 Search Spaces per BWP per cell (including the initial Search Space). + searchSpacesToAddModList SEQUENCE(SIZE (1..10)) OF SearchSpace OPTIONAL, + searchSpacesToReleaseList SEQUENCE(SIZE (1..10)) OF SearchSpaceId OPTIONAL, + + -- Configuration of downlink preemtption indications to be monitored in this cell. + -- Corresponds to L1 parameter 'Preemp-DL' (see 38.214, section 11.2) + -- FFS_RAN1: LS R1-1801281 indicates this is "Per Cell (but association with each configured BWP is needed)" => Unclear, keep on BWP for now. + downlinkPreemption SetupRelease { DownlinkPreemption } OPTIONAL, -- Need M + + -- Configuration of Slot-Format-Indicators to be monitored in this cell + + -- FFS_RAN1 discusses still whether this SFI payload configuration is BWP- or Cell-Specific. + slotFormatIndicator SetupRelease { SlotFormatIndicator } OPTIONAL, -- Need M + -- Enable and configure reception of group TPC commands for PUSCH + tpc-PUSCH SetupRelease { PUSCH-TPC-CommandConfig } OPTIONAL, -- Need M + + -- Enable and configure reception of group TPC commands fpr PUCCH + tpc-PUCCH SetupRelease { PUCCH-TPC-CommandConfig } OPTIONAL, -- Cond PUCCH-CellOnly + + ... +} + +-- TAG-PDCCH-CONFIG-STOP +-- TAG-PDCCH-CONFIGCOMMON-START + +PDCCH-ConfigCommon ::= SEQUENCE { + + -- A list of common control resource sets. Only CORESETs with ControlResourceSetId = 0 or 1 are allowed. The CORESET#0 + -- corresponds to the CORESET configured in MIB (see pdcch-ConfigSIB1) and is used to provide that information to the UE + -- by dedicated signalling during handover and (P)SCell addition. The CORESET#1 may be configured an used for RAR + -- (see ra-ControlResourceSet). + commonControlResourcesSets SEQUENCE (SIZE(1..2)) OF ControlResourceSet OPTIONAL, -- Need R + + -- A list of additional common search spaces. + commonSearchSpaces SEQUENCE (SIZE(1..4)) OF SearchSpace OPTIONAL, -- Need R + + -- ID of the search space for SIB1 message. + + -- Corresponds to L1 parameter 'rmsi-SearchSpace' (see 38.213, section 10) + searchSpaceSIB1 SearchSpaceId OPTIONAL, -- Need R + -- ID of the Search space for other system information, i.e., SIB2 and beyond. + -- Corresponds to L1 parameter 'osi-SearchSpace' (see 38.213, section 10) + -- If the field is absent, the monitoring occasions are derived as described in 38.213, section 10.1 and section 13. + searchSpaceOtherSystemInformation SearchSpaceId OPTIONAL, -- Need R + + -- ID of the Search space for paging. Corresponds to L1 parameter 'paging-SearchSpace' (see 38.213, section 10) + -- If the field is absent, the monitoring occasions are derived as described in 38.213, section 10.1 and section 13. + pagingSearchSpace SearchSpaceId OPTIONAL, -- Need R + + -- CORESET configured for random access. When the field is absent the UE uses the CORESET according to pdcch-ConfigSIB1 + -- which is associated with ControlResourceSetId = 0. + -- Corresponds to L1 parameter 'rach-coreset-configuration' (see 38.211?, section FFS_Section) + ra-ControlResourceSet ControlResourceSetId OPTIONAL, -- Need S + -- ID of the Search space for random access procedure. Corresponds to L1 parameter 'ra-SearchSpace' (see 38.214?, section FFS_Section) + -- If the field is absent, the monitoring occasions are derived as described in 38.213, section 10.1 and section 13. + ra-SearchSpace SearchSpaceId OPTIONAL, -- Need R + ... + +} + +-- TAG-PDCCH-CONFIGCOMMON-STOP +-- TAG-PDCP-CONFIG-START + +PDCP-Config ::= SEQUENCE { + drb SEQUENCE { + discardTimer ENUMERATED {ms10, ms20, ms30, ms40, ms50, ms60, ms75, ms100, ms150, ms200, ms250, ms300, ms500, ms750, ms1500, infinity} OPTIONAL, -- Cond Setup + pdcp-SN-SizeUL ENUMERATED {len12bits, len18bits} OPTIONAL, -- Cond Setup2 + pdcp-SN-SizeDL ENUMERATED {len12bits, len18bits} OPTIONAL, -- Cond Setup2 + headerCompression CHOICE { + notUsed NULL, + rohc SEQUENCE { + maxCID INTEGER (1..16383) DEFAULT 15, + profiles SEQUENCE { + profile0x0001 BOOLEAN, + profile0x0002 BOOLEAN, + profile0x0003 BOOLEAN, + profile0x0004 BOOLEAN, + profile0x0006 BOOLEAN, + profile0x0101 BOOLEAN, + profile0x0102 BOOLEAN, + profile0x0103 BOOLEAN, + profile0x0104 BOOLEAN + }, + drb-ContinueROHC BOOLEAN + }, + uplinkOnlyROHC SEQUENCE { + maxCID INTEGER (1..16383) DEFAULT 15, + profiles SEQUENCE { + profile0x0006 BOOLEAN + }, + drb-ContinueROHC BOOLEAN + }, + ... + }, + integrityProtection ENUMERATED { enabled } OPTIONAL, -- Cond ConnectedTo5GC + statusReportRequired ENUMERATED { true } OPTIONAL, -- Cond Rlc-AM + outOfOrderDelivery BOOLEAN + } OPTIONAL, -- Cond DRB + -- FFS / TODO: Handle more than two secondary cell groups + moreThanOneRLC SEQUENCE { + primaryPath SEQUENCE { + cellGroup CellGroupId OPTIONAL, -- Need R + logicalChannel LogicalChannelIdentity OPTIONAL -- Need R + }, + ul-DataSplitThreshold UL-DataSplitThreshold OPTIONAL, -- Cond SplitBearer + pdcp-Duplication ENUMERATED { true } OPTIONAL -- Need R + } OPTIONAL, -- Cond MoreThanOneRLC + + t-Reordering ENUMERATED { + ms0, ms1, ms2, ms4, ms5, ms8, ms10, ms15, ms20, ms30, ms40, ms50, ms60, ms80, ms100, ms120, ms140, ms160, ms180, ms200, ms220, + ms240, ms260, ms280, ms300, ms500, ms750, ms1000, ms1250, ms1500, ms1750, ms2000, ms2250, ms2500, ms2750, + ms3000, spare28, spare27, spare26, spare25, spare24, spare23, spare22, spare21, spare20, + spare19, spare18, spare17, spare16, spare15, spare14, spare13, spare12, spare11, spare10, spare09, + spare08, spare07, spare06, spare05, spare04, spare03, spare02, spare01 } OPTIONAL, -- Need S + + + ... +} + +UL-DataSplitThreshold ::= ENUMERATED { + b0, b100, b200, b400, b800, b1600, b3200, b6400, b12800, b25600, b51200, b102400, b204800, + b409600, b819200, b1228800, b1638400, b2457600, b3276800, b4096000, b4915200, b5734400, + b6553600, infinity, spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1} + +-- TAG-PDCP-CONFIG-STOP +-- TAG-PDSCH-CONFIG-START + +PDSCH-Config ::= SEQUENCE { + -- Identifer used to initalite data scrambling (c_init) for both PDSCH. + -- Corresponds to L1 parameter 'Data-scrambling-Identity' (see 38,214, section FFS_Section) + -- FFS:_Replace by tye ScramblingId used in other places? + dataScramblingIdentityPDSCH INTEGER (0..1007) OPTIONAL, + + -- DMRS configuration for PDSCH transmissions using PDSCH mapping type A (chosen dynamically via PDSCH-TimeDomainResourceAllocation). + dmrs-DownlinkForPDSCH-MappingTypeA SetupRelease { DMRS-DownlinkConfig } OPTIONAL, -- Need M + -- DMRS configuration for PDSCH transmissions using PDSCH mapping type B (chosen dynamically via PDSCH-TimeDomainResourceAllocation). + dmrs-DownlinkForPDSCH-MappingTypeB SetupRelease { DMRS-DownlinkConfig } OPTIONAL, -- Need M + + + -- A list of Transmission Configuration Indicator (TCI) states for dynamically indicating (over DCI) a transmission configuration + -- which includes QCL-relationships between the DL RSs in one RS set and the PDSCH DMRS ports + -- (see 38.214, section 5.1.4) + tci-StatesToAddModList SEQUENCE (SIZE(1..maxNrofTCI-States)) OF TCI-State OPTIONAL, -- Need N + tci-StatesToReleaseList SEQUENCE (SIZE(1..maxNrofTCI-States)) OF TCI-StateId OPTIONAL, -- Need N + + -- Interleaving unit configurable between 2 and 4 PRBs + -- Corresponds to L1 parameter 'VRB-to-PRB-interleaver' (see 38.211, section 6.3.1.6) + vrb-ToPRB-Interleaver ENUMERATED {n2, n4}, + + -- Configuration of resource allocation type 0 and resource allocation type 1 for non-fallback DCI + -- Corresponds to L1 parameter 'Resouce-allocation-config' (see 38.214, section 5.1.2) + resourceAllocation ENUMERATED { resourceAllocationType0, +resourceAllocationType1, +dynamicSwitch}, + + -- List of time-domain configurations for timing of DL assignment to DL data. If configured, the values provided herein + -- override the values received in corresponding PDSCH-ConfigCommon. + pdsch-AllocationList SEQUENCE (SIZE(1..maxNrofDL-Allocations)) OF PDSCH-TimeDomainResourceAllocation OPTIONAL, -- Need R + -- Number of repetitions for data. Corresponds to L1 parameter 'aggregation-factor-DL' (see 38.214, section FFS_Section) + -- When the field is absent the UE applies the value 1 + pdsch-AggregationFactor ENUMERATED { n2, n4, n8 } OPTIONAL, -- Need S + + -- Resources patterns which the UE should rate match PDSCH around. The UE rate matches around the union of all resources + -- indicated in the nexted bitmaps. Corresponds to L1 parameter 'Resource-set-BWP' (see 38.214, section 5.1.2.2.3) + -- FFS: RAN1 indicates that there should be a set of patterns per cell and one per BWP => Having both seems unnecessary. + + rateMatchPatternToAddModList SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPattern OPTIONAL, -- Need N + rateMatchPatternToReleaseList SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPatternId OPTIONAL, -- Need N + + -- The IDs of a first group of RateMatchPatterns defined in the rateMatchPatternToAddModList. + -- Corresponds to L1 parameter 'Resource-set-group-1'. (see 38.214, section FFS_Section) + rateMatchPatternGroup1 SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPatternId OPTIONAL, -- Need R + -- The IDs of a second group of RateMatchPatterns defined in the rateMatchPatternToAddModList + -- Corresponds to L1 parameter 'Resource-set-group-2'. (see 38.214, section FFS_Section) + rateMatchPatternGroup2 SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPatternId OPTIONAL, -- Need R + + + -- Selection between config 1 and config 2 for RBG size for PDSCH. Corresponds to L1 parameter 'RBG-size-PDSCH' (see 38.214, section 5.1.2.2.1) + rbg-Size ENUMERATED {config1, config2}, + + -- Indicates which MCS table the UE shall use for PDSCH. Corresponds to L1 parameter 'MCS-Table-PDSCH' (see 38.214, section 5.1.3.1). + mcs-Table ENUMERATED {qam64, qam256}, + + -- Maximum number of code words that a single DCI may schedule. This changes the number of MCS/RV/NDI bits in the DCI message from 1 to 2. + maxNrofCodeWordsScheduledByDCI ENUMERATED {n1, n2} OPTIONAL, -- Need R + + + -- Indicates the PRB bundle type and bundle size(s). If "dynamic" is chosen, the actual BundleSizeSet to use is indicated via DCI. + -- If a bundleSize(Set) value is absent, the UE applies the value n2. Corresponds to L1 parameter 'PRB_bundling' + -- (see 38.214, section 5.1.2.3) + prb-BundlingType CHOICE { + static SEQUENCE { + bundleSize ENUMERATED { n4, wideband } OPTIONAL -- Need S + }, + dynamic SEQUENCE { + bundleSizeSet1 ENUMERATED { n4, wideband, n2-wideband, n4-wideband } OPTIONAL, -- Need S + bundleSizeSet2 ENUMERATED { n4, wideband } OPTIONAL -- Need S + } + }, + + -- A list of Zero-Power (ZP) CSI-RS resources used for PDSCH rate-matching. + -- Corresponds to L1 parameter 'ZP-CSI-RS-ResourceConfigList' (see 38.214, section FFS_Section) + zp-CSI-RS-ResourceToAddModList SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Resources)) OF ZP-CSI-RS-Resource OPTIONAL, -- Need N + zp-CSI-RS-ResourceToReleaseList SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Resources)) OF ZP-CSI-RS-ResourceId OPTIONAL, -- Need M + + -- A list of sets. Each set contains a set-ID and the IDs of one or more ZP-CSI-RS-Resources (the actual resources are defined in the + -- zp-CSI-RS-ResourceToAddModList). The network triggers a set by indicating its set-ID (ZP-CSI-RS-ResourceSetId) in the DCI payload. + -- The resources referenced in these sets are confgiured with resourceType 'aperiodic'. + -- Corresponds to L1 parameter ' ZP-CSI-RS-ResourceSetConfigList' (see 38.214, section FFS_Section) + aperiodic-ZP-CSI-RS-ResourceSetsToAddModList SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Sets)) OF ZP-CSI-RS-ResourceSet OPTIONAL, -- Need N + aperiodic-ZP-CSI-RS-ResourceSetsToReleaseList SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Sets)) OF ZP-CSI-RS-ResourceSetId OPTIONAL, -- Need N + + -- A list of sets. Each set contains a set-ID and the IDs of one or more ZP-CSI-RS-Resources (the actual resources are defined in the + -- zp-CSI-RS-ResourceToAddModList). The network triggers a set by indicating its set-ID (ZP-CSI-RS-ResourceSetId) in the MAC CE. + -- The resources referenced in these sets are confgiured with resourceType 'semi-persistent'. + -- Corresponds to L1 parameter 'SP-ZP-CSI-RS-Resource-List' (see 38.214, section 5.1.4_Section) + sp-ZP-CSI-RS-ResourceSetsToAddModList SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Sets)) OF ZP-CSI-RS-ResourceSet OPTIONAL, -- Need N + sp-ZP-CSI-RS-ResourceSetsToReleaseList SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Sets)) OF ZP-CSI-RS-ResourceSetId OPTIONAL, -- Need N + + ... +} + + + + +-- TAG-PDSCH-CONFIG-STOP +-- TAG-PDSCH-CONFIGCOMMON-START + +PDSCH-ConfigCommon ::= SEQUENCE { + + -- List of time-domain configurations for timing of DL assignment to DL data + pdsch-AllocationList SEQUENCE (SIZE(1..maxNrofDL-Allocations)) OF PDSCH-TimeDomainResourceAllocation OPTIONAL, -- Need R + + ... +} + +-- TAG-PDSCH-CONFIGCOMMON-STOP +-- TAG-PDSCH-SERVINGCELLCONFIG-START + +PDSCH-ServingCellConfig ::= SEQUENCE { + -- Enables and configures code-block-group (CBG) based transmission (see 38.213, section 9.1.1) + codeBlockGroupTransmission SetupRelease { PDSCH-CodeBlockGroupTransmission } OPTIONAL, -- Need M + -- Accounts for overhead from CSI-RS, CORESET, etc. If the field is absent, the UE applies value xOh0. + -- Corresponds to L1 parameter 'Xoh-PDSCH' (see 38.214, section 5.1.3.2) + xOverhead ENUMERATED { xOh6, xOh12, xOh18 } OPTIONAL, -- Need S + -- The number of HARQ processes to be used on the PDSCH of a serving cell. n2 corresponds to 2 HARQ processes, n4 to 4 HARQ processes + -- and so on. If the field is absent, the UE uses 8 HARQ processes. + -- Corresponds to L1 parameter 'number-HARQ-process-PDSCH' (see 38.214, section REF) + nrofHARQ-ProcessesForPDSCH ENUMERATED {n2, n4, n6, n10, n12, n16} OPTIONAL, -- Need S + -- The ID of the serving cell (of the same cell group) to use for PUCCH. + -- If the field is absent, the UE sends the HARQ feedback on the PUCCH of the SpCell of this cell group. + pucch-Cell ServCellIndex OPTIONAL , -- Cond SCellAddOnly + ... +} + +PDSCH-CodeBlockGroupTransmission ::= SEQUENCE { + -- Maximum number of code-block-groups (CBGs) per TB. In case of multiple CW the maximum CBG is 4 (see 38.213, section 9.1.1) + maxCodeBlockGroupsPerTransportBlock ENUMERATED {n2, n4, n6, n8}, + -- Indicates whether CBGFI for CBG based (re)transmission in DL is enabled (true). (see 38.212, section 7.3.1.2.2) + codeBlockGroupFlushIndicator BOOLEAN, + ... +} + +-- TAG-PDSCH-SERVINGCELLCONFIG-STOP +-- TAG-PDSCH-TIMEDOMAINRESOURCEALLOCATION-START + +PDSCH-TimeDomainResourceAllocation ::= SEQUENCE { + -- Corresponds to L1 parameter 'K0' (see 38.214, section FFS_Section) + -- When the field is absent the UE applies the value 0 + k0 INTEGER (1..3) OPTIONAL, -- Need S + -- PDSCH mapping type. Corresponds to L1 parameter 'Mapping-type' (see 38.214, section FFS_Section) + mappingType ENUMERATED {typeA, typeB}, + -- An index into a table/equation in RAN1 specs capturing valid combinations of start symbol and length (jointly encoded) + -- Corresponds to L1 parameter 'Index-start-len' (see 38.214, section FFS_Section) + startSymbolAndLength BIT STRING (SIZE (7)) +} + +-- TAG-PDSCH-TIMEDOMAINRESOURCEALLOCATION-STOP +-- TAG-PHYS-CELL-ID-START + +PhysCellId ::= INTEGER (0..1007) + +-- TAG-PHYS-CELL-ID-STOP +-- TAG-PRB-ID-START + +PRB-Id ::= INTEGER (0..maxNrofPhysicalResourceBlocks-1) + +-- TAG-PRB-ID-STOP +-- TAG-PTRS-DOWNLINKCONFIG-START + +PTRS-DownlinkConfig ::= SEQUENCE { + -- Presence and frequency density of DL PT-RS as a function of Scheduled BW + -- If the field is absent, the UE uses K_PT-RS = 2. + -- Corresponds to L1 parameter 'DL-PTRS-frequency-density-table' (see 38.214, section 5.1) + frequencyDensity SEQUENCE (SIZE (2)) OF INTEGER (1..276) OPTIONAL, -- Need S + -- Presence and time density of DL PT-RS as a function of MCS. The value 29 is only applicable for MCS Table 5.1.3.1-1 (38.214) + -- If the field is absent, the UE uses L_PT-RS = 1. + -- Corresponds to L1 parameter 'DL-PTRS-time-density-table' (see 38.214, section 5.1) + timeDensity SEQUENCE (SIZE (3)) OF INTEGER (0..29) OPTIONAL, -- Need S + -- EPRE ratio between PTRS and PDSCH. Value 0 correspond to the codepoint ”00” in table 4.1-2. Value 1 corresponds to codepoint ”01” + -- If the field is not provided, the UE applies value 0. Corresponds to L1 parameter 'DL-PTRS-EPRE-ratio' (see 38.214, section 4.1) + epre-RatioPort1 INTEGER (0..3) OPTIONAL, -- Need S + -- EPRE ratio between PTRS and PDSCH. Value 0 correspond to the codepoint ”00” in table 4.1-2. Value 1 corresponds to codepoint ”01”. + -- If the field is not provided, the UE applies value 0. Corresponds to L1 parameter 'DL-PTRS-EPRE-ratio' (see 38.214, section 4.1) + epre-RatioPort2 SEQUENCE (SIZE (1..2)) OF INTEGER (0..3) OPTIONAL, -- Cond TwoPorts + -- Indicates the subcarrier offset for DL PTRS. If the field is absent, the UE applies the value offset00. + -- Corresponds to L1 parameter 'DL-PTRS-RE-offset' (see 38.214, section 5.1.6.3) + resourceElementOffset ENUMERATED { offset01, offset10, offset11 } OPTIONAL, -- Need S + ... +} + +-- TAG-PTRS-DOWNLINKCONFIG-STOP +-- TAG-PTRS-UPLINKCONFIG-START + +PTRS-UplinkConfig ::= SEQUENCE { + + modeSpecificParameters CHOICE { + -- Configuration of UL PTRS for CP-OFDM + cp-OFDM SEQUENCE { + -- Presence and frequency density of UL PT-RS for CP-OFDM waveform as a function of scheduled BW + -- If the field is absent, the UE uses K_PT-RS = 2. + -- Corresponds to L1 parameter 'UL-PTRS-frequency-density-table' (see 38.214, section 6.1) + frequencyDensity SEQUENCE (SIZE (2)) OF INTEGER (1..276) OPTIONAL, -- Need S + -- Presence and time density of UL PT-RS for CP-OFDM waveform as a function of MCS + -- If the field is absent, the UE uses L_PT-RS = 1. + -- Corresponds to L1 parameter 'UL-PTRS-time-density-table' (see 38.214, section 6.1) + timeDensity SEQUENCE (SIZE (3)) OF INTEGER (0..29) OPTIONAL, -- Need S + -- The maximum number of UL PTRS ports for CP-OFDM. + -- Corresponds to L1 parameter 'UL-PTRS-ports' (see 38.214, section 6.2.3.1) + maxNrofPorts ENUMERATED {n1, n2}, + -- Indicates the subcarrier offset for UL PTRS for CP-OFDM. + -- Corresponds to L1 parameter 'UL-PTRS-RE-offset' (see 38.214, section 6.1) + resourceElementOffset ENUMERATED {offset01, offset10, offset11 } OPTIONAL, -- Need S + -- UL PTRS power boosting factor per PTRS port. Corresponds to L1 parameter 'UL-PTRS-power' (see 38.214, section 6.1, table 6.2.3-5) + ptrs-Power ENUMERATED {p00, p01, p10, p11} + }, + -- Configuration of UL PTRS for DFT-S-OFDM. + dft-S-OFDM SEQUENCE { + -- Sample density of PT-RS for DFT-s-OFDM, pre-DFT, indicating a set of thresholds T={NRBn,n=0,1,2,3,4}, + -- that indicates dependency between presence of PT-RS and scheduled BW and the values of X and K the UE should + -- use depending on the scheduled BW according to the table in 38.214 FFS_Section. + -- Corresponds to L1 parameter 'UL-PTRS-pre-DFT-density' (see 38.214, section 6.1, 6.2.3-3) + sampleDensity SEQUENCE (SIZE (5)) OF INTEGER (1..276), + -- Time density (OFDM symbol level) of PT-RS for DFT-s-OFDM. If the value is absent, the UE applies value d1. + -- Corresponds to L1 parameter 'UL-PTRS-time-density-transform-precoding' (see 38.214, section 6.1) + timeDensity ENUMERATED {d2} OPTIONAL -- Need S + } + } OPTIONAL, -- Cond M + ... +} + +-- TAG-PTRS-UPLINKCONFIG-STOP +-- TAG-PUCCH-CONFIG-START + +PUCCH-Config ::= SEQUENCE { + -- Lists for adding and releasing PUCCH resource sets (see 38.213, section 9.2) + resourceSetToAddModList SEQUENCE (SIZE (1..maxNrofPUCCH-ResourceSets)) OF PUCCH-ResourceSet OPTIONAL, -- Need N + resourceSetToReleaseList SEQUENCE (SIZE (1..maxNrofPUCCH-ResourceSets)) OF PUCCH-ResourceSetId OPTIONAL, -- Need N + + -- Lists for adding and releasing PUCCH resources applicable for the UL BWP and serving cell in which the PUCCH-Config + -- is defined. The resources defined herein are referred to from other parts of the configuration to determine which + -- resource the UE shall use for which report. + resourceToAddModList SEQUENCE (SIZE (1..maxNrofPUCCH-Resources)) OF PUCCH-Resource OPTIONAL, -- Need N + resourceToReleaseList SEQUENCE (SIZE (1..maxNrofPUCCH-Resources)) OF PUCCH-ResourceId OPTIONAL, -- Need N + + -- Parameters that are common for all PUCCH resources of format 1 + format1 SetupRelease { PUCCH-FormatConfig } OPTIONAL, -- Need M + -- Parameters that are common for all PUCCH resources of format 2 + format2 SetupRelease { PUCCH-FormatConfig } OPTIONAL, -- Need M + -- Parameters that are common for all PUCCH resources of format 3 + format3 SetupRelease { PUCCH-FormatConfig } OPTIONAL, -- Need M + -- Parameters that are common for all PUCCH resources of format 4 + format4 SetupRelease { PUCCH-FormatConfig } OPTIONAL, -- Need M + + schedulingRequestResourceToAddModList SEQUENCE (SIZE (1..maxNrofSR-Resources)) OF SchedulingRequestResourceConfig OPTIONAL, -- Need M + schedulingRequestResourceToReleaseList SEQUENCE (SIZE (1..maxNrofSR-Resources)) OF SchedulingRequestResourceId OPTIONAL, -- Need M + + multi-CSI-PUCCH-ResourceList SEQUENCE (SIZE (1..2)) OF PUCCH-ResourceId OPTIONAL,-- Need M + + -- List of timiing for given PDSCH to the DL ACK. In this version of the specification only the values [0..8] are applicable. + -- Corresponds to L1 parameter 'Slot-timing-value-K1' (see 38.213, section FFS_Section) + dl-DataToUL-ACK SEQUENCE (SIZE (8)) OF INTEGER (0..15) OPTIONAL, -- Need M + + -- Configuration of the spatial relation between a reference RS and PUCCH. Reference RS can be SSB/CSI-RS/SRS. + -- If the list has more than one element, MAC-CE selects a single element (see 38.321, section FFS_Section). + -- Corresponds to L1 parameter 'PUCCH-SpatialRelationInfo' (see 38.213, section FFS_Section) + spatialRelationInfoToAddModList SEQUENCE (SIZE (1..maxNrofSpatialRelationInfos)) OF PUCCH-SpatialRelationInfo OPTIONAL, -- Need N + spatialRelationInfoToReleaseList SEQUENCE (SIZE (1..maxNrofSpatialRelationInfos)) OF PUCCH-SpatialRelationInfoId OPTIONAL, -- Need N + + pucch-PowerControl PUCCH-PowerControl OPTIONAL, -- Need M + ... +} + +PUCCH-FormatConfig ::= SEQUENCE { + -- Enabling inter-slot frequency hopping when PUCCH Format 1, 3 or 4 is repetead over multiple slots. + -- The field is not applicable for format 2. + interslotFrequencyHopping ENUMERATED {enabled} OPTIONAL, -- Need R + -- Enabling 2 DMRS symbols per hop of a PUCCH Format 3 or 4 if both hops are more than X symbols when FH is enabled (X=4). + -- Enabling 4 DMRS sybmols for a PUCCH Format 3 or 4 with more than 2X+1 symbols when FH is disabled (X=4). + -- Corresponds to L1 parameter 'PUCCH-F3-F4-additional-DMRS' (see 38.213, section 9.2.1) + -- The field is not applicable for format 1 and 2. + additionalDMRS ENUMERATED {true} OPTIONAL, -- Need R + -- Max coding rate to determine how to feedback UCI on PUCCH for format 2, 3 or 4 + -- Corresponds to L1 parameter 'PUCCH-F2-maximum-coderate', 'PUCCH-F3-maximum-coderate' and 'PUCCH-F4-maximum-coderate' + -- (see 38.213, section 9.2.5) + -- The field is not applicable for format 1. + maxCodeRate PUCCH-MaxCodeRate OPTIONAL, -- Need R + -- Number of slots with the same PUCCH F1, F3 or F4. When the field is absent the UE applies the value n1. + -- Corresponds to L1 parameter 'PUCCH-F1-number-of-slots', 'PUCCH-F3-number-of-slots' and 'PUCCH-F4-number-of-slots' + -- (see 38.213, section 9.2.6) + -- The field is not applicable for format 2. + nrofSlots ENUMERATED {n2,n4,n8} OPTIONAL, -- Need S + -- Enabling pi/2 BPSK for UCI symbols instead of QPSK for PUCCH. + -- Corresponds to L1 parameter 'PUCCH-PF3-PF4-pi/2PBSK' (see 38.213, section 9.2.5) + -- The field is not applicable for format 1 and 2. + pi2PBSK ENUMERATED {enabled} OPTIONAL, -- Need R + -- Enabling simultaneous transmission of CSI and HARQ-ACK feedback with or without SR with PUCCH Format 2, 3 or 4 + -- Corresponds to L1 parameter 'PUCCH-F2-Simultaneous-HARQ-ACK-CSI', 'PUCCH-F3-Simultaneous-HARQ-ACK-CSI' and + -- 'PUCCH-F4-Simultaneous-HARQ-ACK-CSI' (see 38.213, section 9.2.5) + -- When the field is absent the UE applies the value OFF + -- The field is not applicable for format 1. + simultaneousHARQ-ACK-CSI ENUMERATED {true} OPTIONAL -- Need R +} + +PUCCH-MaxCodeRate ::= ENUMERATED {zeroDot08, zeroDot15, zeroDot25, zeroDot35, zeroDot45, zeroDot60, zeroDot80} + +PUCCH-SpatialRelationInfo ::= SEQUENCE { + pucch-SpatialRelationInfoId PUCCH-SpatialRelationInfoId, + referenceSignal CHOICE { + ssb-Index SSB-Index, + csi-RS-Index NZP-CSI-RS-ResourceId, + srs SRS-ResourceId + }, + pucch-PathlossReferenceRS-Id PUCCH-PathlossReferenceRS-Id, + p0-PUCCH-Id P0-PUCCH-Id, + closedLoopIndex ENUMERATED { i0, i1 } +} + +PUCCH-SpatialRelationInfoId ::= INTEGER (1..maxNrofSpatialRelationInfos) + +-- A set with one or more PUCCH resources +PUCCH-ResourceSet ::= SEQUENCE { + pucch-ResourceSetId PUCCH-ResourceSetId, + + -- PUCCH resources of format0 and format1 are only allowed in the first PUCCH reosurce set, + -- i.e., in a PUCCH-ResourceSet with pucch-ResourceSetId = 0. This set may contain between 8 and 32 resources. + -- PUCCH resources of format2, format3 and format4 are only allowed in a PUCCH-ReosurceSet with pucch-ResourceSetId > 0. If present, these sets must contain 8 resources each. + -- The UE chooses a PUCCH-Resource from this list based on the 3-bit PUCCH resource indicator field in DCI as + -- speciied in 38.213, FFS_section. + -- Note that this list contains only a list of resource IDs. The actual resources are configured in PUCCH-Config. + resources SEQUENCE (SIZE (8..maxNrofPUCCH-ResourcesPerSet)) OF PUCCH-ResourceId, + + -- Maximum number of payload bits minus 1 that the UE may transmit using this PUCCH resource set. In a PUCCH occurrence, the UE + -- chooses the first of its PUCCH-ResourceSet which supports the number of bits that the UE wants to transmit. + -- The field is not present in the first set (Set0) since the maximum Size of Set0 is specified to be 3 bit. + -- The field is not present in the last configured set since the UE derives its maximum payload size as specified in 38.213. + -- This field can take integer values that are multiples of 4. Corresponds to L1 parameter 'N_2' or 'N_3' (see 38.213, section 9.2) + maxPayloadMinus1 INTEGER (4..256) OPTIONAL -- Need R +} + +PUCCH-ResourceSetId ::= INTEGER (0..maxNrofPUCCH-ResourceSets-1) + +PUCCH-Resource ::= SEQUENCE { + pucch-ResourceId PUCCH-ResourceId, + + startingPRB PRB-Id, + -- Corresponds to the L1 parameter 'PUCCH-frequency-hopping' (see 38.213, section 9.2) + intraSlotFrequencyHopping ENUMERATED { enabled } OPTIONAL, -- Need R + -- Index of starting PRB for second hop of PUCCH in case of FH. This value is appliable for intra-slot frequency hopping. + -- Corresponds to L1 parameter 'PUCCH-2nd-hop-PRB' (see 38.213, section 9.2) + secondHopPRB PRB-Id OPTIONAL, -- Need R + + -- Selection of the PUCCH format and format-specific parameters + format CHOICE { + format0 PUCCH-format0, -- Cond InFirstSetOnly + format1 PUCCH-format1, -- Cond InFirstSetOnly + format2 PUCCH-format2, -- Cond NotInFirstSet + format3 PUCCH-format3, -- Cond NotInFirstSet + format4 PUCCH-format4 -- Cond NotInFirstSet + } +} + +PUCCH-ResourceId ::= INTEGER (0..maxNrofPUCCH-Resources-1) + + +-- A PUCCH Format 0 resource configuration (see 38.213, section 9.2) +-- Corresponds to L1 parameter 'PUCCH-format0' (see 38.213, section 9.2.1) +PUCCH-format0 ::= SEQUENCE { + initialCyclicShift INTEGER(0..11), + nrofSymbols INTEGER (1..2), + startingSymbolIndex INTEGER(0..13) +} + +-- A PUCCH Format 1 resource configuration (see 38.213, section 9.2) +-- Corresponds to L1 parameter 'PUCCH-format1' (see 38.213, section 9.2.1) +PUCCH-format1 ::= SEQUENCE { + initialCyclicShift INTEGER(0..11), + nrofSymbols INTEGER (4..14), + startingSymbolIndex INTEGER(0..10), + timeDomainOCC INTEGER(0..6) +} + +-- A PUCCH Format 2 resource configuration (see 38.213, section 9.2) +-- Corresponds to L1 parameter 'PUCCH-format2onfig' (see 38.213, section 9.2.1) +PUCCH-format2 ::= SEQUENCE { + nrofPRBs INTEGER (1..16), + nrofSymbols INTEGER (1..2), + startingSymbolIndex INTEGER(0..13) +} + +-- A PUCCH Format 3 resource configuration(see 38.213, section 9.2) +-- Corresponds to L1 parameter 'PUCCH-format3' (see 38.213, section 9.2.1) +PUCCH-format3 ::= SEQUENCE { + -- The supported values are 1,2,3,4,5,6,8,9,10,12,15 and 16 + nrofPRBs INTEGER (1..16), + nrofSymbols INTEGER (4..14), + startingSymbolIndex INTEGER(0..10) +} + +-- A PUCCH Format 4 resource configuration (see 38.213, section 9.2) +-- Corresponds to L1 parameter 'PUCCH-format4' (see 38.213, section 9.2.1) +PUCCH-format4 ::= SEQUENCE { + nrofSymbols INTEGER (4..14), + occ-Length ENUMERATED {n2,n4}, + occ-Index ENUMERATED {n0,n1,n2,n3}, + startingSymbolIndex INTEGER(0..10) +} + +-- TAG-PUCCH-CONFIG-STOP +-- TAG-PUCCH-CONFIGCOMMON-START + +PUCCH-ConfigCommon ::= SEQUENCE { + -- An entry into a 16-row table where each row configures a set of cell-specific PUCCH resources/parameters. The UE uses + -- those PUCCH resources during initial access on the initial uplink BWP. Once the network provides a dedicated PUCCH-Config + -- for that bandwidth part the UE applies that one instead of the one provided in this field. + -- Corresponds to L1 parameter 'PUCCH-resource-common' (see 38.213, section 9.2) + pucch-ResourceCommon BIT STRING (SIZE (4)) OPTIONAL, -- Need R + + -- Configuration of group- and sequence hopping for all the PUCCH formats 0, 1, 3 and 4. "neither" implies neither group + -- or sequence hopping is enabled. "enable" enables group hopping and disables sequence hopping. "disable"” disables group + -- hopping and enables sequence hopping. Corresponds to L1 parameter 'PUCCH-GroupHopping' (see 38.211, section 6.4.1.3) + pucch-GroupHopping ENUMERATED { neither, enable, disable }, + -- Cell-Specific scrambling ID for group hoppping and sequence hopping if enabled. + -- Corresponds to L1 parameter 'HoppingID' (see 38.211, section 6.3.2.2) + hoppingId BIT STRING (SIZE (10)) OPTIONAL, -- Need R + + -- Power control parameter P0 for PUCCH transmissions. Value in dBm. Only even values (step size 2) allowed. + -- Corresponds to L1 parameter 'p0-nominal-pucch' (see 38.213, section 7.2) + p0-nominal INTEGER (-202..24) OPTIONAL, -- Need R + + ... +} + +-- TAG-PUCCH-CONFIGCOMMON-STOP +-- TAG-PUCCH-POWERCONTROL-START +PUCCH-PowerControl ::= SEQUENCE { + + -- deltaF for PUCCH format 0 with 1dB step size (see 38.213, section 7.2) + deltaF-PUCCH-f0 INTEGER (-16..15) OPTIONAL, -- Need R + -- deltaF for PUCCH format 1 with 1dB step size (see 38.213, section 7.2) + deltaF-PUCCH-f1 INTEGER (-16..15) OPTIONAL, -- Need R + -- deltaF for PUCCH format 2 with 1dB step size (see 38.213, section 7.2) + deltaF-PUCCH-f2 INTEGER (-16..15) OPTIONAL, -- Need R + -- deltaF for PUCCH format 3 with 1dB step size (see 38.213, section 7.2) + deltaF-PUCCH-f3 INTEGER (-16..15) OPTIONAL, -- Need R + -- deltaF for PUCCH format 4 with 1dB step size (see 38.213, section 7.2) + deltaF-PUCCH-f4 INTEGER (-16..15) OPTIONAL, -- Need R + + -- A set with dedicated P0 values for PUCCH, i.e., {P01, P02,... }. Corresponds to L1 parameter 'p0-pucch-set' (see 38.213, section 7.2) + p0-Set SEQUENCE (SIZE (1..maxNrofPUCCH-P0-PerSet)) OF P0-PUCCH OPTIONAL, -- Need M + + -- A set of Reference Signals (e.g. a CSI-RS config or a SSblock) to be used for PUCCH pathloss estimation. + -- Up to maxNrofPUCCH-PathlossReference-RSs may be configured + -- FFS_CHECK: Is it possible not to configure it at all? What does the UE use then? Any SSB? + -- Corresponds to L1 parameter 'pucch-pathlossReference-rs-config' (see 38.213, section 7.2) + pathlossReferenceRSs SEQUENCE (SIZE (1..maxNrofPUCCH-PathlossReferenceRSs)) OF PUCCH-PathlossReferenceRS OPTIONAL, -- Need M + -- Number of PUCCH power control adjustment states maintained by the UE (i.e., g(i)). If the field is present (n2) the UE maintains + -- two power control states (i.e., g(i,0) and g(i,1)). Otherwise, it applies one (i.e., g(i,0)). + -- Corresponds to L1 parameter 'num-pucch-pcadjustment-states' (see 38.213, section 7.2) + twoPUCCH-PC-AdjustmentStates ENUMERATED {twoStates} OPTIONAL, -- Need R + ... +} + +-- P0 value for PUCCH. Corresponds to L1 parameter 'p0-pucch' (see 3,213, section 7.2) +P0-PUCCH ::= SEQUENCE { + p0-PUCCH-Id P0-PUCCH-Id, + -- P0 value for PUCCH with 1dB step size. + p0-PUCCH-Value INTEGER (-16..15) +} + +P0-PUCCH-Id ::= INTEGER (1..8) + +-- A reference signal (RS) configured as pathloss reference signal for PUCCH power control +-- Corresponds to L1 parameter 'pucch-pathlossReference-rs' (see 38.213, section 7.2) +PUCCH-PathlossReferenceRS ::= SEQUENCE { + pucch-PathlossReferenceRS-Id PUCCH-PathlossReferenceRS-Id, + referenceSignal CHOICE { + ssb-Index SSB-Index, + csi-RS-Index NZP-CSI-RS-ResourceId + } +} + +-- ID for a referemce signal (RS) configured as PUCCH pathloss reference +-- Corresponds to L1 parameter 'pucch-pathlossreference-index' (see 38.213, section 7.2) +-- FFS_CHECK: Is this ID used anywhere except inside the PUCCH-PathlossReference-RS itself? If not, remove. +PUCCH-PathlossReferenceRS-Id ::= INTEGER (0..maxNrofPUCCH-PathlossReferenceRSs-1) + +-- TAG-PUCCH-POWERCONTROL-STOP +-- TAG-PUCCH-TPC-COMMANDCONFIG-START + +PUCCH-TPC-CommandConfig ::= SEQUENCE { + -- An index determining the position of the first bit of TPC command (applicable to the SpCell) inside the DCI format 2-2 payload. + tpc-IndexPCell INTEGER (1..15) OPTIONAL, -- Cond PUCCH-SCell + -- An index determining the position of the first bit of TPC command (applicable to the PUCCH-SCell) inside the DCI format 2-2 payload. + tpc-IndexPUCCH-SCell INTEGER (1..15) OPTIONAL, -- Cond PUCCH-SCellOnly + ... +} + +-- TAG-PUCCH-TPC-COMMANDCONFIG-STOP +-- TAG-PUSCH-CONFIG-START + +PUSCH-Config ::= SEQUENCE { + -- Identifer used to initalite data scrambling (c_init) for both PUSCH. + -- Corresponds to L1 parameter 'Data-scrambling-Identity' (see 38,214, section FFS_Section) + dataScramblingIdentityPUSCH INTEGER (0..1007) OPTIONAL, -- Need M + -- Whether UE uses codebook based or non-codebook based transmission. Corresponds to L1 parameter 'ulTxConfig' (see 38.214, section 6.1.1) + txConfig ENUMERATED {codebook, nonCodebook}, + + -- DMRS configuration for PUSCH transmissions using PUSCH mapping type A (chosen dynamically via PUSCH-TimeDomainResourceAllocation). + dmrs-UplinkForPUSCH-MappingTypeA SetupRelease { DMRS-UplinkConfig } OPTIONAL, -- Need M + -- DMRS configuration for PUSCH transmissions using PUSCH mapping type B (chosen dynamically via PUSCH-TimeDomainResourceAllocation) + dmrs-UplinkForPUSCH-MappingTypeB SetupRelease { DMRS-UplinkConfig } OPTIONAL, -- Need M + + pusch-PowerControl PUSCH-PowerControl OPTIONAL, -- Need M + -- Configured one of two supported frequency hopping mode. If not configured frequency hopping is not configured + -- Corresponds to L1 parameter 'Frequency-hopping-PUSCH' (see 38.214, section 6) + -- When the field is absent the UE applies the value Not configured + frequencyHopping ENUMERATED {mode1, mode2} OPTIONAL, -- Need S + -- Set of frequency hopping offsets used when frequency hopping is enabled for granted transmission (not msg3) and type 2 + -- Corresponds to L1 parameter 'Frequency-hopping-offsets-set' (see 38.214, section 6.3) + frequencyHoppingOffsetLists SEQUENCE (SIZE (1..4)) OF INTEGER (1.. maxNrofPhysicalResourceBlocks-1) OPTIONAL, -- Need M + -- Configuration of resource allocation type 0 and resource allocation type 1 for non-fallback DCI + -- Corresponds to L1 parameter 'Resouce-allocation-config' (see 38.214, section 6.1.2) + resourceAllocation ENUMERATED { resourceAllocationType0, resourceAllocationType1, dynamicSwitch}, + + -- List of time domain allocations for timing of UL assignment to UL data. If configured, the values provided herein + -- override the values received in corresponding PUSCH-ConfigCommon. + pusch-AllocationList SEQUENCE (SIZE(1..maxNrofUL-Allocations)) OF PUSCH-TimeDomainResourceAllocation OPTIONAL, -- Need R, + -- Number of repetitions for data. Corresponds to L1 parameter 'aggregation-factor-UL' (see 38.214, section FFS_Section) + -- When the field is absent the UE applies the value 1. + pusch-AggregationFactor ENUMERATED { n2, n4, n8 } OPTIONAL, -- Need S + + -- Indicates which MCS table the UE shall use for PUSCH without transform precoder + -- Corresponds to L1 parameter 'MCS-Table-PUSCH' (see 38.214, section 6.1.4) + -- When the field is absent the UE applies the value 64QAM + mcs-Table ENUMERATED {qam256} OPTIONAL, -- Need S + -- Indicates which MCS table the UE shall use for PUSCH with transform precoding + -- Corresponds to L1 parameter 'MCS-Table-PUSCH-transform-precoding' (see 38.214, section 6.1.4) + -- When the field is absent the UE applies the value 64QAM + mcs-TableTransformPrecoder ENUMERATED { qam256} OPTIONAL, -- Need S + -- The UE specific selection of transformer precoder for PUSCH. When the field is absent the UE applies the value msg3-tp. + -- Corresponds to L1 parameter 'PUSCH-tp' (see 38.211, section 6.3.1.4) + transformPrecoder ENUMERATED {enabled, disabled} OPTIONAL, -- Need S + -- Subset of PMIs addressed by TPMI, where PMIs are those supported by UEs with maximum coherence capabilities + -- Corresponds to L1 parameter 'ULCodebookSubset' (see 38.211, section 6.3.1.5) + codebookSubset ENUMERATED {fullyAndPartialAndNonCoherent, partialAndNonCoherent, nonCoherent}, + -- Subset of PMIs addressed by TRIs from 1 to ULmaxRank. Corresponds to L1 parameter 'ULmaxRank' (see 38.211, section 6.3.1.5) + maxRank INTEGER (1..4), + + -- Selection between config 1 and config 2 for RBG size for PUSCH. When the field is absent the UE applies the value config1. + -- Corresponds to L1 parameter 'RBG-size-PUSCH' (see 38.214, section 6.1.2.2.1) + rbg-Size ENUMERATED { config2} OPTIONAL, -- Need S + + -- Selection between and configuration of dynamic and semi-static beta-offset. + -- If the field is absent or released, the UE applies the value 'semiStatic' and the BetaOffsets according to + -- FFS [BetaOffsets and/or section 9.x.x). + -- Corresponds to L1 parameter 'UCI-on-PUSCH' (see 38.213, section 9.3) + uci-OnPUSCH SetupRelease { UCI-OnPUSCH} OPTIONAL, -- Need M + -- Interleaving unit configurable between 2 and 4 PRBs + -- Corresponds to L1 parameter 'VRB-to-PRB-interleaver' (see 38.211, section 6.3.1.6) + vrb-ToPRB-Interleaver ENUMERATED {n2, n4}, + ... +} + +UCI-OnPUSCH ::= SEQUENCE { + betaOffsets CHOICE { + dynamic SEQUENCE (SIZE (4)) OF BetaOffsets, + semiStatic BetaOffsets + } OPTIONAL, -- Need M + -- Indicates a scaling factor to limit the number of resource elements assigned to UCI on PUSCH. + -- Value f0p5 corresponds to 0.5, value f0p65 corresponds to 0.65, and so on. + -- Corresponds to L1 parameter 'uci-on-pusch-scaling' (see 38.212, section 6.3) + scaling ENUMERATED { f0p5, f0p65, f0p8, f1 } +} + +-- TAG-PUSCH-CONFIG-STOP +-- TAG-PUSCH-CONFIGCOMMON-START + +PUSCH-ConfigCommon ::= SEQUENCE { + -- Sequence-group hopping can be enabled or disabled by means of this cell-specific parameter. + -- Corresponds to L1 parameter 'Group-hopping-enabled-Transform-precoding' (see 38.211, section FFS_Section) + -- This field is Cell specific + groupHoppingEnabledTransformPrecoding ENUMERATED {enabled} OPTIONAL, -- Need R + + -- List of time domain allocations for timing of UL assignment to UL data + pusch-AllocationList SEQUENCE (SIZE(1..maxNrofUL-Allocations)) OF PUSCH-TimeDomainResourceAllocation OPTIONAL, -- Need R + + -- ------------------------ + -- Power control parameters + + -- Power offset between msg3 and RACH preamble transmission in steps of 1dB. + -- Corresponds to L1 parameter 'Delta-preamble-msg3' (see 38.213, section 7.1) + msg3-DeltaPreamble INTEGER (-1..6) OPTIONAL, -- Need R + + -- P0 value for PUSCH with grant (except msg3). Value in dBm. Only even values (step size 2) allowed. + -- Corresponds to L1 parameter 'p0-nominal-pusch-withgrant' (see 38.213, section 7.1) + -- This field is cell specific + p0-NominalWithGrant INTEGER (-202..24) OPTIONAL, -- Need R + ... +} + +-- TAG-PUSCH-CONFIGCOMMON-STOP +-- TAG-PUSCH-POWERCONTROL-START + +PUSCH-PowerControl ::= SEQUENCE { + + -- If enabled, UE applies TPC commands via accumulation. If not enabled, UE applies the TPC command without accumulation. + -- If absent, TPC accumulation is enabled. Corresponds to L1 parameter 'Accumulation-enabled' (see 38.213, section 7.1) + tpc-Accumulation ENUMERATED { disabled } OPTIONAL, -- Need R + + -- Dedicated alpha value for msg3 PUSCH. Corresponds to L1 parameter 'alpha-ue-pusch-msg3' (see 38.213, section 7.1) + -- When the field is absent the UE applies the value 1. + msg3-Alpha Alpha OPTIONAL, -- Need S + + -- P0 value for UL grant-free/SPS based PUSCH. Value in dBm. Only even values (step size 2) allowed. + -- Corresponds to L1 parameter 'p0-nominal-pusch-withoutgrant' (see 38.213, section 7.1) + p0-NominalWithoutGrant INTEGER (-202..24) OPTIONAL, -- Need M, + -- configuration {p0-pusch,alpha} sets for PUSCH (except msg3), i.e., { {p0,alpha,index1}, {p0,alpha,index2},...}. + -- Corresponds to L1 parameter 'p0-push-alpha-setconfig' (see 38,213, section 7.1) + p0-AlphaSets SEQUENCE (SIZE (1..maxNrofP0-PUSCH-AlphaSets)) OF P0-PUSCH-AlphaSet OPTIONAL, -- Need M, + + -- A set of Reference Signals (e.g. a CSI-RS config or a SSblock) to be used for PUSCH path loss estimation. + -- Up to maxNrofPUSCH-PathlossReferenceRSs may be configured when 'PUSCH beam indication' is present (FFS: in DCI???). + -- Otherwise, there may be only one entry. + -- Corresponds to L1 parameter 'pusch-pathlossReference-rs-config' (see 38.213, section 7.1) + pathlossReferenceRSToAddModList SEQUENCE (SIZE (1..maxNrofPUSCH-PathlossReferenceRSs)) OF PUSCH-PathlossReferenceRS + OPTIONAL, -- Need N + pathlossReferenceRSToReleaseList SEQUENCE (SIZE (1..maxNrofPUSCH-PathlossReferenceRSs)) OF PUSCH-PathlossReferenceRS-Id + OPTIONAL, -- Need N + + -- Number of PUSCH power control adjustment states maintained by the UE (i.e., fc(i)). If the field is present (n2) the UE maintains + -- two power control states (i.e., fc(i,1) and fc(i,2)). Otherwise, it applies one (i.e., fc(i,1)). + -- Corresponds to L1 parameter 'num-pusch-pcadjustment-states' (see 38.213, section 7.1) + twoPUSCH-PC-AdjustmentStates ENUMERATED {twoStates} OPTIONAL, -- Need S + + -- Indicates whether to apply dela MCS. When the field is absent, the UE applies Ks = 0 in delta_TFC formula for PUSCH. + -- Corresponds to L1 parameter 'deltaMCS-Enabled' (see 38.213, section 7.1) + deltaMCS ENUMERATED {enabled} OPTIONAL, -- Need S + + -- A list of SRI-PUSCH-PowerControl elements among which one is selected by the SRI field in DCI. + -- Corresponds to L1 parameter 'SRI-PUSCHPowerControl-mapping' (see 38.213, section 7.1) + sri-PUSCH-MappingToAddModList SEQUENCE (SIZE (1..maxNrofSRI-PUSCH-Mappings)) OF SRI-PUSCH-PowerControl OPTIONAL, -- Need M + sri-PUSCH-MappingToReleaseList SEQUENCE (SIZE (1..maxNrofSRI-PUSCH-Mappings)) OF SRI-PUSCH-PowerControlId OPTIONAL -- Need M +} + +-- A set of p0-pusch and alpha used for PUSCH with grant. 'PUSCH beam indication' (if present) gives the index of the set to +-- be used for a particular PUSCH transmission. +-- FFS_CHECK: Is the ”PUSCH beam indication” in DCI which schedules the PUSCH? If so, clarify in field description +-- Corresponds to L1 parameter 'p0-pusch-alpha-set' (see 38.213, section 7.1) +P0-PUSCH-AlphaSet ::= SEQUENCE { + p0-PUSCH-AlphaSetId P0-PUSCH-AlphaSetId, + -- P0 value for PUSCH with grant (except msg3) in steps of 1dB. Corresponds to L1 parameter 'p0-pusch' (see 38,213, section 7.1) + p0 INTEGER (-16..15) OPTIONAL, + -- alpha value for PUSCH with grant (except msg3) (see 38.213, section 7.1) + -- When the field is absent the UE applies the value 1 + alpha Alpha OPTIONAL -- Need S +} + +-- ID for a P0-PUSCH-AlphaSet. Corresponds to L1 parameter 'p0alphasetindex' (see 38.213, section 7.1) +P0-PUSCH-AlphaSetId ::= INTEGER (0..maxNrofP0-PUSCH-AlphaSets-1) + +-- A reference signal (RS) configured as pathloss reference signal for PUSCH power control +-- Corresponds to L1 parameter 'pusch-pathlossReference-rs' (see 38.213, section 7.1) +PUSCH-PathlossReferenceRS ::= SEQUENCE { + pusch-PathlossReferenceRS-Id PUSCH-PathlossReferenceRS-Id, + referenceSignal CHOICE { + ssb-Index SSB-Index, + csi-RS-Index NZP-CSI-RS-ResourceId + } +} + +-- ID for a referemce signal (RS) configured as PUSCH pathloss reference +-- Corresponds to L1 parameter 'pathlossreference-index' (see 38.213, section 7.1) +-- FFS_CHECK: Is this ID used anywhere except inside the PUSCH-PathlossReference-RS itself? +PUSCH-PathlossReferenceRS-Id ::= INTEGER (0..maxNrofPUSCH-PathlossReferenceRSs-1) + + +-- A set of PUSCH power control parameters associated with one SRS-ResourceIndex (SRI) +SRI-PUSCH-PowerControl ::= SEQUENCE { + -- The ID of this SRI-PUSCH-PowerControl configuration. It is used as the codepoint (payload) in the SRI DCI field. + sri-PUSCH-PowerControlId SRI-PUSCH-PowerControlId, + -- The ID of PUSCH-PathlossReferenceRS as configured in the pathlossReferenceRSToAddModList in PUSCH-PowerControl. + sri-PUSCH-PathlossReferenceRS-Id PUSCH-PathlossReferenceRS-Id, + -- The ID of a P0-PUSCH-AlphaSet as configured in p0-AlphaSets in PUSCH-PowerControl. + sri-P0-PUSCH-AlphaSetId P0-PUSCH-AlphaSetId, + -- The index of the closed power control loop associated with this SRI-PUSCH-PowerControl + sri-PUSCH-ClosedLoopIndex ENUMERATED { i0, i1 } +} + +SRI-PUSCH-PowerControlId ::= INTEGER (0..maxNrofSRI-PUSCH-Mappings-1) + +-- A set of beta-offset values +BetaOffsets ::= SEQUENCE { + -- Up to 2 bits HARQ-ACK. Corresponds to L1 parameter 'betaOffset-ACK-Index-1' (see 38.213, section 9.3) + -- When the field is absent the UE applies the value 11 + betaOffsetACK-Index1 INTEGER(0..31) OPTIONAL, -- Need S + -- Up to 11 bits HARQ-ACK. Corresponds to L1 parameter 'betaOffset-ACK-Index-2' (see 38.213, section 9.3) + -- When the field is absent the UE applies the value 11 + betaOffsetACK-Index2 INTEGER(0..31) OPTIONAL, -- Need S + -- Above 11 bits HARQ-ACK. Corresponds to L1 parameter 'betaOffset-ACK-Index-3' (see 38.213, section 9.3) + -- When the field is absent the UE applies the value 11 + betaOffsetACK-Index3 INTEGER(0..31) OPTIONAL, -- Need S + -- Up to 11 bits of CSI part 1 bits. Corresponds to L1 parameter 'betaOffset-CSI-part-1-Index-1' (see 38.213, section 9.3) + -- When the field is absent the UE applies the value 13 + betaOffsetCSI-Part1-Index1 INTEGER(0..31) OPTIONAL, -- Need S + -- Above 11 bits of CSI part 1 bits. Corresponds to L1 parameter 'betaOffset-CSI-part-1-Index-2' (see 38.213, section 9.3) + -- When the field is absent the UE applies the value 13 + betaOffsetCSI-Part1-Index2 INTEGER(0..31) OPTIONAL, -- Need S + -- Up to 11 bits of CSI part 2 bits. Corresponds to L1 parameter 'betaOffset-CSI-part-2-Index-1' (see 38.213, section 9.3) + -- When the field is absent the UE applies the value 13 + betaOffsetCSI-Part2-Index1 INTEGER(0..31) OPTIONAL, -- Need S + -- Above 11 bits of CSI part 2 bits. Corresponds to L1 parameter 'betaOffset-CSI-part-2-Index-2' (see 38.213, section 9.3) + -- When the field is absent the UE applies the value 13 + betaOffsetCSI-Part2-Index2 INTEGER(0..31) OPTIONAL -- Need S +} + +-- TAG-PUSCH-POWERCONTROL-STOP +-- TAG-PUSCH-SERVINGCELLCONFIG-START + +PUSCH-ServingCellConfig ::= SEQUENCE { + -- Enables and configures code-block-group (CBG) based transmission (see 38.214, section FFS_Section) + codeBlockGroupTransmission SetupRelease { PUSCH-CodeBlockGroupGransmission } OPTIONAL, -- Need M + -- Enables LBRM (Limited buffer rate-matching). When the field is absent the UE applies FBRM (Full buffer rate-matchingLBRM). + -- Corresponds to L1 parameter 'LBRM-FBRM-selection' (see 38.212, section 5.4.2) + rateMatching ENUMERATED {limitedBufferRM} OPTIONAL, -- Need S + -- Accounts for overhead from CSI-RS, CORESET, etc. If the field is absent, the UE applies the value 'xoh0'. + -- Corresponds to L1 parameter 'Xoh-PUSCH' (see 38.214, section 5.1.3.2) + xOverhead ENUMERATED {xoh6, xoh12, xoh18} OPTIONAL, -- Need S + ... +} + +PUSCH-CodeBlockGroupGransmission ::= SEQUENCE { + -- Maximum number of code-block-groups (CBGs) per TB (see 38.xxx, section x.x.x, FFS_Ref) + -- For 2 codewords, only the values { n2, n4 } are valid. + maxCodeBlockGroupsPerTransportBlock ENUMERATED {n2, n4, n6, n8}, + ... +} + +-- TAG-PUSCH-SERVINGCELLCONFIG-STOP +-- TAG-PUSCH-TIMEDOMAINRESOURCEALLOCATION-START + +PUSCH-TimeDomainResourceAllocation ::= SEQUENCE { + -- Corresponds to L1 parameter 'K2' (see 38.214, section FFS_Section) + -- When the field is absent the UE applies the value 01 when PUSCH SCS is 15/30KHz; 2 when PUSCH SCS is 60KHz and 3 when PUSCH SCS is 120KHz. + k2 INTEGER (0..7) OPTIONAL, -- Need S + -- Mapping type. Corresponds to L1 parameter 'Mapping-type' (see 38.214, section FFS_Section) + mappingType ENUMERATED {typeA, typeB}, + -- An index into a table/equation in RAN1 specs capturing valid combinations of start symbol and length (jointly encoded) + -- Corresponds to L1 parameter 'Index-start-len' (see 38.214, section FFS_Section) + startSymbolAndLength BIT STRING (SIZE (7)) +} + +-- TAG-PUSCH-TIMEDOMAINRESOURCEALLOCATION-STOP +-- TAG-PUSCH-TPC-COMMANDCONFIG-START + +PUSCH-TPC-CommandConfig ::= SEQUENCE { + -- An index determining the position of the first bit of TPC command inside the DCI format 2-2 payload. + tpc-Index INTEGER (1..15) OPTIONAL, -- Cond SUL + -- An index determining the position of the first bit of TPC command inside the DCI format 2-2 payload. + tpc-IndexSUL INTEGER (1..15) OPTIONAL, -- Cond SUL-Only + -- The serving cell to which the acquired power control commands are applicable. If the value is absent, the UE applies the + -- TPC commands to the serving cell on which the command has been received. + targetCell ServCellIndex OPTIONAL, -- Need S + ... +} + +-- TAG-PUSCH-TPC-COMMANDCONFIG-STOP + +Q-OffsetRange ::= ENUMERATED { + dB-24, dB-22, dB-20, dB-18, dB-16, dB-14, + dB-12, dB-10, dB-8, dB-6, dB-5, dB-4, dB-3, + dB-2, dB-1, dB0, dB1, dB2, dB3, dB4, dB5, + dB6, dB8, dB10, dB12, dB14, dB16, dB18, + dB20, dB22, dB24} + +-- TAG-QUANTITY-CONFIG-START + + +QuantityConfig ::= SEQUENCE { + quantityConfigNR-List QuantityConfigNR-List OPTIONAL, -- Need M + ... +} + +QuantityConfigNR-List::= SEQUENCE (SIZE (1..maxNrofQuantityConfig)) OF QuantityConfigNR + +QuantityConfigNR::= SEQUENCE { + quantityConfigCell QuantityConfigRS, + quantityConfigRS-Index QuantityConfigRS OPTIONAL -- Need M +} + +QuantityConfigRS ::= SEQUENCE { + -- SS Block based L3 filter configurations: + ssb-FilterConfig FilterConfig, + + -- CSI-RS basedL3 filter configurations: + cs-RS-FilterConfig FilterConfig +} + +FilterConfig ::= SEQUENCE { + filterCoefficientRSRP FilterCoefficient DEFAULT fc4, + filterCoefficientRSRQ FilterCoefficient DEFAULT fc4, + filterCoefficientRS-SINR FilterCoefficient DEFAULT fc4 +} + +-- TAG-QUANTITY-CONFIG-STOP +-- TAG-RACH-CONFIG-COMMON-START + +RACH-ConfigCommon ::= SEQUENCE { + -- Generic RACH parameters + rach-ConfigGeneric RACH-ConfigGeneric, + + -- Total number of preambles used for contention based and contention free random access, excluding + -- preambles used for other purposes (e.g. for SI request). If the field is absent, the UE may use all 64 preambles for RA. + totalNumberOfRA-Preambles INTEGER (1..63) OPTIONAL, -- Need S + + -- Number of SSBs per RACH occasion (L1 parameter 'SSB-per-rach-occasion') and the number of Contention Based preambles per SSB + -- (L1 parameter 'CB-preambles-per-SSB'). By multiplying the two values, the UE determines the total number of CB preambles. + ssb-perRACH-OccasionAndCB-PreamblesPerSSB CHOICE { + oneEighth ENUMERATED {n4,n8,n12,n16,n20,n24,n28,n32,n36,n40,n44,n48,n52,n56,n60,n64}, + oneFourth ENUMERATED {n4,n8,n12,n16,n20,n24,n28,n32,n36,n40,n44,n48,n52,n56,n60,n64}, + oneHalf ENUMERATED {n4,n8,n12,n16,n20,n24,n28,n32,n36,n40,n44,n48,n52,n56,n60,n64}, + one ENUMERATED {n4,n8,n12,n16,n20,n24,n28,n32,n36,n40,n44,n48,n52,n56,n60,n64}, + two ENUMERATED {n4,n8,n12,n16,n20,n24,n28,n32}, + four INTEGER (1..16), + eight INTEGER (1..8), + sixteen INTEGER (1..4) + } OPTIONAL, -- Need M + + groupBconfigured SEQUENCE { + -- Transport Blocks size threshold in bit below which the UE shall use a contention based RA premable + -- of group A. (see 38.321, section 5.1.2) + ra-Msg3SizeGroupA ENUMERATED {b56, b144, b208, b256, b282, b480, b640, b800, b1000, spare7, spare6, spare5, + spare4, spare3, spare2, spare1}, + -- Threshold for preamble selection. Value in dB. Value minusinfinity corresponds to –infinity. + -- Value dB0 corresponds to 0 dB, dB5 corresponds to 5 dB and so on. (see FFS_Spec, section FFS_Section) + messagePowerOffsetGroupB ENUMERATED { minusinfinity, dB0, dB5, dB8, dB10, dB12, dB15, dB18}, + -- The number of CB preambles per SSB in group A. This determines implicitly the number of CB preambles per SSB available in group B. + -- (see 38.321, section 5.1.1) + numberOfRA-PreamblesGroupA INTEGER (1..64) + } OPTIONAL, -- Need R + + -- The initial value for the contention resolution timer (see 38.321, section 5.1.5) + ra-ContentionResolutionTimer ENUMERATED { sf8, sf16, sf24, sf32, sf40, sf48, sf56, sf64}, + + -- UE may select the SS block and corresponding PRACH resource for path-loss estimation and (re)transmission + -- based on SS blocks that satisfy the threshold (see 38.213, section REF) + rsrp-ThresholdSSB RSRP-Range OPTIONAL, -- Need R + -- UE may select the SS block and corresponding PRACH resource for path-loss estimation and (re)transmission on the SUL carrier + -- based on SS blocks that satisfy the threshold + -- Corresponds to L1 parameter 'SUL-RSRP-Threshold' (see FFS_Spec, section FFS_Section) + rsrp-ThresholdSSB-SUL RSRP-Range OPTIONAL, -- Need R + + -- PRACH root sequence index. Corresponds to L1 parameter 'PRACHRootSequenceIndex' (see 38.211, section 6.3.3.1). + -- The value range depends on whether L=839 or L=139 + prach-RootSequenceIndex CHOICE { + l839 INTEGER (0..837), + l139 INTEGER (0..137) + }, + + -- Subcarrier spacing of PRACH. Only the values 15 or 30 kHz (<6GHz), 60 or 120 kHz (>6GHz) are applicable. + -- Corresponds to L1 parameter 'prach-Msg1SubcarrierSpacing' (see 38.211, section FFS_Section) + msg1-SubcarrierSpacing SubcarrierSpacing, + + -- Configuration of an unrestricted set or one of two types of restricted sets, see 38.211 6.3.3.1 + restrictedSetConfig ENUMERATED {unrestrictedSet, restrictedSetTypeA, restrictedSetTypeB}, + -- Indicates to a UE whether transform precoding is enabled for Msg3 transmission. + -- Corresponds to L1 parameter 'msg3-tp' (see 38.213, section 8.1) + msg3-transformPrecoding ENUMERATED {enabled} OPTIONAL, -- Need R + ... +} + +-- TAG-RACH-CONFIG-COMMON-STOP +-- TAG-RACH-CONFIG-GENERIC-START + +RACH-ConfigGeneric ::= SEQUENCE { + -- PRACH configuration index. Corresponds to L1 parameter 'PRACHConfigurationIndex' (see 38.211, section 6.3.3.2) + prach-ConfigurationIndex INTEGER (0..255), + -- The number of PRACH transmission occasions FDMed in one time instance. + -- Corresponds to L1 parameter 'prach-FDM' (see 38.211, section FFS_Section) + msg1-FDM ENUMERATED {one, two, four, eight}, + -- Offset of lowest PRACH transmission occasion in frequency domain with respective to PRB 0. + -- The value is configured so that the corresponding RACH resource is entirely within the bandwidth of the UL BWP. + -- Corresponds to L1 parameter 'prach-frequency-start' (see 38,211, section FFS_Section) + msg1-FrequencyStart INTEGER (0..maxNrofPhysicalResourceBlocks-1), + -- N-CS configuration, see Table 6.3.3.1-3 in 38.211 + zeroCorrelationZoneConfig INTEGER(0..15), + -- The target power level at the network receiver side (see 38.213, section 7.4, 38.321, section 5.1.2, 5.1.3) + -- Only multiples of 2 dBm may be chosen (e.g. -200, -198, ...). + -- FFS-Value: Actual values to be updated based on input from RAN4 (see LS in R2-1800004 and R4-1803466). + preambleReceivedTargetPower INTEGER (-200..-74), + -- Max number of RA preamble transmission perfomed before declaring a failure (see 38.321, section 5.1.4, 5.1.5) + preambleTransMax ENUMERATED {n3, n4, n5, n6, n7, n8, n10, n20, n50, n100, n200}, + -- Power ramping steps for PRACH (see 38.321,5.1.3) + powerRampingStep ENUMERATED {dB0, dB2, dB4, dB6}, + -- Msg2 (RAR) window length in number of slots. The network configures a value lower than or euqal to 10 ms (see 38.321, section 5.1.4) + ra-ResponseWindow ENUMERATED {sl1, sl2, sl4, sl8, sl10, sl20, sl40, sl80} +} + +-- TAG-RACH-CONFIG-GENERIC-STOP +-- TAG-RACH-CONFIG-DEDICATED-START + +-- FFS_Standlone: resources for msg1-based on-demand SI request + +RACH-ConfigDedicated ::= SEQUENCE { + -- Resources for contention free random access to a given target cell + cfra-Resources CFRA-Resources, + ... +} + +CFRA-Resources ::= CHOICE { + ssb SEQUENCE { + ssb-ResourceList SEQUENCE (SIZE(1..maxRA-SSB-Resources)) OF CFRA-SSB-Resource, + -- Explicitly signalled PRACH Mask Index for RA Resource selection in TS 36.321. The mask is valid for all SSB + -- resources signalled in ssb-ResourceList + ra-ssb-OccasionMaskIndex INTEGER (0..15) + }, + csirs SEQUENCE { + csirs-ResourceList SEQUENCE (SIZE(1..maxRA-CSIRS-Resources)) OF CFRA-CSIRS-Resource, + cfra-csirs-DedicatedRACH-Threshold RSRP-Range + } +} + +CFRA-SSB-Resource ::= SEQUENCE { + -- The ID of an SSB transmitted by this serving cell. + ssb SSB-Index, + -- The preamble index that the UE shall use when performing CF-RA upon selecting the candidate beams identified by this SSB. + ra-PreambleIndex INTEGER (0..63), + ... +} + +CFRA-CSIRS-Resource ::= SEQUENCE { + -- The ID of a CSI-RS resource defined in the measurement object associated with this serving cell. + csi-RS CSI-RS-Index, + -- RA occasions that the UE shall use when performing CF-RA upon selecting the candidate beam identified by this CSI-RS. + ra-OccasionList SEQUENCE (SIZE(1..maxRA-OccasionsPerCSIRS)) OF INTEGER (0..maxRA-Occasions-1), + -- The RA preamble index to use in the RA occasions assoicated with this CSI-RS. + ra-PreambleIndex INTEGER (0..63), + ... +} + +-- TAG-RACH-CONFIG-DEDICATED-STOP +-- TAG-RADIO-BEARER-CONFIG-START + +RadioBearerConfig ::= SEQUENCE { + srb-ToAddModList SRB-ToAddModList OPTIONAL, -- Need N + srb3-ToRelease ENUMERATED{true} OPTIONAL, -- Need N + drb-ToAddModList DRB-ToAddModList OPTIONAL, -- Need N + drb-ToReleaseList DRB-ToReleaseList OPTIONAL, -- Need N + securityConfig SecurityConfig OPTIONAL, -- Cond M + ... +} + +SRB-ToAddModList ::= SEQUENCE (SIZE (1..2)) OF SRB-ToAddMod +SRB-ToAddMod ::= SEQUENCE { + srb-Identity SRB-Identity, + -- may only be set if the cell groups of all linked logical channels are reset or released + reestablishPDCP ENUMERATED{true} OPTIONAL, -- Need N + discardOnPDCP ENUMERATED{true} OPTIONAL, -- Need N + pdcp-Config PDCP-Config OPTIONAL, -- Cond PDCP + ... +} + + +DRB-ToAddModList ::= SEQUENCE (SIZE (1..maxDRB)) OF DRB-ToAddMod +DRB-ToAddMod ::= SEQUENCE { + cnAssociation CHOICE { + -- The EPS bearer ID determines the EPS bearer when NR connects to EPC using EN-DC + eps-BearerIdentity INTEGER (0..15), -- EPS-DRB-Setup + -- The SDAP configuration determines how to map QoS flows to DRBs when NR connects to the 5GC + sdap-Config SDAP-Config -- 5GC + } OPTIONAL, -- Cond DRBSetup + drb-Identity DRB-Identity, + + -- may only be set if the cell groups of all linked logical channels are reset or released + reestablishPDCP ENUMERATED{true} OPTIONAL, -- Need N + recoverPDCP ENUMERATED{true} OPTIONAL, -- Need N + pdcp-Config PDCP-Config OPTIONAL, -- Cond PDCP + ... +} + +DRB-ToReleaseList ::= SEQUENCE (SIZE (1..maxDRB)) OF DRB-Identity + + +SecurityConfig ::= SEQUENCE { + securityAlgorithmConfig SecurityAlgorithmConfig OPTIONAL, -- Cond RBTermChange + keyToUse ENUMERATED{keNB, s-KgNB} OPTIONAL, -- Cond RBTermChange + ... +} + +-- TAG-RADIO-BEARER-CONFIG-STOP +-- TAG-RADIOLINKMONITORINGCONFIG-START + +RadioLinkMonitoringConfig ::= SEQUENCE { + -- A list of reference signals for detecting beam failure and/or cell level radio link failure (RLF). + -- The network configures at most two detectionResources per BWP for the purpose "beamFailure" or "both". + -- If no RSs are provided for the purpose of beam failure detection, the UE performs beam monitoring based on the activated TCI-State + -- for PDCCH. However, if the activated TCI state refers to an aperiodic or semi-persistent CSI-RS, the gNB configures the failure + -- detection resources explicitly (FFS_RAN1: TBC by RAN1). + -- If no RSs are provided in this list at all (neither for Cell- nor for Beam-RLM), the UE performs also Cell-RLM based + -- on the activated TCI-State of PDCCH (FFS_RAN1: TBC by RAN1). + -- When the network reconfigures this field, the UE resets on-going RLF timers and counters. + failureDetectionResources SEQUENCE (SIZE(1..maxNrofFailureDetectionResources)) OF RadioLinkMonitoringRS OPTIONAL, -- Need M + -- This field determines after how many beam failure events the UE triggers beam failure recovery (see 38.321, section 5.17). + -- Value n1 corresponds to 1 beam failure instance, n2 corresponds to 2 beam failure instances and so on. + -- When the network reconfigures this field, the UE resets on-going RLF timers and counters. + -- If the field is absent, the UE does not trigger beam failure recovery. + beamFailureInstanceMaxCount ENUMERATED {n1, n2, n3, n4, n5, n6, n8, n10} OPTIONAL, -- Need S + -- Timer for beam failure detection (see 38.321, section FFS_Section). See also the BeamFailureRecoveryConfig IE. + -- Value in number of "periods of Beam Failure Detection" Reference Signal. Value pbfd1 corresponds to 1 period of Beam Failure + -- Detection Reference Signal, value pbfd2 corresponds to 2 periods of Beam Failure Detection Reference Signal and so on. + -- When the network reconfigures this field, the UE resets on-going RLF timers and counters. + beamFailureDetectionTimer ENUMERATED {pbfd1, pbfd2, pbfd3, pbfd4, pbfd5, pbfd6, pbfd8, pbfd10} OPTIONAL, -- Need R + ... +} + +RadioLinkMonitoringRS ::= SEQUENCE { + -- Determines whether the UE shall monitor the associated reference signal for the purpose of cell- and/or beam failure detection. + purpose ENUMERATED {beamFailure, rlf, both}, + -- A reference signal that the UE shall use for radio link monitoring. The network provides an ssb-Index only if + -- the purpose is set to rlf. + detectionResource CHOICE { + ssb-Index SSB-Index, + csi-RS-Index NZP-CSI-RS-ResourceId + }, + ... +} + +-- TAG-RADIOLINKMONITORINGCONFIG-STOP +-- TAG-RATEMATCHPATTERN-START +RateMatchPattern ::= SEQUENCE { + rateMatchPatternId RateMatchPatternId, + + patternType CHOICE { + bitmaps SEQUENCE { + -- A resource block level bitmap in the frequency domain. It indicates the PRBs to which the symbolsInResourceBlock bitmap applies. + -- Corresponds to L1 parameter 'rate-match-PDSCH-bitmap1' (see 38.214, section FFS_Section) + -- FFS_ASN1: Consider multiple options with different number of bits (for narrower carriers) + resourceBlocks BIT STRING (SIZE (275)), + + -- A symbol level bitmap in time domain. It indicates (FFS: with a bit set to true) the symbols which the UE shall rate match around. + -- This pattern recurs (in time domain) with the configured periodicityAndOffset. + -- Corresponds to L1 parameter 'rate-match-PDSCH-bitmap2' (see 38.214, section FFS_Section) + -- FFS: Why not split it into two BIT STRINGs of 14 bit each? + symbolsInResourceBlock CHOICE { + oneSlot BIT STRING (SIZE (14)), + twoSlots BIT STRING (SIZE (28)) + }, + + -- A time domain repetition pattern. at which the symbolsInResourceBlock + -- pattern recurs. This slot pattern repeats itself continuously. Absence of this field indicates the value n1, i.e., the + -- symbolsInResourceBlock recurs every 14 symbols. + -- Corresponds to L1 parameter 'rate-match-PDSCH-bitmap3' (see 38.214, section FFS_Section) + periodicityAndPattern CHOICE { + n2 BIT STRING (SIZE (2)), + n4 BIT STRING (SIZE (4)), + n5 BIT STRING (SIZE (5)), + n8 BIT STRING (SIZE (8)), + n10 BIT STRING (SIZE (10)), + n20 BIT STRING (SIZE (20)), + n40 BIT STRING (SIZE (40)) + } OPTIONAL, -- Need S + ... + }, + -- This ControlResourceSet us used as a PDSCH rate matching pattern, i.e., PDSCH reception rate matches around it. + controlResourceSet ControlResourceSetId + }, + -- The SubcarrierSpacing for this resource pattern. If the field is absent, the UE applies the SCS of the associcated BWP. + -- The value kHz15 corresponds to µ=0, kHz30 to µ=1, and so on. Only the values 15 or 30 kHz (<6GHz), 60 or 120 kHz (>6GHz) are + -- applicable. Corresponds to L1 parameter 'resource-pattern-scs' (see 38.214, section FFS_Section) + subcarrierSpacing SubcarrierSpacing OPTIONAL, -- Cond CellLevel + -- FFS_Description, FFS_Section + mode ENUMERATED { dynamic, semiStatic }, + ... +} + +-- TAG-RATEMATCHPATTERN-STOP +-- TAG-RATEMATCHPATTERNID-START + +RateMatchPatternId ::= INTEGER (0..maxNrofRateMatchPatterns-1) + +-- TAG-RATEMATCHPATTERNID-STOP +-- TAG-RATEMATCHPATTERNLTE-CRS-START + +RateMatchPatternLTE-CRS ::= SEQUENCE { + -- Center of the LTE carrier. Corresponds to L1 parameter 'center-subcarrier-location' (see 38.214, section 5.1.4) + carrierFreqDL INTEGER (0..16383), + -- BW of the LTE carrier in numbewr of PRBs. Corresponds to L1 parameter 'BW' (see 38.214, section 5.1.4) + carrierBandwidthDL ENUMERATED {n6, n15, n25, n50, n75, n100, spare2, spare1}, + -- LTE MBSFN subframe configuration. Corresponds to L1 parameter 'MBSFN-subframconfig' (see 38.214, section 5.1.4) + -- FFS_ASN1: Import the LTE MBSFN-SubframeConfigList + mbsfn-SubframeConfigList EUTRA-MBSFN-SubframeConfigList OPTIONAL, -- Need M + -- Number of LTE CRS antenna port to rate-match around. + -- Corresponds to L1 parameter 'rate-match-resources-numb-LTE-CRS-antenna-port' (see 38.214, section 5.1.4) + nrofCRS-Ports ENUMERATED {n1, n2, n4}, + -- Shifting value v-shift in LTE to rate match around LTE CRS + -- Corresponds to L1 parameter 'rate-match-resources-LTE-CRS-v-shift' (see 38.214, section 5.1.4) + v-Shift ENUMERATED {n0, n1, n2, n3, n4, n5} +} + +-- TAG-RATEMATCHPATTERNLTE-CRS-STOP +-- TAG-REPORT-CONFIG-ID-START + +ReportConfigId ::= INTEGER (1..maxReportConfigId) + +-- TAG-REPORT-CONFIG-ID-STOP +-- TAG-REPORT-CONFIG-START + +ReportConfigNR ::= SEQUENCE { + reportType CHOICE { + periodical PeriodicalReportConfig, + eventTriggered EventTriggerConfig, +-- reportCGI is to be completed before the end of Rel-15. + reportCGI ENUMERATED {ffsTypeAndValue}, + ... + } +} + +-- FFS / TODO: Consider separating trgger configuration (trigger, periodic, ...) from report configuration. +-- Current structure allows easier definiton of new events and new report types e.g. CGI, etc. +EventTriggerConfig::= SEQUENCE { + eventId CHOICE { + eventA1 SEQUENCE { + a1-Threshold MeasTriggerQuantity, + reportOnLeave BOOLEAN, + hysteresis Hysteresis, + timeToTrigger TimeToTrigger + }, + eventA2 SEQUENCE { + a2-Threshold MeasTriggerQuantity, + reportOnLeave BOOLEAN, + hysteresis Hysteresis, + timeToTrigger TimeToTrigger + }, + eventA3 SEQUENCE { + a3-Offset MeasTriggerQuantityOffset, + reportOnLeave BOOLEAN, + hysteresis Hysteresis, + timeToTrigger TimeToTrigger, + useWhiteCellList BOOLEAN + }, + eventA4 SEQUENCE { + a4-Threshold MeasTriggerQuantity, + reportOnLeave BOOLEAN, + hysteresis Hysteresis, + timeToTrigger TimeToTrigger, + useWhiteCellList BOOLEAN + }, + eventA5 SEQUENCE { + a5-Threshold1 MeasTriggerQuantity, + a5-Threshold2 MeasTriggerQuantity, + reportOnLeave BOOLEAN, + hysteresis Hysteresis, + timeToTrigger TimeToTrigger, + useWhiteCellList BOOLEAN + }, + eventA6 SEQUENCE { + a6-Offset MeasTriggerQuantityOffset, + reportOnLeave BOOLEAN, + hysteresis Hysteresis, + timeToTrigger TimeToTrigger, + useWhiteCellList BOOLEAN + }, + ... + }, + + rsType NR-RS-Type, + + -- Common reporting config (at least to periodical and eventTriggered) + reportInterval ReportInterval, + reportAmount ENUMERATED {r1, r2, r4, r8, r16, r32, r64, infinity}, + + -- Cell reporting configuration + reportQuantityCell MeasReportQuantity, + maxReportCells INTEGER (1..maxCellReport), + + -- RS index reporting configuration + reportQuantityRsIndexes MeasReportQuantity OPTIONAL, -- Need M + maxNrofRSIndexesToReport INTEGER (1..maxNrofIndexesToReport) OPTIONAL, -- Need M + includeBeamMeasurements BOOLEAN, + -- If configured the UE includes the best neighbour cells per serving frequency + reportAddNeighMeas ENUMERATED {setup} OPTIONAL, -- Need R + ... + +} + +PeriodicalReportConfig ::= SEQUENCE { + rsType NR-RS-Type, + + -- Common reporting config (at least to periodical and eventTriggered) + reportInterval ReportInterval, + reportAmount ENUMERATED {r1, r2, r4, r8, r16, r32, r64, infinity}, + + -- Cell reporting configuration + reportQuantityCell MeasReportQuantity, + maxReportCells INTEGER (1..maxCellReport), + + -- RS index reporting configuration + reportQuantityRsIndexes MeasReportQuantity OPTIONAL, -- Need R + maxNrofRsIndexesToReport INTEGER (1..maxNrofIndexesToReport) OPTIONAL, -- Need R + includeBeamMeasurements BOOLEAN, + useWhiteCellList BOOLEAN, + ... + +} + +NR-RS-Type ::= ENUMERATED {ssb, csi-rs} + +MeasTriggerQuantity ::= CHOICE { + rsrp RSRP-Range, + rsrq RSRQ-Range, + sinr SINR-Range +} + +MeasTriggerQuantityOffset ::= CHOICE { + rsrp INTEGER (-30..30), + rsrq INTEGER (-30..30), + sinr INTEGER (-30..30) +} + + +MeasReportQuantity ::= SEQUENCE { + rsrp BOOLEAN, + rsrq BOOLEAN, + sinr BOOLEAN +} + + +-- TAG-REPORT-CONFIG-START +-- TAG-REPORT-CONFIG-TO-ADD-MOD-LIST-START + +ReportConfigToAddModList ::= SEQUENCE (SIZE (1..maxReportConfigId)) OF ReportConfigToAddMod + +ReportConfigToAddMod ::= SEQUENCE { + reportConfigId ReportConfigId, + reportConfig CHOICE { + reportConfigNR ReportConfigNR, + ... + } +} + +-- TAG- REPORT-CONFIG-TO-ADD-MOD-LIST-STOP + +ReportInterval ::= ENUMERATED {ms120, ms240, ms480, ms640, ms1024, ms2048, ms5120, ms10240, ms20480, ms40960, min1, + min6, min12, min30 } + +-- TAG-RLC-CONFIG-START + +RLC-Config ::= CHOICE { + am SEQUENCE { + ul-AM-RLC UL-AM-RLC, + dl-AM-RLC DL-AM-RLC + }, + um-Bi-Directional SEQUENCE { + ul-UM-RLC UL-UM-RLC, + dl-UM-RLC DL-UM-RLC + }, + um-Uni-Directional-UL SEQUENCE { + ul-UM-RLC UL-UM-RLC + }, + um-Uni-Directional-DL SEQUENCE { + dl-UM-RLC DL-UM-RLC + }, + ... +} + +UL-AM-RLC ::= SEQUENCE { + sn-FieldLength SN-FieldLengthAM, + t-PollRetransmit T-PollRetransmit, + pollPDU PollPDU, + pollByte PollByte, + maxRetxThreshold ENUMERATED { t1, t2, t3, t4, t6, t8, t16, t32 } +} + +DL-AM-RLC ::= SEQUENCE { + sn-FieldLength SN-FieldLengthAM, + t-Reassembly T-Reassembly, + t-StatusProhibit T-StatusProhibit +} + +UL-UM-RLC ::= SEQUENCE { + sn-FieldLength SN-FieldLengthUM +} + +DL-UM-RLC ::= SEQUENCE { + sn-FieldLength SN-FieldLengthUM, + t-Reassembly T-Reassembly +} + +T-PollRetransmit ::= ENUMERATED { + ms5, ms10, ms15, ms20, ms25, ms30, ms35, + ms40, ms45, ms50, ms55, ms60, ms65, ms70, + ms75, ms80, ms85, ms90, ms95, ms100, ms105, + ms110, ms115, ms120, ms125, ms130, ms135, + ms140, ms145, ms150, ms155, ms160, ms165, + ms170, ms175, ms180, ms185, ms190, ms195, + ms200, ms205, ms210, ms215, ms220, ms225, + ms230, ms235, ms240, ms245, ms250, ms300, + ms350, ms400, ms450, ms500, ms800, ms1000, + ms2000, ms4000, spare5, spare4, spare3, + spare2, spare1} + + +PollPDU ::= ENUMERATED { + p4, p8, p16, p32, p64, p128, p256, p512, p1024, p2048, p4096, p6144, p8192, p12288, p16384, p20480, + p24576, p28672, p32768, p40960, p49152, p57344, p65536, infinity, spare8, spare7, spare6, spare5, spare4, + spare3, spare2, spare1} + +PollByte ::= ENUMERATED { + kB1, kB2, kB5, kB8, kB10, kB15, kB25, kB50, kB75, + kB100, kB125, kB250, kB375, kB500, kB750, kB1000, + kB1250, kB1500, kB2000, kB3000, kB4000, kB4500, + kB5000, kB5500, kB6000, kB6500, kB7000, kB7500, + mB8, mB9, mB10, mB11, mB12, mB13, mB14, mB15, + mB16, mB17, mB18, mB20, mB25, mB30, mB40, infinity, + spare20, spare19, spare18, spare17, spare16, + spare15, spare14, spare13, spare12, spare11, + spare10, spare9, spare8, spare7, spare6, spare5, + spare4, spare3, spare2, spare1} + +T-Reassembly ::= ENUMERATED { + ms0, ms5, ms10, ms15, ms20, ms25, ms30, ms35, + ms40, ms45, ms50, ms55, ms60, ms65, ms70, + ms75, ms80, ms85, ms90, ms95, ms100, ms110, + ms120, ms130, ms140, ms150, ms160, ms170, + ms180, ms190, ms200, spare1} + +T-StatusProhibit ::= ENUMERATED { + ms0, ms5, ms10, ms15, ms20, ms25, ms30, ms35, + ms40, ms45, ms50, ms55, ms60, ms65, ms70, + ms75, ms80, ms85, ms90, ms95, ms100, ms105, + ms110, ms115, ms120, ms125, ms130, ms135, + ms140, ms145, ms150, ms155, ms160, ms165, + ms170, ms175, ms180, ms185, ms190, ms195, + ms200, ms205, ms210, ms215, ms220, ms225, + ms230, ms235, ms240, ms245, ms250, ms300, + ms350, ms400, ms450, ms500, ms800, ms1000, + ms1200, ms1600, ms2000, ms2400, spare2, spare1} + +SN-FieldLengthUM ::= ENUMERATED {size6, size12} +SN-FieldLengthAM ::= ENUMERATED {size12, size18} + +-- TAG-RLC-CONFIG-STOP +-- TAG-RLF-TIMERS-AND-CONSTANTS-START + +RLF-TimersAndConstants ::= SEQUENCE { + t310 ENUMERATED {ms0, ms50, ms100, ms200, ms500, ms1000, ms2000, ms4000, ms6000}, + n310 ENUMERATED {n1, n2, n3, n4, n6, n8, n10, n20}, + n311 ENUMERATED {n1, n2, n3, n4, n5, n6, n8, n10}, + ... +} + +-- TAG-RLF-TIMERS-AND-CONSTANTS-STOP +-- TAG-RNTI-VALUE-START + +RNTI-Value ::= INTEGER (0..65535) + +-- TAG-RNTI-VALUE-STOP +-- TAG-RSRP-RANGE-START + +RSRP-Range ::= INTEGER(0..124) + +-- TAG-RSRP-RANGE-STOP +-- TAG-RSRQ-RANGE-START + +RSRQ-Range ::= INTEGER(0..127) + +-- TAG-RSRQ-RANGE-STOP +-- TAG-SCELL-INDEX-START + +-- The value range is shared across the Cell Groups +SCellIndex ::= INTEGER (1..31) + +-- TAG-SCELL-INDEX-STOP +-- TAG-SCHEDULING-REQUEST-CONFIG-START + +SchedulingRequestConfig ::= SEQUENCE { + schedulingRequestToAddModList SEQUENCE (SIZE (1..maxNrofSR-ConfigPerCellGroup)) OF SchedulingRequestToAddMod OPTIONAL, -- Need N + schedulingRequestToReleaseList SEQUENCE (SIZE (1..maxNrofSR-ConfigPerCellGroup)) OF SchedulingRequestId OPTIONAL -- Need N +} + +SchedulingRequestToAddMod ::= SEQUENCE { + sr-ConfigIndex SchedulingRequestId, + + sr-ProhibitTimer ENUMERATED {ms1, ms2, ms4, ms8, ms16, ms32, ms64, ms128} OPTIONAL, -- Need S + sr-TransMax ENUMERATED { n4, n8, n16, n32, n64, spare3, spare2, spare1} +} + +SchedulingRequestId ::= INTEGER (0..7) + +-- FFS_TODO: provide resources for each SchedulingRequestID in ServingCellConfig (TBD whether directly, in PUCCH-Config, in each BWP) + +-- TAG-SCHEDULING-REQUEST-CONFIG-STOP +-- TAG-SCHEDULING-REQUEST-RESOURCE-CONFIG-START + +SchedulingRequestResourceConfig ::= SEQUENCE { + schedulingRequestResourceId SchedulingRequestResourceId, + -- The ID of the SchedulingRequestConfig that uses this scheduling request resource. + schedulingRequestID SchedulingRequestId, + -- SR periodicity and offset in number of slots. Corresponds to L1 parameter 'SR-periodicity' and 'SR-offset' (see 38.213, section 9.2.2) + -- The following periodicities may be configured depending on the chosen subcarrier spacing: + -- SCS = 15 kHz: 2sym, 7sym, 1sl, 2sl, 4sl, 5sl, 8sl, 10sl, 16sl, 20sl, 40sl, 80sl + -- SCS = 30 kHz: 2sym, 7sym, 1sl, 2sl, 4sl, 8sl, 10sl, 16sl, 20sl, 40sl, 80sl, 160sl + -- SCS = 60 kHz: 2sym, 7sym/6sym, 1sl, 2sl, 4sl, 8sl, 16sl, 20sl, 40sl, 80sl, 160sl, 320sl + -- SCS = 120 kHz: 2sym, 7sym, 1sl, 2sl, 4sl, 8sl, 16sl, 40sl, 80sl, 160sl, 320sl, sl640 + -- sym6or7 corresponds to 6 symbols if extended cyclic prefix and a SCS of 60 kHz are configured, otherwise it corresponds to 7 symbols. + -- For periodicities sym2, sym7 and sl1 the UE assumes an offset of 0 slots. + periodicityAndOffset CHOICE { + sym2 NULL, + sym6or7 NULL, + sl1 NULL, -- Recurs in every slot + sl2 INTEGER (0..1), + sl4 INTEGER (0..3), + sl5 INTEGER (0..4), + sl8 INTEGER (0..7), + sl10 INTEGER (0..9), + sl16 INTEGER (0..15), + sl20 INTEGER (0..19), + sl40 INTEGER (0..39), + sl80 INTEGER (0..79), + sl160 INTEGER (0..159), + sl320 INTEGER (0..319), + sl640 INTEGER (0..639) + } OPTIONAL, -- Need M + -- ID of the PUCCH resource in which the UE shall send the scheduling request. The + -- actual PUCCH-Resource is configured in PUCCH-Config of the same UL BWP and serving cell as this SchedulingRequestResourceConfig. + -- The network configures a PUCCH-Resource of PUCCH-format0 or PUCCH-format1 + -- (other formats not supported). Corresponds to L1 parameter 'SR-resource' (see 38.213, section 9.2.2) + resource PUCCH-ResourceId OPTIONAL -- Need M +} + +-- TAG-SCHEDULING-REQUEST-RESOURCE-CONFIG-STOP +-- TAG-SCHEDULINGREQUESTRESOURCEID-START + +SchedulingRequestResourceId ::= INTEGER (1..maxNrofSR-Resources) + +-- TAG-SCHEDULINGREQUESTRESOURCEID-STOP +-- TAG-SCRAMBLING-ID-START + +ScramblingId ::= INTEGER (0..1023) + +-- TAG-SCRAMBLING-ID-STOP +-- TAG-SCS-SPECIFIC-CARRIER-START + +SCS-SpecificCarrier ::= SEQUENCE { + -- Offset in frequency domain between Point A (lowest subcarrier of common RB 0) and the lowest usable subcarrier on this carrier + -- in number of PRBs (using the subcarrierSpacing defined for this carrier). The maximum value corresponds to 275*8-1. + -- Corresponds to L1 parameter 'offset-pointA-low-scs' (see 38.211, section FFS_Section) + offsetToCarrier INTEGER (0..2199), + -- Subcarrier spacing of this carrier. It is used to convert the offsetToCarrier into an actual frequency. + -- Only the values 15 or 30 kHz (<6GHz), 60 or 120 kHz (>6GHz) are applicable. + -- Corresponds to L1 parameter 'ref-scs' (see 38.211, section FFS_Section) + subcarrierSpacing SubcarrierSpacing, + -- Corresponds to L1 parameter k0 (see 38.211, section 5.3.1). n-6 corresponds to value -6, n0 corresponds to value 0 and n6 corresponds + -- to value +6. + k0 ENUMERATED {n-6, n0, n6}, + -- Width of this carrier in number of PRBs (using the subcarrierSpacing defined for this carrier) + -- Corresponds to L1 parameter 'BW' (see 38.211, section FFS_Section) + carrierBandwidth INTEGER (1..maxNrofPhysicalResourceBlocks), + ... +} + +-- TAG-SCS-SPECIFIC-CARRIER-STOP +-- TAG-SDAP-CONFIG-START + +SDAP-Config ::= SEQUENCE { + pdu-Session PDU-SessionID, + + -- FFS: separate configuration for UL and DL + sdap-HeaderDL ENUMERATED {present, absent}, + sdap-HeaderUL ENUMERATED {present, absent}, + defaultDRB BOOLEAN, + + -- A list of QoS-Flow-IDs that the UE shall map to the DRB of this SDAP-Config. + mappedQoS-FlowsToAdd SEQUENCE (SIZE (1..maxNrofQFIs)) OF QFI OPTIONAL, -- Need N + -- A list of QoS-Flow-IDs that the UE shall no longer map to the DRB of this SDAP-Config. + mappedQoS-FlowsToRelease SEQUENCE (SIZE (1..maxNrofQFIs)) OF QFI OPTIONAL, -- Need N + ... +} + +QFI ::= INTEGER (0..maxQFI) + +PDU-SessionID ::= INTEGER (0..255) + +-- TAG-SDAP-CONFIG-STOP +-- TAG-SEARCHSPACE-START + +SearchSpace ::= SEQUENCE { + -- Identity of the search space. SearchSpaceId = 0 identifies the SearchSpace configured via PBCH (MIB) or ServingCellConfigCommon. + -- The searchSpaceId is unique among the BWPs of a Serving Cell. + searchSpaceId SearchSpaceId, + + -- The CORESET applicable for this SearchSpace. + -- Value 0 identifies the common CORESET configured in MIB and in ServingCellConfigCommon + -- Values 1..maxNrofControlResourceSets-1 identify CORESETs configured by dedicated signalling + controlResourceSetId ControlResourceSetId OPTIONAL, -- Cond SetupOnly + + -- Slots for PDCCH Monitoring configured as periodicity and offset. Corresponds to L1 parameters 'Montoring-periodicity-PDCCH-slot' and + -- 'Montoring-offset-PDCCH-slot' (see 38.213, section 10) + monitoringSlotPeriodicityAndOffset CHOICE { + sl1 NULL, + sl2 INTEGER (0..1), + sl4 INTEGER (0..3), + sl5 INTEGER (0..4), + sl8 INTEGER (0..7), + sl10 INTEGER (0..9), + sl16 INTEGER (0..15), + sl20 INTEGER (0..19) + } OPTIONAL, -- Cond Setup + + -- Symbols for PDCCH monitoring in the slots configured for PDCCH monitoring (see monitoringSlotPeriodicityAndOffset). + -- The most significant (left) bit represents the first OFDM in a slot. The least significant (right) bit represents the last symbol. + -- Corresponds to L1 parameter 'Montoring-symbols-PDCCH-within-slot' (see 38.213, section 10) + monitoringSymbolsWithinSlot BIT STRING (SIZE (14)) OPTIONAL, -- Cond Setup + + -- Number of PDCCH candidates per aggregation level. Corresponds to L1 parameter 'Aggregation-level-1' to 'Aggregation-level-8'. + -- The number of candidates and aggregation levels configured here applies to all formats unless a particular value is specified or + -- a format-specific value is provided (see inside searchSpaceType). + -- (see 38.213, section 10) + nrofCandidates SEQUENCE { + aggregationLevel1 ENUMERATED {n0, n1, n2, n3, n4, n5, n6, n8}, + aggregationLevel2 ENUMERATED {n0, n1, n2, n3, n4, n5, n6, n8}, + aggregationLevel4 ENUMERATED {n0, n1, n2, n3, n4, n5, n6, n8}, + aggregationLevel8 ENUMERATED {n0, n1, n2, n3, n4, n5, n6, n8}, + aggregationLevel16 ENUMERATED {n0, n1, n2, n3, n4, n5, n6, n8} + } OPTIONAL, -- Cond Setup + + -- Indicates whether this is a common search space (present) or a UE specific search space as well as DCI formats to monitor for. + searchSpaceType CHOICE { + -- Configures this search space as common search space (CSS) and DCI formats to monitor. + common SEQUENCE { + -- If configured, the UE monitors the DCI formats 0_0 and 1_0 with CRC scrambled by C-RNTI, CS-RNTI (if configured), + -- SP-CSI-RNTI (if configured), RA-RNTI, TC-RNTI, P-RNTI, SI-RNTI + dci-Format0-0-AndFormat1-0 SEQUENCE { + ... + } OPTIONAL, -- Need R + -- If configured, UE monitors the DCI format format 2_0 with CRC scrambled by SFI-RNTI + dci-Format2-0 SEQUENCE { + -- The number of PDCCH candidates specifically for format 2-0 for the configured aggregation level. + -- If an aggregation level is absent, the UE does not search for any candidates with that aggregation level. + -- Corresponds to L1 parameters 'SFI-Num-PDCCH-cand' and 'SFI-Aggregation-Level' (see 38.213, section 11.1.1). + nrofCandidates-SFI SEQUENCE { + aggregationLevel1 ENUMERATED {n1, n2} OPTIONAL, -- Need R + aggregationLevel2 ENUMERATED {n1, n2} OPTIONAL, -- Need R + aggregationLevel4 ENUMERATED {n1, n2} OPTIONAL, -- Need R + aggregationLevel8 ENUMERATED {n1, n2} OPTIONAL, -- Need R + aggregationLevel16 ENUMERATED {n1, n2} OPTIONAL -- Need R + }, + ... + } OPTIONAL, -- Need R + -- If configured, UE monitors the DCI format format 2_1 with CRC scrambled by INT-RNTI + dci-Format2-1 SEQUENCE { + ... + } OPTIONAL, -- Need R + -- If configured, UE monitors the DCI format 2_2 with CRC scrambled by TPC-PUSCH-RNTI or TPC-PUCCH-RNTI + dci-Format2-2 SEQUENCE { + ... + } OPTIONAL, -- Need R + -- If configured, UE monitors the DCI format 2_3 with CRC scrambled by TPC-SRS-RNTI + dci-Format2-3 SEQUENCE { + -- Monitoring periodicity of SRS PDCCH in number of slots for DCI format 2-3. + -- Corresponds to L1 parameter 'SRS-monitoring-periodicity' (see 38.212, 38.213, section 7.3.1, 11.3) + monitoringPeriodicity ENUMERATED {n1, n2, n4, n5, n8, n10, n16, n20 } OPTIONAL, -- Cond Setup + + -- The number of PDCCH candidates for DCI format 2-3 for the configured aggregation level. + -- Corresponds to L1 parameter 'SRS-Num-PDCCH-cand' (see 38.212, 38.213, section 7.3.1, 11.3) + nrofPDCCH-Candidates ENUMERATED {n1, n2}, + ... + } OPTIONAL -- Need R + }, + -- Configures this search space as UE specific search space (USS). The UE monitors the DCI format with CRC scrambled + -- by C-RNTI, CS-RNTI (if configured), TC-RNTI (if a certain condition is met), and SP-CSI-RNTI (if configured) + ue-Specific SEQUENCE { + -- Indicates whether the UE monitors in this USS for DCI formats 0-0 and 1-0 or for formats 0-1 and 1-1. + dci-Formats ENUMERATED {formats0-0-And-1-0, formats0-1-And-1-1}, + ... + } + } OPTIONAL -- Cond Setup +} +-- TAG-SEARCHSPACE-STOP +-- TAG-SEARCHSPACEID-START + +SearchSpaceId ::= INTEGER (0..maxNrofSearchSpaces-1) + +-- TAG-SEARCHSPACEID-STOP +-- TAG-SECURITY-ALGORITHM-CONFIG-START + +SecurityAlgorithmConfig ::= SEQUENCE { + cipheringAlgorithm CipheringAlgorithm, + integrityProtAlgorithm IntegrityProtAlgorithm OPTIONAL, -- Need R + ... +} + +IntegrityProtAlgorithm ::= ENUMERATED { + nia0, nia1, nia2, nia3, spare4, spare3, + spare2, spare1, ...} + +CipheringAlgorithm ::= ENUMERATED { + nea0, nea1, nea2, nea3, spare4, spare3, + spare2, spare1, ...} + +-- TAG-SECURITY-ALGORITHM-CONFIG-STOP +-- TAG-SERV-CELL-INDEX-START + +ServCellIndex ::= INTEGER (0..maxNrofServingCells-1) + +-- TAG-SERV-CELL-INDEX-STOP +-- TAG-SERVING-CELL-CONFIG-START + +ServingCellConfig ::= SEQUENCE { + -- L1 parameters: + + tdd-UL-DL-ConfigurationDedicated TDD-UL-DL-ConfigDedicated OPTIONAL, -- Cond TDD + + -- The dedicated (UE-specific) configuration for the initial downlink bandwidth-part. + initialDownlinkBWP BWP-DownlinkDedicated OPTIONAL, -- Cond ServCellAdd + + -- List of additional downlink bandwidth parts to be released. (see 38.211, 38.213, section 12). + downlinkBWP-ToReleaseList SEQUENCE (SIZE (1..maxNrofBWPs)) OF BWP-Id OPTIONAL, -- Need N + -- List of additional downlink bandwidth parts to be added or modified. (see 38.211, 38.213, section 12). + downlinkBWP-ToAddModList SEQUENCE (SIZE (1..maxNrofBWPs)) OF BWP-Downlink OPTIONAL, -- Need N + + -- If configured for an SpCell, this field contains the ID of the DL BWP to be activated upon performing the reconfiguration + -- in which it is received. If the field is absent, the RRC reconfiguration does not impose a BWP switch (corresponds to L1 + -- parameter 'active-BWP-DL-Pcell'). + -- If configured for an SCell, this field contains the ID of the downlink bandwidth part to be used upon MAC-activation of an SCell. + -- If not provided, the UE uses the default BWP. + -- The initial bandwidth part is referred to by BWP-Id = 0. + firstActiveDownlinkBWP-Id BWP-Id OPTIONAL, -- Need R + + -- The duration in ms after which the UE falls back to the default Bandwidth Part. (see 38.321, section 5.15) + -- The value 0.5 ms is only applicable for carriers >6 GHz. + -- When the network releases the timer configuration, the UE stops the timer without swithching to the default BWP. + bwp-InactivityTimer ENUMERATED {ms2, ms3, ms4, ms5, ms6, ms8, ms10, ms20, ms30, ms40,ms50, ms60, ms80, + ms100, ms200, ms300, ms500, ms750, ms1280, ms1920, ms2560, spare10, spare9, + spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 } OPTIONAL, -- Need R + + -- Corresponds to L1 parameter 'default-DL-BWP'. The initial bandwidth part is referred to by BWP-Id = 0. + -- ID of the downlink bandwidth part to be used upon expiry of txxx. + -- This field is UE specific. When the field is absent the UE uses the the initial BWP as default BWP. + -- (see 38.211, 38.213, section 12 and 38.321, section 5.15) + defaultDownlinkBWP-Id BWP-Id OPTIONAL, -- Need M + + uplinkConfig UplinkConfig OPTIONAL, -- Cond ServCellAdd-UL + supplementaryUplink UplinkConfig OPTIONAL, -- Cond ServCellAdd-SUL + + + -- PDSCH releated parameters that are not BWP-specific. + pdsch-ServingCellConfig SetupRelease { PDSCH-ServingCellConfig } OPTIONAL, -- Need M + csi-MeasConfig SetupRelease { CSI-MeasConfig } OPTIONAL, -- Need M + + -- Includes parameters for configuration of carrier based SRS switching + -- Corresponds to L1 parameter 'SRS-CarrierSwitching' (see 38,214, section FFS_Section) + carrierSwitching SetupRelease { SRS-CarrierSwitching } OPTIONAL, -- Need M + -- MAC parameters: + sCellDeactivationTimer ENUMERATED {ms20, ms40, ms80, ms160, ms200, ms240, ms320, ms400, ms480, ms520, ms640, + ms720, ms840, ms1280, spare2,spare1} OPTIONAL, -- Cond ServingCellWithoutPUCCH + + -- Indicates whether this SCell is cross-carrier scheduled by another serving cell. + crossCarrierSchedulingConfig CrossCarrierSchedulingConfig OPTIONAL, -- Need M + + -- Timing Advance Group ID, as specified in TS 38.321 [3], which this cell belongs to. + tag-Id TAG-Id, + -- Enables the "UE beam lock function (UBF)", which disable changes to the UE beamforming configuration when in NR_RRC_CONNECTED. + -- FFS: Parameter added preliminary based on RAN4 LS in R4-1711823. Decide where to place it (maybe ServingCellConfigCommon or + -- in a BeamManagement IE??) + ue-BeamLockFunction ENUMERATED {enabled} OPTIONAL, -- Need R + + -- Indicates whether UE shall apply as pathloss reference either the downlink of PCell or of SCell that corresponds with this uplink + -- (see 38.213, section 7) + pathlossReferenceLinking ENUMERATED {pCell, sCell} OPTIONAL -- Cond SCellOnly +} + +UplinkConfig ::= SEQUENCE { + -- Configuration of UL BWPs (including BWP-specific parameters: + + -- The dedicated (UE-specific) configuration for the initial uplink bandwidth-part. + initialUplinkBWP BWP-UplinkDedicated OPTIONAL, -- Cond ServCellAdd + + -- The additional bandwidth parts for uplink. In case of TDD uplink- and downlink BWP with the same bandwidthPartId are considered + -- as a BWP pair and must have the same center frequency. + uplinkBWP-ToReleaseList SEQUENCE (SIZE (1..maxNrofBWPs)) OF BWP-Id OPTIONAL, -- Need N + uplinkBWP-ToAddModList SEQUENCE (SIZE (1..maxNrofBWPs)) OF BWP-Uplink OPTIONAL, -- Need N + + -- If configured for an SpCell, this field contains the ID of the DL BWP to be activated upon performing the reconfiguration + -- in which it is received. If the field is absent, the RRC reconfiguration does not impose a BWP switch (corresponds to + -- L1 parameter 'active-BWP-UL-Pcell'). + -- If configured for an SCell, this field contains the ID of the uplink bandwidth part to be used upon MAC-activation of an SCell. + -- If not provided, the UE uses the FFS: default BWP. + -- The initial bandwidth part is referred to by BandiwdthPartId = 0. + firstActiveUplinkBWP-Id BWP-Id OPTIONAL, -- Need R + + -- Configuration that is common across the UL BWPs: + + -- PUSCH related parameters that are not BWP-specific. + pusch-ServingCellConfig SetupRelease { PUSCH-ServingCellConfig } OPTIONAL, -- Need M + ... +} + +-- TAG-SERVING-CELL-CONFIG-STOP +-- TAG-SERVING-CELL-CONFIG-COMMON-START + +ServingCellConfigCommon ::= SEQUENCE { + physCellId PhysCellId OPTIONAL, -- Cond HOAndServCellAdd, + frequencyInfoDL FrequencyInfoDL OPTIONAL, -- Cond InterFreqHOAndServCellAdd + -- The initial downlink BWP configuration for a SpCell (PCell of MCG or SCG). + initialDownlinkBWP BWP-DownlinkCommon OPTIONAL, -- Cond ServCellAdd + + uplinkConfigCommon UplinkConfigCommon OPTIONAL, -- Cond ServCellAdd-UL + supplementaryUplinkConfig UplinkConfigCommon OPTIONAL, -- Cond ServCellAdd-SUL + + + -- Indicates the time domain positions of the transmitted SS-blocks in an SS-burst. The first/ leftmost bit corresponds to SS/PBCH + -- block index 0, the second bit corresponds to SS/PBCH block index 1, and so on. Value 0 in the bitmap indicates that the + -- corresponding SS/PBCH block is not transmitted while value 1 indicates that the corresponding SS/PBCH block is transmitted. + -- Corresponds to L1 parameter 'SSB-Transmitted' (see 38.213, section 4.1) + ssb-PositionsInBurst CHOICE { + -- bitmap for sub 3 GHz + shortBitmap BIT STRING (SIZE (4)), + -- bitmap for 3-6 GHz + mediumBitmap BIT STRING (SIZE (8)), + -- bitmap for above 6 GHz + longBitmap BIT STRING (SIZE (64)) + } OPTIONAL, -- Need R, + -- The SSB periodicity in msec for the rate matching purpose. If the field is absent, the UE applies the value ms5. + -- (see 38.211, section [7.4.3.1]) + ssb-periodicityServingCell ENUMERATED { ms5, ms10, ms20, ms40, ms80, ms160, spare2, spare1 } OPTIONAL, -- Need S + -- Position of (first) DL DM-RS (see 38.211, section 7.4.1.1.1) + dmrs-TypeA-Position ENUMERATED {pos2, pos3}, + + -- Parameters to determine an LTE CRS pattern that the UE shall rate match around. + lte-CRS-ToMatchAround SetupRelease { RateMatchPatternLTE-CRS } OPTIONAL, -- Need M + + -- Resources patterns which the UE should rate match PDSCH around. The UE rate matches around the union of all resources + -- indicated in the nested bitmaps. Rate match patterns defined here on cell level apply only to PDSCH of the same numerology. + -- Corresponds to L1 parameter 'Resource-set-cekk' (see 38.214, section 5.1.2.2.3) + rateMatchPatternToAddModList SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPattern OPTIONAL, -- Need N + rateMatchPatternToReleaseList SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPatternId OPTIONAL, -- Need N + + -- Subcarrier spacing of SSB. Used only for non-initial access (e.g. SCells, PCell of SCG). + -- If the field is absent the UE shall assume the default value of the band. + -- Only the values 15 or 30 kHz (<6GHz), 120 or 240 kHz (>6GHz) are applicable. + subcarrierSpacing SubcarrierSpacing OPTIONAL, -- Need S + -- A cell-specific TDD UL/DL configuration. Corresponds to L1 parameter 'UL-DL-configuration-common' (see 38.213, section 11.1) + tdd-UL-DL-ConfigurationCommon TDD-UL-DL-ConfigCommon OPTIONAL, -- Cond TDD + -- A second cell-specific TDD UL/DL configuration. When tdd-UL-DL-ConfigurationCommon2 is configured, the cell specific DL/UL + -- pattern is a concatenation of the pattern specified in tdd-UL-DL-ConfigurationCommon and the pattern specified in + -- tdd-UL-DL-ConfigurationCommon2. Corresponds to L1 parameter 'UL-DL-configuration-common-Set2' (see 38.211, section 11.1) + tdd-UL-DL-ConfigurationCommon2 TDD-UL-DL-ConfigCommon OPTIONAL, -- Cond TDD + -- TX power that the NW used for SSB transmission. The UE uses it to estimate the RA preamble TX power. + -- (see 38.213, section 7.4) + ss-PBCH-BlockPower INTEGER (-60..50), + ... +} + +UplinkConfigCommon ::= SEQUENCE { + -- Absolute uplink frequency configuration and subcarrier specific virtual carriers. + frequencyInfoUL FrequencyInfoUL OPTIONAL, -- Cond InterFreqHOAndServCellAdd + -- The initial uplink BWP configuration for a SpCell (PCell of MCG or SCG). Corresponds to L1 parameter 'initial-UL-BWP'. + -- (see 38.331, section FFS_Section). + initialUplinkBWP BWP-UplinkCommon OPTIONAL -- Cond ServCellAdd +} + +-- TAG-SERVING-CELL-CONFIG-COMMON-STOP +-- TAG-SINR-RANGE-START + +SINR-Range ::= INTEGER(0..127) + +-- TAG-SINR-RANGE-STOP +-- TAG-SLOTFORMATCOMBINATIONSPERCELL-START + +-- The SlotFormatCombinations applicable for one serving cell. Corresponds to L1 parameter 'cell-to-SFI' (see 38.213, section 11.1.1) +SlotFormatCombinationsPerCell ::= SEQUENCE { + -- The ID of the serving cell for which the slotFormatCombinations are applicable + servingCellId ServCellIndex, + + -- Reference subcarrier spacing for this Slot Format Combination. Corresponds to L1 parameter 'SFI-scs' (see 38.213, section FFS_Section) + subcarrierSpacing SubcarrierSpacing, + -- Reference subcarrier spacing for a Slot Format Combination on an FDD or SUL cell. + -- Corresponds to L1 parameter 'SFI-scs2' (see 38.213, section FFS_Section). + -- For FDD, subcarrierSpacing (SFI-scs) is the reference SCS for DL BWP and subcarrierSpacing2 (SFI-scs2) is the reference SCS for UL BWP. + -- For SUL, subcarrierSpacing (SFI-scs) is the reference SCS for non-SUL carrier and subcarrierSpacing2 (SFI-scs2) is the reference + -- SCS for SUL carrier. + subcarrierSpacing2 SubcarrierSpacing OPTIONAL, -- Need R + + -- A list with SlotFormatCombinations. Each SlotFormatCombination comprises of one or more SlotFormats (see 38.211, section 4.3.2) + -- FFS_CHECK: RAN1 indicates that the combinations could be of two different types... but they don't specify the second + slotFormatCombinations SEQUENCE (SIZE (1..maxNrofSlotFormatCombinationsPerSet)) OF SlotFormatCombination OPTIONAL, + + -- The (starting) position (bit) of the slotFormatCombinationId (SFI-Index) for this serving cell (servingCellId) within the DCI payload. + -- Corresponds to L1 parameter 'SFI-values' (see 38.213, section FFS_Section) + positionInDCI INTEGER(0..maxSFI-DCI-PayloadSize-1) OPTIONAL, + ... +} + +SlotFormatCombination ::= SEQUENCE { + -- This ID is used in the DCI payload to dynamically select this SlotFormatCombination. + -- Corresponds to L1 parameter 'SFI-index' (see 38.213, section FFS_Section) + slotFormatCombinationId SlotFormatCombinationId, + -- Slot formats that occur in consecutive slots in time domain order as listed here. The the slot formats are + -- defined in 38.211, table 4.3.2-3 and numbered with 0..255. + slotFormats SEQUENCE (SIZE (1..maxNrofSlotFormatsPerCombination)) OF INTEGER (0..255) +} + +-- SFI index that is assoicated with a certian slot-format-combination +-- Corresponds to L1 parameter 'SFI-index' (see 38.213, section FFS_Section) +SlotFormatCombinationId ::= INTEGER (0..maxNrofSlotFormatCombinationsPerSet-1) + +-- TAG-SLOTFORMATCOMBINATIONSPERCELL-STOP +-- TAG-SLOTFORMATINDICATOR-START + +SlotFormatIndicator ::= SEQUENCE { + -- RNTI used for SFI on the given cell + -- Corresponds to L1 parameter 'SFI-RNTI' (see 38.213, section 11.1.1) + sfi-RNTI RNTI-Value, + + -- Total length of the DCI payload scrambled with SFI-RNTI. + -- Corresponds to L1 parameter 'SFI-DCI-payload-length' (see 38.213, section 11.1.1) + dci-PayloadSize INTEGER (1..maxSFI-DCI-PayloadSize), + + -- A list of SlotFormatCombinations for the UE's serving cells. + -- Corresponds to L1 parameter 'SFI-cell-to-SFI' (see 38.213, section 11.1.1) + slotFormatCombToAddModList SEQUENCE (SIZE(1..maxNrofAggregatedCellsPerCellGroup)) OF SlotFormatCombinationsPerCell OPTIONAL, -- Need N + slotFormatCombToReleaseList SEQUENCE (SIZE(1..maxNrofAggregatedCellsPerCellGroup)) OF ServCellIndex OPTIONAL, -- Need N + ... +} + +-- TAG-SLOTFORMATINDICATOR-STOP +-- TAG-SPS-CONFIG-START + +-- Downlink SPS may be configured on the PCell as well as on SCells. But it shall not be configured for more than +-- one serving cell of a cell group at once. +SPS-Config ::= SEQUENCE { + -- Periodicity for DL SPS + -- Corresponds to L1 parameter 'semiPersistSchedIntervalDL' (see 38.214 and 38.321, section FFS_Section) + -- FFS-Value: Support also shorter periodicities for DL? + periodicity ENUMERATED {ms10, ms20, ms32, ms40, ms64, ms80, ms128, ms160, ms320, ms640, + spare6, spare5, spare4, spare3, spare2, spare1}, + -- Number of configured HARQ processes for SPS DL. Corresponds to L1 parameter 'numberOfConfSPS-Processes' (see 38.214, section FFS_Section) + nrofHARQ-Processes INTEGER (1..8), + -- HARQ resource for PUCCH for DL SPS. The network configures the resource either as format0 or format1. (see 38.214, section FFS_Section) + n1PUCCH-AN PUCCH-Resource OPTIONAL -- Need M +} + +-- TAG-SPS-CONFIG-STOP +-- TAG-SRB-IDENTITY-START + +SRB-Identity ::= INTEGER (1..3) + +-- TAG-SRB-IDENTITY-STOP +-- TAG-SRS-CONFIG-START + +SRS-Config ::= SEQUENCE { + srs-ResourceSetToReleaseList SEQUENCE (SIZE(0..maxNrofSRS-ResourceSets)) OF SRS-ResourceSetId OPTIONAL, -- Need N + srs-ResourceSetToAddModList SEQUENCE (SIZE(0..maxNrofSRS-ResourceSets)) OF SRS-ResourceSet OPTIONAL, -- Need N + + srs-ResourceToReleaseList SEQUENCE (SIZE(1..maxNrofSRS-Resources)) OF SRS-ResourceId OPTIONAL, -- Need N + srs-ResourceToAddModList SEQUENCE (SIZE(1..maxNrofSRS-Resources)) OF SRS-Resource OPTIONAL, -- Need N + + + -- If absent, UE applies TPC commands via accumulation. If disabled, UE applies the TPC command without accumulation + -- (this applies to SRS when a separate closed loop is configured for SRS) + -- Corresponds to L1 parameter 'Accumulation-enabled-srs' (see 38,213, section 7.3) + tpc-Accumulation ENUMERATED {disabled} OPTIONAL, -- Need S + ... +} + +SRS-ResourceSet ::= SEQUENCE { + -- The ID of this resource set. It is unique in the context of the BWP in which the parent SRS-Config is defined. + srs-ResourceSetId SRS-ResourceSetId, + -- The IDs of the SRS-Reosurces used in this SRS-ResourceSet + srs-ResourceIdList SEQUENCE (SIZE(1..maxNrofSRS-ResourcesPerSet)) OF SRS-ResourceId OPTIONAL, -- Cond Setup + + resourceType CHOICE { + aperiodic SEQUENCE { + -- The DCI "code point" upon which the UE shall transmit SRS according to this SRS resource set configuration. + -- Corresponds to L1 parameter 'AperiodicSRS-ResourceTrigger' (see 38.214, section 6.1.1.2) + aperiodicSRS-ResourceTrigger INTEGER (0..maxNrofSRS-TriggerStates-1), + -- ID of CSI-RS resource associated with this SRS resource set. (see 38.214, section 6.1.1.2) + csi-RS NZP-CSI-RS-ResourceId, + -- An offset in number of slots between the triggering DCI and the actual transmission of this SRS-ResourceSet. + -- If the field is absent the UE applies no offset (value 0) + slotOffset INTEGER (1..8) OPTIONAL, -- Need S + ... + }, + semi-persistent SEQUENCE { + -- ID of CSI-RS resource associated with this SRS resource set in non-codebook based operation. + -- Corresponds to L1 parameter 'SRS-AssocCSIRS' (see 38.214, section 6.2.1) + associatedCSI-RS NZP-CSI-RS-ResourceId OPTIONAL, -- Cond nonCodebook + ... + }, + periodic SEQUENCE { + -- ID of CSI-RS resource associated with this SRS resource set in non-codebook based operation. + -- Corresponds to L1 parameter 'SRS-AssocCSIRS' (see 38.214, section 6.2.1) + associatedCSI-RS NZP-CSI-RS-ResourceId OPTIONAL, -- Cond nonCodebook + ... + } + }, + -- Indicates if the SRS resource set is used for beam management vs. used for either codebook based or non-codebook based transmission. + -- Corresponds to L1 parameter 'SRS-SetUse' (see 38.214, section 6.2.1) + -- FFS_CHECK: Isn't codebook/noncodebook already known from the ulTxConfig in the SRS-Config? If so, isn't the only distinction + -- in the set between BeamManagement, AtennaSwitching and "Other”? Or what happens if SRS-Config=Codebook but a Set=NonCodebook? + usage ENUMERATED {beamManagement, codebook, nonCodebook, antennaSwitching}, + + -- alpha value for SRS power control. Corresponds to L1 parameter 'alpha-srs' (see 38.213, section 7.3) + -- When the field is absent the UE applies the value 1 + alpha Alpha OPTIONAL, -- Need S + -- P0 value for SRS power control. The value is in dBm. Only even values (step size 2) are allowed. + -- Corresponds to L1 parameter 'p0-srs' (see 38.213, section 7.3) + p0 INTEGER (-202..24) OPTIONAL, -- Cond Setup + -- A reference signal (e.g. a CSI-RS config or a SSblock) to be used for SRS path loss estimation. + -- Corresponds to L1 parameter 'srs-pathlossReference-rs-config' (see 38.213, section 7.3) + pathlossReferenceRS CHOICE { + ssb-Index SSB-Index, + csi-RS-Index NZP-CSI-RS-ResourceId + } OPTIONAL, -- Need M + -- Indicates whether hsrs,c(i) = fc(i,1) or hsrs,c(i) = fc(i,2) (if twoPUSCH-PC-AdjustmentStates are configured) + -- or serarate close loop is configured for SRS. This parameter is applicable only for Uls on which UE also transmits PUSCH. + -- If absent or release, the UE applies the value sameAs-Fci1 + -- Corresponds to L1 parameter 'srs-pcadjustment-state-config' (see 38.213, section 7.3) + srs-PowerControlAdjustmentStates ENUMERATED { sameAsFci2, separateClosedLoop} OPTIONAL, -- Need S + ... +} + +SRS-ResourceSetId ::= INTEGER (0..maxNrofSRS-ResourceSets-1) + +SRS-Resource ::= SEQUENCE { + srs-ResourceId SRS-ResourceId, + nrofSRS-Ports ENUMERATED {port1, ports2, ports4}, + -- The PTRS port index for this SRS resource for non-codebook based UL MIMO. This is only applicable when the corresponding + -- PTRS-UplinkConfig is set to CP-OFDM. The ptrs-PortIndex configured here must be smaller than or equal to the maxNnrofPorts + -- configured in the PTRS-UplinkConfig. + -- Corresponds to L1 parameter 'UL-PTRS-SRS-mapping-non-CB' (see 38.214, section 6.1) + ptrs-PortIndex ENUMERATED {n0, n1 } OPTIONAL, -- Need R + -- Comb value (2 or 4) and comb offset (0..combValue-1). Corresponds to L1 parameter 'SRS-TransmissionComb' (see 38.214, section 6.2.1) + transmissionComb CHOICE { + n2 SEQUENCE { + combOffset-n2 INTEGER (0..1), + -- Cyclic shift configuration. Corresponds to L1 parameter 'SRS-CyclicShiftConfig' (see 38.214, section 6.2.1) + cyclicShift-n2 INTEGER (0..7) + }, + n4 SEQUENCE { + combOffset-n4 INTEGER (0..3), + -- Cyclic shift configuration. Corresponds to L1 parameter 'SRS-CyclicShiftConfig' (see 38.214, section 6.2.1) + cyclicShift-n4 INTEGER (0..11) + } + }, + -- OFDM symbol location of the SRS resource within a slot including number of OFDM symbols (N = 1, 2 or 4 per SRS resource), + -- startPosition (SRSSymbolStartPosition = 0..5; "0" refers to the last symbol, "1" refers to the second last symbol) and + -- RepetitionFactor (r = 1, 2 or 4). + -- Corresponds to L1 parameter 'SRS-ResourceMapping' (see 38.214, section 6.2.1 and 38.211, section 6.4.1.4). + -- FFS: Apparently, RAN1 considers replacing these three fields by a table in RAN1 specs and a corresponding index in ASN.1?! + resourceMapping SEQUENCE { + startPosition INTEGER (0..5), + nrofSymbols ENUMERATED {n1, n2, n4}, + repetitionFactor ENUMERATED {n1, n2, n4} + }, + -- Parameter(s) defining frequency domain position and configurable shift to align SRS allocation to 4 PRB grid. + -- Corresponds to L1 parameter 'SRS-FreqDomainPosition' (see 38.214, section 6.2.1) + freqDomainPosition INTEGER (0..67), + freqDomainShift INTEGER (0..268), + -- Includes parameters capturing SRS frequency hopping + -- Corresponds to L1 parameter 'SRS-FreqHopping' (see 38.214, section 6.2.1) + freqHopping SEQUENCE { + c-SRS INTEGER (0..63), + b-SRS INTEGER (0..3), + b-hop INTEGER (0..3) + }, + -- Parameter(s) for configuring group or sequence hopping + -- Corresponds to L1 parameter 'SRS-GroupSequenceHopping' (see 38.211, section FFS_Section) + groupOrSequenceHopping ENUMERATED { neither, groupHopping, sequenceHopping }, + -- Time domain behavior of SRS resource configuration. + -- Corresponds to L1 parameter 'SRS-ResourceConfigType' (see 38.214, section 6.2.1). + -- For codebook based uplink transmission, the network configures SRS resources in the same resource set with the same + -- time domain behavior on periodic, aperiodic and semi-persistent SRS. + -- FFS: Add configuration parameters for the different SRS resource types? + resourceType CHOICE { + aperiodic SEQUENCE { + ... + }, + semi-persistent SEQUENCE { + -- Periodicity and slot offset for for this SRS resource. All values in "number of slots". + -- sl1 corresponds to a periodicity of 1 slot, value sl2 corresponds to a periodicity of 2 slots, and so on. + -- For each periodicity the corresponding offset is given in number of slots. For periodicity sl1 the offset is 0 slots. + -- Corresponds to L1 parameter 'SRS-SlotConfig' (see 38.214, section 6.2.1) + periodicityAndOffset-sp SRS-PeriodicityAndOffset, + ... + }, + periodic SEQUENCE { + -- Periodicity and slot offset for for this SRS resource. All values in "number of slots" + -- sl1 corresponds to a periodicity of 1 slot, value sl2 corresponds to a periodicity of 2 slots, and so on. + -- For each periodicity the corresponding offset is given in number of slots. For periodicity sl1 the offset is 0 slots. + -- Corresponds to L1 parameter 'SRS-SlotConfig' (see 38.214, section 6.2.1) + periodicityAndOffset-p SRS-PeriodicityAndOffset, + ... + } + }, + -- Sequence ID used to initialize psedo random group and sequence hopping. + -- Corresponds to L1 parameter 'SRS-SequenceId' (see 38.214, section 6.2.1) + sequenceId BIT STRING (SIZE (10)), + + -- Configuration of the spatial relation between a reference RS and the target SRS. Reference RS can be SSB/CSI-RS/SRS + -- Corresponds to L1 parameter 'SRS-SpatialRelationInfo' (see 38.214, section 6.2.1) + spatialRelationInfo CHOICE { + ssb-Index SSB-Index, + csi-RS-Index NZP-CSI-RS-ResourceId, + srs SRS-ResourceId + } OPTIONAL, -- Need R + ... +} + +SRS-ResourceId ::= INTEGER (0..maxNrofSRS-Resources-1) + +SRS-PeriodicityAndOffset ::= CHOICE { + sl1 NULL, + sl2 INTEGER(0..1), + sl4 INTEGER(0..3), + sl5 INTEGER(0..4), + sl8 INTEGER(0..7), + sl10 INTEGER(0..9), + sl16 INTEGER(0..15), + sl20 INTEGER(0..19), + sl32 INTEGER(0..31), + sl40 INTEGER(0..39), + sl64 INTEGER(0..63), + sl80 INTEGER(0..79), + sl160 INTEGER(0..159), + sl320 INTEGER(0..319), + sl640 INTEGER(0..639), + sl1280 INTEGER(0..1279), + sl2560 INTEGER(0..2559) +} + +-- TAG-SRS-CONFIG-STOP +-- TAG-SRS-CARRIERSWITCHING-START +SRS-CarrierSwitching ::= SEQUENCE { + + -- Indicates the serving cell whose UL transmission may be interrupted during SRS transmission on a PUSCH-less cell. + -- During SRS transmission on a PUSCH-less cell, the UE may temporarily suspend the UL transmission on a serving cell with PUSCH + -- in the same CG to allow the PUSCH-less cell to transmit SRS. (see 38.214, section 6.2.1.3) + srs-SwitchFromServCellIndex INTEGER (0..31) OPTIONAL, -- Cond Setup + + -- Network configures the UE with either typeA-SRS-TPC-PDCCH-Group or typeB-SRS-TPC-PDCCH-Group, if any. + srs-TPC-PDCCH-Group CHOICE { + -- Type A trigger configuration for SRS transmission on a PUSCH-less SCell. + -- Corresponds to L1 parameter 'typeA-SRS-TPC-PDCCH-Group' (see 38.212, 38.213, section 7.3.1, 11.3) + typeA SEQUENCE (SIZE (1..32)) OF SRS-TPC-PDCCH-Config, + -- Type B trigger configuration for SRS transmission on a PUSCH-less SCell. + -- Corresponds to L1 parameter 'typeB-SRS-TPC-PDCCH-Config' (see 38.212, 38.213, section 7.3.1, 11.3) + typeB SRS-TPC-PDCCH-Config + } OPTIONAL, -- Cond Setup + + -- Maps a specific cell to a given SFI value within the DCI message + -- Corresponds to L1 parameter 'SRS-cell-to-SFI' (see 38.212, 38.213, section 7.3.1, 11.3) + srs-CellToSFI SEQUENCE (SIZE (1..maxNrofServingCells)) OF SlotFormatCombinationsPerCell OPTIONAL, -- Cond Setup + + -- A set of serving cells for monitoring PDCCH conveying SRS DCI format with CRC scrambled by TPC-SRS-RNTI + -- Corresponds to L1 parameter 'SRS-monitoring-cells' (see 38.212, 38.213, section 7.3.1, 11.3) + monitoringCells SEQUENCE (SIZE (1..maxNrofServingCells)) OF ServCellIndex OPTIONAL, -- Cond Setup + ... +} + +-- One trigger configuration for SRS-Carrier Switching. (see 38.212, 38.213, section 7.3.1, 11.3) +SRS-TPC-PDCCH-Config ::= SEQUENCE { + -- The starting bit position of a block within the group DCI with SRS request fields (optional) and TPC commands + -- for a PUSCH-less SCell. (see 38.212, 38.213, section 7.3.1, 11.3) + startingBitOfFormat2-3 INTEGER (1..31) OPTIONAL, -- Cond Setup + -- The type of a field within the group DCI with SRS request fields (optional) for a PUSCH-less SCell, + -- which indicates how many bits in the field are for SRS request (0 or 1/2). + -- Note that for Type A, there is a common SRS request field for all SCells in the set, but each SCell has its + -- own TPC command bits. See TS 38.212. Network configures this field with the same value for all PUSCH-less SCells. + -- (see 38.212, 38.213, section 7.3.1, 11.3) + fieldTypeFormat2-3 INTEGER (0..1) OPTIONAL, -- Cond Setup + -- A list of paris of [cc-SetIndex; cc-IndexInOneCC-Set] (see 38.212, 38.213, section 7.3.1, 11.3) + -- FFS: Improve description. What is a "CC"? Where is a CC-Set defined? ... + srs-CC-SetIndexlist SEQUENCE (SIZE(1..4)) OF SRS-CC-SetIndex OPTIONAL -- Cond Setup +} + +SRS-CC-SetIndex ::= SEQUENCE { + -- Indicates the CC set index for Type A associated (see 38.212, 38.213, section 7.3.1, 11.3) + cc-SetIndex INTEGER (0..3) OPTIONAL, -- Cond Setup + -- Indicates the CC index in one CC set for Type A (see 38.212, 38.213, section 7.3.1, 11.3) + cc-IndexInOneCC-Set INTEGER (0..7) OPTIONAL -- Cond Setup +} + +-- TAG-SRS-CARRIERSWITCHING-STOP +-- TAG-SSB-INDEX-START + +SSB-Index ::= INTEGER (0..63) + +-- TAG-SSB-INDEX-STOP +-- TAG-SUBCARRIER-SPACING-START + +-- The subcarrier spacing supported in NR. Restrictions applicable for certain frequencies, channels or signals are clarified +-- in the fields that use this IE. +SubcarrierSpacing ::= ENUMERATED {kHz15, kHz30, kHz60, kHz120, kHz240, spare3, spare2, spare1} + + +-- TAG-SUBCARRIER-SPACING-STOP +-- TAG-TCI-STATE-START + +TCI-State ::= SEQUENCE { + tci-StateId TCI-StateId, + qcl-Type1 QCL-Info, + qcl-Type2 QCL-Info OPTIONAL, -- Need R + nrofPTRS-Ports ENUMERATED {n1, n2} OPTIONAL, -- Need R + ... +} + +QCL-Info ::= SEQUENCE { + + -- The carrier which the RS is located in. If the field is absent, it applies to the serving cell in which the TCI-State is configured + cell ServCellIndex OPTIONAL, -- Need R + + -- The DL BWP which the RS is located in. + bwp-Id BWP-Id OPTIONAL, -- Cond CSI-RS-Indicated + -- Cond NZP-CSI-RS-Indicated: mandatory if csi-rs or csi-RS-for-tracking is included, absent otherwise + referenceSignal CHOICE { + csi-rs NZP-CSI-RS-ResourceId, + ssb SSB-Index, + -- A set of CSI-RS resources for tracking + csi-RS-for-tracking NZP-CSI-RS-ResourceSetId + }, + qcl-Type ENUMERATED {typeA, typeB, typeC, typeD}, + ... +} + +-- TAG-TCI-STATE-STOP +-- TAG-TCI-STATEID-START + +TCI-StateId ::= INTEGER (0..maxNrofTCI-States-1) + +-- TAG-TCI-STATEID-STOP +-- TAG-TDD-UL-DL-CONFIG-START + +TDD-UL-DL-ConfigCommon ::= SEQUENCE { + -- Reference SCS used to determine the time domain boundaries in the UL-DL pattern which must be common across all subcarrier specific + -- virtual carriers, i.e., independent of the actual subcarrier spacing using for data transmission. + -- Only the values 15 or 30 kHz (<6GHz), 60 or 120 kHz (>6GHz) are applicable. + -- Corresponds to L1 parameter 'reference-SCS' (see 38.211, section FFS_Section) + referenceSubcarrierSpacing SubcarrierSpacing OPTIONAL, + -- Periodicity of the DL-UL pattern. Corresponds to L1 parameter 'DL-UL-transmission-periodicity' (see 38.211, section FFS_Section) + dl-UL-TransmissionPeriodicity ENUMERATED {ms0p5, ms0p625, ms1, ms1p25, ms2, ms2p5, ms5, ms10} OPTIONAL, + + -- Number of consecutive full DL slots at the beginning of each DL-UL pattern. + -- Corresponds to L1 parameter 'number-of-DL-slots' (see 38.211, Table 4.3.2-1) + nrofDownlinkSlots INTEGER (0..maxNrofSlots) OPTIONAL, + + -- Number of consecutive DL symbols in the beginning of the slot following the last full DL slot (as derived from nrofDownlinkSlots). + -- If the field is absent or released, there is no partial-downlink slot. + -- Corresponds to L1 parameter 'number-of-DL-symbols-common' (see 38.211, section FFS_Section). + nrofDownlinkSymbols INTEGER (0..maxNrofSymbols-1) OPTIONAL, -- Need R + + -- Number of consecutive full UL slots at the end of each DL-UL pattern. + -- Corresponds to L1 parameter 'number-of-UL-slots' (see 38.211, Table 4.3.2-1) + nrofUplinkSlots INTEGER (0..maxNrofSlots) OPTIONAL, + + -- Number of consecutive UL symbols in the end of the slot preceding the first full UL slot (as derived from nrofUplinkSlots). + -- If the field is absent or released, there is no partial-uplink slot. + -- Corresponds to L1 parameter 'number-of-UL-symbols-common' (see 38.211, section FFS_Section) + nrofUplinkSymbols INTEGER (0..maxNrofSymbols-1) OPTIONAL -- Need R +} + +TDD-UL-DL-ConfigDedicated ::= SEQUENCE { + -- The slotSpecificConfiguration allows overriding UL/DL allocations provided in tdd-UL-DL-configurationCommon. + -- FFS_ASN1: Consider making this an AddMod/Release list + -- FFS_ASN1: Replace absolute numbers by variables... once RAN1 confirms. + -- FFS_CHECK: This list will grow very large if used for many slots. + slotSpecificConfigurationsToAddModList SEQUENCE (SIZE (1..maxNrofSlots)) OF TDD-UL-DL-SlotConfig OPTIONAL, -- Need N + slotSpecificConfigurationsToreleaseList SEQUENCE (SIZE (1..maxNrofSlots)) OF TDD-UL-DL-SlotIndex OPTIONAL -- Need N +} + +TDD-UL-DL-SlotConfig ::= SEQUENCE { + -- Identifies a slot within a dl-UL-TransmissionPeriodicity (given in tdd-UL-DL-configurationCommon) + slotIndex TDD-UL-DL-SlotIndex, + + -- The direction (downlink or uplink) for the symbols in this slot. "allDownlink" indicates that all symbols in this slot are used + -- for downlink; "allUplink" indicates that all symbols in this slot are used for uplink; "explicit" indicates explicitly how many symbols + -- in the beginning and end of this slot are allocated to downlink and uplink, respectively. + symbols CHOICE { + allDownlink NULL, + allUplink NULL, + explicit SEQUENCE { + -- Number of consecutive DL symbols in the beginning of the slot identified by slotIndex. + -- If the field is absent the UE assumes that there are no leading DL symbols. + -- Corresponds to L1 parameter 'number-of-DL-symbols-dedicated' (see 38.211, section FFS_Section) + nrofDownlinkSymbols INTEGER (1..maxNrofSymbols-1) OPTIONAL, -- Need S + + -- Number of consecutive UL symbols in the end of the slot identified by slotIndex. + -- If the field is absent the UE assumes that there are no trailing UL symbols. + -- Corresponds to L1 parameter 'number-of-UL-symbols-dedicated' (see 38.211, section FFS_Section) + nrofUplinkSymbols INTEGER (1..maxNrofSymbols-1) OPTIONAL -- Need S + } + } +} + +TDD-UL-DL-SlotIndex ::= INTEGER (0..maxNrofSlots-1) + +-- TAG-TDD-UL-DL-CONFIG-STOP + +TimeToTrigger ::= ENUMERATED { + ms0, ms40, ms64, ms80, ms100, ms128, ms160, ms256, + ms320, ms480, ms512, ms640, ms1024, ms1280, ms2560, + ms5120} + +-- TAG-ZP-CSI-RS-RESOURCE-START + +ZP-CSI-RS-Resource ::= SEQUENCE { + -- ZP CSI-RS resource configuration ID + -- Corresponds to L1 parameter 'ZP-CSI-RS-ResourceConfigId' (see 38.214, section 5.1.4.2) + zp-CSI-RS-ResourceId ZP-CSI-RS-ResourceId, + -- OFDM symbol and subcarrier occupancy of the ZP-CSI-RS resource within a slot + resourceMapping CSI-RS-ResourceMapping, + -- Periodicity and slot offset for periodic/semi-persistent ZP-CSI-RS + -- Corresponds to L1 parameter 'ZP-CSI-RS-timeConfig' (see 38.214, section 5.1.4.2) + periodicityAndOffset CSI-ResourcePeriodicityAndOffset OPTIONAL, --Cond PeriodicOrSemiPersistent + + ... +} + +ZP-CSI-RS-ResourceId ::= INTEGER (0..maxNrofZP-CSI-RS-Resources-1) + +-- TAG-ZP-CSI-RS-RESOURCE-STOP +-- TAG-ZP-CSI-RS-RESOURCESET-START + +ZP-CSI-RS-ResourceSet ::= SEQUENCE { + zp-CSI-RS-ResourceSetId ZP-CSI-RS-ResourceSetId, + -- The list of ZP-CSI-RS-ResourceId identifying the ZP-CSI-RS-Resource elements belonging to this set. + zp-CSI-RS-ResourceIdList SEQUENCE (SIZE(1..maxNrofZP-CSI-RS-ResourcesPerSet)) OF ZP-CSI-RS-ResourceId, + -- Time domain behavior of ZP-CSI-RS resource configuration. + -- Corresponds to L1 parameter 'ZP-CSI-RS-ResourceConfigType' (see 38.214, section 5.1.4.2) + resourceType ENUMERATED {aperiodic, semiPersistent, periodic}, + ... +} + +-- TAG-ZP-CSI-RS-RESOURCESET-STOP +-- TAG-ZP-CSI-RS-RESOURCESETID-START + +ZP-CSI-RS-ResourceSetId ::= INTEGER (0..maxNrofZP-CSI-RS-ResourceSets-1) + +-- TAG-ZP-CSI-RS-RESOURCESETID-STOP +-- TAG-BANDCOMBINATIONLIST-START + +BandCombinationList ::= SEQUENCE (SIZE (1..maxBandComb)) OF BandCombination + +BandCombination ::= SEQUENCE { + bandAndDL-ParametersList BandAndDL-ParametersList, + bandCombinationsUL BIT STRING (SIZE (1.. maxBandComb)), + bandCombinationParametersList SEQUENCE (SIZE (1..maxBandComb)) OF BandCombinationParameters OPTIONAL +} + +BandAndDL-ParametersList ::= SEQUENCE (SIZE (1..maxSimultaneousBands)) OF BandAndDL-Parameters + +BandAndDL-Parameters ::= CHOICE { + bandAndDL-ParametersEUTRA BandAndDL-ParametersEUTRA, + bandAndDL-ParametersNR BandAndDL-ParametersNR +} +BandCombinationParameters ::= SEQUENCE { + ca-ParametersNR CA-ParametersNR OPTIONAL, + mrdc-Parameters MRDC-Parameters OPTIONAL +} + +CA-ParametersNR ::= SEQUENCE { + multipleTimingAdvances ENUMERATED {supported} OPTIONAL, +-- R4 2-5: Simultaneous reception and transmission for inter band CA (TDD-TDD or TDD-FDD) + simultaneousRxTxInterBandCA ENUMERATED {supported} OPTIONAL, +-- BCS related to R4 2-1 and Updated CA BW class in R4-1803374 + supportedBandwidthCombinationSet BIT STRING (SIZE (1..32)) OPTIONAL +} + +MRDC-Parameters ::= SEQUENCE { + singleUL-Transmission ENUMERATED {supported} OPTIONAL, +-- R4 1-10: Support of EN-DC with LTE-NR coexistence in UL sharing from UE perspective + ul-SharingEUTRA-NR ENUMERATED {supported} OPTIONAL, +-- R4 1-11: Switching time between LTE UL and NR UL for EN-DC with LTE-NR coexistence in UL sharing from UE perspective + ul-SwitchingTimeEUTRA-NR ENUMERATED {type1, type2} OPTIONAL, +-- R4 2-4: Simultaneous reception and transmission for inter-band EN-DC (TDD-TDD or TDD-FDD) + simultaneousRxTxInterBandENDC ENUMERATED {supported} OPTIONAL, +-- R4 2-6: Asynchronous FDD-FDD intra-band EN-DC + asyncIntraBandENDC ENUMERATED {supported} OPTIONAL, + basebandProcesingCombinationMRDC BasebandProcessingCombinationMRDC +} + +BandAndDL-ParametersEUTRA ::= SEQUENCE { + bandEUTRA FreqBandIndicatorEUTRA, + ca-BandwidthClassDL-EUTRA CA-BandwidthClassEUTRA OPTIONAL, + intraBandContiguousCC-InfoDL-EUTRA-List SEQUENCE (SIZE (1.. maxNrofServingCellsEUTRA)) OF IntraBandContiguousCC-InfoDL-EUTRA OPTIONAL +} + +BandAndDL-ParametersNR ::= SEQUENCE { + bandNR FreqBandIndicatorNR, + ca-BandwidthClassDL CA-BandwidthClassNR OPTIONAL, +-- R4 2-3: Non-contiguous intra-band CA frequency separation class for FR2 as in the RAN4 LS R4-1803363 + intraBandFreqSeparationDL FreqSeparationClass OPTIONAL, + intraBandContiguousCC-InfoDL-List SEQUENCE (SIZE (1.. maxNrofServingCells)) OF IntraBandContiguousCC-InfoDL OPTIONAL +} + +IntraBandContiguousCC-InfoDL ::= SEQUENCE { +-- Related to RAN4 LS R2-1804078 + maxNumberMIMO-LayersPDSCH MIMO-LayersDL OPTIONAL +} + +IntraBandContiguousCC-InfoDL-EUTRA ::= SEQUENCE { +-- Related to RAN4 LS R2-1804078 + mimo-CapabilityDL ENUMERATED {twoLayers, fourLayers, eightLayers} OPTIONAL +} + +-- TAG-BANDCOMBINATIONLIST-STOP +-- TAG-BANDCOMBINATIONPARAMETERSULLIST-START + +BandCombinationParametersUL-List ::= SEQUENCE (SIZE (1..maxBandComb)) OF BandCombinationParametersUL + +BandCombinationParametersUL ::= SEQUENCE (SIZE (1.. maxSimultaneousBands)) OF BandParametersUL + +BandParametersUL ::= CHOICE { + bandParametersUL-EUTRA BandParametersUL-EUTRA, + bandParametersUL-NR BandParametersUL-NR +} + +BandParametersUL-EUTRA ::= SEQUENCE { + ca-BandwidthClassUL-EUTRA CA-BandwidthClassEUTRA OPTIONAL, + intraBandContiguousCC-InfoUL-EUTRA-List SEQUENCE (SIZE (1.. maxNrofServingCellsEUTRA)) OF IntraBandContiguousCC-InfoUL-EUTRA OPTIONAL +} + +BandParametersUL-NR ::= SEQUENCE { + ca-BandwidthClassUL CA-BandwidthClassNR OPTIONAL, +-- R4 2-3: Non-contiguous intra-band CA frequency separation class for FR2 as in the RAN4 LS R4-1803363 + intraBandFreqSeparationUL FreqSeparationClass OPTIONAL, + intraBandContiguousCC-InfoUL-List SEQUENCE (SIZE (1.. maxNrofServingCells)) OF IntraBandContiguousCC-InfoUL OPTIONAL +} + +IntraBandContiguousCC-InfoUL ::= SEQUENCE { +-- Related to RAN4 LS R2-1804078 + maxNumberMIMO-LayersCB-PUSCH MIMO-LayersUL OPTIONAL, + maxNumberMIMO-LayersNonCB-PUSCH MIMO-LayersUL OPTIONAL +} + +IntraBandContiguousCC-InfoUL-EUTRA ::= SEQUENCE { +-- Related to RAN4 LS R2-1804078 + mimo-CapabilityUL ENUMERATED {twoLayers, fourLayers} OPTIONAL +} + +-- TAG-BANDCOMBINATIONPARAMETERSULLIST-STOP +-- TAG-BASEBANDCOMBINATIONPARAMETERSULLIST-START + +BasebandCombinationParametersUL-List ::= SEQUENCE (SIZE (1..maxBasebandProcComb)) OF BasebandCombinationParametersUL + +BasebandCombinationParametersUL ::= SEQUENCE (SIZE (1..maxSimultaneousBands)) OF BasebandParametersPerBandUL + +BasebandParametersPerBandUL ::= SEQUENCE { + ca-BandwidthClassUL CA-BandwidthClassNR, + freqRange ENUMERATED {fr1, fr2}, + basebandParametersPerCC-UL SEQUENCE (SIZE (1.. maxNrofServingCells)) OF BasebandParametersPerCC-UL +} + +BasebandParametersPerCC-UL ::= SEQUENCE { +-- R4 2-2: Simultaneous reception or transmission with same or different numerologies in CA +-- It is expressed by the combination of SCS whether simultaneous RxTx is supported or not. + supportedSubcarrierSpacingUL SubcarrierSpacing, +-- Accoding to the RAN4 LS R4-1803563, maximum Bandwidth supported per CC is added in BPC +-- FFS how to work together with BCS and max BW for each CC to be defined for each CA band combination in the RAN4 spec. + supportedBandwidthUL CHOICE { + fr1 ENUMERATED {mhz5, mhz10, mhz15, mhz20, mhz25, mhz30, mhz40, mhz50, mhz60, mhz80, mhz100}, + fr2 ENUMERATED {mhz50, mhz100, mhz200, mhz400} + }, + -- R2-1800012. To be confirmed by RAN1 + scalingFactor0dot75 ENUMERATED {supported} OPTIONAL, +-- R1 2-14: Codebook based PUSCH MIMO transmission. Absence of this field implies that CB-based PUSCH is not supported. + maxNumberMIMO-LayersCB-PUSCH MIMO-LayersUL OPTIONAL, +-- R1 2-15: Non-codebook based PUSCH MIMO transmission. Absence of this field implies that Non-CB-based PUSCH is not supported. + maxNumberMIMO-LayersNonCB-PUSCH MIMO-LayersUL OPTIONAL, +-- Accoding to the RAN4 LS R4-1803563, modulation order is added per CC granularity in BPC +-- FFS whether all of modulation order specified in the spec need to be signalled. +-- FFS how to address the requirements agreed by RAN4, e.g. mandaotry w/o capabiltiy for 64QAM. mandaotry with capabiltiy for DL 256QAM in FR1. + supportedModulationOrderUL ModulationOrder OPTIONAL, +-- R1 2-53: SRS resources + supportedSRS-Resources SRS-Resources OPTIONAL, +-- R1 2-55: SRS Tx switch + srs-TxSwitch SRS-TxSwitch OPTIONAL, +-- R1 2-57: Support low latency CSI feedback + lowLatencyCSI-Feedback ENUMERATED {supported} OPTIONAL, +-- R1 5-12 & 5-12a: Up to 2/7 PUSCHs per slot for different TBs + pusch-DifferentTB-PerSlot SEQUENCE { + scs-15kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-30kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-60kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-120kHz ENUMERATED {upto2, upto7} OPTIONAL + } OPTIONAL, +-- R1 6-7: Two PUCCH group + twoPUCCH-Group ENUMERATED {supported} OPTIONAL, +-- R1 6-8: Different numerology across PUCCH groups + diffNumerologyAcrossPUCCH-Group ENUMERATED {supported} OPTIONAL, +-- R1 6-9: Different numerologies across carriers within the same PUCCH group + diffNumerologyWithinPUCCH-Group ENUMERATED {supported} OPTIONAL, +-- R1 6-10: Cross carrier scheduling + crossCarrierScheduling ENUMERATED {supported} OPTIONAL, +-- R1 6-11: Number of supported TAGs + supportedNumberTAG ENUMERATED {n2, n3, n4} OPTIONAL, +-- R1 6-18: Supplemental uplink with dynamic switch + dynamicSwitchSUL ENUMERATED {supported} OPTIONAL, +-- R1 6-19: Simultaneous transmission of SRS on an SUL/non-SUL carrier and PUSCH/PUCCH/SRS/PRACH on the other UL carrier in the same cell +-- Details on the channel/signal combination are to be described in TS 38.306 + simultaneousTxSUL-NonSUL ENUMERATED {supported} OPTIONAL, +-- R1 6-22: UL search space sharing for CA + searchSpaceSharingCA-UL ENUMERATED {supported} OPTIONAL +} + +-- TAG-BASEBANDCOMBINATIONPARAMETERSULLIST-STOP +-- TAG-BASEBANDPROCESSINGCOMBINATIONMRDC-START + +BasebandProcessingCombinationMRDC ::= SEQUENCE (SIZE (1..maxBasebandProcComb)) OF BasebandProcessingCombinationLink + +BasebandProcessingCombinationLink ::= SEQUENCE { + basebandProcessingCombinationIndexMN BasebandProcessingCombinationIndex, + basebandProcessingCombinationLinkedIndexSN SEQUENCE (SIZE (1..maxBasebandProcComb)) OF BasebandProcessingCombinationIndex +} + +BasebandProcessingCombinationIndex ::= INTEGER (1..maxBasebandProcComb) + +-- TAG-BASEBANDPROCESSINGCOMBINATIONMRDC-STOP +-- TAG-CA-BANDWIDTHCLASSNR-START + +-- Updated based on R4-1803374 +CA-BandwidthClassNR ::= ENUMERATED {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, ...} + +-- TAG-CA-BANDWIDTHCLASSNR-STOP +-- TAG-CA-BANDWIDTHCLASSEUTRA-START + +CA-BandwidthClassEUTRA ::= ENUMERATED {a, b, c, d, e, f, ...} + +-- TAG-CA-BANDWIDTHCLASSEUTRA-STOP +-- TAG-FREQ-BAND-INDICATOR-EUTRA-START + +FreqBandIndicatorEUTRA ::= INTEGER (1..maxBandsEUTRA) + +-- TAG-FREQ-BAND-INDICATOR-EUTRA-STOP +-- TAG-FREQBANDLIST-START + +FreqBandList ::= SEQUENCE (SIZE (1..maxBandsMRDC)) OF FreqBandInformation + +FreqBandInformation ::= CHOICE { + bandEUTRA FreqBandIndicatorEUTRA, + bandNR FreqBandIndicatorNR +} + +-- TAG-FREQBANDLIST-STOP +-- TAG-FREQSEPARATIONCLASS-START + +FreqSeparationClass ::= ENUMERATED {c1, c2, c3, ...} + +-- TAG-FREQSEPARATIONCLASS-STOP +-- TAG-MIMO-LAYERS-START + +MIMO-LayersDL ::= ENUMERATED {twoLayers, fourLayers, eightLayers} + +MIMO-LayersUL ::= ENUMERATED {oneLayer, twoLayers, fourLayers} + +-- TAG-MIMO-LAYERS-STOP +-- TAG-MODULATION-ORDER-START + +ModulationOrder ::= ENUMERATED {bpsk-halfpi, bpsk, qpsk, qam16, qam64, qam256} + +-- TAG-MODULATION-ORDER-STOP +-- TAG-RAT-TYPE-START + +RAT-Type ::= ENUMERATED {nr, eutra-nr, spare2, spare1, ...} + +-- TAG-RAT-TYPE-STOP +-- TAG-SUPPORTEDBASEBANDPROCESSINGCOMBINATION-START + +SupportedBasebandProcessingCombination ::= SEQUENCE (SIZE (1..maxBasebandProcComb)) OF BasebandProcessingCombination + +BasebandProcessingCombination ::= SEQUENCE { + basebandParametersDL SEQUENCE (SIZE (1..maxSimultaneousBands)) OF BasebandParametersPerBandDL, + basebandParametersUL BIT STRING (SIZE (1..maxBasebandProcComb))} + +BasebandParametersPerBandDL ::= SEQUENCE { + ca-BandwidthClassDL CA-BandwidthClassNR, + freqRange ENUMERATED {fr1, fr2}, + basebandParametersPerCC-DL SEQUENCE (SIZE (1.. maxNrofServingCells)) OF BasebandParametersPerCC-DL +} + +BasebandParametersPerCC-DL ::= SEQUENCE { +-- R4 2-2: Simultaneous reception or transmission with same or different numerologies in CA +-- It is expressed by the combination of SCS whether simultaneous RxTx is supported or not. + supportedSubcarrierSpacingDL SubcarrierSpacing, +-- Accoding to the RAN4 LS R4-1803563, maximum Bandwidth supported per CC is added in BPC +-- FFS how to work together with BCS and max BW for each CC to be defined for each CA band combination in the RAN4 spec. + supportedBandwidthDL CHOICE { + fr1 ENUMERATED {mhz5, mhz10, mhz15, mhz20, mhz25, mhz30, mhz40, mhz50, mhz60, mhz80, mhz100}, + fr2 ENUMERATED {mhz50, mhz100, mhz200, mhz400} + }, +-- R2-1800012. To be confirmed by RAN1 + scalingFactor0dot75 ENUMERATED {supported} OPTIONAL, +-- R1 2-2: PDSCH beam switching + timeDurationForQCL SEQUENCE { + scs-60kHz ENUMERATED {s7, s14, s28} OPTIONAL, + sch-120kHz ENUMERATED {s14, s28} OPTIONAL + } OPTIONAL, +-- R1 1-10: Support of SCell without SS/PBCH block + scellWithoutSSB ENUMERATED {supported} OPTIONAL, +-- R1 1-11: Support of CSI-RS RRM measurement for SCell without SS/PBCH block + csi-RS-MeasSCellWithoutSSB ENUMERATED {supported} OPTIONAL, +-- R1 2-3: PDSCH MIMO layers. Absence of this field implies support of one layer. + maxNumberMIMO-LayersPDSCH MIMO-LayersDL OPTIONAL, +-- Accoding to the RAN4 LS R4-1803563, modulation order is added per CC granularity in BPC +-- FFS whether all of modulation order specified in the spec need to be signalled. +-- FFS how to address the requirements agreed by RAN4, e.g. mandaotry w/o capabiltiy for 64QAM. mandaotry with capabiltiy for DL 256QAM in FR1. + supportedModulationOrderDL ModulationOrder OPTIONAL, +-- R1 2-15a: Association between CSI-RS and SRS + srs-AssocCSI-RS ENUMERATED {supported} OPTIONAL, +-- R1 3-1a: For type 1 CSS with dedicated RRC configuration and for type 3 CSS, UE specific SS, CORESET resource allocation of 6RB bit-map and duration 3 OFDM symbols for FR2 + type1-3-CSS ENUMERATED {supported} OPTIONAL, +-- R1 3-5 & 3-5a: For type 1 with dedicated RRC configuration, type 3, and UE-SS,, monitoring occasion can be any OFDM symbol(s) of a slot for Case 2 (with a DCI gap) + pdcchMonitoringAnyOccasions ENUMERATED {withoutDCI-gap, withDCI-gap} OPTIONAL, +-- R1 5-1a: UE specific RRC configure UL/DL assignment + ue-SpecificUL-DL-Assignment ENUMERATED {supported} OPTIONAL, +-- R1 5-11 & 5-11a: Up to 2/7 unicast PDSCHs per slot for different TBs + pdsch-DifferentTB-PerSlot SEQUENCE { + scs-15kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-30kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-60kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-120kHz ENUMERATED {upto2, upto7} OPTIONAL + } OPTIONAL, +-- R1 6-10: Cross carrier scheduling + crossCarrierScheduling ENUMERATED {supported} OPTIONAL, +-- R1 6-21: DL search space sharing for CA + searchSpaceSharingCA-DL ENUMERATED {supported} OPTIONAL +} + +-- TAG-SUPPORTEDBASEBANDPROCESSINGCOMBINATION-STOP +-- TAG-UE-CAPABILITY-RAT-CONTAINER-LIST-START + +UE-CapabilityRAT-ContainerList ::=SEQUENCE (SIZE (0.. maxRAT-CapabilityContainers)) OF UE-CapabilityRAT-Container + +UE-CapabilityRAT-Container ::= SEQUENCE { + rat-Type RAT-Type, + ue-CapabilityRAT-Container OCTET STRING +} + +-- TAG-UE-CAPABILITY-RAT-CONTAINER-LIST-STOP +-- TAG-UE-MRDC-CAPABILITY-START + +UE-MRDC-Capability ::= SEQUENCE { + measParametersMRDC MeasParametersMRDC OPTIONAL, + rf-ParametersMRDC RF-ParametersMRDC, + phy-ParametersMRDC Phy-ParametersMRDC OPTIONAL, + generalParametersMRDC GeneralParametersMRDC-XDD-Diff OPTIONAL, + fdd-Add-UE-MRDC-Capabilities UE-MRDC-CapabilityAddXDD-Mode OPTIONAL, + tdd-Add-UE-MRDC-Capabilities UE-MRDC-CapabilityAddXDD-Mode OPTIONAL, + fr1-Add-UE-MRDC-Capabilities UE-MRDC-CapabilityAddFRX-Mode OPTIONAL, + fr2-Add-UE-MRDC-Capabilities UE-MRDC-CapabilityAddFRX-Mode OPTIONAL, + lateNonCriticalExtension OCTET STRING OPTIONAL, + nonCriticalExtension SEQUENCE {} OPTIONAL +} + +UE-MRDC-CapabilityAddXDD-Mode ::= SEQUENCE { + phy-ParametersMRDC-XDD-Diff Phy-ParametersMRDC-XDD-Diff OPTIONAL, + measParametersMRDC-XDD-Diff MeasParametersMRDC-XDD-Diff OPTIONAL, + generalParametersMRDC-XDD-Diff GeneralParametersMRDC-XDD-Diff OPTIONAL +} + +UE-MRDC-CapabilityAddFRX-Mode ::= SEQUENCE { + phy-ParametersMRDC-FRX-Diff Phy-ParametersMRDC-FRX-Diff OPTIONAL, + measParametersMRDC-FRX-Diff MeasParametersMRDC-FRX-Diff +} + +RF-ParametersMRDC ::= SEQUENCE { + supportedBandCombination BandCombinationList, + bandCombinationParametersUL-List BandCombinationParametersUL-List +} + +Phy-ParametersMRDC ::= SEQUENCE { + phy-ParametersMRDC-XDD-Diff Phy-ParametersMRDC-XDD-Diff OPTIONAL, + phy-ParametersMRDC-FRX-Diff Phy-ParametersMRDC-FRX-Diff OPTIONAL +} + +Phy-ParametersMRDC-XDD-Diff ::= SEQUENCE { +-- R1 8-1: Dynamic power sharing for LTE-NR DC + dynamicPowerSharing ENUMERATED {supported} OPTIONAL, +-- R1 6-13 & 8-2: Case 1 Single Tx UL LTE-NR DC + tdm-Pattern ENUMERATED {supported} OPTIONAL +} +Phy-ParametersMRDC-FRX-Diff ::= SEQUENCE { +-- R1 8-1: Dynamic power sharing for LTE-NR DC + dynamicPowerSharing ENUMERATED {supported} OPTIONAL, +-- R1 6-13 & 8-2: Case 1 Single Tx UL LTE-NR DC + tdm-Pattern ENUMERATED {supported} OPTIONAL +} + +MeasParametersMRDC ::= SEQUENCE { + measParametersMRDC-Common MeasParametersMRDC-Common, + measParametersMRDC-XDD-Diff MeasParametersMRDC-XDD-Diff OPTIONAL, + measParametersMRDC-FRX-Diff MeasParametersMRDC-FRX-Diff +} + +MeasParametersMRDC-Common ::= SEQUENCE { +-- R4 3-1: Independent measurement gap configurations for FR1 and FR2 + independentGapConfig ENUMERATED {supported} OPTIONAL +} + +MeasParametersMRDC-XDD-Diff ::= SEQUENCE { + sftd-MeasPSCell ENUMERATED {supported} OPTIONAL, + sftd-MeasNR-Cell ENUMERATED {supported} OPTIONAL +} + +MeasParametersMRDC-FRX-Diff ::= SEQUENCE { +-- R4 3-2: Simultaneous reception of data and SS block with different numerologies when UE conducts the serving cell measurement or intra-frequency measurement + simultaneousRxDataSSB-DiffNumerology ENUMERATED {supported} OPTIONAL +} + +GeneralParametersMRDC-XDD-Diff ::= SEQUENCE { + splitSRB-WithOneUL-Path ENUMERATED {supported} OPTIONAL, + splitDRB-withUL-Both-MCG-SCG ENUMERATED {supported} OPTIONAL, + srb3 ENUMERATED {supported} OPTIONAL +} + +-- TAG-UE-MRDC-CAPABILITY-STOP +-- TAG-UE-NR-CAPABILITY-START + +UE-NR-Capability ::= SEQUENCE { + pdcp-Parameters PDCP-Parameters, + rlc-Parameters RLC-Parameters OPTIONAL, + mac-Parameters MAC-Parameters OPTIONAL, + phy-Parameters Phy-Parameters, + rf-Parameters RF-Parameters, + measParameters MeasParameters OPTIONAL, + fdd-Add-UE-NR-Capabilities UE-NR-CapabilityAddXDD-Mode OPTIONAL, + tdd-Add-UE-NR-Capabilities UE-NR-CapabilityAddXDD-Mode OPTIONAL, + fr1-Add-UE-NR-Capabilities UE-NR-CapabilityAddFRX-Mode OPTIONAL, + fr2-Add-UE-NR-Capabilities UE-NR-CapabilityAddFRX-Mode OPTIONAL, + lateNonCriticalExtension OCTET STRING OPTIONAL, + nonCriticalExtension SEQUENCE {} OPTIONAL +} + +UE-NR-CapabilityAddXDD-Mode ::= SEQUENCE { + phy-ParametersXDD-Diff Phy-ParametersXDD-Diff OPTIONAL, + mac-ParametersXDD-Diff MAC-ParametersXDD-Diff OPTIONAL, + measParametersXDD-Diff MeasParametersXDD-Diff OPTIONAL +} + +UE-NR-CapabilityAddFRX-Mode ::= SEQUENCE { + phy-ParametersFRX-Diff Phy-ParametersFRX-Diff OPTIONAL, + measParametersFRX-Diff MeasParametersFRX-Diff OPTIONAL +} + +Phy-Parameters ::= SEQUENCE { + phy-ParametersCommon Phy-ParametersCommon OPTIONAL, + phy-ParametersXDD-Diff Phy-ParametersXDD-Diff OPTIONAL, + phy-ParametersFRX-Diff Phy-ParametersFRX-Diff OPTIONAL, + phy-ParametersFR1 Phy-ParametersFR1 OPTIONAL, + phy-ParametersFR2 Phy-ParametersFR2 OPTIONAL, + supportedBasebandProcessingCombination SupportedBasebandProcessingCombination, + basebandCombinationParametersUL-List BasebandCombinationParametersUL-List +} + +Phy-ParametersCommon ::= SEQUENCE { +-- R1 1-9: CSI-RS based CFRA for HO + csi-RS-CFRA-ForHO ENUMERATED {supported} OPTIONAL, +-- R1 2-11: Downlink dynamic PRB bundling (DL) + dynamicPRB-BundlingDL ENUMERATED {supported} OPTIONAL, +-- R1 2-32a: Semi-persistent CSI report on PUCCH + sp-CSI-ReportPUCCH ENUMERATED {supported} OPTIONAL, +-- R1 2-32b: Semi-persistent CSI report on PUSCH + sp-CSI-ReportPUSCH ENUMERATED {supported} OPTIONAL, +-- R1 2-34: NZP-CSI-RS based interference measurement + nzp-CSI-RS-IntefMgmt ENUMERATED {supported} OPTIONAL, +-- R1 2-42: Support Type II SP-CSI feedback on long PUCCH + type2-SP-CSI-Feedback-LongPUCCH ENUMERATED {supported} OPTIONAL, +-- R1 3-3: More than one CORESET per BWP (in addition to CORESET #0) + multipleCORESET ENUMERATED {supported} OPTIONAL, +-- R1 3-6: Dynamic SFI monitoring and dynamic UL/DL determination + dynamicSFI ENUMERATED {supported} OPTIONAL, +-- R1 3-7: Precoder-granularity of CORESET size + precoderGranularityCORESET ENUMERATED {supported} OPTIONAL, +-- R1 4-10: Dynamic HARQ-ACK codebook + dynamicHARQ-ACK-Codebook ENUMERATED {supported} OPTIONAL, +-- R1 4-11: Semi-static HARQ-ACK codebook + semiStaticHARQ-ACK-Codebook ENUMERATED {supported} OPTIONAL, +-- R1 4-12: HARQ-ACK spatial bundling for PUCCH or PUSCH per PUCCH group + spatialBundlingHARQ-ACK ENUMERATED {supported} OPTIONAL, +-- R1 4-21: Dynamic beta-offset configuration and indication for HARQ-ACK and/or CSI + dynamicBetaOffsetInd-HARQ-ACK-CSI ENUMERATED {supported} OPTIONAL, +-- R1 4-23: Repetitions for PUCCH format 1, 3,and 4 over multiple slots with K = 1, 2, 4, 8 + pucch-Repetition-F1-3-4 ENUMERATED {supported} OPTIONAL, +-- R1 5-2: RA type 0 for PUSCH + ra-Type0-PUSCH ENUMERATED {supported} OPTIONAL, +-- R1 5-3: Dynamic switching between RA type 0 and RA type 1 for PDSCH + dynamicSwitchRA-Type0-1-PDSCH ENUMERATED {supported} OPTIONAL, +-- R1 5-4: Dynamic switching between RA type 0 andRA type 1 for PUSCH + dynamicSwitchRA-Type0-1-PUSCH ENUMERATED {supported} OPTIONAL, +-- R1 5-6: PDSCH mapping type A with less than 7 OFDM symbols + pdsch-MappingTypeA ENUMERATED {supported} OPTIONAL, +-- R1 5-6a: PDSCH mapping type B + pdsch-MappingTypeB ENUMERATED {supported} OPTIONAL, +-- R1 5-7: Interleaving for VRB-to-PRB mapping for PDSCH + interleavingVRB-ToPRB-PDSCH ENUMERATED {supported} OPTIONAL, +-- R1 5-8: Interleaving for VRB-to-PRB mapping for PUSCH + interleavingVRB-ToPRB-PUSCH ENUMERATED {supported} OPTIONAL, +-- R1 5-10: Inter-slot frequency hopping for PUSCH + interSlotFreqHopping-PUSCH ENUMERATED {supported} OPTIONAL, +-- R1 5-13: Type 1 configured PUSCH repetitions within a slot + type1-PUSCH-RepetitionOneSlot ENUMERATED {supported} OPTIONAL, +-- R1 5-14: Type 1 configured PUSCH repetitions over multiple slots + type1-PUSCH-RepetitionMultiSlots ENUMERATED {supported} OPTIONAL, +-- R1 5-15: Type 2 configured PUSCH repetitions within a slot + type2-PUSCH-RepetitionOneSlot ENUMERATED {supported} OPTIONAL, +-- R1 5-16: Type 2 configured PUSCH repetitions over multiple slots + type2-PUSCH-RepetitionMultiSlots ENUMERATED {supported} OPTIONAL, +-- R1 5-17: PUSCH repetitions over multiple slots + pusch-RepetitionMultiSlots ENUMERATED {supported} OPTIONAL, +-- R1 5-17a: PDSCH repetitions over multiple slots + pdsch-RepetitionMultiSlots ENUMERATED {supported} OPTIONAL, +-- R1 5-18: DL SPS + downlinkSPS ENUMERATED {supported} OPTIONAL, +-- R1 5-19: Type 1 Configured UL grant + configuredUL-GrantType1 ENUMERATED {supported} OPTIONAL, +-- R1 5-20: Type 2 Configured UL grant + configuredUL-GrantType2 ENUMERATED {supported} OPTIONAL, +-- R1 5-21: Pre-emption indication for DL + pre-EmptIndication-DL ENUMERATED {supported} OPTIONAL, +-- R1 5-22 & 5-25: CBG-based re-transmission for DL/UL using CBGTI + cbg-TransIndication BIT STRING (SIZE (2)) OPTIONAL, +-- R1 5-23: CBGFI for CBG-based re-transmission for DL + cbg-FlushIndication-DL ENUMERATED {supported} OPTIONAL, +-- R1 5-24: Dynamic HARQ-ACK codebook using sub-codebooks for CBG-based re-transmission for DL + dynamicHARQ-ACK-CodeB-CBG-Retx-DL ENUMERATED {supported} OPTIONAL, +-- R1 5-26: Semi-static rate-matching resource set configuration for DL + rateMatchingResrcSetSemi-Static ENUMERATED {supported} OPTIONAL, +-- R1 5-27: Dynamic rate-matching resource set configuration for DL + rateMatchingResrcSetDynamic ENUMERATED {supported} OPTIONAL, +-- R1 5-28: Rate-matching around LTE CRS + rateMatchingLTE-CRS ENUMERATED {supported} OPTIONAL, +-- R4 1-8: BWP switching delay + bwp-SwitchingDelay ENUMERATED {type1, type2} OPTIONAL +} + +Phy-ParametersXDD-Diff ::= SEQUENCE { +-- R1 4-2: 2 PUCCH of format 0 or 2 in consecutive symbols + twoPUCCH-F0-2-ConsecSymbols ENUMERATED {supported} OPTIONAL, +-- R1 8-7: UL power control with 2 PUSCH closed loops + twoDifferentTPC-Loop-PUSCH ENUMERATED {supported} OPTIONAL, +-- R1 8-8: UL power control with 2 PUCCH closed loops + twoDifferentTPC-Loop-PUCCH ENUMERATED {supported} OPTIONAL +} + +Phy-ParametersFRX-Diff ::= SEQUENCE { +-- R1 2-6 & 2-16b: Support 1+2 DMRS (DL/UL) + oneFL-DMRS-TwoAdditionalDMRS BIT STRING (SIZE (2)) OPTIONAL, +-- R1 2-7 & 2-18: Supported 2 symbols front-loaded DMRS(DL/UL) + twoFL-DMRS BIT STRING (SIZE (2)) OPTIONAL, +-- R1 2-8 & 2-18a: Supported 2 symbols front-loaded +2 symbols additional DMRS(DL/UL) + twoFL-DMRS-TwoAdditionalDMRS BIT STRING (SIZE (2)) OPTIONAL, +-- R1 2-9 & 2-19: Support 1+3 DMRS (DL/UL) + oneFL-DMRS-ThreeAdditionalDMRS BIT STRING (SIZE (2)) OPTIONAL, +-- R1 2-10: Support DMRS type (DL) + supportedDMRS-TypeDL ENUMERATED {type1, type2} OPTIONAL, +-- R1 2-17: Support DMRS type (UL) + supportedDMRS-TypeUL ENUMERATED {type1, type2} OPTIONAL, +-- R1 2-37: Support Semi-open loop CSI + semiOpenLoopCSI ENUMERATED {supported} OPTIONAL, +-- R1 2-38: CSI report without PMI + csi-ReportWithoutPMI ENUMERATED {supported} OPTIONAL, +-- R1 2-39: CSI report with CRI + csi-ReportWithCRI ENUMERATED {supported} OPTIONAL, +-- R1 2-39a: CSI report without CQI + csi-ReportWithoutCQI ENUMERATED {supported} OPTIONAL, +-- R1 2-44 & 2-47: 1 port of DL/UL PTRS + onePortsPTRS BIT STRING (SIZE (2)) OPTIONAL, +-- R1 4-2: 2 PUCCH of format 0 or 2 in consecutive symbols + twoPUCCH-F0-2-ConsecSymbols ENUMERATED {supported} OPTIONAL, +-- R1 4-3: PUCCH format 2 over 1 – 2 OFDM symbols once per slot with FH + pucch-F2-WithFH ENUMERATED {supported} OPTIONAL, +-- R1 4-4: PUCCH format 3 over 4 – 14 OFDM symbols once per slot with FH + pucch-F3-WithFH ENUMERATED {supported} OPTIONAL, +-- R1 4-5: PUCCH format 4 over 4 – 14 OFDM symbols once per slot with FH + pucch-F4-WithFH ENUMERATED {supported} OPTIONAL, +-- R1 4-6: Non-frequency hopping for PUCCH formats 0 and 2 + freqHoppingPUCCH-F0-2 ENUMERATED {notSupported} OPTIONAL, +-- R1 4-7: Non-frequency hopping for PUCCH format 1, 3, and 4 + freqHoppingPUCCH-F1-3-4 ENUMERATED {notSupported} OPTIONAL, +-- R1 4-19: SR/HARQ-ACK/CSI multiplexing once per slot using a PUCCH (or piggybacked on a PUSCH) + mux-SR-HARQ-ACK-CSI-PUCCH ENUMERATED {supported} OPTIONAL, +-- R1 4-20: UCI code-block segmentation + uci-CodeBlockSegmentation ENUMERATED {supported} OPTIONAL, +-- R1 4-22: 1 long PUCCH format and 1 short PUCCH format in the same slot + onePUCCH-LongAndShortFormat ENUMERATED {supported} OPTIONAL, +-- R1 4-22a: 2 PUCCH transmissions in the same slot which are not covered by 4-22 and 4-2 + twoPUCCH-AnyOthersInSlot ENUMERATED {supported} OPTIONAL, +-- R1 5-9: Intra-slot frequency-hopping for PUSCH except for PUSCH scheduled by Type 1 before RRC connection + intraSlotFreqHopping-PUSCH ENUMERATED {supported} OPTIONAL, +-- R1 5-29: LBRM for PUSCH + pusch-LBRM ENUMERATED {supported} OPTIONAL, +-- R1 6-5a: PDCCH blind detection capability for CA + pdcch-BlindDetectionCA ENUMERATED {supported} OPTIONAL, +-- R1 8-3: TPC-PUSCH-RNTI + tpc-PUSCH-RNTI ENUMERATED {supported} OPTIONAL, +-- R1 8-4: TPC-PUCCH-RNTI + tpc-PUCCH-RNTI ENUMERATED {supported} OPTIONAL, +-- R1 8-5: TPC-SRS-RNTI + tpc-SRS-RNTI ENUMERATED {supported} OPTIONAL, +-- R1 8-6: Absolute TPC command mode + absoluteTPC-Command ENUMERATED {supported} OPTIONAL, +-- R1 8-7: UL power control with 2 PUSCH closed loops + twoDifferentTPC-Loop-PUSCH ENUMERATED {supported} OPTIONAL, +-- R1 8-8: UL power control with 2 PUCCH closed loops + twoDifferentTPC-Loop-PUCCH ENUMERATED {supported} OPTIONAL, +-- R4 1-6: pi/2-BPSK for PUSCH + pusch-HalfPi-BPSK ENUMERATED {supported} OPTIONAL, +-- R4 1-7: pi/2-BPSK for PUCCH format 3/4 + pucch-F3-4-HalfPi-BPSK ENUMERATED {supported} OPTIONAL, +-- R4 1-9: 1-symbol GP in unpaired spectrum + oneSymbolGP-TDD ENUMERATED {supported} OPTIONAL, +-- R4 2-7: Almost contiguous UL CP-OFDM + almostContiguousCP-OFDM-UL ENUMERATED {supported} OPTIONAL +} + +Phy-ParametersFR1 ::= SEQUENCE { +-- R1 3-2: Unicast PDCCH monitoring following Case 1-2 + pdcchMonitoringSingleOccasion ENUMERATED {supported} OPTIONAL, +-- R4 1-1: 60kHz of subcarrier spacing for FR1 + scs-60kHz ENUMERATED {supported} OPTIONAL, +-- R4 1-4: 256QAM for PDSCH in FR1 + pdsch-256QAM-FR1 ENUMERATED {supported} OPTIONAL +} + +Phy-ParametersFR2 ::= SEQUENCE { +-- R4 2-8: PA calibration gap + calibrationGapPA ENUMERATED {supported} OPTIONAL +} + +RF-Parameters ::= SEQUENCE { + supportedBandListNR SupportedBandListNR, + supportedBandCombination BandCombinationList, + bandCombinationParametersUL-List BandCombinationParametersUL-List +} + +SupportedBandListNR ::= SEQUENCE (SIZE (1..maxBands)) OF BandNR + +BandNR ::= SEQUENCE { + bandNR FreqBandIndicatorNR, +-- Modified MPR behaviour as in RAN4 LS R2-1804077, which is needed for NSA as well as SA + modifiedMPR-Behaviour BIT STRING (SIZE (8)) OPTIONAL, +-- R4 2-1: Maximum channel bandwidth supported in each band for DL and UL separately and for each SCS that UE supports within a single CC +-- RAN4 agreed that 400 MHz is optional for FR2. The other values defined for FR1/fR2 in TS 38.101 are mandatory w/o capability bit. + maxChannelBW-PerCC ENUMERATED {mhz400} OPTIONAL, + mimo-ParametersPerBand MIMO-ParametersPerBand OPTIONAL, +-- R1 0-10: Extended CP + extendedCP ENUMERATED {supported} OPTIONAL, +-- R1 0-13: Phase coherence across non-contiguous UL symbols in slot in the transmission of one channel + phaseCoherenceUL ENUMERATED {supported} OPTIONAL, +-- R1 1-10: Support of SCell without SS/PBCH block + scellWithoutSSB ENUMERATED {supported} OPTIONAL, +-- R1 1-11: Support of CSI-RS RRM measurement for SCell without SS/PBCH block + csi-RS-MeasSCellWithoutSSB ENUMERATED {supported} OPTIONAL, +-- R1 2-15a: Association between CSI-RS and SRS + srs-AssocCSI-RS ENUMERATED {supported} OPTIONAL, +-- R1 3-1a: For type 1 CSS with dedicated RRC configuration and for type 3 CSS, UE specific SS, CORESET resource allocation of 6RB bit-map and duration 3 OFDM symbols for FR2 + type1-3-CSS ENUMERATED {supported} OPTIONAL, +-- R1 3-4: More than one TCI state configurations per CORESET + multipleTCI ENUMERATED {supported} OPTIONAL, +-- R1 3-5 & 3-5a: For type 1 with dedicated RRC configuration, type 3, and UE-SS,, monitoring occasion can be any OFDM symbol(s) of a slot for Case 2 (with a DCI gap) + pdcchMonitoringAnyOccasions ENUMERATED {withoutDCI-gap, withDCI-gap} OPTIONAL, +-- R1 5-1a: UE specific RRC configure UL/DL assignment + ue-SpecificUL-DL-Assignment ENUMERATED {supported} OPTIONAL, +-- R1 5-11 & 5-11a: Up to 2/7 unicast PDSCHs per slot for different TBs + pdsch-DifferentTB-PerSlot SEQUENCE { + scs-15kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-30kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-60kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-120kHz ENUMERATED {upto2, upto7} OPTIONAL + } OPTIONAL, +-- R1 5-12 & 5-12a: Up to 2/7 PUSCHs per slot for different TBs + pusch-DifferentTB-PerSlot SEQUENCE { + scs-15kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-30kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-60kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-120kHz ENUMERATED {upto2, upto7} OPTIONAL + } OPTIONAL, +-- R1 6-2 & 6-3: Type A/B BWP adaptation (up to 2/4 BWPs) with same numerology + bwp-SameNumerology ENUMERATED {upto2, upto4} OPTIONAL, +-- R1 6-4: BWP adaptation (up to 4 BWPs) with different numerologies + bwp-DiffNumerology ENUMERATED {upto4} OPTIONAL, +-- R1 6-7: Two PUCCH group + twoPUCCH-Group ENUMERATED {supported} OPTIONAL, +-- R1 6-8: Different numerology across PUCCH groups + diffNumerologyAcrossPUCCH-Group ENUMERATED {supported} OPTIONAL, +-- R1 6-9: Different numerologies across carriers within the same PUCCH group + diffNumerologyWithinPUCCH-Group ENUMERATED {supported} OPTIONAL, +-- R1 6-10: Cross carrier scheduling + crossCarrierScheduling ENUMERATED {supported} OPTIONAL, +-- R1 6-11: Number of supported TAGs + supportedNumberTAG ENUMERATED {n2, n3, n4} OPTIONAL, +-- R1 6-19: Simultaneous transmission of SRS on an SUL/non-SUL carrier and PUSCH/PUCCH/SRS/PRACH on the other UL carrier in the same cell +-- Details on the channel/signal combination are to be described in TS 38.306 + simultaneousTxSUL-NonSUL ENUMERATED {supported} OPTIONAL, +-- R1 6-21: DL search space sharing for CA + searchSpaceSharingCA-DL ENUMERATED {supported} OPTIONAL, +-- R1 6-22: UL search space sharing for CA + searchSpaceSharingCA-UL ENUMERATED {supported} OPTIONAL, +-- R4 1-4: 256QAM for PDSCH in FR2 + pdsch-256QAM-FR2 ENUMERATED {supported} OPTIONAL, +-- R4 1-5: 256QAM for PUSCH + pusch-256QAM ENUMERATED {supported} OPTIONAL +} + +MIMO-ParametersPerBand ::= SEQUENCE { +-- R1 2-2: PDSCH beam switching + timeDurationForQCL SEQUENCE { + scs-60kHz ENUMERATED {s7, s14, s28} OPTIONAL, + sch-120kHz ENUMERATED {s14, s28} OPTIONAL + } OPTIONAL, +-- R1 2-3: PDSCH MIMO layers. Absence of this field implies support of one layer. + maxNumberMIMO-LayersPDSCH MIMO-LayersDL OPTIONAL, +-- R1 2-14: Codebook based PUSCH MIMO transmission. Absence of this field implies that CB-based PUSCH is not supported. + maxNumberMIMO-LayersCB-PUSCH MIMO-LayersUL OPTIONAL, +-- R1 2-15: Non-codebook based PUSCH MIMO transmission. Absence of this field implies that Non-CB-based PUSCH is not supported. + maxNumberMIMO-LayersNonCB-PUSCH MIMO-LayersUL OPTIONAL, +-- R1 2-4: TCI states for PDSCH + maxNumberConfiguredTCIstates ENUMERATED {n4, n8, n16, n32, n64} OPTIONAL, + maxNumberActiveTCI-PerCC ENUMERATED {n1, n2, n4, n8} OPTIONAL, +-- R1 2-13: PUSCH transmission coherence + pusch-TransCoherence ENUMERATED {nonCoherent, partialNonCoherent, fullCoherent} OPTIONAL, +-- R1 2-20: Beam correspondence + beamCorrespondence ENUMERATED {supported} OPTIONAL, +-- R1 2-21: Periodic beam report on PUCCH + periodicBeamReport ENUMERATED {supported} OPTIONAL, +-- R1 2-22: Aperiodic beam report on PUSCH + aperiodicBeamReport ENUMERATED {supported} OPTIONAL, +-- R1 2-23: Semi-persistent beam report on PUCCH + sp-BeamReportPUCCH ENUMERATED {supported} OPTIONAL, +-- R1 2-23a: Semi-persistent beam report on PUSCH + sp-BeamReportPUSCH ENUMERATED {supported} OPTIONAL, +-- R1 2-24: SSB/CSI-RS for beam management + beamManagementSSB-CSI-RS BeamManagementSSB-CSI-RS OPTIONAL, +-- R1 2-26: Receiving beam selection using CSI-RS resource repetition "ON" + maxNumberRxBeam INTEGER (2..8) OPTIONAL, +-- R1 2-27: Beam switching (including SSB and CSI-RS) + maxNumberRxTxBeamSwitchDL SEQUENCE { + scs-15kHz ENUMERATED {n4, n7, n14} OPTIONAL, + scs-30kHz ENUMERATED {n4, n7, n14} OPTIONAL, + scs-60kHz ENUMERATED {n4, n7, n14} OPTIONAL, + scs-120kHz ENUMERATED {n4, n7, n14} OPTIONAL, + scs-240kHz ENUMERATED {n4, n7, n14} OPTIONAL + } OPTIONAL, +-- R1 2-29: Non-group based beam reporting + maxNumberNonGroupBeamReporting ENUMERATED {n1, n2, n4} OPTIONAL, +-- R1 2-29a: Group based beam reporting + groupBeamReporting ENUMERATED {supported} OPTIONAL, +-- R1 2-30: UL beam management + uplinkBeamManagement SEQUENCE { + maxNumberSRS-ResourcePerSet ENUMERATED {n8, n16, n32}, + maxNumberSRS-ResourceSet INTEGER (1..8) + } OPTIONAL, +-- R1 2-31: Beam failure recovery + maxNumberCSI-RS-BFR INTEGER (1..64) OPTIONAL, + maxNumberSSB-BFR INTEGER (1..64) OPTIONAL, + maxNumberCSI-RS-SSB-BFR INTEGER (1..256) OPTIONAL, +-- R1 2-45 & 2-48: 2 ports of DL/UL PTRS + twoPortsPTRS BIT STRING (SIZE (2)) OPTIONAL, +-- R1 2-53: SRS resources + supportedSRS-Resources SRS-Resources OPTIONAL, +-- R1 2-55: SRS Tx switch + srs-TxSwitch SRS-TxSwitch OPTIONAL, +-- R1 2-54a: Simultaneous SRS Tx + maxNumberSimultaneousSRS-PerCC INTEGER (1..4) OPTIONAL, +-- R1 2-57: Support low latency CSI feedback + lowLatencyCSI-Feedback ENUMERATED {supported} OPTIONAL +} + +-- R1 2-24: SSB/CSI-RS for beam management +BeamManagementSSB-CSI-RS ::= SEQUENCE { + maxNumberSSB-CSI-RS-ResourceOneTx ENUMERATED {n8, n16, n32, n64}, + maxNumberSSB-CSI-RS-ResourceTwoTx ENUMERATED {n0, n4, n8, n16, n32, n64}, + supportedCSI-RS-Density ENUMERATED {one, three, oneAndThree} +} + +-- R1 2-53: SRS resources +SRS-Resources ::= SEQUENCE { + maxNumberAperiodicSRS-PerBWP ENUMERATED {n1, n2, n4, n8, n16}, + maxNumberAperiodicSRS-PerBWP-PerSlot INTEGER (1..6), + maxNumberPeriodicSRS-PerBWP ENUMERATED {n1, n2, n4, n8, n16}, + maxNumberPeriodicSRS-PerBWP-PerSlot INTEGER (1..6), + maxNumberSemiPersitentSRS-PerBWP ENUMERATED {n0, n1, n2, n4, n8, n16}, + maxNumberSP-SRS-PerBWP-PerSlot INTEGER (0..6), + maxNumberSRS-Ports-PerResource ENUMERATED {n1, n2, n4} +} +-- R1 2-55: SRS Tx switch +SRS-TxSwitch ::= SEQUENCE { + supportedSRS-TxPortSwitch ENUMERATED {t1r2, t1r4, t2r4, t1r4-t2r4}, + txSwitchImpactToRx ENUMERATED {true} OPTIONAL +} + +PDCP-Parameters ::= SEQUENCE { + supportedROHC-Profiles SEQUENCE { + profile0x0000 BOOLEAN, + profile0x0001 BOOLEAN, + profile0x0002 BOOLEAN, + profile0x0003 BOOLEAN, + profile0x0004 BOOLEAN, + profile0x0006 BOOLEAN, + profile0x0101 BOOLEAN, + profile0x0102 BOOLEAN, + profile0x0103 BOOLEAN, + profile0x0104 BOOLEAN + }, + maxNumberROHC-ContextSessions ENUMERATED {cs2, cs4, cs8, cs12, cs16, cs24, cs32, cs48, cs64, cs128, cs256, cs512, cs1024, cs16384, spare2, spare1}, + uplinkOnlyROHC-Profiles ENUMERATED {supported} OPTIONAL, + continueROHC-Context ENUMERATED {supported} OPTIONAL, + outOfOrderDelivery ENUMERATED {supported} OPTIONAL, + shortSN ENUMERATED {supported} OPTIONAL +} + +RLC-Parameters ::= SEQUENCE { + am-WithShortSN ENUMERATED {supported} OPTIONAL, + um-WithShortSN ENUMERATED {supported} OPTIONAL, + um-WIthLongSN ENUMERATED {supported} OPTIONAL +} + +MAC-Parameters ::= SEQUENCE { + mac-ParametersCommon MAC-ParametersCommon OPTIONAL, + mac-ParametersXDD-Diff MAC-ParametersXDD-Diff OPTIONAL +} + +MAC-ParametersCommon ::= SEQUENCE { + lcp-Restriction ENUMERATED {supported} OPTIONAL, +-- R1 4-24: PUCCH-spatialrelationinfo indication by a MAC CE per PUCCH resource + pucch-SpatialRelInfoMAC-CE ENUMERATED {supported} OPTIONAL +} + +MAC-ParametersXDD-Diff ::= SEQUENCE { + skipUplinkTxDynamic ENUMERATED {supported} OPTIONAL, + logicalChannelSR-DelayTimer ENUMERATED {supported} OPTIONAL, + longDRX-Cycle ENUMERATED {supported} OPTIONAL, + shortDRX-Cycle ENUMERATED {supported} OPTIONAL, + multipleSR-Configurations ENUMERATED {supported} OPTIONAL, + -- If supported UE supports 8 SR configurations, otherwise 1 SR config is supported. + -- Confirmation is needed whether to align the number to what the configuration signalling can support. + multipleConfiguredGrantConfigurations ENUMERATED {supported} OPTIONAL + -- If supported UE supports 16 configured grant configurations, otherwise 1 ConfiguredGrant config is supported. + -- Confirmation is needed whether to align the number to what the configuration signalling can support, and to consider whether the 16 refers + -- to the configurations or the active ones only (as they are within the BWP). +} + +MeasParameters ::= SEQUENCE { + measParametersXDD-Diff MeasParametersXDD-Diff OPTIONAL, + measParametersFRX-Diff MeasParametersFRX-Diff OPTIONAL +} + +MeasParametersXDD-Diff ::= SEQUENCE { + intraAndInterF-MeasAndReport ENUMERATED {supported} OPTIONAL, + eventA-MeasAndReport ENUMERATED {supported} OPTIONAL + -- Confirmation is needed on the need of capability/IOT signaling in LTE for support of the additional measurement gap configurations. +} + +MeasParametersFRX-Diff ::= SEQUENCE { +-- R1 1-3: SSB based SINR measurement + ss-SINR-Meas ENUMERATED {supported} OPTIONAL, +-- R1 1-5: CSI-RS based RRM measurement with associated SS-block + csi-RSRP-AndRSRQ-MeasWithSSB ENUMERATED {supported} OPTIONAL, +-- R1 1-5a: CSI-RS based RRM measurement without associated SS-block + csi-RSRP-AndRSRQ-MeasWithoutSSB ENUMERATED {supported} OPTIONAL, +-- R1 1-6: CSI-RS based SINR measurement + csi-SINR-Meas ENUMERATED {supported} OPTIONAL, +-- R1 1-7: CSI-RS based RLM + csi-RS-RLM ENUMERATED {supported} OPTIONAL +} + +-- TAG-UE-NR-CAPABILITY-STOP +-- TAG-RRC-TRANSACTIONIDENTIFIER-START + +RRC-TransactionIdentifier ::= INTEGER (0..3) + +-- TAG-RRC-TRANSACTIONIDENTIFIER-STOP +-- TAG-MULTIPLICITY-AND-TYPE-CONSTRAINT-DEFINITIONS-START + +maxBandComb INTEGER ::= 65536 -- Maximum number of DL band combinations +maxBasebandProcComb INTEGER ::= 65536 -- Maximum number of baseband processing combinations +maxNrofServingCells INTEGER ::= 32 -- Max number of serving cells (SpCell + SCells) per cell group +maxNrofServingCells-1 INTEGER ::= 31 -- Max number of serving cells (SpCell + SCells) per cell group minus 1 +maxNrofAggregatedCellsPerCellGroup INTEGER ::= 16 +maxNrofSCells INTEGER ::= 31 -- Max number of secondary serving cells per cell group +maxNrofCellMeas INTEGER ::= 32 -- Maximum number of entries in each of the cell lists in a measurement object +maxNrofSS-BlocksToAverage INTEGER ::= 16 -- Max number for the (max) number of SS blocks to average to determine cell + -- measurement +maxNrofCSI-RS-ResourcesToAverage INTEGER ::= 16 -- Max number for the (max) number of CSI-RS to average to determine cell + -- measurement +maxNrofDL-Allocations INTEGER ::= 16 -- Maximum number of PDSCH time domain resource allocations + +maxNrofSR-ConfigPerCellGroup INTEGER ::= 8 -- Maximum number of SR configurations per cell group + +maxLCG-ID INTEGER ::= 7 -- Maximum value of LCG ID +maxLC-ID INTEGER ::= 32 -- Maximum value of Logical Channel ID +maxNrofTAGs INTEGER ::= 4 -- Maximum number of Timing Advance Groups +maxNrofTAGs-1 INTEGER ::= 3 -- Maximum number of Timing Advance Groups minus 1 + +maxNrofBWPs INTEGER ::= 4 -- Maximum number of BWPs per serving cell +maxNrofSymbols-1 INTEGER ::= 13 -- Maximum index identifying a symbol within a slot (14 symbols, indexed from 0..13) +maxNrofSlots INTEGER ::= 320 -- Maximum number of slots in a 10 ms period +maxNrofSlots-1 INTEGER ::= 319 -- Maximum number of slots in a 10 ms period minus 1 + +maxNrofPhysicalResourceBlocks INTEGER ::= 275 -- Maximum number of PRBs +maxNrofPhysicalResourceBlocks-1 INTEGER ::= 274 -- Maximum number of PRBs +maxNrofControlResourceSets INTEGER ::= 12 -- Max number of CoReSets configurable on a serving cell +maxNrofControlResourceSets-1 INTEGER ::= 11 -- Max number of CoReSets configurable on a serving cell minus 1 +maxCoReSetDuration INTEGER ::= 3 -- Max number of OFDM symbols in a control resource set +maxNrofSearchSpaces INTEGER ::= 40 -- Max number of Search Spaces +maxNrofSearchSpaces-1 INTEGER ::= 39 -- Max number of Search Spaces minus 1 +maxSFI-DCI-PayloadSize INTEGER ::= 128 -- Max number payload of a DCI scrambled with SFI-RNTI +maxSFI-DCI-PayloadSize-1 INTEGER ::= 127 -- Max number payload of a DCI scrambled with SFI-RNTI minus 1 +maxINT-DCI-PayloadSize INTEGER ::= 126 -- Max number payload of a DCI scrambled with INT-RNTI +maxINT-DCI-PayloadSize-1 INTEGER ::= 125 -- Max number payload of a DCI scrambled with INT-RNTI minus 1 +maxNrofRateMatchPatterns INTEGER ::= 4 -- Max number of rate matching patterns that may be configured +maxNrofRateMatchPatterns-1 INTEGER ::= 3 -- Max number of rate matching patterns that may be configured minus 1 + +maxNrofCSI-ReportConfigurations INTEGER ::= 48 -- Maximum number of report configurations +maxNrofCSI-ReportConfigurations-1 INTEGER ::= 47 -- Maximum number of report configurations minus 1 + +maxNrofCSI-ResourceConfigurations INTEGER ::= 112 -- Maximum number of resource configurations +maxNrofCSI-ResourceConfigurations-1 INTEGER ::= 111 -- Maximum number of resource configurations minus 1 + +maxNrofAP-CSI-RS-ResourcesPerSet INTEGER ::= 16 +maxNrOfCSI-AperiodicTriggers INTEGER ::= 128 -- Maximum number of triggers for aperiodic CSI reporting +maxNrofReportConfigPerAperiodicTrigger INTEGER ::= 16 -- Maximum number of report configurations per trigger state for aperiodic reporting + +maxNrofNZP-CSI-RS-Resources INTEGER ::= 192 -- Maximum number of Non-Zero-Power (NZP) CSI-RS resources +maxNrofNZP-CSI-RS-Resources-1 INTEGER ::= 191 -- Maximum number of Non-Zero-Power (NZP) CSI-RS resources minus 1 +maxNrofNZP-CSI-RS-ResourcesPerSet INTEGER ::= 64 -- Maximum number of NZP CSI-RS resources per resource set +maxNrofNZP-CSI-RS-ResourceSetsPerConfig INTEGER ::= 16 -- Maximum number of resource sets per resource configuration + +maxNrofZP-CSI-RS-Resources INTEGER ::= 32 -- Maximum number of Zero-Power (NZP) CSI-RS resources +maxNrofZP-CSI-RS-Resources-1 INTEGER ::= 31 -- Maximum number of Zero-Power (NZP) CSI-RS resources minus 1 +maxNrofZP-CSI-RS-ResourceSets-1 INTEGER ::= 16 +maxNrofZP-CSI-RS-ResourcesPerSet INTEGER ::= 16 +maxNrofZP-CSI-RS-Sets INTEGER ::= 16 + +maxNrofCSI-IM-Resources INTEGER ::= 32 -- Maximum number of CSI-IM resources. See CSI-IM-ResourceMax in 38.214. +maxNrofCSI-IM-Resources-1 INTEGER ::= 31 -- Maximum number of CSI-IM resources minus 1. See CSI-IM-ResourceMax in 38.214. +maxNrofCSI-IM-ResourcesPerSet INTEGER ::= 8 -- Maximum number of CSI-IM resources per set. See CSI-IM-ResourcePerSetMax in 38.214 +maxNrofCSI-IM-ResourceSetsPerConfig INTEGER ::= 16 -- Maximum number of CSI IM resource sets per resource configuration + +maxNrofSSB-Resources-1 INTEGER ::= 63 -- Maximum number of SSB resources in a resource set minus 1 +maxNrofCSI-SSB-ResourcePerSet INTEGER ::= 64 +maxNrofCSI-SSB-ResourceSetsPerConfig INTEGER ::= 1 -- Maximum number of CSI SSB resource sets per resource configuration + +maxNrofFailureDetectionResources INTEGER ::= 10 -- Maximum number of failure detection resources + +maxNrofObjectId INTEGER ::= 64 -- Maximum number of measurement objects +maxNrofPCI-Ranges INTEGER ::= 8 -- Maximum number of PCI ranges +maxNrofCSI-RS-ResourcesRRM INTEGER ::= 96 -- Maximum number of CSI-RS resources for an RRM measurement object +maxNrofCSI-RS-ResourcesRRM-1 INTEGER ::= 95 -- Maximum number of CSI-RS resources for an RRM measurement object minus 1 +maxNrofMeasId INTEGER ::= 64 -- Maximum number of configured measurements +maxNrofQuantityConfig INTEGER ::= 2 -- Maximum number of quantity configurations +maxNrofCSI-RS-CellsRRM INTEGER ::= 96 -- Maximum number of FFS + +maxNrofSRS-ResourceSets INTEGER ::= 16 -- Maximum number of SRS resource sets in a BWP. +maxNrofSRS-ResourceSets-1 INTEGER ::= 15 -- Maximum number of SRS resource sets in a BWP minus 1. +maxNrofSRS-Resources INTEGER ::= 64 -- Maximum number of SRS resources in an SRS resource set. +maxNrofSRS-Resources-1 INTEGER ::= 63 -- Maximum number of SRS resources in an SRS resource set minus 1. +maxNrofSRS-TriggerStates-1 INTEGER ::= 3 -- Maximum number of SRS trigger states minus 1, i.e., the largest code point. +maxRAT-CapabilityContainers INTEGER ::= 8 -- Maximum number of interworking RAT containers (incl NR and MRDC) +maxSimultaneousBands INTEGER ::= 32 -- Maximum number of simultaneously aggregated bands + + +maxNrofSlotFormatCombinationsPerCell INTEGER ::= 16 -- Maximum number of +maxNrofSlotFormatCombinationsPerSet INTEGER ::= 4096 -- Maximum number of Slot Format Combinations in a SF-Set. +maxNrofSlotFormatCombinationsPerSet-1 INTEGER ::= 4095 -- Maximum number of Slot Format Combinations in a SF-Set minus 1. +maxNrofPUCCH-Resources INTEGER ::= 128 +maxNrofPUCCH-Resources-1 INTEGER ::= 127 +maxNrofPUCCH-ResourceSets INTEGER ::= 4 -- Maximum number of PUCCH Resource Sets +maxNrofPUCCH-ResourceSets-1 INTEGER ::= 3 -- Maximum number of PUCCH Resource Sets minus 1. +maxNrofPUCCH-ResourcesPerSet INTEGER ::= 32 -- Maximum number of PUCCH Resources per PUCCH-ResourceSet +maxNrofPUCCH-ResourcesPerSet-1 INTEGER ::= 31 -- Maximum number of PUCCH Resources per PUCCH-ResourceSet minus 1. +maxNrofPUCCH-P0-PerSet INTEGER ::= 8 -- Maximum number of P0-pucch present in a p0-pucch set +maxNrofPUCCH-PathlossReferenceRSs INTEGER ::= 4 -- Maximum number of RSs used as pathloss reference for PUCCH power control. +maxNrofPUCCH-PathlossReferenceRSs-1 INTEGER ::= 3 -- Maximum number of RSs used as pathloss reference for PUCCH power control minus 1. + +maxNrofP0-PUSCH-AlphaSets INTEGER ::= 30 -- Maximum number of P0-pusch-alpha-sets (see 38,213, section 7.1) +maxNrofP0-PUSCH-AlphaSets-1 INTEGER ::= 29 -- Maximum number of P0-pusch-alpha-sets minus 1 (see 38,213, section 7.1) +maxNrofPUSCH-PathlossReferenceRSs INTEGER ::= 4 -- Maximum number of RSs used as pathloss reference for PUSCH power control. +maxNrofPUSCH-PathlossReferenceRSs-1 INTEGER ::= 3 -- Maximum number of RSs used as pathloss reference for PUSCH power control minus 1. + +maxBands INTEGER ::= 1024 -- Maximum number of supported bands in UE capability. +maxBandsMRDC INTEGER ::= 1280 +maxBandsEUTRA INTEGER ::= 256 +maxCellPrep INTEGER ::= 32 +maxCellReport INTEGER ::= 8 +maxDRB INTEGER ::= 29 -- Maximum number of DRBs (that can be added in DRB-ToAddModLIst). +maxFreq INTEGER ::= 8 -- Max number of non-serving frequencies in MeasResultSCG-Failure. +maxNrofCSI-RS INTEGER ::= 64 +maxNrofCandidateBeams INTEGER ::= 16 -- Max number of PRACH-ResourceDedicatedBFR that in BFR config. +maxNrofPCIsPerSMTC INTEGER ::= 64 -- Maximun number of PCIs per SMTC. +maxNrofQFIs INTEGER ::= 64 +maxNrofSR-Resources INTEGER ::= 8 -- Maximum number of SR resources per BWP in a cell. +maxNrofSlotFormatsPerCombination INTEGER ::= 256 +maxNrofSpatialRelationInfos INTEGER ::= 8 +maxNrofSRS-ResourcesPerSet INTEGER ::= 16 +maxNrofIndexesToReport INTEGER ::= 32 +maxNrofSSBs INTEGER ::= 64 -- Maximum number of SSB resources in a resource set. +maxNrofSSBs-1 INTEGER ::= 63 -- Maximum number of SSB resources in a resource set minus 1. + +maxNrofTCI-StatesPDCCH INTEGER ::= 64 +maxNrofTCI-States INTEGER ::= 64 -- Maximum number of TCI states. +maxNrofTCI-States-1 INTEGER ::= 63 -- Maximum number of TCI states minus 1. +maxNrofUL-Allocations INTEGER ::= 16 -- Maximum number of PUSCH time domain resource allocations. +maxQFI INTEGER ::= 63 +maxRA-CSIRS-Resources INTEGER ::= 96 +maxRA-OccasionsPerCSIRS INTEGER ::= 64 -- Maximum number of RA occasions for one CSI-RS +maxRA-Occasions-1 INTEGER ::= 511 -- Maximum number of RA occasions in the system +maxRA-SSB-Resources INTEGER ::= 64 +maxSCSs INTEGER ::= 5 +maxSecondaryCellGroups INTEGER ::= 3 +maxNrofServingCellsEUTRA INTEGER ::= 32 +maxMBSFN-Allocations INTEGER ::= 8 +maxNrofMultiBands INTEGER ::= 8 +maxCellSFTD INTEGER ::= 3 -- Maximum number of cells for SFTD reporting +maxReportConfigId INTEGER ::= 64 + +maxNrofSRI-PUSCH-Mappings INTEGER ::= 16 +maxNrofSRI-PUSCH-Mappings-1 INTEGER ::= 15 + +-- Editor’s Note: Targeted for completion in June 2018. Not used in EN-DC drop. +CellIdentity ::= ENUMERATED {ffsTypeAndValue} +ShortMAC-I ::= ENUMERATED {ffsTypeAndValue} + +-- TAG-MULTIPLICITY-AND-TYPE-CONSTRAINT-DEFINITIONS-STOP + +END + diff --git a/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-UE-Variables.asn b/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-UE-Variables.asn new file mode 100755 index 0000000000..3eeec31891 --- /dev/null +++ b/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-UE-Variables.asn @@ -0,0 +1,46 @@ +NR-UE-Variables DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- TAG-VAR-MEAS-CONFIG-START + +VarMeasConfig ::= SEQUENCE { + -- Measurement identities + measIdList MeasIdToAddModList OPTIONAL, + -- Measurement objects + measObjectList MeasObjectToAddModList OPTIONAL, + -- Reporting configurations + reportConfigList ReportConfigToAddModList OPTIONAL, + -- Other parameters + quantityConfig QuantityConfig OPTIONAL, + + s-MeasureConfig CHOICE { + ssb-RSRP RSRP-Range, + csi-RSRP RSRP-Range + } OPTIONAL + +} + +-- TAG-VAR-MEAS-CONFIG-STOP +-- TAG-VAR-MEAS-REPORT-START + +VarMeasReportList ::= SEQUENCE (SIZE (1..maxNrofMeasId)) OF VarMeasReport + +VarMeasReport ::= SEQUENCE { + -- List of measurement that have been triggered + measId MeasId, + cellsTriggeredList CellsTriggeredList OPTIONAL, + numberOfReportsSent INTEGER +} + +CellsTriggeredList ::= SEQUENCE (SIZE (1..maxNrofCellMeas)) OF CHOICE { + physCellId PhysCellId, +-- Not needed for EN-DC. + physCellIdEUTRA ENUMERATED {ffsTypeAndValue} + } + + +-- TAG-VAR-MEAS-REPORT-STOP + +END + diff --git a/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/extract_asn1_from_spce.pl b/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/extract_asn1_from_spce.pl new file mode 100755 index 0000000000..18f6792a8c --- /dev/null +++ b/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/extract_asn1_from_spce.pl @@ -0,0 +1,82 @@ +#!/usr/bin/perl +# This script extracts the ASN1 definition from and TS 38.331 and generates 3 output files that can be processed by asn2wrs +# First download the specification from 3gpp.org as a word document and open it +# Then in "view" menu, select normal or web layout (needed to removed page header and footers) +# Finally save the document as a text file +# Call the script: "perl extract_asn1_from_spec.pl 38331-xxx.txt" +# It should generate: NR-RRC-Definitions.asn, NR-UE-Variables.asn and NR-InterNodeDefinitions +use warnings; +$input_file = $ARGV[0]; +$NR_def_output_file = "NR-RRC-Definitions.asn"; +$NR_var_output_file = "NR-UE-Variables.asn"; +$NR_internode_output_file = "NR-InterNodeDefinitions.asn"; + + +sub extract_asn1; + +open(INPUT_FILE, "< $input_file") or die "Can not open file $input_file"; + +while () { + + # Process the NR-RRC-Definitions section + if( m/NR-RRC-Definitions DEFINITIONS AUTOMATIC TAGS ::=/){ + open(OUTPUT_FILE, "> $NR_def_output_file") or die "Can not open file $def_output_file"; + syswrite OUTPUT_FILE,"$_ \n"; + syswrite OUTPUT_FILE,"BEGIN\n\n"; + + # Get all the text delimited by -- ASN1START and -- ASN1STOP + extract_asn1(); + + syswrite OUTPUT_FILE,"END\n\n"; + close(OUTPUT_FILE); + } + + # Process the NR-UE-Variables section + if( m/NR-UE-Variables DEFINITIONS AUTOMATIC TAGS ::=/){ + open(OUTPUT_FILE, "> $NR_var_output_file") or die "Can not open file $def_output_file"; + syswrite OUTPUT_FILE,"$_ \n"; + syswrite OUTPUT_FILE,"BEGIN\n\n"; + + # Get all the text delimited by -- ASN1START and -- ASN1STOP + extract_asn1(); + + syswrite OUTPUT_FILE,"END\n\n"; + close(OUTPUT_FILE); + } + # Process the NR-InterNodeDefinitions section + if( m/NR-InterNodeDefinitions DEFINITIONS AUTOMATIC TAGS ::=/){ + open(OUTPUT_FILE, "> $NR_internode_output_file") or die "Can not open file $def_output_file"; + syswrite OUTPUT_FILE,"$_ \n"; + syswrite OUTPUT_FILE,"BEGIN\n\n"; + + # Get all the text delimited by -- ASN1START and -- ASN1STOP + extract_asn1(); + + syswrite OUTPUT_FILE,"END\n\n"; + close(OUTPUT_FILE); + } + +} + +close(INPUT_FILE); + +# This subroutine copies the text delimited by -- ASN1START and -- ASN1STOP in INPUT_FILE +# and copies it into OUTPUT_FILE. +# It stops when it meets the keyword "END" +sub extract_asn1 { + my $line = ; + my $is_asn1 = 0; + + while(($line ne "END\n") && ($line ne "END\r\n")){ + if ($line =~ m/-- ASN1STOP/) { + $is_asn1 = 0; + } + if ($is_asn1 == 1){ + syswrite OUTPUT_FILE,"$line"; + } + if ($line =~ m/-- ASN1START/) { + $is_asn1 = 1; + } + $line = ; + } +} diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c new file mode 100644 index 0000000000..a05b27ddc3 --- /dev/null +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -0,0 +1,2667 @@ +/* + * 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 + */ + +/*! \file asn1_msg.c +* \brief primitives to build the asn1 messages +* \author Raymond Knopp and Navid Nikaein +* \date 2011 +* \version 1.0 +* \company Eurecom +* \email: raymond.knopp@eurecom.fr and navid.nikaein@eurecom.fr +*/ + +#ifdef USER_MODE +#include +#include +#include /* for atoi(3) */ +#include /* for getopt(3) */ +#include /* for strerror(3) */ +#include /* for EX_* exit codes */ +#include /* for errno */ +#else +#include /* Needed by all modules */ +#endif +#ifdef USER_MODE +//#include "RRC/LITE/defs.h" +//#include "COMMON/mac_rrc_primitives.h" +#include "UTIL/LOG/log.h" +#endif +#include +#include /* for _ASN_DEFAULT_STACK_MAX */ +#include + +#include "assertions.h" +#include "RRCConnectionRequest.h" +#include "UL-CCCH-Message.h" +#include "UL-DCCH-Message.h" +#include "DL-CCCH-Message.h" +#include "DL-DCCH-Message.h" +#include "EstablishmentCause.h" +#include "RRCConnectionSetup.h" +#include "SRB-ToAddModList.h" +#include "DRB-ToAddModList.h" +#if defined(Rel10) || defined(Rel14) +#include "MCCH-Message.h" +//#define MRB1 1 +#endif + +#include "RRC/LITE/defs.h" +#include "RRC/LITE/extern.h" +#include "RRCConnectionSetupComplete.h" +#include "RRCConnectionReconfigurationComplete.h" +#include "RRCConnectionReconfiguration.h" +#include "MasterInformationBlock.h" +#include "SystemInformation.h" + +#include "SystemInformationBlockType1.h" + +#include "SIB-Type.h" + +#include "BCCH-DL-SCH-Message.h" + +#include "PHY/defs.h" + +#include "MeasObjectToAddModList.h" +#include "ReportConfigToAddModList.h" +#include "MeasIdToAddModList.h" +#include "enb_config.h" + +#if defined(ENABLE_ITTI) +# include "intertask_interface.h" +#endif + +#include "common/ran_context.h" + +//#include "PHY/defs.h" +#ifndef USER_MODE +#define msg printk +#ifndef errno +int errno; +#endif +#else +# if !defined (msg) +# define msg printf +# endif +#endif + +//#define XER_PRINT + +typedef struct xer_sprint_string_s { + char *string; + size_t string_size; + size_t string_index; +} xer_sprint_string_t; + +extern unsigned char NB_eNB_INST; +extern uint8_t usim_test; + +extern RAN_CONTEXT_t RC; + +uint16_t two_tier_hexagonal_cellIds[7] = {0,1,2,4,5,7,8}; +uint16_t two_tier_hexagonal_adjacent_cellIds[7][6] = {{1,2,4,5,7,8}, // CellId 0 + {11,18,2,0,8,15}, // CellId 1 + {18,13,3,4,0,1}, // CellId 2 + {2,3,14,6,5,0}, // CellId 4 + {0,4,6,16,9,7}, // CellId 5 + {8,0,5,9,17,12}, // CellId 7 + {15,1,0,7,12,10} +};// CellId 8 + +/* + * This is a helper function for xer_sprint, which directs all incoming data + * into the provided string. + */ +static int xer__print2s (const void *buffer, size_t size, void *app_key) +{ + xer_sprint_string_t *string_buffer = (xer_sprint_string_t *) app_key; + size_t string_remaining = string_buffer->string_size - string_buffer->string_index; + + if (string_remaining > 0) { + if (size > string_remaining) { + size = string_remaining; + } + + memcpy(&string_buffer->string[string_buffer->string_index], buffer, size); + string_buffer->string_index += size; + } + + return 0; +} + +int xer_sprint (char *string, size_t string_size, asn_TYPE_descriptor_t *td, void *sptr) +{ + asn_enc_rval_t er; + xer_sprint_string_t string_buffer; + + string_buffer.string = string; + string_buffer.string_size = string_size; + string_buffer.string_index = 0; + + er = xer_encode(td, sptr, XER_F_BASIC, xer__print2s, &string_buffer); + + if (er.encoded < 0) { + LOG_E(RRC, "xer_sprint encoding error (%zd)!", er.encoded); + er.encoded = string_buffer.string_size; + } else { + if (er.encoded > string_buffer.string_size) { + LOG_E(RRC, "xer_sprint string buffer too small, got %zd need %zd!", string_buffer.string_size, er.encoded); + er.encoded = string_buffer.string_size; + } + } + + return er.encoded; +} + +uint16_t get_adjacent_cell_id(uint8_t Mod_id,uint8_t index) +{ + return(two_tier_hexagonal_adjacent_cellIds[Mod_id][index]); +} +/* This only works for the hexagonal topology...need a more general function for other topologies */ + +uint8_t get_adjacent_cell_mod_id(uint16_t phyCellId) +{ + uint8_t i; + + for(i=0; i<7; i++) { + if(two_tier_hexagonal_cellIds[i] == phyCellId) { + return i; + } + } + + LOG_E(RRC,"\nCannot get adjacent cell mod id! Fatal error!\n"); + return 0xFF; //error! +} + +uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich_Resource, uint32_t phich_duration, uint32_t frame) +{ + + asn_enc_rval_t enc_rval; + BCCH_BCH_Message_t *mib=&carrier->mib ; + uint8_t sfn = (uint8_t)((frame>>2)&0xff); + uint16_t *spare= calloc(1, sizeof(uint16_t)); + if (spare == NULL) abort(); + + switch (N_RB_DL) { + + case 6: + mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n6; + break; + + case 15: + mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n15; + break; + + case 25: + mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n25; + break; + + case 50: + mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n50; + break; + + case 75: + mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n75; + break; + + case 100: + mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n100; + break; + default: + AssertFatal(1==0,"Unknown dl_Bandwidth %d\n",N_RB_DL); + } + + AssertFatal(phich_Resource <= PHICH_Config__phich_Resource_two,"Illegal phich_Resource\n"); + mib->message.phich_Config.phich_Resource = phich_Resource; + AssertFatal(phich_Resource <= PHICH_Config__phich_Duration_extended,"Illegal phich_Duration\n"); + mib->message.phich_Config.phich_Duration = phich_duration; + LOG_I(RRC,"[MIB] systemBandwidth %x, phich_duration %x, phich_resource %x,sfn %x\n", + (uint32_t)mib->message.dl_Bandwidth, + (uint32_t)phich_duration, + (uint32_t)phich_Resource, + (uint32_t)sfn); + + mib->message.systemFrameNumber.buf = &sfn; + mib->message.systemFrameNumber.size = 1; + mib->message.systemFrameNumber.bits_unused=0; + mib->message.spare.buf = (uint8_t *)spare; +#ifndef Rel14 + mib->message.spare.size = 2; + mib->message.spare.bits_unused = 6; // This makes a spare of 10 bits +#else + mib->message.spare.size = 1; + mib->message.spare.bits_unused = 3; // This makes a spare of 5 bits + mib->message.schedulingInfoSIB1_BR_r13 = 0; // turn off eMTC +#endif + + enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message, + (void*)mib, + carrier->MIB, + 24); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + + /* +#if defined(ENABLE_ITTI) +# if !defined(DISABLE_XER_SPRINT) + { + char message_string[20000]; + size_t message_string_size; + + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_BCCH_BCH_Message, (void *) &mib)) > 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_BCCH, message_string_size + sizeof (IttiMsgText)); + msg_p->ittiMsg.rrc_dl_bcch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_dl_bcch.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, enb_module_idP, msg_p); + } + } +# endif +#endif + */ + if (enc_rval.encoded==-1) { + return(-1); + } + + return((enc_rval.encoded+7)/8); +} + +uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier, + int Mod_id,int CC_id +#if defined(ENABLE_ITTI) + , RrcConfigurationReq *configuration +#endif + ) +{ + + // SystemInformation_t systemInformation; + PLMN_IdentityInfo_t PLMN_identity_info; + MCC_MNC_Digit_t dummy_mcc[3],dummy_mnc[3]; + asn_enc_rval_t enc_rval; + SchedulingInfo_t schedulingInfo; + SIB_Type_t sib_type; + + uint8_t *buffer = carrier->SIB1; + BCCH_DL_SCH_Message_t *bcch_message = &carrier->siblock1; + SystemInformationBlockType1_t **sib1 = &carrier->sib1; + + + memset(bcch_message,0,sizeof(BCCH_DL_SCH_Message_t)); + bcch_message->message.present = BCCH_DL_SCH_MessageType_PR_c1; + bcch_message->message.choice.c1.present = BCCH_DL_SCH_MessageType__c1_PR_systemInformationBlockType1; + // memcpy(&bcch_message.message.choice.c1.choice.systemInformationBlockType1,sib1,sizeof(SystemInformationBlockType1_t)); + + *sib1 = &bcch_message->message.choice.c1.choice.systemInformationBlockType1; + + memset(&PLMN_identity_info,0,sizeof(PLMN_IdentityInfo_t)); + memset(&schedulingInfo,0,sizeof(SchedulingInfo_t)); + memset(&sib_type,0,sizeof(SIB_Type_t)); + + + + PLMN_identity_info.plmn_Identity.mcc = CALLOC(1,sizeof(*PLMN_identity_info.plmn_Identity.mcc)); + memset(PLMN_identity_info.plmn_Identity.mcc,0,sizeof(*PLMN_identity_info.plmn_Identity.mcc)); + + asn_set_empty(&PLMN_identity_info.plmn_Identity.mcc->list);//.size=0; + +#if defined(ENABLE_ITTI) + dummy_mcc[0] = (configuration->mcc / 100) % 10; + dummy_mcc[1] = (configuration->mcc / 10) % 10; + dummy_mcc[2] = (configuration->mcc / 1) % 10; +#else + dummy_mcc[0] = 0; + dummy_mcc[1] = 0; + dummy_mcc[2] = 1; +#endif + ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mcc->list,&dummy_mcc[0]); + ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mcc->list,&dummy_mcc[1]); + ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mcc->list,&dummy_mcc[2]); + + PLMN_identity_info.plmn_Identity.mnc.list.size=0; + PLMN_identity_info.plmn_Identity.mnc.list.count=0; +#if defined(ENABLE_ITTI) + + if (configuration->mnc >= 100) { + dummy_mnc[0] = (configuration->mnc / 100) % 10; + dummy_mnc[1] = (configuration->mnc / 10) % 10; + dummy_mnc[2] = (configuration->mnc / 1) % 10; + } else { + if (configuration->mnc_digit_length == 2) { + dummy_mnc[0] = (configuration->mnc / 10) % 10; + dummy_mnc[1] = (configuration->mnc / 1) % 10; + dummy_mnc[2] = 0xf; + } else { + dummy_mnc[0] = (configuration->mnc / 100) % 100; + dummy_mnc[1] = (configuration->mnc / 10) % 10; + dummy_mnc[2] = (configuration->mnc / 1) % 10; + } + } + +#else + dummy_mnc[0] = 0; + dummy_mnc[1] = 1; + dummy_mnc[2] = 0xf; +#endif + ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mnc.list,&dummy_mnc[0]); + ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mnc.list,&dummy_mnc[1]); + + if (dummy_mnc[2] != 0xf) { + ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mnc.list,&dummy_mnc[2]); + } + + //assign_enum(&PLMN_identity_info.cellReservedForOperatorUse,PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved); + PLMN_identity_info.cellReservedForOperatorUse=PLMN_IdentityInfo__cellReservedForOperatorUse_notReserved; + + ASN_SEQUENCE_ADD(&(*sib1)->cellAccessRelatedInfo.plmn_IdentityList.list,&PLMN_identity_info); + + + // 16 bits + (*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf = MALLOC(2); +#if defined(ENABLE_ITTI) + (*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf[0] = (configuration->tac >> 8) & 0xff; + (*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf[1] = (configuration->tac >> 0) & 0xff; +#else + (*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf[0] = 0x00; + (*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf[1] = 0x01; +#endif + (*sib1)->cellAccessRelatedInfo.trackingAreaCode.size=2; + (*sib1)->cellAccessRelatedInfo.trackingAreaCode.bits_unused=0; + + // 28 bits + (*sib1)->cellAccessRelatedInfo.cellIdentity.buf = MALLOC(8); +#if defined(ENABLE_ITTI) + (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[0] = (configuration->cell_identity >> 20) & 0xff; + (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[1] = (configuration->cell_identity >> 12) & 0xff; + (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[2] = (configuration->cell_identity >> 4) & 0xff; + (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[3] = (configuration->cell_identity << 4) & 0xf0; +#else + (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[0] = 0x00; + (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[1] = 0x00; + (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[2] = 0x00; + (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[3] = 0x10; +#endif + (*sib1)->cellAccessRelatedInfo.cellIdentity.size=4; + (*sib1)->cellAccessRelatedInfo.cellIdentity.bits_unused=4; + + // assign_enum(&(*sib1)->cellAccessRelatedInfo.cellBarred,SystemInformationBlockType1__cellAccessRelatedInfo__cellBarred_notBarred); + (*sib1)->cellAccessRelatedInfo.cellBarred=SystemInformationBlockType1__cellAccessRelatedInfo__cellBarred_notBarred; + + // assign_enum(&(*sib1)->cellAccessRelatedInfo.intraFreqReselection,SystemInformationBlockType1__cellAccessRelatedInfo__intraFreqReselection_allowed); + (*sib1)->cellAccessRelatedInfo.intraFreqReselection=SystemInformationBlockType1__cellAccessRelatedInfo__intraFreqReselection_notAllowed; + (*sib1)->cellAccessRelatedInfo.csg_Indication=0; + + (*sib1)->cellSelectionInfo.q_RxLevMin=-65; + (*sib1)->cellSelectionInfo.q_RxLevMinOffset=NULL; + //(*sib1)->p_Max = CALLOC(1, sizeof(P_Max_t)); + //*((*sib1)->p_Max) = 23; + (*sib1)->freqBandIndicator = +#if defined(ENABLE_ITTI) + configuration->eutra_band[CC_id]; +#else + 7; +#endif + + schedulingInfo.si_Periodicity=SchedulingInfo__si_Periodicity_rf8; + + // This is for SIB2/3 + sib_type=SIB_Type_sibType3; + ASN_SEQUENCE_ADD(&schedulingInfo.sib_MappingInfo.list,&sib_type); + ASN_SEQUENCE_ADD(&(*sib1)->schedulingInfoList.list,&schedulingInfo); + + // ASN_SEQUENCE_ADD(&schedulingInfo.sib_MappingInfo.list,NULL); + +#if defined(ENABLE_ITTI) + + if (configuration->frame_type[CC_id] == TDD) +#endif + { + (*sib1)->tdd_Config = CALLOC(1,sizeof(struct TDD_Config)); + + (*sib1)->tdd_Config->subframeAssignment = +#if defined(ENABLE_ITTI) + configuration->tdd_config[CC_id]; +#else + 3; +#endif + + (*sib1)->tdd_Config->specialSubframePatterns = +#if defined(ENABLE_ITTI) + configuration->tdd_config_s[CC_id]; +#else + 0; +#endif + } + + (*sib1)->si_WindowLength=SystemInformationBlockType1__si_WindowLength_ms20; + (*sib1)->systemInfoValueTag=0; + // (*sib1).nonCriticalExtension = calloc(1,sizeof(*(*sib1).nonCriticalExtension)); + +#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, (void*)bcch_message); +#endif + enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message, + (void*)bcch_message, + buffer, + 100); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + +#if defined(ENABLE_ITTI) +# if !defined(DISABLE_XER_SPRINT) + { + char message_string[10000]; + size_t message_string_size; + + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_BCCH_DL_SCH_Message, (void *)bcch_message)) > 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_BCCH, message_string_size + sizeof (IttiMsgText)); + msg_p->ittiMsg.rrc_dl_bcch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_dl_bcch.text, message_string, message_string_size); + itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); + } + } +# endif +#endif + +#ifdef USER_MODE + LOG_D(RRC,"[eNB] SystemInformationBlockType1 Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); +#endif + + if (enc_rval.encoded==-1) { + return(-1); + } + + return((enc_rval.encoded+7)/8); +} + +uint8_t do_SIB23(uint8_t Mod_id, + + int CC_id +#if defined(ENABLE_ITTI) + , RrcConfigurationReq *configuration +#endif + ) +{ + struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member *sib2_part,*sib3_part; +#if defined(Rel10) || defined(Rel14) + struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member *sib13_part; + MBSFN_SubframeConfigList_t *MBSFNSubframeConfigList; + MBSFN_AreaInfoList_r9_t *MBSFNArea_list; + struct MBSFN_AreaInfo_r9 *MBSFN_Area1, *MBSFN_Area2; +#endif + asn_enc_rval_t enc_rval; + + uint8_t *buffer = RC.rrc[Mod_id]->carrier[CC_id].SIB23; + BCCH_DL_SCH_Message_t *bcch_message = &RC.rrc[Mod_id]->carrier[CC_id].systemInformation; + SystemInformationBlockType2_t **sib2 = &RC.rrc[Mod_id]->carrier[CC_id].sib2; + SystemInformationBlockType3_t **sib3 = &RC.rrc[Mod_id]->carrier[CC_id].sib3; +#if defined(Rel10) || defined(Rel14) + SystemInformationBlockType13_r9_t **sib13 = &RC.rrc[Mod_id]->carrier[CC_id].sib13; + uint8_t MBMS_flag = RC.rrc[Mod_id]->carrier[CC_id].MBMS_flag; +#endif + + if (bcch_message) { + memset(bcch_message,0,sizeof(BCCH_DL_SCH_Message_t)); + } else { + LOG_E(RRC,"[eNB %d] BCCH_MESSAGE is null, exiting\n", Mod_id); + exit(-1); + } + + if (!sib2) { + LOG_E(RRC,"[eNB %d] sib2 is null, exiting\n", Mod_id); + exit(-1); + } + + if (!sib3) { + LOG_E(RRC,"[eNB %d] sib3 is null, exiting\n", Mod_id); + exit(-1); + } + +#if defined(Rel10) || defined(Rel14) + LOG_I(RRC,"[eNB %d] Configuration SIB2/3, MBMS = %d\n", Mod_id, MBMS_flag); +#else + LOG_I(RRC,"[eNB %d] Configuration SIB2/3\n", Mod_id); +#endif + sib2_part = CALLOC(1,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); + sib3_part = CALLOC(1,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); + memset(sib2_part,0,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); + memset(sib3_part,0,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); + + sib2_part->present = SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2; + sib3_part->present = SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3; + + *sib2 = &sib2_part->choice.sib2; + *sib3 = &sib3_part->choice.sib3; + +#if defined(Rel10) || defined(Rel14) + + if (MBMS_flag > 0) { + sib13_part = CALLOC(1,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); + memset(sib13_part,0,sizeof(struct SystemInformation_r8_IEs__sib_TypeAndInfo__Member)); + sib13_part->present = SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib13_v920; + *sib13 = &sib13_part->choice.sib13_v920; + } + +#endif + + // sib2 + + (*sib2)->ac_BarringInfo = NULL; +#if defined(Rel10) || defined(Rel14) +#if 0 + (*sib2)->ssac_BarringForMMTEL_Voice_r9 = NULL; + (*sib2)->ssac_BarringForMMTEL_Video_r9 = NULL; + (*sib2)->ac_BarringForCSFB_r10 = NULL; +#endif + (*sib2)->ext1 = NULL; + (*sib2)->ext2 = NULL; +#endif + +#if defined(ENABLE_ITTI) + + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.numberOfRA_Preambles = configuration->rach_numberOfRA_Preambles[CC_id]; + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig = NULL; + + if (configuration->rach_preamblesGroupAConfig[CC_id]) { + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig + = CALLOC(1,sizeof(struct RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig)); + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig->sizeOfRA_PreamblesGroupA + = configuration->rach_sizeOfRA_PreamblesGroupA[CC_id]; + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig->messageSizeGroupA + = configuration->rach_messageSizeGroupA[CC_id]; + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig->messagePowerOffsetGroupB + = configuration->rach_messagePowerOffsetGroupB[CC_id]; + } + + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.powerRampingStep = configuration->rach_powerRampingStep[CC_id]; + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.preambleInitialReceivedTargetPower = + configuration->rach_preambleInitialReceivedTargetPower[CC_id]; + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.preambleTransMax = configuration->rach_preambleTransMax[CC_id]; + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.ra_ResponseWindowSize = configuration->rach_raResponseWindowSize[CC_id]; + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer = + configuration->rach_macContentionResolutionTimer[CC_id]; + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.maxHARQ_Msg3Tx = configuration->rach_maxHARQ_Msg3Tx[CC_id]; + + // BCCH-Config + (*sib2)->radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff + = configuration->bcch_modificationPeriodCoeff[CC_id]; + + // PCCH-Config + (*sib2)->radioResourceConfigCommon.pcch_Config.defaultPagingCycle + = configuration->pcch_defaultPagingCycle[CC_id]; + (*sib2)->radioResourceConfigCommon.pcch_Config.nB + = configuration->pcch_nB[CC_id]; + + // PRACH-Config + (*sib2)->radioResourceConfigCommon.prach_Config.rootSequenceIndex + = configuration->prach_root[CC_id]; + (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_ConfigIndex + = configuration->prach_config_index[CC_id]; + (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.highSpeedFlag + = configuration->prach_high_speed[CC_id]; + (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig + = configuration->prach_zero_correlation[CC_id]; + (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_FreqOffset + = configuration->prach_freq_offset[CC_id]; + + // PDSCH-Config + (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.referenceSignalPower + = configuration->pdsch_referenceSignalPower[CC_id]; + (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.p_b + = configuration->pdsch_p_b[CC_id]; + + // PUSCH-Config + (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.n_SB + = configuration->pusch_n_SB[CC_id]; + (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode + = configuration->pusch_hoppingMode[CC_id]; + (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset + = configuration->pusch_hoppingOffset[CC_id]; + (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM + = configuration->pusch_enable64QAM[CC_id]; + (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled + = configuration->pusch_groupHoppingEnabled[CC_id]; + (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH + = configuration->pusch_groupAssignment[CC_id]; + (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled + = configuration->pusch_sequenceHoppingEnabled[CC_id]; + (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift + = configuration->pusch_nDMRS1[CC_id]; + + // PUCCH-Config + + (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.deltaPUCCH_Shift + = configuration->pucch_delta_shift[CC_id]; + (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.nRB_CQI + = configuration->pucch_nRB_CQI[CC_id]; + (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.nCS_AN + = configuration->pucch_nCS_AN[CC_id]; +#if !defined(Rel10) && !defined(Rel14) + (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.n1PUCCH_AN + = configuration->pucch_n1_AN[CC_id]; +#endif + + // SRS Config + if (configuration->srs_enable[CC_id]==1) { + (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present + = SoundingRS_UL_ConfigCommon_PR_setup; + (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_BandwidthConfig + = configuration->srs_BandwidthConfig[CC_id]; + (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig + = configuration->srs_SubframeConfig[CC_id]; + (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.ackNackSRS_SimultaneousTransmission + = configuration->srs_ackNackST[CC_id]; + + if (configuration->srs_MaxUpPts[CC_id]) { + (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts + = CALLOC(1,sizeof(long)); + *(*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts=1; + } else { + (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_MaxUpPts = NULL; + } + RC.rrc[Mod_id]->srs_enable[CC_id] = 1; + } else { + RC.rrc[Mod_id]->srs_enable[CC_id] = 0; + (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present=SoundingRS_UL_ConfigCommon_PR_release; + (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.release=0; + } + + // uplinkPowerControlCommon + + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUSCH + = configuration->pusch_p0_Nominal[CC_id]; + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUCCH + = configuration->pucch_p0_Nominal[CC_id]; + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.alpha + = configuration->pusch_alpha[CC_id]; + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1 + = configuration->pucch_deltaF_Format1[CC_id]; + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1b + = configuration->pucch_deltaF_Format1b[CC_id]; + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2 + = configuration->pucch_deltaF_Format2[CC_id]; + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2a + = configuration->pucch_deltaF_Format2a[CC_id]; + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b + = configuration->pucch_deltaF_Format2b[CC_id]; + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaPreambleMsg3 + = configuration->msg3_delta_Preamble[CC_id]; + (*sib2)->radioResourceConfigCommon.ul_CyclicPrefixLength + = configuration->ul_CyclicPrefixLength[CC_id]; + + // UE Timers and Constants + + (*sib2)->ue_TimersAndConstants.t300 + = configuration->ue_TimersAndConstants_t300[CC_id]; + (*sib2)->ue_TimersAndConstants.t301 + = configuration->ue_TimersAndConstants_t301[CC_id]; + (*sib2)->ue_TimersAndConstants.t310 + = configuration->ue_TimersAndConstants_t310[CC_id]; + (*sib2)->ue_TimersAndConstants.n310 + = configuration->ue_TimersAndConstants_n310[CC_id]; + (*sib2)->ue_TimersAndConstants.t311 + = configuration->ue_TimersAndConstants_t311[CC_id]; + (*sib2)->ue_TimersAndConstants.n311 + = configuration->ue_TimersAndConstants_n311[CC_id]; + +#else + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.numberOfRA_Preambles=RACH_ConfigCommon__preambleInfo__numberOfRA_Preambles_n64; + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.preambleInfo.preamblesGroupAConfig = NULL; + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.powerRampingStep=RACH_ConfigCommon__powerRampingParameters__powerRampingStep_dB2; + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.powerRampingParameters.preambleInitialReceivedTargetPower= + RACH_ConfigCommon__powerRampingParameters__preambleInitialReceivedTargetPower_dBm_100; + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.preambleTransMax=RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n10; + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.ra_ResponseWindowSize=RACH_ConfigCommon__ra_SupervisionInfo__ra_ResponseWindowSize_sf10; + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.ra_SupervisionInfo.mac_ContentionResolutionTimer= + RACH_ConfigCommon__ra_SupervisionInfo__mac_ContentionResolutionTimer_sf48; + (*sib2)->radioResourceConfigCommon.rach_ConfigCommon.maxHARQ_Msg3Tx = 4; + + // BCCH-Config + (*sib2)->radioResourceConfigCommon.bcch_Config.modificationPeriodCoeff=BCCH_Config__modificationPeriodCoeff_n2; + + // PCCH-Config + (*sib2)->radioResourceConfigCommon.pcch_Config.defaultPagingCycle = PCCH_Config__defaultPagingCycle_rf128; + (*sib2)->radioResourceConfigCommon.pcch_Config.nB=PCCH_Config__nB_oneT; + + // PRACH-Config + (*sib2)->radioResourceConfigCommon.prach_Config.rootSequenceIndex=Mod_id;//0;//384; + (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_ConfigIndex = 0;//3; + (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.highSpeedFlag = 0; + (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.zeroCorrelationZoneConfig = 1;//12; + (*sib2)->radioResourceConfigCommon.prach_Config.prach_ConfigInfo.prach_FreqOffset = 2; + + // PDSCH-Config + (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.referenceSignalPower=0; // corresponds to 24.7 dBm 5 MHz/ 27.7 10 MHz/ 30.7 20 MHz + + + (*sib2)->radioResourceConfigCommon.pdsch_ConfigCommon.p_b=0; + + // PUSCH-Config + (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.n_SB=1; + (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode=PUSCH_ConfigCommon__pusch_ConfigBasic__hoppingMode_interSubFrame; + (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset=0; + (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM=0; + (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled=1; + (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH=0; + (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled=0; + (*sib2)->radioResourceConfigCommon.pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift=0; + + // PUCCH-Config + + (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.deltaPUCCH_Shift=PUCCH_ConfigCommon__deltaPUCCH_Shift_ds1; + (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.nRB_CQI = 1; + (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.nCS_AN = 0; + (*sib2)->radioResourceConfigCommon.pucch_ConfigCommon.n1PUCCH_AN = 32; + + + (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present=SoundingRS_UL_ConfigCommon_PR_release; + (*sib2)->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.release=0; + + // uplinkPowerControlCommon + + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUSCH = -108; + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.p0_NominalPUCCH = -108; + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.alpha=UplinkPowerControlCommon__alpha_al1; + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1=DeltaFList_PUCCH__deltaF_PUCCH_Format1_deltaF2; + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format1b=DeltaFList_PUCCH__deltaF_PUCCH_Format1b_deltaF3; + + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2=DeltaFList_PUCCH__deltaF_PUCCH_Format2_deltaF0; + + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2a=DeltaFList_PUCCH__deltaF_PUCCH_Format2a_deltaF0; + + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaFList_PUCCH.deltaF_PUCCH_Format2b=DeltaFList_PUCCH__deltaF_PUCCH_Format2b_deltaF0; + + (*sib2)->radioResourceConfigCommon.uplinkPowerControlCommon.deltaPreambleMsg3 = 6; + + (*sib2)->radioResourceConfigCommon.ul_CyclicPrefixLength=UL_CyclicPrefixLength_len1; + + (*sib2)->ue_TimersAndConstants.t300=UE_TimersAndConstants__t300_ms1000; + + (*sib2)->ue_TimersAndConstants.t301=UE_TimersAndConstants__t301_ms1000; + + (*sib2)->ue_TimersAndConstants.t310=UE_TimersAndConstants__t310_ms1000; + + (*sib2)->ue_TimersAndConstants.n310=UE_TimersAndConstants__n310_n20; + + (*sib2)->ue_TimersAndConstants.t311=UE_TimersAndConstants__t311_ms10000; + + (*sib2)->ue_TimersAndConstants.n311=UE_TimersAndConstants__n311_n1; + +#endif + + (*sib2)->freqInfo.additionalSpectrumEmission = 1; + (*sib2)->freqInfo.ul_CarrierFreq = NULL; + (*sib2)->freqInfo.ul_Bandwidth = NULL; + // (*sib2)->mbsfn_SubframeConfigList = NULL; + +#if defined(Rel10) || defined(Rel14) + + if (MBMS_flag > 0) { + LOG_I(RRC,"Adding MBSFN subframe Configuration 1 to SIB2\n"); + MBSFN_SubframeConfig_t *sib2_mbsfn_SubframeConfig1; + (*sib2)->mbsfn_SubframeConfigList = CALLOC(1,sizeof(struct MBSFN_SubframeConfigList)); + MBSFNSubframeConfigList = (*sib2)->mbsfn_SubframeConfigList; + + sib2_mbsfn_SubframeConfig1= CALLOC(1,sizeof(*sib2_mbsfn_SubframeConfig1)); + memset((void*)sib2_mbsfn_SubframeConfig1,0,sizeof(*sib2_mbsfn_SubframeConfig1)); + + sib2_mbsfn_SubframeConfig1->radioframeAllocationPeriod= MBSFN_SubframeConfig__radioframeAllocationPeriod_n4; + sib2_mbsfn_SubframeConfig1->radioframeAllocationOffset= 1; + sib2_mbsfn_SubframeConfig1->subframeAllocation.present= MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame; + sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf= MALLOC(1); + sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.size= 1; + sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.bits_unused= 2; + + sib2_mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x38<<2; + + ASN_SEQUENCE_ADD(&MBSFNSubframeConfigList->list,sib2_mbsfn_SubframeConfig1); + + if (MBMS_flag == 4 ) { + LOG_I(RRC,"Adding MBSFN subframe Configuration 2 to SIB2\n"); + MBSFN_SubframeConfig_t *sib2_mbsfn_SubframeConfig2; + sib2_mbsfn_SubframeConfig2= CALLOC(1,sizeof(*sib2_mbsfn_SubframeConfig2)); + memset((void*)sib2_mbsfn_SubframeConfig2,0,sizeof(*sib2_mbsfn_SubframeConfig2)); + + sib2_mbsfn_SubframeConfig2->radioframeAllocationPeriod= MBSFN_SubframeConfig__radioframeAllocationPeriod_n4; + sib2_mbsfn_SubframeConfig2->radioframeAllocationOffset= 1; + sib2_mbsfn_SubframeConfig2->subframeAllocation.present= MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame; + sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.buf= MALLOC(1); + sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.size= 1; + sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.bits_unused= 2; + + sib2_mbsfn_SubframeConfig2->subframeAllocation.choice.oneFrame.buf[0]=0x07<<2; + + + ASN_SEQUENCE_ADD(&MBSFNSubframeConfigList->list,sib2_mbsfn_SubframeConfig2); + } + } + +#else // no MBMS transmission + (*sib2)->mbsfn_SubframeConfigList = NULL; +#endif + + (*sib2)->timeAlignmentTimerCommon=TimeAlignmentTimer_infinity;//TimeAlignmentTimer_sf5120; + + /// (*SIB3) +#if defined(Rel10) || defined(Rel14) + (*sib3)->ext1 = NULL; +#if 0 + (*sib3)->s_IntraSearch_v920=NULL; + (*sib3)->s_NonIntraSearch_v920=NULL; + (*sib3)->q_QualMin_r9=NULL; + (*sib3)->threshServingLowQ_r9=NULL; +#endif +#endif + (*sib3)->cellReselectionInfoCommon.q_Hyst=SystemInformationBlockType3__cellReselectionInfoCommon__q_Hyst_dB4; + + (*sib3)->cellReselectionInfoCommon.speedStateReselectionPars=NULL; + + (*sib3)->cellReselectionServingFreqInfo.s_NonIntraSearch=NULL; + (*sib3)->cellReselectionServingFreqInfo.threshServingLow=31; + (*sib3)->cellReselectionServingFreqInfo.cellReselectionPriority=7; + + (*sib3)->intraFreqCellReselectionInfo.q_RxLevMin = -70; + (*sib3)->intraFreqCellReselectionInfo.p_Max = NULL; + (*sib3)->intraFreqCellReselectionInfo.s_IntraSearch = CALLOC(1,sizeof(*(*sib3)->intraFreqCellReselectionInfo.s_IntraSearch)); + *(*sib3)->intraFreqCellReselectionInfo.s_IntraSearch = 31; + (*sib3)->intraFreqCellReselectionInfo.allowedMeasBandwidth=CALLOC(1,sizeof(*(*sib3)->intraFreqCellReselectionInfo.allowedMeasBandwidth)); + + *(*sib3)->intraFreqCellReselectionInfo.allowedMeasBandwidth = AllowedMeasBandwidth_mbw6; + + (*sib3)->intraFreqCellReselectionInfo.presenceAntennaPort1 = 0; + (*sib3)->intraFreqCellReselectionInfo.neighCellConfig.buf = CALLOC(8,1); + (*sib3)->intraFreqCellReselectionInfo.neighCellConfig.size = 1; + (*sib3)->intraFreqCellReselectionInfo.neighCellConfig.buf[0] = 1; + (*sib3)->intraFreqCellReselectionInfo.neighCellConfig.bits_unused = 6; + (*sib3)->intraFreqCellReselectionInfo.t_ReselectionEUTRA = 1; + (*sib3)->intraFreqCellReselectionInfo.t_ReselectionEUTRA_SF = (struct SpeedStateScaleFactors *)NULL; + + // SIB13 + // fill in all elements of SIB13 if present +#if defined(Rel10) || defined(Rel14) + + if (MBMS_flag > 0 ) { + // Notification for mcch change + (*sib13)->notificationConfig_r9.notificationRepetitionCoeff_r9= MBMS_NotificationConfig_r9__notificationRepetitionCoeff_r9_n2; + (*sib13)->notificationConfig_r9.notificationOffset_r9= 0; + (*sib13)->notificationConfig_r9.notificationSF_Index_r9= 1; + + // MBSFN-AreaInfoList + MBSFNArea_list= &(*sib13)->mbsfn_AreaInfoList_r9;//CALLOC(1,sizeof(*MBSFNArea_list)); + memset(MBSFNArea_list,0,sizeof(*MBSFNArea_list)); + // MBSFN Area 1 + MBSFN_Area1= CALLOC(1, sizeof(*MBSFN_Area1)); + MBSFN_Area1->mbsfn_AreaId_r9= 1; + MBSFN_Area1->non_MBSFNregionLength= MBSFN_AreaInfo_r9__non_MBSFNregionLength_s2; + MBSFN_Area1->notificationIndicator_r9= 0; + MBSFN_Area1->mcch_Config_r9.mcch_RepetitionPeriod_r9= MBSFN_AreaInfo_r9__mcch_Config_r9__mcch_RepetitionPeriod_r9_rf32; + MBSFN_Area1->mcch_Config_r9.mcch_Offset_r9= 1; // in accordance with mbsfn subframe configuration in sib2 + MBSFN_Area1->mcch_Config_r9.mcch_ModificationPeriod_r9= MBSFN_AreaInfo_r9__mcch_Config_r9__mcch_ModificationPeriod_r9_rf512; + // Subframe Allocation Info + MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.buf= MALLOC(1); + MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.size= 1; + + MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.buf[0]=0x20<<2; // FDD: SF1 + + + MBSFN_Area1->mcch_Config_r9.sf_AllocInfo_r9.bits_unused= 2; + + MBSFN_Area1->mcch_Config_r9.signallingMCS_r9= MBSFN_AreaInfo_r9__mcch_Config_r9__signallingMCS_r9_n7; + + ASN_SEQUENCE_ADD(&MBSFNArea_list->list,MBSFN_Area1); + + //MBSFN Area 2: currently only activated for eMBMS relaying + if (MBMS_flag == 4 ) { + MBSFN_Area2= CALLOC(1, sizeof(*MBSFN_Area2)); + MBSFN_Area2->mbsfn_AreaId_r9= 2; + MBSFN_Area2->non_MBSFNregionLength= MBSFN_AreaInfo_r9__non_MBSFNregionLength_s2; + MBSFN_Area2->notificationIndicator_r9= 1; + MBSFN_Area2->mcch_Config_r9.mcch_RepetitionPeriod_r9= MBSFN_AreaInfo_r9__mcch_Config_r9__mcch_RepetitionPeriod_r9_rf32; + MBSFN_Area2->mcch_Config_r9.mcch_Offset_r9= 1; + MBSFN_Area2->mcch_Config_r9.mcch_ModificationPeriod_r9= MBSFN_AreaInfo_r9__mcch_Config_r9__mcch_ModificationPeriod_r9_rf512; + // Subframe Allocation Info + MBSFN_Area2->mcch_Config_r9.sf_AllocInfo_r9.buf= MALLOC(1); + MBSFN_Area2->mcch_Config_r9.sf_AllocInfo_r9.size= 1; + MBSFN_Area2->mcch_Config_r9.sf_AllocInfo_r9.bits_unused= 2; + + MBSFN_Area2->mcch_Config_r9.sf_AllocInfo_r9.buf[0]=0x04<<2; // FDD: SF6 + + + MBSFN_Area2->mcch_Config_r9.signallingMCS_r9= MBSFN_AreaInfo_r9__mcch_Config_r9__signallingMCS_r9_n7; + + ASN_SEQUENCE_ADD(&MBSFNArea_list->list,MBSFN_Area2); + } + + // end of adding for MBMS SIB13 + } + +#endif + + bcch_message->message.present = BCCH_DL_SCH_MessageType_PR_c1; + bcch_message->message.choice.c1.present = BCCH_DL_SCH_MessageType__c1_PR_systemInformation; + + /* memcpy((void*)&bcch_message.message.choice.c1.choice.systemInformation, + (void*)systemInformation, + sizeof(SystemInformation_t));*/ + + bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.present = SystemInformation__criticalExtensions_PR_systemInformation_r8; + + bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count=0; + + // asn_set_empty(&systemInformation->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list);//.size=0; + // systemInformation->criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list.count=0; + ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list, + sib2_part); + ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list, + sib3_part); +#if defined(Rel10) || defined(Rel14) + + if (MBMS_flag > 0) { + ASN_SEQUENCE_ADD(&bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.choice.systemInformation_r8.sib_TypeAndInfo.list,sib13_part); + } + +#endif + + +#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, (void*)bcch_message); +#endif + enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_DL_SCH_Message, + (void*)bcch_message, + buffer, + 900); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + + +#if defined(ENABLE_ITTI) +# if !defined(DISABLE_XER_SPRINT) + { + char message_string[15000]; + size_t message_string_size; + + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_BCCH_DL_SCH_Message, (void *)bcch_message)) > 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_BCCH, message_string_size + sizeof (IttiMsgText)); + msg_p->ittiMsg.rrc_dl_bcch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_dl_bcch.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); + } + } +# endif +#endif + +#ifdef USER_MODE + LOG_D(RRC,"[eNB] SystemInformation Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); +#endif + + if (enc_rval.encoded==-1) { + msg("[RRC] ASN1 : SI encoding failed for SIB23\n"); + return(-1); + } + + return((enc_rval.encoded+7)/8); +} + +uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) +{ + + asn_enc_rval_t enc_rval; + uint8_t buf[5],buf2=0; + uint8_t ecause=0; + + UL_CCCH_Message_t ul_ccch_msg; + + RRCConnectionRequest_t *rrcConnectionRequest; + + memset((void *)&ul_ccch_msg,0,sizeof(UL_CCCH_Message_t)); + + ul_ccch_msg.message.present = UL_CCCH_MessageType_PR_c1; + ul_ccch_msg.message.choice.c1.present = UL_CCCH_MessageType__c1_PR_rrcConnectionRequest; + rrcConnectionRequest = &ul_ccch_msg.message.choice.c1.choice.rrcConnectionRequest; + + rrcConnectionRequest->criticalExtensions.present = RRCConnectionRequest__criticalExtensions_PR_rrcConnectionRequest_r8; + + if (1) { + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.present = InitialUE_Identity_PR_randomValue; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.randomValue.size = 5; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.randomValue.bits_unused = 0; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.randomValue.buf = buf; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.randomValue.buf[0] = rv[0]; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.randomValue.buf[1] = rv[1]; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.randomValue.buf[2] = rv[2]; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.randomValue.buf[3] = rv[3]; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.randomValue.buf[4] = rv[4]; + } else { + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.present = InitialUE_Identity_PR_s_TMSI; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.mmec.size = 1; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.mmec.bits_unused = 0; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.mmec.buf = buf; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.mmec.buf[0] = 0x12; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.m_TMSI.size = 4; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.m_TMSI.bits_unused = 0; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.m_TMSI.buf = &buf[1]; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.m_TMSI.buf[0] = 0x34; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.m_TMSI.buf[1] = 0x56; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.m_TMSI.buf[2] = 0x78; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.ue_Identity.choice.s_TMSI.m_TMSI.buf[3] = 0x9a; + } + + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.establishmentCause = EstablishmentCause_mo_Signalling; //EstablishmentCause_mo_Data; + + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.spare.buf = &buf2; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.spare.size=1; + rrcConnectionRequest->criticalExtensions.choice.rrcConnectionRequest_r8.spare.bits_unused = 7; + + + enc_rval = uper_encode_to_buffer(&asn_DEF_UL_CCCH_Message, + (void*)&ul_ccch_msg, + buffer, + 100); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + +#if defined(ENABLE_ITTI) +# if !defined(DISABLE_XER_SPRINT) + { + char message_string[20000]; + size_t message_string_size; + + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_CCCH_Message, (void *) &ul_ccch_msg)) > 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_CCCH, message_string_size + sizeof (IttiMsgText)); + msg_p->ittiMsg.rrc_ul_ccch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_ul_ccch.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, NB_eNB_INST + Mod_id, msg_p); + } + } +# endif +#endif + +#ifdef USER_MODE + LOG_D(RRC,"[UE] RRCConnectionRequest Encoded %zd bits (%zd bytes), ecause %d\n",enc_rval.encoded,(enc_rval.encoded+7)/8,ecause); +#endif + + return((enc_rval.encoded+7)/8); + +} + +uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Transaction_id, const int dedicatedInfoNASLength, const char *dedicatedInfoNAS) +{ + + + asn_enc_rval_t enc_rval; + + UL_DCCH_Message_t ul_dcch_msg; + + RRCConnectionSetupComplete_t *rrcConnectionSetupComplete; + + memset((void *)&ul_dcch_msg,0,sizeof(UL_DCCH_Message_t)); + + ul_dcch_msg.message.present = UL_DCCH_MessageType_PR_c1; + ul_dcch_msg.message.choice.c1.present = UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete; + rrcConnectionSetupComplete = &ul_dcch_msg.message.choice.c1.choice.rrcConnectionSetupComplete; + + rrcConnectionSetupComplete->rrc_TransactionIdentifier = Transaction_id; + rrcConnectionSetupComplete->criticalExtensions.present = RRCConnectionSetupComplete__criticalExtensions_PR_c1; + rrcConnectionSetupComplete->criticalExtensions.choice.c1.present = RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8; + + rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.nonCriticalExtension=CALLOC(1, + sizeof(*rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.nonCriticalExtension)); + + if(usim_test == 0) + rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.selectedPLMN_Identity= 2; + else + rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.selectedPLMN_Identity= 1; + + rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME = + NULL;//calloc(1,sizeof(*rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME)); + /* + rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->plmn_Identity=NULL; + rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmegi.buf = calloc(2,1); + rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmegi.buf[0] = 0x0; + rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmegi.buf[1] = 0x1; + rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmegi.size=2; + rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmegi.bits_unused=0; + */ + memset(&rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.dedicatedInfoNAS,0,sizeof(OCTET_STRING_t)); + OCTET_STRING_fromBuf(&rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.dedicatedInfoNAS, + dedicatedInfoNAS, dedicatedInfoNASLength); + + /* + rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.buf = calloc(1,1); + rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.buf[0] = 0x98; + rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.size=1; + rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.bits_unused=0; + */ + + enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, + (void*)&ul_dcch_msg, + buffer, + 100); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + +#if defined(ENABLE_ITTI) +# if !defined(DISABLE_XER_SPRINT) + { + char message_string[20000]; + size_t message_string_size; + + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText)); + msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, NB_eNB_INST + Mod_id, msg_p); + } + } +# endif +#endif + +#ifdef USER_MODE + LOG_D(RRC,"RRCConnectionSetupComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); +#endif + + return((enc_rval.encoded+7)/8); + +} + +//------------------------------------------------------------------------------ +uint8_t +do_RRCConnectionReconfigurationComplete( + const protocol_ctxt_t* const ctxt_pP, + uint8_t* buffer, + const uint8_t Transaction_id +) +//------------------------------------------------------------------------------ +{ + + + asn_enc_rval_t enc_rval; + + UL_DCCH_Message_t ul_dcch_msg; + + RRCConnectionReconfigurationComplete_t *rrcConnectionReconfigurationComplete; + + memset((void *)&ul_dcch_msg,0,sizeof(UL_DCCH_Message_t)); + + ul_dcch_msg.message.present = UL_DCCH_MessageType_PR_c1; + ul_dcch_msg.message.choice.c1.present = UL_DCCH_MessageType__c1_PR_rrcConnectionReconfigurationComplete; + rrcConnectionReconfigurationComplete = &ul_dcch_msg.message.choice.c1.choice.rrcConnectionReconfigurationComplete; + + rrcConnectionReconfigurationComplete->rrc_TransactionIdentifier = Transaction_id; + rrcConnectionReconfigurationComplete->criticalExtensions.present = + RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8; + rrcConnectionReconfigurationComplete->criticalExtensions.choice.rrcConnectionReconfigurationComplete_r8.nonCriticalExtension=NULL; + + enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, + (void*)&ul_dcch_msg, + buffer, + 100); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + +#if defined(ENABLE_ITTI) +# if !defined(DISABLE_XER_SPRINT) + { + char message_string[20000]; + size_t message_string_size; + + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UL_DCCH, message_string_size + sizeof (IttiMsgText)); + msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); + } + } +# endif +#endif + +#ifdef USER_MODE + LOG_D(RRC,"RRCConnectionReconfigurationComplete Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); +#endif + + return((enc_rval.encoded+7)/8); +} + + +//------------------------------------------------------------------------------ +uint8_t +do_RRCConnectionSetup( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + int CC_id, + uint8_t* const buffer, + const uint8_t transmission_mode, + const uint8_t Transaction_id, + SRB_ToAddModList_t **SRB_configList, + struct PhysicalConfigDedicated **physicalConfigDedicated) +{ + + asn_enc_rval_t enc_rval; + uint8_t ecause=0; + eNB_RRC_INST *rrc = RC.rrc[ctxt_pP->module_id]; + rrc_eNB_carrier_data_t *carrier = &rrc->carrier[CC_id]; + + long* logicalchannelgroup = NULL; + struct SRB_ToAddMod* SRB1_config = NULL; + struct SRB_ToAddMod__rlc_Config* SRB1_rlc_config = NULL; + struct SRB_ToAddMod__logicalChannelConfig* SRB1_lchan_config = NULL; + struct LogicalChannelConfig__ul_SpecificParameters* SRB1_ul_SpecificParameters = NULL; + +#ifdef CBA + struct PUSCH_CBAConfigDedicated_vlola* pusch_CBAConfigDedicated_vlola = NULL; + long* betaOffset_CBA_Index = NULL; + long* cShift_CBA = NULL; +#endif + PhysicalConfigDedicated_t* physicalConfigDedicated2 = NULL; + + DL_CCCH_Message_t dl_ccch_msg; + + RRCConnectionSetup_t* rrcConnectionSetup = NULL; + + memset((void *)&dl_ccch_msg,0,sizeof(DL_CCCH_Message_t)); + dl_ccch_msg.message.present = DL_CCCH_MessageType_PR_c1; + dl_ccch_msg.message.choice.c1.present = DL_CCCH_MessageType__c1_PR_rrcConnectionSetup; + rrcConnectionSetup = &dl_ccch_msg.message.choice.c1.choice.rrcConnectionSetup; + + // RRCConnectionSetup + // Configure SRB1 + + // *SRB_configList = CALLOC(1,sizeof(*SRB_configList)); + if (*SRB_configList) { + free(*SRB_configList); + } + + *SRB_configList = CALLOC(1,sizeof(SRB_ToAddModList_t)); + + /// SRB1 + SRB1_config = CALLOC(1,sizeof(*SRB1_config)); + + SRB1_config->srb_Identity = 1; + SRB1_rlc_config = CALLOC(1,sizeof(*SRB1_rlc_config)); + SRB1_config->rlc_Config = SRB1_rlc_config; + + SRB1_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; + SRB1_rlc_config->choice.explicitValue.present=RLC_Config_PR_am; +#if defined(ENABLE_ITTI) + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = rrc->srb1_timer_poll_retransmit; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = rrc->srb1_poll_pdu; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = rrc->srb1_poll_byte; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = rrc->srb1_max_retx_threshold; + SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = rrc->srb1_timer_reordering; + SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = rrc->srb1_timer_status_prohibit; +#else + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms20;; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p4;; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; + SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; + SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms0; +#endif + + SRB1_lchan_config = CALLOC(1,sizeof(*SRB1_lchan_config)); + SRB1_config->logicalChannelConfig = SRB1_lchan_config; + + SRB1_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; + SRB1_ul_SpecificParameters = CALLOC(1,sizeof(*SRB1_ul_SpecificParameters)); + + SRB1_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB1_ul_SpecificParameters; + + + SRB1_ul_SpecificParameters->priority = 1; + + //assign_enum(&SRB1_ul_SpecificParameters->prioritisedBitRate,LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity); + SRB1_ul_SpecificParameters->prioritisedBitRate=LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + + //assign_enum(&SRB1_ul_SpecificParameters->bucketSizeDuration,LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50); + SRB1_ul_SpecificParameters->bucketSizeDuration=LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + + logicalchannelgroup = CALLOC(1,sizeof(long)); + *logicalchannelgroup=0; + SRB1_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; + + + ASN_SEQUENCE_ADD(&(*SRB_configList)->list,SRB1_config); + + // PhysicalConfigDedicated + + physicalConfigDedicated2 = CALLOC(1,sizeof(*physicalConfigDedicated2)); + *physicalConfigDedicated = physicalConfigDedicated2; + + physicalConfigDedicated2->pdsch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pdsch_ConfigDedicated)); + physicalConfigDedicated2->pucch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pucch_ConfigDedicated)); + physicalConfigDedicated2->pusch_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->pusch_ConfigDedicated)); + physicalConfigDedicated2->uplinkPowerControlDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated)); + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH)); + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH = CALLOC(1,sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH)); + physicalConfigDedicated2->cqi_ReportConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig)); + if (rrc->srs_enable[CC_id]==1) + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); + else + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = NULL; + physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo)); + physicalConfigDedicated2->schedulingRequestConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->schedulingRequestConfig)); + + // PDSCH + //assign_enum(&physicalConfigDedicated2->pdsch_ConfigDedicated->p_a, + // PDSCH_ConfigDedicated__p_a_dB0); + if (carrier->p_eNB==2) + physicalConfigDedicated2->pdsch_ConfigDedicated->p_a= PDSCH_ConfigDedicated__p_a_dB_3; + else + physicalConfigDedicated2->pdsch_ConfigDedicated->p_a= PDSCH_ConfigDedicated__p_a_dB0; + + // PUCCH + physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.present=PUCCH_ConfigDedicated__ackNackRepetition_PR_release; + physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.choice.release=0; + + if (carrier->sib1->tdd_Config == NULL) { + physicalConfigDedicated2->pucch_ConfigDedicated->tdd_AckNackFeedbackMode=NULL;//PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing; + } else { //TDD + physicalConfigDedicated2->pucch_ConfigDedicated->tdd_AckNackFeedbackMode= CALLOC(1,sizeof(long)); + *(physicalConfigDedicated2->pucch_ConfigDedicated->tdd_AckNackFeedbackMode) = + PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_bundling;//PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing; + } + + // Pusch_config_dedicated + physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_ACK_Index = 0; // 2.00 + physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_RI_Index = 0; // 1.25 + physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_CQI_Index = 8; // 2.25 + + // UplinkPowerControlDedicated + physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUSCH = 0; // 0 dB + //assign_enum(&physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled, + // UplinkPowerControlDedicated__deltaMCS_Enabled_en1); + physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled= UplinkPowerControlDedicated__deltaMCS_Enabled_en1; + physicalConfigDedicated2->uplinkPowerControlDedicated->accumulationEnabled = 1; // TRUE + physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUCCH = 0; // 0 dB + physicalConfigDedicated2->uplinkPowerControlDedicated->pSRS_Offset = 0; // 0 dB + physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient = CALLOC(1, + sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient)); + // assign_enum(physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient,FilterCoefficient_fc4); // fc4 dB + *physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient=FilterCoefficient_fc4; // fc4 dB + + // TPC-PDCCH-Config + + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->present=TPC_PDCCH_Config_PR_setup; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.present = TPC_Index_PR_indexOfFormat3; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.choice.indexOfFormat3 = 1; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf=CALLOC(1,2); + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.size=2; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf[0]=0x12; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf[1]=0x34+ue_context_pP->local_uid; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.bits_unused=0; + + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->present=TPC_PDCCH_Config_PR_setup; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.present = TPC_Index_PR_indexOfFormat3; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.choice.indexOfFormat3 = 1; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf=CALLOC(1,2); + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.size=2; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[0]=0x22; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[1]=0x34+ue_context_pP->local_uid; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.bits_unused=0; + + // CQI ReportConfig + + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic)); +#if defined(Rel10) || defined(Rel14) + *physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic= CQI_ReportModeAperiodic_rm30; +#else + *physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic=CQI_ReportConfig__cqi_ReportModeAperiodic_rm30; // HLC CQI, no PMI +#endif + physicalConfigDedicated2->cqi_ReportConfig->nomPDSCH_RS_EPRE_Offset = 0; // 0 dB + //physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic=NULL; + + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic)); + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = CQI_ReportPeriodic_PR_release; + /* + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = CQI_ReportPeriodic_PR_setup; + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex = 0; // n2_pucch + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex = 0; // Icqi/pmi + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present = CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI; // subband CQI + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.choice.subbandCQI.k=4; + + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex=NULL; + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI=0; + */ + + //soundingRS-UL-ConfigDedicated + if (rrc->srs_enable[CC_id]==1) { + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->present = SoundingRS_UL_ConfigDedicated_PR_setup; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth = + SoundingRS_UL_ConfigDedicated__setup__srs_Bandwidth_bw0; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth = + SoundingRS_UL_ConfigDedicated__setup__srs_HoppingBandwidth_hbw0; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition=0; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.duration=1; + if (carrier->sib1->tdd_Config==NULL) { // FDD + if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present + == SoundingRS_UL_ConfigCommon_PR_setup) + if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig!=0) + LOG_W(RRC,"This code has been optimized for SRS Subframe Config 0, but current config is %zd. Expect undefined behaviour!\n", + carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig); + if (ue_context_pP->local_uid >=20) + LOG_W(RRC,"This code has been optimized for up to 10 UEs, but current UE_id is %d. Expect undefined behaviour!\n", + ue_context_pP->local_uid); + //the current code will allow for 20 UEs - to be revised for more + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=7+ue_context_pP->local_uid/2; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb= ue_context_pP->local_uid%2; + } + else { + if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.present + == SoundingRS_UL_ConfigCommon_PR_setup) + if (carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig!=7) { + LOG_W(RRC,"This code has been optimized for SRS Subframe Config 7 and TDD config 3, but current configs are %zd and %zd. Expect undefined behaviour!\n", + carrier->sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon.choice.setup.srs_SubframeConfig, + carrier->sib1->tdd_Config->subframeAssignment); + } + if (ue_context_pP->local_uid >=6) + LOG_W(RRC,"This code has been optimized for up to 6 UEs, but current UE_id is %d. Expect undefined behaviour!\n", + ue_context_pP->local_uid); + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=17+ue_context_pP->local_uid/2; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb= ue_context_pP->local_uid%2; + } + LOG_W(RRC,"local UID %d, srs ConfigIndex %zd, TransmissionComb %zd\n",ue_context_pP->local_uid, + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex, + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb); + + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift= + SoundingRS_UL_ConfigDedicated__setup__cyclicShift_cs0; + } + + + //AntennaInfoDedicated + physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo)); + physicalConfigDedicated2->antennaInfo->present = PhysicalConfigDedicated__antennaInfo_PR_explicitValue; + //assign_enum(&physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode, + // AntennaInfoDedicated__transmissionMode_tm2); + + switch (transmission_mode) { + default: + LOG_W(RRC,"At RRCConnectionSetup Transmission mode can only take values 1 or 2! Defaulting to 1!\n"); + case 1: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm1; + break; + + case 2: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm2; + break; + /* + case 3: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm3; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction= CALLOC(1, + sizeof(*physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction)); + physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1); + physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6; + + break; + + case 4: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm4; + break; + + case 5: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm5; + break; + + case 6: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm6; + break; + + case 7: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm7; + break; + */ + } + + + physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.present = AntennaInfoDedicated__ue_TransmitAntennaSelection_PR_release; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.release = 0; + + // SchedulingRequestConfig + + physicalConfigDedicated2->schedulingRequestConfig->present = SchedulingRequestConfig_PR_setup; + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = 71 - ue_context_pP->local_uid/10;//ue_context_pP->local_uid; + + if (carrier->sib1->tdd_Config == NULL) { // FDD + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 5+(ue_context_pP->local_uid%10); // Isr = 5 (every 10 subframes, offset=2+UE_id mod3) + } else { + switch (carrier->sib1->tdd_Config->subframeAssignment) { + case 1: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+(ue_context_pP->local_uid&1)+(( + ue_context_pP->local_uid&3)>>1)*5; // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 7 for UE2, 8 for UE3 , 2 for UE4 etc..) + break; + + case 3: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+ + (ue_context_pP->local_uid%3); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) + break; + + case 4: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+ + (ue_context_pP->local_uid&1); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) + break; + + default: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7; // Isr = 5 (every 10 subframes, offset=2 for all UE0 etc..) + break; + } + } + + // assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax, + //SchedulingRequestConfig__setup__dsr_TransMax_n4); + // assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = SchedulingRequestConfig__setup__dsr_TransMax_n4; + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = SchedulingRequestConfig__setup__dsr_TransMax_n4; + + rrcConnectionSetup->rrc_TransactionIdentifier = Transaction_id; + rrcConnectionSetup->criticalExtensions.present = RRCConnectionSetup__criticalExtensions_PR_c1; + rrcConnectionSetup->criticalExtensions.choice.c1.present =RRCConnectionSetup__criticalExtensions__c1_PR_rrcConnectionSetup_r8 ; + rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.srb_ToAddModList = *SRB_configList; + rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.drb_ToAddModList = NULL; + rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.drb_ToReleaseList = NULL; + rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.sps_Config = NULL; + rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.physicalConfigDedicated = physicalConfigDedicated2; + rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.mac_MainConfig = NULL; +#ifdef CBA + betaOffset_CBA_Index = CALLOC(1,sizeof(long)); + cShift_CBA = CALLOC(1,sizeof(long)); + *betaOffset_CBA_Index=10; // need to be changed by Kaijie + *cShift_CBA=4; + physicalConfigDedicated2->pusch_CBAConfigDedicated_vlola->betaOffset_CBA_Index=betaOffset_CBA_Index; + physicalConfigDedicated2->pusch_CBAConfigDedicated_vlola->cShift_CBA=cShift_CBA; + rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.sps_CBA_ConfigList_vlola = NULL; +#endif + + +#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg); +#endif + enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message, + (void*)&dl_ccch_msg, + buffer, + 100); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + +#if defined(ENABLE_ITTI) +# if !defined(DISABLE_XER_SPRINT) + { + char message_string[20000]; + size_t message_string_size; + + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message, (void *) &dl_ccch_msg)) > 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText)); + msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); + } + } +# endif +#endif + +#ifdef USER_MODE + LOG_D(RRC,"RRCConnectionSetup Encoded %zd bits (%zd bytes), ecause %d\n", + enc_rval.encoded,(enc_rval.encoded+7)/8,ecause); +#endif + + // FREEMEM(SRB_list); + // free(SRB1_config); + // free(SRB1_rlc_config); + // free(SRB1_lchan_config); + // free(SRB1_ul_SpecificParameters); + + return((enc_rval.encoded+7)/8); +} + +//------------------------------------------------------------------------------ +uint8_t +do_SecurityModeCommand( + const protocol_ctxt_t* const ctxt_pP, + uint8_t* const buffer, + const uint8_t Transaction_id, + const uint8_t cipheringAlgorithm, + const uint8_t integrityProtAlgorithm +) +//------------------------------------------------------------------------------ +{ + DL_DCCH_Message_t dl_dcch_msg; + asn_enc_rval_t enc_rval; + + memset(&dl_dcch_msg,0,sizeof(DL_DCCH_Message_t)); + + dl_dcch_msg.message.present = DL_DCCH_MessageType_PR_c1; + dl_dcch_msg.message.choice.c1.present = DL_DCCH_MessageType__c1_PR_securityModeCommand; + + dl_dcch_msg.message.choice.c1.choice.securityModeCommand.rrc_TransactionIdentifier = Transaction_id; + dl_dcch_msg.message.choice.c1.choice.securityModeCommand.criticalExtensions.present = SecurityModeCommand__criticalExtensions_PR_c1; + + dl_dcch_msg.message.choice.c1.choice.securityModeCommand.criticalExtensions.choice.c1.present = + SecurityModeCommand__criticalExtensions__c1_PR_securityModeCommand_r8; + // the two following information could be based on the mod_id + dl_dcch_msg.message.choice.c1.choice.securityModeCommand.criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.cipheringAlgorithm + = (CipheringAlgorithm_r12_t)cipheringAlgorithm; + dl_dcch_msg.message.choice.c1.choice.securityModeCommand.criticalExtensions.choice.c1.choice.securityModeCommand_r8.securityConfigSMC.securityAlgorithmConfig.integrityProtAlgorithm + = (e_SecurityAlgorithmConfig__integrityProtAlgorithm)integrityProtAlgorithm; + +#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_DL_DCCH_Message, (void*)&dl_dcch_msg); +#endif + enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, + (void*)&dl_dcch_msg, + buffer, + 100); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + +#if defined(ENABLE_ITTI) +# if !defined(DISABLE_XER_SPRINT) + { + char message_string[20000]; + size_t message_string_size; + + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message, (void *) &dl_dcch_msg)) > 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText)); + msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); + } + } +# endif +#endif + +#ifdef USER_MODE + LOG_D(RRC,"[eNB %d] securityModeCommand for UE %x Encoded %zd bits (%zd bytes)\n", + ctxt_pP->module_id, + ctxt_pP->rnti, + enc_rval.encoded, + (enc_rval.encoded+7)/8); +#endif + + if (enc_rval.encoded==-1) { + LOG_E(RRC,"[eNB %d] ASN1 : securityModeCommand encoding failed for UE %x\n", + ctxt_pP->module_id, + ctxt_pP->rnti); + return(-1); + } + + // rrc_ue_process_ueCapabilityEnquiry(0,1000,&dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry,0); + // exit(-1); + return((enc_rval.encoded+7)/8); +} + +//------------------------------------------------------------------------------ +uint8_t +do_UECapabilityEnquiry( + const protocol_ctxt_t* const ctxt_pP, + uint8_t* const buffer, + const uint8_t Transaction_id +) +//------------------------------------------------------------------------------ +{ + + DL_DCCH_Message_t dl_dcch_msg; + + RAT_Type_t rat=RAT_Type_eutra; + asn_enc_rval_t enc_rval; + + memset(&dl_dcch_msg,0,sizeof(DL_DCCH_Message_t)); + + dl_dcch_msg.message.present = DL_DCCH_MessageType_PR_c1; + dl_dcch_msg.message.choice.c1.present = DL_DCCH_MessageType__c1_PR_ueCapabilityEnquiry; + + dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.rrc_TransactionIdentifier = Transaction_id; + + dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.present = UECapabilityEnquiry__criticalExtensions_PR_c1; + dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.present = + UECapabilityEnquiry__criticalExtensions__c1_PR_ueCapabilityEnquiry_r8; + dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list.count=0; + ASN_SEQUENCE_ADD(&dl_dcch_msg.message.choice.c1.choice.ueCapabilityEnquiry.criticalExtensions.choice.c1.choice.ueCapabilityEnquiry_r8.ue_CapabilityRequest.list, + &rat); + +#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_DL_DCCH_Message, (void*)&dl_dcch_msg); +#endif + enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, + (void*)&dl_dcch_msg, + buffer, + 100); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + +#if defined(ENABLE_ITTI) +# if !defined(DISABLE_XER_SPRINT) + { + char message_string[20000]; + size_t message_string_size; + + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message, (void *) &dl_dcch_msg)) > 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText)); + msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); + } + } +# endif +#endif + +#ifdef USER_MODE + LOG_D(RRC,"[eNB %d] UECapabilityRequest for UE %x Encoded %zd bits (%zd bytes)\n", + ctxt_pP->module_id, + ctxt_pP->rnti, + enc_rval.encoded, + (enc_rval.encoded+7)/8); +#endif + + if (enc_rval.encoded==-1) { + LOG_E(RRC,"[eNB %d] ASN1 : UECapabilityRequest encoding failed for UE %x\n", + ctxt_pP->module_id, + ctxt_pP->rnti); + return(-1); + } + + return((enc_rval.encoded+7)/8); +} + +//------------------------------------------------------------------------------ +uint16_t +do_RRCConnectionReconfiguration( + const protocol_ctxt_t* const ctxt_pP, + uint8_t *buffer, + uint8_t Transaction_id, + SRB_ToAddModList_t *SRB_list, + DRB_ToAddModList_t *DRB_list, + DRB_ToReleaseList_t *DRB_list2, + struct SPS_Config *sps_Config, + struct PhysicalConfigDedicated *physicalConfigDedicated, + MeasObjectToAddModList_t *MeasObj_list, + ReportConfigToAddModList_t *ReportConfig_list, + QuantityConfig_t *quantityConfig, + MeasIdToAddModList_t *MeasId_list, + MAC_MainConfig_t *mac_MainConfig, + MeasGapConfig_t *measGapConfig, + MobilityControlInfo_t *mobilityInfo, + struct MeasConfig__speedStatePars *speedStatePars, + RSRP_Range_t *rsrp, + C_RNTI_t *cba_rnti, + struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList + *dedicatedInfoNASList + +#if defined(Rel10) || defined(Rel14) + , SCellToAddMod_r10_t *SCell_config +#endif +) +//------------------------------------------------------------------------------ +{ + + asn_enc_rval_t enc_rval; + + DL_DCCH_Message_t dl_dcch_msg; + RRCConnectionReconfiguration_t *rrcConnectionReconfiguration; + + + memset(&dl_dcch_msg,0,sizeof(DL_DCCH_Message_t)); + + dl_dcch_msg.message.present = DL_DCCH_MessageType_PR_c1; + dl_dcch_msg.message.choice.c1.present = DL_DCCH_MessageType__c1_PR_rrcConnectionReconfiguration; + rrcConnectionReconfiguration = &dl_dcch_msg.message.choice.c1.choice.rrcConnectionReconfiguration; + + // RRCConnectionReconfiguration + rrcConnectionReconfiguration->rrc_TransactionIdentifier = Transaction_id; + rrcConnectionReconfiguration->criticalExtensions.present = RRCConnectionReconfiguration__criticalExtensions_PR_c1; + rrcConnectionReconfiguration->criticalExtensions.choice.c1.present =RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8 ; + + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated = CALLOC(1, + sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated)); + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->srb_ToAddModList = SRB_list; + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToAddModList = DRB_list; + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->drb_ToReleaseList = DRB_list2; + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->sps_Config = sps_Config; + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->physicalConfigDedicated = physicalConfigDedicated; +#ifdef CBA + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->cba_RNTI_vlola= cba_rnti; +#endif + + if (mac_MainConfig!=NULL) { + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig = CALLOC(1, + sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig)); + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig->present + =RadioResourceConfigDedicated__mac_MainConfig_PR_explicitValue; + memcpy(&rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue, + mac_MainConfig, + sizeof(*mac_MainConfig)); + } else { + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig=NULL; + } + + if (MeasId_list != NULL) { + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig = CALLOC(1, + sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig)); + memset((void*)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig, + 0, sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig)); + + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; + + if (quantityConfig!=NULL) { + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig = CALLOC(1, + sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig)); + memcpy((void *)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig, + (void *)quantityConfig, + sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig)); + } else { + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig = NULL; + } + + if(speedStatePars != NULL) { + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->speedStatePars = CALLOC(1, + sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->speedStatePars)); + memcpy((void *)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->speedStatePars, + (void *)speedStatePars,sizeof(*speedStatePars)); + } else { + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->speedStatePars = NULL; + } + + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->s_Measure= rsrp; + } else { + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig = NULL; + } + + if (mobilityInfo !=NULL) { + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo = CALLOC(1, + sizeof(*rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo)); + memcpy((void*)rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo, (void*)mobilityInfo, + sizeof(MobilityControlInfo_t)); + + } else { + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo = NULL; + } + + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.dedicatedInfoNASList = dedicatedInfoNASList; + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.securityConfigHO = NULL; + + enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, + (void*)&dl_dcch_msg, + buffer, + RRC_BUF_SIZE); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %zd)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + +#ifdef XER_PRINT + xer_fprint(stdout,&asn_DEF_DL_DCCH_Message,(void*)&dl_dcch_msg); +#endif + +#if defined(ENABLE_ITTI) +# if !defined(DISABLE_XER_SPRINT) + { + char message_string[30000]; + size_t message_string_size; + + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message, (void *) &dl_dcch_msg)) > 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText)); + msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); + } + } +# endif +#endif + + //#ifdef USER_MODE + LOG_I(RRC,"RRCConnectionReconfiguration Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); + // for (i=0;i<30;i++) + // msg("%x.",buffer[i]); + // msg("\n"); + + //#endif + + return((enc_rval.encoded+7)/8); +} + +//------------------------------------------------------------------------------ +uint8_t +do_RRCConnectionReestablishmentReject( + uint8_t Mod_id, + uint8_t* const buffer) +//------------------------------------------------------------------------------ +{ + + asn_enc_rval_t enc_rval; + + DL_CCCH_Message_t dl_ccch_msg; + RRCConnectionReestablishmentReject_t *rrcConnectionReestablishmentReject; + + memset((void *)&dl_ccch_msg,0,sizeof(DL_CCCH_Message_t)); + dl_ccch_msg.message.present = DL_CCCH_MessageType_PR_c1; + dl_ccch_msg.message.choice.c1.present = DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentReject; + rrcConnectionReestablishmentReject = &dl_ccch_msg.message.choice.c1.choice.rrcConnectionReestablishmentReject; + + // RRCConnectionReestablishmentReject + rrcConnectionReestablishmentReject->criticalExtensions.present = RRCConnectionReestablishmentReject__criticalExtensions_PR_rrcConnectionReestablishmentReject_r8; + +#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg); +#endif + enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message, + (void*)&dl_ccch_msg, + buffer, + 100); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + +#if defined(ENABLE_ITTI) +# if !defined(DISABLE_XER_SPRINT) + { + char message_string[20000]; + size_t message_string_size; + + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message, (void *) &dl_ccch_msg)) > 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText)); + msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); + } + } +# endif +#endif + +#ifdef USER_MODE + LOG_D(RRC,"RRCConnectionReestablishmentReject Encoded %zd bits (%zd bytes)\n", + enc_rval.encoded,(enc_rval.encoded+7)/8); +#endif + + return((enc_rval.encoded+7)/8); +} + +//------------------------------------------------------------------------------ +uint8_t +do_RRCConnectionReject( + uint8_t Mod_id, + uint8_t* const buffer) +//------------------------------------------------------------------------------ +{ + + asn_enc_rval_t enc_rval; + + DL_CCCH_Message_t dl_ccch_msg; + RRCConnectionReject_t *rrcConnectionReject; + + memset((void *)&dl_ccch_msg,0,sizeof(DL_CCCH_Message_t)); + dl_ccch_msg.message.present = DL_CCCH_MessageType_PR_c1; + dl_ccch_msg.message.choice.c1.present = DL_CCCH_MessageType__c1_PR_rrcConnectionReject; + rrcConnectionReject = &dl_ccch_msg.message.choice.c1.choice.rrcConnectionReject; + + // RRCConnectionReject + rrcConnectionReject->criticalExtensions.present = RRCConnectionReject__criticalExtensions_PR_c1; + rrcConnectionReject->criticalExtensions.choice.c1.present = RRCConnectionReject__criticalExtensions__c1_PR_rrcConnectionReject_r8; + /* let's put a wait time of 1s for the moment */ + rrcConnectionReject->criticalExtensions.choice.c1.choice.rrcConnectionReject_r8.waitTime = 1; + +#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg); +#endif + enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message, + (void*)&dl_ccch_msg, + buffer, + 100); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %ld)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + +#if defined(ENABLE_ITTI) +# if !defined(DISABLE_XER_SPRINT) + { + char message_string[20000]; + size_t message_string_size; + + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_CCCH_Message, (void *) &dl_ccch_msg)) > 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_CCCH, message_string_size + sizeof (IttiMsgText)); + msg_p->ittiMsg.rrc_dl_ccch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_dl_ccch.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); + } + } +# endif +#endif + +#ifdef USER_MODE + LOG_D(RRC,"RRCConnectionReject Encoded %zd bits (%zd bytes)\n", + enc_rval.encoded,(enc_rval.encoded+7)/8); +#endif + + return((enc_rval.encoded+7)/8); +} + +uint8_t do_RRCConnectionRelease( + uint8_t Mod_id, + uint8_t *buffer, + uint8_t Transaction_id) +{ + + asn_enc_rval_t enc_rval; + + DL_DCCH_Message_t dl_dcch_msg; + RRCConnectionRelease_t *rrcConnectionRelease; + + + memset(&dl_dcch_msg,0,sizeof(DL_DCCH_Message_t)); + + dl_dcch_msg.message.present = DL_DCCH_MessageType_PR_c1; + dl_dcch_msg.message.choice.c1.present = DL_DCCH_MessageType__c1_PR_rrcConnectionRelease; + rrcConnectionRelease = &dl_dcch_msg.message.choice.c1.choice.rrcConnectionRelease; + + // RRCConnectionRelease + rrcConnectionRelease->rrc_TransactionIdentifier = Transaction_id; + rrcConnectionRelease->criticalExtensions.present = RRCConnectionRelease__criticalExtensions_PR_c1; + rrcConnectionRelease->criticalExtensions.choice.c1.present =RRCConnectionRelease__criticalExtensions__c1_PR_rrcConnectionRelease_r8 ; + + rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.releaseCause = ReleaseCause_other; + rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.redirectedCarrierInfo = NULL; + rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.idleModeMobilityControlInfo = NULL; + + rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.nonCriticalExtension=CALLOC(1, + sizeof(*rrcConnectionRelease->criticalExtensions.choice.c1.choice.rrcConnectionRelease_r8.nonCriticalExtension)); + + enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message, + (void*)&dl_dcch_msg, + buffer, + RRC_BUF_SIZE); + + return((enc_rval.encoded+7)/8); +} + +uint8_t TMGI[5] = {4,3,2,1,0};//TMGI is a string of octet, ref. TS 24.008 fig. 10.5.4a + + +#if defined(Rel10) || defined(Rel14) +uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, + uint8_t sync_area, + uint8_t *buffer, + MCCH_Message_t *mcch_message, + MBSFNAreaConfiguration_r9_t **mbsfnAreaConfiguration) +{ + + asn_enc_rval_t enc_rval; + MBSFN_SubframeConfig_t *mbsfn_SubframeConfig1; + PMCH_Info_r9_t *pmch_Info_1; + MBMS_SessionInfo_r9_t *mbms_Session_1; + // MBMS_SessionInfo_r9_t *mbms_Session_2; + eNB_RRC_INST *rrc = RC.rrc[Mod_id]; + rrc_eNB_carrier_data_t *carrier = &rrc->carrier[0]; + + + memset(mcch_message,0,sizeof(MCCH_Message_t)); + mcch_message->message.present = MCCH_MessageType_PR_c1; + mcch_message->message.choice.c1.present = MCCH_MessageType__c1_PR_mbsfnAreaConfiguration_r9; + *mbsfnAreaConfiguration = &mcch_message->message.choice.c1.choice.mbsfnAreaConfiguration_r9; + + // Common Subframe Allocation (CommonSF-Alloc-r9) + + mbsfn_SubframeConfig1= CALLOC(1,sizeof(*mbsfn_SubframeConfig1)); + memset((void*)mbsfn_SubframeConfig1,0,sizeof(*mbsfn_SubframeConfig1)); + // + mbsfn_SubframeConfig1->radioframeAllocationPeriod= MBSFN_SubframeConfig__radioframeAllocationPeriod_n4; + mbsfn_SubframeConfig1->radioframeAllocationOffset= 1; + mbsfn_SubframeConfig1->subframeAllocation.present= MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame; + mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf= MALLOC(1); + mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.size= 1; + mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.bits_unused= 2; + + // CURRENTLY WE ARE SUPPORITNG ONLY ONE sf ALLOCATION + switch (sync_area) { + case 0: + if (carrier->sib1->tdd_Config != NULL) {// pattern 001110 for TDD + mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x08<<2;// shift 2bits cuz 2last bits are unused. + } else { //111000 + mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x38<<2; + } + + break; + + case 1: + if (carrier->sib1->tdd_Config != NULL) { + mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x08<<2;// shift 2bits cuz 2last bits are unused. + } else { // 000111 + mbsfn_SubframeConfig1->subframeAllocation.choice.oneFrame.buf[0]=0x07<<2; + } + + default : + break; + } + + ASN_SEQUENCE_ADD(&(*mbsfnAreaConfiguration)->commonSF_Alloc_r9.list,mbsfn_SubframeConfig1); + + // commonSF-AllocPeriod-r9 + (*mbsfnAreaConfiguration)->commonSF_AllocPeriod_r9= MBSFNAreaConfiguration_r9__commonSF_AllocPeriod_r9_rf16; + + // PMCHs Information List (PMCH-InfoList-r9) + // PMCH_1 Config + pmch_Info_1 = CALLOC(1,sizeof(PMCH_Info_r9_t)); + memset((void*)pmch_Info_1,0,sizeof(PMCH_Info_r9_t)); + + /* + * take the value of last mbsfn subframe in this CSA period because there is only one PMCH in this mbsfn area + * Note: this has to be set based on the subframeAllocation and CSA + */ + pmch_Info_1->pmch_Config_r9.sf_AllocEnd_r9= 3; + pmch_Info_1->pmch_Config_r9.dataMCS_r9= 7; + pmch_Info_1->pmch_Config_r9.mch_SchedulingPeriod_r9= PMCH_Config_r9__mch_SchedulingPeriod_r9_rf16; + + // MBMSs-SessionInfoList-r9 + // pmch_Info_1->mbms_SessionInfoList_r9 = CALLOC(1,sizeof(struct MBMS_SessionInfoList_r9)); + // Session 1 + mbms_Session_1 = CALLOC(1,sizeof(MBMS_SessionInfo_r9_t)); + memset(mbms_Session_1,0,sizeof(MBMS_SessionInfo_r9_t)); + // TMGI value + mbms_Session_1->tmgi_r9.plmn_Id_r9.present= TMGI_r9__plmn_Id_r9_PR_plmn_Index_r9; + mbms_Session_1->tmgi_r9.plmn_Id_r9.choice.plmn_Index_r9= 1; + // Service ID + memset(&mbms_Session_1->tmgi_r9.serviceId_r9,0,sizeof(OCTET_STRING_t));// need to check + OCTET_STRING_fromBuf(&mbms_Session_1->tmgi_r9.serviceId_r9,(const char*)&TMGI[2],3); + // Session ID is still missing here, it can be used as an rab id or mrb id + mbms_Session_1->sessionId_r9 = CALLOC(1,sizeof(OCTET_STRING_t)); + mbms_Session_1->sessionId_r9->buf= MALLOC(1); + mbms_Session_1->sessionId_r9->size= 1; + mbms_Session_1->sessionId_r9->buf[0]= MTCH; + // Logical Channel ID + mbms_Session_1->logicalChannelIdentity_r9= MTCH; + ASN_SEQUENCE_ADD(&pmch_Info_1->mbms_SessionInfoList_r9.list,mbms_Session_1); + + /* // Session 2 + //mbms_Session_2 = CALLOC(1,sizeof(MBMS_SessionInfo_r9_t)); + memset(mbms_Session_2,0,sizeof(MBMS_SessionInfo_r9_t)); + // TMGI value + mbms_Session_2->tmgi_r9.plmn_Id_r9.present= TMGI_r9__plmn_Id_r9_PR_plmn_Index_r9; + mbms_Session_2->tmgi_r9.plmn_Id_r9.choice.plmn_Index_r9= 1; + // Service ID + memset(&mbms_Session_2->tmgi_r9.serviceId_r9,0,sizeof(OCTET_STRING_t));// need to check + OCTET_STRING_fromBuf(&mbms_Session_2->tmgi_r9.serviceId_r9,(const char*)&TMGI[3],3); + // Session ID is still missing here + mbms_Session_2->sessionID_r9->buf= MALLOC(1); + mbms_Session_2->sessionID_r9->size= 1; + mbms_Session_2->sessionID_r9->buf[0]= 0x11; + // Logical Channel ID + mbms_Session_2->logicalChannelIdentity_r9= 2; + ASN_SEQUENCE_ADD(&pmch_Info_1->mbms_SessionInfoList_r9.list,mbms_Session_2); + */ + ASN_SEQUENCE_ADD(&(*mbsfnAreaConfiguration)->pmch_InfoList_r9.list,pmch_Info_1); + +#ifdef XER_PRINT + xer_fprint(stdout,&asn_DEF_MCCH_Message,(void*)mcch_message); +#endif + enc_rval = uper_encode_to_buffer(&asn_DEF_MCCH_Message, + (void*)mcch_message, + buffer, + 100); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + +#if defined(ENABLE_ITTI) +# if !defined(DISABLE_XER_SPRINT) + { + char message_string[20000]; + size_t message_string_size; + + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_MCCH_Message, (void *) &mcch_message)) > 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_MCCH, message_string_size); + msg_p->ittiMsg.rrc_dl_mcch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_dl_mcch.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); + } + } +# endif +#endif + +#ifdef USER_MODE + LOG_D(RRC,"[eNB] MCCH Message Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); +#endif + + if (enc_rval.encoded==-1) { + msg("[RRC] ASN1 : MCCH encoding failed for MBSFNAreaConfiguration\n"); + return(-1); + } + + return((enc_rval.encoded+7)/8); +} +#endif + +uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_id,long rsrp_s,long rsrq_s,long rsrp_t,long rsrq_t) +{ + + asn_enc_rval_t enc_rval; + + UL_DCCH_Message_t ul_dcch_msg; + + MeasurementReport_t *measurementReport; + + ul_dcch_msg.message.present = UL_DCCH_MessageType_PR_c1; + ul_dcch_msg.message.choice.c1.present = UL_DCCH_MessageType__c1_PR_measurementReport; + measurementReport = &ul_dcch_msg.message.choice.c1.choice.measurementReport; + + measurementReport->criticalExtensions.present=MeasurementReport__criticalExtensions_PR_c1; + measurementReport->criticalExtensions.choice.c1.present=MeasurementReport__criticalExtensions__c1_PR_measurementReport_r8; + measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.nonCriticalExtension=CALLOC(1, + sizeof(*measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.nonCriticalExtension)); + + measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measId=measid; +#if defined(Rel10) || defined(Rel14) + measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultPCell.rsrpResult=rsrp_s; + measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultPCell.rsrqResult=rsrq_s; +#else + measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultServCell.rsrpResult=rsrp_s; + measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultServCell.rsrqResult=rsrq_s; +#endif + measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells=CALLOC(1, + sizeof(*measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells)); + measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->present=MeasResults__measResultNeighCells_PR_measResultListEUTRA; + + MeasResultListEUTRA_t *measResultListEUTRA2; + measResultListEUTRA2 = CALLOC(1,sizeof(*measResultListEUTRA2)); + + struct MeasResultEUTRA *measresulteutra2; + measresulteutra2 = CALLOC(1,sizeof(*measresulteutra2)); + measresulteutra2->physCellId=phy_id;//1; + + struct MeasResultEUTRA__cgi_Info *measresult_cgi2; + measresult_cgi2 = CALLOC(1,sizeof(*measresult_cgi2)); + + memset(&measresult_cgi2->cellGlobalId.plmn_Identity,0,sizeof(measresult_cgi2->cellGlobalId.plmn_Identity)); + + // measresult_cgi2->cellGlobalId.plmn_Identity.mcc=CALLOC(1,sizeof(measresult_cgi2->cellGlobalId.plmn_Identity.mcc)); + measresult_cgi2->cellGlobalId.plmn_Identity.mcc = CALLOC(1, sizeof(*measresult_cgi2->cellGlobalId.plmn_Identity.mcc)); + + asn_set_empty(&measresult_cgi2->cellGlobalId.plmn_Identity.mcc->list);//.size=0; + + MCC_MNC_Digit_t dummy; + dummy=2; + ASN_SEQUENCE_ADD(&measresult_cgi2->cellGlobalId.plmn_Identity.mcc->list,&dummy); + dummy=6; + ASN_SEQUENCE_ADD(&measresult_cgi2->cellGlobalId.plmn_Identity.mcc->list,&dummy); + dummy=2; + ASN_SEQUENCE_ADD(&measresult_cgi2->cellGlobalId.plmn_Identity.mcc->list,&dummy); + + measresult_cgi2->cellGlobalId.plmn_Identity.mnc.list.size=0; + measresult_cgi2->cellGlobalId.plmn_Identity.mnc.list.count=0; + dummy=8; + ASN_SEQUENCE_ADD(&measresult_cgi2->cellGlobalId.plmn_Identity.mnc.list,&dummy); + dummy=0; + ASN_SEQUENCE_ADD(&measresult_cgi2->cellGlobalId.plmn_Identity.mnc.list,&dummy); + + measresult_cgi2->cellGlobalId.cellIdentity.buf=MALLOC(8); + measresult_cgi2->cellGlobalId.cellIdentity.buf[0]=0x01; + measresult_cgi2->cellGlobalId.cellIdentity.buf[1]=0x48; + measresult_cgi2->cellGlobalId.cellIdentity.buf[2]=0x0f; + measresult_cgi2->cellGlobalId.cellIdentity.buf[3]=0x03; + measresult_cgi2->cellGlobalId.cellIdentity.size=4; + measresult_cgi2->cellGlobalId.cellIdentity.bits_unused=4; + + measresult_cgi2->trackingAreaCode.buf = MALLOC(2); + measresult_cgi2->trackingAreaCode.buf[0]=0x00; + measresult_cgi2->trackingAreaCode.buf[1]=0x10; + measresult_cgi2->trackingAreaCode.size=2; + measresult_cgi2->trackingAreaCode.bits_unused=0; + + + measresulteutra2->cgi_Info=measresult_cgi2; + + struct MeasResultEUTRA__measResult meas2; + // int rsrp_va=10; + + meas2.rsrpResult=&(rsrp_t); + //&rsrp_va; + meas2.rsrqResult=&(rsrq_t); + + measresulteutra2->measResult=meas2; + + ASN_SEQUENCE_ADD(&measResultListEUTRA2->list,measresulteutra2); + + measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->choice.measResultListEUTRA=*(measResultListEUTRA2); + + enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, + (void*)&ul_dcch_msg, + buffer, + 100); + + + + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + +#if defined(ENABLE_ITTI) +# if !defined(DISABLE_XER_SPRINT) + { + char message_string[20000]; + size_t message_string_size; + + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *) &ul_dcch_msg)) > 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText)); + msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, NB_eNB_INST + Mod_id, msg_p); + } + } +# endif +#endif + +#ifdef USER_MODE + printf("Measurement Report Encoded %zu bits (%zu bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); +#endif + + return((enc_rval.encoded+7)/8); +} + +uint8_t do_DLInformationTransfer(uint8_t Mod_id, uint8_t **buffer, uint8_t transaction_id, uint32_t pdu_length, uint8_t *pdu_buffer) +{ + ssize_t encoded; + + DL_DCCH_Message_t dl_dcch_msg; + + memset(&dl_dcch_msg, 0, sizeof(DL_DCCH_Message_t)); + + dl_dcch_msg.message.present = DL_DCCH_MessageType_PR_c1; + dl_dcch_msg.message.choice.c1.present = DL_DCCH_MessageType__c1_PR_dlInformationTransfer; + dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.rrc_TransactionIdentifier = transaction_id; + dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.criticalExtensions.present = DLInformationTransfer__criticalExtensions_PR_c1; + dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.criticalExtensions.choice.c1.present = DLInformationTransfer__criticalExtensions__c1_PR_dlInformationTransfer_r8; + dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType.present = + DLInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS; + dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType.choice.dedicatedInfoNAS.size = pdu_length; + dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType.choice.dedicatedInfoNAS.buf = pdu_buffer; + + encoded = uper_encode_to_new_buffer (&asn_DEF_DL_DCCH_Message, NULL, (void*) &dl_dcch_msg, (void **) buffer); + + /* +#if defined(ENABLE_ITTI) +# if !defined(DISABLE_XER_SPRINT) + { + char message_string[10000]; + size_t message_string_size; + + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message, (void *)&dl_dcch_msg)) > 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText)); + msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); + } + } +# endif +#endif + */ + + return encoded; +} + +uint8_t do_ULInformationTransfer(uint8_t **buffer, uint32_t pdu_length, uint8_t *pdu_buffer) +{ + ssize_t encoded; + + UL_DCCH_Message_t ul_dcch_msg; + + memset(&ul_dcch_msg, 0, sizeof(UL_DCCH_Message_t)); + + ul_dcch_msg.message.present = UL_DCCH_MessageType_PR_c1; + ul_dcch_msg.message.choice.c1.present = UL_DCCH_MessageType__c1_PR_ulInformationTransfer; + ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.present = ULInformationTransfer__criticalExtensions_PR_c1; + ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.choice.c1.present = DLInformationTransfer__criticalExtensions__c1_PR_dlInformationTransfer_r8; + ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType.present = + ULInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS; + ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType.choice.dedicatedInfoNAS.size = pdu_length; + ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType.choice.dedicatedInfoNAS.buf = pdu_buffer; + + encoded = uper_encode_to_new_buffer (&asn_DEF_UL_DCCH_Message, NULL, (void*) &ul_dcch_msg, (void **) buffer); + + return encoded; +} + +OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) +{ + static OAI_UECapability_t UECapability; /* TODO declared static to allow returning this has an address should be allocated in a cleaner way. */ + static SupportedBandEUTRA_t Bandlist[4]; // the macro ASN_SEQUENCE_ADD() does not copy the source, but only stores a reference to it + static InterFreqBandInfo_t InterFreqBandInfo[4][4]; // the macro ASN_SEQUENCE_ADD() does not copy the source, but only stores a reference to it + static BandInfoEUTRA_t BandInfoEUTRA[4]; // the macro ASN_SEQUENCE_ADD() does not copy the source, but only stores a reference to it + + asn_enc_rval_t enc_rval; + asn_dec_rval_t dec_rval; + + long maxNumberROHC_ContextSessions = PDCP_Parameters__maxNumberROHC_ContextSessions_cs16; + int i; + + UE_EUTRA_Capability_t *UE_EUTRA_Capability; + char UE_EUTRA_Capability_xer[8192]; + size_t size; + + LOG_I(RRC,"Allocating %zu bytes for UE_EUTRA_Capability\n",sizeof(*UE_EUTRA_Capability)); + + UE_EUTRA_Capability = CALLOC(1, sizeof(*UE_EUTRA_Capability)); + + assert(UE_EUTRA_Capability); + + if (!UE_EUTRA_Capability_xer_fname) { + Bandlist[0].bandEUTRA = 3; // UL 1710-1785, DL 1805-1880 FDD + Bandlist[0].halfDuplex = 0; + Bandlist[1].bandEUTRA = 20; // UL 824-849 , DL 869-894 FDD + Bandlist[1].halfDuplex = 0; + Bandlist[2].bandEUTRA = 7; // UL 2500-2570, DL 2620-2690 FDD + Bandlist[2].halfDuplex = 0; + Bandlist[3].bandEUTRA = 38; // UL/DL 2570-2620, TDD + Bandlist[3].halfDuplex = 0; + + memset((void*)InterFreqBandInfo, 0, sizeof(InterFreqBandInfo)); + memset((void*)BandInfoEUTRA, 0, sizeof(BandInfoEUTRA)); + + InterFreqBandInfo[0][0].interFreqNeedForGaps = 0; + InterFreqBandInfo[0][1].interFreqNeedForGaps = 1; + InterFreqBandInfo[0][2].interFreqNeedForGaps = 1; + InterFreqBandInfo[0][3].interFreqNeedForGaps = 1; + InterFreqBandInfo[1][0].interFreqNeedForGaps = 1; + InterFreqBandInfo[1][1].interFreqNeedForGaps = 0; + InterFreqBandInfo[1][2].interFreqNeedForGaps = 1; + InterFreqBandInfo[1][3].interFreqNeedForGaps = 1; + InterFreqBandInfo[2][0].interFreqNeedForGaps = 1; + InterFreqBandInfo[2][1].interFreqNeedForGaps = 1; + InterFreqBandInfo[2][2].interFreqNeedForGaps = 0; + InterFreqBandInfo[2][3].interFreqNeedForGaps = 1; + InterFreqBandInfo[3][0].interFreqNeedForGaps = 1; + InterFreqBandInfo[3][1].interFreqNeedForGaps = 1; + InterFreqBandInfo[3][2].interFreqNeedForGaps = 1; + InterFreqBandInfo[3][3].interFreqNeedForGaps = 0; + + + UE_EUTRA_Capability->accessStratumRelease = 0;//AccessStratumRelease_rel8; + UE_EUTRA_Capability->ue_Category = 4; + UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0001=0; + UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0002=0; + UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0003=0; + UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0004=0; + UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0006=0; + UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0101=0; + UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0102=0; + UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0103=0; + UE_EUTRA_Capability->pdcp_Parameters.supportedROHC_Profiles.profile0x0104=0; + + UE_EUTRA_Capability->pdcp_Parameters.maxNumberROHC_ContextSessions = &maxNumberROHC_ContextSessions; + + UE_EUTRA_Capability->phyLayerParameters.ue_TxAntennaSelectionSupported = 0; + UE_EUTRA_Capability->phyLayerParameters.ue_SpecificRefSigsSupported = 0; + UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list.count = 0; + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void*)&Bandlist[0]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void*)&Bandlist[1]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void*)&Bandlist[2]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->rf_Parameters.supportedBandListEUTRA.list,(void*)&Bandlist[3]); + + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void*)&BandInfoEUTRA[0]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void*)&BandInfoEUTRA[1]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void*)&BandInfoEUTRA[2]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list,(void*)&BandInfoEUTRA[3]); + + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void*)&InterFreqBandInfo[0][0]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void*)&InterFreqBandInfo[0][1]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void*)&InterFreqBandInfo[0][2]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[0]->interFreqBandList.list,(void*)&InterFreqBandInfo[0][3]); + + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void*)&InterFreqBandInfo[1][0]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void*)&InterFreqBandInfo[1][1]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void*)&InterFreqBandInfo[1][2]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[1]->interFreqBandList.list,(void*)&InterFreqBandInfo[1][3]); + + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void*)&InterFreqBandInfo[2][0]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void*)&InterFreqBandInfo[2][1]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void*)&InterFreqBandInfo[2][2]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[2]->interFreqBandList.list,(void*)&InterFreqBandInfo[2][3]); + + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void*)&InterFreqBandInfo[3][0]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void*)&InterFreqBandInfo[3][1]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void*)&InterFreqBandInfo[3][2]); + ASN_SEQUENCE_ADD(&UE_EUTRA_Capability->measParameters.bandListEUTRA.list.array[3]->interFreqBandList.list,(void*)&InterFreqBandInfo[3][3]); + + // UE_EUTRA_Capability->measParameters.bandListEUTRA.list.count = 0; // no measurements on other bands + // UE_EUTRA_Capability->featureGroupIndicators // null + + if(usim_test == 1) + { + // featureGroup is mandatory for CMW tests + // featureGroup is filled only for usim-test mode + BIT_STRING_t *bit_string = CALLOC(1, sizeof(*bit_string)); + char featrG[4] = { 0x00, 0x08, 0x00, 0x04 }; + bit_string->buf = CALLOC(1, 4); + memcpy(bit_string->buf, featrG, 4); + bit_string->size = 4; + bit_string->bits_unused = 0; + UE_EUTRA_Capability->featureGroupIndicators = bit_string; + } + + // UE_EUTRA_Capability->interRAT_Parameters // null + } else { + + FILE* f = fopen(UE_EUTRA_Capability_xer_fname, "r"); + assert(f); + size = fread(UE_EUTRA_Capability_xer, 1, sizeof UE_EUTRA_Capability_xer, f); + fclose(f); + + if (size == 0 || size == sizeof UE_EUTRA_Capability_xer) { + LOG_E(RRC,"UE Capabilities XER file %s is too large\n", UE_EUTRA_Capability_xer_fname); + free( UE_EUTRA_Capability); + return(NULL); + } + + dec_rval = xer_decode(0, &asn_DEF_UE_EUTRA_Capability, (void*)UE_EUTRA_Capability, UE_EUTRA_Capability_xer, size); + assert(dec_rval.code == RC_OK); + } + + UECapability.UE_EUTRA_Capability = UE_EUTRA_Capability; +#ifdef XER_PRINT + xer_fprint(stdout,&asn_DEF_UE_EUTRA_Capability,(void *)UE_EUTRA_Capability); +#endif + enc_rval = uper_encode_to_buffer(&asn_DEF_UE_EUTRA_Capability, + (void*)UE_EUTRA_Capability, + &UECapability.sdu[0], + MAX_UE_CAPABILITY_SIZE); + AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", + enc_rval.failed_type->name, enc_rval.encoded); + +#if defined(ENABLE_ITTI) +# if defined(DISABLE_XER_SPRINT) + { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message (TASK_RRC_UE, RRC_UE_EUTRA_CAPABILITY); + memcpy (&msg_p->ittiMsg, (void *) UE_EUTRA_Capability, sizeof(RrcUeEutraCapability)); + + itti_send_msg_to_task (TASK_UNKNOWN, NB_eNB_INST, msg_p); + } +# else + { + char message_string[10000]; + size_t message_string_size; + + if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_UE_EUTRA_Capability, (void *)UE_EUTRA_Capability)) > 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized (TASK_RRC_UE, RRC_UE_EUTRA_CAPABILITY, message_string_size + sizeof (IttiMsgText)); + msg_p->ittiMsg.rrc_ue_eutra_capability.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_ue_eutra_capability.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, msg_p); + } + } +# endif +#endif + + UECapability.sdu_size = (enc_rval.encoded + 7) / 8; + LOG_I(PHY, "[RRC]UE Capability encoded, %d bytes (%zd bits)\n", + UECapability.sdu_size, enc_rval.encoded + 7); + { + char *sdu; + sdu = malloc (3 * UECapability.sdu_size + 1 /* For '\0' */); + + for (i = 0; i < UECapability.sdu_size; i++) { + sprintf (&sdu[3 * i], "%02x.", UECapability.sdu[i]); + } + + LOG_D(PHY, "[RRC]UE Capability encoded, %s\n", sdu); + free(sdu); + } + + return(&UECapability); +} + diff --git a/openair2/RRC/NR/defs_NR.h b/openair2/RRC/NR/defs_NR.h new file mode 100644 index 0000000000..88d2510fb6 --- /dev/null +++ b/openair2/RRC/NR/defs_NR.h @@ -0,0 +1,616 @@ +/* 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 + */ + +/*! \file RRC/LITE/defs_NR.h +* \brief NR RRC struct definitions and function prototypes +* \author Navid Nikaein, Raymond Knopp and WEI-TAI CHEN +* \date 2010 - 2014, 2018 +* \version 1.0 +* \company Eurecom +* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr, kroempa@gmail.com.tw +*/ + +#ifndef __OPENAIR_RRC_DEFS_NR_H__ +#define __OPENAIR_RRC_DEFS_NR_H__ + + +#include +#include +#include + +#include "collection/tree.h" +#include "rrc_types_NR.h" +#include "COMMON/platform_constants.h" +#include "COMMON/platform_types.h" + +//#include "COMMON/mac_rrc_primitives.h" +#if defined(Rel15) +#include "SIB1.h" +//#include "SystemInformation.h" +//#include "RRCConnectionReconfiguration.h" +//#include "RRCConnectionReconfigurationComplete.h" +//#include "RRCConnectionSetup.h" +//#include "RRCConnectionSetupComplete.h" +//#include "RRCConnectionRequest.h" +//#include "RRCConnectionReestablishmentRequest.h" +//#include "BCCH-DL-SCH-Message.h" +#include "BCCH-BCH-Message.h" +//#include "MCCH-Message.h" +//#include "MBSFNAreaConfiguration-r9.h" +//#include "SCellToAddMod-r10.h" +//#include "AS-Config.h" +//#include "AS-Context.h" +#include "UE-NR-Capability.h" +#include "MeasResults.h" +#endif +//------------------- + +#if defined(ENABLE_ITTI) +# include "intertask_interface.h" +#endif + +/* TODO: be sure this include is correct. + * It solves a problem of compilation of the RRH GW, + * issue #186. + */ +#if !defined(ENABLE_ITTI) +# include "as_message.h" +#endif + +#if defined(ENABLE_USE_MME) +# include "commonDef.h" +#endif + +#if ENABLE_RAL +# include "collection/hashtable/obj_hashtable.h" +#endif + + + +/*I will change the name of the structure for compile purposes--> hope not to undo this process*/ + +typedef unsigned int uid_NR_t; +#define UID_LINEAR_ALLOCATOR_BITMAP_SIZE_NR (((NUMBER_OF_UE_MAX_NR/8)/sizeof(unsigned int)) + 1) + +typedef struct uid_linear_allocator_NR_s { + unsigned int bitmap[UID_LINEAR_ALLOCATOR_BITMAP_SIZE_NR]; +} uid_allocator_NR_t; + + +#define PROTOCOL_RRC_CTXT_UE_FMT PROTOCOL_CTXT_FMT +#define PROTOCOL_RRC_CTXT_UE_ARGS(CTXT_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp) + +#define PROTOCOL_RRC_CTXT_FMT PROTOCOL_CTXT_FMT +#define PROTOCOL_RRC_CTXT_ARGS(CTXT_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp) + + +#define UE_MODULE_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!! +#define UE_INDEX_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!! used to be -1 + +typedef enum { + RRC_OK=0, + RRC_ConnSetup_failed, + RRC_PHY_RESYNCH, + RRC_Handover_failed, + RRC_HO_STARTED +} RRC_status_NR_t; + +typedef enum UE_STATE_NR_e { + RRC_INACTIVE=0, + RRC_IDLE, + RRC_SI_RECEIVED, + RRC_CONNECTED, + RRC_RECONFIGURED, + RRC_HO_EXECUTION +} UE_STATE_NR_t; + +typedef enum HO_STATE_NR_e { + HO_IDLE=0, + HO_MEASURMENT, + HO_PREPARE, + HO_CMD, // initiated by the src eNB + HO_COMPLETE // initiated by the target eNB +} HO_STATE_NR_t; + +//#define NUMBER_OF_UE_MAX MAX_MOBILES_PER_RG +#define RRM_FREE(p) if ( (p) != NULL) { free(p) ; p=NULL ; } +#define RRM_MALLOC(t,n) (t *) malloc16( sizeof(t) * n ) +#define RRM_CALLOC(t,n) (t *) malloc16( sizeof(t) * n) +#define RRM_CALLOC2(t,s) (t *) malloc16( s ) + +#define MAX_MEAS_OBJ 6 +#define MAX_MEAS_CONFIG 6 +#define MAX_MEAS_ID 6 + +#define PAYLOAD_SIZE_MAX 1024 +#define RRC_BUF_SIZE 255 +#define UNDEF_SECURITY_MODE 0xff +#define NO_SECURITY_MODE 0x20 + +/* TS 36.331: RRC-TransactionIdentifier ::= INTEGER (0..3) */ +#define RRC_TRANSACTION_IDENTIFIER_NUMBER 3 + +typedef struct { + unsigned short transport_block_size; /*!< \brief Minimum PDU size in bytes provided by RLC to MAC layer interface */ + unsigned short max_transport_blocks; /*!< \brief Maximum PDU size in bytes provided by RLC to MAC layer interface */ + unsigned long Guaranteed_bit_rate; /*!< \brief Guaranteed Bit Rate (average) to be offered by MAC layer scheduling*/ + unsigned long Max_bit_rate; /*!< \brief Maximum Bit Rate that can be offered by MAC layer scheduling*/ + uint8_t Delay_class; /*!< \brief Delay class offered by MAC layer scheduling*/ + uint8_t Target_bler; /*!< \brief Target Average Transport Block Error rate*/ + uint8_t Lchan_t; /*!< \brief Logical Channel Type (BCCH,CCCH,DCCH,DTCH_B,DTCH,MRBCH)*/ +} __attribute__ ((__packed__)) LCHAN_DESC_NR; + +typedef struct UE_RRC_INFO_NR_s { + UE_STATE_NR_t State; + uint8_t SIB1systemInfoValueTag; + uint32_t SIStatus; + uint32_t SIcnt; +#if defined(Rel10) || defined(Rel14) + uint8_t MCCHStatus[8]; // MAX_MBSFN_AREA +#endif + uint8_t SIwindowsize; //!< Corresponds to the SIB1 si-WindowLength parameter. The unit is ms. Possible values are (final): 1,2,5,10,15,20,40 + uint8_t handoverTarget; + //HO_STATE_t ho_state; + uint16_t SIperiod; //!< Corresponds to the SIB1 si-Periodicity parameter (multiplied by 10). Possible values are (final): 80,160,320,640,1280,2560,5120 + unsigned short UE_index; + uint32_t T300_active; + uint32_t T300_cnt; + uint32_t T304_active; + uint32_t T304_cnt; + uint32_t T310_active; + uint32_t T310_cnt; + uint32_t N310_cnt; + uint32_t N311_cnt; + rnti_t rnti; +} __attribute__ ((__packed__)) UE_RRC_INFO_NR; + +typedef struct UE_S_TMSI_NR_s { + boolean_t presence; + mme_code_t mme_code; + m_tmsi_t m_tmsi; +} __attribute__ ((__packed__)) UE_S_TMSI_NR; + + +typedef enum e_rab_satus_NR_e { + E_RAB_STATUS_NEW_NR, + E_RAB_STATUS_DONE_NR, // from the eNB perspective + E_RAB_STATUS_ESTABLISHED_NR, // get the reconfigurationcomplete form UE + E_RAB_STATUS_FAILED_NR, +} e_rab_status_NR_t; + +typedef struct e_rab_param_NR_s { + e_rab_t param; + uint8_t status; + uint8_t xid; // transaction_id +} __attribute__ ((__packed__)) e_rab_param_NR_t; + + +typedef struct HANDOVER_INFO_NR_s { + uint8_t ho_prepare; + uint8_t ho_complete; + uint8_t modid_s; //module_idP of serving cell + uint8_t modid_t; //module_idP of target cell + uint8_t ueid_s; //UE index in serving cell + uint8_t ueid_t; //UE index in target cell + + // NR not define at this moment + //AS_Config_t as_config; /* these two parameters are taken from 36.331 section 10.2.2: HandoverPreparationInformation-r8-IEs */ + //AS_Context_t as_context; /* They are mandatory for HO */ + + uint8_t buf[RRC_BUF_SIZE]; /* ASN.1 encoded handoverCommandMessage */ + int size; /* size of above message in bytes */ +} HANDOVER_INFO_NR; + + +#define RRC_HEADER_SIZE_MAX 64 +#define RRC_BUFFER_SIZE_MAX 1024 + +typedef struct { + char Payload[RRC_BUFFER_SIZE_MAX]; + char Header[RRC_HEADER_SIZE_MAX]; + char payload_size; +} RRC_BUFFER_NR; + +#define RRC_BUFFER_SIZE_NR sizeof(RRC_BUFFER_NR) + + +typedef struct RB_INFO_NR_s { + uint16_t Rb_id; //=Lchan_id + LCHAN_DESC Lchan_desc[2]; + //MAC_MEAS_REQ_ENTRY *Meas_entry; //may not needed for NB-IoT +} RB_INFO_NR; + +typedef struct SRB_INFO_NR_s { + uint16_t Srb_id; //=Lchan_id + RRC_BUFFER Rx_buffer; + RRC_BUFFER Tx_buffer; + LCHAN_DESC Lchan_desc[2]; + unsigned int Trans_id; + uint8_t Active; +} SRB_INFO_NR; + + +typedef struct RB_INFO_TABLE_ENTRY_NR_s { + RB_INFO_NR Rb_info; + uint8_t Active; + uint32_t Next_check_frame; + uint8_t Status; +} RB_INFO_TABLE_ENTRY_NR; + +typedef struct SRB_INFO_TABLE_ENTRY_NR_s { + SRB_INFO_NR Srb_info; + uint8_t Active; + uint8_t Status; + uint32_t Next_check_frame; +} SRB_INFO_TABLE_ENTRY_NR; + +typedef struct MEAS_REPORT_LIST_NR_s { + MeasId_t measId; + //CellsTriggeredList cellsTriggeredList;//OPTIONAL + uint32_t numberOfReportsSent; +} MEAS_REPORT_LIST_NR; + +typedef struct HANDOVER_INFO_UE_NR_s { + PhysCellId_t targetCellId; + uint8_t measFlag; +} HANDOVER_INFO_UE_NR; + +//NB-IoT eNB_RRC_UE_NB_IoT_s--(used as a context in eNB --> ue_context in rrc_eNB_ue_context)------ +typedef struct gNB_RRC_UE_s { + + uint8_t primaryCC_id; + + //SCellToAddMod_t sCell_config[2]; + + SRB_ToAddModList_t* SRB_configList;//for SRB1 and SRB1bis + SRB_ToAddModList_t* SRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER]; + DRB_ToAddModList_t* DRB_configList; //for all the DRBs + DRB_ToAddModList_t* DRB_configList2[RRC_TRANSACTION_IDENTIFIER_NUMBER]; //for the configured DRBs of a xid + uint8_t DRB_active[8];//in LTE was 8 + + // NR not define at this moment + //struct PhysicalConfigDedicated* physicalConfigDedicated_NR; + + struct SPS_Config* sps_Config; + MeasObjectToAddMod_t* MeasObj[MAX_MEAS_OBJ]; + struct ReportConfigToAddMod* ReportConfig[MAX_MEAS_CONFIG]; + struct QuantityConfig* QuantityConfig; + struct MeasIdToAddMod* MeasId[MAX_MEAS_ID]; + + // NR not define at this moment + //MAC_MainConfig_t* mac_MainConfig_NR; + + MeasGapConfig_t* measGapConfig; + + SRB_INFO_NR SI; + SRB_INFO_NR Srb0; + SRB_INFO_TABLE_ENTRY_NR Srb1; + SRB_INFO_TABLE_ENTRY_NR Srb2; + + MeasConfig_t* measConfig; + HANDOVER_INFO_NR* handover_info; + + +#if defined(ENABLE_SECURITY) + /* KeNB as derived from KASME received from EPC */ + uint8_t kenb[32]; +#endif + + /* Used integrity/ciphering algorithms */ + //Specs. TS 38.331 V15.1.0 pag 432 Change position of chipering enumerative w.r.t previous version + e_CipheringAlgorithm ciphering_algorithm; + e_IntegrityProtAlgorithm integrity_algorithm; + + uint8_t Status; + rnti_t rnti; + uint64_t random_ue_identity; + + + + /* Information from UE RRC ConnectionRequest */ + UE_S_TMSI_NR Initialue_identity_s_TMSI; + + /* NR not define at this moment + EstablishmentCause_t establishment_cause_NR; //different set for NB-IoT + + /* NR not define at this moment + /* Information from UE RRC ConnectionReestablishmentRequest */ + //ReestablishmentCause_t reestablishment_cause_NR; //different set for NB_IoT + + /* UE id for initial connection to S1AP */ + uint16_t ue_initial_id; + + /* Information from S1AP initial_context_setup_req */ + uint32_t eNB_ue_s1ap_id :24; + + security_capabilities_t security_capabilities; + + /* Total number of e_rab already setup in the list */ //NAS list? + uint8_t setup_e_rabs; + /* Number of e_rab to be setup in the list */ //NAS list? + uint8_t nb_of_e_rabs; + /* list of e_rab to be setup by RRC layers */ + e_rab_param_NR_t e_rab[NB_RB_MAX_NB_IOT];//[S1AP_MAX_E_RAB]; + + // LG: For GTPV1 TUNNELS + uint32_t enb_gtp_teid[S1AP_MAX_E_RAB]; + transport_layer_addr_t enb_gtp_addrs[S1AP_MAX_E_RAB]; + rb_id_t enb_gtp_ebi[S1AP_MAX_E_RAB]; + + //Which timers are referring to? + uint32_t ul_failure_timer; + uint32_t ue_release_timer; + //threshold of the release timer--> set in RRCConnectionRelease + uint32_t ue_release_timer_thres; +} gNB_RRC_UE_t; +//-------------------------------------------------------------------------------- + +typedef uid_NR_t ue_uid_t; + + +//generally variable called: ue_context_pP +typedef struct rrc_gNB_ue_context_s { + + /* Tree related data */ + RB_ENTRY(rrc_gNB_ue_context_s) entries; + + /* Uniquely identifies the UE between MME and eNB within the eNB. + * This id is encoded on 24bits. + */ + rnti_t ue_id_rnti; + + // another key for protocol layers but should not be used as a key for RB tree + ue_uid_t local_uid; + + /* UE id for initial connection to S1AP */ + struct gNB_RRC_UE_s ue_context; //context of ue in the e-nB + +} rrc_gNB_ue_context_t; + + +//called "carrier"--> data from PHY layer +typedef struct { + + // buffer that contains the encoded messages + uint8_t *MIB_NR; + uint8_t sizeof_MIB_NR; +/* + uint8_t *SIB1_NB_IoT; + uint8_t sizeof_SIB1_NB_IoT; + uint8_t *SIB23_NB_IoT; + uint8_t sizeof_SIB23_NB_IoT; +*/ + +/* + //not actually implemented in OAI + uint8_t *SIB4_NB_IoT; + uint8_t sizeof_SIB4_NB_IoT; + uint8_t *SIB5_NB_IoT; + uint8_t sizeof_SIB5_NB_IoT; + uint8_t *SIB14_NB_IoT; + uint8_t sizeof_SIB14_NB_IoT; + uint8_t *SIB16_NB_IoT; + uint8_t sizeof_SIB16_NB_IoT; +*/ + //TS 36.331 V14.2.1 +// uint8_t *SIB15_NB; +// uint8_t sizeof_SIB15_NB; +// uint8_t *SIB20_NB; +// uint8_t sizeof_SIB20_NB; +// uint8_t *SIB22_NB; +// uint8_t sizeof_SIB22_NB; + + //implicit parameters needed + int Ncp; //cyclic prefix for DL + int Ncp_UL; //cyclic prefix for UL + int p_eNB; //number of tx antenna port + int p_rx_eNB; //number of receiving antenna ports + uint32_t dl_CarrierFreq; //detected by the UE + uint32_t ul_CarrierFreq; //detected by the UE + uint16_t physCellId; //not stored in the MIB-NB but is getting through NPSS/NSSS + + //are the only static one (memory has been already allocated) + BCCH_BCH_Message_t mib_NR; + + /* + BCCH_DL_SCH_Message_NR_t siblock1_NB_IoT; //SIB1-NB + BCCH_DL_SCH_Message_NR_t systemInformation_NB_IoT; //SI + */ + SIB1_t *sib1_NR; + /* + SIB2_t *sib2_NR; + SIB3_t *sib3_NR; + //not implemented yet + SIB4_t *sib4_NR; + SIB5_t *sib5_NR; + */ + + + SRB_INFO_NR SI; + SRB_INFO_NR Srb0; + + uint8_t **MCCH_MESSAGE; // probably not needed , but added to remove errors + uint8_t sizeof_MCCH_MESSAGE[8];// but added to remove errors + SRB_INFO_NR MCCH_MESS[8];// MAX_MBSFN_AREA + + /*future implementation TS 36.331 V14.2.1 + SystemInformationBlockType15_NB_r14_t *sib15; + SystemInformationBlockType20_NB_r14_t *sib20; + SystemInformationBlockType22_NB_r14_t *sib22; + + uint8_t SCPTM_flag; + uint8_t sizeof_SC_MCHH_MESS[]; + SC_MCCH_Message_NR_t scptm;*/ + + +} rrc_gNB_carrier_data_t; +//--------------------------------------------------- + + + +//---NR---(completely change)--------------------- +typedef struct gNB_RRC_INST_s { + + eth_params_t eth_params_s; + rrc_gNB_carrier_data_t carrier[MAX_NUM_CCs]; + uid_allocator_NR_t uid_allocator; // for rrc_ue_head + RB_HEAD(rrc_ue_tree_NR_s, rrc_gNB_ue_context_s) rrc_ue_head; // ue_context tree key search by rnti + + uint8_t HO_flag; + uint8_t Nb_ue; + + hash_table_t *initial_id2_s1ap_ids; // key is content is rrc_ue_s1ap_ids_t + hash_table_t *s1ap_id2_s1ap_ids ; // key is content is rrc_ue_s1ap_ids_t + + //RRC configuration +#if defined(ENABLE_ITTI) + gNB_RrcConfigurationReq configuration;//rrc_messages_types.h +#endif + // other PLMN parameters + /// Mobile country code + int mcc; + /// Mobile network code + int mnc; + /// number of mnc digits + int mnc_digit_length; + + // other RAN parameters + int srb1_timer_poll_retransmit; + int srb1_poll_pdu; + int srb1_poll_byte; + int srb1_max_retx_threshold; + int srb1_timer_reordering; + int srb1_timer_status_prohibit; + int srs_enable[MAX_NUM_CCs]; + +} gNB_RRC_INST; + +//#define RRC_HEADER_SIZE_MAX_NR 64 +#define MAX_UE_CAPABILITY_SIZE_NR 255 + +//not needed for the moment +typedef struct OAI_UECapability_NR_s { + uint8_t sdu[MAX_UE_CAPABILITY_SIZE_NR]; + uint8_t sdu_size; +////NR------ + UE_NR_Capability_t UE_Capability_NR; //replace the UE_EUTRA_Capability of LTE +} OAI_UECapability_NR_t; + + +typedef struct UE_RRC_INST_NR_s { + Rrc_State_NR_t RrcState; + Rrc_Sub_State_NR_t RrcSubState; +# if defined(ENABLE_USE_MME) + plmn_t plmnID; + Byte_t rat; + as_nas_info_t initialNasMsg; +# endif + OAI_UECapability_NR_t *UECap; + uint8_t *UECapability; + uint8_t UECapability_size; + + UE_RRC_INFO_NR Info[NB_SIG_CNX_UE]; + + SRB_INFO_NR Srb0[NB_SIG_CNX_UE]; + SRB_INFO_TABLE_ENTRY_NR Srb1[NB_CNX_UE]; + SRB_INFO_TABLE_ENTRY_NR Srb2[NB_CNX_UE]; + HANDOVER_INFO_UE_NR HandoverInfoUe; + /* + uint8_t *SIB1[NB_CNX_UE]; + uint8_t sizeof_SIB1[NB_CNX_UE]; + uint8_t *SI[NB_CNX_UE]; + uint8_t sizeof_SI[NB_CNX_UE]; + uint8_t SIB1Status[NB_CNX_UE]; + uint8_t SIStatus[NB_CNX_UE]; + SIB1_t *sib1[NB_CNX_UE]; + SystemInformation_t *si[NB_CNX_UE]; //!< Temporary storage for an SI message. Decoding happens in decode_SI(). + + SystemInformationBlockType2_t *sib2[NB_CNX_UE]; + /* + SystemInformationBlockType3_t *sib3[NB_CNX_UE]; + SystemInformationBlockType4_t *sib4[NB_CNX_UE]; + SystemInformationBlockType5_t *sib5[NB_CNX_UE]; + SystemInformationBlockType6_t *sib6[NB_CNX_UE]; + SystemInformationBlockType7_t *sib7[NB_CNX_UE]; + SystemInformationBlockType8_t *sib8[NB_CNX_UE]; + SystemInformationBlockType9_t *sib9[NB_CNX_UE]; + SystemInformationBlockType10_t *sib10[NB_CNX_UE]; + SystemInformationBlockType11_t *sib11[NB_CNX_UE]; + +#if defined(Rel10) || defined(Rel14) + uint8_t MBMS_flag; + uint8_t *MCCH_MESSAGE[NB_CNX_UE]; + uint8_t sizeof_MCCH_MESSAGE[NB_CNX_UE]; + uint8_t MCCH_MESSAGEStatus[NB_CNX_UE]; + MBSFNAreaConfiguration_r9_t *mcch_message[NB_CNX_UE]; + SystemInformationBlockType12_r9_t *sib12[NB_CNX_UE]; + SystemInformationBlockType13_r9_t *sib13[NB_CNX_UE]; +#endif +#ifdef CBA + uint8_t num_active_cba_groups; + uint16_t cba_rnti[NUM_MAX_CBA_GROUP]; +#endif + uint8_t num_srb; + struct SRB_ToAddMod *SRB1_config[NB_CNX_UE]; + struct SRB_ToAddMod *SRB2_config[NB_CNX_UE]; + struct DRB_ToAddMod *DRB_config[NB_CNX_UE][8]; + rb_id_t *defaultDRB; // remember the ID of the default DRB + MeasObjectToAddMod_t *MeasObj[NB_CNX_UE][MAX_MEAS_OBJ]; + struct ReportConfigToAddMod *ReportConfig[NB_CNX_UE][MAX_MEAS_CONFIG]; + */ + struct QuantityConfig *QuantityConfig[NB_CNX_UE]; + /* + struct MeasIdToAddMod *MeasId[NB_CNX_UE][MAX_MEAS_ID]; + MEAS_REPORT_LIST *measReportList[NB_CNX_UE][MAX_MEAS_ID]; + uint32_t measTimer[NB_CNX_UE][MAX_MEAS_ID][6]; // 6 neighboring cells + RSRP_Range_t s_measure; + struct MeasConfig__speedStatePars *speedStatePars; + struct PhysicalConfigDedicated *physicalConfigDedicated[NB_CNX_UE]; + struct SPS_Config *sps_Config[NB_CNX_UE]; + MAC_MainConfig_t *mac_MainConfig[NB_CNX_UE]; + MeasGapConfig_t *measGapConfig[NB_CNX_UE]; + double filter_coeff_rsrp; // [7] ??? + double filter_coeff_rsrq; // [7] ??? + float rsrp_db[7]; + float rsrq_db[7]; + float rsrp_db_filtered[7]; + float rsrq_db_filtered[7]; +#if ENABLE_RAL + obj_hash_table_t *ral_meas_thresholds; + ral_transaction_id_t scan_transaction_id; +#endif +#if defined(ENABLE_SECURITY) + // KeNB as computed from parameters within USIM card // + uint8_t kenb[32]; +#endif + + // Used integrity/ciphering algorithms // + CipheringAlgorithm_r12_t ciphering_algorithm; + e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm; + */ +}UE_RRC_INST_NR; + + + + +#include "proto_NR.h" //should be put here otherwise compilation error + +#endif +/** @} */ diff --git a/openair2/RRC/NR/extern_NR.h b/openair2/RRC/NR/extern_NR.h new file mode 100644 index 0000000000..b45dbd11e9 --- /dev/null +++ b/openair2/RRC/NR/extern_NR.h @@ -0,0 +1,87 @@ +/* + * 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 + */ + +/*! \file vars.h +* \brief rrc external vars +* \author Navid Nikaein and Raymond Knopp +* \date 2011 +* \version 1.0 +* \company Eurecom +* \email: navid.nikaein@eurecom.fr +*/ + +#ifndef __OPENAIR_RRC_EXTERN_H__ +#define __OPENAIR_RRC_EXTERN_H__ +#include "defs.h" +#include "COMMON/mac_rrc_primitives.h" +#include "LAYER2/MAC/defs.h" +#include "LAYER2/MAC/extern.h" +#include "LAYER2/RLC/rlc.h" + +extern UE_RRC_INST *UE_rrc_inst; + +#include "LAYER2/MAC/extern.h" + +extern uint8_t DRB2LCHAN[8]; + +extern LogicalChannelConfig_t SRB1_logicalChannelConfig_defaultValue; +extern LogicalChannelConfig_t SRB2_logicalChannelConfig_defaultValue; + + +#ifndef PHY_EMUL +#ifndef PHYSIM +//#define NB_INST 1 +#else +extern unsigned char NB_INST; +#endif +extern unsigned char NB_eNB_INST; +extern unsigned char NB_UE_INST; +extern unsigned short NODE_ID[1]; +extern void* bigphys_malloc(int); +#endif + + +//CONSTANTS +extern rlc_info_t Rlc_info_um,Rlc_info_am_config; +//uint8_t RACH_TIME_ALLOC; +extern uint16_t RACH_FREQ_ALLOC; +//uint8_t NB_RACH; +extern LCHAN_DESC BCCH_LCHAN_DESC,CCCH_LCHAN_DESC,DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC; +extern MAC_MEAS_T BCCH_MEAS_TRIGGER,CCCH_MEAS_TRIGGER,DCCH_MEAS_TRIGGER,DTCH_MEAS_TRIGGER; +extern MAC_AVG_T BCCH_MEAS_AVG,CCCH_MEAS_AVG,DCCH_MEAS_AVG, DTCH_MEAS_AVG; + +extern uint16_t T300[8]; +extern uint16_t T310[8]; +extern uint16_t N310[8]; +extern uint16_t N311[8]; +extern uint32_t T304[8]; +extern uint32_t timeToTrigger_ms[16]; +extern float RSRP_meas_mapping[98]; +extern float RSRQ_meas_mapping[35]; + +extern UE_PF_PO_t UE_PF_PO[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; +extern pthread_mutex_t ue_pf_po_mutex; + +extern uint16_t reestablish_rnti_map[NUMBER_OF_UE_MAX][2]; + +#endif + + diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c new file mode 100644 index 0000000000..ef3658af07 --- /dev/null +++ b/openair2/RRC/NR/rrc_gNB.c @@ -0,0 +1,7428 @@ +/* + * 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 + */ + +/*! \file rrc_gNB.c + * \brief rrc procedures for gNB + * \author Navid Nikaein and Raymond Knopp , WEI-TAI CHEN + * \date 2011 - 2014 , 2018 + * \version 1.0 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr and raymond.knopp@eurecom.fr + */ +#define RRC_GNB +#define RRC_GNB_C + +#include "defs_NR.h" +#include "extern.h" +#include "assertions.h" +#include "common/ran_context.h" +#include "asn1_conversions.h" + +#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" +#include "LAYER2/RLC/rlc.h" +#include "LAYER2/MAC/proto.h" +#include "UTIL/LOG/log.h" +#include "COMMON/mac_rrc_primitives.h" +#include "RRC/LITE/MESSAGES/asn1_msg.h" + +///ASN.1 header files +//#include "RRCConnectionRequest.h" +//#include "RRCConnectionReestablishmentRequest.h" +//#include "ReestablishmentCause.h" +#include "BCCH-BCH-Message.h" +//#include "UL-CCCH-Message.h" +//#include "DL-CCCH-Message.h" +#include "UL-DCCH-Message.h" +#include "DL-DCCH-Message.h" +//#include "TDD-Config.h" +//#include "HandoverCommand.h" +#include "MeasResults.h" + +#include "pdcp.h" +#include "rlc.h" +#include "SIMULATION/ETH_TRANSPORT/extern.h" +#include "rrc_eNB_UE_context.h" +#include "platform_types.h" +#include "msc.h" +#include "UTIL/LOG/vcd_signal_dumper.h" +#include "T.h" + + +#include "RRC/NAS/nas_config.h" +#include "RRC/NAS/rb_config.h" +#include "OCG.h" +#include "OCG_extern.h" + +#if defined(ENABLE_SECURITY) +# include "UTIL/OSA/osa_defs.h" +#endif + +#if defined(ENABLE_USE_MME) +# include "rrc_eNB_S1AP.h" +# include "rrc_eNB_GTPV1U.h" +# if defined(ENABLE_ITTI) +# else +# include "../../S1AP/s1ap_eNB.h" +# endif +#endif + +#include "gtpv1u_eNB_task.h" + +#if defined(ENABLE_ITTI) +# include "intertask_interface.h" +#endif + +#if ENABLE_RAL +# include "rrc_eNB_ral.h" +#endif + +#include "SIMULATION/TOOLS/defs.h" // for taus + +//#define XER_PRINT + +extern RAN_CONTEXT_t RC; + +#ifdef PHY_EMUL +extern EMULATION_VARS *Emul_vars; +#endif +extern eNB_MAC_INST *eNB_mac_inst; +extern UE_MAC_INST *UE_mac_inst; +#ifdef BIGPHYSAREA +extern void* bigphys_malloc(int); +#endif + +extern uint16_t two_tier_hexagonal_cellIds[7]; + +mui_t rrc_eNB_mui = 0; + +void +openair_rrc_on( + const protocol_ctxt_t* const ctxt_pP +) +//----------------------------------------------------------------------------- +{ + int CC_id; + + LOG_I(NR_RRC, PROTOCOL_RRC_CTXT_FMT" gNB:OPENAIR NR RRC IN....\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + rrc_config_buffer (&RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].SI, BCCH, 1); + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].SI.Active = 1; + rrc_config_buffer (&RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0, CCCH, 1); + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Active = 1; + } +} + +//----------------------------------------------------------------------------- +static void +init_SI( + const protocol_ctxt_t* const ctxt_pP, + const int CC_id +#if defined(ENABLE_ITTI) + , + RrcConfigurationReq * configuration +#endif +) +//----------------------------------------------------------------------------- +{ +#if defined(Rel10) || defined(Rel14) + int i; +#endif + +#ifdef Rel14 + SystemInformationBlockType1_v1310_IEs_t *sib1_v13ext=(SystemInformationBlockType1_v1310_IEs_t *)NULL; +#endif + + LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__); + + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MIB = (uint8_t*) malloc16(4); + // copy basic parameters + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId = configuration->Nid_cell[CC_id]; + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB = configuration->nb_antenna_ports[CC_id]; + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Ncp = configuration->prefix_type[CC_id]; + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq = configuration->downlink_frequency[CC_id]; + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].ul_CarrierFreq = configuration->downlink_frequency[CC_id]+ configuration->uplink_frequency_offset[CC_id]; +#ifdef Rel14 + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].pbch_repetition = configuration->pbch_repetition[CC_id]; +#endif + LOG_I(RRC, "Configuring MIB (N_RB_DL %d,phich_Resource %d,phich_Duration %d)\n", + (int)configuration->N_RB_DL[CC_id], + (int)configuration->phich_resource[CC_id], + (int)configuration->phich_duration[CC_id]); + do_MIB(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id], +#ifdef ENABLE_ITTI + configuration->N_RB_DL[CC_id], + configuration->phich_resource[CC_id], + configuration->phich_duration[CC_id] +#else + 50,0,0 +#endif + ,0); + + + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 = 0; + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 = 0; + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1 = (uint8_t*) malloc16(32); + + AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1!=NULL,PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB1 allocated\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 = do_SIB1(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],ctxt_pP->module_id,CC_id +#if defined(ENABLE_ITTI) + , configuration +#endif + ); + + AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 != 255,"FATAL, RC.rrc[enb_mod_idP].carrier[CC_id].sizeof_SIB1 == 255"); + + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23 = (uint8_t*) malloc16(64); + AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23!=NULL,"cannot allocate memory for SIB"); + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 = do_SIB23( + ctxt_pP->module_id, + + CC_id +#if defined(ENABLE_ITTI) + , configuration +#endif + ); + + AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 != 255,"FATAL, RC.rrc[mod].carrier[CC_id].sizeof_SIB23 == 255"); + + + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" SIB2/3 Contents (partial)\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.n_SB = %ld\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + pusch_ConfigBasic.n_SB); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.hoppingMode = %ld\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + pusch_ConfigBasic.hoppingMode); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.pusch_HoppingOffset = %ld\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + pusch_ConfigBasic.pusch_HoppingOffset); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.enable64QAM = %d\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + pusch_ConfigBasic.enable64QAM); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.groupHoppingEnabled = %d\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + ul_ReferenceSignalsPUSCH.groupHoppingEnabled); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.groupAssignmentPUSCH = %ld\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.sequenceHoppingEnabled = %d\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled); + LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.cyclicShift = %ld\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. + ul_ReferenceSignalsPUSCH.cyclicShift); + +#if defined(Rel10) || defined(Rel14) + + if (RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MBMS_flag > 0) { + for (i = 0; i < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.count; i++) { + // SIB 2 + // LOG_D(RRC, "[eNB %d] mbsfn_SubframeConfigList.list.count = %ld\n", enb_mod_idP, RC.rrc[enb_mod_idP].sib2->mbsfn_SubframeConfigList->list.count); + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" SIB13 contents for MBSFN subframe allocation %d/%d(partial)\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + i, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.count); + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" mbsfn_Subframe_pattern is = %x\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0] >> 0); + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" radioframe_allocation_period = %ld (just index number, not the real value)\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationPeriod); // need to display the real value, using array of char (like in dumping SIB2) + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" radioframe_allocation_offset = %ld\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationOffset); + } + + // SIB13 + for (i = 0; i < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.count; i++) { + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" SIB13 contents for MBSFN sync area %d/%d (partial)\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + i, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.count); + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" MCCH Repetition Period: %ld (just index number, not real value)\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_RepetitionPeriod_r9); + LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" MCCH Offset: %ld\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_Offset_r9); + } + } + else memset((void*)&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13,0,sizeof(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13)); +#endif + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_FMT" RRC_UE --- MAC_CONFIG_REQ (SIB1.tdd & SIB2 params) ---> MAC_UE\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + +#ifdef Rel14 + if ((RC.rrc[ctxt_pP->module_id]->carrier[CC_id].mib.message.schedulingInfoSIB1_BR_r13>0) && + (RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR!=NULL)) { + AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension!=NULL, + "sib2_br->nonCriticalExtension is null (v8.9)\n"); + AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension!=NULL, + "sib2_br->nonCriticalExtension is null (v9.2)\n"); + AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, + "sib2_br->nonCriticalExtension is null (v11.3)\n"); + AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, + "sib2_br->nonCriticalExtension is null (v12.5)\n"); + AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, + "sib2_br->nonCriticalExtension is null (v13.10)\n"); + sib1_v13ext = RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension; + } +#endif + + LOG_D(RRC, "About to call rrc_mac_config_req_eNB\n"); + + rrc_mac_config_req_eNB(ctxt_pP->module_id, CC_id, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Ncp, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->freqBandIndicator, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq, +#ifdef Rel14 + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].pbch_repetition, +#endif + 0, // rnti + (BCCH_BCH_Message_t *) + &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].mib, + (RadioResourceConfigCommonSIB_t *) & + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon, +#if defined(Rel14) + (RadioResourceConfigCommonSIB_t *) & + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2_BR->radioResourceConfigCommon, +#endif + (struct PhysicalConfigDedicated *)NULL, +#if defined(Rel10) || defined(Rel14) + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + (MAC_MainConfig_t *) NULL, 0, + (struct LogicalChannelConfig *)NULL, + (MeasGapConfig_t *) NULL, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->tdd_Config, + NULL, + &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->schedulingInfoList, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].ul_CarrierFreq, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->freqInfo.ul_Bandwidth, + &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->freqInfo.additionalSpectrumEmission, + (MBSFN_SubframeConfigList_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList +#if defined(Rel10) || defined(Rel14) + , + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MBMS_flag, + (MBSFN_AreaInfoList_r9_t*) & RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9, + (PMCH_InfoList_r9_t *) NULL +#endif +#ifdef Rel14 + , + sib1_v13ext +#endif + ); +} + +#if defined(Rel10) || defined(Rel14) +/*------------------------------------------------------------------------------*/ +static void +init_MCCH( + module_id_t enb_mod_idP, + int CC_id +) +//----------------------------------------------------------------------------- +{ + + int sync_area = 0; + // initialize RRC_eNB_INST MCCH entry + RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE = + malloc(RC.rrc[enb_mod_idP]->carrier[CC_id].num_mbsfn_sync_area * sizeof(uint8_t*)); + + for (sync_area = 0; sync_area < RC.rrc[enb_mod_idP]->carrier[CC_id].num_mbsfn_sync_area; sync_area++) { + + RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] = 0; + RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area] = (uint8_t *) malloc16(32); + + AssertFatal(RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area] != NULL, + "[eNB %d]init_MCCH: FATAL, no memory for MCCH MESSAGE allocated \n", enb_mod_idP); + RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] = do_MBSFNAreaConfig(enb_mod_idP, + sync_area, + (uint8_t *)RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area], + &RC.rrc[enb_mod_idP]->carrier[CC_id].mcch, + &RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message); + + LOG_I(RRC, "mcch message pointer %p for sync area %d \n", + RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area], + sync_area); + LOG_D(RRC, "[eNB %d] MCCH_MESSAGE contents for Sync Area %d (partial)\n", enb_mod_idP, sync_area); + LOG_D(RRC, "[eNB %d] CommonSF_AllocPeriod_r9 %ld\n", enb_mod_idP, + RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->commonSF_AllocPeriod_r9); + LOG_D(RRC, + "[eNB %d] CommonSF_Alloc_r9.list.count (number of MBSFN Subframe Pattern) %d\n", + enb_mod_idP, RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->commonSF_Alloc_r9.list.count); + LOG_D(RRC, "[eNB %d] MBSFN Subframe Pattern: %02x (in hex)\n", + enb_mod_idP, + RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->commonSF_Alloc_r9.list.array[0]->subframeAllocation. + choice.oneFrame.buf[0]); + + AssertFatal(RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] != 255, + "RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] == 255"); + RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESS[sync_area].Active = 1; + } + + + //Set the RC.rrc[enb_mod_idP]->MCCH_MESS.Active to 1 (allow to transfer MCCH message RRC->MAC in function mac_rrc_data_req) + + // ??Configure MCCH logical channel + // call mac_config_req with appropriate structure from ASN.1 description + + + // LOG_I(RRC, "DUY: serviceID is %d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->tmgi_r9.serviceId_r9.buf[2]); + // LOG_I(RRC, "DUY: session ID is %d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->sessionId_r9->buf[0]); + rrc_mac_config_req_eNB(enb_mod_idP, CC_id, + 0,0,0,0,0, +#ifdef Rel14 + 0, +#endif + 0,//rnti + (BCCH_BCH_Message_t *)NULL, + (RadioResourceConfigCommonSIB_t *) NULL, +#ifdef Rel14 + (RadioResourceConfigCommonSIB_t *) NULL, +#endif + (struct PhysicalConfigDedicated *)NULL, +#if defined(Rel10) || defined(Rel14) + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + (MAC_MainConfig_t *) NULL, + 0, + (struct LogicalChannelConfig *)NULL, + (MeasGapConfig_t *) NULL, + (TDD_Config_t *) NULL, + (MobilityControlInfo_t *)NULL, + (SchedulingInfoList_t *) NULL, + 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL +#if defined(Rel10) || defined(Rel14) + , + 0, + (MBSFN_AreaInfoList_r9_t *) NULL, + (PMCH_InfoList_r9_t *) & (RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9) +# endif +# ifdef Rel14 + , + (SystemInformationBlockType1_v1310_IEs_t *)NULL +# endif + ); + + //LOG_I(RRC,"DUY: lcid after rrc_mac_config_req is %02d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9); + +} + +//----------------------------------------------------------------------------- +static void init_MBMS( + module_id_t enb_mod_idP, + int CC_id, + frame_t frameP +) +//----------------------------------------------------------------------------- +{ + // init the configuration for MTCH + protocol_ctxt_t ctxt; + + if (RC.rrc[enb_mod_idP]->carrier[CC_id].MBMS_flag > 0) { + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, enb_mod_idP, ENB_FLAG_YES, NOT_A_RNTI, frameP, 0,enb_mod_idP); + + LOG_D(RRC, "[eNB %d] Frame %d : Radio Bearer config request for MBMS\n", enb_mod_idP, frameP); //check the lcid + // Configuring PDCP and RLC for MBMS Radio Bearer + + rrc_pdcp_config_asn1_req(&ctxt, + (SRB_ToAddModList_t *)NULL, // SRB_ToAddModList + (DRB_ToAddModList_t *)NULL, // DRB_ToAddModList + (DRB_ToReleaseList_t *)NULL, + 0, // security mode + NULL, // key rrc encryption + NULL, // key rrc integrity + NULL // key encryption +# if defined(Rel10) || defined(Rel14) + , &(RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9) +# endif + ,NULL); + + rrc_rlc_config_asn1_req(&ctxt, + NULL, // SRB_ToAddModList + NULL, // DRB_ToAddModList + NULL, // DRB_ToReleaseList + &(RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9)); + + //rrc_mac_config_req(); + } +} +#endif + +//----------------------------------------------------------------------------- +uint8_t +rrc_eNB_get_next_transaction_identifier( + module_id_t enb_mod_idP +) +//----------------------------------------------------------------------------- +{ + static uint8_t rrc_transaction_identifier[NUMBER_OF_eNB_MAX]; + rrc_transaction_identifier[enb_mod_idP] = (rrc_transaction_identifier[enb_mod_idP] + 1) % RRC_TRANSACTION_IDENTIFIER_NUMBER; + LOG_T(RRC,"generated xid is %d\n",rrc_transaction_identifier[enb_mod_idP]); + return rrc_transaction_identifier[enb_mod_idP]; +} +/*------------------------------------------------------------------------------*/ +/* Functions to handle UE index in eNB UE list */ + + +////----------------------------------------------------------------------------- +//static module_id_t +//rrc_eNB_get_UE_index( +// module_id_t enb_mod_idP, +// uint64_t UE_identity +//) +////----------------------------------------------------------------------------- +//{ +// +// boolean_t reg = FALSE; +// module_id_t i; +// +// AssertFatal(enb_mod_idP < NB_eNB_INST, "eNB index invalid (%d/%d)!", enb_mod_idP, NB_eNB_INST); +// +// for (i = 0; i < NUMBER_OF_UE_MAX; i++) { +// if (RC.rrc[enb_mod_idP]->Info.UE_list[i] == UE_identity) { +// // UE_identity already registered +// reg = TRUE; +// break; +// } +// } +// +// if (reg == FALSE) { +// return (UE_MODULE_INVALID); +// } else +// return (i); +//} + + +//----------------------------------------------------------------------------- +// return the ue context if there is already an UE with ue_identityP, NULL otherwise +static struct rrc_eNB_ue_context_s* +rrc_eNB_ue_context_random_exist( + const protocol_ctxt_t* const ctxt_pP, + const uint64_t ue_identityP +) +//----------------------------------------------------------------------------- +{ + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { + if (ue_context_p->ue_context.random_ue_identity == ue_identityP) + return ue_context_p; + } + return NULL; +} +//----------------------------------------------------------------------------- +// return the ue context if there is already an UE with the same S-TMSI(MMEC+M-TMSI), NULL otherwise +static struct rrc_eNB_ue_context_s* +rrc_eNB_ue_context_stmsi_exist( + const protocol_ctxt_t* const ctxt_pP, + const mme_code_t mme_codeP, + const m_tmsi_t m_tmsiP +) +//----------------------------------------------------------------------------- +{ + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { + LOG_I(RRC,"checking for UE S-TMSI %x, mme %x (%p): rnti %x", + m_tmsiP, mme_codeP, ue_context_p, + ue_context_p->ue_context.rnti); + if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) { + printf("=> S-TMSI %x, MME %x\n", + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code); + if (ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi == m_tmsiP) + if (ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code == mme_codeP) + return ue_context_p; + } + else + printf("\n"); + + } + return NULL; +} + +//----------------------------------------------------------------------------- +// return a new ue context structure if ue_identityP, ctxt_pP->rnti not found in collection +static struct rrc_eNB_ue_context_s* +rrc_eNB_get_next_free_ue_context( + const protocol_ctxt_t* const ctxt_pP, + const uint64_t ue_identityP +) +//----------------------------------------------------------------------------- +{ + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + ue_context_p = rrc_eNB_get_ue_context( + RC.rrc[ctxt_pP->module_id], + ctxt_pP->rnti); + + if (ue_context_p == NULL) { +#if 0 + RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { + if (ue_context_p->ue_context.random_ue_identity == ue_identityP) { + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Cannot create new UE context, already exist rand UE id 0x%"PRIx64", uid %u\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_identityP, + ue_context_p->local_uid); + return NULL; + } + } +#endif + ue_context_p = rrc_eNB_allocate_new_UE_context(RC.rrc[ctxt_pP->module_id]); + + if (ue_context_p == NULL) { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Cannot create new UE context, no memory\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + return NULL; + } + + ue_context_p->ue_id_rnti = ctxt_pP->rnti; // here ue_id_rnti is just a key, may be something else + ue_context_p->ue_context.rnti = ctxt_pP->rnti; // yes duplicate, 1 may be removed + ue_context_p->ue_context.random_ue_identity = ue_identityP; + RB_INSERT(rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p); + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Created new UE context uid %u\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p->local_uid); + return ue_context_p; + + } else { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Cannot create new UE context, already exist\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + return NULL; + } +} + +#if 0 //!defined(ENABLE_USE_MME) +void rrc_eNB_emulation_notify_ue_module_id( + const module_id_t ue_module_idP, + const rnti_t rntiP, + const uint8_t cell_identity_byte0P, + const uint8_t cell_identity_byte1P, + const uint8_t cell_identity_byte2P, + const uint8_t cell_identity_byte3P) +{ + module_id_t enb_module_id; + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + int CC_id; + + // find enb_module_id + for (enb_module_id = 0; enb_module_id < NUMBER_OF_eNB_MAX; enb_module_id++) { + if(enb_module_id>0){ /*FIX LATER*/ + return; + } + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + if (&RC.rrc[enb_module_id]->carrier[CC_id].sib1 != NULL) { + if ( + (&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[0] == cell_identity_byte0P) && + (&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[1] == cell_identity_byte1P) && + (&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[2] == cell_identity_byte2P) && + (&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[3] == cell_identity_byte3P) + ) { + ue_context_p = rrc_eNB_get_ue_context( + RC.rrc[enb_module_id], + rntiP + ); + + if (NULL != ue_context_p) { + oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[enb_module_id][ue_context_p->local_uid] = ue_module_idP; + } + + //return; + } + } + } + oai_emulation.info.eNB_ue_module_id_to_rnti[enb_module_id][ue_module_idP] = rntiP; + } + + AssertFatal(enb_module_id == NUMBER_OF_eNB_MAX, + "Cell identity not found for ue module id %u rnti %x", + ue_module_idP, rntiP); +} +#endif + +//----------------------------------------------------------------------------- +void +rrc_eNB_free_mem_UE_context( + const protocol_ctxt_t* const ctxt_pP, + struct rrc_eNB_ue_context_s* const ue_context_pP +) +//----------------------------------------------------------------------------- +{ + int i; + LOG_T(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Clearing UE context 0x%p (free internal structs)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_pP); +#if defined(Rel10) || defined(Rel14) + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_SCellToAddMod_r10, &ue_context_pP->ue_context.sCell_config[0]); + ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_SCellToAddMod_r10, &ue_context_pP->ue_context.sCell_config[1]); +#endif + + if (ue_context_pP->ue_context.SRB_configList) { + ASN_STRUCT_FREE(asn_DEF_SRB_ToAddModList, ue_context_pP->ue_context.SRB_configList); + ue_context_pP->ue_context.SRB_configList = NULL; + } + + for(i = 0;i < RRC_TRANSACTION_IDENTIFIER_NUMBER;i++){ + if (ue_context_pP->ue_context.SRB_configList2[i]) { + free(ue_context_pP->ue_context.SRB_configList2[i]); + ue_context_pP->ue_context.SRB_configList2[i] = NULL; + } + } + + if (ue_context_pP->ue_context.DRB_configList) { + ASN_STRUCT_FREE(asn_DEF_DRB_ToAddModList, ue_context_pP->ue_context.DRB_configList); + ue_context_pP->ue_context.DRB_configList = NULL; + } + + for(i = 0;i < RRC_TRANSACTION_IDENTIFIER_NUMBER;i++){ + if (ue_context_pP->ue_context.DRB_configList2[i]) { + free(ue_context_pP->ue_context.DRB_configList2[i]); + ue_context_pP->ue_context.DRB_configList2[i] = NULL; + } + if (ue_context_pP->ue_context.DRB_Release_configList2[i]) { + free(ue_context_pP->ue_context.DRB_Release_configList2[i]); + ue_context_pP->ue_context.DRB_Release_configList2[i] = NULL; + } + } + + memset(ue_context_pP->ue_context.DRB_active, 0, sizeof(ue_context_pP->ue_context.DRB_active)); + + if (ue_context_pP->ue_context.physicalConfigDedicated) { + ASN_STRUCT_FREE(asn_DEF_PhysicalConfigDedicated, ue_context_pP->ue_context.physicalConfigDedicated); + ue_context_pP->ue_context.physicalConfigDedicated = NULL; + } + + if (ue_context_pP->ue_context.sps_Config) { + ASN_STRUCT_FREE(asn_DEF_SPS_Config, ue_context_pP->ue_context.sps_Config); + ue_context_pP->ue_context.sps_Config = NULL; + } + + for (i=0; i < MAX_MEAS_OBJ; i++) { + if (ue_context_pP->ue_context.MeasObj[i] != NULL) { + ASN_STRUCT_FREE(asn_DEF_MeasObjectToAddMod, ue_context_pP->ue_context.MeasObj[i]); + ue_context_pP->ue_context.MeasObj[i] = NULL; + } + } + + for (i=0; i < MAX_MEAS_CONFIG; i++) { + if (ue_context_pP->ue_context.ReportConfig[i] != NULL) { + ASN_STRUCT_FREE(asn_DEF_ReportConfigToAddMod, ue_context_pP->ue_context.ReportConfig[i]); + ue_context_pP->ue_context.ReportConfig[i] = NULL; + } + } + + if (ue_context_pP->ue_context.QuantityConfig) { + ASN_STRUCT_FREE(asn_DEF_QuantityConfig, ue_context_pP->ue_context.QuantityConfig); + ue_context_pP->ue_context.QuantityConfig = NULL; + } + + if (ue_context_pP->ue_context.mac_MainConfig) { + ASN_STRUCT_FREE(asn_DEF_MAC_MainConfig, ue_context_pP->ue_context.mac_MainConfig); + ue_context_pP->ue_context.mac_MainConfig = NULL; + } + +/* if (ue_context_pP->ue_context.measGapConfig) { + ASN_STRUCT_FREE(asn_DEF_MeasGapConfig, ue_context_pP->ue_context.measGapConfig); + ue_context_pP->ue_context.measGapConfig = NULL; + }*/ + if (ue_context_pP->ue_context.handover_info) { + ASN_STRUCT_FREE(asn_DEF_Handover, ue_context_pP->ue_context.handover_info); + ue_context_pP->ue_context.handover_info = NULL; + } + + //SRB_INFO SI; + //SRB_INFO Srb0; + //SRB_INFO_TABLE_ENTRY Srb1; + //SRB_INFO_TABLE_ENTRY Srb2; + if (ue_context_pP->ue_context.measConfig) { + ASN_STRUCT_FREE(asn_DEF_MeasConfig, ue_context_pP->ue_context.measConfig); + ue_context_pP->ue_context.measConfig = NULL; + } + + if (ue_context_pP->ue_context.measConfig) { + ASN_STRUCT_FREE(asn_DEF_MeasConfig, ue_context_pP->ue_context.measConfig); + ue_context_pP->ue_context.measConfig = NULL; + } + + //HANDOVER_INFO *handover_info; +#if defined(ENABLE_SECURITY) + //uint8_t kenb[32]; +#endif + //e_SecurityAlgorithmConfig__cipheringAlgorithm ciphering_algorithm; + //e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm; + //uint8_t Status; + //rnti_t rnti; + //uint64_t random_ue_identity; +#if defined(ENABLE_ITTI) + //UE_S_TMSI Initialue_identity_s_TMSI; + //EstablishmentCause_t establishment_cause; + //ReestablishmentCause_t reestablishment_cause; + //uint16_t ue_initial_id; + //uint32_t eNB_ue_s1ap_id :24; + //security_capabilities_t security_capabilities; + //uint8_t nb_of_e_rabs; + //e_rab_param_t e_rab[S1AP_MAX_E_RAB]; + //uint32_t enb_gtp_teid[S1AP_MAX_E_RAB]; + //transport_layer_addr_t enb_gtp_addrs[S1AP_MAX_E_RAB]; + //rb_id_t enb_gtp_ebi[S1AP_MAX_E_RAB]; +#endif +} + +//----------------------------------------------------------------------------- +// should be called when UE is lost by eNB +void +rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s* const ue_context_pP) +//----------------------------------------------------------------------------- +{ + + + protocol_ctxt_t ctxt; +#if !defined(ENABLE_USE_MME) + module_id_t ue_module_id; + /* avoid gcc warnings */ + (void)ue_module_id; +#endif + rnti_t rnti = ue_context_pP->ue_context.rnti; + int i, j , CC_id, pdu_number; + LTE_eNB_ULSCH_t *ulsch = NULL; + LTE_eNB_DLSCH_t *dlsch = NULL; + nfapi_ul_config_request_body_t *ul_req_tmp = NULL; + PHY_VARS_eNB *eNB_PHY = NULL; + eNB_MAC_INST *eNB_MAC = RC.mac[enb_mod_idP]; + + AssertFatal(enb_mod_idP < NB_eNB_INST, "eNB inst invalid (%d/%d) for UE %x!", enb_mod_idP, NB_eNB_INST, rnti); + /* ue_context_p = rrc_eNB_get_ue_context( + &RC.rrc[enb_mod_idP], + rntiP + ); + */ + if (NULL != ue_context_pP) { + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, enb_mod_idP, ENB_FLAG_YES, rnti, 0, 0,enb_mod_idP); + LOG_W(RRC, "[eNB %d] Removing UE RNTI %x\n", enb_mod_idP, rnti); + +#if defined(ENABLE_USE_MME) + if( ue_context_pP->ue_context.ul_failure_timer >= 8 ) { + LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ RNTI %x\n", enb_mod_idP, rnti); + rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(enb_mod_idP, ue_context_pP, S1AP_CAUSE_RADIO_NETWORK, 21); // send cause 21: connection with ue lost + /* From 3GPP 36300v10 p129 : 19.2.2.2.2 S1 UE Context Release Request (eNB triggered) + * If the E-UTRAN internal reason is a radio link failure detected in the eNB, the eNB shall wait a sufficient time before + * triggering the S1 UE Context Release Request procedure + * in order to allow the UE to perform the NAS recovery + * procedure, see TS 23.401 [17]. + */ + return; + } +#endif + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + eNB_PHY = RC.eNB[enb_mod_idP][CC_id]; + for (i=0; iulsch[i]; + if((ulsch != NULL) && (ulsch->rnti == rnti)){ + LOG_I(RRC, "clean_eNb_ulsch UE %x \n", rnti); + clean_eNb_ulsch(ulsch); + } + } + for (i=0; idlsch[i][0]; + if((dlsch != NULL) && (dlsch->rnti == rnti)){ + LOG_I(RRC, "clean_eNb_dlsch UE %x \n", rnti); + clean_eNb_dlsch(dlsch); + } + } + + if (rrc_agent_registered[enb_mod_idP]) { + agent_rrc_xface[enb_mod_idP]->flexran_agent_notify_ue_state_change(enb_mod_idP, + rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); + } + + for(j = 0; j < 10; j++){ + ul_req_tmp = &eNB_MAC->UL_req_tmp[CC_id][j].ul_config_request_body; + if(ul_req_tmp){ + pdu_number = ul_req_tmp->number_of_pdus; + for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--){ + if(ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == rnti){ + LOG_I(RRC, "remove UE %x from ul_config_pdu_list %d/%d\n", rnti, pdu_index, pdu_number); + if(pdu_index < pdu_number -1){ + memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t)); + } + ul_req_tmp->number_of_pdus--; + } + } + } + } + } + rrc_mac_remove_ue(enb_mod_idP,rnti); + rrc_rlc_remove_ue(&ctxt); + pdcp_remove_UE(&ctxt); + + rrc_eNB_remove_ue_context( + &ctxt, + RC.rrc[enb_mod_idP], + (struct rrc_eNB_ue_context_s*) ue_context_pP); + } +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_process_RRCConnectionSetupComplete( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* ue_context_pP, + RRCConnectionSetupComplete_r8_IEs_t * rrcConnectionSetupComplete +) +//----------------------------------------------------------------------------- +{ + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing RRCConnectionSetupComplete from UE (SRB1 Active)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + + ue_context_pP->ue_context.Srb1.Active=1; + T(T_ENB_RRC_CONNECTION_SETUP_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#if defined(ENABLE_USE_MME) + + if (EPC_MODE_ENABLED == 1) { + // Forward message to S1AP layer + rrc_eNB_send_S1AP_NAS_FIRST_REQ( + ctxt_pP, + ue_context_pP, + rrcConnectionSetupComplete); + } else +#endif + { + // RRC loop back (no S1AP), send SecurityModeCommand to UE + rrc_eNB_generate_SecurityModeCommand( + ctxt_pP, + ue_context_pP); + // rrc_eNB_generate_UECapabilityEnquiry(enb_mod_idP,frameP,ue_mod_idP); + } +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_SecurityModeCommand( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP +) +//----------------------------------------------------------------------------- +{ + uint8_t buffer[100]; + uint8_t size; + + T(T_ENB_RRC_SECURITY_MODE_COMMAND, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + size = do_SecurityModeCommand( + ctxt_pP, + buffer, + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), + ue_context_pP->ue_context.ciphering_algorithm, + ue_context_pP->ue_context.integrity_algorithm); + +#ifdef RRC_MSG_PRINT + uint16_t i=0; + LOG_F(RRC,"[MSG] RRC Security Mode Command\n"); + + for (i = 0; i < size; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); + } + + LOG_F(RRC,"\n"); +#endif + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate SecurityModeCommand (bytes %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + size); + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (securityModeCommand to UE MUI %d) --->[PDCP][RB %02d]\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + size, + rrc_eNB_mui, + DCCH); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" securityModeCommand UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_eNB_mui, + size); + + rrc_data_req( + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_UECapabilityEnquiry( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP +) +//----------------------------------------------------------------------------- +{ + + uint8_t buffer[100]; + uint8_t size; + + T(T_ENB_RRC_UE_CAPABILITY_ENQUIRY, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + size = do_UECapabilityEnquiry( + ctxt_pP, + buffer, + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id)); + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate UECapabilityEnquiry (bytes %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + size); + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (UECapabilityEnquiry MUI %d) --->[PDCP][RB %02d]\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + size, + rrc_eNB_mui, + DCCH); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" rrcUECapabilityEnquiry UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_eNB_mui, + size); + + rrc_data_req( + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_RRCConnectionReject( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + const int CC_id +) +//----------------------------------------------------------------------------- +{ +#ifdef RRC_MSG_PRINT + int cnt; +#endif + + T(T_ENB_RRC_CONNECTION_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size = + do_RRCConnectionReject(ctxt_pP->module_id, + (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRCConnectionReject\n"); + + for (cnt = 0; cnt < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) { + LOG_F(RRC,"%02x ", ((uint8_t*)RC.rrc[ctxt_pP->module_id]->Srb0.Tx_buffer.Payload)[cnt]); + } + + LOG_F(RRC,"\n"); +#endif + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, + MSC_AS_TIME_FMT" RRCConnectionReject UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReject (bytes %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_RRCConnectionReestablishment( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + const int CC_id +) +//----------------------------------------------------------------------------- +{ + LogicalChannelConfig_t *SRB1_logicalChannelConfig; + SRB_ToAddModList_t **SRB_configList; + SRB_ToAddMod_t *SRB1_config; + int cnt; + + T(T_ENB_RRC_CONNECTION_REESTABLISHMENT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + SRB_configList = &ue_context_pP->ue_context.SRB_configList; + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size = + do_RRCConnectionReestablishment(ctxt_pP, + ue_context_pP, + CC_id, + (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, + (uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2 + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), + SRB_configList, + &ue_context_pP->ue_context.physicalConfigDedicated); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRCConnectionReestablishment\n"); + + for (cnt = 0; cnt < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) { + LOG_F(RRC,"%02x ", ((uint8_t*)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload)[cnt]); + } + + LOG_F(RRC,"\n"); +#endif + + // configure SRB1 for UE + + if (*SRB_configList != NULL) { + for (cnt = 0; cnt < (*SRB_configList)->list.count; cnt++) { + if ((*SRB_configList)->list.array[cnt]->srb_Identity == 1) { + SRB1_config = (*SRB_configList)->list.array[cnt]; + + if (SRB1_config->logicalChannelConfig) { + if (SRB1_config->logicalChannelConfig->present == + SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { + SRB1_logicalChannelConfig = &SRB1_config->logicalChannelConfig->choice.explicitValue; + } else { + SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; + } + } else { + SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; + } + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rrc_mac_config_req_eNB(ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, +#ifdef Rel14 + 0, +#endif + ctxt_pP->rnti, + (BCCH_BCH_Message_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, +#ifdef Rel14 + (RadioResourceConfigCommonSIB_t *) NULL, +#endif + (struct PhysicalConfigDedicated* ) ue_context_pP->ue_context.physicalConfigDedicated, +#if defined(Rel10) || defined(Rel14) + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + 1, + SRB1_logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (TDD_Config_t *) NULL, + NULL, + (SchedulingInfoList_t *) NULL, + 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL +#if defined(Rel10) || defined(Rel14) + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL +#endif +#ifdef Rel14 + ,(SystemInformationBlockType1_v1310_IEs_t *)NULL +#endif + ); + break; + } + } + } + + MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, + MSC_RRC_UE, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, + MSC_AS_TIME_FMT" RRCConnectionReestablishment UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); + + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReestablishment (bytes %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); + + // activate release timer, if RRCComplete not received after 10 frames, remove UE + //ue_context_pP->ue_context.ue_release_timer = 1; + // remove UE after 10 frames after RRCConnectionReestablishmentRelease is triggered + //ue_context_pP->ue_context.ue_release_timer_thres = 100; + // activate release timer, if RRCComplete not received after 100 frames, remove UE + int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); + RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1; + // remove UE after 100 frames after RRCConnectionReestablishmentRelease is triggered + RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres = 1000; +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_process_RRCConnectionReestablishmentComplete( + const protocol_ctxt_t* const ctxt_pP, + const rnti_t reestablish_rnti, + rrc_eNB_ue_context_t* ue_context_pP, + const uint8_t xid, + RRCConnectionReestablishmentComplete_r8_IEs_t * rrcConnectionReestablishmentComplete +) +//----------------------------------------------------------------------------- +{ + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, processing RRCConnectionReestablishmentComplete from UE (SRB1 Active)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + + T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + DRB_ToAddModList_t* DRB_configList = ue_context_pP->ue_context.DRB_configList; + SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; + SRB_ToAddModList_t** SRB_configList2 = NULL; + DRB_ToAddModList_t** DRB_configList2 = NULL; + struct SRB_ToAddMod *SRB2_config = NULL; + struct DRB_ToAddMod *DRB_config = NULL; + int i = 0; +# if defined(ENABLE_USE_MME) + int j = 0; + hashtable_rc_t h_rc; +#endif + uint8_t buffer[RRC_BUF_SIZE]; + uint16_t size; + MeasObjectToAddModList_t *MeasObj_list = NULL; + MeasObjectToAddMod_t *MeasObj = NULL; + ReportConfigToAddModList_t *ReportConfig_list = NULL; + ReportConfigToAddMod_t *ReportConfig_per, *ReportConfig_A1, + *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; + MeasIdToAddModList_t *MeasId_list = NULL; + MeasIdToAddMod_t *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; + RSRP_Range_t *rsrp = NULL; + struct MeasConfig__speedStatePars *Sparams = NULL; + QuantityConfig_t *quantityConfig = NULL; + CellsToAddMod_t *CellToAdd = NULL; + CellsToAddModList_t *CellsToAddModList = NULL; + struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; + DedicatedInfoNAS_t *dedicatedInfoNas = NULL; + /* for no gcc warnings */ + (void)dedicatedInfoNas; + C_RNTI_t *cba_RNTI = NULL; + uint8_t next_xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); + + ue_context_pP->ue_context.Status = RRC_CONNECTED; + + SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[xid]; + // get old configuration of SRB2 + if (*SRB_configList2 != NULL) { + LOG_D(RRC, "SRB_configList2(%p) count is %d\n SRB_configList2->list.array[0] addr is %p", + SRB_configList2, (*SRB_configList2)->list.count, (*SRB_configList2)->list.array[0]); + for (i = 0; (i < (*SRB_configList2)->list.count) && (i < 3); i++) { + if ((*SRB_configList2)->list.array[i]->srb_Identity == 2 ){ + LOG_D(RRC, "get SRB2_config from (ue_context_pP->ue_context.SRB_configList2[%d])\n", xid); + SRB2_config = (*SRB_configList2)->list.array[i]; + break; + } + } + } + SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[next_xid]; + DRB_configList2 = &ue_context_pP->ue_context.DRB_configList2[next_xid]; + + if (*SRB_configList2) { + free(*SRB_configList2); + LOG_D(RRC, "free(ue_context_pP->ue_context.SRB_configList2[%d])\n", next_xid); + } + *SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2)); + if (SRB2_config != NULL) { + // Add SRB2 to SRB configuration list + + ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); + ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config); + + LOG_D(RRC, "Add SRB2_config (srb_Identity:%ld) to ue_context_pP->ue_context.SRB_configList\n", + SRB2_config->srb_Identity); + LOG_D(RRC, "Add SRB2_config (srb_Identity:%ld) to ue_context_pP->ue_context.SRB_configList2[%d]\n", + SRB2_config->srb_Identity, next_xid); + } else { + // SRB configuration list only contains SRB1. + LOG_W(RRC,"SRB2 configuration does not exist in SRB configuration list\n"); + } + + + + if (*DRB_configList2) { + free(*DRB_configList2); + LOG_D(RRC, "free(ue_context_pP->ue_context.DRB_configList2[%d])\n", next_xid); + } + *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); + + if (DRB_configList != NULL) { + LOG_D(RRC, "get DRB_config from (ue_context_pP->ue_context.DRB_configList)\n"); + for (i = 0; (i < DRB_configList->list.count) && (i < 3); i++) { + DRB_config = DRB_configList->list.array[i]; + + // Add DRB to DRB configuration list, for RRCConnectionReconfigurationComplete + ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config); + } + } + ue_context_pP->ue_context.Srb1.Active = 1; + //ue_context_pP->ue_context.Srb2.Srb_info.Srb_id = 2; + +# if defined(ENABLE_USE_MME) + rrc_ue_s1ap_ids_t* rrc_ue_s1ap_ids_p = NULL; + uint16_t ue_initial_id = ue_context_pP->ue_context.ue_initial_id; + uint32_t eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; + eNB_RRC_INST *rrc_instance_p = RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]; + if (eNB_ue_s1ap_id > 0) { + h_rc = hashtable_get(rrc_instance_p->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, (void**)&rrc_ue_s1ap_ids_p); + if (h_rc == HASH_TABLE_OK) { + rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti; + } + } + if (ue_initial_id != 0) { + h_rc = hashtable_get(rrc_instance_p->initial_id2_s1ap_ids, (hash_key_t)ue_initial_id, (void**)&rrc_ue_s1ap_ids_p); + if (h_rc == HASH_TABLE_OK) { + rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti; + } + } + + gtpv1u_enb_create_tunnel_req_t create_tunnel_req; + + /* Save e RAB information for later */ + memset(&create_tunnel_req, 0 , sizeof(create_tunnel_req)); + + for (j = 0, i = 0; i < NB_RB_MAX; i++) { + if (ue_context_pP->ue_context.e_rab[i].status == E_RAB_STATUS_ESTABLISHED) { + create_tunnel_req.eps_bearer_id[j] = ue_context_pP->ue_context.e_rab[i].param.e_rab_id; + create_tunnel_req.sgw_S1u_teid[j] = ue_context_pP->ue_context.e_rab[i].param.gtp_teid; + + memcpy(&create_tunnel_req.sgw_addr[j], + &ue_context_pP->ue_context.e_rab[i].param.sgw_addr, + sizeof(transport_layer_addr_t)); + j++; + } + } + + create_tunnel_req.rnti = ctxt_pP->rnti; // warning put zero above + create_tunnel_req.num_tunnels = j; + + gtpv1u_update_s1u_tunnel( + ctxt_pP->instance, + &create_tunnel_req, + reestablish_rnti); +#endif + /* Update RNTI in ue_context */ + ue_context_pP->ue_id_rnti = ctxt_pP->rnti; // here ue_id_rnti is just a key, may be something else + ue_context_pP->ue_context.rnti = ctxt_pP->rnti; +# if defined(ENABLE_USE_MME) + uint8_t send_security_mode_command = FALSE; + rrc_pdcp_config_security( + ctxt_pP, + ue_context_pP, + send_security_mode_command); + LOG_D(RRC, "set security successfully \n"); +#endif + // Measurement ID list + MeasId_list = CALLOC(1, sizeof(*MeasId_list)); + memset((void *)MeasId_list, 0, sizeof(*MeasId_list)); + + MeasId0 = CALLOC(1, sizeof(*MeasId0)); + MeasId0->measId = 1; + MeasId0->measObjectId = 1; + MeasId0->reportConfigId = 1; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0); + + MeasId1 = CALLOC(1, sizeof(*MeasId1)); + MeasId1->measId = 2; + MeasId1->measObjectId = 1; + MeasId1->reportConfigId = 2; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1); + + MeasId2 = CALLOC(1, sizeof(*MeasId2)); + MeasId2->measId = 3; + MeasId2->measObjectId = 1; + MeasId2->reportConfigId = 3; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2); + + MeasId3 = CALLOC(1, sizeof(*MeasId3)); + MeasId3->measId = 4; + MeasId3->measObjectId = 1; + MeasId3->reportConfigId = 4; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3); + + MeasId4 = CALLOC(1, sizeof(*MeasId4)); + MeasId4->measId = 5; + MeasId4->measObjectId = 1; + MeasId4->reportConfigId = 5; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4); + + MeasId5 = CALLOC(1, sizeof(*MeasId5)); + MeasId5->measId = 6; + MeasId5->measObjectId = 1; + MeasId5->reportConfigId = 6; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5); + + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; + + // Add one EUTRA Measurement Object + MeasObj_list = CALLOC(1, sizeof(*MeasObj_list)); + memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list)); + + // Configure MeasObject + + MeasObj = CALLOC(1, sizeof(*MeasObj)); + memset((void *)MeasObj, 0, sizeof(*MeasObj)); + + MeasObj->measObjectId = 1; + MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA; + MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 3350; //band 7, 2.68GHz + //MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; //band 33, 1.909GHz + MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25; + MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t)); + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6; + MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB + + MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = + (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); + + CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; + + // Add adjacent cell lists (6 per eNB) + for (i = 0; i < 6; i++) { + CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd)); + CellToAdd->cellIndex = i + 1; + CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i); + CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0; + + ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd); + } + + ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj); + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; + + // Report Configurations for periodical, A1-A5 events + ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list)); + + ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); + + ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1)); + + ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2)); + + ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3)); + + ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4)); + + ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5)); + + ReportConfig_per->reportConfigId = 1; + ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_periodical; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose = + ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); + + ReportConfig_A1->reportConfigId = 2; + ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. + a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. + a1_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1); + + if (RC.rrc[ctxt_pP->module_id]->HO_flag == 1 /*HO_MEASURMENT */ ) { + LOG_I(RRC, "[eNB %d] frame %d: requesting A2, A3, A4, A5, and A6 event reporting\n", + ctxt_pP->module_id, ctxt_pP->frame); + ReportConfig_A2->reportConfigId = 3; + ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA2.a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA2.a2_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = + ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2); + + ReportConfig_A3->reportConfigId = 4; + ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; + + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = 1; //10; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA3.reportOnLeave = 1; + + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = + ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.hysteresis = 0.5; // FIXME ...hysteresis is of type long! + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger = + TimeToTrigger_ms40; + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3); + + ReportConfig_A4->reportConfigId = 5; + ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA4.a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA4.a4_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = + ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4); + + ReportConfig_A5->reportConfigId = 6; + ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold1.choice.threshold_RSRP = 10; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold2.choice.threshold_RSRP = 10; + + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = + ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5); + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; + + rsrp = CALLOC(1, sizeof(RSRP_Range_t)); + *rsrp = 20; + + Sparams = CALLOC(1, sizeof(*Sparams)); + Sparams->present = MeasConfig__speedStatePars_PR_setup; + Sparams->choice.setup.timeToTrigger_SF.sf_High = SpeedStateScaleFactors__sf_Medium_oDot75; + Sparams->choice.setup.timeToTrigger_SF.sf_Medium = SpeedStateScaleFactors__sf_High_oDot5; + Sparams->choice.setup.mobilityStateParameters.n_CellChangeHigh = 10; + Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5; + Sparams->choice.setup.mobilityStateParameters.t_Evaluation = MobilityStateParameters__t_Evaluation_s60; + Sparams->choice.setup.mobilityStateParameters.t_HystNormal = MobilityStateParameters__t_HystNormal_s120; + + quantityConfig = CALLOC(1, sizeof(*quantityConfig)); + memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); + quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct QuantityConfigEUTRA)); + memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA)); + quantityConfig->quantityConfigCDMA2000 = NULL; + quantityConfig->quantityConfigGERAN = NULL; + quantityConfig->quantityConfigUTRA = NULL; + quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = + CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP))); + quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = + CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ))); + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4; + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4; + + LOG_I(RRC, + "[eNB %d] Frame %d: potential handover preparation: store the information in an intermediate structure in case of failure\n", + ctxt_pP->module_id, ctxt_pP->frame); + // store the information in an intermediate structure for Hanodver management + //rrc_inst->handover_info.as_config.sourceRadioResourceConfig.srb_ToAddModList = CALLOC(1,sizeof()); + ue_context_pP->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_pP->ue_context.handover_info))); + //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.srb_ToAddModList,(void *)SRB_list,sizeof(SRB_ToAddModList_t)); + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.srb_ToAddModList = *SRB_configList2; + //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.drb_ToAddModList,(void *)DRB_list,sizeof(DRB_ToAddModList_t)); + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList = DRB_configList; + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL; + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig = + CALLOC(1, sizeof(*ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig)); + memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, + (void *)ue_context_pP->ue_context.mac_MainConfig, sizeof(MAC_MainConfig_t)); + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated = + CALLOC(1, sizeof(PhysicalConfigDedicated_t)); + memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, + (void*)ue_context_pP->ue_context.physicalConfigDedicated, sizeof(PhysicalConfigDedicated_t)); + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.sps_Config = NULL; + //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config,(void *)rrc_inst->sps_Config[ue_mod_idP],sizeof(SPS_Config_t)); + + } + +#ifdef CBA + //struct PUSCH_CBAConfigDedicated_vlola *pusch_CBAConfigDedicated_vlola; + uint8_t *cba_RNTI_buf; + cba_RNTI = CALLOC(1, sizeof(C_RNTI_t)); + cba_RNTI_buf = CALLOC(1, 2 * sizeof(uint8_t)); + cba_RNTI->buf = cba_RNTI_buf; + cba_RNTI->size = 2; + cba_RNTI->bits_unused = 0; + + // associate UEs to the CBa groups as a function of their UE id + if (rrc_inst->num_active_cba_groups) { + cba_RNTI->buf[0] = rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups] & 0xff; + cba_RNTI->buf[1] = 0xff; + LOG_D(RRC, + "[eNB %d] Frame %d: cba_RNTI = %x in group %d is attribued to UE %d\n", + enb_mod_idP, frameP, + rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups], + ue_mod_idP % rrc_inst->num_active_cba_groups, ue_mod_idP); + } else { + cba_RNTI->buf[0] = 0x0; + cba_RNTI->buf[1] = 0x0; + LOG_D(RRC, "[eNB %d] Frame %d: no cba_RNTI is configured for UE %d\n", enb_mod_idP, frameP, ue_mod_idP); + } + +#endif + +#if defined(ENABLE_ITTI) + /* Initialize NAS list */ + dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); + + /* Add all NAS PDUs to the list */ + for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { + if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { + dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); + memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); + OCTET_STRING_fromBuf(dedicatedInfoNas, + (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, + ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length); + LOG_D(RRC, "Add dedicatedInfoNas(%d) to dedicatedInfoNASList\n", i); + ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); + } + + /* TODO parameters yet to process ... */ + { + // ue_context_pP->ue_context.e_rab[i].param.qos; + // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; + // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; + } + + /* TODO should test if e RAB are Ok before! */ + ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; + LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", + i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE"); + } + + /* If list is empty free the list and reset the address */ + if (dedicatedInfoNASList->list.count == 0) { + free(dedicatedInfoNASList); + dedicatedInfoNASList = NULL; + } + +#endif + + // send RRCConnectionReconfiguration + memset(buffer, 0, RRC_BUF_SIZE); + + size = do_RRCConnectionReconfiguration(ctxt_pP, + buffer, + next_xid, //Transaction_id, + (SRB_ToAddModList_t*)*SRB_configList2, // SRB_configList + (DRB_ToAddModList_t*)DRB_configList, + (DRB_ToReleaseList_t*)NULL, // DRB2_list, + (struct SPS_Config*)NULL, // maybe ue_context_pP->ue_context.sps_Config, + (struct PhysicalConfigDedicated*)ue_context_pP->ue_context.physicalConfigDedicated, +#ifdef EXMIMO_IOT + NULL, NULL, NULL,NULL, +#else + (MeasObjectToAddModList_t*)MeasObj_list, // MeasObj_list, + (ReportConfigToAddModList_t*)ReportConfig_list, // ReportConfig_list, + (QuantityConfig_t*)quantityConfig, //quantityConfig, + (MeasIdToAddModList_t*)NULL, +#endif + (MAC_MainConfig_t*)ue_context_pP->ue_context.mac_MainConfig, + (MeasGapConfig_t*)NULL, + (MobilityControlInfo_t*)NULL, + (struct MeasConfig__speedStatePars*)Sparams, // Sparams, + (RSRP_Range_t*)rsrp, // rsrp, + (C_RNTI_t*)cba_RNTI, // cba_RNTI + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList //dedicatedInfoNASList +#if defined(Rel10) || defined(Rel14) + , (SCellToAddMod_r10_t*)NULL +#endif + ); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n"); + for (i = 0; i < size; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); + } + LOG_F(RRC,"\n"); + //////////////////////////////////////// +#endif + +#if defined(ENABLE_ITTI) + + /* Free all NAS PDUs */ + for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { + if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { + /* Free the NAS PDU buffer and invalidate it */ + free(ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer); + ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL; + } + } + +#endif + + LOG_I(RRC, + "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n", + ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); + + LOG_D(RRC, + "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", + ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_eNB_mui, + size); + + rrc_data_req( + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + + // delete UE data of prior RNTI. UE use current RNTI. + protocol_ctxt_t ctxt_prior = *ctxt_pP; + ctxt_prior.rnti = reestablish_rnti; + + LTE_eNB_ULSCH_t *ulsch = NULL; + nfapi_ul_config_request_body_t *ul_req_tmp = NULL; + PHY_VARS_eNB *eNB_PHY = NULL; + eNB_MAC_INST *eNB_MAC = RC.mac[ctxt_prior.module_id]; + for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + eNB_PHY = RC.eNB[ctxt_prior.module_id][CC_id]; + for (int i=0; iulsch[i]; + if((ulsch != NULL) && (ulsch->rnti == ctxt_prior.rnti)){ + LOG_I(RRC, "clean_eNb_ulsch UE %x \n", ctxt_prior.rnti); + clean_eNb_ulsch(ulsch); + break; + } + } + + for(int j = 0; j < 10; j++){ + ul_req_tmp = &eNB_MAC->UL_req_tmp[CC_id][j].ul_config_request_body; + if(ul_req_tmp){ + int pdu_number = ul_req_tmp->number_of_pdus; + for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--){ + if(ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == ctxt_prior.rnti){ + LOG_I(RRC, "remove UE %x from ul_config_pdu_list %d/%d\n", ctxt_prior.rnti, pdu_index, pdu_number); + if(pdu_index < pdu_number -1){ + memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t)); + } + ul_req_tmp->number_of_pdus--; + } + } + } + } + } + rrc_mac_remove_ue(ctxt_prior.module_id, ctxt_prior.rnti); + rrc_rlc_remove_ue(&ctxt_prior); + pdcp_remove_UE(&ctxt_prior); +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_RRCConnectionReestablishmentReject( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + const int CC_id +) +//----------------------------------------------------------------------------- +{ +#ifdef RRC_MSG_PRINT + int cnt; +#endif + int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); + RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1; + RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres = 20; + + T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size = + do_RRCConnectionReestablishmentReject(ctxt_pP->module_id, + (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRCConnectionReestablishmentReject\n"); + + for (cnt = 0; cnt < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) { + LOG_F(RRC,"%02x ", ((uint8_t*)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload)[cnt]); + } + + LOG_F(RRC,"\n"); +#endif + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, + MSC_AS_TIME_FMT" RRCConnectionReestablishmentReject UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReestablishmentReject (bytes %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_RRCConnectionRelease( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP +) +//----------------------------------------------------------------------------- +{ + + uint8_t buffer[RRC_BUF_SIZE]; + uint16_t size; + + T(T_ENB_RRC_CONNECTION_RELEASE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + memset(buffer, 0, RRC_BUF_SIZE); + + size = do_RRCConnectionRelease(ctxt_pP->module_id, buffer,rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id)); + // set release timer + //ue_context_pP->ue_context.ue_release_timer=1; + // remove UE after 10 frames after RRCConnectionRelease is triggered + //ue_context_pP->ue_context.ue_release_timer_thres=100; + // set release timer + ue_context_pP->ue_context.ue_release_timer_rrc = 1; + // remove UE after 10 frames after RRCConnectionRelease is triggered + ue_context_pP->ue_context.ue_release_timer_thres_rrc = 100; + ue_context_pP->ue_context.ue_reestablishment_timer = 0; + ue_context_pP->ue_context.ue_release_timer = 0; + ue_context_pP->ue_context.ue_release_timer_s1 = 0; + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate RRCConnectionRelease (bytes %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + size); + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (rrcConnectionRelease MUI %d) --->[PDCP][RB %u]\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + size, + rrc_eNB_mui, + DCCH); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" rrcConnectionRelease UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_eNB_mui, + size); + + rrc_data_req( + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); +} + +uint8_t qci_to_priority[9]={2,4,3,5,1,6,7,8,9}; + +// TBD: this directive can be remived if we create a similar e_rab_param_t structure in RRC context +#if defined(ENABLE_ITTI) +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + const uint8_t ho_state + ) +//----------------------------------------------------------------------------- +{ + + uint8_t buffer[RRC_BUF_SIZE]; + uint16_t size; + int i; + + struct DRB_ToAddMod *DRB_config = NULL; + struct RLC_Config *DRB_rlc_config = NULL; + struct PDCP_Config *DRB_pdcp_config = NULL; + struct PDCP_Config__rlc_AM *PDCP_rlc_AM = NULL; + struct PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; + struct LogicalChannelConfig *DRB_lchan_config = NULL; + struct LogicalChannelConfig__ul_SpecificParameters + *DRB_ul_SpecificParameters = NULL; + // DRB_ToAddModList_t** DRB_configList=&ue_context_pP->ue_context.DRB_configList; + DRB_ToAddModList_t* DRB_configList=ue_context_pP->ue_context.DRB_configList; + DRB_ToAddModList_t** DRB_configList2=NULL; + //DRB_ToAddModList_t** RRC_DRB_configList=&ue_context_pP->ue_context.DRB_configList; + + struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; + DedicatedInfoNAS_t *dedicatedInfoNas = NULL; + /* for no gcc warnings */ + (void)dedicatedInfoNas; + + long *logicalchannelgroup_drb; +// int drb_identity_index=0; + + uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); //Transaction_id, + DRB_configList2=&ue_context_pP->ue_context.DRB_configList2[xid]; + if (*DRB_configList2) { + free(*DRB_configList2); + } + //*DRB_configList = CALLOC(1, sizeof(*DRB_configList)); + *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); + /* Initialize NAS list */ + dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); + + int e_rab_done=0; + + for ( i = 0 ; + i < ue_context_pP->ue_context.setup_e_rabs ; + i++){ + + if (e_rab_done >= ue_context_pP->ue_context.nb_of_e_rabs){ + break; + } + + // bypass the new and already configured erabs + if (ue_context_pP->ue_context.e_rab[i].status >= E_RAB_STATUS_DONE) { +// drb_identity_index++; + continue; + } + + DRB_config = CALLOC(1, sizeof(*DRB_config)); + + DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long)); + // allowed value 5..15, value : x+4 + *(DRB_config->eps_BearerIdentity) = ue_context_pP->ue_context.e_rab[i].param.e_rab_id;//+ 4; // especial case generation + + // DRB_config->drb_Identity = 1 + drb_identity_index + e_rab_done;// + i ;// (DRB_Identity_t) ue_context_pP->ue_context.e_rab[i].param.e_rab_id; + // 1 + drb_identiy_index; + DRB_config->drb_Identity = i+1; + + DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long)); + *(DRB_config->logicalChannelIdentity) = DRB_config->drb_Identity + 2; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2 + + DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config)); + DRB_config->rlc_Config = DRB_rlc_config; + + DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); + DRB_config->pdcp_Config = DRB_pdcp_config; + DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long)); + *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity; + DRB_pdcp_config->rlc_AM = NULL; + DRB_pdcp_config->rlc_UM = NULL; + + + switch (ue_context_pP->ue_context.e_rab[i].param.qos.qci){ + /* + * type: realtime data with medium packer error rate + * action: swtich to RLC UM + */ + case 1: // 100ms, 10^-2, p2, GBR + case 2: // 150ms, 10^-3, p4, GBR + case 3: // 50ms, 10^-3, p3, GBR + case 4: // 300ms, 10^-6, p5 + case 7: // 100ms, 10^-3, p7, GBR + case 9: // 300ms, 10^-6, p9 + case 65: // 75ms, 10^-2, p0.7, mission critical voice, GBR + case 66: // 100ms, 10^-2, p2, non-mission critical voice , GBR + // RLC + DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; + DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; + // PDCP + PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); + DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; + PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; + break; + + /* + * type: non-realtime data with low packer error rate + * action: swtich to RLC AM + */ + case 5: // 100ms, 10^-6, p1 , IMS signaling + case 6: // 300ms, 10^-6, p6 + case 8: // 300ms, 10^-6, p8 + case 69: // 60ms, 10^-6, p0.5, mission critical delay sensitive data, Lowest Priority + case 70: // 200ms, 10^-6, p5.5, mision critical data + // RLC + DRB_rlc_config->present = RLC_Config_PR_am; + DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50; + DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16; + DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; + DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; + DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; + DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25; + + // PDCP + PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); + DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; + PDCP_rlc_AM->statusReportRequired = FALSE; + + break; + default : + LOG_E(RRC,"not supported qci %d\n", ue_context_pP->ue_context.e_rab[i].param.qos.qci); + ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_FAILED; + ue_context_pP->ue_context.e_rab[i].xid = xid; + e_rab_done++; + continue; + } + + DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; + + DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config)); + DRB_config->logicalChannelConfig = DRB_lchan_config; + DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); + DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; + + if (ue_context_pP->ue_context.e_rab[i].param.qos.qci < 9 ) + DRB_ul_SpecificParameters->priority = qci_to_priority[ue_context_pP->ue_context.e_rab[i].param.qos.qci-1] + 3; + // ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.priority_level; + else + DRB_ul_SpecificParameters->priority= 4; + + DRB_ul_SpecificParameters->prioritisedBitRate = LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8; + //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + DRB_ul_SpecificParameters->bucketSizeDuration = + LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + + logicalchannelgroup_drb = CALLOC(1, sizeof(long)); + *logicalchannelgroup_drb = 1;//(i+1) % 3; + DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; + + ASN_SEQUENCE_ADD(&DRB_configList->list, DRB_config); + ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config); + //ue_context_pP->ue_context.DRB_configList2[drb_identity_index] = &(*DRB_configList); + + LOG_I(RRC,"EPS ID %ld, DRB ID %ld (index %d), QCI %d, priority %ld, LCID %ld LCGID %ld \n", + *DRB_config->eps_BearerIdentity, + DRB_config->drb_Identity, i, + ue_context_pP->ue_context.e_rab[i].param.qos.qci, + DRB_ul_SpecificParameters->priority, + *(DRB_config->logicalChannelIdentity), + *DRB_ul_SpecificParameters->logicalChannelGroup + ); + + e_rab_done++; + ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; + ue_context_pP->ue_context.e_rab[i].xid = xid; + + { + if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { + dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); + memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); + OCTET_STRING_fromBuf(dedicatedInfoNas, + (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, + ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length); + ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); + LOG_I(RRC,"add NAS info with size %d (rab id %d)\n",ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length, i); + } + else { + LOG_W(RRC,"Not received activate dedicated EPS bearer context request\n"); + } + /* TODO parameters yet to process ... */ + { + // ue_context_pP->ue_context.e_rab[i].param.qos; + // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; + // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; + } + } + + } + + /* If list is empty free the list and reset the address */ + if (dedicatedInfoNASList != NULL) { + if (dedicatedInfoNASList->list.count == 0) { + free(dedicatedInfoNASList); + dedicatedInfoNASList = NULL; + LOG_W(RRC,"dedlicated NAS list is empty, free the list and reset the address\n"); + } + } else { + LOG_W(RRC,"dedlicated NAS list is empty\n"); + } + + memset(buffer, 0, RRC_BUF_SIZE); + + size = do_RRCConnectionReconfiguration(ctxt_pP, + buffer, + xid, + (SRB_ToAddModList_t*)NULL, + (DRB_ToAddModList_t*)*DRB_configList2, + (DRB_ToReleaseList_t*)NULL, // DRB2_list, + (struct SPS_Config*)NULL, // *sps_Config, + NULL, NULL, NULL, NULL,NULL, + NULL, NULL, NULL, NULL, NULL, NULL, + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList +#if defined(Rel10) || defined(Rel14) + , (SCellToAddMod_r10_t*)NULL +#endif + ); + + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n"); + for (i = 0; i < size; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); + } + LOG_F(RRC,"\n"); + //////////////////////////////////////// +#endif + +#if defined(ENABLE_ITTI) + + /* Free all NAS PDUs */ + for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { + if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { + /* Free the NAS PDU buffer and invalidate it */ + free(ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer); + ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL; + } + } +#endif + + LOG_I(RRC, + "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE RNTI %x)\n", + ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); + + LOG_D(RRC, + "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", + ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" dedicated rrcConnectionReconfiguration UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_eNB_mui, + size); + + rrc_data_req( + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + + +} +int +rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + const uint8_t ho_state + ) +//----------------------------------------------------------------------------- +{ + uint8_t buffer[RRC_BUF_SIZE]; + uint16_t size; + int i, j; + + struct DRB_ToAddMod *DRB_config = NULL; + struct RLC_Config *DRB_rlc_config = NULL; + struct PDCP_Config *DRB_pdcp_config = NULL; + struct PDCP_Config__rlc_AM *PDCP_rlc_AM = NULL; + struct PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; + struct LogicalChannelConfig *DRB_lchan_config = NULL; + struct LogicalChannelConfig__ul_SpecificParameters + *DRB_ul_SpecificParameters = NULL; + DRB_ToAddModList_t* DRB_configList = ue_context_pP->ue_context.DRB_configList; + DRB_ToAddModList_t* DRB_configList2 = NULL; + + struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; + DedicatedInfoNAS_t *dedicatedInfoNas = NULL; + /* for no gcc warnings */ + (void)dedicatedInfoNas; + + uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); // Transaction_id, + DRB_configList2 = CALLOC(1, sizeof(*DRB_configList2)); + /* Initialize NAS list */ + dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); + + for (i = 0; i < ue_context_pP->ue_context.nb_of_modify_e_rabs; i++) { + // bypass the new and already configured erabs + if (ue_context_pP->ue_context.modify_e_rab[i].status >= E_RAB_STATUS_DONE) { + ue_context_pP->ue_context.modify_e_rab[i].xid = xid; + continue; + } + + if (ue_context_pP->ue_context.modify_e_rab[i].cause != S1AP_CAUSE_NOTHING) { + // set xid of failure RAB + ue_context_pP->ue_context.modify_e_rab[i].xid = xid; + ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_FAILED; + continue; + } + + DRB_config = NULL; + // search exist DRB_config + for (j = 0; j < DRB_configList->list.count; j++) { + if((uint8_t)*(DRB_configList->list.array[j]->eps_BearerIdentity) == ue_context_pP->ue_context.modify_e_rab[i].param.e_rab_id) { + DRB_config = DRB_configList->list.array[j]; + break; + } + } + if (NULL == DRB_config) { + ue_context_pP->ue_context.modify_e_rab[i].xid = xid; + ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_FAILED; + // TODO use which cause + ue_context_pP->ue_context.modify_e_rab[i].cause = S1AP_CAUSE_RADIO_NETWORK; + ue_context_pP->ue_context.modify_e_rab[i].cause_value = 0;//S1ap_CauseRadioNetwork_unspecified; + ue_context_pP->ue_context.nb_of_failed_e_rabs++; + continue; + } + + DRB_rlc_config = DRB_config->rlc_Config; + + DRB_pdcp_config = DRB_config->pdcp_Config; + *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity; + switch (ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci) { + /* + * type: realtime data with medium packer error rate + * action: swtich to RLC UM + */ + case 1: // 100ms, 10^-2, p2, GBR + case 2: // 150ms, 10^-3, p4, GBR + case 3: // 50ms, 10^-3, p3, GBR + case 4: // 300ms, 10^-6, p5 + case 7: // 100ms, 10^-3, p7, GBR + case 9: // 300ms, 10^-6, p9 + case 65: // 75ms, 10^-2, p0.7, mission critical voice, GBR + case 66: // 100ms, 10^-2, p2, non-mission critical voice , GBR + // RLC + DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; + DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; + // PDCP + if (DRB_pdcp_config->rlc_AM) { + free(DRB_pdcp_config->rlc_AM); + DRB_pdcp_config->rlc_AM = NULL; + } + if (DRB_pdcp_config->rlc_UM) { + free(DRB_pdcp_config->rlc_UM); + DRB_pdcp_config->rlc_UM = NULL; + } + PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); + DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; + PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; + break; + + /* + * type: non-realtime data with low packer error rate + * action: swtich to RLC AM + */ + case 5: // 100ms, 10^-6, p1 , IMS signaling + case 6: // 300ms, 10^-6, p6 + case 8: // 300ms, 10^-6, p8 + case 69: // 60ms, 10^-6, p0.5, mission critical delay sensitive data, Lowest Priority + case 70: // 200ms, 10^-6, p5.5, mision critical data + // RLC + DRB_rlc_config->present = RLC_Config_PR_am; + DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50; + DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16; + DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; + DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; + DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; + DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25; + + // PDCP + if (DRB_pdcp_config->rlc_AM) { + free(DRB_pdcp_config->rlc_AM); + DRB_pdcp_config->rlc_AM = NULL; + } + if (DRB_pdcp_config->rlc_UM) { + free(DRB_pdcp_config->rlc_UM); + DRB_pdcp_config->rlc_UM = NULL; + } + PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); + DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; + PDCP_rlc_AM->statusReportRequired = FALSE; + + break; + default : + LOG_E(RRC, "not supported qci %d\n", ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci); + ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_FAILED; + ue_context_pP->ue_context.modify_e_rab[i].xid = xid; + ue_context_pP->ue_context.modify_e_rab[i].cause = S1AP_CAUSE_RADIO_NETWORK; + ue_context_pP->ue_context.modify_e_rab[i].cause_value = 37;//S1ap_CauseRadioNetwork_not_supported_QCI_value; + ue_context_pP->ue_context.nb_of_failed_e_rabs++; + continue; + } + + DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; + + DRB_lchan_config = DRB_config->logicalChannelConfig; + DRB_ul_SpecificParameters = DRB_lchan_config->ul_SpecificParameters; + + if (ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci < 9 ) + DRB_ul_SpecificParameters->priority = qci_to_priority[ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci-1] + 3; + else + DRB_ul_SpecificParameters->priority= 4; + + DRB_ul_SpecificParameters->prioritisedBitRate = LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8; + + DRB_ul_SpecificParameters->bucketSizeDuration = + LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + + ASN_SEQUENCE_ADD(&(DRB_configList2)->list, DRB_config); + + LOG_I(RRC, "EPS ID %ld, DRB ID %ld (index %d), QCI %d, priority %ld, LCID %ld LCGID %ld \n", + *DRB_config->eps_BearerIdentity, + DRB_config->drb_Identity, i, + ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci, + DRB_ul_SpecificParameters->priority, + *(DRB_config->logicalChannelIdentity), + *DRB_ul_SpecificParameters->logicalChannelGroup + ); + + //e_rab_done++; + ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_DONE; + ue_context_pP->ue_context.modify_e_rab[i].xid = xid; + + { + if (ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer != NULL) { + dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); + memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); + OCTET_STRING_fromBuf(dedicatedInfoNas, + (char*)ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer, + ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.length); + ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); + LOG_I(RRC, "add NAS info with size %d (rab id %d)\n",ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.length, i); + } + else { + LOG_W(RRC, "Not received activate dedicated EPS bearer context request\n"); + } + } + } + + /* If list is empty free the list and reset the address */ + if (dedicatedInfoNASList != NULL) { + if (dedicatedInfoNASList->list.count == 0) { + free(dedicatedInfoNASList); + dedicatedInfoNASList = NULL; + LOG_W(RRC,"dedlicated NAS list is empty, free the list and reset the address\n"); + } + } else { + LOG_W(RRC,"dedlicated NAS list is empty\n"); + } + + memset(buffer, 0, RRC_BUF_SIZE); + + size = do_RRCConnectionReconfiguration(ctxt_pP, + buffer, + xid, + (SRB_ToAddModList_t*)NULL, + (DRB_ToAddModList_t*)DRB_configList2, + (DRB_ToReleaseList_t*)NULL, // DRB2_list, + (struct SPS_Config*)NULL, // *sps_Config, + NULL, NULL, NULL, NULL,NULL, + NULL, NULL, NULL, NULL, NULL, NULL, + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList +#if defined(Rel10) || defined(Rel14) + , (SCellToAddMod_r10_t*)NULL +#endif + ); + + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n"); + for (i = 0; i < size; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); + } + LOG_F(RRC,"\n"); + //////////////////////////////////////// +#endif + +#if defined(ENABLE_ITTI) + + /* Free all NAS PDUs */ + for (i = 0; i < ue_context_pP->ue_context.nb_of_modify_e_rabs; i++) { + if (ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer != NULL) { + /* Free the NAS PDU buffer and invalidate it */ + free(ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer); + ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer = NULL; + } + } +#endif + + LOG_I(RRC, + "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE RNTI %x)\n", + ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); + + LOG_D(RRC, + "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", + ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" dedicated rrcConnectionReconfiguration UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_eNB_mui, + size); + + rrc_data_req( + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + return 0; +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release( const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + uint8_t xid, + uint32_t nas_length, + uint8_t* nas_buffer) +//----------------------------------------------------------------------------- +{ + uint8_t buffer[RRC_BUF_SIZE]; + int i; + uint16_t size = 0; + DRB_ToReleaseList_t** DRB_Release_configList2=NULL; + DRB_Identity_t* DRB_release; + struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; + + DRB_Release_configList2=&ue_context_pP->ue_context.DRB_Release_configList2[xid]; + if (*DRB_Release_configList2) { + free(*DRB_Release_configList2); + } + *DRB_Release_configList2 = CALLOC(1, sizeof(**DRB_Release_configList2)); + + for(i = 0; i < NB_RB_MAX; i++){ + if((ue_context_pP->ue_context.e_rab[i].status == E_RAB_STATUS_TORELEASE) && ue_context_pP->ue_context.e_rab[i].xid == xid){ + DRB_release = CALLOC(1, sizeof(DRB_Identity_t)); + *DRB_release = i+1; + ASN_SEQUENCE_ADD(&(*DRB_Release_configList2)->list, DRB_release); + //free(DRB_release); + } + } + + /* If list is empty free the list and reset the address */ + if (nas_length > 0) { + DedicatedInfoNAS_t *dedicatedInfoNas = NULL; + dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); + dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); + memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); + OCTET_STRING_fromBuf(dedicatedInfoNas, + (char*)nas_buffer, + nas_length); + ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); + LOG_I(RRC,"add NAS info with size %d\n",nas_length); + } else { + LOG_W(RRC,"dedlicated NAS list is empty\n"); + } + + memset(buffer, 0, RRC_BUF_SIZE); + size = do_RRCConnectionReconfiguration(ctxt_pP, + buffer, + xid, + NULL, + NULL, + (DRB_ToReleaseList_t*)*DRB_Release_configList2, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + NULL, + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList +#if defined(Rel10) || defined(Rel14) + , (SCellToAddMod_r10_t*)NULL +#endif + ); + ue_context_pP->ue_context.e_rab_release_command_flag = 1; + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n"); + for (i = 0; i < size; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); + } + LOG_F(RRC,"\n"); + //////////////////////////////////////// +#endif + +#if defined(ENABLE_ITTI) + /* Free all NAS PDUs */ + if (nas_length > 0) { + /* Free the NAS PDU buffer and invalidate it */ + free(nas_buffer); + } +#endif + + LOG_I(RRC, + "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE RNTI %x)\n", + ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); + + LOG_D(RRC, + "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", + ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" dedicated rrcConnectionReconfiguration UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_eNB_mui, + size); + + rrc_data_req( + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + +} +#endif +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + const uint8_t ho_state + ) +//----------------------------------------------------------------------------- +{ + uint8_t buffer[RRC_BUF_SIZE]; + uint16_t size; + int i; + + // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE + eNB_RRC_INST* rrc_inst = RC.rrc[ctxt_pP->module_id]; + struct PhysicalConfigDedicated** physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; + + struct SRB_ToAddMod *SRB2_config = NULL; + struct SRB_ToAddMod__rlc_Config *SRB2_rlc_config = NULL; + struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config = NULL; + struct LogicalChannelConfig__ul_SpecificParameters + *SRB2_ul_SpecificParameters = NULL; + SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; + SRB_ToAddModList_t **SRB_configList2 = NULL; + + struct DRB_ToAddMod *DRB_config = NULL; + struct RLC_Config *DRB_rlc_config = NULL; + struct PDCP_Config *DRB_pdcp_config = NULL; + struct PDCP_Config__rlc_AM *PDCP_rlc_AM = NULL; + struct PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; + struct LogicalChannelConfig *DRB_lchan_config = NULL; + struct LogicalChannelConfig__ul_SpecificParameters + *DRB_ul_SpecificParameters = NULL; + DRB_ToAddModList_t** DRB_configList = &ue_context_pP->ue_context.DRB_configList; + DRB_ToAddModList_t** DRB_configList2 = NULL; + MAC_MainConfig_t *mac_MainConfig = NULL; + MeasObjectToAddModList_t *MeasObj_list = NULL; + MeasObjectToAddMod_t *MeasObj = NULL; + ReportConfigToAddModList_t *ReportConfig_list = NULL; + ReportConfigToAddMod_t *ReportConfig_per, *ReportConfig_A1, + *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; + MeasIdToAddModList_t *MeasId_list = NULL; + MeasIdToAddMod_t *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; +#if defined(Rel10) || defined(Rel14) + long *sr_ProhibitTimer_r9 = NULL; + // uint8_t sCellIndexToAdd = rrc_find_free_SCell_index(enb_mod_idP, ue_mod_idP, 1); + //uint8_t sCellIndexToAdd = 0; +#endif + + long *logicalchannelgroup, *logicalchannelgroup_drb; + long *maxHARQ_Tx, *periodicBSR_Timer; + + RSRP_Range_t *rsrp = NULL; + struct MeasConfig__speedStatePars *Sparams = NULL; + QuantityConfig_t *quantityConfig = NULL; + CellsToAddMod_t *CellToAdd = NULL; + CellsToAddModList_t *CellsToAddModList = NULL; + struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; + DedicatedInfoNAS_t *dedicatedInfoNas = NULL; + /* for no gcc warnings */ + (void)dedicatedInfoNas; + + C_RNTI_t *cba_RNTI = NULL; + + uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); //Transaction_id, + +#ifdef CBA + //struct PUSCH_CBAConfigDedicated_vlola *pusch_CBAConfigDedicated_vlola; + uint8_t *cba_RNTI_buf; + cba_RNTI = CALLOC(1, sizeof(C_RNTI_t)); + cba_RNTI_buf = CALLOC(1, 2 * sizeof(uint8_t)); + cba_RNTI->buf = cba_RNTI_buf; + cba_RNTI->size = 2; + cba_RNTI->bits_unused = 0; + + // associate UEs to the CBa groups as a function of their UE id + if (rrc_inst->num_active_cba_groups) { + cba_RNTI->buf[0] = rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups] & 0xff; + cba_RNTI->buf[1] = 0xff; + LOG_D(RRC, + "[eNB %d] Frame %d: cba_RNTI = %x in group %d is attribued to UE %d\n", + enb_mod_idP, frameP, + rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups], + ue_mod_idP % rrc_inst->num_active_cba_groups, ue_mod_idP); + } else { + cba_RNTI->buf[0] = 0x0; + cba_RNTI->buf[1] = 0x0; + LOG_D(RRC, "[eNB %d] Frame %d: no cba_RNTI is configured for UE %d\n", enb_mod_idP, frameP, ue_mod_idP); + } + +#endif + + T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + // Configure SRB2 + /// SRB2 + SRB_configList2=&ue_context_pP->ue_context.SRB_configList2[xid]; + if (*SRB_configList2) { + free(*SRB_configList2); + } + *SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2)); + memset(*SRB_configList2, 0, sizeof(**SRB_configList2)); + SRB2_config = CALLOC(1, sizeof(*SRB2_config)); + + SRB2_config->srb_Identity = 2; + SRB2_rlc_config = CALLOC(1, sizeof(*SRB2_rlc_config)); + SRB2_config->rlc_Config = SRB2_rlc_config; + + SRB2_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; + SRB2_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t32; + SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; + SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; + + SRB2_lchan_config = CALLOC(1, sizeof(*SRB2_lchan_config)); + SRB2_config->logicalChannelConfig = SRB2_lchan_config; + + SRB2_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; + + SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters)); + + SRB2_ul_SpecificParameters->priority = 3; // let some priority for SRB1 and dedicated DRBs + SRB2_ul_SpecificParameters->prioritisedBitRate = + LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + SRB2_ul_SpecificParameters->bucketSizeDuration = + LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + + // LCG for CCCH and DCCH is 0 as defined in 36331 + logicalchannelgroup = CALLOC(1, sizeof(long)); + *logicalchannelgroup = 0; + + SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; + + SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters; + // this list has the configuration for SRB1 and SRB2 + ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); + // this list has only the configuration for SRB2 + ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config); + + // Configure DRB + //*DRB_configList = CALLOC(1, sizeof(*DRB_configList)); + // list for all the configured DRB + if (*DRB_configList) { + free(*DRB_configList); + } + *DRB_configList = CALLOC(1, sizeof(**DRB_configList)); + memset(*DRB_configList, 0, sizeof(**DRB_configList)); + + // list for the configured DRB for a this xid + DRB_configList2=&ue_context_pP->ue_context.DRB_configList2[xid]; + if (*DRB_configList2) { + free(*DRB_configList2); + } + *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); + memset(*DRB_configList2, 0, sizeof(**DRB_configList2)); + + + /// DRB + DRB_config = CALLOC(1, sizeof(*DRB_config)); + + DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long)); + *(DRB_config->eps_BearerIdentity) = 5L; // LW set to first value, allowed value 5..15, value : x+4 + // DRB_config->drb_Identity = (DRB_Identity_t) 1; //allowed values 1..32 + // NN: this is the 1st DRB for this ue, so set it to 1 + DRB_config->drb_Identity = (DRB_Identity_t) 1; // (ue_mod_idP+1); //allowed values 1..32, value: x + DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long)); + *(DRB_config->logicalChannelIdentity) = (long)3; // value : x+2 + DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config)); + DRB_config->rlc_Config = DRB_rlc_config; + +#ifdef RRC_DEFAULT_RAB_IS_AM + DRB_rlc_config->present = RLC_Config_PR_am; + DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50; + DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16; + DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; + DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; + DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; + DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25; +#else + DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; + DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; +#ifdef CBA + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms5;//T_Reordering_ms25; +#else + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; +#endif +#endif + + DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); + DRB_config->pdcp_Config = DRB_pdcp_config; + DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long)); + *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity; + DRB_pdcp_config->rlc_AM = NULL; + DRB_pdcp_config->rlc_UM = NULL; + + /* avoid gcc warnings */ + (void)PDCP_rlc_AM; + (void)PDCP_rlc_UM; + +#ifdef RRC_DEFAULT_RAB_IS_AM // EXMIMO_IOT + PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); + DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; + PDCP_rlc_AM->statusReportRequired = FALSE; +#else + PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); + DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; + PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; +#endif + DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; + + DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config)); + DRB_config->logicalChannelConfig = DRB_lchan_config; + DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); + DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; + + DRB_ul_SpecificParameters->priority = 12; // lower priority than srb1, srb2 and other dedicated bearer + DRB_ul_SpecificParameters->prioritisedBitRate =LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ; + //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + DRB_ul_SpecificParameters->bucketSizeDuration = + LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + + // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM) + logicalchannelgroup_drb = CALLOC(1, sizeof(long)); + *logicalchannelgroup_drb = 1; + DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; + + ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config); + ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config); + + //ue_context_pP->ue_context.DRB_configList2[0] = &(*DRB_configList); + + mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig)); + ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig; + + mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config)); + + maxHARQ_Tx = CALLOC(1, sizeof(long)); + *maxHARQ_Tx = MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; + mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx; + periodicBSR_Timer = CALLOC(1, sizeof(long)); + *periodicBSR_Timer = PeriodicBSR_Timer_r12_sf64; + mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer; + mac_MainConfig->ul_SCH_Config->retxBSR_Timer = RetxBSR_Timer_r12_sf320; + mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE + + mac_MainConfig->timeAlignmentTimerDedicated = TimeAlignmentTimer_infinity; + + mac_MainConfig->drx_Config = NULL; + + mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config)); + + mac_MainConfig->phr_Config->present = MAC_MainConfig__phr_Config_PR_setup; + mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes + + mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes + + mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB + +#if defined(Rel10) || defined(Rel14) + sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long)); + *sr_ProhibitTimer_r9 = 0; // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR + mac_MainConfig->ext1 = CALLOC(1, sizeof(struct MAC_MainConfig__ext1)); + mac_MainConfig->ext1->sr_ProhibitTimer_r9 = sr_ProhibitTimer_r9; + //sps_RA_ConfigList_rlola = NULL; +#endif + + //change the transmission mode for the primary component carrier + //TODO: add codebook subset restriction here + //TODO: change TM for secondary CC in SCelltoaddmodlist + if (*physicalConfigDedicated) { + if ((*physicalConfigDedicated)->antennaInfo) { + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.transmissionMode = rrc_inst->configuration.ue_TransmissionMode[0]; + LOG_D(RRC,"Setting transmission mode to %ld+1\n",rrc_inst->configuration.ue_TransmissionMode[0]); + if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm3) { + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6; + } + else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) { + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2; + + } + else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) { + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4; + } + else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6) { + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4; + } + } + else { + LOG_E(RRC,"antenna_info not present in physical_config_dedicated. Not reconfiguring!\n"); + } + if ((*physicalConfigDedicated)->cqi_ReportConfig) { + if ((rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) || + (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) || + (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6)) { + //feedback mode needs to be set as well + //TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable + printf("setting cqi reporting mode to rm31\n"); +#if defined(Rel10) || defined(Rel14) + *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportModeAperiodic_rm31; +#else + *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportConfig__cqi_ReportModeAperiodic_rm31; // HLC CQI, no PMI +#endif + } + } + else { + LOG_E(RRC,"cqi_ReportConfig not present in physical_config_dedicated. Not reconfiguring!\n"); + } + } + else { + LOG_E(RRC,"physical_config_dedicated not present in RRCConnectionReconfiguration. Not reconfiguring!\n"); + } + + // Measurement ID list + MeasId_list = CALLOC(1, sizeof(*MeasId_list)); + memset((void *)MeasId_list, 0, sizeof(*MeasId_list)); + + MeasId0 = CALLOC(1, sizeof(*MeasId0)); + MeasId0->measId = 1; + MeasId0->measObjectId = 1; + MeasId0->reportConfigId = 1; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0); + + MeasId1 = CALLOC(1, sizeof(*MeasId1)); + MeasId1->measId = 2; + MeasId1->measObjectId = 1; + MeasId1->reportConfigId = 2; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1); + + MeasId2 = CALLOC(1, sizeof(*MeasId2)); + MeasId2->measId = 3; + MeasId2->measObjectId = 1; + MeasId2->reportConfigId = 3; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2); + + MeasId3 = CALLOC(1, sizeof(*MeasId3)); + MeasId3->measId = 4; + MeasId3->measObjectId = 1; + MeasId3->reportConfigId = 4; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3); + + MeasId4 = CALLOC(1, sizeof(*MeasId4)); + MeasId4->measId = 5; + MeasId4->measObjectId = 1; + MeasId4->reportConfigId = 5; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4); + + MeasId5 = CALLOC(1, sizeof(*MeasId5)); + MeasId5->measId = 6; + MeasId5->measObjectId = 1; + MeasId5->reportConfigId = 6; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5); + + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; + + // Add one EUTRA Measurement Object + MeasObj_list = CALLOC(1, sizeof(*MeasObj_list)); + memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list)); + + // Configure MeasObject + + MeasObj = CALLOC(1, sizeof(*MeasObj)); + memset((void *)MeasObj, 0, sizeof(*MeasObj)); + + MeasObj->measObjectId = 1; + MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA; + MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 3350; //band 7, 2.68GHz + //MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; //band 33, 1.909GHz + MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25; + MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t)); + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6; + MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB + + MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = + (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); + + CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; + + // Add adjacent cell lists (6 per eNB) + for (i = 0; i < 6; i++) { + CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd)); + CellToAdd->cellIndex = i + 1; + CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i); + CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0; + + ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd); + } + + ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj); + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; + + // Report Configurations for periodical, A1-A5 events + ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list)); + + ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); + + ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1)); + + ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2)); + + ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3)); + + ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4)); + + ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5)); + + ReportConfig_per->reportConfigId = 1; + ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_periodical; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose = + ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); + + ReportConfig_A1->reportConfigId = 2; + ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. + a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. + a1_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1); + + if (ho_state == 1 /*HO_MEASURMENT */ ) { + LOG_I(RRC, "[eNB %d] frame %d: requesting A2, A3, A4, A5, and A6 event reporting\n", + ctxt_pP->module_id, ctxt_pP->frame); + ReportConfig_A2->reportConfigId = 3; + ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA2.a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA2.a2_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = + ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2); + + ReportConfig_A3->reportConfigId = 4; + ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; + + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = 1; //10; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA3.reportOnLeave = 1; + + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = + ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.hysteresis = 0.5; // FIXME ...hysteresis is of type long! + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger = + TimeToTrigger_ms40; + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3); + + ReportConfig_A4->reportConfigId = 5; + ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA4.a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA4.a4_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = + ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4); + + ReportConfig_A5->reportConfigId = 6; + ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold1.choice.threshold_RSRP = 10; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold2.choice.threshold_RSRP = 10; + + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = + ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5); + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; + + rsrp = CALLOC(1, sizeof(RSRP_Range_t)); + *rsrp = 20; + + Sparams = CALLOC(1, sizeof(*Sparams)); + Sparams->present = MeasConfig__speedStatePars_PR_setup; + Sparams->choice.setup.timeToTrigger_SF.sf_High = SpeedStateScaleFactors__sf_Medium_oDot75; + Sparams->choice.setup.timeToTrigger_SF.sf_Medium = SpeedStateScaleFactors__sf_High_oDot5; + Sparams->choice.setup.mobilityStateParameters.n_CellChangeHigh = 10; + Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5; + Sparams->choice.setup.mobilityStateParameters.t_Evaluation = MobilityStateParameters__t_Evaluation_s60; + Sparams->choice.setup.mobilityStateParameters.t_HystNormal = MobilityStateParameters__t_HystNormal_s120; + + quantityConfig = CALLOC(1, sizeof(*quantityConfig)); + memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); + quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct QuantityConfigEUTRA)); + memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA)); + quantityConfig->quantityConfigCDMA2000 = NULL; + quantityConfig->quantityConfigGERAN = NULL; + quantityConfig->quantityConfigUTRA = NULL; + quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = + CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP))); + quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = + CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ))); + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4; + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4; + + LOG_I(RRC, + "[eNB %d] Frame %d: potential handover preparation: store the information in an intermediate structure in case of failure\n", + ctxt_pP->module_id, ctxt_pP->frame); + // store the information in an intermediate structure for Hanodver management + //rrc_inst->handover_info.as_config.sourceRadioResourceConfig.srb_ToAddModList = CALLOC(1,sizeof()); + ue_context_pP->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_pP->ue_context.handover_info))); + //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.srb_ToAddModList,(void *)SRB_list,sizeof(SRB_ToAddModList_t)); + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.srb_ToAddModList = *SRB_configList2; + //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.drb_ToAddModList,(void *)DRB_list,sizeof(DRB_ToAddModList_t)); + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList = *DRB_configList; + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL; + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig = + CALLOC(1, sizeof(*ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig)); + memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, + (void *)mac_MainConfig, sizeof(MAC_MainConfig_t)); + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated = + CALLOC(1, sizeof(PhysicalConfigDedicated_t)); + memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, + (void*)ue_context_pP->ue_context.physicalConfigDedicated, sizeof(PhysicalConfigDedicated_t)); + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.sps_Config = NULL; + //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config,(void *)rrc_inst->sps_Config[ue_mod_idP],sizeof(SPS_Config_t)); + + } + +#if defined(ENABLE_ITTI) + /* Initialize NAS list */ + dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); + + /* Add all NAS PDUs to the list */ + for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { + if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { + dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); + memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); + OCTET_STRING_fromBuf(dedicatedInfoNas, + (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, + ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length); + ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); + } + + /* TODO parameters yet to process ... */ + { + // ue_context_pP->ue_context.e_rab[i].param.qos; + // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; + // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; + } + + /* TODO should test if e RAB are Ok before! */ + ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; + LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", + i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE"); + } + + /* If list is empty free the list and reset the address */ + if (dedicatedInfoNASList->list.count == 0) { + free(dedicatedInfoNASList); + dedicatedInfoNASList = NULL; + } + +#endif + + memset(buffer, 0, RRC_BUF_SIZE); + + size = do_RRCConnectionReconfiguration(ctxt_pP, + buffer, + xid, //Transaction_id, + (SRB_ToAddModList_t*)*SRB_configList2, // SRB_configList + (DRB_ToAddModList_t*)*DRB_configList, + (DRB_ToReleaseList_t*)NULL, // DRB2_list, + (struct SPS_Config*)NULL, // *sps_Config, + (struct PhysicalConfigDedicated*)*physicalConfigDedicated, +#ifdef EXMIMO_IOT + NULL, NULL, NULL,NULL, +#else + (MeasObjectToAddModList_t*)MeasObj_list, + (ReportConfigToAddModList_t*)ReportConfig_list, + (QuantityConfig_t*)quantityConfig, + (MeasIdToAddModList_t*)MeasId_list, +#endif + (MAC_MainConfig_t*)mac_MainConfig, + (MeasGapConfig_t*)NULL, + (MobilityControlInfo_t*)NULL, + (struct MeasConfig__speedStatePars*)Sparams, + (RSRP_Range_t*)rsrp, + (C_RNTI_t*)cba_RNTI, + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList +#if defined(Rel10) || defined(Rel14) + , (SCellToAddMod_r10_t*)NULL +#endif + ); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n"); + for (i = 0; i < size; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); + } + LOG_F(RRC,"\n"); + //////////////////////////////////////// +#endif + +#if defined(ENABLE_ITTI) + + /* Free all NAS PDUs */ + for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { + if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { + /* Free the NAS PDU buffer and invalidate it */ + free(ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer); + ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL; + } + } + +#endif + + LOG_I(RRC, + "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n", + ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); + + LOG_D(RRC, + "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", + ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_eNB_mui, + size); + + rrc_data_req( + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); +} + +//----------------------------------------------------------------------------- +void +flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + const uint8_t ho_state, + agent_reconf_rrc * trig_param + ) +//----------------------------------------------------------------------------- +{ + uint8_t buffer[RRC_BUF_SIZE]; + uint16_t size; + int i; + + // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE + eNB_RRC_INST* rrc_inst = RC.rrc[ctxt_pP->module_id]; + struct PhysicalConfigDedicated** physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; + + struct SRB_ToAddMod *SRB2_config = NULL; + struct SRB_ToAddMod__rlc_Config *SRB2_rlc_config = NULL; + struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config = NULL; + struct LogicalChannelConfig__ul_SpecificParameters + *SRB2_ul_SpecificParameters = NULL; + SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; + SRB_ToAddModList_t **SRB_configList2 = NULL; + + struct DRB_ToAddMod *DRB_config = NULL; + struct RLC_Config *DRB_rlc_config = NULL; + struct PDCP_Config *DRB_pdcp_config = NULL; + struct PDCP_Config__rlc_AM *PDCP_rlc_AM = NULL; + struct PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; + struct LogicalChannelConfig *DRB_lchan_config = NULL; + struct LogicalChannelConfig__ul_SpecificParameters + *DRB_ul_SpecificParameters = NULL; + DRB_ToAddModList_t** DRB_configList = &ue_context_pP->ue_context.DRB_configList; + DRB_ToAddModList_t** DRB_configList2 = NULL; + MAC_MainConfig_t *mac_MainConfig = NULL; + MeasObjectToAddModList_t *MeasObj_list = NULL; + MeasObjectToAddMod_t *MeasObj = NULL; + ReportConfigToAddModList_t *ReportConfig_list = NULL; + ReportConfigToAddMod_t *ReportConfig_per;//, *ReportConfig_A1, + // *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; + MeasIdToAddModList_t *MeasId_list = NULL; + MeasIdToAddMod_t *MeasId0; //, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; +#if Rel10 + long *sr_ProhibitTimer_r9 = NULL; + // uint8_t sCellIndexToAdd = rrc_find_free_SCell_index(enb_mod_idP, ue_mod_idP, 1); + //uint8_t sCellIndexToAdd = 0; +#endif + + long *logicalchannelgroup, *logicalchannelgroup_drb; + long *maxHARQ_Tx, *periodicBSR_Timer; + + RSRP_Range_t *rsrp = NULL; + struct MeasConfig__speedStatePars *Sparams = NULL; + QuantityConfig_t *quantityConfig = NULL; + CellsToAddMod_t *CellToAdd = NULL; + CellsToAddModList_t *CellsToAddModList = NULL; + struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; + DedicatedInfoNAS_t *dedicatedInfoNas = NULL; + /* for no gcc warnings */ + (void)dedicatedInfoNas; + + C_RNTI_t *cba_RNTI = NULL; + + uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); //Transaction_id, + +#ifdef CBA + //struct PUSCH_CBAConfigDedicated_vlola *pusch_CBAConfigDedicated_vlola; + uint8_t *cba_RNTI_buf; + cba_RNTI = CALLOC(1, sizeof(C_RNTI_t)); + cba_RNTI_buf = CALLOC(1, 2 * sizeof(uint8_t)); + cba_RNTI->buf = cba_RNTI_buf; + cba_RNTI->size = 2; + cba_RNTI->bits_unused = 0; + + // associate UEs to the CBa groups as a function of their UE id + if (rrc_inst->num_active_cba_groups) { + cba_RNTI->buf[0] = rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups] & 0xff; + cba_RNTI->buf[1] = 0xff; + LOG_D(RRC, + "[eNB %d] Frame %d: cba_RNTI = %x in group %d is attribued to UE %d\n", + enb_mod_idP, frameP, + rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups], + ue_mod_idP % rrc_inst->num_active_cba_groups, ue_mod_idP); + } else { + cba_RNTI->buf[0] = 0x0; + cba_RNTI->buf[1] = 0x0; + LOG_D(RRC, "[eNB %d] Frame %d: no cba_RNTI is configured for UE %d\n", enb_mod_idP, frameP, ue_mod_idP); + } + +#endif + + T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + // Configure SRB2 + /// SRB2 + SRB_configList2=&ue_context_pP->ue_context.SRB_configList2[xid]; + if (*SRB_configList2) { + free(*SRB_configList2); + } + *SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2)); + memset(*SRB_configList2, 0, sizeof(**SRB_configList2)); + SRB2_config = CALLOC(1, sizeof(*SRB2_config)); + + SRB2_config->srb_Identity = 2; + SRB2_rlc_config = CALLOC(1, sizeof(*SRB2_rlc_config)); + SRB2_config->rlc_Config = SRB2_rlc_config; + + SRB2_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; + SRB2_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t32; + SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; + SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; + + SRB2_lchan_config = CALLOC(1, sizeof(*SRB2_lchan_config)); + SRB2_config->logicalChannelConfig = SRB2_lchan_config; + + SRB2_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; + + SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters)); + + SRB2_ul_SpecificParameters->priority = 3; // let some priority for SRB1 and dedicated DRBs + SRB2_ul_SpecificParameters->prioritisedBitRate = + LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + SRB2_ul_SpecificParameters->bucketSizeDuration = + LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + + // LCG for CCCH and DCCH is 0 as defined in 36331 + logicalchannelgroup = CALLOC(1, sizeof(long)); + *logicalchannelgroup = 0; + + SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; + + SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters; + // this list has the configuration for SRB1 and SRB2 + ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); + // this list has only the configuration for SRB2 + ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config); + + // Configure DRB + //*DRB_configList = CALLOC(1, sizeof(*DRB_configList)); + // list for all the configured DRB + if (*DRB_configList) { + free(*DRB_configList); + } + *DRB_configList = CALLOC(1, sizeof(**DRB_configList)); + memset(*DRB_configList, 0, sizeof(**DRB_configList)); + + // list for the configured DRB for a this xid + DRB_configList2=&ue_context_pP->ue_context.DRB_configList2[xid]; + if (*DRB_configList2) { + free(*DRB_configList2); + } + *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); + memset(*DRB_configList2, 0, sizeof(**DRB_configList2)); + + + /// DRB + DRB_config = CALLOC(1, sizeof(*DRB_config)); + + DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long)); + *(DRB_config->eps_BearerIdentity) = 5L; // LW set to first value, allowed value 5..15, value : x+4 + // DRB_config->drb_Identity = (DRB_Identity_t) 1; //allowed values 1..32 + // NN: this is the 1st DRB for this ue, so set it to 1 + DRB_config->drb_Identity = (DRB_Identity_t) 1; // (ue_mod_idP+1); //allowed values 1..32, value: x + DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long)); + *(DRB_config->logicalChannelIdentity) = (long)3; // value : x+2 + DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config)); + DRB_config->rlc_Config = DRB_rlc_config; + +#ifdef RRC_DEFAULT_RAB_IS_AM + DRB_rlc_config->present = RLC_Config_PR_am; + DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50; + DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16; + DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; + DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; + DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; + DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25; +#else + DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; + DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; +#ifdef CBA + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms5;//T_Reordering_ms25; +#else + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; +#endif +#endif + + DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); + DRB_config->pdcp_Config = DRB_pdcp_config; + DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long)); + *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity; + DRB_pdcp_config->rlc_AM = NULL; + DRB_pdcp_config->rlc_UM = NULL; + + /* avoid gcc warnings */ + (void)PDCP_rlc_AM; + (void)PDCP_rlc_UM; + +#ifdef RRC_DEFAULT_RAB_IS_AM // EXMIMO_IOT + PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); + DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; + PDCP_rlc_AM->statusReportRequired = FALSE; +#else + PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); + DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; + PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; +#endif + DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; + + DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config)); + DRB_config->logicalChannelConfig = DRB_lchan_config; + DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); + DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; + + DRB_ul_SpecificParameters->priority = 12; // lower priority than srb1, srb2 and other dedicated bearer + DRB_ul_SpecificParameters->prioritisedBitRate =LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ; + //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + DRB_ul_SpecificParameters->bucketSizeDuration = + LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + + // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM) + logicalchannelgroup_drb = CALLOC(1, sizeof(long)); + *logicalchannelgroup_drb = 1; + DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; + + ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config); + ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config); + + //ue_context_pP->ue_context.DRB_configList2[0] = &(*DRB_configList); + + mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig)); + // ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig; + + mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config)); + + maxHARQ_Tx = CALLOC(1, sizeof(long)); + *maxHARQ_Tx = MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; + mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx; + periodicBSR_Timer = CALLOC(1, sizeof(long)); + *periodicBSR_Timer = PeriodicBSR_Timer_r12_sf64; + mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer; + mac_MainConfig->ul_SCH_Config->retxBSR_Timer = RetxBSR_Timer_r12_sf320; + mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE + + mac_MainConfig->timeAlignmentTimerDedicated = TimeAlignmentTimer_infinity; + + mac_MainConfig->drx_Config = NULL; + + mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config)); + + mac_MainConfig->phr_Config->present = MAC_MainConfig__phr_Config_PR_setup; + mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes + + mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes + + mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB + +#ifdef Rel10 + sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long)); + *sr_ProhibitTimer_r9 = 0; // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR + mac_MainConfig->ext1 = CALLOC(1, sizeof(struct MAC_MainConfig__ext1)); + mac_MainConfig->ext1->sr_ProhibitTimer_r9 = sr_ProhibitTimer_r9; + //sps_RA_ConfigList_rlola = NULL; +#endif + + //change the transmission mode for the primary component carrier + //TODO: add codebook subset restriction here + //TODO: change TM for secondary CC in SCelltoaddmodlist + if (*physicalConfigDedicated) { + if ((*physicalConfigDedicated)->antennaInfo) { + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.transmissionMode = rrc_inst->configuration.ue_TransmissionMode[0]; + LOG_D(RRC,"Setting transmission mode to %ld+1\n",rrc_inst->configuration.ue_TransmissionMode[0]); + if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm3) { + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6; + } + else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) { + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2; + + } + else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) { + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4; + } + else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6) { + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= + CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1); + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1; + (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4; + } + } + else { + LOG_E(RRC,"antenna_info not present in physical_config_dedicated. Not reconfiguring!\n"); + } + if ((*physicalConfigDedicated)->cqi_ReportConfig) { + if ((rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) || + (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) || + (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6)) { + //feedback mode needs to be set as well + //TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable + printf("setting cqi reporting mode to rm31\n"); +#if defined(Rel10) || defined(Rel14) + *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportModeAperiodic_rm31; +#else + *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportConfig__cqi_ReportModeAperiodic_rm31; // HLC CQI, no PMI +#endif + } + } + else { + LOG_E(RRC,"cqi_ReportConfig not present in physical_config_dedicated. Not reconfiguring!\n"); + } + } + else { + LOG_E(RRC,"physical_config_dedicated not present in RRCConnectionReconfiguration. Not reconfiguring!\n"); + } + + // Measurement ID list + MeasId_list = CALLOC(1, sizeof(*MeasId_list)); + memset((void *)MeasId_list, 0, sizeof(*MeasId_list)); + + MeasId0 = CALLOC(1, sizeof(*MeasId0)); + MeasId0->measId = 1; + MeasId0->measObjectId = 1; + MeasId0->reportConfigId = 1; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0); + + /* + * Add one EUTRA Measurement Object + */ + + MeasObj_list = CALLOC(1, sizeof(*MeasObj_list)); + memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list)); + + // Configure MeasObject + + MeasObj = CALLOC(1, sizeof(*MeasObj)); + memset((void *)MeasObj, 0, sizeof(*MeasObj)); + + MeasObj->measObjectId = 1; + MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA; + MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 3350; //band 7, 2.68GHz + //MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; //band 33, 1.909GHz + MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25; + MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t)); + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6; + MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB + + MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = + (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); + + CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; + + // Add adjacent cell lists (6 per eNB) + for (i = 0; i < 6; i++) { + CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd)); + CellToAdd->cellIndex = i + 1; + CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i); + CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0; + + ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd); + } + + ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj); + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; + + // Report Configurations for periodical, A1-A5 events + + /* RRC Strategy Measurement */ + + + if (strcmp("one_shot", trig_param->trigger_policy) == 0){ + + trig_param->report_interval = 0; + trig_param->report_amount = 0; + + } + + else if (strcmp("event_driven", trig_param->trigger_policy) == 0){ + + trig_param->report_interval = 6; + trig_param->report_amount = 2; + + } + + else if (strcmp("periodical", trig_param->trigger_policy) == 0){ + + trig_param->report_interval = 1; + trig_param->report_amount = 7; + + } + + else { + + LOG_E(FLEXRAN_AGENT, "There is something wrong on RRC agent!"); + } + + + + ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list)); + + ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); + + // Periodical Measurement Report + + ReportConfig_per->reportConfigId = 1; + ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_periodical; + + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose = + ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; + + // ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger = TimeToTrigger_ms40; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = trig_param->report_interval ;//ReportInterval_ms2048; // RRC counter frame- ms1024 is 1ms + + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = trig_param->report_amount; //ReportConfigEUTRA__reportAmount_r2; // put r1 to see once, r2 for 2 times and ... + + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); + + + + quantityConfig = CALLOC(1, sizeof(*quantityConfig)); + memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); + quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct QuantityConfigEUTRA)); + memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA)); + quantityConfig->quantityConfigCDMA2000 = NULL; + quantityConfig->quantityConfigGERAN = NULL; + quantityConfig->quantityConfigUTRA = NULL; + quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = + CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP))); + quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = + CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ))); + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4; + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4; + + +#if defined(ENABLE_ITTI) + /* Initialize NAS list */ + dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); + + /* Add all NAS PDUs to the list */ + for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { + if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { + dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); + memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); + OCTET_STRING_fromBuf(dedicatedInfoNas, + (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, + ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length); + ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); + } + + /* TODO parameters yet to process ... */ + // { + // ue_context_pP->ue_context.e_rab[i].param.qos; + // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; + // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; + // } + + /* TODO should test if e RAB are Ok before! */ + ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; + LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", + i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE"); + } + + /* If list is empty free the list and reset the address */ + if (dedicatedInfoNASList->list.count == 0) { + free(dedicatedInfoNASList); + dedicatedInfoNASList = NULL; + } + +#endif + + memset(buffer, 0, RRC_BUF_SIZE); + + size = do_RRCConnectionReconfiguration(ctxt_pP, + buffer, + xid, //Transaction_id, + (SRB_ToAddModList_t*)NULL, // SRB_configList + (DRB_ToAddModList_t*)NULL, + (DRB_ToReleaseList_t*)NULL, // DRB2_list, + (struct SPS_Config*)NULL, // *sps_Config, + (struct PhysicalConfigDedicated*)*physicalConfigDedicated, +// #ifdef EXMIMO_IOT +// NULL, NULL, NULL,NULL, +// #else + (MeasObjectToAddModList_t*)MeasObj_list, + (ReportConfigToAddModList_t*)ReportConfig_list, + (QuantityConfig_t*)quantityConfig, + (MeasIdToAddModList_t*)MeasId_list, +// #endif + (MAC_MainConfig_t*)mac_MainConfig, + (MeasGapConfig_t*)NULL, + (MobilityControlInfo_t*)NULL, + (struct MeasConfig__speedStatePars*)Sparams, + (RSRP_Range_t*)rsrp, + (C_RNTI_t*)cba_RNTI, + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList +#if defined(Rel10) || defined(Rel14) + , (SCellToAddMod_r10_t*)NULL +#endif + ); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n"); + for (i = 0; i < size; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); + } + LOG_F(RRC,"\n"); + //////////////////////////////////////// +#endif + +#if defined(ENABLE_ITTI) + + /* Free all NAS PDUs */ + for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { + if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { + /* Free the NAS PDU buffer and invalidate it */ + free(ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer); + ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL; + } + } + +#endif + + LOG_I(RRC, + "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n", + ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); + + LOG_D(RRC, + "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", + ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_eNB_mui, + size); + + rrc_data_req( + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); +} + + +//----------------------------------------------------------------------------- +int +rrc_eNB_generate_RRCConnectionReconfiguration_SCell( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + uint32_t dl_CarrierFreq_r10 +) +//----------------------------------------------------------------------------- +{ + + uint8_t size; + uint8_t buffer[100]; + +#if defined(Rel10) || defined(Rel14) + uint8_t sCellIndexToAdd = 0; //one SCell so far + + // uint8_t sCellIndexToAdd; + // sCellIndexToAdd = rrc_find_free_SCell_index(enb_mod_idP, ue_mod_idP, 1); + // if (RC.rrc[enb_mod_idP]->sCell_config[ue_mod_idP][sCellIndexToAdd] ) { + if (ue_context_pP->ue_context.sCell_config != NULL) { + ue_context_pP->ue_context.sCell_config[sCellIndexToAdd].cellIdentification_r10->dl_CarrierFreq_r10 = dl_CarrierFreq_r10; + } else { + LOG_E(RRC,"Scell not configured!\n"); + return(-1); + } + +#endif + size = do_RRCConnectionReconfiguration(ctxt_pP, + buffer, + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),//Transaction_id, + (SRB_ToAddModList_t*)NULL, + (DRB_ToAddModList_t*)NULL, + (DRB_ToReleaseList_t*)NULL, + (struct SPS_Config*)NULL, + (struct PhysicalConfigDedicated*)NULL, + (MeasObjectToAddModList_t*)NULL, + (ReportConfigToAddModList_t*)NULL, + (QuantityConfig_t*)NULL, + (MeasIdToAddModList_t*)NULL, + (MAC_MainConfig_t*)NULL, + (MeasGapConfig_t*)NULL, + (MobilityControlInfo_t*)NULL, + (struct MeasConfig__speedStatePars*)NULL, + (RSRP_Range_t*)NULL, + (C_RNTI_t*)NULL, + (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)NULL + +#if defined(Rel10) || defined(Rel14) + , ue_context_pP->ue_context.sCell_config +#endif + ); + LOG_I(RRC,"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n", + ctxt_pP->module_id,ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + buffer, + size, + MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + rrc_eNB_mui, + size); + + rrc_data_req( + ctxt_pP, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + size, + buffer, + PDCP_TRANSMISSION_MODE_CONTROL); + return(0); +} + + +//----------------------------------------------------------------------------- +void +rrc_eNB_process_MeasurementReport( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* ue_context_pP, + const MeasResults_t* const measResults2 +) +//----------------------------------------------------------------------------- +{ + int i=0; + int neighboring_cells=-1; + + T(T_ENB_RRC_MEASUREMENT_REPORT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + if (measResults2 == NULL ) + return; + + if (measResults2->measId > 0 ){ + if (ue_context_pP->ue_context.measResults == NULL) { + ue_context_pP->ue_context.measResults = CALLOC(1, sizeof(MeasResults_t)); + } + ue_context_pP->ue_context.measResults->measId=measResults2->measId; + ue_context_pP->ue_context.measResults->measResultPCell.rsrpResult=measResults2->measResultPCell.rsrpResult; + ue_context_pP->ue_context.measResults->measResultPCell.rsrqResult=measResults2->measResultPCell.rsrqResult; + LOG_D(RRC, "[eNB %d]Frame %d: UE %x (Measurement Id %d): RSRP of Source %ld\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId, ue_context_pP->ue_context.measResults->measResultPCell.rsrpResult-140); + LOG_D(RRC, "[eNB %d]Frame %d: UE %x (Measurement Id %d): RSRQ of Source %ld\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId, ue_context_pP->ue_context.measResults->measResultPCell.rsrqResult/2 - 20); + } + if (measResults2->measResultNeighCells == NULL) + return; + + if (measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count > 0) { + neighboring_cells = measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count; + + if (ue_context_pP->ue_context.measResults->measResultNeighCells == NULL) { + + ue_context_pP->ue_context.measResults->measResultNeighCells = CALLOC(1, sizeof(*measResults2->measResultNeighCells)*neighboring_cells); + } + ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.count = neighboring_cells; + for (i=0; i < neighboring_cells; i++){ + memcpy (ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i], + measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[i], + sizeof(MeasResultListEUTRA_t)); + + LOG_D(RRC, "Physical Cell Id %d\n", + (int)ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->physCellId); + LOG_D(RRC, "RSRP of Target %d\n", + (int)*(ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrpResult)); + LOG_D(RRC, "RSRQ of Target %d\n", + (int)*(ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrqResult)); + } + } + +// #if defined(Rel10) || defined(Rel14) + + +// #else + // LOG_I(RRC, "RSRP of Source %d\n", measResults2->measResultServCell.rsrpResult); + // LOG_I(RRC, "RSRQ of Source %d\n", measResults2->measResultServCell.rsrqResult); +// #endif + + // if (ue_context_pP->ue_context.handover_info->ho_prepare != 0xF0) { + // rrc_eNB_generate_HandoverPreparationInformation(ctxt_pP, + // ue_context_pP, + // measResults2->measResultNeighCells->choice. + // measResultListEUTRA.list.array[0]->physCellId); + // } else { + // LOG_D(RRC, "[eNB %d] Frame %d: Ignoring MeasReport from UE %x as Handover is in progress... \n", ctxt_pP->module_id, ctxt_pP->frame, + // ctxt_pP->rnti); + // } + + //Look for IP address of the target eNB + //Send Handover Request -> target eNB + //Wait for Handover Acknowledgement <- target eNB + //Send Handover Command + + //x2delay(); + // handover_request_x2(ue_mod_idP,enb_mod_idP,measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId); + + // uint8_t buffer[100]; + // int size=rrc_eNB_generate_Handover_Command_TeNB(0,0,buffer); + // + // send_check_message((char*)buffer,size); + //send_handover_command(); + +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_HandoverPreparationInformation( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + PhysCellId_t targetPhyId +) +//----------------------------------------------------------------------------- +{ + struct rrc_eNB_ue_context_s* ue_context_target_p = NULL; + //uint8_t UE_id_target = -1; + uint8_t mod_id_target = get_adjacent_cell_mod_id(targetPhyId); + HANDOVER_INFO *handoverInfo = CALLOC(1, sizeof(*handoverInfo)); + /* + uint8_t buffer[100]; + uint8_t size; + struct PhysicalConfigDedicated **physicalConfigDedicated = &RC.rrc[enb_mod_idP]->physicalConfigDedicated[ue_mod_idP]; + RadioResourceConfigDedicated_t *radioResourceConfigDedicated = CALLOC(1,sizeof(RadioResourceConfigDedicated_t)); + */ + + T(T_ENB_RRC_HANDOVER_PREPARATION_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + handoverInfo->as_config.antennaInfoCommon.antennaPortsCount = 0; //Not used 0- but check value + handoverInfo->as_config.sourceDl_CarrierFreq = 36090; //Verify! + + memcpy((void *)&handoverInfo->as_config.sourceMasterInformationBlock, + (void*)&RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.mib, sizeof(MasterInformationBlock_t)); + memcpy((void *)&handoverInfo->as_config.sourceMeasConfig, + (void*)ue_context_pP->ue_context.measConfig, sizeof(MeasConfig_t)); + + // FIXME handoverInfo not used... + free( handoverInfo ); + handoverInfo = 0; + + //to be configured + memset((void*)&ue_context_pP->ue_context.handover_info->as_config.sourceSecurityAlgorithmConfig, + 0, sizeof(SecurityAlgorithmConfig_t)); + + memcpy((void*)&ue_context_pP->ue_context.handover_info->as_config.sourceSystemInformationBlockType1, + (void*)&RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.SIB1, sizeof(SystemInformationBlockType1_t)); + memcpy((void*)&ue_context_pP->ue_context.handover_info->as_config.sourceSystemInformationBlockType2, + (void*)&RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.SIB23, sizeof(SystemInformationBlockType2_t)); + ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo = + CALLOC(1, sizeof(ReestablishmentInfo_t)); + ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->sourcePhysCellId = + RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.physCellId; + ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->targetCellShortMAC_I.buf = NULL; // Check values later + ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->targetCellShortMAC_I.size = 0; + ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->targetCellShortMAC_I.bits_unused = 0; + ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->additionalReestabInfoList = NULL; + ue_context_pP->ue_context.handover_info->ho_prepare = 0xFF; //0xF0; + ue_context_pP->ue_context.handover_info->ho_complete = 0; + + if (mod_id_target != 0xFF) { + //UE_id_target = rrc_find_free_ue_index(modid_target); + ue_context_target_p = + rrc_eNB_get_ue_context( + RC.rrc[mod_id_target], + ue_context_pP->ue_context.rnti); + + /*UE_id_target = rrc_eNB_get_next_free_UE_index( + mod_id_target, + RC.rrc[ctxt_pP->module_id]->Info.UE_list[ue_mod_idP]); //this should return a new index*/ + + if (ue_context_target_p == NULL) { // if not already in target cell + ue_context_target_p = rrc_eNB_allocate_new_UE_context(RC.rrc[ctxt_pP->module_id]); + ue_context_target_p->ue_id_rnti = ue_context_pP->ue_context.rnti; // LG: should not be the same + ue_context_target_p->ue_context.rnti = ue_context_target_p->ue_id_rnti; // idem + LOG_N(RRC, + "[eNB %d] Frame %d : Emulate sending HandoverPreparationInformation msg from eNB source %d to eNB target %ld: source UE_id %x target UE_id %x source_modId: %d target_modId: %d\n", + ctxt_pP->module_id, + ctxt_pP->frame, + RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.physCellId, + targetPhyId, + ue_context_pP->ue_context.rnti, + ue_context_target_p->ue_id_rnti, + ctxt_pP->module_id, + mod_id_target); + ue_context_target_p->ue_context.handover_info = + CALLOC(1, sizeof(*(ue_context_target_p->ue_context.handover_info))); + memcpy((void*)&ue_context_target_p->ue_context.handover_info->as_context, + (void*)&ue_context_pP->ue_context.handover_info->as_context, + sizeof(AS_Context_t)); + memcpy((void*)&ue_context_target_p->ue_context.handover_info->as_config, + (void*)&ue_context_pP->ue_context.handover_info->as_config, + sizeof(AS_Config_t)); + ue_context_target_p->ue_context.handover_info->ho_prepare = 0x00;// 0xFF; + ue_context_target_p->ue_context.handover_info->ho_complete = 0; + ue_context_pP->ue_context.handover_info->modid_t = mod_id_target; + ue_context_pP->ue_context.handover_info->ueid_s = ue_context_pP->ue_context.rnti; + ue_context_pP->ue_context.handover_info->modid_s = ctxt_pP->module_id; + ue_context_target_p->ue_context.handover_info->modid_t = mod_id_target; + ue_context_target_p->ue_context.handover_info->modid_s = ctxt_pP->module_id; + ue_context_target_p->ue_context.handover_info->ueid_t = ue_context_target_p->ue_context.rnti; + + } else { + LOG_E(RRC, "\nError in obtaining free UE id in target eNB %ld for handover \n", targetPhyId); + } + + } else { + LOG_E(RRC, "\nError in obtaining Module ID of target eNB for handover \n"); + } +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_process_handoverPreparationInformation( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP +) +//----------------------------------------------------------------------------- +{ + T(T_ENB_RRC_HANDOVER_PREPARATION_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + + LOG_I(RRC, + "[eNB %d] Frame %d : Logical Channel UL-DCCH, processing RRCHandoverPreparationInformation, sending RRCConnectionReconfiguration to UE %d \n", + ctxt_pP->module_id, ctxt_pP->frame, ue_context_pP->ue_context.rnti); + rrc_eNB_generate_RRCConnectionReconfiguration_handover( + ctxt_pP, + ue_context_pP, + NULL, + 0); +} + + +//----------------------------------------------------------------------------- +void +check_handovers( + protocol_ctxt_t* const ctxt_pP +) +//----------------------------------------------------------------------------- +{ + int result; + struct rrc_eNB_ue_context_s* ue_context_p; + RB_FOREACH(ue_context_p, rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head) { + ctxt_pP->rnti = ue_context_p->ue_id_rnti; + + if (ue_context_p->ue_context.handover_info != NULL) { + if (ue_context_p->ue_context.handover_info->ho_prepare == 0xFF) { + LOG_D(RRC, + "[eNB %d] Frame %d: Incoming handover detected for new UE_idx %d (source eNB %d->target eNB %d) \n", + ctxt_pP->module_id, + ctxt_pP->frame, + ctxt_pP->rnti, + ctxt_pP->module_id, + ue_context_p->ue_context.handover_info->modid_t); + // source eNB generates rrcconnectionreconfiguration to prepare the HO + rrc_eNB_process_handoverPreparationInformation( + ctxt_pP, + ue_context_p); + ue_context_p->ue_context.handover_info->ho_prepare = 0xF1; + } + + if (ue_context_p->ue_context.handover_info->ho_complete == 0xF1) { + LOG_D(RRC, + "[eNB %d] Frame %d: handover Command received for new UE_id %x current eNB %d target eNB: %d \n", + ctxt_pP->module_id, + ctxt_pP->frame, + ctxt_pP->rnti, + ctxt_pP->module_id, + ue_context_p->ue_context.handover_info->modid_t); + //rrc_eNB_process_handoverPreparationInformation(enb_mod_idP,frameP,i); + result = pdcp_data_req(ctxt_pP, + SRB_FLAG_YES, + DCCH, + rrc_eNB_mui++, + SDU_CONFIRM_NO, + ue_context_p->ue_context.handover_info->size, + ue_context_p->ue_context.handover_info->buf, + PDCP_TRANSMISSION_MODE_CONTROL); + AssertFatal(result == TRUE, "PDCP data request failed!\n"); + ue_context_p->ue_context.handover_info->ho_complete = 0xF2; + } + } + } +} + +// 5.3.5.4 RRCConnectionReconfiguration including the mobilityControlInfo to prepare the UE handover +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_RRCConnectionReconfiguration_handover( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + uint8_t* const nas_pdu, + const uint32_t nas_length +) +//----------------------------------------------------------------------------- +{ + T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + + uint8_t buffer[RRC_BUF_SIZE]; + uint16_t size; + int i; + uint8_t rv[2]; + uint16_t Idx; + // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE + eNB_RRC_INST* rrc_inst = RC.rrc[ctxt_pP->module_id]; + struct PhysicalConfigDedicated** physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; + + struct SRB_ToAddMod *SRB2_config; + struct SRB_ToAddMod__rlc_Config *SRB2_rlc_config; + struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config; + struct LogicalChannelConfig__ul_SpecificParameters *SRB2_ul_SpecificParameters; + LogicalChannelConfig_t *SRB1_logicalChannelConfig = NULL; + SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; // not used in this context: may be removed + SRB_ToAddModList_t *SRB_configList2; + + struct DRB_ToAddMod *DRB_config; + struct RLC_Config *DRB_rlc_config; + struct PDCP_Config *DRB_pdcp_config; + struct PDCP_Config__rlc_UM *PDCP_rlc_UM; + struct LogicalChannelConfig *DRB_lchan_config; + struct LogicalChannelConfig__ul_SpecificParameters *DRB_ul_SpecificParameters; + DRB_ToAddModList_t *DRB_configList2; + + MAC_MainConfig_t *mac_MainConfig; + MeasObjectToAddModList_t *MeasObj_list; + MeasObjectToAddMod_t *MeasObj; + ReportConfigToAddModList_t *ReportConfig_list; + ReportConfigToAddMod_t *ReportConfig_per, *ReportConfig_A1, + *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; + MeasIdToAddModList_t *MeasId_list; + MeasIdToAddMod_t *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; + QuantityConfig_t *quantityConfig; + MobilityControlInfo_t *mobilityInfo; + // HandoverCommand_t handoverCommand; + //uint8_t sourceModId = + // get_adjacent_cell_mod_id(ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->sourcePhysCellId); +#if defined(Rel10) || defined(Rel14) + long *sr_ProhibitTimer_r9; +#endif + + long *logicalchannelgroup, *logicalchannelgroup_drb; + long *maxHARQ_Tx, *periodicBSR_Timer; + + // RSRP_Range_t *rsrp; + struct MeasConfig__speedStatePars *Sparams; + CellsToAddMod_t *CellToAdd; + CellsToAddModList_t *CellsToAddModList; + // srb 1: for HO + struct SRB_ToAddMod *SRB1_config; + struct SRB_ToAddMod__rlc_Config *SRB1_rlc_config; + struct SRB_ToAddMod__logicalChannelConfig *SRB1_lchan_config; + struct LogicalChannelConfig__ul_SpecificParameters *SRB1_ul_SpecificParameters; + // phy config dedicated + PhysicalConfigDedicated_t *physicalConfigDedicated2; + struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList; + protocol_ctxt_t ctxt; + + LOG_D(RRC, "[eNB %d] Frame %d: handover preparation: get the newSourceUEIdentity (C-RNTI): ", + ctxt_pP->module_id, ctxt_pP->frame); + + for (i = 0; i < 2; i++) { + rv[i] = taus() & 0xff; + LOG_D(RRC, " %x.", rv[i]); + } + + LOG_D(RRC, "[eNB %d] Frame %d : handover reparation: add target eNB SRB1 and PHYConfigDedicated reconfiguration\n", + ctxt_pP->module_id, ctxt_pP->frame); + // 1st: reconfigure SRB + SRB_configList2 = CALLOC(1, sizeof(*SRB_configList)); + SRB1_config = CALLOC(1, sizeof(*SRB1_config)); + SRB1_config->srb_Identity = 1; + SRB1_rlc_config = CALLOC(1, sizeof(*SRB1_rlc_config)); + SRB1_config->rlc_Config = SRB1_rlc_config; + + SRB1_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; + SRB1_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000; + SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t16; + SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; + SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; + + SRB1_lchan_config = CALLOC(1, sizeof(*SRB1_lchan_config)); + SRB1_config->logicalChannelConfig = SRB1_lchan_config; + + SRB1_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; + SRB1_ul_SpecificParameters = CALLOC(1, sizeof(*SRB1_ul_SpecificParameters)); + + SRB1_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB1_ul_SpecificParameters; + + SRB1_ul_SpecificParameters->priority = 1; + + //assign_enum(&SRB1_ul_SpecificParameters->prioritisedBitRate,LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity); + SRB1_ul_SpecificParameters->prioritisedBitRate = + LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + + //assign_enum(&SRB1_ul_SpecificParameters->bucketSizeDuration,LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50); + SRB1_ul_SpecificParameters->bucketSizeDuration = + LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + + logicalchannelgroup = CALLOC(1, sizeof(long)); + *logicalchannelgroup = 0; + SRB1_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; + + ASN_SEQUENCE_ADD(&SRB_configList2->list, SRB1_config); + + //2nd: now reconfigure phy config dedicated + physicalConfigDedicated2 = CALLOC(1, sizeof(*physicalConfigDedicated2)); + *physicalConfigDedicated = physicalConfigDedicated2; + + physicalConfigDedicated2->pdsch_ConfigDedicated = + CALLOC(1, sizeof(*physicalConfigDedicated2->pdsch_ConfigDedicated)); + physicalConfigDedicated2->pucch_ConfigDedicated = + CALLOC(1, sizeof(*physicalConfigDedicated2->pucch_ConfigDedicated)); + physicalConfigDedicated2->pusch_ConfigDedicated = + CALLOC(1, sizeof(*physicalConfigDedicated2->pusch_ConfigDedicated)); + physicalConfigDedicated2->uplinkPowerControlDedicated = + CALLOC(1, sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated)); + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH = + CALLOC(1, sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH)); + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH = + CALLOC(1, sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH)); + physicalConfigDedicated2->cqi_ReportConfig = NULL; //CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig)); + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); + physicalConfigDedicated2->antennaInfo = CALLOC(1, sizeof(*physicalConfigDedicated2->antennaInfo)); + physicalConfigDedicated2->schedulingRequestConfig = + CALLOC(1, sizeof(*physicalConfigDedicated2->schedulingRequestConfig)); + // PDSCH + //assign_enum(&physicalConfigDedicated2->pdsch_ConfigDedicated->p_a, + // PDSCH_ConfigDedicated__p_a_dB0); + physicalConfigDedicated2->pdsch_ConfigDedicated->p_a = PDSCH_ConfigDedicated__p_a_dB0; + + // PUCCH + physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.present = + PUCCH_ConfigDedicated__ackNackRepetition_PR_release; + physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.choice.release = 0; + physicalConfigDedicated2->pucch_ConfigDedicated->tdd_AckNackFeedbackMode = NULL; //PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing; + + // Pusch_config_dedicated + physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_ACK_Index = 0; // 2.00 + physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_RI_Index = 0; // 1.25 + physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_CQI_Index = 8; // 2.25 + + // UplinkPowerControlDedicated + physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUSCH = 0; // 0 dB + //assign_enum(&physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled, + // UplinkPowerControlDedicated__deltaMCS_Enabled_en1); + physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled = + UplinkPowerControlDedicated__deltaMCS_Enabled_en1; + physicalConfigDedicated2->uplinkPowerControlDedicated->accumulationEnabled = 1; // should be TRUE in order to have 0dB power offset + physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUCCH = 0; // 0 dB + physicalConfigDedicated2->uplinkPowerControlDedicated->pSRS_Offset = 0; // 0 dB + physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient = + CALLOC(1, sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient)); + // assign_enum(physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient,FilterCoefficient_fc4); // fc4 dB + *physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient = FilterCoefficient_fc4; // fc4 dB + + // TPC-PDCCH-Config + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->present = TPC_PDCCH_Config_PR_setup; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.present = TPC_Index_PR_indexOfFormat3; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.choice.indexOfFormat3 = 1; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf = CALLOC(1, 2); + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.size = 2; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf[0] = 0x12; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf[1] = 0x34 + ue_context_pP->local_uid; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.bits_unused = 0; + + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->present = TPC_PDCCH_Config_PR_setup; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.present = TPC_Index_PR_indexOfFormat3; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.choice.indexOfFormat3 = 1; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf = CALLOC(1, 2); + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.size = 2; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[0] = 0x22; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[1] = 0x34 + ue_context_pP->local_uid; + physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.bits_unused = 0; + + // CQI ReportConfig + /* + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic)); + assign_enum(physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic, + CQI_ReportConfig__cqi_ReportModeAperiodic_rm30); // HLC CQI, no PMI + physicalConfigDedicated2->cqi_ReportConfig->nomPDSCH_RS_EPRE_Offset = 0; // 0 dB + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic)); + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = CQI_ReportPeriodic_PR_setup; + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex = 0; // n2_pucch + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex = 0; // Icqi/pmi + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present = CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI; // subband CQI + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.choice.subbandCQI.k=4; + + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex=NULL; + physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI=0; + */ + + //soundingRS-UL-ConfigDedicated + /* + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->present = SoundingRS_UL_ConfigDedicated_PR_setup; + assign_enum(&physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth, + SoundingRS_UL_ConfigDedicated__setup__srs_Bandwidth_bw0); + assign_enum(&physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth, + SoundingRS_UL_ConfigDedicated__setup__srs_HoppingBandwidth_hbw0); + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition=0; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.duration=1; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=1; + physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb=0; + assign_enum(&physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift, + SoundingRS_UL_ConfigDedicated__setup__cyclicShift_cs0); + */ + + //AntennaInfoDedicated + physicalConfigDedicated2->antennaInfo = CALLOC(1, sizeof(*physicalConfigDedicated2->antennaInfo)); + physicalConfigDedicated2->antennaInfo->present = PhysicalConfigDedicated__antennaInfo_PR_explicitValue; + //assign_enum(&physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode, + // AntennaInfoDedicated__transmissionMode_tm2); + /* + switch (transmission_mode){ + case 1: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm1; + break; + case 2: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm2; + break; + case 4: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm4; + break; + case 5: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm5; + break; + case 6: + physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm6; + break; + } + */ + physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.present = + AntennaInfoDedicated__ue_TransmitAntennaSelection_PR_release; + physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.release = 0; + + // SchedulingRequestConfig + physicalConfigDedicated2->schedulingRequestConfig->present = SchedulingRequestConfig_PR_setup; + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = ue_context_pP->local_uid; + + if (rrc_inst->carrier[0].sib1->tdd_Config==NULL) { // FD + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 5 + (ue_context_pP->local_uid % + 10); // Isr = 5 (every 10 subframes, offset=2+UE_id mod3) + } else { + switch (rrc_inst->carrier[0].sib1->tdd_Config->subframeAssignment) { + case 1: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid & 1) + (( + ue_context_pP->local_uid & 3) >> 1) * 5; // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 7 for UE2, 8 for UE3 , 2 for UE4 etc..) + break; + + case 3: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid % + 3); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) + break; + + case 4: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid & + 1); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) + break; + + default: + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7; // Isr = 5 (every 10 subframes, offset=2 for all UE0 etc..) + break; + } + } + + // assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax, + //SchedulingRequestConfig__setup__dsr_TransMax_n4); + // assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = SchedulingRequestConfig__setup__dsr_TransMax_n4; + physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = + SchedulingRequestConfig__setup__dsr_TransMax_n4; + + LOG_D(RRC, + "handover_config [FRAME %05d][RRC_eNB][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 UE %x) --->][MAC_eNB][MOD %02d][]\n", + ctxt_pP->frame, ctxt_pP->module_id, ue_context_pP->ue_context.rnti, ctxt_pP->module_id); + rrc_mac_config_req_eNB( + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, +#ifdef Rel14 +0, +#endif + ue_context_pP->ue_context.rnti, + (BCCH_BCH_Message_t *) NULL, + (RadioResourceConfigCommonSIB_t*) NULL, +#ifdef Rel14 + (RadioResourceConfigCommonSIB_t*) NULL, +#endif + ue_context_pP->ue_context.physicalConfigDedicated, +#if defined(Rel10) || defined(Rel14) + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + 1, + SRB1_logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (TDD_Config_t*) NULL, + (MobilityControlInfo_t*) NULL, + (SchedulingInfoList_t*) NULL, + 0, + NULL, + NULL, + (MBSFN_SubframeConfigList_t *) NULL +#if defined(Rel10) || defined(Rel14) + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL +#endif +# ifdef Rel14 + , + (SystemInformationBlockType1_v1310_IEs_t *)NULL +# endif + ); + + // Configure target eNB SRB2 + /// SRB2 + SRB2_config = CALLOC(1, sizeof(*SRB2_config)); + SRB_configList2 = CALLOC(1, sizeof(*SRB_configList2)); + memset(SRB_configList2, 0, sizeof(*SRB_configList2)); + + SRB2_config->srb_Identity = 2; + SRB2_rlc_config = CALLOC(1, sizeof(*SRB2_rlc_config)); + SRB2_config->rlc_Config = SRB2_rlc_config; + + SRB2_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; + SRB2_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000; + SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t32; + SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; + SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; + + SRB2_lchan_config = CALLOC(1, sizeof(*SRB2_lchan_config)); + SRB2_config->logicalChannelConfig = SRB2_lchan_config; + + SRB2_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; + + SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters)); + + SRB2_ul_SpecificParameters->priority = 1; + SRB2_ul_SpecificParameters->prioritisedBitRate = + LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + SRB2_ul_SpecificParameters->bucketSizeDuration = + LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + + // LCG for CCCH and DCCH is 0 as defined in 36331 + logicalchannelgroup = CALLOC(1, sizeof(long)); + *logicalchannelgroup = 0; + + SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; + SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters; + ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); + ASN_SEQUENCE_ADD(&SRB_configList2->list, SRB2_config); + + // Configure target eNB DRB + DRB_configList2 = CALLOC(1, sizeof(*DRB_configList2)); + /// DRB + DRB_config = CALLOC(1, sizeof(*DRB_config)); + + //DRB_config->drb_Identity = (DRB_Identity_t) 1; //allowed values 1..32 + // NN: this is the 1st DRB for this ue, so set it to 1 + DRB_config->drb_Identity = (DRB_Identity_t) 1; // (ue_mod_idP+1); //allowed values 1..32 + DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long)); + *(DRB_config->logicalChannelIdentity) = (long)3; + DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config)); + DRB_config->rlc_Config = DRB_rlc_config; + DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; + DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; + DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; + + DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); + DRB_config->pdcp_Config = DRB_pdcp_config; + DRB_pdcp_config->discardTimer = NULL; + DRB_pdcp_config->rlc_AM = NULL; + PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); + DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; + PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; + DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; + + DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config)); + DRB_config->logicalChannelConfig = DRB_lchan_config; + DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); + DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; + + DRB_ul_SpecificParameters->priority = 2; // lower priority than srb1, srb2 + DRB_ul_SpecificParameters->prioritisedBitRate = + LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; + DRB_ul_SpecificParameters->bucketSizeDuration = + LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; + + // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM) + logicalchannelgroup_drb = CALLOC(1, sizeof(long)); + *logicalchannelgroup_drb = 1; + DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; + + ASN_SEQUENCE_ADD(&DRB_configList2->list, DRB_config); + + mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig)); + ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig; + + mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config)); + + maxHARQ_Tx = CALLOC(1, sizeof(long)); + *maxHARQ_Tx = MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; + mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx; + + periodicBSR_Timer = CALLOC(1, sizeof(long)); + *periodicBSR_Timer = PeriodicBSR_Timer_r12_sf64; + mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer; + + mac_MainConfig->ul_SCH_Config->retxBSR_Timer = RetxBSR_Timer_r12_sf320; + + mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE + + mac_MainConfig->drx_Config = NULL; + + mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config)); + + mac_MainConfig->phr_Config->present = MAC_MainConfig__phr_Config_PR_setup; + mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes + + mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes + + mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB + +#if defined(Rel10) || defined(Rel14) + sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long)); + *sr_ProhibitTimer_r9 = 0; // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR + mac_MainConfig->ext1 = CALLOC(1, sizeof(struct MAC_MainConfig__ext1)); + mac_MainConfig->ext1->sr_ProhibitTimer_r9 = sr_ProhibitTimer_r9; + //sps_RA_ConfigList_rlola = NULL; +#endif + // Measurement ID list + MeasId_list = CALLOC(1, sizeof(*MeasId_list)); + memset((void *)MeasId_list, 0, sizeof(*MeasId_list)); + + MeasId0 = CALLOC(1, sizeof(*MeasId0)); + MeasId0->measId = 1; + MeasId0->measObjectId = 1; + MeasId0->reportConfigId = 1; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0); + + MeasId1 = CALLOC(1, sizeof(*MeasId1)); + MeasId1->measId = 2; + MeasId1->measObjectId = 1; + MeasId1->reportConfigId = 2; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1); + + MeasId2 = CALLOC(1, sizeof(*MeasId2)); + MeasId2->measId = 3; + MeasId2->measObjectId = 1; + MeasId2->reportConfigId = 3; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2); + + MeasId3 = CALLOC(1, sizeof(*MeasId3)); + MeasId3->measId = 4; + MeasId3->measObjectId = 1; + MeasId3->reportConfigId = 4; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3); + + MeasId4 = CALLOC(1, sizeof(*MeasId4)); + MeasId4->measId = 5; + MeasId4->measObjectId = 1; + MeasId4->reportConfigId = 5; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4); + + MeasId5 = CALLOC(1, sizeof(*MeasId5)); + MeasId5->measId = 6; + MeasId5->measObjectId = 1; + MeasId5->reportConfigId = 6; + ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5); + + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; + + // Add one EUTRA Measurement Object + MeasObj_list = CALLOC(1, sizeof(*MeasObj_list)); + memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list)); + + // Configure MeasObject + + MeasObj = CALLOC(1, sizeof(*MeasObj)); + memset((void *)MeasObj, 0, sizeof(*MeasObj)); + + MeasObj->measObjectId = 1; + MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA; + MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; + MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25; + MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t)); + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; + MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6; + MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB + + MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = + (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); + CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; + + // Add adjacent cell lists (6 per eNB) + for (i = 0; i < 6; i++) { + CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd)); + CellToAdd->cellIndex = i + 1; + CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i); + CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0; + + ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd); + } + + ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj); + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; + + // Report Configurations for periodical, A1-A5 events + ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list)); + + ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); + + ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1)); + + ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2)); + + ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3)); + + ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4)); + + ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5)); + + ReportConfig_per->reportConfigId = 1; + ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_periodical; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose = + ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); + + ReportConfig_A1->reportConfigId = 2; + ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. + a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. + a1_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1); + + ReportConfig_A2->reportConfigId = 3; + ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA2. + a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA2. + a2_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2); + + ReportConfig_A3->reportConfigId = 4; + ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = + 10; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA3.reportOnLeave = 1; + + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3); + + ReportConfig_A4->reportConfigId = 5; + ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA4. + a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA4. + a4_Threshold.choice.threshold_RSRP = 10; + + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4); + + ReportConfig_A5->reportConfigId = 6; + ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present = + ReportConfigEUTRA__triggerType_PR_event; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = + ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold1.choice.threshold_RSRP = 10; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. + eventA5.a5_Threshold2.choice.threshold_RSRP = 10; + + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; + ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; + + ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5); + + Sparams = CALLOC(1, sizeof(*Sparams)); + Sparams->present = MeasConfig__speedStatePars_PR_setup; + Sparams->choice.setup.timeToTrigger_SF.sf_High = SpeedStateScaleFactors__sf_Medium_oDot75; + Sparams->choice.setup.timeToTrigger_SF.sf_Medium = SpeedStateScaleFactors__sf_High_oDot5; + Sparams->choice.setup.mobilityStateParameters.n_CellChangeHigh = 10; + Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5; + Sparams->choice.setup.mobilityStateParameters.t_Evaluation = MobilityStateParameters__t_Evaluation_s60; + Sparams->choice.setup.mobilityStateParameters.t_HystNormal = MobilityStateParameters__t_HystNormal_s120; + + quantityConfig = CALLOC(1, sizeof(*quantityConfig)); + memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); + quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(*quantityConfig->quantityConfigEUTRA)); + memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA)); + quantityConfig->quantityConfigCDMA2000 = NULL; + quantityConfig->quantityConfigGERAN = NULL; + quantityConfig->quantityConfigUTRA = NULL; + quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = + CALLOC(1, sizeof(*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP)); + quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = + CALLOC(1, sizeof(*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ)); + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4; + *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4; + + /* mobilityinfo */ + + mobilityInfo = CALLOC(1, sizeof(*mobilityInfo)); + memset((void *)mobilityInfo, 0, sizeof(*mobilityInfo)); + mobilityInfo->targetPhysCellId = + (PhysCellId_t) two_tier_hexagonal_cellIds[ue_context_pP->ue_context.handover_info->modid_t]; + LOG_D(RRC, "[eNB %d] Frame %d: handover preparation: targetPhysCellId: %ld mod_id: %d ue: %x \n", + ctxt_pP->module_id, + ctxt_pP->frame, + mobilityInfo->targetPhysCellId, + ctxt_pP->module_id, + ue_context_pP->ue_context.rnti); + + mobilityInfo->additionalSpectrumEmission = CALLOC(1, sizeof(*mobilityInfo->additionalSpectrumEmission)); + *mobilityInfo->additionalSpectrumEmission = 1; //Check this value! + + mobilityInfo->t304 = MobilityControlInfo__t304_ms50; // need to configure an appropriate value here + + // New UE Identity (C-RNTI) to identify an UE uniquely in a cell + mobilityInfo->newUE_Identity.size = 2; + mobilityInfo->newUE_Identity.bits_unused = 0; + mobilityInfo->newUE_Identity.buf = rv; + mobilityInfo->newUE_Identity.buf[0] = rv[0]; + mobilityInfo->newUE_Identity.buf[1] = rv[1]; + + //memset((void *)&mobilityInfo->radioResourceConfigCommon,(void *)&rrc_inst->sib2->radioResourceConfigCommon,sizeof(RadioResourceConfigCommon_t)); + //memset((void *)&mobilityInfo->radioResourceConfigCommon,0,sizeof(RadioResourceConfigCommon_t)); + + // Configuring radioResourceConfigCommon + mobilityInfo->radioResourceConfigCommon.rach_ConfigCommon = + CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.rach_ConfigCommon)); + memcpy((void *)mobilityInfo->radioResourceConfigCommon.rach_ConfigCommon, + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.rach_ConfigCommon, sizeof(RACH_ConfigCommon_t)); + mobilityInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo = + CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo)); + memcpy((void *)mobilityInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo, + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.prach_Config.prach_ConfigInfo, + sizeof(PRACH_ConfigInfo_t)); + + mobilityInfo->radioResourceConfigCommon.prach_Config.rootSequenceIndex = + rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.prach_Config.rootSequenceIndex; + mobilityInfo->radioResourceConfigCommon.pdsch_ConfigCommon = + CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.pdsch_ConfigCommon)); + memcpy((void *)mobilityInfo->radioResourceConfigCommon.pdsch_ConfigCommon, + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.pdsch_ConfigCommon, sizeof(PDSCH_ConfigCommon_t)); + memcpy((void *)&mobilityInfo->radioResourceConfigCommon.pusch_ConfigCommon, + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.pusch_ConfigCommon, sizeof(PUSCH_ConfigCommon_t)); + mobilityInfo->radioResourceConfigCommon.phich_Config = NULL; + mobilityInfo->radioResourceConfigCommon.pucch_ConfigCommon = + CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.pucch_ConfigCommon)); + memcpy((void *)mobilityInfo->radioResourceConfigCommon.pucch_ConfigCommon, + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.pucch_ConfigCommon, sizeof(PUCCH_ConfigCommon_t)); + mobilityInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon = + CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon)); + memcpy((void *)mobilityInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon, + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon, + sizeof(SoundingRS_UL_ConfigCommon_t)); + mobilityInfo->radioResourceConfigCommon.uplinkPowerControlCommon = + CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.uplinkPowerControlCommon)); + memcpy((void *)mobilityInfo->radioResourceConfigCommon.uplinkPowerControlCommon, + (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.uplinkPowerControlCommon, + sizeof(UplinkPowerControlCommon_t)); + mobilityInfo->radioResourceConfigCommon.antennaInfoCommon = NULL; + mobilityInfo->radioResourceConfigCommon.p_Max = NULL; // CALLOC(1,sizeof(*mobilityInfo->radioResourceConfigCommon.p_Max)); + //memcpy((void *)mobilityInfo->radioResourceConfigCommon.p_Max,(void *)rrc_inst->sib1->p_Max,sizeof(P_Max_t)); + mobilityInfo->radioResourceConfigCommon.tdd_Config = NULL; //CALLOC(1,sizeof(TDD_Config_t)); + //memcpy((void *)mobilityInfo->radioResourceConfigCommon.tdd_Config,(void *)rrc_inst->sib1->tdd_Config,sizeof(TDD_Config_t)); + mobilityInfo->radioResourceConfigCommon.ul_CyclicPrefixLength = + rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.ul_CyclicPrefixLength; + //End of configuration of radioResourceConfigCommon + + mobilityInfo->carrierFreq = CALLOC(1, sizeof(*mobilityInfo->carrierFreq)); //CALLOC(1,sizeof(CarrierFreqEUTRA_t)); 36090 + mobilityInfo->carrierFreq->dl_CarrierFreq = 36090; + mobilityInfo->carrierFreq->ul_CarrierFreq = NULL; + + mobilityInfo->carrierBandwidth = CALLOC(1, sizeof( + *mobilityInfo->carrierBandwidth)); //CALLOC(1,sizeof(struct CarrierBandwidthEUTRA)); AllowedMeasBandwidth_mbw25 + mobilityInfo->carrierBandwidth->dl_Bandwidth = CarrierBandwidthEUTRA__dl_Bandwidth_n25; + mobilityInfo->carrierBandwidth->ul_Bandwidth = NULL; + mobilityInfo->rach_ConfigDedicated = NULL; + + // store the srb and drb list for ho management, mainly in case of failure + + memcpy(ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.srb_ToAddModList, + (void*)SRB_configList2, + sizeof(SRB_ToAddModList_t)); + memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList, + (void*)DRB_configList2, + sizeof(DRB_ToAddModList_t)); + ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL; + memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, + (void*)mac_MainConfig, + sizeof(MAC_MainConfig_t)); + memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, + (void*)ue_context_pP->ue_context.physicalConfigDedicated, + sizeof(PhysicalConfigDedicated_t)); + /* memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config, + (void *)rrc_inst->sps_Config[ue_mod_idP], + sizeof(SPS_Config_t)); + */ + LOG_I(RRC, "[eNB %d] Frame %d: adding new UE\n", + ctxt_pP->module_id, ctxt_pP->frame); + //Idx = (ue_mod_idP * NB_RB_MAX) + DCCH; + Idx = DCCH; + // SRB1 + ue_context_pP->ue_context.Srb1.Active = 1; + ue_context_pP->ue_context.Srb1.Srb_info.Srb_id = Idx; + memcpy(&ue_context_pP->ue_context.Srb1.Srb_info.Lchan_desc[0], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); + memcpy(&ue_context_pP->ue_context.Srb1.Srb_info.Lchan_desc[1], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); + + // SRB2 + ue_context_pP->ue_context.Srb2.Active = 1; + ue_context_pP->ue_context.Srb2.Srb_info.Srb_id = Idx; + memcpy(&ue_context_pP->ue_context.Srb2.Srb_info.Lchan_desc[0], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); + memcpy(&ue_context_pP->ue_context.Srb2.Srb_info.Lchan_desc[1], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); + + LOG_I(RRC, "[eNB %d] CALLING RLC CONFIG SRB1 (rbid %d) for UE %x\n", + ctxt_pP->module_id, Idx, ue_context_pP->ue_context.rnti); + + // rrc_pdcp_config_req (enb_mod_idP, frameP, 1, CONFIG_ACTION_ADD, idx, UNDEF_SECURITY_MODE); + // rrc_rlc_config_req(enb_mod_idP,frameP,1,CONFIG_ACTION_ADD,Idx,SIGNALLING_RADIO_BEARER,Rlc_info_am_config); + + rrc_pdcp_config_asn1_req(&ctxt, + ue_context_pP->ue_context.SRB_configList, + (DRB_ToAddModList_t *) NULL, (DRB_ToReleaseList_t *) NULL, 0xff, NULL, NULL, NULL +#if defined(Rel10) || defined(Rel14) + , (PMCH_InfoList_r9_t *) NULL +#endif + ,NULL); + + rrc_rlc_config_asn1_req(&ctxt, + ue_context_pP->ue_context.SRB_configList, + (DRB_ToAddModList_t *) NULL, (DRB_ToReleaseList_t *) NULL +#if defined(Rel10) || defined(Rel14) + , (PMCH_InfoList_r9_t *) NULL +#endif + ); + + /* Initialize NAS list */ + dedicatedInfoNASList = NULL; + + // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; + memset(buffer, 0, RRC_BUF_SIZE); + + size = do_RRCConnectionReconfiguration( + ctxt_pP, + buffer, + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), //Transaction_id, + SRB_configList2, + DRB_configList2, + NULL, // DRB2_list, + NULL, //*sps_Config, + ue_context_pP->ue_context.physicalConfigDedicated, + MeasObj_list, + ReportConfig_list, + NULL, //quantityConfig, + MeasId_list, + mac_MainConfig, + NULL, + mobilityInfo, + Sparams, + NULL, + NULL, + dedicatedInfoNASList +#if defined(Rel10) || defined(Rel14) + , NULL // SCellToAddMod_r10_t +#endif + ); + + LOG_I(RRC, + "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration for handover (bytes %d, UE rnti %x)\n", + ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); + // to be updated if needed + /*if (RC.rrc[ctxt_pP->module_id]->SRB1_config[ue_mod_idP]->logicalChannelConfig) { + if (RC.rrc[ctxt_pP->module_id]->SRB1_config[ue_mod_idP]->logicalChannelConfig->present == SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { + SRB1_logicalChannelConfig = &RC.rrc[ctxt_pP->module_id]->SRB1_config[ue_mod_idP]->logicalChannelConfig->choice.explicitValue; + } + else { + SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; + } + } + else { + SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; + } + */ + + LOG_D(RRC, + "[FRAME %05d][RRC_eNB][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration_handover to UE %x MUI %d) --->][PDCP][MOD %02d][RB %02d]\n", + ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); + //rrc_rlc_data_req(ctxt_pP->module_id,frameP, 1,(ue_mod_idP*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer); + //pdcp_data_req (ctxt_pP->module_id, frameP, 1, (ue_mod_idP * NB_RB_MAX) + DCCH,rrc_eNB_mui++, 0, size, (char *) buffer, 1); + + rrc_mac_config_req_eNB( + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, +#ifdef Rel14 + 0, +#endif + ue_context_pP->ue_context.rnti, + (BCCH_BCH_Message_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, +#ifdef Rel14 + (RadioResourceConfigCommonSIB_t *) NULL, +#endif + ue_context_pP->ue_context.physicalConfigDedicated, +#if defined(Rel10) || defined(Rel14) + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + 1, + SRB1_logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (TDD_Config_t *) NULL, + (MobilityControlInfo_t *) mobilityInfo, + (SchedulingInfoList_t *) NULL, 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL +#if defined(Rel10) || defined(Rel14) + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL +#endif +# ifdef Rel14 + , + (SystemInformationBlockType1_v1310_IEs_t *)NULL +# endif + ); + + /* + handoverCommand.criticalExtensions.present = HandoverCommand__criticalExtensions_PR_c1; + handoverCommand.criticalExtensions.choice.c1.present = HandoverCommand__criticalExtensions__c1_PR_handoverCommand_r8; + handoverCommand.criticalExtensions.choice.c1.choice.handoverCommand_r8.handoverCommandMessage.buf = buffer; + handoverCommand.criticalExtensions.choice.c1.choice.handoverCommand_r8.handoverCommandMessage.size = size; + */ +//#warning "COMPILATION PROBLEM" +#ifdef PROBLEM_COMPILATION_RESOLVED + + if (sourceModId != 0xFF) { + memcpy(RC.rrc[sourceModId].handover_info[RC.rrc[ctxt_pP->module_id]->handover_info[ue_mod_idP]->ueid_s]->buf, + (void *)buffer, size); + RC.rrc[sourceModId].handover_info[RC.rrc[ctxt_pP->module_id]->handover_info[ue_mod_idP]->ueid_s]->size = size; + RC.rrc[sourceModId].handover_info[RC.rrc[ctxt_pP->module_id]->handover_info[ue_mod_idP]->ueid_s]->ho_complete = + 0xF1; + //RC.rrc[ctxt_pP->module_id]->handover_info[ue_mod_idP]->ho_complete = 0xFF; + LOG_D(RRC, "[eNB %d] Frame %d: setting handover complete to 0xF1 for (%d,%d) and to 0xFF for (%d,%d)\n", + ctxt_pP->module_id, + ctxt_pP->frame, + sourceModId, + RC.rrc[ctxt_pP->module_id]->handover_info[ue_mod_idP]->ueid_s, + ctxt_pP->module_id, + ue_mod_idP); + } else + LOG_W(RRC, + "[eNB %d] Frame %d: rrc_eNB_generate_RRCConnectionReconfiguration_handover: Could not find source eNB mod_id.\n", + ctxt_pP->module_id, ctxt_pP->frame); + +#endif +} + +/* + void ue_rrc_process_rrcConnectionReconfiguration(uint8_t enb_mod_idP,frame_t frameP, + RRCConnectionReconfiguration_t *rrcConnectionReconfiguration, + uint8_t CH_index) { + + if (rrcConnectionReconfiguration->criticalExtensions.present == RRCConnectionReconfiguration__criticalExtensions_PR_c1) + if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.present == RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8) { + + if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated) { + rrc_ue_process_radioResourceConfigDedicated(enb_mod_idP,frameP,CH_index, + rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated); + + } + + // check other fields for + } + } +*/ + +//----------------------------------------------------------------------------- +void +rrc_eNB_process_RRCConnectionReconfigurationComplete( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* ue_context_pP, + const uint8_t xid +) +//----------------------------------------------------------------------------- +{ + int i, drb_id; +#ifdef PDCP_USE_NETLINK + int oip_ifup = 0; + int dest_ip_offset = 0; + module_id_t ue_module_id = -1; + /* avoid gcc warnings */ + (void)oip_ifup; + (void)dest_ip_offset; + (void)ue_module_id; +#endif + + uint8_t *kRRCenc = NULL; + uint8_t *kRRCint = NULL; + uint8_t *kUPenc = NULL; + ue_context_pP->ue_context.ue_reestablishment_timer = 0; + + DRB_ToAddModList_t* DRB_configList = ue_context_pP->ue_context.DRB_configList2[xid]; + SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList2[xid]; + DRB_ToReleaseList_t* DRB_Release_configList2 = ue_context_pP->ue_context.DRB_Release_configList2[xid]; + DRB_Identity_t* drb_id_p = NULL; + + T(T_ENB_RRC_CONNECTION_RECONFIGURATION_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#if defined(ENABLE_SECURITY) + + /* Derive the keys from kenb */ + if (DRB_configList != NULL) { + derive_key_up_enc(ue_context_pP->ue_context.ciphering_algorithm, + ue_context_pP->ue_context.kenb, &kUPenc); + } + + derive_key_rrc_enc(ue_context_pP->ue_context.ciphering_algorithm, + ue_context_pP->ue_context.kenb, &kRRCenc); + derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm, + ue_context_pP->ue_context.kenb, &kRRCint); + +#endif + + // Refresh SRBs/DRBs + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_PDCP_ENB, + NULL, + 0, + MSC_AS_TIME_FMT" CONFIG_REQ UE %x DRB (security unchanged)", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti); + + rrc_pdcp_config_asn1_req( + ctxt_pP, + SRB_configList, //NULL, //LG-RK 14/05/2014 SRB_configList, + DRB_configList, +// (DRB_ToReleaseList_t *) NULL, + DRB_Release_configList2, + /*RC.rrc[ctxt_pP->module_id]->ciphering_algorithm[ue_mod_idP] | + (RC.rrc[ctxt_pP->module_id]->integrity_algorithm[ue_mod_idP] << 4), + */ + 0xff, // already configured during the securitymodecommand + kRRCenc, + kRRCint, + kUPenc +#if defined(Rel10) || defined(Rel14) + , (PMCH_InfoList_r9_t *) NULL +#endif + ,NULL); + // Refresh SRBs/DRBs + rrc_rlc_config_asn1_req( + ctxt_pP, + SRB_configList, // NULL, //LG-RK 14/05/2014 SRB_configList, + DRB_configList, +// (DRB_ToReleaseList_t *) NULL + DRB_Release_configList2 +#if defined(Rel10) || defined(Rel14) + , (PMCH_InfoList_r9_t *) NULL +#endif + ); + + // set the SRB active in Ue context + if (SRB_configList != NULL) { + for (i = 0; (i < SRB_configList->list.count) && (i < 3); i++) { + if (SRB_configList->list.array[i]->srb_Identity == 1 ){ + ue_context_pP->ue_context.Srb1.Active=1; + } + else if (SRB_configList->list.array[i]->srb_Identity == 2 ) { + ue_context_pP->ue_context.Srb2.Active=1; + ue_context_pP->ue_context.Srb2.Srb_info.Srb_id=2; + LOG_I(RRC,"[eNB %d] Frame %d CC %d : SRB2 is now active\n", + ctxt_pP->module_id, + ctxt_pP->frame, + ue_context_pP->ue_context.primaryCC_id); + } else { + LOG_W(RRC,"[eNB %d] Frame %d CC %d : invalide SRB identity %ld\n", + ctxt_pP->module_id, + ctxt_pP->frame, + ue_context_pP->ue_context.primaryCC_id, + SRB_configList->list.array[i]->srb_Identity); + } + } + free(SRB_configList); + ue_context_pP->ue_context.SRB_configList2[xid] = NULL; + } + + // Loop through DRBs and establish if necessary + + if (DRB_configList != NULL) { + for (i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8) + if (DRB_configList->list.array[i]) { + drb_id = (int)DRB_configList->list.array[i]->drb_Identity; + LOG_I(RRC, + "[eNB %d] Frame %d : Logical Channel UL-DCCH, Received RRCConnectionReconfigurationComplete from UE rnti %x, reconfiguring DRB %d/LCID %d\n", + ctxt_pP->module_id, + ctxt_pP->frame, + ctxt_pP->rnti, + (int)DRB_configList->list.array[i]->drb_Identity, + (int)*DRB_configList->list.array[i]->logicalChannelIdentity); + // for pre-ci tests + LOG_I(RRC, + "[eNB %d] Frame %d : Logical Channel UL-DCCH, Received RRCConnectionReconfigurationComplete from UE %u, reconfiguring DRB %d/LCID %d\n", + ctxt_pP->module_id, + ctxt_pP->frame, + oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid], + (int)DRB_configList->list.array[i]->drb_Identity, + (int)*DRB_configList->list.array[i]->logicalChannelIdentity); + + if (ue_context_pP->ue_context.DRB_active[drb_id] == 0) { + /* + rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_ADD, + (ue_mod_idP * NB_RB_MAX) + *DRB_configList->list.array[i]->logicalChannelIdentity,UNDEF_SECURITY_MODE); + rrc_rlc_config_req(ctxt_pP->module_id,frameP,1,CONFIG_ACTION_ADD, + (ue_mod_idP * NB_RB_MAX) + (int)*RC.rrc[ctxt_pP->module_id]->DRB_config[ue_mod_idP][i]->logicalChannelIdentity, + RADIO_ACCESS_BEARER,Rlc_info_um); + */ + ue_context_pP->ue_context.DRB_active[drb_id] = 1; + + LOG_D(RRC, + "[eNB %d] Frame %d: Establish RLC UM Bidirectional, DRB %d Active\n", + ctxt_pP->module_id, ctxt_pP->frame, (int)DRB_configList->list.array[i]->drb_Identity); +#if defined(PDCP_USE_NETLINK) && !defined(LINK_ENB_PDCP_TO_GTPV1U) + // can mean also IPV6 since ether -> ipv6 autoconf +# if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(EXMIMO) && !defined(OAI_USRP) && !defined(OAI_BLADERF) && !defined(ETHERNET) && !defined(OAI_ADRV9371_ZC706) + LOG_I(OIP, "[eNB %d] trying to bring up the OAI interface oai%d\n", + ctxt_pP->module_id, + ctxt_pP->module_id); + oip_ifup = nas_config( + ctxt_pP->module_id, // interface index + ctxt_pP->module_id + 1, // thrid octet + ctxt_pP->module_id + 1); // fourth octet + + if (oip_ifup == 0) { // interface is up --> send a config the DRB + dest_ip_offset = 8; + LOG_I(OIP, + "[eNB %d] Config the oai%d to send/receive pkt on DRB %ld to/from the protocol stack\n", + ctxt_pP->module_id, ctxt_pP->module_id, + (long int)((ue_context_pP->local_uid * maxDRB) + DRB_configList->list.array[i]->drb_Identity)); + ue_module_id = oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid]; + rb_conf_ipv4(0, //add + ue_module_id, //cx + ctxt_pP->module_id, //inst + (ue_module_id * maxDRB) + DRB_configList->list.array[i]->drb_Identity, // RB + 0, //dscp + ipv4_address(ctxt_pP->module_id + 1, ctxt_pP->module_id + 1), //saddr + ipv4_address(ctxt_pP->module_id + 1, dest_ip_offset + ue_module_id + 1)); //daddr + LOG_D(RRC, "[eNB %d] State = Attached (UE rnti %x module id %u)\n", + ctxt_pP->module_id, ue_context_pP->ue_context.rnti, ue_module_id); + } + +# endif +#endif + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (DRB) ---> MAC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + + if (DRB_configList->list.array[i]->logicalChannelIdentity) { + DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->logicalChannelIdentity; + } + + rrc_mac_config_req_eNB( + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, +#ifdef Rel14 + 0, +#endif + ue_context_pP->ue_context.rnti, + (BCCH_BCH_Message_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, +#ifdef Rel14 + (RadioResourceConfigCommonSIB_t *) NULL, +#endif + ue_context_pP->ue_context.physicalConfigDedicated, +#if defined(Rel10) || defined(Rel14) + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + DRB2LCHAN[i], + DRB_configList->list.array[i]->logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (TDD_Config_t *) NULL, + NULL, + (SchedulingInfoList_t *) NULL, + 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL +#if defined(Rel10) || defined(Rel14) + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL +#endif +# ifdef Rel14 + , + (SystemInformationBlockType1_v1310_IEs_t *)NULL +# endif + ); + + } else { // remove LCHAN from MAC/PHY + + if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) { + // DRB has just been removed so remove RLC + PDCP for DRB + /* rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_REMOVE, + (ue_mod_idP * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE); + */ + rrc_rlc_config_req( + ctxt_pP, + SRB_FLAG_NO, + MBMS_FLAG_NO, + CONFIG_ACTION_REMOVE, + DRB2LCHAN[i], + Rlc_info_um); + } + + ue_context_pP->ue_context.DRB_active[drb_id] = 0; + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (DRB) ---> MAC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rrc_mac_config_req_eNB(ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, +#ifdef Rel14 + 0, +#endif + ue_context_pP->ue_context.rnti, + (BCCH_BCH_Message_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, +#ifdef Rel14 + (RadioResourceConfigCommonSIB_t *) NULL, +#endif + ue_context_pP->ue_context.physicalConfigDedicated, +#if defined(Rel10) || defined(Rel14) + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + DRB2LCHAN[i], + (LogicalChannelConfig_t *) NULL, + (MeasGapConfig_t *) NULL, + (TDD_Config_t *) NULL, + NULL, + (SchedulingInfoList_t *) NULL, + 0, NULL, NULL, NULL +#if defined(Rel10) || defined(Rel14) + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL +#endif +# ifdef Rel14 + , + (SystemInformationBlockType1_v1310_IEs_t *)NULL +# endif + ); + } + } + } + free(DRB_configList); + ue_context_pP->ue_context.DRB_configList2[xid] = NULL; + } + + if(DRB_Release_configList2 != NULL){ + for (i = 0; i < DRB_Release_configList2->list.count; i++) { + if (DRB_Release_configList2->list.array[i]) { + drb_id_p = DRB_Release_configList2->list.array[i]; + drb_id = *drb_id_p; + if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) { + ue_context_pP->ue_context.DRB_active[drb_id] = 0; + } + } + } + free(DRB_Release_configList2); + ue_context_pP->ue_context.DRB_Release_configList2[xid] = NULL; + } +} + +//----------------------------------------------------------------------------- +void +rrc_eNB_generate_RRCConnectionSetup( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + const int CC_id +) +//----------------------------------------------------------------------------- +{ + + LogicalChannelConfig_t *SRB1_logicalChannelConfig; //,*SRB2_logicalChannelConfig; + SRB_ToAddModList_t **SRB_configList; + SRB_ToAddMod_t *SRB1_config; + int cnt; + + T(T_ENB_RRC_CONNECTION_SETUP, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + SRB_configList = &ue_context_pP->ue_context.SRB_configList; + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size = + do_RRCConnectionSetup(ctxt_pP, + ue_context_pP, + CC_id, + (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, + (uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2 + rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), + SRB_configList, + &ue_context_pP->ue_context.physicalConfigDedicated); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Setup\n"); + + for (cnt = 0; cnt < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) { + LOG_F(RRC,"%02x ", ((uint8_t*)RC.rrc[ctxt_pP->module_id]->Srb0.Tx_buffer.Payload)[cnt]); + } + + LOG_F(RRC,"\n"); + ////////////////////////////////// +#endif + + // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE + + if (*SRB_configList != NULL) { + for (cnt = 0; cnt < (*SRB_configList)->list.count; cnt++) { + if ((*SRB_configList)->list.array[cnt]->srb_Identity == 1) { + SRB1_config = (*SRB_configList)->list.array[cnt]; + + if (SRB1_config->logicalChannelConfig) { + if (SRB1_config->logicalChannelConfig->present == + SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { + SRB1_logicalChannelConfig = &SRB1_config->logicalChannelConfig->choice.explicitValue; + } else { + SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; + } + } else { + SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; + } + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rrc_mac_config_req_eNB( + ctxt_pP->module_id, + ue_context_pP->ue_context.primaryCC_id, + 0,0,0,0,0, +#ifdef Rel14 + 0, +#endif + ue_context_pP->ue_context.rnti, + (BCCH_BCH_Message_t *) NULL, + (RadioResourceConfigCommonSIB_t *) NULL, +#ifdef Rel14 + (RadioResourceConfigCommonSIB_t *) NULL, +#endif + ue_context_pP->ue_context.physicalConfigDedicated, +#if defined(Rel10) || defined(Rel14) + (SCellToAddMod_r10_t *)NULL, + //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, +#endif + (MeasObjectToAddMod_t **) NULL, + ue_context_pP->ue_context.mac_MainConfig, + 1, + SRB1_logicalChannelConfig, + ue_context_pP->ue_context.measGapConfig, + (TDD_Config_t *) NULL, + NULL, + (SchedulingInfoList_t *) NULL, + 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL +#if defined(Rel10) || defined(Rel14) + , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL +#endif +# ifdef Rel14 + , + (SystemInformationBlockType1_v1310_IEs_t *)NULL +# endif + ); + break; + } + } + } + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header, // LG WARNING + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, + MSC_AS_TIME_FMT" RRCConnectionSetup UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_pP->ue_context.rnti, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); + + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionSetup (bytes %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); + + // activate release timer, if RRCSetupComplete not received after 10 frames, remove UE + //ue_context_pP->ue_context.ue_release_timer=1; + // remove UE after 10 frames after RRCConnectionRelease is triggered + //ue_context_pP->ue_context.ue_release_timer_thres=100; + // activate release timer, if RRCSetupComplete not received after 100 frames, remove UE + ue_context_pP->ue_context.ue_release_timer=1; + // remove UE after 10 frames after RRCConnectionRelease is triggered + ue_context_pP->ue_context.ue_release_timer_thres=1000; +} + + +#if defined(ENABLE_ITTI) +//----------------------------------------------------------------------------- +char +openair_rrc_eNB_configuration( + const module_id_t enb_mod_idP, + RrcConfigurationReq* configuration +) +#else +char +openair_rrc_eNB_init( + const module_id_t enb_mod_idP +) +#endif +//----------------------------------------------------------------------------- +{ + protocol_ctxt_t ctxt; + int CC_id; + + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, enb_mod_idP, ENB_FLAG_YES, NOT_A_RNTI, 0, 0,enb_mod_idP); + LOG_I(RRC, + PROTOCOL_RRC_CTXT_FMT" Init...\n", + PROTOCOL_RRC_CTXT_ARGS(&ctxt)); + +#if OCP_FRAMEWORK + while ( RC.rrc[enb_mod_idP] == NULL ) { + LOG_E(RRC, "RC.rrc not yet initialized, waiting 1 second\n"); + sleep(1); + } +#endif + AssertFatal(RC.rrc[enb_mod_idP] != NULL, "RC.rrc not initialized!"); + AssertFatal(NUMBER_OF_UE_MAX < (module_id_t)0xFFFFFFFFFFFFFFFF, " variable overflow"); +#ifdef ENABLE_ITTI + AssertFatal(configuration!=NULL,"configuration input is null\n"); +#endif + // for (j = 0; j < NUMBER_OF_UE_MAX; j++) + // RC.rrc[ctxt.module_id].Info.UE[j].Status = RRC_IDLE; //CH_READY; + // + //#if defined(ENABLE_USE_MME) + // // Connect eNB to MME + // if (EPC_MODE_ENABLED <= 0) + //#endif + // { + // /* Init security parameters */ + // for (j = 0; j < NUMBER_OF_UE_MAX; j++) { + // RC.rrc[ctxt.module_id].ciphering_algorithm[j] = SecurityAlgorithmConfig__cipheringAlgorithm_eea0; + // RC.rrc[ctxt.module_id].integrity_algorithm[j] = SecurityAlgorithmConfig__integrityProtAlgorithm_eia2; + // rrc_eNB_init_security(enb_mod_idP, j); + // } + // } + RC.rrc[ctxt.module_id]->Nb_ue = 0; + + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + RC.rrc[ctxt.module_id]->carrier[CC_id].Srb0.Active = 0; + } + + uid_linear_allocator_init(&RC.rrc[ctxt.module_id]->uid_allocator); + RB_INIT(&RC.rrc[ctxt.module_id]->rrc_ue_head); + // for (j = 0; j < (NUMBER_OF_UE_MAX + 1); j++) { + // RC.rrc[enb_mod_idP]->Srb2[j].Active = 0; + // } + + + RC.rrc[ctxt.module_id]->initial_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); + RC.rrc[ctxt.module_id]->s1ap_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); + + memcpy(&RC.rrc[ctxt.module_id]->configuration,configuration,sizeof(RrcConfigurationReq)); + + /// System Information INIT + + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Checking release \n", + PROTOCOL_RRC_CTXT_ARGS(&ctxt)); +#if defined(Rel10) || defined(Rel14) + + // can clear it at runtime + RC.rrc[ctxt.module_id]->carrier[0].MBMS_flag = 0; + + // This has to come from some top-level configuration + // only CC_id 0 is logged +#if defined(Rel10) + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Rel10 RRC detected, MBMS flag %d\n", +#else + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Rel14 RRC detected, MBMS flag %d\n", +#endif + PROTOCOL_RRC_CTXT_ARGS(&ctxt), + RC.rrc[ctxt.module_id]->carrier[0].MBMS_flag); + +#else + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Rel8 RRC\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); +#endif +#ifdef CBA + + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + for (j = 0; j < NUM_MAX_CBA_GROUP; j++) { + RC.rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[j] = CBA_OFFSET + j; + } + + if (RC.rrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups > NUM_MAX_CBA_GROUP) { + RC.rrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups = NUM_MAX_CBA_GROUP; + } + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_FMT" Initialization of 4 cba_RNTI values (%x %x %x %x) num active groups %d\n", + PROTOCOL_RRC_CTXT_ARGS(&ctxt), + enb_mod_idP, RC.rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[0], + RC.rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[1], + RC.rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[2], + RC.rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[3], + RC.rrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups); + } + +#endif + + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + init_SI(&ctxt, + CC_id +#if defined(ENABLE_ITTI) + , configuration +#endif + ); + for (int ue_id = 0; ue_id < NUMBER_OF_UE_MAX; ue_id++) { + RC.rrc[ctxt.module_id]->carrier[CC_id].sizeof_paging[ue_id] = 0; + RC.rrc[ctxt.module_id]->carrier[CC_id].paging[ue_id] = (uint8_t*) malloc16(256); + } + } + + rrc_init_global_param(); + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { + +#if defined(Rel10) || defined(Rel14) + switch (RC.rrc[ctxt.module_id]->carrier[CC_id].MBMS_flag) { + case 1: + case 2: + case 3: + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Configuring 1 MBSFN sync area\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); + RC.rrc[ctxt.module_id]->carrier[CC_id].num_mbsfn_sync_area = 1; + break; + + case 4: + LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Configuring 2 MBSFN sync area\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); + RC.rrc[ctxt.module_id]->carrier[CC_id].num_mbsfn_sync_area = 2; + break; + + default: + RC.rrc[ctxt.module_id]->carrier[CC_id].num_mbsfn_sync_area = 0; + break; + } + + // if we are here the RC.rrc[enb_mod_idP]->MBMS_flag > 0, + /// MCCH INIT + if (RC.rrc[ctxt.module_id]->carrier[CC_id].MBMS_flag > 0) { + init_MCCH(ctxt.module_id, CC_id); + /// MTCH data bearer init + init_MBMS(ctxt.module_id, CC_id, 0); + } +#endif + + openair_rrc_top_init_eNB(RC.rrc[ctxt.module_id]->carrier[CC_id].MBMS_flag,0); + } + openair_rrc_on(&ctxt); + + return 0; + +} + +/*------------------------------------------------------------------------------*/ +int +rrc_eNB_decode_ccch( + protocol_ctxt_t* const ctxt_pP, + const SRB_INFO* const Srb_info, + const int CC_id +) +//----------------------------------------------------------------------------- +{ + module_id_t Idx; + asn_dec_rval_t dec_rval; + UL_CCCH_Message_t *ul_ccch_msg = NULL; + RRCConnectionRequest_r8_IEs_t* rrcConnectionRequest = NULL; + RRCConnectionReestablishmentRequest_r8_IEs_t* rrcConnectionReestablishmentRequest = NULL; + int i, rval; + struct rrc_eNB_ue_context_s* ue_context_p = NULL; + uint64_t random_value = 0; + int stmsi_received = 0; + + T(T_ENB_RRC_UL_CCCH_DATA_IN, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + //memset(ul_ccch_msg,0,sizeof(UL_CCCH_Message_t)); + + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Decoding UL CCCH %x.%x.%x.%x.%x.%x (%p)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ((uint8_t*) Srb_info->Rx_buffer.Payload)[0], + ((uint8_t *) Srb_info->Rx_buffer.Payload)[1], + ((uint8_t *) Srb_info->Rx_buffer.Payload)[2], + ((uint8_t *) Srb_info->Rx_buffer.Payload)[3], + ((uint8_t *) Srb_info->Rx_buffer.Payload)[4], + ((uint8_t *) Srb_info->Rx_buffer.Payload)[5], (uint8_t *) Srb_info->Rx_buffer.Payload); + dec_rval = uper_decode( + NULL, + &asn_DEF_UL_CCCH_Message, + (void**)&ul_ccch_msg, + (uint8_t*) Srb_info->Rx_buffer.Payload, + 100, + 0, + 0); + + /* +#if defined(ENABLE_ITTI) +# if defined(DISABLE_ITTI_XER_PRINT) + { + MessageDef *message_p; + + message_p = itti_alloc_new_message(TASK_RRC_ENB, RRC_UL_CCCH_MESSAGE); + memcpy(&message_p->ittiMsg, (void *)ul_ccch_msg, sizeof(RrcUlCcchMessage)); + + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, message_p); + } +# else + { + char message_string[10000]; + size_t message_string_size; + + if ((message_string_size = + xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_CCCH_Message, (void *)ul_ccch_msg)) > 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized(TASK_RRC_ENB, RRC_UL_CCCH, message_string_size + sizeof(IttiMsgText)); + msg_p->ittiMsg.rrc_ul_ccch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_ul_ccch.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); + } + } +# endif +#endif + */ + + for (i = 0; i < 8; i++) { + LOG_T(RRC, "%x.", ((uint8_t *) & ul_ccch_msg)[i]); + } + + if (dec_rval.consumed == 0) { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" FATAL Error in receiving CCCH\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + return -1; + } + + if (ul_ccch_msg->message.present == UL_CCCH_MessageType_PR_c1) { + + switch (ul_ccch_msg->message.choice.c1.present) { + + case UL_CCCH_MessageType__c1_PR_NOTHING: + LOG_I(RRC, + PROTOCOL_RRC_CTXT_FMT" Received PR_NOTHING on UL-CCCH-Message\n", + PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + break; + + case UL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentRequest: + T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Reestablishment Request\n"); + + for (i = 0; i < Srb_info->Rx_buffer.payload_size; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Srb_info->Rx_buffer.Payload)[i]); + } + + LOG_F(RRC,"\n"); +#endif + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT"MAC_eNB--- MAC_DATA_IND (rrcConnectionReestablishmentRequest on SRB0) --> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rrcConnectionReestablishmentRequest = + &ul_ccch_msg->message.choice.c1.choice.rrcConnectionReestablishmentRequest.criticalExtensions.choice.rrcConnectionReestablishmentRequest_r8; + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest cause %s\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ((rrcConnectionReestablishmentRequest->reestablishmentCause == ReestablishmentCause_otherFailure) ? "Other Failure" : + (rrcConnectionReestablishmentRequest->reestablishmentCause == ReestablishmentCause_handoverFailure) ? "Handover Failure" : + "reconfigurationFailure")); + /*{ + uint64_t c_rnti = 0; + + memcpy(((uint8_t *) & c_rnti) + 3, rrcConnectionReestablishmentRequest.UE_identity.c_RNTI.buf, + rrcConnectionReestablishmentRequest.UE_identity.c_RNTI.size); + ue_mod_id = rrc_eNB_get_UE_index(enb_mod_idP, c_rnti); + } + + if ((RC.rrc[enb_mod_idP]->phyCellId == rrcConnectionReestablishmentRequest.UE_identity.physCellId) && + (ue_mod_id != UE_INDEX_INVALID)){ + rrc_eNB_generate_RRCConnectionReestablishment(enb_mod_idP, frameP, ue_mod_id); + }else { + rrc_eNB_generate_RRCConnectionReestablishmentReject(enb_mod_idP, frameP, ue_mod_id); + } + */ + /* reject all reestablishment attempts for the moment */ +// rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, +// rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti), +// CC_id); +{ + uint16_t c_rnti = 0; + + if (rrcConnectionReestablishmentRequest->ue_Identity.physCellId != RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId) { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest ue_Identity.physCellId(%ld) is not equal to current physCellId(%d), let's reject the UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + rrcConnectionReestablishmentRequest->ue_Identity.physCellId, + RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId); + rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); + break; + } + LOG_D(RRC, "physCellId is %ld\n", rrcConnectionReestablishmentRequest->ue_Identity.physCellId); + + for (i = 0; i < rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.size; i++) { + LOG_D(RRC, "rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.buf[%d] = %x\n", + i, rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.buf[i]); + } + + if (rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI.size == 0 || + rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI.size > 2) { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest c_RNTI range error, let's reject the UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); + break; + + } + + c_rnti = BIT_STRING_to_uint16(&rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI); + LOG_D(RRC, "c_rnti is %x\n", c_rnti); + + ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], c_rnti); + if (ue_context_p == NULL) { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest without UE context, let's reject the UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); + break; + } + int UE_id = find_UE_id(ctxt_pP->module_id, c_rnti); + if(ue_context_p->ue_context.ue_reestablishment_timer > 0 || RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer > 0){ + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishment(Previous) don't complete, let's reject the UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); + break; + } + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" UE context: %p\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p); + ue_context_p->ue_context.ul_failure_timer = 0; + ue_context_p->ue_context.ue_release_timer = 0; + ue_context_p->ue_context.ue_reestablishment_timer = 0; + ue_context_p->ue_context.ue_release_timer_s1 = 0; + ue_context_p->ue_context.ue_release_timer_rrc = 0; + + /* reset timers */ + ue_context_p->ue_context.ul_failure_timer = 0; + ue_context_p->ue_context.ue_release_timer = 0; + + // insert C-RNTI to map + for (i = 0; i < NUMBER_OF_UE_MAX; i++) { + if (reestablish_rnti_map[i][0] == 0) { + reestablish_rnti_map[i][0] = ctxt_pP->rnti; + reestablish_rnti_map[i][1] = c_rnti; + break; + } + } + LOG_D(RRC, "reestablish_rnti_map[%d] [0] %x, [1] %x\n", + i, reestablish_rnti_map[i][0], reestablish_rnti_map[i][1]); + +#if defined(ENABLE_ITTI) + ue_context_p->ue_context.reestablishment_cause = rrcConnectionReestablishmentRequest->reestablishmentCause; + LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept connection reestablishment request from UE physCellId %ld cause %ld\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + rrcConnectionReestablishmentRequest->ue_Identity.physCellId, + ue_context_p->ue_context.reestablishment_cause); +#else + LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept connection restablishment request for UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); +#endif + +#ifndef NO_RRM + send_msg(&S_rrc, msg_rrc_MR_attach_ind(ctxt_pP->module_id, Mac_id)); +#else + + ue_context_p->ue_context.primaryCC_id = CC_id; + + //LG COMMENT Idx = (ue_mod_idP * NB_RB_MAX) + DCCH; + Idx = DCCH; + // SRB1 + ue_context_p->ue_context.Srb1.Active = 1; + ue_context_p->ue_context.Srb1.Srb_info.Srb_id = Idx; + memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[0], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[1], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + + // SRB2: set it to go through SRB1 with id 1 (DCCH) + ue_context_p->ue_context.Srb2.Active = 1; + ue_context_p->ue_context.Srb2.Srb_info.Srb_id = Idx; + memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[0], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[1], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + + rrc_eNB_generate_RRCConnectionReestablishment(ctxt_pP, ue_context_p, CC_id); + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1 (rbid %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + Idx); + + MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, + MSC_PDCP_ENB, + NULL, + 0, + MSC_AS_TIME_FMT" CONFIG_REQ UE %x SRB", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti); + + rrc_pdcp_config_asn1_req(ctxt_pP, + ue_context_p->ue_context.SRB_configList, + (DRB_ToAddModList_t *) NULL, + (DRB_ToReleaseList_t*) NULL, + 0xff, + NULL, + NULL, + NULL +# if defined(Rel10) || defined(Rel14) + , (PMCH_InfoList_r9_t *) NULL +# endif + ,NULL); + + rrc_rlc_config_asn1_req(ctxt_pP, + ue_context_p->ue_context.SRB_configList, + (DRB_ToAddModList_t*) NULL, + (DRB_ToReleaseList_t*) NULL +# if defined(Rel10) || defined(Rel14) + , (PMCH_InfoList_r9_t *) NULL +# endif + ); +#endif //NO_RRM + } + break; + + case UL_CCCH_MessageType__c1_PR_rrcConnectionRequest: + T(T_ENB_RRC_CONNECTION_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Request\n"); + + for (i = 0; i < Srb_info->Rx_buffer.payload_size; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Srb_info->Rx_buffer.Payload)[i]); + } + + LOG_F(RRC,"\n"); +#endif + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT"MAC_eNB --- MAC_DATA_IND (rrcConnectionRequest on SRB0) --> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + ue_context_p = rrc_eNB_get_ue_context( + RC.rrc[ctxt_pP->module_id], + ctxt_pP->rnti); + + if (ue_context_p != NULL) { + // erase content + rrc_eNB_free_mem_UE_context(ctxt_pP, ue_context_p); + + MSC_LOG_RX_DISCARDED_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Srb_info->Rx_buffer.Payload, + dec_rval.consumed, + MSC_AS_TIME_FMT" RRCConnectionRequest UE %x size %u (UE already in context)", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + dec_rval.consumed); + } else { + rrcConnectionRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.choice.rrcConnectionRequest_r8; + { + if (InitialUE_Identity_PR_randomValue == rrcConnectionRequest->ue_Identity.present) { + AssertFatal(rrcConnectionRequest->ue_Identity.choice.randomValue.size == 5, + "wrong InitialUE-Identity randomValue size, expected 5, provided %d", + rrcConnectionRequest->ue_Identity.choice.randomValue.size); + memcpy(((uint8_t*) & random_value) + 3, + rrcConnectionRequest->ue_Identity.choice.randomValue.buf, + rrcConnectionRequest->ue_Identity.choice.randomValue.size); + /* if there is already a registered UE (with another RNTI) with this random_value, + * the current one must be removed from MAC/PHY (zombie UE) + */ +#if 0 + if ((ue_context_p = rrc_eNB_ue_context_random_exist(ctxt_pP, random_value))) { + LOG_W(RRC, "new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n", + ctxt_pP->rnti, ue_context_p->ue_context.rnti, ctxt_pP->rnti); + rrc_mac_remove_ue(ctxt_pP->module_id, ctxt_pP->rnti); + ue_context_p = NULL; + return 0; + } else { + ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value); + } +#endif + if ((ue_context_p = rrc_eNB_ue_context_random_exist(ctxt_pP, random_value))) { + LOG_W(RRC, "new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n", + ctxt_pP->rnti, ue_context_p->ue_context.rnti, ue_context_p->ue_context.rnti); + ue_context_p->ue_context.ul_failure_timer = 20000; + } + ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value); + } else if (InitialUE_Identity_PR_s_TMSI == rrcConnectionRequest->ue_Identity.present) { + /* Save s-TMSI */ + S_TMSI_t s_TMSI = rrcConnectionRequest->ue_Identity.choice.s_TMSI; + mme_code_t mme_code = BIT_STRING_to_uint8(&s_TMSI.mmec); + m_tmsi_t m_tmsi = BIT_STRING_to_uint32(&s_TMSI.m_TMSI); + random_value = (((uint64_t)mme_code) << 32) | m_tmsi; + if ((ue_context_p = rrc_eNB_ue_context_stmsi_exist(ctxt_pP, mme_code, m_tmsi))) { + LOG_I(RRC," S-TMSI exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p,ue_context_p->ue_context.rnti,ctxt_pP->rnti); + rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti); + stmsi_received=1; + /* replace rnti in the context */ + /* for that, remove the context from the RB tree */ + RB_REMOVE(rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p); + /* and insert again, after changing rnti everywhere it has to be changed */ + ue_context_p->ue_id_rnti = ctxt_pP->rnti; + ue_context_p->ue_context.rnti = ctxt_pP->rnti; + RB_INSERT(rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p); + /* reset timers */ + ue_context_p->ue_context.ul_failure_timer = 0; + ue_context_p->ue_context.ue_release_timer = 0; + ue_context_p->ue_context.ue_reestablishment_timer = 0; + ue_context_p->ue_context.ue_release_timer_s1 = 0; + ue_context_p->ue_context.ue_release_timer_rrc = 0; + } else { + LOG_I(RRC," S-TMSI doesn't exist, setting Initialue_identity_s_TMSI.m_tmsi to %p => %x\n",ue_context_p,m_tmsi); +// ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, NOT_A_RANDOM_UE_IDENTITY); + ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP,random_value); + if (ue_context_p == NULL) + LOG_E(RRC, "%s:%d:%s: rrc_eNB_get_next_free_ue_context returned NULL\n", __FILE__, __LINE__, __FUNCTION__); + if (ue_context_p != NULL) { + ue_context_p->ue_context.Initialue_identity_s_TMSI.presence = TRUE; + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code = mme_code; + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi = m_tmsi; + } else { + /* TODO: do we have to break here? */ + //break; + } + } + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Srb_info->Rx_buffer.Payload, + dec_rval.consumed, + MSC_AS_TIME_FMT" RRCConnectionRequest UE %x size %u (s-TMSI mmec %u m_TMSI %u random UE id (0x%" PRIx64 ")", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + dec_rval.consumed, + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.random_ue_identity); + } else { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionRequest without random UE identity or S-TMSI not supported, let's reject the UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rrc_eNB_generate_RRCConnectionReject(ctxt_pP, + rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti), + CC_id); + break; + } + + } + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" UE context: %p\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p); + + if (ue_context_p != NULL) { + + +#if defined(ENABLE_ITTI) + ue_context_p->ue_context.establishment_cause = rrcConnectionRequest->establishmentCause; + ue_context_p->ue_context.reestablishment_cause = ReestablishmentCause_spare1; + if (stmsi_received==0) + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection from UE random UE identity (0x%" PRIx64 ") MME code %u TMSI %u cause %ld\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p->ue_context.random_ue_identity, + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.establishment_cause); + else + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection from UE MME code %u TMSI %u cause %ld\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.establishment_cause); +#else + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection for UE random UE identity (0x%" PRIx64 ")\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + ue_context_p->ue_context.random_ue_identity); +#endif + if (stmsi_received == 0) + RC.rrc[ctxt_pP->module_id]->Nb_ue++; + + } else { + // no context available + if (rrc_agent_registered[ctxt_pP->module_id]) { + agent_rrc_xface[ctxt_pP->module_id]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, + ctxt_pP->rnti, + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); + } + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Can't create new context for UE random UE identity (0x%" PRIx64 ")\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + random_value); + rrc_mac_remove_ue(ctxt_pP->module_id,ctxt_pP->rnti); + return -1; + } + } + +#ifndef NO_RRM + send_msg(&S_rrc, msg_rrc_MR_attach_ind(ctxt_pP->module_id, Mac_id)); +#else + + ue_context_p->ue_context.primaryCC_id = CC_id; + + //LG COMMENT Idx = (ue_mod_idP * NB_RB_MAX) + DCCH; + Idx = DCCH; + // SRB1 + ue_context_p->ue_context.Srb1.Active = 1; + ue_context_p->ue_context.Srb1.Srb_info.Srb_id = Idx; + memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[0], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[1], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + + // SRB2: set it to go through SRB1 with id 1 (DCCH) + ue_context_p->ue_context.Srb2.Active = 1; + ue_context_p->ue_context.Srb2.Srb_info.Srb_id = Idx; + memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[0], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[1], + &DCCH_LCHAN_DESC, + LCHAN_DESC_SIZE); + + rrc_eNB_generate_RRCConnectionSetup(ctxt_pP, ue_context_p, CC_id); + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1 (rbid %d)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + Idx); + + MSC_LOG_TX_MESSAGE( + MSC_RRC_ENB, + MSC_PDCP_ENB, + NULL, + 0, + MSC_AS_TIME_FMT" CONFIG_REQ UE %x SRB", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti); + + rrc_pdcp_config_asn1_req(ctxt_pP, + ue_context_p->ue_context.SRB_configList, + (DRB_ToAddModList_t *) NULL, + (DRB_ToReleaseList_t*) NULL, + 0xff, + NULL, + NULL, + NULL +# if defined(Rel10) || defined(Rel14) + , (PMCH_InfoList_r9_t *) NULL +# endif + ,NULL); + + rrc_rlc_config_asn1_req(ctxt_pP, + ue_context_p->ue_context.SRB_configList, + (DRB_ToAddModList_t*) NULL, + (DRB_ToReleaseList_t*) NULL +# if defined(Rel10) || defined(Rel14) + , (PMCH_InfoList_r9_t *) NULL +# endif + ); +#endif //NO_RRM + + break; + + default: + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown message\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rval = -1; + break; + } + + rval = 0; + } else { + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown error \n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + rval = -1; + } + + return rval; +} + +//----------------------------------------------------------------------------- +int +rrc_eNB_decode_dcch( + const protocol_ctxt_t* const ctxt_pP, + const rb_id_t Srb_id, + const uint8_t* const Rx_sdu, + const sdu_size_t sdu_sizeP +) +//----------------------------------------------------------------------------- +{ + + asn_dec_rval_t dec_rval; + //UL_DCCH_Message_t uldcchmsg; + UL_DCCH_Message_t *ul_dcch_msg = NULL; //&uldcchmsg; + int i; + struct rrc_eNB_ue_context_s* ue_context_p = NULL; +#if defined(ENABLE_ITTI) +# if defined(ENABLE_USE_MME) + MessageDef * msg_delete_tunnels_p = NULL; + uint8_t xid; +#endif +#endif + + int dedicated_DRB=0; + + T(T_ENB_RRC_UL_DCCH_DATA_IN, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + if ((Srb_id != 1) && (Srb_id != 2)) { + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received message on SRB%d, should not have ...\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + Srb_id); + } else { + LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received message on SRB%d\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + Srb_id); + } + //memset(ul_dcch_msg,0,sizeof(UL_DCCH_Message_t)); + + LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Decoding UL-DCCH Message\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + dec_rval = uper_decode( + NULL, + &asn_DEF_UL_DCCH_Message, + (void**)&ul_dcch_msg, + Rx_sdu, + sdu_sizeP, + 0, + 0); + /* +#if defined(ENABLE_ITTI) +# if defined(DISABLE_ITTI_XER_PRINT) + { + MessageDef *message_p; + + message_p = itti_alloc_new_message(TASK_RRC_ENB, RRC_UL_DCCH_MESSAGE); + memcpy(&message_p->ittiMsg, (void *)ul_dcch_msg, sizeof(RrcUlDcchMessage)); + + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, message_p); + } +# else + { + char message_string[10000]; + size_t message_string_size; + + if ((message_string_size = + xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg)) >= 0) { + MessageDef *msg_p; + + msg_p = itti_alloc_new_message_sized(TASK_RRC_ENB, RRC_UL_DCCH, message_string_size + sizeof(IttiMsgText)); + msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size; + memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); + } + } +# endif +#endif + */ + { + for (i = 0; i < sdu_sizeP; i++) { + LOG_T(RRC, "%x.", Rx_sdu[i]); + } + + LOG_T(RRC, "\n"); + } + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Failed to decode UL-DCCH (%zu bytes)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + dec_rval.consumed); + return -1; + } + + ue_context_p = rrc_eNB_get_ue_context( + RC.rrc[ctxt_pP->module_id], + ctxt_pP->rnti); + + if (ul_dcch_msg->message.present == UL_DCCH_MessageType_PR_c1) { + + switch (ul_dcch_msg->message.choice.c1.present) { + case UL_DCCH_MessageType__c1_PR_NOTHING: /* No components present */ + break; + + case UL_DCCH_MessageType__c1_PR_csfbParametersRequestCDMA2000: + break; + + case UL_DCCH_MessageType__c1_PR_measurementReport: + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND " + "%d bytes (measurementReport) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); + rrc_eNB_process_MeasurementReport( + ctxt_pP, + ue_context_p, + &ul_dcch_msg->message.choice.c1.choice.measurementReport. + criticalExtensions.choice.c1.choice.measurementReport_r8.measResults); + break; + + case UL_DCCH_MessageType__c1_PR_rrcConnectionReconfigurationComplete: +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Reconfiguration Complete\n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" RRCConnectionReconfigurationComplete UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(RRCConnectionReconfigurationComplete) ---> RRC_eNB]\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); + + if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions. + present == + RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8) { + /*NN: revise the condition */ + if (ue_context_p->ue_context.Status == RRC_RECONFIGURED){ + dedicated_DRB = 1; + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + }else { + dedicated_DRB = 0; + ue_context_p->ue_context.Status = RRC_RECONFIGURED; + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (default DRB, xid %ld)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + } + rrc_eNB_process_RRCConnectionReconfigurationComplete( + ctxt_pP, + ue_context_p, + ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + + //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future + if (rrc_agent_registered[ctxt_pP->module_id]) { + agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, + ue_context_p->ue_id_rnti, + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED); + } + } +#if defined(ENABLE_ITTI) +# if defined(ENABLE_USE_MME) + if (EPC_MODE_ENABLED == 1) { + if (dedicated_DRB == 1){ +// rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(ctxt_pP, +// ue_context_p, +// ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); +if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { + rrc_eNB_send_S1AP_E_RAB_MODIFY_RESP(ctxt_pP, + ue_context_p, + ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + + ue_context_p->ue_context.nb_of_modify_e_rabs = 0; + ue_context_p->ue_context.nb_of_failed_e_rabs = 0; + memset(ue_context_p->ue_context.modify_e_rab, 0, sizeof(ue_context_p->ue_context.modify_e_rab)); + for(int i = 0; i < NB_RB_MAX; i++) { + ue_context_p->ue_context.modify_e_rab[i].xid = -1; + } + + } else if(ue_context_p->ue_context.e_rab_release_command_flag == 1){ + xid = ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier; + ue_context_p->ue_context.e_rab_release_command_flag = 0; + //gtp tunnel delete + msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ); + memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); + GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; + for(i = 0; i < NB_RB_MAX; i++){ + if(xid == ue_context_p->ue_context.e_rab[i].xid){ + GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = ue_context_p->ue_context.enb_gtp_ebi[i]; + ue_context_p->ue_context.enb_gtp_teid[i] = 0; + memset(&ue_context_p->ue_context.enb_gtp_addrs[i], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[i])); + ue_context_p->ue_context.enb_gtp_ebi[i] = 0; + } + } + itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->instance, msg_delete_tunnels_p); + //S1AP_E_RAB_RELEASE_RESPONSE + rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(ctxt_pP, + ue_context_p, + xid); + } else { + rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(ctxt_pP, + ue_context_p, + ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); + } + }else { + if(ue_context_p->ue_context.reestablishment_cause == ReestablishmentCause_spare1){ + rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP, + ue_context_p); + } else { + ue_context_p->ue_context.reestablishment_cause = ReestablishmentCause_spare1; + for (uint8_t e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { + if (ue_context_p->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE) { + ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED; + } else { + ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_FAILED; + } + } + } + } + } +#else // establish a dedicated bearer + if (dedicated_DRB == 0 ) { + // ue_context_p->ue_context.e_rab[0].status = E_RAB_STATUS_ESTABLISHED; + rrc_eNB_reconfigure_DRBs(ctxt_pP,ue_context_p); + } + +#endif +#endif + break; + + case UL_DCCH_MessageType__c1_PR_rrcConnectionReestablishmentComplete: + T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection Reestablishment Complete\n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" rrcConnectionReestablishmentComplete UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(rrcConnectionReestablishmentComplete) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); + { + int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); + RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 0; + rnti_t reestablish_rnti = 0; + // select C-RNTI from map + for (i = 0; i < NUMBER_OF_UE_MAX; i++) { + if (reestablish_rnti_map[i][0] == ctxt_pP->rnti) { + reestablish_rnti = reestablish_rnti_map[i][1]; + ue_context_p = rrc_eNB_get_ue_context( + RC.rrc[ctxt_pP->module_id], + reestablish_rnti); + // clear currentC-RNTI from map + reestablish_rnti_map[i][0] = 0; + reestablish_rnti_map[i][1] = 0; + break; + } + } + LOG_D(RRC, "reestablish_rnti_map[%d] [0] %x, [1] %x\n", + i, reestablish_rnti_map[i][0], reestablish_rnti_map[i][1]); + + if (!ue_context_p) { + LOG_E(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentComplete without UE context, falt\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + break; + } + + if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.present == + RRCConnectionReestablishmentComplete__criticalExtensions_PR_rrcConnectionReestablishmentComplete_r8) { + rrc_eNB_process_RRCConnectionReestablishmentComplete(ctxt_pP, reestablish_rnti, ue_context_p, + ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.rrc_TransactionIdentifier, + &ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.choice.rrcConnectionReestablishmentComplete_r8); + + //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future + if (mac_agent_registered[ctxt_pP->module_id]) { + agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, + ue_context_p->ue_id_rnti, + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); + } + } + //ue_context_p->ue_context.ue_release_timer = 0; + ue_context_p->ue_context.ue_reestablishment_timer = 1; + // remove UE after 100 frames after RRCConnectionReestablishmentRelease is triggered + ue_context_p->ue_context.ue_reestablishment_timer_thres = 1000; + } + break; + + case UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete: +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Connection SetupComplete\n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" RRCConnectionSetupComplete UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(RRCConnectionSetupComplete) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); + + if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.present == + RRCConnectionSetupComplete__criticalExtensions_PR_c1) { + if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1. + present == + RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8) { + rrc_eNB_process_RRCConnectionSetupComplete( + ctxt_pP, + ue_context_p, + &ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8); + ue_context_p->ue_context.Status = RRC_CONNECTED; + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); + + //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future + if (rrc_agent_registered[ctxt_pP->module_id]) { + agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, + ue_context_p->ue_id_rnti, + PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); + } + } + } + + ue_context_p->ue_context.ue_release_timer=0; + break; + + case UL_DCCH_MessageType__c1_PR_securityModeComplete: + T(T_ENB_RRC_SECURITY_MODE_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Security Mode Complete\n"); + + for (i = 0; i < sdu_sizeP; i++) eNB->pusch_vars[UE_id]{ + LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" securityModeComplete UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" received securityModeComplete on UL-DCCH %d from UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH); + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(securityModeComplete) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); +#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg); +#endif + // confirm with PDCP about the security mode for DCCH + //rrc_pdcp_config_req (enb_mod_idP, frameP, 1,CONFIG_ACTION_SET_SECURITY_MODE, (ue_mod_idP * NB_RB_MAX) + DCCH, 0x77); + // continue the procedure + rrc_eNB_generate_UECapabilityEnquiry( + ctxt_pP, + ue_context_p); + break; + + case UL_DCCH_MessageType__c1_PR_securityModeFailure: + T(T_ENB_RRC_SECURITY_MODE_FAILURE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC Security Mode Failure\n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" securityModeFailure UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + + LOG_W(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(securityModeFailure) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); +#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg); +#endif + // cancel the security mode in PDCP + + // followup with the remaining procedure +//#warning "LG Removed rrc_eNB_generate_UECapabilityEnquiry after receiving securityModeFailure" + rrc_eNB_generate_UECapabilityEnquiry(ctxt_pP, ue_context_p); + break; + + case UL_DCCH_MessageType__c1_PR_ueCapabilityInformation: + T(T_ENB_RRC_UE_CAPABILITY_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC UECapablility Information \n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" ueCapabilityInformation UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + + LOG_I(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" received ueCapabilityInformation on UL-DCCH %d from UE\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH); + LOG_D(RRC, + PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " + "(UECapabilityInformation) ---> RRC_eNB\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + DCCH, + sdu_sizeP); +#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg); +#endif + LOG_I(RRC, "got UE capabilities for UE %x\n", ctxt_pP->rnti); + if (ue_context_p->ue_context.UE_Capability) { + LOG_I(RRC, "freeing old UE capabilities for UE %x\n", ctxt_pP->rnti); + asn_DEF_UE_EUTRA_Capability.free_struct(&asn_DEF_UE_EUTRA_Capability, + ue_context_p->ue_context.UE_Capability, 0); + ue_context_p->ue_context.UE_Capability = 0; + } + dec_rval = uper_decode(NULL, + &asn_DEF_UE_EUTRA_Capability, + (void **)&ue_context_p->ue_context.UE_Capability, + ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions. + choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list. + array[0]->ueCapabilityRAT_Container.buf, + ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions. + choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list. + array[0]->ueCapabilityRAT_Container.size, 0, 0); +#ifdef XER_PRINT + xer_fprint(stdout, &asn_DEF_UE_EUTRA_Capability, ue_context_p->ue_context.UE_Capability); +#endif + + if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Failed to decode UE capabilities (%zu bytes)\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + dec_rval.consumed); + asn_DEF_UE_EUTRA_Capability.free_struct(&asn_DEF_UE_EUTRA_Capability, + ue_context_p->ue_context.UE_Capability, 0); + ue_context_p->ue_context.UE_Capability = 0; + } + +#if defined(ENABLE_USE_MME) + + if (EPC_MODE_ENABLED == 1) { + rrc_eNB_send_S1AP_UE_CAPABILITIES_IND(ctxt_pP, + ue_context_p, + ul_dcch_msg); + } +#else + ue_context_p->ue_context.nb_of_e_rabs = 1; + for (i = 0; i < ue_context_p->ue_context.nb_of_e_rabs; i++){ + ue_context_p->ue_context.e_rab[i].status = E_RAB_STATUS_NEW; + ue_context_p->ue_context.e_rab[i].param.e_rab_id = 1+i; + ue_context_p->ue_context.e_rab[i].param.qos.qci=9; + } + ue_context_p->ue_context.setup_e_rabs =ue_context_p->ue_context.nb_of_e_rabs; +#endif + + rrc_eNB_generate_defaultRRCConnectionReconfiguration(ctxt_pP, + ue_context_p, + RC.rrc[ctxt_pP->module_id]->HO_flag); + break; + + case UL_DCCH_MessageType__c1_PR_ulHandoverPreparationTransfer: + T(T_ENB_RRC_UL_HANDOVER_PREPARATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + break; + + case UL_DCCH_MessageType__c1_PR_ulInformationTransfer: + T(T_ENB_RRC_UL_INFORMATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + LOG_D(RRC,"[MSG] RRC UL Information Transfer \n"); +#ifdef RRC_MSG_PRINT + LOG_F(RRC,"[MSG] RRC UL Information Transfer \n"); + + for (i = 0; i < sdu_sizeP; i++) { + LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); + } + + LOG_F(RRC,"\n"); +#endif + + + MSC_LOG_RX_MESSAGE( + MSC_RRC_ENB, + MSC_RRC_UE, + Rx_sdu, + sdu_sizeP, + MSC_AS_TIME_FMT" ulInformationTransfer UE %x size %u", + MSC_AS_TIME_ARGS(ctxt_pP), + ue_context_p->ue_context.rnti, + sdu_sizeP); + +#if defined(ENABLE_USE_MME) + + if (EPC_MODE_ENABLED == 1) { + rrc_eNB_send_S1AP_UPLINK_NAS(ctxt_pP, + ue_context_p, + ul_dcch_msg); + } + +#endif + break; + + case UL_DCCH_MessageType__c1_PR_counterCheckResponse: + T(T_ENB_RRC_COUNTER_CHECK_RESPONSE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + break; + +#if defined(Rel10) || defined(Rel14) + + case UL_DCCH_MessageType__c1_PR_ueInformationResponse_r9: + T(T_ENB_RRC_UE_INFORMATION_RESPONSE_R9, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + break; + + case UL_DCCH_MessageType__c1_PR_proximityIndication_r9: + T(T_ENB_RRC_PROXIMITY_INDICATION_R9, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + break; + + case UL_DCCH_MessageType__c1_PR_rnReconfigurationComplete_r10: + T(T_ENB_RRC_RECONFIGURATION_COMPLETE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + break; + + case UL_DCCH_MessageType__c1_PR_mbmsCountingResponse_r10: + T(T_ENB_RRC_MBMS_COUNTING_RESPONSE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + break; + + case UL_DCCH_MessageType__c1_PR_interFreqRSTDMeasurementIndication_r10: + T(T_ENB_RRC_INTER_FREQ_RSTD_MEASUREMENT_INDICATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + break; +#endif + + default: + T(T_ENB_RRC_UNKNOW_MESSAGE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), + T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); + + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown message %s:%u\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + __FILE__, __LINE__); + return -1; + } + + return 0; + } else { + LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown error %s:%u\n", + PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), + __FILE__, __LINE__); + return -1; + } + +} + +#if defined(ENABLE_ITTI) +void rrc_eNB_reconfigure_DRBs (const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* ue_context_pP){ + + int i; + int e_rab_done=0; + for (i = 0; + i < 3;//NB_RB_MAX - 3; // S1AP_MAX_E_RAB + i++) { + + if ( ue_context_pP->ue_context.e_rab[i].status < E_RAB_STATUS_DONE){ + ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_NEW; + ue_context_pP->ue_context.e_rab[i].param.e_rab_id = i + 1; + ue_context_pP->ue_context.e_rab[i].param.qos.qci = i % 9; + ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.priority_level= i % PRIORITY_LEVEL_LOWEST; + ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.pre_emp_capability= PRE_EMPTION_CAPABILITY_DISABLED; + ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.pre_emp_vulnerability= PRE_EMPTION_VULNERABILITY_DISABLED; + ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL; + ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length = 0; + // memset (ue_context_pP->ue_context.e_rab[i].param.sgw_addr.buffer,0,20); + ue_context_pP->ue_context.e_rab[i].param.sgw_addr.length = 0; + ue_context_pP->ue_context.e_rab[i].param.gtp_teid=0; + + ue_context_pP->ue_context.nb_of_e_rabs++; + e_rab_done++; + LOG_I(RRC,"setting up the dedicated DRBs %d (index %d) status %d \n", + ue_context_pP->ue_context.e_rab[i].param.e_rab_id, i, ue_context_pP->ue_context.e_rab[i].status); + } + } + ue_context_pP->ue_context.setup_e_rabs+=e_rab_done; + + rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(ctxt_pP, ue_context_pP, 0); +} + + +//----------------------------------------------------------------------------- +void* +rrc_enb_task( + void* args_p +) +//----------------------------------------------------------------------------- +{ + MessageDef *msg_p; + const char *msg_name_p; + instance_t instance; + int result; + SRB_INFO *srb_info_p; + int CC_id; + + protocol_ctxt_t ctxt; + itti_mark_task_ready(TASK_RRC_ENB); + LOG_I(RRC,"Entering main loop of RRC message task\n"); + while (1) { + // Wait for a message + itti_receive_msg(TASK_RRC_ENB, &msg_p); + + msg_name_p = ITTI_MSG_NAME(msg_p); + instance = ITTI_MSG_INSTANCE(msg_p); + LOG_I(RRC,"Received message %s\n",msg_name_p); + + switch (ITTI_MSG_ID(msg_p)) { + case TERMINATE_MESSAGE: + LOG_W(RRC, " *** Exiting RRC thread\n"); + itti_exit_task(); + break; + + case MESSAGE_TEST: + LOG_I(RRC, "[eNB %d] Received %s\n", instance, msg_name_p); + break; + + /* Messages from MAC */ + case RRC_MAC_CCCH_DATA_IND: + PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, + instance, + ENB_FLAG_YES, + RRC_MAC_CCCH_DATA_IND(msg_p).rnti, + msg_p->ittiMsgHeader.lte_time.frame, + msg_p->ittiMsgHeader.lte_time.slot); + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received %s\n", + PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt), + msg_name_p); + + CC_id = RRC_MAC_CCCH_DATA_IND(msg_p).CC_id; + srb_info_p = &RC.rrc[instance]->carrier[CC_id].Srb0; + + LOG_I(RRC,"Decoding CCCH : inst %d, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n", + instance,CC_id,&ctxt, RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); + AssertFatal(RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size < RRC_BUFFER_SIZE_MAX, + "CCCH message has size %d > %d\n", + RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,RRC_BUFFER_SIZE_MAX); + memcpy(srb_info_p->Rx_buffer.Payload, + RRC_MAC_CCCH_DATA_IND(msg_p).sdu, + RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); + srb_info_p->Rx_buffer.payload_size = RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size; + + rrc_eNB_decode_ccch(&ctxt, srb_info_p, CC_id); + break; + + /* Messages from PDCP */ + case RRC_DCCH_DATA_IND: + PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, + instance, + ENB_FLAG_YES, + RRC_DCCH_DATA_IND(msg_p).rnti, + msg_p->ittiMsgHeader.lte_time.frame, + msg_p->ittiMsgHeader.lte_time.slot); + LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received on DCCH %d %s\n", + PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt), + RRC_DCCH_DATA_IND(msg_p).dcch_index, + msg_name_p); + rrc_eNB_decode_dcch(&ctxt, + RRC_DCCH_DATA_IND(msg_p).dcch_index, + RRC_DCCH_DATA_IND(msg_p).sdu_p, + RRC_DCCH_DATA_IND(msg_p).sdu_size); + + // Message buffer has been processed, free it now. + result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), RRC_DCCH_DATA_IND(msg_p).sdu_p); + AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); + break; + +# if defined(ENABLE_USE_MME) + + /* Messages from S1AP */ + case S1AP_DOWNLINK_NAS: + rrc_eNB_process_S1AP_DOWNLINK_NAS(msg_p, msg_name_p, instance, &rrc_eNB_mui); + break; + + case S1AP_INITIAL_CONTEXT_SETUP_REQ: + rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(msg_p, msg_name_p, instance); + break; + + case S1AP_UE_CTXT_MODIFICATION_REQ: + rrc_eNB_process_S1AP_UE_CTXT_MODIFICATION_REQ(msg_p, msg_name_p, instance); + break; + + case S1AP_PAGING_IND: + LOG_D(RRC, "[eNB %d] Received Paging message from S1AP: %s\n", instance, msg_name_p); + rrc_eNB_process_PAGING_IND(msg_p, msg_name_p, instance); + break; + + case S1AP_E_RAB_SETUP_REQ: + rrc_eNB_process_S1AP_E_RAB_SETUP_REQ(msg_p, msg_name_p, instance); + LOG_D(RRC, "[eNB %d] Received the message %s\n", instance, msg_name_p); + break; + + case S1AP_E_RAB_MODIFY_REQ: + rrc_eNB_process_S1AP_E_RAB_MODIFY_REQ(msg_p, msg_name_p, instance); + break; + + case S1AP_E_RAB_RELEASE_COMMAND: + rrc_eNB_process_S1AP_E_RAB_RELEASE_COMMAND(msg_p, msg_name_p, instance); + break; + + case S1AP_UE_CONTEXT_RELEASE_REQ: + rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_REQ(msg_p, msg_name_p, instance); + break; + + case S1AP_UE_CONTEXT_RELEASE_COMMAND: + rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND(msg_p, msg_name_p, instance); + break; + + case GTPV1U_ENB_DELETE_TUNNEL_RESP: + /* Nothing to do. Apparently everything is done in S1AP processing */ + //LOG_I(RRC, "[eNB %d] Received message %s, not processed because procedure not synched\n", + //instance, msg_name_p); + if (rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti) + && rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc > 0) { + rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc = + rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_thres_rrc; + } + break; + +# endif + + /* Messages from eNB app */ + case RRC_CONFIGURATION_REQ: + LOG_I(RRC, "[eNB %d] Received %s : %p\n", instance, msg_name_p,&RRC_CONFIGURATION_REQ(msg_p)); + openair_rrc_eNB_configuration(ENB_INSTANCE_TO_MODULE_ID(instance), &RRC_CONFIGURATION_REQ(msg_p)); + break; + + default: + LOG_E(RRC, "[eNB %d] Received unexpected message %s\n", instance, msg_name_p); + break; + } + + result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), msg_p); + AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); + msg_p = NULL; + } +} +#endif + +/*------------------------------------------------------------------------------*/ +void +openair_rrc_top_init_eNB(int eMBMS_active,uint8_t HO_active) +//----------------------------------------------------------------------------- +{ + + module_id_t module_id; + int CC_id; + + /* for no gcc warnings */ + (void)CC_id; + + LOG_D(RRC, "[OPENAIR][INIT] Init function start: NB_eNB_INST=%d\n", RC.nb_inst); + + if (RC.nb_inst > 0) { + LOG_I(RRC,"[eNB] handover active state is %d \n", HO_active); + + for (module_id=0; module_idHO_flag = (uint8_t)HO_active; + } + +#if defined(Rel10) || defined(Rel14) + LOG_I(RRC,"[eNB] eMBMS active state is %d \n", eMBMS_active); + + for (module_id=0; module_idcarrier[CC_id].MBMS_flag = (uint8_t)eMBMS_active; + } + } + +#endif +#ifdef CBA + + for (module_id=0; module_idcarrier[CC_id].num_active_cba_groups = cba_group_active; + } + } + +#endif + } + + +} + +//----------------------------------------------------------------------------- +void +rrc_top_cleanup_eNB( + void +) +//----------------------------------------------------------------------------- +{ + + for (int i=0;imodule_id]->rrc_ue_head)) { + if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe==0)) { + if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) { + LOG_I(RRC,"UE rnti %x:S-TMSI %x failure timer %d/8\n", + ue_context_p->ue_context.rnti, + ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, + ue_context_p->ue_context.ul_failure_timer); + } + else { + LOG_I(RRC,"UE rnti %x failure timer %d/8\n", + ue_context_p->ue_context.rnti, + ue_context_p->ue_context.ul_failure_timer); + } + } + if (ue_context_p->ue_context.ul_failure_timer>0) { + ue_context_p->ue_context.ul_failure_timer++; + if (ue_context_p->ue_context.ul_failure_timer >= 8) { + // remove UE after 20 seconds after MAC has indicated UL failure + LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti); + ue_to_be_removed = ue_context_p; + break; + } + } + if (ue_context_p->ue_context.ue_release_timer_s1>0) { + ue_context_p->ue_context.ue_release_timer_s1++; + if (ue_context_p->ue_context.ue_release_timer_s1 >= + ue_context_p->ue_context.ue_release_timer_thres_s1) { + LOG_I(RRC,"Removing UE %x instance Because of UE_CONTEXT_RELEASE_COMMAND not received after %d ms from sending request\n", + ue_context_p->ue_context.rnti, ue_context_p->ue_context.ue_release_timer_thres_s1); + ue_to_be_removed = ue_context_p; + break; + } + } + + if (ue_context_p->ue_context.ue_release_timer_rrc>0) { + ue_context_p->ue_context.ue_release_timer_rrc++; + if (ue_context_p->ue_context.ue_release_timer_rrc >= + ue_context_p->ue_context.ue_release_timer_thres_rrc) { + LOG_I(RRC,"Removing UE %x instance After UE_CONTEXT_RELEASE_Complete\n", ue_context_p->ue_context.rnti); + ue_to_be_removed = ue_context_p; + break; + } + } + + if (ue_context_p->ue_context.ue_reestablishment_timer>0) { + ue_context_p->ue_context.ue_reestablishment_timer++; + if (ue_context_p->ue_context.ue_reestablishment_timer >= + ue_context_p->ue_context.ue_reestablishment_timer_thres) { + LOG_I(RRC,"UE %d reestablishment_timer max\n",ue_context_p->ue_context.rnti); + ue_context_p->ue_context.ul_failure_timer = 20000; + ue_to_be_removed = ue_context_p; + ue_context_p->ue_context.ue_reestablishment_timer = 0; + break; + } + } + if (ue_context_p->ue_context.ue_release_timer>0) { + ue_context_p->ue_context.ue_release_timer++; + if (ue_context_p->ue_context.ue_release_timer >= + ue_context_p->ue_context.ue_release_timer_thres) { + LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti); + ue_to_be_removed = ue_context_p; + break; + } + } + } + if (ue_to_be_removed) { + if(ue_to_be_removed->ue_context.ul_failure_timer >= 8) { + ue_to_be_removed->ue_context.ue_release_timer_s1 = 1; + ue_to_be_removed->ue_context.ue_release_timer_thres_s1 = 100; + ue_to_be_removed->ue_context.ue_release_timer = 0; + ue_to_be_removed->ue_context.ue_reestablishment_timer = 0; + } + rrc_eNB_free_UE(ctxt_pP->module_id,ue_to_be_removed); + if(ue_to_be_removed->ue_context.ul_failure_timer >= 8){ + ue_to_be_removed->ue_context.ul_failure_timer = 0; + } + } + +#ifdef RRC_LOCALIZATION + + /* for the localization, only primary CC_id might be relevant*/ + gettimeofday(&ts, NULL); + current_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000; + ref_timestamp_ms = RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms; + RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { + ctxt = *ctxt_pP; + ctxt.rnti = ue_context_p->ue_context.rnti; + estimated_distance = rrc_get_estimated_ue_distance( + &ctxt, + CC_id, + RC.rrc[ctxt_pP->module_id]->loc_type); + + if ((current_timestamp_ms - ref_timestamp_ms > RC.rrc[ctxt_pP->module_id]->aggregation_period_ms) && + estimated_distance != -1) { + LOG_D(LOCALIZE, " RRC [UE/id %d -> eNB/id %d] timestamp %d frame %d estimated r = %f\n", + ctxt.rnti, + ctxt_pP->module_id, + current_timestamp_ms, + ctxt_pP->frame, + estimated_distance); + LOG_D(LOCALIZE, " RRC status %d\n", ue_context_p->ue_context.Status); + push_front(&RC.rrc[ctxt_pP->module_id]->loc_list, + estimated_distance); + RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms = current_timestamp_ms; + } + } + +#endif + (void)ts; /* remove gcc warning "unused variable" */ + (void)ref_timestamp_ms; /* remove gcc warning "unused variable" */ + (void)current_timestamp_ms; /* remove gcc warning "unused variable" */ + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT); + return (RRC_OK); +} + diff --git a/openair2/RRC/NR/rrc_types_NR.h b/openair2/RRC/NR/rrc_types_NR.h new file mode 100644 index 0000000000..f621d9b2dd --- /dev/null +++ b/openair2/RRC/NR/rrc_types_NR.h @@ -0,0 +1,64 @@ +/* + * 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 + */ + +/*! \file rrc_types.h +* \brief rrc types and subtypes +* \author Navid Nikaein and Raymond Knopp +* \date 2011 - 2014, 2018 +* \version 1.0 +* \company Eurecom +* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr +*/ + +#ifndef RRC_TYPES_NR_H_ +#define RRC_TYPES_NR_H_ + +typedef enum Rrc_State_NR_e { + RRC_STATE_INACTIVE_NR=0, + RRC_STATE_IDLE_NR, + RRC_STATE_CONNECTED_NR, + + RRC_STATE_FIRST_NR = RRC_STATE_INACTIVE_NR, + RRC_STATE_LAST_NR = RRC_STATE_CONNECTED_NR, +} Rrc_State_NR_t; + +typedef enum Rrc_Sub_State_NR_e { + RRC_SUB_STATE_INACTIVE_NR=0, + + RRC_SUB_STATE_IDLE_SEARCHING_NR, + RRC_SUB_STATE_IDLE_RECEIVING_SIB_NR, + RRC_SUB_STATE_IDLE_SIB_COMPLETE_NR, + RRC_SUB_STATE_IDLE_CONNECTING_NR, + RRC_SUB_STATE_IDLE_NR, + + RRC_SUB_STATE_CONNECTED_NR, + + RRC_SUB_STATE_INACTIVE_FIRST_NB_IoT = RRC_SUB_STATE_INACTIVE_NR, + RRC_SUB_STATE_INACTIVE_LAST_NB_IoT = RRC_SUB_STATE_INACTIVE_NR, + + RRC_SUB_STATE_IDLE_FIRST_NB_IoT = RRC_SUB_STATE_IDLE_SEARCHING_NR, + RRC_SUB_STATE_IDLE_LAST_NB_IoT = RRC_SUB_STATE_IDLE_NR, + + RRC_SUB_STATE_CONNECTED_FIRST_NB_IoT = RRC_SUB_STATE_CONNECTED_NR, + RRC_SUB_STATE_CONNECTED_LAST_NB_IoT = RRC_SUB_STATE_CONNECTED_NR, +} Rrc_Sub_State_NR_t; + +#endif /* RRC_TYPES_H_ */ From b61b9255445b0fcb39c427b987cced6043f87120 Mon Sep 17 00:00:00 2001 From: Calvin Date: Fri, 13 Apr 2018 10:59:37 +0200 Subject: [PATCH 04/13] create NR UE directory --- .../nfapi/public_inc/nr_fapi_ue_interface.h | 3886 +++++++++++++++++ 1 file changed, 3886 insertions(+) create mode 100644 nfapi/open-nFAPI/nfapi/public_inc/nr_fapi_ue_interface.h diff --git a/nfapi/open-nFAPI/nfapi/public_inc/nr_fapi_ue_interface.h b/nfapi/open-nFAPI/nfapi/public_inc/nr_fapi_ue_interface.h new file mode 100644 index 0000000000..fcfb7e7b25 --- /dev/null +++ b/nfapi/open-nFAPI/nfapi/public_inc/nr_fapi_ue_interface.h @@ -0,0 +1,3886 @@ +/* + * Copyright 2017 Cisco Systems, Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * 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. + */ + + +#ifndef _NFAPI_INTERFACE_NR_EXTENSION_H_ +#define _NFAPI_INTERFACE_NR_EXTENSION_H_ +#define _NFAPI_INTERFACE_H_ + +#include "stddef.h" + +// Constants - update based on implementation +#define NFAPI_MAX_PHY_RF_INSTANCES 2 +#define NFAPI_PNF_PARAM_GENERAL_LOCATION_LENGTH 16 +#define NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH 3 +#define NFAPI_MAX_NUM_RF_BANDS 16 + +// The following definition control the size of arrays used in the interface. +// These may be changed if desired. They are used in the encoder to make sure +// that the user has not specified a 'count' larger than the max array, and also +// used by the decoder when decode an array. If the 'count' received is larger +// than the array it is to be stored in the decode fails. +#define NFAPI_MAX_NUM_ANTENNAS 8 +#define NFAPI_MAX_NUM_SUBBANDS 13 +#define NFAPI_MAX_BF_VECTORS 8 +#define NFAPI_MAX_CC 1 +#define NFAPI_MAX_NUM_PHYSICAL_ANTENNAS 8 +#define NFAPI_MAX_RSSI 8 +#define NFAPI_MAX_PSC_LIST 32 +#define NFAPI_MAX_PCI_LIST 32 +#define NFAPI_MAX_CARRIER_LIST 32 +#define NFAPI_MAX_ARFCN_LIST 128 +#define NFAPI_MAX_LTE_CELLS_FOUND 8 +#define NFAPI_MAX_UTRAN_CELLS_FOUND 8 +#define NFAPI_MAX_GSM_CELLS_FOUND 8 +#define NFAPI_MAX_NB_IOT_CELLS_FOUND 8 +#define NFAPI_MAX_SI_PERIODICITY 8 +#define NFAPI_MAX_SI_INDEX 8 +#define NFAPI_MAX_MIB_LENGTH 32 +#define NFAPI_MAX_SIB_LENGTH 256 +#define NFAPI_MAX_SI_LENGTH 256 +#define NFAPI_MAX_OPAQUE_DATA 64 +#define NFAPI_MAX_NUM_SCHEDULED_UES 8 // Used in the TPM structure +#define NFAPI_MAX_PNF_PHY 5 +#define NFAPI_MAX_PNF_PHY_RF_CONFIG 5 +#define NFAPI_MAX_PNF_RF 5 +#define NFAPI_MAX_NMM_FREQUENCY_BANDS 32 +#define NFAPI_MAX_RECEIVED_INTERFERENCE_POWER_RESULTS 100 +#define NFAPI_MAX_UL_DL_CONFIGURATIONS 5 +#define NFAPI_MAX_CSI_RS_RESOURCE_CONFIG 4 +#define NFAPI_MAX_ANTENNA_PORT_COUNT 8 +#define NFAPI_MAX_EPDCCH_PRB 8 +#define NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS 8 +#define NFAPI_MAX_NUMBER_ACK_NACK_TDD 8 +#define NFAPI_MAX_RO_DL 8 + +#define NFAPI_HEADER_LENGTH 8 +#define NFAPI_P7_HEADER_LENGTH 16 + +#define NFAPI_VENDOR_EXTENSION_MIN_TAG_VALUE 0xF000 +#define NFAPI_VENDOR_EXTENSION_MAX_TAG_VALUE 0xFFFF + +#define NFAPI_VERSION_3_0_11 0x000 +#define NFAPI_VERSION_3_0_12 0x001 + +// The IANA agreed port definition of the P5 SCTP VNF enpoint +// http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml?search=7701 +#define NFAPI_P5_SCTP_PORT 7701 + +typedef unsigned int uint32_t; +typedef unsigned short uint16_t; +typedef unsigned char uint8_t; +typedef signed int int32_t; +typedef signed short int16_t; +typedef signed char int8_t; + +typedef struct { + uint16_t phy_id; + uint16_t message_id; + uint16_t message_length; + uint16_t spare; +} nfapi_p4_p5_message_header_t; + +typedef struct { + uint16_t phy_id; + uint16_t message_id; + uint16_t message_length; + uint16_t m_segment_sequence; /* This consists of 3 fields - namely, M, Segement & Sequence number*/ + uint32_t checksum; + uint32_t transmit_timestamp; +} nfapi_p7_message_header_t; + +#define NFAPI_PHY_ID_NA 0 + +//#define NFAPI_P7_GET_MORE(_mss) ( ((_mss) & 0x80) >> 7 ) +//#define NFAPI_P7_GET_SEGMENT(_mss) ( ((_mss) & 0x70) >> 4 ) +#define NFAPI_P7_GET_MORE(_mss) ( ((_mss) & 0x8000) >> 15 ) +#define NFAPI_P7_GET_SEGMENT(_mss) ( ((_mss) & 0x7F00) >> 8 ) +#define NFAPI_P7_GET_SEQUENCE(_mss) ( (_mss) & 0x00FF ) +#define NFAPI_P7_SET_MSS(_more, _segm, _sequ) ( (((_more) & 0x1) << 7) | (((_segm) & 0x7) << 4) | ((_sequ) & 0xF) ) + +typedef struct { + uint16_t tag; + uint16_t length; +} nfapi_tl_t; +#define NFAPI_TAG_LENGTH_PACKED_LEN 4 + +// Convenience methods to convert between SFN/SFN formats +#define NFAPI_SFNSF2DEC(_sfnsf) ((((_sfnsf) >> 4) * 10) + ((_sfnsf) & 0xF)) +#define NFAPI_SFNSFDEC2SFNSF(_sfnsf_dec) ((((_sfnsf_dec) / 10) << 4) | (((_sfnsf_dec) - (((_sfnsf_dec) / 10) * 10)) & 0xF)) + +#define NFAPI_SFNSF2SFN(_sfnsf) ((_sfnsf) >> 4) +#define NFAPI_SFNSF2SF(_sfnsf) ((_sfnsf) & 0xF) + +#define NFAPI_MAX_SFNSFDEC 10240 + +typedef nfapi_tl_t* nfapi_vendor_extension_tlv_t; + + +// nFAPI Message IDs +typedef enum { + NFAPI_DL_CONFIG_REQUEST = 0x0080, + NFAPI_UL_CONFIG_REQUEST, + NFAPI_SUBFRAME_INDICATION, + NFAPI_HI_DCI0_REQUEST, + NFAPI_TX_REQUEST, + NFAPI_HARQ_INDICATION, + NFAPI_CRC_INDICATION, + NFAPI_RX_ULSCH_INDICATION, + NFAPI_RACH_INDICATION, + NFAPI_SRS_INDICATION, + NFAPI_RX_SR_INDICATION, + NFAPI_RX_CQI_INDICATION, + NFAPI_LBT_DL_CONFIG_REQUEST, + NFAPI_LBT_DL_INDICATION, + NFAPI_NB_HARQ_INDICATION, + NFAPI_NRACH_INDICATION, + + NFAPI_PNF_PARAM_REQUEST = 0x0100, + NFAPI_PNF_PARAM_RESPONSE, + NFAPI_PNF_CONFIG_REQUEST, + NFAPI_PNF_CONFIG_RESPONSE, + NFAPI_PNF_START_REQUEST, + NFAPI_PNF_START_RESPONSE, + NFAPI_PNF_STOP_REQUEST, + NFAPI_PNF_STOP_RESPONSE, + NFAPI_PARAM_REQUEST, + NFAPI_PARAM_RESPONSE, + NFAPI_CONFIG_REQUEST, + NFAPI_CONFIG_RESPONSE, + NFAPI_START_REQUEST, + NFAPI_START_RESPONSE, + NFAPI_STOP_REQUEST, + NFAPI_STOP_RESPONSE, + NFAPI_MEASUREMENT_REQUEST, + NFAPI_MEASUREMENT_RESPONSE, + + NFAPI_UL_NODE_SYNC = 0x0180, + NFAPI_DL_NODE_SYNC, + NFAPI_TIMING_INFO, + + + NFAPI_RSSI_REQUEST = 0x0200, + NFAPI_RSSI_RESPONSE, + NFAPI_RSSI_INDICATION, + NFAPI_CELL_SEARCH_REQUEST, + NFAPI_CELL_SEARCH_RESPONSE, + NFAPI_CELL_SEARCH_INDICATION, + NFAPI_BROADCAST_DETECT_REQUEST, + NFAPI_BROADCAST_DETECT_RESPONSE, + NFAPI_BROADCAST_DETECT_INDICATION, + NFAPI_SYSTEM_INFORMATION_SCHEDULE_REQUEST, + NFAPI_SYSTEM_INFORMATION_SCHEDULE_RESPONSE, + NFAPI_SYSTEM_INFORMATION_SCHEDULE_INDICATION, + NFAPI_SYSTEM_INFORMATION_REQUEST, + NFAPI_SYSTEM_INFORMATION_RESPONSE, + NFAPI_SYSTEM_INFORMATION_INDICATION, + NFAPI_NMM_STOP_REQUEST, + NFAPI_NMM_STOP_RESPONSE, + + NFAPI_VENDOR_EXT_MSG_MIN = 0x0300, + NFAPI_VENDOR_EXT_MSG_MAX = 0x03FF, + + + NFAPI_MAX_MESSAGE_ID, +} nfapi_message_id_e; + +// nFAPI Error Codes +typedef enum { + NFAPI_MSG_OK = 0, + NFAPI_MSG_INVALID_STATE, + NFAPI_MSG_INVALID_CONFIG, + NFAPI_SFN_OUT_OF_SYNC, + NFAPI_MSG_SUBFRAME_ERR, + NFAPI_MSG_BCH_MISSING, + NFAPI_MSG_INVALID_SFN, + NFAPI_MSG_HI_ERR, + NFAPI_MSG_TX_ERR, + + NFAPI_LBT_NO_PDU_IN_DL_REQ, + NFAPI_LBT_NO_VALID_CONFIG_REQ_RECEIVED, + NFAPI_FAPI_E_LBT_SF_SFN_PASSED_END_SF_SFN, + NFAPI_FAPI_E_LBT_OVERLAP, + NFAPI_MSG_BCH_PRESENT, + + NFAPI_NBIOT_UNEXPECTED_REQ, + + // This is special return code that indicates that a response has + // been send via P9 + NFAPI_MSG_P9_RESPONSE = 0xAA +} nfapi_error_code_e; + + +typedef enum { + NFAPI_P4_MSG_OK = 100, + NFAPI_P4_MSG_INVALID_STATE = 101, + NFAPI_P4_MSG_INVALID_CONFIG = 102, + NFAPI_P4_MSG_RAT_NOT_SUPPORTED = 103, + NFAPI_P4_MSG_NMM_STOP_OK = 200, + NFAPI_P4_MSG_NMM_STOP_IGNOREDED = 201, + NFAPI_P4_MSG_NMM_STOP_INVALID_STATE = 202, + NFAPI_P4_MSG_PROCEDURE_COMPLETE = 300, + NFAPI_P4_MSG_PROCEDURE_STOPPED = 301, + NFAPI_P4_MSG_PARTIAL_RESULTS = 302, + NFAPI_P4_MSG_TIMEOUT = 303 +} nfapi_p4_error_code_e; + +// nFAPI enums +typedef enum { + NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE = 0, + NFAPI_DL_CONFIG_BCH_PDU_TYPE, + NFAPI_DL_CONFIG_MCH_PDU_TYPE, + NFAPI_DL_CONFIG_DLSCH_PDU_TYPE, + NFAPI_DL_CONFIG_PCH_PDU_TYPE, + NFAPI_DL_CONFIG_PRS_PDU_TYPE, + NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE, + NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE, + NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE, + NFAPI_DL_CONFIG_NBCH_PDU_TYPE, + NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE, + NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE +} nfapi_dl_config_pdu_type_e; + +typedef enum { + NFAPI_DL_DCI_FORMAT_1 = 0, + NFAPI_DL_DCI_FORMAT_1A, + NFAPI_DL_DCI_FORMAT_1B, + NFAPI_DL_DCI_FORMAT_1C, + NFAPI_DL_DCI_FORMAT_1D, + NFAPI_DL_DCI_FORMAT_2, + NFAPI_DL_DCI_FORMAT_2A, + NFAPI_DL_DCI_FORMAT_2B, + NFAPI_DL_DCI_FORMAT_2C +} nfapi_dl_dci_format_e; + +typedef enum { + NFAPI_UL_DCI_FORMAT_0 = 0, + NFAPI_UL_DCI_FORMAT_3, + NFAPI_UL_DCI_FORMAT_3A, + NFAPI_UL_DCI_FORMAT_4 +} nfapi_ul_dci_format_e; + +typedef enum { + NFAPI_UL_CONFIG_ULSCH_PDU_TYPE = 0, + NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE, + NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE, + NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE, + NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE, + NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE, + NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE, + NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE, + NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE, + NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE, + NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE, + NFAPI_UL_CONFIG_SRS_PDU_TYPE, + NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE, + NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE, + NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE, + NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE, + NFAPI_UL_CONFIG_NULSCH_PDU_TYPE, + NFAPI_UL_CONFIG_NRACH_PDU_TYPE, +} nfapi_ul_config_pdu_type_e; + +typedef enum { + NFAPI_HI_DCI0_HI_PDU_TYPE = 0, + NFAPI_HI_DCI0_DCI_PDU_TYPE, + NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE, + NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE, + NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE, +} nfapi_hi_dci0_pdu_type_e; + +typedef enum { + NFAPI_HARQ_ACK = 1, + NFAPI_HARQ_NACK, + NFAPI_HARQ_ACK_OR_NACK, + NFAPI_HARQ_DTX, + NFAPI_HARQ_ACK_OR_DTX, + NFAPI_HARQ_NACK_OR_DTX, + NFAPI_HARQ_ACK_OR_NACK_OR_DTX +} nfapi_harq_type_e; + +typedef enum { + NFAPI_CSI_REPORT_TYPE_PERIODIC = 0, + NFAPI_CSI_REPORT_TYPE_APERIODIC +} nfapi_csi_report_type_e; + +typedef enum { + NFAPI_DL_BW_SUPPORTED_6 = 1, + NFAPI_DL_BW_SUPPORTED_15 = 2, + NFAPI_DL_BW_SUPPORTED_25 = 4, + NFAPI_DL_BW_SUPPORTED_50 = 8, + NFAPI_DL_BW_SUPPORTED_75 = 16, + NFAPI_DL_BW_SUPPORTED_100 = 32 +} nfapi_dl_bandwith_supported_e; + +typedef enum { + NFAPI_UL_BW_SUPPORTED_6 = 1, + NFAPI_UL_BW_SUPPORTED_15 = 2, + NFAPI_UL_BW_SUPPORTED_25 = 4, + NFAPI_UL_BW_SUPPORTED_50 = 8, + NFAPI_UL_BW_SUPPORTED_75 = 16, + NFAPI_UL_BW_SUPPORTED_100 = 32 +} nfapi_ul_bandwith_supported_e; + +typedef enum { + NFAPI_3GPP_REL_SUPPORTED_8 = 0, + NFAPI_3GPP_REL_SUPPORTED_9 = 1, + NFAPI_3GPP_REL_SUPPORTED_10 = 2, + NFAPI_3GPP_REL_SUPPORTED_11 = 4, + NFAPI_3GPP_REL_SUPPORTED_12 = 8, + NFAPI_3GPP_REL_SUPPORTED_15 = 64 +} nfapi_3gpp_release_supported_e; + + +typedef enum { + NFAPI_DUPLEXING_MODE_TDD = 0, + NFAPI_DUPLEXING_MODE_FDD = 1, + NFAPI_DUPLEXING_MODE_HD_FDD = 2, +} nfapi_duplexing_mode_e; + +typedef enum { + NFAPI_CP_NORMAL = 0, + NFAPI_CP_EXTENDED = 1 +} nfapi_cyclic_prefix_type_e; + +typedef enum { + NFAPI_RAT_TYPE_LTE = 0, + NFAPI_RAT_TYPE_UTRAN = 1, + NFAPI_RAT_TYPE_GERAN = 2, + NFAPI_RAT_TYPE_NB_IOT = 3, + NFAPI_RAT_TYPE_NR = 4 +} nfapi_rat_type_e; + +typedef enum { + NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_BUNDLING, + NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_MULIPLEXING, + NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_SPECIAL_BUNDLING, + NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_CHANNEL_SELECTION, + NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_3, + NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_4, + NFAPI_HARQ_INDICATION_TDD_HARQ_ACK_NACK_FORMAT_FORMAT_5 +} nfapi_harq_indication_tdd_ack_nackformat_e; + + +typedef enum { + NFAPI_LBT_DL_CONFIG_REQUEST_PDSCH_PDU_TYPE = 0, + NFAPI_LBT_DL_CONFIG_REQUEST_DRS_PDU_TYPE +} nfapi_lbt_dl_config_pdu_type_e; + +typedef enum { + NFAPI_LBT_DL_RSP_PDSCH_PDU_TYPE = 0, + NFAPI_LBT_DL_RSP_DRS_PDU_TYPE +} nfapi_lbt_dl_rsp_pdu_type_e; + +typedef struct { + nfapi_tl_t tl; + uint32_t length; + uint8_t value[NFAPI_MAX_OPAQUE_DATA]; +} nfapi_opaqaue_data_t; + +// Utility functions to turn enums into char* +const char* nfapi_error_code_to_str(nfapi_error_code_e value); + + +// P5 Sub Structures +typedef struct { + nfapi_tl_t tl; + uint8_t nfapi_sync_mode; + uint8_t location_mode; + uint16_t location_coordinates_length; + uint8_t location_coordinates[NFAPI_PNF_PARAM_GENERAL_LOCATION_LENGTH]; + uint32_t dl_config_timing; + uint32_t tx_timing; + uint32_t ul_config_timing; + uint32_t hi_dci0_timing; + uint16_t maximum_number_phys; + uint16_t maximum_total_bandwidth; + uint8_t maximum_total_number_dl_layers; + uint8_t maximum_total_number_ul_layers; + uint8_t shared_bands; + uint8_t shared_pa; + int16_t maximum_total_power; + uint8_t oui[NFAPI_PNF_PARAM_GENERAL_OUI_LENGTH]; +} nfapi_pnf_param_general_t; +#define NFAPI_PNF_PARAM_GENERAL_TAG 0x1000 + + + + + +typedef struct { + uint16_t rf_config_index; +} nfapi_rf_config_info_t; + +typedef struct { + uint16_t phy_config_index; + uint16_t number_of_rfs; + nfapi_rf_config_info_t rf_config[NFAPI_MAX_PNF_PHY_RF_CONFIG]; + uint16_t number_of_rf_exclusions; + nfapi_rf_config_info_t excluded_rf_config[NFAPI_MAX_PNF_PHY_RF_CONFIG]; + uint16_t downlink_channel_bandwidth_supported; + uint16_t uplink_channel_bandwidth_supported; + uint8_t number_of_dl_layers_supported; + uint8_t number_of_ul_layers_supported; + uint16_t maximum_3gpp_release_supported; + uint8_t nmm_modes_supported; +} nfapi_pnf_phy_info_t; + + +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_phys; + nfapi_pnf_phy_info_t phy[NFAPI_MAX_PNF_PHY]; +} nfapi_pnf_phy_t; +#define NFAPI_PNF_PHY_TAG 0x1001 + +typedef struct { + uint16_t phy_config_index; + uint16_t transmission_mode_7_supported; + uint16_t transmission_mode_8_supported; + uint16_t two_antenna_ports_for_pucch; + uint16_t transmission_mode_9_supported; + uint16_t simultaneous_pucch_pusch; + uint16_t four_layer_tx_with_tm3_and_tm4; +} nfapi_pnf_phy_rel10_info_t; + +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_phys; + nfapi_pnf_phy_rel10_info_t phy[NFAPI_MAX_PNF_PHY]; +} nfapi_pnf_phy_rel10_t; +#define NFAPI_PNF_PHY_REL10_TAG 0x100A + +typedef struct { + uint16_t phy_config_index; + uint16_t edpcch_supported; + uint16_t multi_ack_csi_reporting; + uint16_t pucch_tx_diversity; + uint16_t ul_comp_supported; + uint16_t transmission_mode_5_supported; +} nfapi_pnf_phy_rel11_info_t; + +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_phys; + nfapi_pnf_phy_rel11_info_t phy[NFAPI_MAX_PNF_PHY]; +} nfapi_pnf_phy_rel11_t; +#define NFAPI_PNF_PHY_REL11_TAG 0x100B + + +typedef struct { + uint16_t phy_config_index; + uint16_t csi_subframe_set; + uint16_t enhanced_4tx_codebook; + uint16_t drs_supported; + uint16_t ul_64qam_supported; + uint16_t transmission_mode_10_supported; + uint16_t alternative_bts_indices; +} nfapi_pnf_phy_rel12_info_t; + +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_phys; + nfapi_pnf_phy_rel12_info_t phy[NFAPI_MAX_PNF_PHY]; +} nfapi_pnf_phy_rel12_t; +#define NFAPI_PNF_PHY_REL12_TAG 0x100C + +typedef struct { + uint16_t phy_config_index; + uint16_t pucch_format4_supported; + uint16_t pucch_format5_supported; + uint16_t more_than_5_ca_support; + uint16_t laa_supported; + uint16_t laa_ending_in_dwpts_supported; + uint16_t laa_starting_in_second_slot_supported; + uint16_t beamforming_supported; + uint16_t csi_rs_enhancement_supported; + uint16_t drms_enhancement_supported; + uint16_t srs_enhancement_supported; +} nfapi_pnf_phy_rel13_info_t; + +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_phys; + nfapi_pnf_phy_rel13_info_t phy[NFAPI_MAX_PNF_PHY]; +} nfapi_pnf_phy_rel13_t; +#define NFAPI_PNF_PHY_REL13_TAG 0x100D + +typedef struct { + uint16_t phy_config_index; + uint16_t number_of_rfs; + nfapi_rf_config_info_t rf_config[NFAPI_MAX_PNF_PHY_RF_CONFIG]; + uint16_t number_of_rf_exclusions; + nfapi_rf_config_info_t excluded_rf_config[NFAPI_MAX_PNF_PHY_RF_CONFIG]; + uint8_t number_of_dl_layers_supported; + uint8_t number_of_ul_layers_supported; + uint16_t maximum_3gpp_release_supported; + uint8_t nmm_modes_supported; +} nfapi_pnf_phy_rel13_nb_iot_info_t; + +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_phys; + nfapi_pnf_phy_rel13_nb_iot_info_t phy[NFAPI_MAX_PNF_PHY]; +} nfapi_pnf_phy_rel13_nb_iot_t; +#define NFAPI_PNF_PHY_REL13_NB_IOT_TAG 0x100E + +typedef struct { + uint16_t phy_config_index; +} nfapi_pnf_phy_rel15_info_t; + +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_phys; + nfapi_pnf_phy_rel15_info_t phy[NFAPI_MAX_PNF_PHY]; +} nfapi_pnf_phy_rel15_t; +#define NFAPI_PNF_PHY_REL15_TAG 0x100H + + +typedef struct { + uint16_t rf_config_index; + uint16_t band; + int16_t maximum_transmit_power; + int16_t minimum_transmit_power; + uint8_t number_of_antennas_suppported; + uint32_t minimum_downlink_frequency; + uint32_t maximum_downlink_frequency; + uint32_t minimum_uplink_frequency; + uint32_t maximum_uplink_frequency; +} nfapi_pnf_rf_info_t; + +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_rfs; + nfapi_pnf_rf_info_t rf[NFAPI_MAX_PNF_RF]; +} nfapi_pnf_rf_t; +#define NFAPI_PNF_RF_TAG 0x1002 + +typedef struct { + uint16_t phy_id; + uint16_t phy_config_index; + uint16_t rf_config_index; +} nfapi_phy_rf_config_info_t; + +typedef struct { + nfapi_tl_t tl; + uint16_t number_phy_rf_config_info; + nfapi_phy_rf_config_info_t phy_rf_config[NFAPI_MAX_PHY_RF_INSTANCES]; +} nfapi_pnf_phy_rf_config_t; +#define NFAPI_PNF_PHY_RF_TAG 0x1003 + +// Generic strucutre for single tlv value. +typedef struct { + nfapi_tl_t tl; + uint16_t value; +} nfapi_uint16_tlv_t; + +typedef struct { + nfapi_tl_t tl; + int16_t value; +} nfapi_int16_tlv_t; + +typedef struct { + nfapi_tl_t tl; + uint8_t value; +} nfapi_uint8_tlv_t; + +typedef struct { + nfapi_uint16_tlv_t phy_state; +} nfapi_l1_status; + +#define NFAPI_L1_STATUS_PHY_STATE_TAG 0x00FA + +typedef struct { + nfapi_uint16_tlv_t dl_bandwidth_support; + nfapi_uint16_tlv_t ul_bandwidth_support; + nfapi_uint16_tlv_t dl_modulation_support; + nfapi_uint16_tlv_t ul_modulation_support; + nfapi_uint16_tlv_t phy_antenna_capability; + nfapi_uint16_tlv_t release_capability; + nfapi_uint16_tlv_t mbsfn_capability; +} nfapi_phy_capabilities_t; + +#define NFAPI_PHY_CAPABILITIES_DL_BANDWIDTH_SUPPORT_TAG 0x00C8 +#define NFAPI_PHY_CAPABILITIES_UL_BANDWIDTH_SUPPORT_TAG 0x00C9 +#define NFAPI_PHY_CAPABILITIES_DL_MODULATION_SUPPORT_TAG 0x00CA +#define NFAPI_PHY_CAPABILITIES_UL_MODULATION_SUPPORT_TAG 0x00CB +#define NFAPI_PHY_CAPABILITIES_PHY_ANTENNA_CAPABILITY_TAG 0x00CC +#define NFAPI_PHY_CAPABILITIES_RELEASE_CAPABILITY_TAG 0x00CD +#define NFAPI_PHY_CAPABILITIES_MBSFN_CAPABILITY_TAG 0x00CE + + +typedef struct { + nfapi_uint16_tlv_t data_report_mode; + nfapi_uint16_tlv_t sfnsf; +} nfapi_l23_config_t; + + +#define NFAPI_L23_CONFIG_DATA_REPORT_MODE_TAG 0x00F0 +#define NFAPI_L23_CONFIG_SFNSF_TAG 0x00F1 + +typedef struct { + nfapi_uint16_tlv_t numerology_index_mu; + nfapi_uint16_tlv_t duplex_mode; + nfapi_uint16_tlv_t pcfich_power_offset; + nfapi_uint16_tlv_t pb; + nfapi_uint16_tlv_t dl_cyclic_prefix_type; + nfapi_uint16_tlv_t ul_cyclic_prefix_type; +} nfapi_subframe_config_t; + +#define NFAPI_SUBFRAME_CONFIG_DUPLEX_MODE_TAG 0x0001 +#define NFAPI_SUBFRAME_CONFIG_PCFICH_POWER_OFFSET_TAG 0x0002 +#define NFAPI_SUBFRAME_CONFIG_PB_TAG 0x0003 +#define NFAPI_SUBFRAME_CONFIG_DL_CYCLIC_PREFIX_TYPE_TAG 0x0004 +#define NFAPI_SUBFRAME_CONFIG_UL_CYCLIC_PREFIX_TYPE_TAG 0x0005 +#define NFAPI_SUBFRAME_CONFIG_NUMEROLOGY_INDEX_MU_TAG 0x0006 + +typedef struct { + nfapi_uint16_tlv_t dl_channel_bandwidth; + nfapi_uint16_tlv_t ul_channel_bandwidth; + nfapi_uint16_tlv_t reference_signal_power; + nfapi_uint16_tlv_t tx_antenna_ports; + nfapi_uint16_tlv_t rx_antenna_ports; +} nfapi_rf_config_t; + +#define NFAPI_RF_CONFIG_DL_CHANNEL_BANDWIDTH_TAG 0x000A +#define NFAPI_RF_CONFIG_UL_CHANNEL_BANDWIDTH_TAG 0x000B +#define NFAPI_RF_CONFIG_REFERENCE_SIGNAL_POWER_TAG 0x000C +#define NFAPI_RF_CONFIG_TX_ANTENNA_PORTS_TAG 0x000D +#define NFAPI_RF_CONFIG_RX_ANTENNA_PORTS_TAG 0x000E + +typedef struct { + nfapi_uint16_tlv_t phich_resource; + nfapi_uint16_tlv_t phich_duration; + nfapi_uint16_tlv_t phich_power_offset; +} nfapi_phich_config_t; + +#define NFAPI_PHICH_CONFIG_PHICH_RESOURCE_TAG 0x0014 +#define NFAPI_PHICH_CONFIG_PHICH_DURATION_TAG 0x0015 +#define NFAPI_PHICH_CONFIG_PHICH_POWER_OFFSET_TAG 0x0016 + +typedef enum { + NFAPI_HALF_FRAME_INDEX_FIRST_HALF = 0, + NFAPI_HALF_FRAME_INDEX_SECOND_HALF = 1 +} nfapi_half_frame_index_e; + +typedef struct { + nfapi_uint16_tlv_t primary_synchronization_signal_epre_eprers; + nfapi_uint16_tlv_t secondary_synchronization_signal_epre_eprers; + nfapi_uint16_tlv_t physical_cell_id; + nfapi_half_frame_index_e half_frame_index; + nfapi_uint16_tlv_t ssb_subcarrier_offset; + nfapi_uint16_tlv_t ssb_position_in_burst; + nfapi_uint16_tlv_t ssb_periodicity; + nfapi_uint16_tlv_t ss_pbch_block_power; +} nfapi_sch_config_t; + +#define NFAPI_SCH_CONFIG_PRIMARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG 0x001E +#define NFAPI_SCH_CONFIG_SECONDARY_SYNCHRONIZATION_SIGNAL_EPRE_EPRERS_TAG 0x001F +#define NFAPI_SCH_CONFIG_PHYSICAL_CELL_ID_TAG 0x0020 +#define NFAPI_SCH_CONFIG_HALF_FRAME_INDEX_TAG 0x0021 +#define NFAPI_SCH_CONFIG_SSB_SUBCARRIER_OFFSET_TAG 0x0022 +#define NFAPI_SCH_CONFIG_SSB_POSITION_IN_BURST 0x0023 +#define NFAPI_SCH_CONFIG_SSB_PERIODICITY 0x0024 +#define NFAPI_SCH_CONFIG_SS_PBCH_BLOCK_POWER 0x0025 + +typedef struct { + nfapi_uint16_tlv_t configuration_index; + nfapi_uint16_tlv_t root_sequence_index; + nfapi_uint16_tlv_t zero_correlation_zone_configuration; + nfapi_uint16_tlv_t high_speed_flag; + nfapi_uint16_tlv_t frequency_offset; +} nfapi_prach_config_t; + +#define NFAPI_PRACH_CONFIG_CONFIGURATION_INDEX_TAG 0x0028 +#define NFAPI_PRACH_CONFIG_ROOT_SEQUENCE_INDEX_TAG 0x0029 +#define NFAPI_PRACH_CONFIG_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG 0x002A +#define NFAPI_PRACH_CONFIG_HIGH_SPEED_FLAG_TAG 0x002B +#define NFAPI_PRACH_CONFIG_FREQUENCY_OFFSET_TAG 0x002C + +typedef struct { + nfapi_uint16_tlv_t hopping_mode; + nfapi_uint16_tlv_t hopping_offset; + nfapi_uint16_tlv_t number_of_subbands; +} nfapi_pusch_config_t; + +#define NFAPI_PUSCH_CONFIG_HOPPING_MODE_TAG 0x0032 +#define NFAPI_PUSCH_CONFIG_HOPPING_OFFSET_TAG 0x0033 +#define NFAPI_PUSCH_CONFIG_NUMBER_OF_SUBBANDS_TAG 0x0034 + +typedef struct { + nfapi_uint16_tlv_t delta_pucch_shift; + nfapi_uint16_tlv_t n_cqi_rb; + nfapi_uint16_tlv_t n_an_cs; + nfapi_uint16_tlv_t n1_pucch_an; +} nfapi_pucch_config_t; + +#define NFAPI_PUCCH_CONFIG_DELTA_PUCCH_SHIFT_TAG 0x003C +#define NFAPI_PUCCH_CONFIG_N_CQI_RB_TAG 0x003D +#define NFAPI_PUCCH_CONFIG_N_AN_CS_TAG 0x003E +#define NFAPI_PUCCH_CONFIG_N1_PUCCH_AN_TAG 0x003F + +typedef struct { + nfapi_uint16_tlv_t bandwidth_configuration; + nfapi_uint16_tlv_t max_up_pts; + nfapi_uint16_tlv_t srs_subframe_configuration; + nfapi_uint16_tlv_t srs_acknack_srs_simultaneous_transmission; +} nfapi_srs_config_t; + +#define NFAPI_SRS_CONFIG_BANDWIDTH_CONFIGURATION_TAG 0x0046 +#define NFAPI_SRS_CONFIG_MAX_UP_PTS_TAG 0x0047 +#define NFAPI_SRS_CONFIG_SRS_SUBFRAME_CONFIGURATION_TAG 0x0048 +#define NFAPI_SRS_CONFIG_SRS_ACKNACK_SRS_SIMULTANEOUS_TRANSMISSION_TAG 0x0049 + +typedef struct { + nfapi_uint16_tlv_t uplink_rs_hopping; + nfapi_uint16_tlv_t group_assignment; + nfapi_uint16_tlv_t cyclic_shift_1_for_drms; +} nfapi_uplink_reference_signal_config_t; + +#define NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_UPLINK_RS_HOPPING_TAG 0x0050 +#define NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_GROUP_ASSIGNMENT_TAG 0x0051 +#define NFAPI_UPLINK_REFERENCE_SIGNAL_CONFIG_CYCLIC_SHIFT_1_FOR_DRMS_TAG 0x0052 + + +typedef struct { + nfapi_uint16_tlv_t ed_threshold_lbt_pdsch; + nfapi_uint16_tlv_t ed_threshold_lbt_drs; + nfapi_uint16_tlv_t pd_threshold; + nfapi_uint16_tlv_t multi_carrier_type; + nfapi_uint16_tlv_t multi_carrier_tx; + nfapi_uint16_tlv_t multi_carrier_freeze; + nfapi_uint16_tlv_t tx_antenna_ports_drs; + nfapi_uint16_tlv_t tx_power_drs; +} nfapi_laa_config_t; + +#define NFAPI_LAA_CONFIG_ED_THRESHOLD_FOR_LBT_FOR_PDSCH_TAG 0x0064 +#define NFAPI_LAA_CONFIG_ED_THRESHOLD_FOR_LBT_FOR_DRS_TAG 0x0065 +#define NFAPI_LAA_CONFIG_PD_THRESHOLD_TAG 0x0066 +#define NFAPI_LAA_CONFIG_MULTI_CARRIER_TYPE_TAG 0x0067 +#define NFAPI_LAA_CONFIG_MULTI_CARRIER_TX_TAG 0x0068 +#define NFAPI_LAA_CONFIG_MULTI_CARRIER_FREEZE_TAG 0x0069 +#define NFAPI_LAA_CONFIG_TX_ANTENNA_PORTS_FOR_DRS_TAG 0x006A +#define NFAPI_LAA_CONFIG_TRANSMISSION_POWER_FOR_DRS_TAG 0x006B + +typedef struct { + + nfapi_uint16_tlv_t pbch_repetitions_enable_r13; + nfapi_uint16_tlv_t prach_catm_root_sequence_index; + nfapi_uint16_tlv_t prach_catm_zero_correlation_zone_configuration; + nfapi_uint16_tlv_t prach_catm_high_speed_flag; + nfapi_uint16_tlv_t prach_ce_level_0_enable; + nfapi_uint16_tlv_t prach_ce_level_0_configuration_index; + nfapi_uint16_tlv_t prach_ce_level_0_frequency_offset; + nfapi_uint16_tlv_t prach_ce_level_0_number_of_repetitions_per_attempt; + nfapi_uint16_tlv_t prach_ce_level_0_starting_subframe_periodicity; + nfapi_uint16_tlv_t prach_ce_level_0_hopping_enable; + nfapi_uint16_tlv_t prach_ce_level_0_hopping_offset; + nfapi_uint16_tlv_t prach_ce_level_1_enable; + nfapi_uint16_tlv_t prach_ce_level_1_configuration_index; + nfapi_uint16_tlv_t prach_ce_level_1_frequency_offset; + nfapi_uint16_tlv_t prach_ce_level_1_number_of_repetitions_per_attempt; + nfapi_uint16_tlv_t prach_ce_level_1_starting_subframe_periodicity; + nfapi_uint16_tlv_t prach_ce_level_1_hopping_enable; + nfapi_uint16_tlv_t prach_ce_level_1_hopping_offset; + nfapi_uint16_tlv_t prach_ce_level_2_enable; + nfapi_uint16_tlv_t prach_ce_level_2_configuration_index; + nfapi_uint16_tlv_t prach_ce_level_2_frequency_offset; + nfapi_uint16_tlv_t prach_ce_level_2_number_of_repetitions_per_attempt; + nfapi_uint16_tlv_t prach_ce_level_2_starting_subframe_periodicity; + nfapi_uint16_tlv_t prach_ce_level_2_hopping_enable; + nfapi_uint16_tlv_t prach_ce_level_2_hopping_offset; + nfapi_uint16_tlv_t prach_ce_level_3_enable; + nfapi_uint16_tlv_t prach_ce_level_3_configuration_index; + nfapi_uint16_tlv_t prach_ce_level_3_frequency_offset; + nfapi_uint16_tlv_t prach_ce_level_3_number_of_repetitions_per_attempt; + nfapi_uint16_tlv_t prach_ce_level_3_starting_subframe_periodicity; + nfapi_uint16_tlv_t prach_ce_level_3_hopping_enable; + nfapi_uint16_tlv_t prach_ce_level_3_hopping_offset; + nfapi_uint16_tlv_t pucch_interval_ulhoppingconfigcommonmodea; + nfapi_uint16_tlv_t pucch_interval_ulhoppingconfigcommonmodeb; +} nfapi_emtc_config_t; + +#define NFAPI_EMTC_CONFIG_PBCH_REPETITIONS_ENABLE_R13_TAG 0x0078 +#define NFAPI_EMTC_CONFIG_PRACH_CATM_ROOT_SEQUENCE_INDEX_TAG 0x0079 +#define NFAPI_EMTC_CONFIG_PRACH_CATM_ZERO_CORRELATION_ZONE_CONFIGURATION_TAG 0x007A +#define NFAPI_EMTC_CONFIG_PRACH_CATM_HIGH_SPEED_FLAG 0x007B +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_ENABLE_TAG 0x007C +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_CONFIGURATION_INDEX_TAG 0x007D +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_FREQUENCY_OFFSET_TAG 0x007E +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG 0x007F +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_STARTING_SUBFRAME_PERIODICITY_TAG 0x0080 +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_ENABLE_TAG 0x0081 +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_0_HOPPING_OFFSET_TAG 0x0082 +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_ENABLE_TAG 0x0083 +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_CONFIGURATION_INDEX_TAG 0x0084 +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_FREQUENCY_OFFSET_TAG 0x0085 +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG 0x0086 +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_STARTING_SUBFRAME_PERIODICITY_TAG 0x0087 +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_ENABLE_TAG 0x0088 +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_1_HOPPING_OFFSET_TAG 0x0089 +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_ENABLE_TAG 0x008A +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_CONFIGURATION_INDEX_TAG 0x008B +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_FREQUENCY_OFFSET_TAG 0x008C +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG 0x008D +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_STARTING_SUBFRAME_PERIODICITY_TAG 0x008E +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_ENABLE_TAG 0x008F +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_2_HOPPING_OFFSET_TAG 0x0090 +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_ENABLE_TAG 0x0091 +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_CONFIGURATION_INDEX_TAG 0x0092 +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_FREQUENCY_OFFSET_TAG 0x0093 +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG 0x0094 +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_STARTING_SUBFRAME_PERIODICITY_TAG 0x0095 +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_ENABLE_TAG 0x0096 +#define NFAPI_EMTC_CONFIG_PRACH_CE_LEVEL_3_HOPPING_OFFSET_TAG 0x0097 +#define NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEA_TAG 0x0098 +#define NFAPI_EMTC_CONFIG_PUCCH_INTERVAL_ULHOPPINGCONFIGCOMMONMODEB_TAG 0x0099 + +typedef struct { + nfapi_uint16_tlv_t operating_mode; + nfapi_uint16_tlv_t anchor; + nfapi_uint16_tlv_t prb_index; + nfapi_uint16_tlv_t control_region_size; + nfapi_uint16_tlv_t assumed_crs_aps; + nfapi_uint16_tlv_t nprach_config_0_enabled; + nfapi_uint16_tlv_t nprach_config_0_sf_periodicity; + nfapi_uint16_tlv_t nprach_config_0_start_time; + nfapi_uint16_tlv_t nprach_config_0_subcarrier_offset; + nfapi_uint16_tlv_t nprach_config_0_number_of_subcarriers; + nfapi_uint16_tlv_t nprach_config_0_cp_length; + nfapi_uint16_tlv_t nprach_config_0_number_of_repetitions_per_attempt; + nfapi_uint16_tlv_t nprach_config_1_enabled; + nfapi_uint16_tlv_t nprach_config_1_sf_periodicity; + nfapi_uint16_tlv_t nprach_config_1_start_time; + nfapi_uint16_tlv_t nprach_config_1_subcarrier_offset; + nfapi_uint16_tlv_t nprach_config_1_number_of_subcarriers; + nfapi_uint16_tlv_t nprach_config_1_cp_length; + nfapi_uint16_tlv_t nprach_config_1_number_of_repetitions_per_attempt; + nfapi_uint16_tlv_t nprach_config_2_enabled; + nfapi_uint16_tlv_t nprach_config_2_sf_periodicity; + nfapi_uint16_tlv_t nprach_config_2_start_time; + nfapi_uint16_tlv_t nprach_config_2_subcarrier_offset; + nfapi_uint16_tlv_t nprach_config_2_number_of_subcarriers; + nfapi_uint16_tlv_t nprach_config_2_cp_length; + nfapi_uint16_tlv_t nprach_config_2_number_of_repetitions_per_attempt; + nfapi_uint16_tlv_t three_tone_base_sequence; + nfapi_uint16_tlv_t six_tone_base_sequence; + nfapi_uint16_tlv_t twelve_tone_base_sequence; + nfapi_uint16_tlv_t three_tone_cyclic_shift; + nfapi_uint16_tlv_t six_tone_cyclic_shift; + nfapi_uint16_tlv_t dl_gap_config_enable; + nfapi_uint16_tlv_t dl_gap_threshold; + nfapi_uint16_tlv_t dl_gap_periodicity; + nfapi_uint16_tlv_t dl_gap_duration_coefficient; +} nfapi_nb_iot_config_t; + +#define NFAPI_NB_IOT_CONFIG_OPERATING_MODE_TAG 0x00A5 +#define NFAPI_NB_IOT_CONFIG_ANCHOR_TAG 0x00A6 +#define NFAPI_NB_IOT_CONFIG_PRB_INDEX_TAG 0x00A7 +#define NFAPI_NB_IOT_CONFIG_CONTROL_REGION_SIZE_TAG 0x00A8 +#define NFAPI_NB_IOT_CONFIG_ASSUMED_CRS_APS_TAG 0x00A9 +#define NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_0_ENABLED_TAG 0x00AA +#define NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_0_SF_PERIODICITY_TAG 0x00AB +#define NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_0_START_TIME_TAG 0x00AC +#define NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_0_SUBCARRIER_OFFSET_TAG 0x00AD +#define NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_0_NUMBER_OF_SUBCARRIERS_TAG 0x00AE +#define NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_0_CP_LENGTH_TAG 0x00AF +#define NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_0_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG 0x00B0 +#define NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_1_ENABLED_TAG 0x00B1 +#define NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_1_SF_PERIODICITY_TAG 0x00B2 +#define NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_1_START_TIME_TAG 0x00B3 +#define NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_1_SUBCARRIER_OFFSET_TAG 0x00B4 +#define NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_1_NUMBER_OF_SUBCARRIERS_TAG 0x00B5 +#define NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_1_CP_LENGTH_TAG 0x00B6 +#define NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_1_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG 0x00B7 +#define NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_2_ENABLED_TAG 0x00B8 +#define NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_2_SF_PERIODICITY_TAG 0x00B9 +#define NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_2_START_TIME_TAG 0x00BA +#define NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_2_SUBCARRIER_OFFSET_TAG 0x00BB +#define NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_2_NUMBER_OF_SUBCARRIERS_TAG 0x00BC +#define NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_2_CP_LENGTH_TAG 0x00BD +#define NFAPI_NB_IOT_CONFIG_NPRACH_CONFIG_2_NUMBER_OF_REPETITIONS_PER_ATTEMPT_TAG 0x00BE +#define NFAPI_NB_IOT_CONFIG_THREE_TONE_BASE_SEQUENCE_TAG 0x00BF +#define NFAPI_NB_IOT_CONFIG_SIX_TONE_BASE_SEQUENCE_TAG 0x00C0 +#define NFAPI_NB_IOT_CONFIG_TWELVE_TONE_BASE_SEQUENCE_TAG 0x00C1 +#define NFAPI_NB_IOT_CONFIG_THREE_TONE_CYCLIC_SHIFT_TAG 0x00C2 +#define NFAPI_NB_IOT_CONFIG_SIX_TONE_CYCLIC_SHIFT_TAG 0x00C3 +#define NFAPI_NB_IOT_CONFIG_DL_GAP_CONFIG_ENABLE_TAG 0x00C4 +#define NFAPI_NB_IOT_CONFIG_DL_GAP_THRESHOLD_TAG 0x00C5 +#define NFAPI_NB_IOT_CONFIG_DL_GAP_PERIODICITY_TAG 0x00C6 +#define NFAPI_NB_IOT_CONFIG_DL_GAP_DURATION_COEFFICIENT_TAG 0x00C7 + +typedef struct { + nfapi_uint16_tlv_t laa_support; + nfapi_uint16_tlv_t pd_sensing_lbt_support; + nfapi_uint16_tlv_t multi_carrier_lbt_support; + nfapi_uint16_tlv_t partial_sf_support; +} nfapi_laa_capability_t; + +#define NFAPI_LAA_CAPABILITY_LAA_SUPPORT_TAG 0x00D1 +#define NFAPI_LAA_CAPABILITY_PD_SENSING_LBT_SUPPORT_TAG 0x00D2 +#define NFAPI_LAA_CAPABILITY_MULTI_CARRIER_LBT_SUPPORT_TAG 0x00D3 +#define NFAPI_LAA_CAPABILITY_PARTIAL_SF_SUPPORT_TAG 0x00D4 + +typedef struct { + nfapi_uint16_tlv_t nb_iot_support; + nfapi_uint16_tlv_t nb_iot_operating_mode_capability; +} nfapi_nb_iot_capability_t; + +#define NFAPI_LAA_CAPABILITY_NB_IOT_SUPPORT_TAG 0x00D5 +#define NFAPI_LAA_CAPABILITY_NB_IOT_OPERATING_MODE_CAPABILITY_TAG 0x00D6 + +typedef struct { + nfapi_uint16_tlv_t subframe_assignment; + nfapi_uint16_tlv_t special_subframe_patterns; +} nfapi_tdd_frame_structure_t; + +#define NFAPI_TDD_FRAME_STRUCTURE_SUBFRAME_ASSIGNMENT_TAG 0x005A +#define NFAPI_TDD_FRAME_STRUCTURE_SPECIAL_SUBFRAME_PATTERNS_TAG 0x005B + +typedef struct { + nfapi_tl_t tl; + uint16_t number_rf_bands; + uint16_t rf_band[NFAPI_MAX_NUM_RF_BANDS]; +} nfapi_rf_bands_t; +#define NFAPI_PHY_RF_BANDS_TAG 0x0114 + +#define NFAPI_IPV4_ADDRESS_LENGTH 4 +#define NFAPI_IPV6_ADDRESS_LENGTH 16 + +// Convience enum to allow the ip addres type to be distinguished +typedef enum { + NFAPI_IP_ADDRESS_IPV4 = 0, + NFAPI_IP_ADDRESS_IPV6 +} nfapi_ip_address_type_e; + +// The type could be infered from the length, but it is clearer in +// code to have a type variable set +typedef struct { + nfapi_tl_t tl; + uint8_t type; + union { + uint8_t ipv4_address[NFAPI_IPV4_ADDRESS_LENGTH]; + uint8_t ipv6_address[NFAPI_IPV6_ADDRESS_LENGTH]; + } u; +} nfapi_ip_address_t; + +typedef struct { + nfapi_tl_t tl; + uint8_t address[NFAPI_IPV4_ADDRESS_LENGTH]; +} nfapi_ipv4_address_t; + +typedef struct { + nfapi_tl_t tl; + uint8_t address[NFAPI_IPV6_ADDRESS_LENGTH]; +} nfapi_ipv6_address_t; + + + +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_rf_bands; + uint16_t bands[NFAPI_MAX_NMM_FREQUENCY_BANDS]; +} nfapi_nmm_frequency_bands_t; + +//These TLVs are used exclusively by nFAPI +typedef struct +{ + // These TLVs are used to setup the transport connection between VNF and PNF + nfapi_ipv4_address_t p7_vnf_address_ipv4; + nfapi_ipv6_address_t p7_vnf_address_ipv6; + nfapi_uint16_tlv_t p7_vnf_port; + + nfapi_ipv4_address_t p7_pnf_address_ipv4; + nfapi_ipv6_address_t p7_pnf_address_ipv6; + nfapi_uint16_tlv_t p7_pnf_port; + + // These TLVs are used to setup the transport connection between VNF and PNF + nfapi_uint8_tlv_t dl_ue_per_sf; + nfapi_uint8_tlv_t ul_ue_per_sf; + + // These TLVs are used by PNF to report its RF capabilities to the VNF software + nfapi_rf_bands_t rf_bands; + + // These TLVs are used by the VNF to configure the synchronization with the PNF. + nfapi_uint8_tlv_t timing_window; + nfapi_uint8_tlv_t timing_info_mode; + nfapi_uint8_tlv_t timing_info_period; + + // These TLVs are used by the VNF to configure the RF in the PNF + nfapi_uint16_tlv_t max_transmit_power; + nfapi_uint16_tlv_t earfcn; + + nfapi_nmm_frequency_bands_t nmm_gsm_frequency_bands; + nfapi_nmm_frequency_bands_t nmm_umts_frequency_bands; + nfapi_nmm_frequency_bands_t nmm_lte_frequency_bands; + nfapi_uint8_tlv_t nmm_uplink_rssi_supported; + +} nfapi_nfapi_t; + +#define NFAPI_NFAPI_P7_VNF_ADDRESS_IPV4_TAG 0x0100 +#define NFAPI_NFAPI_P7_VNF_ADDRESS_IPV6_TAG 0x0101 +#define NFAPI_NFAPI_P7_VNF_PORT_TAG 0x0102 +#define NFAPI_NFAPI_P7_PNF_ADDRESS_IPV4_TAG 0x0103 +#define NFAPI_NFAPI_P7_PNF_ADDRESS_IPV6_TAG 0x0104 +#define NFAPI_NFAPI_P7_PNF_PORT_TAG 0x0105 + +#define NFAPI_NFAPI_DOWNLINK_UES_PER_SUBFRAME_TAG 0x010A +#define NFAPI_NFAPI_UPLINK_UES_PER_SUBFRAME_TAG 0x010B +#define NFAPI_NFAPI_RF_BANDS_TAG 0x0114 +#define NFAPI_NFAPI_TIMING_WINDOW_TAG 0x011E +#define NFAPI_NFAPI_TIMING_INFO_MODE_TAG 0x011F +#define NFAPI_NFAPI_TIMING_INFO_PERIOD_TAG 0x0120 +#define NFAPI_NFAPI_MAXIMUM_TRANSMIT_POWER_TAG 0x0128 +#define NFAPI_NFAPI_EARFCN_TAG 0x0129 +#define NFAPI_NFAPI_NMM_GSM_FREQUENCY_BANDS_TAG 0x0130 +#define NFAPI_NFAPI_NMM_UMTS_FREQUENCY_BANDS_TAG 0x0131 +#define NFAPI_NFAPI_NMM_LTE_FREQUENCY_BANDS_TAG 0x0132 +#define NFAPI_NFAPI_NMM_UPLINK_RSSI_SUPPORTED_TAG 0x0133 + + +// P5 Message Structures +typedef struct { + nfapi_p4_p5_message_header_t header; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_pnf_param_request_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint32_t error_code; + nfapi_pnf_param_general_t pnf_param_general; + nfapi_pnf_phy_t pnf_phy; + nfapi_pnf_rf_t pnf_rf; + nfapi_pnf_phy_rel10_t pnf_phy_rel10; + nfapi_pnf_phy_rel11_t pnf_phy_rel11; + nfapi_pnf_phy_rel12_t pnf_phy_rel12; + nfapi_pnf_phy_rel13_t pnf_phy_rel13; + nfapi_pnf_phy_rel13_nb_iot_t pnf_phy_rel13_nb_iot; + nfapi_pnf_phy_rel15_t pnf_phy_rel15; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_pnf_param_response_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + nfapi_pnf_phy_rf_config_t pnf_phy_rf_config; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_pnf_config_request_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint32_t error_code; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_pnf_config_response_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_pnf_start_request_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint32_t error_code; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_pnf_start_response_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_pnf_stop_request_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint32_t error_code; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_pnf_stop_response_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_param_request_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint8_t error_code; + uint8_t num_tlv; + // fdd or tdd in idle or configured tlvs + nfapi_l1_status l1_status; + nfapi_phy_capabilities_t phy_capabilities; + nfapi_laa_capability_t laa_capability; + nfapi_nb_iot_capability_t nb_iot_capability; + + nfapi_subframe_config_t subframe_config; + nfapi_rf_config_t rf_config; + nfapi_phich_config_t phich_config; + nfapi_sch_config_t sch_config; + nfapi_prach_config_t prach_config; + nfapi_pusch_config_t pusch_config; + nfapi_pucch_config_t pucch_config; + nfapi_srs_config_t srs_config; + nfapi_uplink_reference_signal_config_t uplink_reference_signal_config; + nfapi_tdd_frame_structure_t tdd_frame_structure_config; + nfapi_l23_config_t l23_config; + nfapi_nb_iot_config_t nb_iot_config; + + // addition nfapi tlvs as per table 2-16 in idle or configure + nfapi_nfapi_t nfapi_config; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_param_response_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint8_t num_tlv; + nfapi_subframe_config_t subframe_config; + nfapi_rf_config_t rf_config; + nfapi_phich_config_t phich_config; + nfapi_sch_config_t sch_config; + nfapi_prach_config_t prach_config; + nfapi_pusch_config_t pusch_config; + nfapi_pucch_config_t pucch_config; + nfapi_srs_config_t srs_config; + nfapi_uplink_reference_signal_config_t uplink_reference_signal_config; + nfapi_laa_config_t laa_config; + nfapi_emtc_config_t emtc_config; + nfapi_tdd_frame_structure_t tdd_frame_structure_config; + nfapi_l23_config_t l23_config; + nfapi_nb_iot_config_t nb_iot_config; + + // addition nfapi tlvs as per table 2-16 in idle or configure + nfapi_nfapi_t nfapi_config; + + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_config_request_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint32_t error_code; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_config_response_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_start_request_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint32_t error_code; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_start_response_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_stop_request_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint32_t error_code; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_stop_response_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + nfapi_uint16_tlv_t dl_rs_tx_power; + nfapi_uint16_tlv_t received_interference_power; + nfapi_uint16_tlv_t thermal_noise_power; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_measurement_request_t; + +#define NFAPI_MEASUREMENT_REQUEST_DL_RS_XTX_POWER_TAG 0x1004 +#define NFAPI_MEASUREMENT_REQUEST_RECEIVED_INTERFERENCE_POWER_TAG 0x1005 +#define NFAPI_MEASUREMENT_REQUEST_THERMAL_NOISE_POWER_TAG 0x1006 + + + +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_resource_blocks; + int16_t received_interference_power[NFAPI_MAX_RECEIVED_INTERFERENCE_POWER_RESULTS]; +} nfapi_received_interference_power_measurement_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint32_t error_code; + nfapi_int16_tlv_t dl_rs_tx_power_measurement; + nfapi_received_interference_power_measurement_t received_interference_power_measurement; + nfapi_int16_tlv_t thermal_noise_power_measurement; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_measurement_response_t; + +#define NFAPI_MEASUREMENT_RESPONSE_DL_RS_POWER_MEASUREMENT_TAG 0x1007 +#define NFAPI_MEASUREMENT_RESPONSE_RECEIVED_INTERFERENCE_POWER_MEASUREMENT_TAG 0x1008 +#define NFAPI_MEASUREMENT_RESPONSE_THERMAL_NOISE_MEASUREMENT_TAG 0x1009 + +// P7 Sub Structures +typedef struct { + nfapi_tl_t tl; + uint8_t dci_format; + uint8_t cce_idx; + uint8_t aggregation_level; + uint16_t rnti; + uint8_t resource_allocation_type; + uint8_t virtual_resource_block_assignment_flag; + uint32_t resource_block_coding; + uint8_t mcs_1; + uint8_t redundancy_version_1; + uint8_t new_data_indicator_1; + uint8_t transport_block_to_codeword_swap_flag; + uint8_t mcs_2; + uint8_t redundancy_version_2; + uint8_t new_data_indicator_2; + uint8_t harq_process; + uint8_t tpmi; + uint8_t pmi; + uint8_t precoding_information; + uint8_t tpc; + uint8_t downlink_assignment_index; + uint8_t ngap; + uint8_t transport_block_size_index; + uint8_t downlink_power_offset; + uint8_t allocate_prach_flag; + uint8_t preamble_index; + uint8_t prach_mask_index; + uint8_t rnti_type; + uint16_t transmission_power; +} nfapi_dl_config_dci_dl_pdu_rel8_t; +#define NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL8_TAG 0x2001 + +typedef struct { + nfapi_tl_t tl; + uint8_t mcch_flag; + uint8_t mcch_change_notification; + uint8_t scrambling_identity; +} nfapi_dl_config_dci_dl_pdu_rel9_t; +#define NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL9_TAG 0x2002 + +typedef struct { + nfapi_tl_t tl; + uint8_t cross_carrier_scheduling_flag; + uint8_t carrier_indicator; + uint8_t srs_flag; + uint8_t srs_request; + uint8_t antenna_ports_scrambling_and_layers; + uint8_t total_dci_length_including_padding; + uint8_t n_dl_rb; +} nfapi_dl_config_dci_dl_pdu_rel10_t; +#define NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL10_TAG 0x2003 + + +typedef struct { + nfapi_tl_t tl; + uint8_t harq_ack_resource_offset; + uint8_t pdsch_re_mapping_quasi_co_location_indicator; +} nfapi_dl_config_dci_dl_pdu_rel11_t; + +#define NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL11_TAG 0x2039 + + + +typedef struct { + nfapi_tl_t tl; + uint8_t primary_cell_type; + uint8_t ul_dl_configuration_flag; + uint8_t number_ul_dl_configurations; + uint8_t ul_dl_configuration_indication[NFAPI_MAX_UL_DL_CONFIGURATIONS]; +} nfapi_dl_config_dci_dl_pdu_rel12_t; + +#define NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL12_TAG 0x203a + + + +typedef struct { + uint8_t subband_index; + uint8_t scheduled_ues; + uint16_t precoding_value[NFAPI_MAX_NUM_PHYSICAL_ANTENNAS][NFAPI_MAX_NUM_SCHEDULED_UES]; +} nfapi_dl_config_dci_dl_tpm_subband_info_t; + +typedef struct { + uint8_t num_prb_per_subband; + uint8_t number_of_subbands; + uint8_t num_antennas; + nfapi_dl_config_dci_dl_tpm_subband_info_t subband_info[NFAPI_MAX_NUM_SUBBANDS]; +} nfapi_dl_config_dci_dl_tpm_t; + +typedef struct { + nfapi_tl_t tl; + uint8_t laa_end_partial_sf_flag; + uint8_t laa_end_partial_sf_configuration; + uint8_t initial_lbt_sf; + uint8_t codebook_size_determination; + uint8_t drms_table_flag; + uint8_t tpm_struct_flag; + nfapi_dl_config_dci_dl_tpm_t tpm; +} nfapi_dl_config_dci_dl_pdu_rel13_t; + +#define NFAPI_DL_CONFIG_REQUEST_DCI_DL_PDU_REL13_TAG 0x203b + +typedef struct { + nfapi_dl_config_dci_dl_pdu_rel8_t dci_dl_pdu_rel8; + nfapi_dl_config_dci_dl_pdu_rel9_t dci_dl_pdu_rel9; + nfapi_dl_config_dci_dl_pdu_rel10_t dci_dl_pdu_rel10; + nfapi_dl_config_dci_dl_pdu_rel11_t dci_dl_pdu_rel11; + nfapi_dl_config_dci_dl_pdu_rel12_t dci_dl_pdu_rel12; + nfapi_dl_config_dci_dl_pdu_rel13_t dci_dl_pdu_rel13; +} nfapi_dl_config_dci_dl_pdu; + +typedef struct { + nfapi_tl_t tl; + uint16_t length; + uint16_t pdu_index; + uint16_t transmission_power; +} nfapi_dl_config_bch_pdu_rel8_t; +#define NFAPI_DL_CONFIG_REQUEST_BCH_PDU_REL8_TAG 0x2004 + +typedef struct { + nfapi_dl_config_bch_pdu_rel8_t bch_pdu_rel8; +} nfapi_dl_config_bch_pdu; + +typedef struct { + nfapi_tl_t tl; + uint16_t length; + uint16_t pdu_index; + uint16_t rnti; + uint8_t resource_allocation_type; + uint32_t resource_block_coding; + uint8_t modulation; + uint16_t transmission_power; + uint16_t mbsfn_area_id; +} nfapi_dl_config_mch_pdu_rel8_t; +#define NFAPI_DL_CONFIG_REQUEST_MCH_PDU_REL8_TAG 0x2005 + +typedef struct { + nfapi_dl_config_mch_pdu_rel8_t mch_pdu_rel8; +} nfapi_dl_config_mch_pdu; + + +typedef struct { + uint8_t subband_index; + uint8_t num_antennas; + uint16_t bf_value[NFAPI_MAX_NUM_ANTENNAS]; +} nfapi_bf_vector_t; + +typedef struct { + nfapi_tl_t tl; + uint16_t length; + uint16_t pdu_index; + uint16_t rnti; + uint8_t resource_allocation_type; + uint8_t virtual_resource_block_assignment_flag; + uint32_t resource_block_coding; + uint8_t modulation; + uint8_t redundancy_version; + uint8_t transport_blocks; + uint8_t transport_block_to_codeword_swap_flag; + uint8_t transmission_scheme; + uint8_t number_of_layers; + uint8_t number_of_subbands; + uint8_t codebook_index[NFAPI_MAX_NUM_SUBBANDS]; + uint8_t ue_category_capacity; + uint8_t pa; + uint8_t delta_power_offset_index; + uint8_t ngap; + uint8_t nprb; + uint8_t transmission_mode; + uint8_t num_bf_prb_per_subband; + uint8_t num_bf_vector; + nfapi_bf_vector_t bf_vector[NFAPI_MAX_BF_VECTORS]; +} nfapi_dl_config_dlsch_pdu_rel8_t; +#define NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL8_TAG 0x2006 + +typedef struct { + nfapi_tl_t tl; + uint8_t nscid; +} nfapi_dl_config_dlsch_pdu_rel9_t; +#define NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL9_TAG 0x2007 + +typedef struct { + nfapi_tl_t tl; + uint8_t csi_rs_flag; + uint8_t csi_rs_resource_config_r10; + uint16_t csi_rs_zero_tx_power_resource_config_bitmap_r10; + uint8_t csi_rs_number_nzp_configuration; + uint8_t csi_rs_resource_config[NFAPI_MAX_CSI_RS_RESOURCE_CONFIG]; + uint8_t pdsch_start; +} nfapi_dl_config_dlsch_pdu_rel10_t; +#define NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG 0x2008 + +typedef struct { + nfapi_tl_t tl; + uint8_t drms_config_flag; + uint16_t drms_scrambling; + uint8_t csi_config_flag; + uint16_t csi_scrambling; + uint8_t pdsch_re_mapping_flag; + uint8_t pdsch_re_mapping_atenna_ports; + uint8_t pdsch_re_mapping_freq_shift; +} nfapi_dl_config_dlsch_pdu_rel11_t; +#define NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL11_TAG 0x203C + +typedef struct { + nfapi_tl_t tl; + uint8_t altcqi_table_r12; + uint8_t maxlayers; + uint8_t n_dl_harq; +} nfapi_dl_config_dlsch_pdu_rel12_t; +#define NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL12_TAG 0x203D + +typedef struct { + nfapi_tl_t tl; + uint8_t dwpts_symbols; + uint8_t initial_lbt_sf; + uint8_t ue_type; + uint8_t pdsch_payload_type; + uint16_t initial_transmission_sf_io; + uint8_t drms_table_flag; +} nfapi_dl_config_dlsch_pdu_rel13_t; +#define NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG 0x203E + +typedef struct { + nfapi_dl_config_dlsch_pdu_rel8_t dlsch_pdu_rel8; + nfapi_dl_config_dlsch_pdu_rel9_t dlsch_pdu_rel9; + nfapi_dl_config_dlsch_pdu_rel10_t dlsch_pdu_rel10; + nfapi_dl_config_dlsch_pdu_rel11_t dlsch_pdu_rel11; + nfapi_dl_config_dlsch_pdu_rel12_t dlsch_pdu_rel12; + nfapi_dl_config_dlsch_pdu_rel13_t dlsch_pdu_rel13; +} nfapi_dl_config_dlsch_pdu; + +typedef struct { + nfapi_tl_t tl; + uint16_t length; + uint16_t pdu_index; + uint16_t p_rnti; + uint8_t resource_allocation_type; + uint8_t virtual_resource_block_assignment_flag; + uint32_t resource_block_coding; + uint8_t mcs; + uint8_t redundancy_version; + uint8_t number_of_transport_blocks; + uint8_t transport_block_to_codeword_swap_flag; + uint8_t transmission_scheme; + uint8_t number_of_layers; + uint8_t codebook_index; + uint8_t ue_category_capacity; + uint8_t pa; + uint16_t transmission_power; + uint8_t nprb; + uint8_t ngap; +} nfapi_dl_config_pch_pdu_rel8_t; +#define NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL8_TAG 0x2009 + +typedef struct { + nfapi_tl_t tl; + uint8_t ue_mode; + uint16_t initial_transmission_sf_io; +} nfapi_dl_config_pch_pdu_rel13_t; +#define NFAPI_DL_CONFIG_REQUEST_PCH_PDU_REL13_TAG 0x203F + +typedef struct { + nfapi_dl_config_pch_pdu_rel8_t pch_pdu_rel8; + nfapi_dl_config_pch_pdu_rel13_t pch_pdu_rel13; +} nfapi_dl_config_pch_pdu; + +typedef struct { + nfapi_tl_t tl; + uint16_t transmission_power; + uint8_t prs_bandwidth; + uint8_t prs_cyclic_prefix_type; + uint8_t prs_muting; +} nfapi_dl_config_prs_pdu_rel9_t; +#define NFAPI_DL_CONFIG_REQUEST_PRS_PDU_REL9_TAG 0x200A + +typedef struct { + nfapi_dl_config_prs_pdu_rel9_t prs_pdu_rel9; +} nfapi_dl_config_prs_pdu; + +typedef struct { + nfapi_tl_t tl; + uint8_t csi_rs_antenna_port_count_r10; + uint8_t csi_rs_resource_config_r10; + uint16_t transmission_power; + uint16_t csi_rs_zero_tx_power_resource_config_bitmap_r10; + uint8_t csi_rs_number_of_nzp_configuration; + uint8_t csi_rs_resource_config[NFAPI_MAX_CSI_RS_RESOURCE_CONFIG]; +} nfapi_dl_config_csi_rs_pdu_rel10_t; +#define NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL10_TAG 0x200B + +typedef struct { + nfapi_tl_t tl; + uint8_t csi_rs_class; + uint8_t cdm_type; + uint8_t num_bf_vector; + struct { + uint8_t csi_rs_resource_index; + uint16_t bf_value[NFAPI_MAX_ANTENNA_PORT_COUNT]; + } bf_vector[NFAPI_MAX_BF_VECTORS]; + +}nfapi_dl_config_csi_rs_pdu_rel13_t; +#define NFAPI_DL_CONFIG_REQUEST_CSI_RS_PDU_REL13_TAG 0x2040 + +typedef struct { + nfapi_dl_config_csi_rs_pdu_rel10_t csi_rs_pdu_rel10; + nfapi_dl_config_csi_rs_pdu_rel13_t csi_rs_pdu_rel13; +} nfapi_dl_config_csi_rs_pdu; + +#define NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL8_TAG 0x2001 +#define NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL9_TAG 0x2002 +#define NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL10_TAG 0x2003 +#define NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL11_TAG 0x2039 +#define NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL12_TAG 0x203a +#define NFAPI_DL_CONFIG_REQUEST_EPDCCH_PDU_REL13_TAG 0x203b + +typedef struct { + nfapi_tl_t tl; + uint8_t epdcch_resource_assignment_flag; + uint16_t epdcch_id; + uint8_t epdcch_start_symbol; + uint8_t epdcch_num_prb; + uint8_t epdcch_prb_index[NFAPI_MAX_EPDCCH_PRB]; + nfapi_bf_vector_t bf_vector; +} nfapi_dl_config_epdcch_parameters_rel11_t; +#define NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL11_TAG 0x2041 + +typedef struct { + nfapi_tl_t tl; + uint8_t dwpts_symbols; + uint8_t initial_lbt_sf; +} nfapi_dl_config_epdcch_parameters_rel13_t; +#define NFAPI_DL_CONFIG_REQUEST_EPDCCH_PARAM_REL13_TAG 0x2042 + +typedef struct { + nfapi_dl_config_dci_dl_pdu_rel8_t epdcch_pdu_rel8; + nfapi_dl_config_dci_dl_pdu_rel9_t epdcch_pdu_rel9; + nfapi_dl_config_dci_dl_pdu_rel10_t epdcch_pdu_rel10; + nfapi_dl_config_dci_dl_pdu_rel11_t epdcch_pdu_rel11; + nfapi_dl_config_dci_dl_pdu_rel12_t epdcch_pdu_rel12; + nfapi_dl_config_dci_dl_pdu_rel13_t epdcch_pdu_rel13; + nfapi_dl_config_epdcch_parameters_rel11_t epdcch_params_rel11; + nfapi_dl_config_epdcch_parameters_rel13_t epdcch_params_rel13; +} nfapi_dl_config_epdcch_pdu; + + +typedef struct { + nfapi_tl_t tl; + uint8_t mpdcch_narrow_band; + uint8_t number_of_prb_pairs; + uint8_t resource_block_assignment; + uint8_t mpdcch_tansmission_type; + uint8_t start_symbol; + uint8_t ecce_index; + uint8_t aggregation_level; + uint8_t rnti_type; + uint16_t rnti; + uint8_t ce_mode; + uint16_t drms_scrambling_init; + uint16_t initial_transmission_sf_io; + uint16_t transmission_power; + uint8_t dci_format; + uint16_t resource_block_coding; + uint8_t mcs; + uint8_t pdsch_reptition_levels; + uint8_t redundancy_version; + uint8_t new_data_indicator; + uint8_t harq_process; + uint8_t tpmi_length; + uint8_t tpmi; + uint8_t pmi_flag; + uint8_t pmi; + uint8_t harq_resource_offset; + uint8_t dci_subframe_repetition_number; + uint8_t tpc; + uint8_t downlink_assignment_index_length; + uint8_t downlink_assignment_index; + uint8_t allocate_prach_flag; + uint8_t preamble_index; + uint8_t prach_mask_index; + uint8_t starting_ce_level; + uint8_t srs_request; + uint8_t antenna_ports_and_scrambling_identity_flag; + uint8_t antenna_ports_and_scrambling_identity; + uint8_t frequency_hopping_enabled_flag; + uint8_t paging_direct_indication_differentiation_flag; + uint8_t direct_indication; + uint8_t total_dci_length_including_padding; + uint8_t number_of_tx_antenna_ports; + uint16_t precoding_value[NFAPI_MAX_TX_PHYSICAL_ANTENNA_PORTS]; +} nfapi_dl_config_mpdcch_pdu_rel13_t; +#define NFAPI_DL_CONFIG_REQUEST_MPDCCH_PDU_REL13_TAG 0x205B + + +typedef struct { + nfapi_dl_config_mpdcch_pdu_rel13_t mpdcch_pdu_rel13; +} nfapi_dl_config_mpdcch_pdu; + +typedef struct { + nfapi_tl_t tl; + uint16_t length; + uint16_t pdu_index; + uint16_t transmission_power; + uint16_t hyper_sfn_2_lsbs; +} nfapi_dl_config_nbch_pdu_rel13_t; + +#define NFAPI_DL_CONFIG_REQUEST_NBCH_PDU_REL13_TAG 0x205C + +typedef struct { + nfapi_dl_config_nbch_pdu_rel13_t nbch_pdu_rel13; +} nfapi_dl_config_nbch_pdu; + +typedef struct { + nfapi_tl_t tl; + uint16_t length; + uint16_t pdu_index; + uint8_t ncce_index; + uint8_t aggregation_level; + uint8_t start_symbol; + uint8_t rnti_type; + uint16_t rnti; + uint8_t scrambling_reinitialization_batch_index; + uint8_t nrs_antenna_ports_assumed_by_the_ue; + uint8_t dci_format; + uint8_t scheduling_delay; + uint8_t resource_assignment; + uint8_t repetition_number; + uint8_t mcs; + uint8_t new_data_indicator; + uint8_t harq_ack_resource; + uint8_t npdcch_order_indication; + uint8_t starting_number_of_nprach_repetitions; + uint8_t subcarrier_indication_of_nprach; + uint8_t paging_direct_indication_differentation_flag; + uint8_t direct_indication; + uint8_t dci_subframe_repetition_number; + uint8_t total_dci_length_including_padding; +} nfapi_dl_config_npdcch_pdu_rel13_t; + +#define NFAPI_DL_CONFIG_REQUEST_NPDCCH_PDU_REL13_TAG 0x205D + +typedef struct { + nfapi_dl_config_npdcch_pdu_rel13_t npdcch_pdu_rel13; +} nfapi_dl_config_npdcch_pdu; + +typedef struct { + nfapi_tl_t tl; + uint16_t length; + uint16_t pdu_index; + uint8_t start_symbol; + uint8_t rnti_type; + uint16_t rnti; + uint16_t resource_assignment; + uint16_t repetition_number; + uint8_t modulation; + uint8_t number_of_subframes_for_resource_assignment; + uint8_t scrambling_sequence_initialization_cinit; + uint16_t sf_idx; + uint8_t nrs_antenna_ports_assumed_by_the_ue; +} nfapi_dl_config_ndlsch_pdu_rel13_t; + +#define NFAPI_DL_CONFIG_REQUEST_NDLSCH_PDU_REL13_TAG 0x205E + +typedef struct { + nfapi_dl_config_ndlsch_pdu_rel13_t ndlsch_pdu_rel13; +} nfapi_dl_config_ndlsch_pdu; + + +typedef struct { + uint8_t pdu_type; + uint8_t pdu_size; + union { + nfapi_dl_config_dci_dl_pdu dci_dl_pdu; + nfapi_dl_config_bch_pdu bch_pdu; + nfapi_dl_config_mch_pdu mch_pdu; + nfapi_dl_config_dlsch_pdu dlsch_pdu; + nfapi_dl_config_pch_pdu pch_pdu; + nfapi_dl_config_prs_pdu prs_pdu; + nfapi_dl_config_csi_rs_pdu csi_rs_pdu; + nfapi_dl_config_epdcch_pdu epdcch_pdu; + nfapi_dl_config_mpdcch_pdu mpdcch_pdu; + nfapi_dl_config_nbch_pdu nbch_pdu; + nfapi_dl_config_npdcch_pdu npdcch_pdu; + nfapi_dl_config_ndlsch_pdu ndlsch_pdu; + }; +} nfapi_dl_config_request_pdu_t; + +#define NFAPI_DL_CONFIG_MAX_PDU 100 +typedef struct { + nfapi_tl_t tl; + uint8_t number_pdcch_ofdm_symbols; + uint8_t number_dci; + uint16_t number_pdu; + uint8_t number_pdsch_rnti; + uint16_t transmission_power_pcfich; + nfapi_dl_config_request_pdu_t* dl_config_pdu_list; +} nfapi_dl_config_request_body_t; +#define NFAPI_DL_CONFIG_REQUEST_BODY_TAG 0x2000 + +typedef struct { + nfapi_tl_t tl; + uint32_t handle; + uint16_t size; + uint16_t rnti; + uint8_t resource_block_start; + uint8_t number_of_resource_blocks; + uint8_t modulation_type; + uint8_t cyclic_shift_2_for_drms; + uint8_t frequency_hopping_enabled_flag; + uint8_t frequency_hopping_bits; + uint8_t new_data_indication; + uint8_t redundancy_version; + uint8_t harq_process_number; + uint8_t ul_tx_mode; + uint8_t current_tx_nb; + uint8_t n_srs; +} nfapi_ul_config_ulsch_pdu_rel8_t; +#define NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL8_TAG 0x200D + +typedef struct { + nfapi_tl_t tl; + uint8_t resource_allocation_type; + uint32_t resource_block_coding; + uint8_t transport_blocks; + uint8_t transmission_scheme; + uint8_t number_of_layers; + uint8_t codebook_index; + uint8_t disable_sequence_hopping_flag; +} nfapi_ul_config_ulsch_pdu_rel10_t; +#define NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL10_TAG 0x200E + + +typedef struct { + nfapi_tl_t tl; + uint8_t virtual_cell_id_enabled_flag; + uint16_t npusch_identity; + uint8_t dmrs_config_flag; + uint16_t ndmrs_csh_identity; +} nfapi_ul_config_ulsch_pdu_rel11_t; + +#define NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL11_TAG 0x2043 + +typedef struct { + nfapi_tl_t tl; + uint8_t ue_type; + uint16_t total_number_of_repetitions; + uint16_t repetition_number; + uint16_t initial_transmission_sf_io; + uint8_t empty_symbols_due_to_re_tunning; +} nfapi_ul_config_ulsch_pdu_rel13_t; +#define NFAPI_UL_CONFIG_REQUEST_ULSCH_PDU_REL13_TAG 0x2044 + +typedef struct { + nfapi_ul_config_ulsch_pdu_rel8_t ulsch_pdu_rel8; + nfapi_ul_config_ulsch_pdu_rel10_t ulsch_pdu_rel10; + nfapi_ul_config_ulsch_pdu_rel11_t ulsch_pdu_rel11; + nfapi_ul_config_ulsch_pdu_rel13_t ulsch_pdu_rel13; +} nfapi_ul_config_ulsch_pdu; + +typedef struct { + nfapi_tl_t tl; + uint8_t dl_cqi_pmi_size_rank_1; + uint8_t dl_cqi_pmi_size_rank_greater_1; + uint8_t ri_size; + uint8_t delta_offset_cqi; + uint8_t delta_offset_ri; +} nfapi_ul_config_cqi_ri_information_rel8_t; +#define NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL8_TAG 0x2010 + +typedef struct { + uint8_t dl_cqi_pmi_ri_size; + uint8_t control_type; +} nfapi_ul_config_periodic_cqi_pmi_ri_report_t; + +typedef struct { + uint8_t number_of_cc; + struct { + uint8_t ri_size; + uint8_t dl_cqi_pmi_size[8]; + } cc[NFAPI_MAX_CC]; +} nfapi_ul_config_aperiodic_cqi_pmi_ri_report_t; + +typedef struct { + nfapi_tl_t tl; + uint8_t report_type; + uint8_t delta_offset_cqi; + uint8_t delta_offset_ri; + union { + nfapi_ul_config_periodic_cqi_pmi_ri_report_t periodic_cqi_pmi_ri_report; + nfapi_ul_config_aperiodic_cqi_pmi_ri_report_t aperiodic_cqi_pmi_ri_report; + }; +} nfapi_ul_config_cqi_ri_information_rel9_t; +#define NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL9_TAG 0x2011 + +typedef struct { + uint16_t dl_cqi_pmi_ri_size_2; +} nfapi_ul_config_periodic_cqi_pmi_ri_report_re13_t; + +typedef struct { +} nfapi_ul_config_aperiodic_cqi_pmi_ri_report_re13_t; + +typedef struct { + nfapi_tl_t tl; + uint8_t report_type; // Convience parameter, not sent on the wire + union { + nfapi_ul_config_periodic_cqi_pmi_ri_report_re13_t periodic_cqi_pmi_ri_report; + nfapi_ul_config_aperiodic_cqi_pmi_ri_report_re13_t aperiodic_cqi_pmi_ri_report; + }; +} nfapi_ul_config_cqi_ri_information_rel13_t; +#define NFAPI_UL_CONFIG_REQUEST_CQI_RI_INFORMATION_REL13_TAG 0x2045 + +typedef struct { + nfapi_ul_config_cqi_ri_information_rel8_t cqi_ri_information_rel8; + nfapi_ul_config_cqi_ri_information_rel9_t cqi_ri_information_rel9; + nfapi_ul_config_cqi_ri_information_rel13_t cqi_ri_information_rel13; +} nfapi_ul_config_cqi_ri_information; + +typedef struct { + nfapi_tl_t tl; + uint8_t harq_size; + uint8_t delta_offset_harq; + uint8_t ack_nack_mode; +} nfapi_ul_config_ulsch_harq_information_rel10_t; +#define NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL10_TAG 0x2012 + +typedef struct { + nfapi_tl_t tl; + uint16_t harq_size_2; + uint8_t delta_offset_harq_2; +} nfapi_ul_config_ulsch_harq_information_rel13_t; +#define NFAPI_UL_CONFIG_REQUEST_ULSCH_HARQ_INFORMATION_REL13_TAG 0x2046 + +typedef struct { + nfapi_ul_config_ulsch_harq_information_rel10_t harq_information_rel10; + nfapi_ul_config_ulsch_harq_information_rel13_t harq_information_rel13; +} nfapi_ul_config_ulsch_harq_information; + +typedef struct { + nfapi_tl_t tl; + uint8_t n_srs_initial; + uint8_t initial_number_of_resource_blocks; +} nfapi_ul_config_initial_transmission_parameters_rel8_t; +#define NFAPI_UL_CONFIG_REQUEST_INITIAL_TRANSMISSION_PARAMETERS_REL8_TAG 0x200F + +typedef struct { + nfapi_ul_config_initial_transmission_parameters_rel8_t initial_transmission_parameters_rel8; +} nfapi_ul_config_initial_transmission_parameters; + +typedef struct { + nfapi_ul_config_ulsch_pdu ulsch_pdu; + nfapi_ul_config_cqi_ri_information cqi_ri_information; + nfapi_ul_config_initial_transmission_parameters initial_transmission_parameters; +} nfapi_ul_config_ulsch_cqi_ri_pdu; + +typedef struct { + nfapi_ul_config_ulsch_pdu ulsch_pdu; + nfapi_ul_config_ulsch_harq_information harq_information; + nfapi_ul_config_initial_transmission_parameters initial_transmission_parameters; +} nfapi_ul_config_ulsch_harq_pdu; + +typedef struct { + nfapi_ul_config_ulsch_pdu ulsch_pdu; + nfapi_ul_config_cqi_ri_information cqi_ri_information; + nfapi_ul_config_ulsch_harq_information harq_information; + nfapi_ul_config_initial_transmission_parameters initial_transmission_parameters; +} nfapi_ul_config_ulsch_cqi_harq_ri_pdu; + + +typedef struct { + nfapi_tl_t tl; + uint32_t handle; + uint16_t rnti; +} nfapi_ul_config_ue_information_rel8_t; +#define NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL8_TAG 0x2013 + +typedef struct { + nfapi_tl_t tl; + uint8_t virtual_cell_id_enabled_flag; + uint16_t npusch_identity; +} nfapi_ul_config_ue_information_rel11_t; + +#define NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL11_TAG 0x2047 + +typedef struct { + nfapi_tl_t tl; + uint8_t ue_type; + uint8_t empty_symbols; + uint16_t total_number_of_repetitions; + uint16_t repetition_number; +} nfapi_ul_config_ue_information_rel13_t; + +#define NFAPI_UL_CONFIG_REQUEST_UE_INFORMATION_REL13_TAG 0x2048 + +typedef struct { + nfapi_ul_config_ue_information_rel8_t ue_information_rel8; + nfapi_ul_config_ue_information_rel11_t ue_information_rel11; + nfapi_ul_config_ue_information_rel13_t ue_information_rel13; +} nfapi_ul_config_ue_information; + +typedef struct { + nfapi_tl_t tl; + uint16_t pucch_index; + uint8_t dl_cqi_pmi_size; +} nfapi_ul_config_cqi_information_rel8_t; +#define NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL8_TAG 0x2014 + +typedef struct { + nfapi_tl_t tl; + uint8_t number_of_pucch_resource; + uint16_t pucch_index_p1; +} nfapi_ul_config_cqi_information_rel10_t; +#define NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL10_TAG 0x2015 + +typedef struct { + nfapi_tl_t tl; + uint8_t csi_mode; + uint16_t dl_cqi_pmi_size_2; + uint8_t starting_prb; + uint8_t n_prb; + uint8_t cdm_index; + uint8_t n_srs; +} nfapi_ul_config_cqi_information_rel13_t; +#define NFAPI_UL_CONFIG_REQUEST_CQI_INFORMATION_REL13_TAG 0x2049 + +typedef struct { + nfapi_ul_config_cqi_information_rel8_t cqi_information_rel8; + nfapi_ul_config_cqi_information_rel10_t cqi_information_rel10; + nfapi_ul_config_cqi_information_rel13_t cqi_information_rel13; +} nfapi_ul_config_cqi_information; + +typedef struct { + nfapi_tl_t tl; + uint16_t pucch_index; +} nfapi_ul_config_sr_information_rel8_t; +#define NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL8_TAG 0x2016 + +typedef struct { + nfapi_tl_t tl; + uint8_t number_of_pucch_resources; + uint16_t pucch_index_p1; +} nfapi_ul_config_sr_information_rel10_t; +#define NFAPI_UL_CONFIG_REQUEST_SR_INFORMATION_REL10_TAG 0x2017 + +typedef struct { + nfapi_ul_config_sr_information_rel8_t sr_information_rel8; + nfapi_ul_config_sr_information_rel10_t sr_information_rel10; +} nfapi_ul_config_sr_information; + +typedef struct { + nfapi_tl_t tl; + uint8_t harq_size; + uint8_t ack_nack_mode; + uint8_t number_of_pucch_resources; + uint16_t n_pucch_1_0; + uint16_t n_pucch_1_1; + uint16_t n_pucch_1_2; + uint16_t n_pucch_1_3; +} nfapi_ul_config_harq_information_rel10_tdd_t; +#define NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL10_TDD_TAG 0x2018 + + +typedef struct { + nfapi_tl_t tl; + uint16_t n_pucch_1_0; + uint8_t harq_size; +} nfapi_ul_config_harq_information_rel8_fdd_t; +#define NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL8_FDD_TAG 0x2019 + +typedef struct { + nfapi_tl_t tl; + uint8_t harq_size; + uint8_t ack_nack_mode; + uint8_t number_of_pucch_resources; + uint16_t n_pucch_1_0; + uint16_t n_pucch_1_1; + uint16_t n_pucch_1_2; + uint16_t n_pucch_1_3; +} nfapi_ul_config_harq_information_rel9_fdd_t; +#define NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL9_FDD_TAG 0x201a + +typedef struct { + nfapi_tl_t tl; + uint8_t num_ant_ports; + uint16_t n_pucch_2_0; + uint16_t n_pucch_2_1; + uint16_t n_pucch_2_2; + uint16_t n_pucch_2_3; +} nfapi_ul_config_harq_information_rel11_t; +#define NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL11_TAG 0x204A + +typedef struct { + nfapi_tl_t tl; + uint16_t harq_size_2; + uint8_t starting_prb; + uint8_t n_prb; + uint8_t cdm_index; + uint8_t n_srs; +} nfapi_ul_config_harq_information_rel13_t; +#define NFAPI_UL_CONFIG_REQUEST_HARQ_INFORMATION_REL13_TAG 0x204B + +typedef struct { + nfapi_ul_config_harq_information_rel10_tdd_t harq_information_rel10_tdd; + nfapi_ul_config_harq_information_rel8_fdd_t harq_information_rel8_fdd; + nfapi_ul_config_harq_information_rel9_fdd_t harq_information_rel9_fdd; + nfapi_ul_config_harq_information_rel11_t harq_information_rel11; + nfapi_ul_config_harq_information_rel13_t harq_information_rel13; +} nfapi_ul_config_harq_information; + +typedef struct { + nfapi_tl_t tl; + uint32_t handle; + uint16_t size; + uint16_t rnti; + uint8_t srs_bandwidth; + uint8_t frequency_domain_position; + uint8_t srs_hopping_bandwidth; + uint8_t transmission_comb; + uint16_t i_srs; + uint8_t sounding_reference_cyclic_shift; +} nfapi_ul_config_srs_pdu_rel8_t; +#define NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL8_TAG 0x201b + +typedef struct { + nfapi_tl_t tl; + uint8_t antenna_port; +} nfapi_ul_config_srs_pdu_rel10_t; +#define NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL10_TAG 0x201c + +typedef struct { + nfapi_tl_t tl; + uint8_t number_of_combs; +} nfapi_ul_config_srs_pdu_rel13_t; +#define NFAPI_UL_CONFIG_REQUEST_SRS_PDU_REL13_TAG 0x204c + +typedef struct { + nfapi_ul_config_srs_pdu_rel8_t srs_pdu_rel8; + nfapi_ul_config_srs_pdu_rel10_t srs_pdu_rel10; + nfapi_ul_config_srs_pdu_rel13_t srs_pdu_rel13; +} nfapi_ul_config_srs_pdu; + +typedef struct { + nfapi_ul_config_ue_information ue_information; + nfapi_ul_config_cqi_information cqi_information; +} nfapi_ul_config_uci_cqi_pdu; + +typedef struct { + nfapi_ul_config_ue_information ue_information; + nfapi_ul_config_sr_information sr_information; +} nfapi_ul_config_uci_sr_pdu; + +typedef struct { + nfapi_ul_config_ue_information ue_information; + nfapi_ul_config_harq_information harq_information; +} nfapi_ul_config_uci_harq_pdu; + +typedef struct { + nfapi_ul_config_ue_information ue_information; + nfapi_ul_config_sr_information sr_information; + nfapi_ul_config_harq_information harq_information; +} nfapi_ul_config_uci_sr_harq_pdu; + +typedef struct { + nfapi_ul_config_ue_information ue_information; + nfapi_ul_config_cqi_information cqi_information; + nfapi_ul_config_harq_information harq_information; +} nfapi_ul_config_uci_cqi_harq_pdu; + +typedef struct { + nfapi_ul_config_ue_information ue_information; + nfapi_ul_config_cqi_information cqi_information; + nfapi_ul_config_sr_information sr_information; +} nfapi_ul_config_uci_cqi_sr_pdu; + +typedef struct { + nfapi_ul_config_ue_information ue_information; + nfapi_ul_config_cqi_information cqi_information; + nfapi_ul_config_sr_information sr_information; + nfapi_ul_config_harq_information harq_information; +} nfapi_ul_config_uci_cqi_sr_harq_pdu; + +typedef struct { + nfapi_ul_config_ue_information ue_information; +} nfapi_ul_config_harq_buffer_pdu; + +typedef struct { + nfapi_ul_config_ulsch_pdu ulsch_pdu; + nfapi_ul_config_cqi_information csi_information; +} nfapi_ul_config_ulsch_uci_csi_pdu; + +typedef struct { + nfapi_ul_config_ulsch_pdu ulsch_pdu; + nfapi_ul_config_harq_information harq_information; +} nfapi_ul_config_ulsch_uci_harq_pdu; + +typedef struct { + nfapi_ul_config_ulsch_pdu ulsch_pdu; + nfapi_ul_config_cqi_information csi_information; + nfapi_ul_config_harq_information harq_information; +} nfapi_ul_config_ulsch_csi_uci_harq_pdu; + +typedef struct { + nfapi_tl_t tl; + uint8_t harq_ack_resource; +} nfapi_ul_config_nb_harq_information_rel13_fdd_t; +#define NFAPI_UL_CONFIG_REQUEST_NB_HARQ_INFORMATION_REL13_FDD_TAG 0x2061 + +typedef struct { + nfapi_ul_config_nb_harq_information_rel13_fdd_t nb_harq_information_rel13_fdd; +} nfapi_ul_config_nb_harq_information; + +typedef struct { + nfapi_tl_t tl; + uint8_t nulsch_format; + uint32_t handle; + uint16_t size; + uint16_t rnti; + uint8_t subcarrier_indication; + uint8_t resource_assignment; + uint8_t mcs; + uint8_t redudancy_version; + uint8_t repetition_number; + uint8_t new_data_indication; + uint8_t n_srs; + uint16_t scrambling_sequence_initialization_cinit; + uint16_t sf_idx; + nfapi_ul_config_ue_information ue_information; + nfapi_ul_config_nb_harq_information nb_harq_information; +} nfapi_ul_config_nulsch_pdu_rel13_t; +#define NFAPI_UL_CONFIG_REQUEST_NULSCH_PDU_REL13_TAG 0x205F + +typedef struct { + nfapi_ul_config_nulsch_pdu_rel13_t nulsch_pdu_rel13; +} nfapi_ul_config_nulsch_pdu; + + +typedef struct { + nfapi_tl_t tl; + uint8_t nprach_config_0; + uint8_t nprach_config_1; + uint8_t nprach_config_2; +} nfapi_ul_config_nrach_pdu_rel13_t; +#define NFAPI_UL_CONFIG_REQUEST_NRACH_PDU_REL13_TAG 0x2067 + +typedef struct { + nfapi_ul_config_nrach_pdu_rel13_t nrach_pdu_rel13; +} nfapi_ul_config_nrach_pdu; + +typedef struct { + uint8_t pdu_type; + uint8_t pdu_size; + union { + nfapi_ul_config_ulsch_pdu ulsch_pdu; + nfapi_ul_config_ulsch_cqi_ri_pdu ulsch_cqi_ri_pdu; + nfapi_ul_config_ulsch_harq_pdu ulsch_harq_pdu; + nfapi_ul_config_ulsch_cqi_harq_ri_pdu ulsch_cqi_harq_ri_pdu; + nfapi_ul_config_uci_cqi_pdu uci_cqi_pdu; + nfapi_ul_config_uci_sr_pdu uci_sr_pdu; + nfapi_ul_config_uci_harq_pdu uci_harq_pdu; + nfapi_ul_config_uci_sr_harq_pdu uci_sr_harq_pdu; + nfapi_ul_config_uci_cqi_harq_pdu uci_cqi_harq_pdu; + nfapi_ul_config_uci_cqi_sr_pdu uci_cqi_sr_pdu; + nfapi_ul_config_uci_cqi_sr_harq_pdu uci_cqi_sr_harq_pdu; + nfapi_ul_config_srs_pdu srs_pdu; + nfapi_ul_config_harq_buffer_pdu harq_buffer_pdu; + nfapi_ul_config_ulsch_uci_csi_pdu ulsch_uci_csi_pdu; + nfapi_ul_config_ulsch_uci_harq_pdu ulsch_uci_harq_pdu; + nfapi_ul_config_ulsch_csi_uci_harq_pdu ulsch_csi_uci_harq_pdu; + nfapi_ul_config_nulsch_pdu nulsch_pdu; + nfapi_ul_config_nrach_pdu nrach_pdu; + }; +} nfapi_ul_config_request_pdu_t; + +#define NFAPI_UL_CONFIG_MAX_PDU 100 +typedef struct { + nfapi_tl_t tl; + uint8_t number_of_pdus; + uint8_t rach_prach_frequency_resources; + uint8_t srs_present; + nfapi_ul_config_request_pdu_t* ul_config_pdu_list; +} nfapi_ul_config_request_body_t; +#define NFAPI_UL_CONFIG_REQUEST_BODY_TAG 0x200C + +typedef struct { + nfapi_tl_t tl; + uint8_t resource_block_start; + uint8_t cyclic_shift_2_for_drms; + uint8_t hi_value; + uint8_t i_phich; + uint16_t transmission_power; +} nfapi_hi_dci0_hi_pdu_rel8_t; +#define NFAPI_HI_DCI0_REQUEST_HI_PDU_REL8_TAG 0x201e + +typedef struct { + nfapi_tl_t tl; + uint8_t flag_tb2; + uint8_t hi_value_2; +} nfapi_hi_dci0_hi_pdu_rel10_t; +#define NFAPI_HI_DCI0_REQUEST_HI_PDU_REL10_TAG 0x201f + +typedef struct { + nfapi_hi_dci0_hi_pdu_rel8_t hi_pdu_rel8; + nfapi_hi_dci0_hi_pdu_rel10_t hi_pdu_rel10; +} nfapi_hi_dci0_hi_pdu; + +typedef struct { + nfapi_tl_t tl; + uint8_t dci_format; + uint8_t cce_index; + uint8_t aggregation_level; + uint16_t rnti; + uint8_t resource_block_start; + uint8_t number_of_resource_block; + uint8_t mcs_1; + uint8_t cyclic_shift_2_for_drms; + uint8_t frequency_hopping_enabled_flag; + uint8_t frequency_hopping_bits; + uint8_t new_data_indication_1; + uint8_t ue_tx_antenna_seleciton; + uint8_t tpc; + uint8_t cqi_csi_request; + uint8_t ul_index; + uint8_t dl_assignment_index; + uint32_t tpc_bitmap; + uint16_t transmission_power; +} nfapi_hi_dci0_dci_pdu_rel8_t; +#define NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL8_TAG 0x2020 + +typedef struct { + nfapi_tl_t tl; + uint8_t cross_carrier_scheduling_flag; + uint8_t carrier_indicator; + uint8_t size_of_cqi_csi_feild; + uint8_t srs_flag; + uint8_t srs_request; + uint8_t resource_allocation_flag; + uint8_t resource_allocation_type; + uint32_t resource_block_coding; + uint8_t mcs_2; + uint8_t new_data_indication_2; + uint8_t number_of_antenna_ports; + uint8_t tpmi; + uint8_t total_dci_length_including_padding; + uint8_t n_ul_rb; +} nfapi_hi_dci0_dci_pdu_rel10_t; +#define NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL10_TAG 0x2021 + +typedef struct { + nfapi_tl_t tl; + uint8_t pscch_resource; + uint8_t time_resource_pattern; +} nfapi_hi_dci0_dci_pdu_rel12_t; + +#define NFAPI_HI_DCI0_REQUEST_DCI_PDU_REL12_TAG 0x204D + +typedef struct { + nfapi_hi_dci0_dci_pdu_rel8_t dci_pdu_rel8; + nfapi_hi_dci0_dci_pdu_rel10_t dci_pdu_rel10; + nfapi_hi_dci0_dci_pdu_rel12_t dci_pdu_rel12; +} nfapi_hi_dci0_dci_pdu; + +typedef nfapi_hi_dci0_dci_pdu_rel8_t nfapi_hi_dci0_epdcch_dci_pdu_rel8_t; +#define NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL8_TAG 0x2020 + +typedef nfapi_hi_dci0_dci_pdu_rel10_t nfapi_hi_dci0_epdcch_dci_pdu_rel10_t; +#define NFAPI_HI_DCI0_REQUEST_EPDCCH_DCI_PDU_REL10_TAG 0x2021 + +typedef nfapi_dl_config_epdcch_parameters_rel11_t nfapi_hi_dci0_epdcch_parameters_rel11_t; +#define NFAPI_HI_DCI0_REQUEST_EPDCCH_PARAMETERS_REL11_TAG 0x2041 + +typedef struct { + nfapi_hi_dci0_epdcch_dci_pdu_rel8_t epdcch_dci_pdu_rel8; + nfapi_hi_dci0_epdcch_dci_pdu_rel10_t epdcch_dci_pdu_rel10; + nfapi_hi_dci0_epdcch_parameters_rel11_t epdcch_parameters_rel11; +} nfapi_hi_dci0_epdcch_dci_pdu; + + +typedef struct { + nfapi_tl_t tl; + uint8_t mpdcch_narrowband; + uint8_t number_of_prb_pairs; + uint8_t resource_block_assignment; + uint8_t mpdcch_transmission_type; + uint8_t start_symbol; + uint8_t ecce_index; + uint8_t aggreagation_level; + uint8_t rnti_type; + uint16_t rnti; + uint8_t ce_mode; + uint16_t drms_scrambling_init; + uint16_t initial_transmission_sf_io; + uint16_t transmission_power; + uint8_t dci_format; + uint8_t resource_block_start; + uint8_t number_of_resource_blocks; + uint8_t mcs; + uint8_t pusch_repetition_levels; + uint8_t frequency_hopping_flag; + uint8_t new_data_indication; + uint8_t harq_process; + uint8_t redudency_version; + uint8_t tpc; + uint8_t csi_request; + uint8_t ul_inex; + uint8_t dai_presence_flag; + uint8_t dl_assignment_index; + uint8_t srs_request; + uint8_t dci_subframe_repetition_number; + uint32_t tcp_bitmap; + uint8_t total_dci_length_include_padding; + uint8_t number_of_tx_antenna_ports; + uint16_t precoding_value[NFAPI_MAX_ANTENNA_PORT_COUNT]; +} nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t; +#define NFAPI_HI_DCI0_REQUEST_MPDCCH_DCI_PDU_REL13_TAG 0x204E + +typedef struct { + nfapi_hi_dci0_mpdcch_dci_pdu_rel13_t mpdcch_dci_pdu_rel13; +} nfapi_hi_dci0_mpdcch_dci_pdu; + +typedef struct { + nfapi_tl_t tl; + uint8_t ncce_index; + uint8_t aggregation_level; + uint8_t start_symbol; + uint16_t rnti; + uint8_t scrambling_reinitialization_batch_index; + uint8_t nrs_antenna_ports_assumed_by_the_ue; + uint8_t subcarrier_indication; + uint8_t resource_assignment; + uint8_t scheduling_delay; + uint8_t mcs; + uint8_t redudancy_version; + uint8_t repetition_number; + uint8_t new_data_indicator; + uint8_t dci_subframe_repetition_number; +} nfapi_hi_dci0_npdcch_dci_pdu_rel13_t; + +#define NFAPI_HI_DCI0_REQUEST_NPDCCH_DCI_PDU_REL13_TAG 0x2062 + +typedef struct { + nfapi_hi_dci0_npdcch_dci_pdu_rel13_t npdcch_dci_pdu_rel13; +} nfapi_hi_dci0_npdcch_dci_pdu; + +typedef struct { + uint8_t pdu_type; + uint8_t pdu_size; + union { + nfapi_hi_dci0_hi_pdu hi_pdu; + nfapi_hi_dci0_dci_pdu dci_pdu; + nfapi_hi_dci0_epdcch_dci_pdu epdcch_dci_pdu; + nfapi_hi_dci0_mpdcch_dci_pdu mpdcch_dci_pdu; + nfapi_hi_dci0_npdcch_dci_pdu npdcch_dci_pdu; + }; +} nfapi_hi_dci0_request_pdu_t; + +#define NFAPI_HI_DCI0_MAX_PDU 100 +typedef struct { + nfapi_tl_t tl; + uint16_t sfnsf; + uint8_t number_of_dci; + uint8_t number_of_hi; + nfapi_hi_dci0_request_pdu_t* hi_dci0_pdu_list; +} nfapi_hi_dci0_request_body_t; +#define NFAPI_HI_DCI0_REQUEST_BODY_TAG 0x201D + +#define NFAPI_TX_MAX_SEGMENTS 32 +typedef struct { + uint16_t pdu_length; + uint16_t pdu_index; + uint8_t num_segments; + struct { + uint32_t segment_length; + uint8_t* segment_data; + } segments[NFAPI_TX_MAX_SEGMENTS]; +} nfapi_tx_request_pdu_t; + +#define NFAPI_TX_MAX_PDU 100 +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_pdus; + nfapi_tx_request_pdu_t* tx_pdu_list; +} nfapi_tx_request_body_t; +#define NFAPI_TX_REQUEST_BODY_TAG 0x2022 + +// P7 Message Structures +typedef struct { + nfapi_p7_message_header_t header; + uint32_t t1; + int32_t delta_sfn_sf; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_dl_node_sync_t; + +typedef struct { + nfapi_p7_message_header_t header; + uint32_t t1; + uint32_t t2; + uint32_t t3; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_ul_node_sync_t; + +typedef struct { + nfapi_p7_message_header_t header; + uint32_t last_sfn_sf; + uint32_t time_since_last_timing_info; + uint32_t dl_config_jitter; + uint32_t tx_request_jitter; + uint32_t ul_config_jitter; + uint32_t hi_dci0_jitter; + int32_t dl_config_latest_delay; + int32_t tx_request_latest_delay; + int32_t ul_config_latest_delay; + int32_t hi_dci0_latest_delay; + int32_t dl_config_earliest_arrival; + int32_t tx_request_earliest_arrival; + int32_t ul_config_earliest_arrival; + int32_t hi_dci0_earliest_arrival; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_timing_info_t; + +typedef struct { + nfapi_tl_t tl; + uint32_t handle; + uint16_t rnti; +} nfapi_rx_ue_information; +#define NFAPI_RX_UE_INFORMATION_TAG 0x2038 + +typedef struct { + uint8_t value_0; + uint8_t value_1; +} nfapi_harq_indication_tdd_harq_data_bundling_t; + +typedef struct { + uint8_t value_0; + uint8_t value_1; + uint8_t value_2; + uint8_t value_3; +} nfapi_harq_indication_tdd_harq_data_multiplexing_t; + +typedef struct { + uint8_t value_0; +} nfapi_harq_indication_tdd_harq_data_special_bundling_t; + +typedef struct { + uint8_t value_0; +} nfapi_harq_indication_tdd_harq_data_t; + +typedef struct { + nfapi_tl_t tl; + uint8_t mode; + uint8_t number_of_ack_nack; + union{ + nfapi_harq_indication_tdd_harq_data_bundling_t bundling; + nfapi_harq_indication_tdd_harq_data_multiplexing_t multiplex; + nfapi_harq_indication_tdd_harq_data_special_bundling_t special_bundling; + } harq_data; +} nfapi_harq_indication_tdd_rel8_t; +#define NFAPI_HARQ_INDICATION_TDD_REL8_TAG 0x2027 + +typedef struct { + nfapi_tl_t tl; + uint8_t mode; + uint8_t number_of_ack_nack; + union{ + nfapi_harq_indication_tdd_harq_data_t bundling; + nfapi_harq_indication_tdd_harq_data_t multiplex; + nfapi_harq_indication_tdd_harq_data_special_bundling_t special_bundling; + nfapi_harq_indication_tdd_harq_data_t channel_selection; + nfapi_harq_indication_tdd_harq_data_t format_3; + } harq_data[NFAPI_MAX_NUMBER_ACK_NACK_TDD]; +} nfapi_harq_indication_tdd_rel9_t; +#define NFAPI_HARQ_INDICATION_TDD_REL9_TAG 0x2028 + +typedef struct { + nfapi_tl_t tl; + uint8_t mode; + uint16_t number_of_ack_nack; + union{ + nfapi_harq_indication_tdd_harq_data_t bundling; + nfapi_harq_indication_tdd_harq_data_t multiplex; + nfapi_harq_indication_tdd_harq_data_special_bundling_t special_bundling; + nfapi_harq_indication_tdd_harq_data_t channel_selection; + nfapi_harq_indication_tdd_harq_data_t format_3; + nfapi_harq_indication_tdd_harq_data_t format_4; + nfapi_harq_indication_tdd_harq_data_t format_5; + } harq_data[NFAPI_MAX_NUMBER_ACK_NACK_TDD]; +} nfapi_harq_indication_tdd_rel13_t; +#define NFAPI_HARQ_INDICATION_TDD_REL13_TAG 0x204F + +typedef struct { + nfapi_tl_t tl; + uint8_t harq_tb1; + uint8_t harq_tb2; +} nfapi_harq_indication_fdd_rel8_t; +#define NFAPI_HARQ_INDICATION_FDD_REL8_TAG 0x2029 + +#define NFAPI_HARQ_ACK_NACK_REL9_MAX 10 +typedef struct { + nfapi_tl_t tl; + uint8_t mode; + uint8_t number_of_ack_nack; + uint8_t harq_tb_n[NFAPI_HARQ_ACK_NACK_REL9_MAX]; +} nfapi_harq_indication_fdd_rel9_t; +#define NFAPI_HARQ_INDICATION_FDD_REL9_TAG 0x202a + +#define NFAPI_HARQ_ACK_NACK_REL13_MAX 22 // Need to check this max? +typedef struct { + nfapi_tl_t tl; + uint8_t mode; + uint16_t number_of_ack_nack; + uint8_t harq_tb_n[NFAPI_HARQ_ACK_NACK_REL13_MAX]; +} nfapi_harq_indication_fdd_rel13_t; +#define NFAPI_HARQ_INDICATION_FDD_REL13_TAG 0x2050 + +typedef struct { + nfapi_tl_t tl; + uint8_t ul_cqi; + uint8_t channel; +} nfapi_ul_cqi_information_t; +#define NFAPI_UL_CQI_INFORMATION_TAG 0x2052 + +// Only expect 1 harq_indication TLV.tag to be set +// Would this be a better a an union, but not clear which combinations +// are valid +typedef struct { + uint16_t instance_length; + nfapi_rx_ue_information rx_ue_information; + nfapi_harq_indication_tdd_rel8_t harq_indication_tdd_rel8; + nfapi_harq_indication_tdd_rel9_t harq_indication_tdd_rel9; + nfapi_harq_indication_tdd_rel13_t harq_indication_tdd_rel13; + nfapi_harq_indication_fdd_rel8_t harq_indication_fdd_rel8; + nfapi_harq_indication_fdd_rel9_t harq_indication_fdd_rel9; + nfapi_harq_indication_fdd_rel13_t harq_indication_fdd_rel13; + nfapi_ul_cqi_information_t ul_cqi_information; +} nfapi_harq_indication_pdu_t; + +#define NFAPI_HARQ_IND_MAX_PDU 100 +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_harqs; + nfapi_harq_indication_pdu_t* harq_pdu_list; +} nfapi_harq_indication_body_t; +#define NFAPI_HARQ_INDICATION_BODY_TAG 0x2026 + +typedef struct { + nfapi_tl_t tl; + uint8_t crc_flag; +} nfapi_crc_indication_rel8_t; +#define NFAPI_CRC_INDICATION_REL8_TAG 0x202c + +typedef struct { + uint16_t instance_length; + nfapi_rx_ue_information rx_ue_information; + nfapi_crc_indication_rel8_t crc_indication_rel8; +} nfapi_crc_indication_pdu_t; + +#define NFAPI_CRC_IND_MAX_PDU 100 +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_crcs; + nfapi_crc_indication_pdu_t* crc_pdu_list; +} nfapi_crc_indication_body_t; +#define NFAPI_CRC_INDICATION_BODY_TAG 0x202b + +typedef struct { + uint16_t instance_length; + nfapi_rx_ue_information rx_ue_information; + nfapi_ul_cqi_information_t ul_cqi_information; +} nfapi_sr_indication_pdu_t; + +#define NFAPI_SR_IND_MAX_PDU 100 +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_srs; // Question : should this be srs + nfapi_sr_indication_pdu_t* sr_pdu_list; +} nfapi_sr_indication_body_t; +#define NFAPI_SR_INDICATION_BODY_TAG 0x202d + +// The data offset should be set to 0 or 1 before encoding +// If it is set to 1 the nfapi library will detemine the correct offset + +typedef struct { + nfapi_tl_t tl; + uint16_t length; + uint16_t data_offset; + uint8_t ul_cqi; + uint8_t ri; + uint16_t timing_advance; +} nfapi_cqi_indication_rel8_t; +#define NFAPI_CQI_INDICATION_REL8_TAG 0x202f + +#define NFAPI_CC_MAX 4 +typedef struct { + nfapi_tl_t tl; + uint16_t length; + uint16_t data_offset; + uint8_t ul_cqi; + uint8_t number_of_cc_reported; + uint8_t ri[NFAPI_CC_MAX]; + uint16_t timing_advance; + uint16_t timing_advance_r9; +} nfapi_cqi_indication_rel9_t; +#define NFAPI_CQI_INDICATION_REL9_TAG 0x2030 + +typedef struct { + uint16_t instance_length; + nfapi_rx_ue_information rx_ue_information; + nfapi_cqi_indication_rel8_t cqi_indication_rel8; + nfapi_cqi_indication_rel9_t cqi_indication_rel9; + nfapi_ul_cqi_information_t ul_cqi_information; +} nfapi_cqi_indication_pdu_t; + +#define NFAPI_CQI_RAW_MAX_LEN 12 +typedef struct { + uint8_t pdu[NFAPI_CQI_RAW_MAX_LEN]; +} nfapi_cqi_indication_raw_pdu_t; + +#define NFAPI_CQI_IND_MAX_PDU 100 +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_cqis; + nfapi_cqi_indication_pdu_t* cqi_pdu_list; + nfapi_cqi_indication_raw_pdu_t* cqi_raw_pdu_list; +} nfapi_cqi_indication_body_t; +#define NFAPI_CQI_INDICATION_BODY_TAG 0x202e + +typedef struct { + nfapi_tl_t tl; + uint16_t rnti; + uint8_t preamble; + uint16_t timing_advance; +} nfapi_preamble_pdu_rel8_t; +#define NFAPI_PREAMBLE_REL8_TAG 0x2032 + +typedef struct { + nfapi_tl_t tl; + uint16_t timing_advance_r9; +} nfapi_preamble_pdu_rel9_t; +#define NFAPI_PREAMBLE_REL9_TAG 0x2033 + +typedef struct { + nfapi_tl_t tl; + uint8_t rach_resource_type; +} nfapi_preamble_pdu_rel13_t; +#define NFAPI_PREAMBLE_REL13_TAG 0x2051 + +typedef struct { + uint16_t instance_length; + nfapi_preamble_pdu_rel8_t preamble_rel8; + nfapi_preamble_pdu_rel9_t preamble_rel9; + nfapi_preamble_pdu_rel13_t preamble_rel13; +} nfapi_preamble_pdu_t; + +#define NFAPI_PREAMBLE_MAX_PDU 100 +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_preambles; + nfapi_preamble_pdu_t* preamble_list; +} nfapi_rach_indication_body_t; +#define NFAPI_RACH_INDICATION_BODY_TAG 0x2031 + +#define NFAPI_NUM_RB_MAX 1000 +typedef struct { + nfapi_tl_t tl; + uint16_t doppler_estimation; + uint16_t timing_advance; + uint8_t number_of_resource_blocks; + uint8_t rb_start; + uint8_t snr[NFAPI_NUM_RB_MAX]; +} nfapi_srs_indication_fdd_rel8_t; +#define NFAPI_SRS_INDICATION_FDD_REL8_TAG 0x2035 + +typedef struct { + nfapi_tl_t tl; + uint16_t timing_advance_r9; +} nfapi_srs_indication_fdd_rel9_t; +#define NFAPI_SRS_INDICATION_FDD_REL9_TAG 0x2036 + +typedef struct { + nfapi_tl_t tl; + uint8_t uppts_symbol; +} nfapi_srs_indication_ttd_rel10_t; +#define NFAPI_SRS_INDICATION_TDD_REL10_TAG 0x2037 + +typedef struct { + nfapi_tl_t tl; + uint16_t ul_rtoa; +} nfapi_srs_indication_fdd_rel11_t; +#define NFAPI_SRS_INDICATION_FDD_REL11_TAG 0x2053 + + +typedef struct { + nfapi_tl_t tl; + uint8_t num_prb_per_subband; + uint8_t number_of_subbands; + uint8_t num_atennas; + struct { + uint8_t subband_index; + uint16_t channel[NFAPI_MAX_NUM_PHYSICAL_ANTENNAS]; + } subands[NFAPI_MAX_NUM_SUBBANDS]; +} nfapi_tdd_channel_measurement_t; +#define NFAPI_TDD_CHANNEL_MEASUREMENT_TAG 0x2054 + +typedef struct { + uint16_t instance_length; + nfapi_rx_ue_information rx_ue_information; + nfapi_srs_indication_fdd_rel8_t srs_indication_fdd_rel8; + nfapi_srs_indication_fdd_rel9_t srs_indication_fdd_rel9; + nfapi_srs_indication_ttd_rel10_t srs_indication_tdd_rel10; + nfapi_srs_indication_fdd_rel11_t srs_indication_fdd_rel11; + nfapi_tdd_channel_measurement_t tdd_channel_measurement; +} nfapi_srs_indication_pdu_t; + +#define NFAPI_SRS_IND_MAX_PDU 16 +typedef struct { + nfapi_tl_t tl; + uint8_t number_of_ues; + nfapi_srs_indication_pdu_t* srs_pdu_list; +} nfapi_srs_indication_body_t; +#define NFAPI_SRS_INDICATION_BODY_TAG 0x2034 + +typedef struct { + nfapi_tl_t tl; + uint16_t length; + uint16_t offset; + uint8_t ul_cqi; + uint16_t timing_advance; +} nfapi_rx_indication_rel8_t; +#define NFAPI_RX_INDICATION_REL8_TAG 0x2024 + +typedef struct { + nfapi_tl_t tl; + uint16_t timing_advance_r9; + } nfapi_rx_indication_rel9_t; +#define NFAPI_RX_INDICATION_REL9_TAG 0x2025 + +typedef struct { + nfapi_rx_ue_information rx_ue_information; + nfapi_rx_indication_rel8_t rx_indication_rel8; + nfapi_rx_indication_rel9_t rx_indication_rel9; + uint8_t* data; +} nfapi_rx_indication_pdu_t; + +#define NFAPI_RX_IND_MAX_PDU 100 +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_pdus; + nfapi_rx_indication_pdu_t* rx_pdu_list; +} nfapi_rx_indication_body_t; +#define NFAPI_RX_INDICATION_BODY_TAG 0x2023 + +typedef struct { + nfapi_tl_t tl; + uint8_t harq_tb1; +} nfapi_nb_harq_indication_fdd_rel13_t; +#define NFAPI_NB_HARQ_INDICATION_FDD_REL13_TAG 0x2064 + +typedef struct { + uint16_t instance_length; + nfapi_rx_ue_information rx_ue_information; + nfapi_nb_harq_indication_fdd_rel13_t nb_harq_indication_fdd_rel13; + nfapi_ul_cqi_information_t ul_cqi_information; +} nfapi_nb_harq_indication_pdu_t; + +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_harqs; + nfapi_nb_harq_indication_pdu_t* nb_harq_pdu_list; +} nfapi_nb_harq_indication_body_t; +#define NFAPI_NB_HARQ_INDICATION_BODY_TAG 0x2063 + +typedef struct { + nfapi_tl_t tl; + uint16_t rnti; + uint8_t initial_sc; + uint16_t timing_advance; + uint8_t nrach_ce_level; +} nfapi_nrach_indication_pdu_rel13_t; +#define NFAPI_NRACH_INDICATION_REL13_TAG 0x2066 + +typedef struct { + nfapi_nrach_indication_pdu_rel13_t nrach_indication_rel13; +} nfapi_nrach_indication_pdu_t; + +typedef struct { + nfapi_tl_t tl; + uint8_t number_of_initial_scs_detected; + nfapi_nrach_indication_pdu_t* nrach_pdu_list; +} nfapi_nrach_indication_body_t; +#define NFAPI_NRACH_INDICATION_BODY_TAG 0x2065 + +typedef struct { + nfapi_tl_t tl; + uint32_t handle; + uint32_t mp_cca; + uint32_t n_cca; + uint32_t offset; + uint32_t lte_txop_sf; + uint16_t txop_sfn_sf_end; + uint32_t lbt_mode; +} nfapi_lbt_pdsch_req_pdu_rel13_t; +#define NFAPI_LBT_PDSCH_REQ_PDU_REL13_TAG 0x2056 + +typedef struct { + nfapi_lbt_pdsch_req_pdu_rel13_t lbt_pdsch_req_pdu_rel13; +} nfapi_lbt_pdsch_req_pdu; + +typedef struct { + nfapi_tl_t tl; + uint32_t handle; + uint32_t offset; + uint16_t sfn_sf_end; + uint32_t lbt_mode; +} nfapi_lbt_drs_req_pdu_rel13_t; +#define NFAPI_LBT_DRS_REQ_PDU_REL13_TAG 0x2057 + +typedef struct { + nfapi_lbt_drs_req_pdu_rel13_t lbt_drs_req_pdu_rel13; +} nfapi_lbt_drs_req_pdu; + +typedef struct { + uint8_t pdu_type; + uint8_t pdu_size; + union { + nfapi_lbt_pdsch_req_pdu lbt_pdsch_req_pdu; + nfapi_lbt_drs_req_pdu lbt_drs_req_pdu; + }; +} nfapi_lbt_dl_config_request_pdu_t; + +#define NFAPI_LBT_DL_CONFIG_REQ_MAX_PDU 16 +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_pdus; + nfapi_lbt_dl_config_request_pdu_t* lbt_dl_config_req_pdu_list; +} nfapi_lbt_dl_config_request_body_t; +#define NFAPI_LBT_DL_CONFIG_REQUEST_BODY_TAG 0x2055 + + +typedef struct { + nfapi_tl_t tl; + uint32_t handle; + uint32_t result; + uint32_t lte_txop_symbols; + uint32_t initial_partial_sf; +} nfapi_lbt_pdsch_rsp_pdu_rel13_t; +#define NFAPI_LBT_PDSCH_RSP_PDU_REL13_TAG 0x2059 + +typedef struct { + nfapi_lbt_pdsch_rsp_pdu_rel13_t lbt_pdsch_rsp_pdu_rel13; +} nfapi_lbt_pdsch_rsp_pdu; + +typedef struct { + nfapi_tl_t tl; + uint32_t handle; + uint32_t result; +} nfapi_lbt_drs_rsp_pdu_rel13_t; +#define NFAPI_LBT_DRS_RSP_PDU_REL13_TAG 0x205A + +typedef struct { + nfapi_lbt_drs_rsp_pdu_rel13_t lbt_drs_rsp_pdu_rel13; +} nfapi_lbt_drs_rsp_pdu; + + +typedef struct { + uint8_t pdu_type; + uint8_t pdu_size; + union { + nfapi_lbt_pdsch_rsp_pdu lbt_pdsch_rsp_pdu; + nfapi_lbt_drs_rsp_pdu lbt_drs_rsp_pdu; + }; +} nfapi_lbt_dl_indication_pdu_t; + +#define NFAPI_LBT_IND_MAX_PDU 16 +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_pdus; + nfapi_lbt_dl_indication_pdu_t* lbt_indication_pdu_list; +} nfapi_lbt_dl_indication_body_t; +#define NFAPI_LBT_DL_INDICATION_BODY_TAG 0x2058 + +typedef struct { +} nfapi_error_indication_msg_invalid_state; + +typedef struct { +} nfapi_error_indication_msg_bch_missing; + +typedef struct { + uint16_t recieved_sfn_sf; + uint16_t expected_sfn_sf; +} nfapi_error_indication_sfn_out_of_sync; + +typedef struct { + uint8_t sub_error_code; + uint8_t direction; + uint16_t rnti; + uint8_t pdu_type; +} nfapi_error_indication_msg_pdu_err; + +typedef struct { + uint16_t recieved_sfn_sf; + uint16_t expected_sfn_sf; +} nfapi_error_indication_msg_invalid_sfn; + +typedef struct { + uint8_t sub_error_code; + uint8_t phich_lowest_ul_rb_index; +} nfapi_error_indication_msg_hi_err; + +typedef struct { + uint8_t sub_error_code; + uint16_t pdu_index; +} nfapi_error_indication_msg_tx_err; + +// +// P4 Message Structures +// + +typedef struct { + nfapi_tl_t tl; + uint8_t frequency_band_indicator; + uint16_t measurement_period; + uint8_t bandwidth; + uint32_t timeout; + uint8_t number_of_earfcns; + uint16_t earfcn[NFAPI_MAX_CARRIER_LIST]; +} nfapi_lte_rssi_request_t; + +#define NFAPI_LTE_RSSI_REQUEST_TAG 0x3000 + +#define NFAPI_P4_START_TAG NFAPI_LTE_RSSI_REQUEST_TAG + +typedef struct { + nfapi_tl_t tl; + uint8_t frequency_band_indicator; + uint16_t measurement_period; + uint32_t timeout; + uint8_t number_of_uarfcns; + uint16_t uarfcn[NFAPI_MAX_CARRIER_LIST]; +} nfapi_utran_rssi_request_t; + +#define NFAPI_UTRAN_RSSI_REQUEST_TAG 0x3001 + +typedef struct { + uint16_t arfcn; + uint8_t direction; +} nfapi_arfcn_t; + +typedef struct { + nfapi_tl_t tl; + uint8_t frequency_band_indicator; + uint16_t measurement_period; + uint32_t timeout; + uint8_t number_of_arfcns; + nfapi_arfcn_t arfcn[NFAPI_MAX_CARRIER_LIST]; +} nfapi_geran_rssi_request_t; + +#define NFAPI_GERAN_RSSI_REQUEST_TAG 0x3002 + + + +typedef struct { + uint16_t earfcn; + uint8_t number_of_ro_dl; + uint8_t ro_dl[NFAPI_MAX_RO_DL]; +} nfapi_earfcn_t; + +typedef struct { + nfapi_tl_t tl; + uint8_t frequency_band_indicator; + uint16_t measurement_period; + uint32_t timeout; + uint8_t number_of_earfcns; + nfapi_earfcn_t earfcn[NFAPI_MAX_CARRIER_LIST]; +} nfapi_nb_iot_rssi_request_t; + +#define NFAPI_NB_IOT_RSSI_REQUEST_TAG 0x3020 + +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_rssi; + int16_t rssi[NFAPI_MAX_RSSI]; +} nfapi_rssi_indication_body_t; + +#define NFAPI_RSSI_INDICATION_TAG 0x3003 + +typedef struct { + nfapi_tl_t tl; + uint16_t earfcn; + uint8_t measurement_bandwidth; + uint8_t exhaustive_search; + uint32_t timeout; + uint8_t number_of_pci; + uint16_t pci[NFAPI_MAX_PCI_LIST]; +} nfapi_lte_cell_search_request_t; + +#define NFAPI_LTE_CELL_SEARCH_REQUEST_TAG 0x3004 + +typedef struct { + nfapi_tl_t tl; + uint16_t uarfcn; + uint8_t exhaustive_search; + uint32_t timeout; + uint8_t number_of_psc; + uint16_t psc[NFAPI_MAX_PSC_LIST]; +} nfapi_utran_cell_search_request_t; + +#define NFAPI_UTRAN_CELL_SEARCH_REQUEST_TAG 0x3005 + +typedef struct { + nfapi_tl_t tl; + uint32_t timeout; + uint8_t number_of_arfcn; + uint16_t arfcn[NFAPI_MAX_ARFCN_LIST]; +} nfapi_geran_cell_search_request_t; + +#define NFAPI_GERAN_CELL_SEARCH_REQUEST_TAG 0x3006 + +typedef struct { + nfapi_tl_t tl; + uint16_t earfcn; + uint8_t ro_dl; + uint8_t exhaustive_search; + uint32_t timeout; + uint8_t number_of_pci; + uint16_t pci[NFAPI_MAX_PCI_LIST]; +} nfapi_nb_iot_cell_search_request_t; + +#define NFAPI_NB_IOT_CELL_SEARCH_REQUEST_TAG 0x3021 + +typedef struct { + uint16_t pci; + uint8_t rsrp; + uint8_t rsrq; + int16_t frequency_offset; +} nfapi_lte_found_cell_t; + +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_lte_cells_found; + nfapi_lte_found_cell_t lte_found_cells[NFAPI_MAX_LTE_CELLS_FOUND]; +} nfapi_lte_cell_search_indication_t; + +#define NFAPI_LTE_CELL_SEARCH_INDICATION_TAG 0x3007 + +typedef struct { + uint16_t psc; + uint8_t rscp; + uint8_t ecno; + int16_t frequency_offset; +} nfapi_utran_found_cell_t; + +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_utran_cells_found; + nfapi_utran_found_cell_t utran_found_cells[NFAPI_MAX_UTRAN_CELLS_FOUND]; +} nfapi_utran_cell_search_indication_t; + +#define NFAPI_UTRAN_CELL_SEARCH_INDICATION_TAG 0x3008 + +typedef struct { + uint16_t arfcn; + uint8_t bsic; + uint8_t rxlev; + uint8_t rxqual; + int16_t frequency_offset; + uint32_t sfn_offset; +} nfapi_gsm_found_cell_t; + +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_gsm_cells_found; + nfapi_gsm_found_cell_t gsm_found_cells[NFAPI_MAX_GSM_CELLS_FOUND]; +} nfapi_geran_cell_search_indication_t; + +#define NFAPI_GERAN_CELL_SEARCH_INDICATION_TAG 0x3009 + +typedef struct { + uint16_t pci; + uint8_t rsrp; + uint8_t rsrq; + int16_t frequency_offset; +} nfapi_nb_iot_found_cell_t; + +typedef struct { + nfapi_tl_t tl; + uint16_t number_of_nb_iot_cells_found; + nfapi_nb_iot_found_cell_t nb_iot_found_cells[NFAPI_MAX_NB_IOT_CELLS_FOUND]; +} nfapi_nb_iot_cell_search_indication_t; + +#define NFAPI_NB_IOT_CELL_SEARCH_INDICATION_TAG 0x3022 + +typedef nfapi_opaqaue_data_t nfapi_pnf_cell_search_state_t; + +#define NFAPI_PNF_CELL_SEARCH_STATE_TAG 0x300A + +typedef struct { + nfapi_tl_t tl; + uint16_t earfcn; + uint16_t pci; + uint32_t timeout; +} nfapi_lte_broadcast_detect_request_t; + +#define NFAPI_LTE_BROADCAST_DETECT_REQUEST_TAG 0x300B + +typedef struct { + nfapi_tl_t tl; + uint16_t uarfcn; + uint16_t psc; + uint32_t timeout; +} nfapi_utran_broadcast_detect_request_t; + +#define NFAPI_UTRAN_BROADCAST_DETECT_REQUEST_TAG 0x300C + +typedef struct { + nfapi_tl_t tl; + uint16_t earfcn; + uint8_t ro_dl; + uint16_t pci; + uint32_t timeout; +} nfapi_nb_iot_broadcast_detect_request_t; + +#define NFAPI_NB_IOT_BROADCAST_DETECT_REQUEST_TAG 0x3023 + +typedef struct { + nfapi_tl_t tl; + uint8_t number_of_tx_antenna; + uint16_t mib_length; + uint8_t mib[NFAPI_MAX_MIB_LENGTH]; + uint32_t sfn_offset; +} nfapi_lte_broadcast_detect_indication_t; + +#define NFAPI_LTE_BROADCAST_DETECT_INDICATION_TAG 0x300E + +typedef struct { + nfapi_tl_t tl; + uint16_t mib_length; + uint8_t mib[NFAPI_MAX_MIB_LENGTH]; + uint32_t sfn_offset; +} nfapi_utran_broadcast_detect_indication_t; + +#define NFAPI_UTRAN_BROADCAST_DETECT_INDICATION_TAG 0x300F + + +typedef struct { + nfapi_tl_t tl; + uint8_t number_of_tx_antenna; + uint16_t mib_length; + uint8_t mib[NFAPI_MAX_MIB_LENGTH]; + uint32_t sfn_offset; +} nfapi_nb_iot_broadcast_detect_indication_t; + +#define NFAPI_NB_IOT_BROADCAST_DETECT_INDICATION_TAG 0x3024 + +#define NFAPI_PNF_CELL_BROADCAST_STATE_TAG 0x3010 + +typedef struct { + nfapi_tl_t tl; + uint16_t earfcn; + uint16_t pci; + uint16_t downlink_channel_bandwidth; + uint8_t phich_configuration; + uint8_t number_of_tx_antenna; + uint8_t retry_count; + uint32_t timeout; +} nfapi_lte_system_information_schedule_request_t; + +#define NFAPI_LTE_SYSTEM_INFORMATION_SCHEDULE_REQUEST_TAG 0x3011 + + +typedef struct { + nfapi_tl_t tl; + uint16_t earfcn; + uint8_t ro_dl; + uint16_t pci; + uint8_t scheduling_info_sib1_nb; + uint32_t timeout; +} nfapi_nb_iot_system_information_schedule_request_t; + +#define NFAPI_NB_IOT_SYSTEM_INFORMATION_SCHEDULE_REQUEST_TAG 0x3025 + +typedef nfapi_opaqaue_data_t nfapi_pnf_cell_broadcast_state_t; + +typedef struct { + uint8_t si_periodicity; + uint8_t si_index; +} nfapi_lte_system_information_si_periodicity_t; + +typedef struct { + nfapi_tl_t tl; + uint16_t earfcn; + uint16_t pci; + uint16_t downlink_channel_bandwidth; + uint8_t phich_configuration; + uint8_t number_of_tx_antenna; + uint8_t number_of_si_periodicity; + nfapi_lte_system_information_si_periodicity_t si_periodicity[NFAPI_MAX_SI_PERIODICITY]; + uint8_t si_window_length; + uint32_t timeout; +} nfapi_lte_system_information_request_t; + +#define NFAPI_LTE_SYSTEM_INFORMATION_REQUEST_TAG 0x3014 + +typedef struct { + nfapi_tl_t tl; + uint16_t uarfcn; + uint16_t psc; + uint32_t timeout; +} nfapi_utran_system_information_request_t; + +#define NFAPI_UTRAN_SYSTEM_INFORMATION_REQUEST_TAG 0x3015 + +typedef struct { + nfapi_tl_t tl; + uint16_t arfcn; + uint8_t bsic; + uint32_t timeout; +} nfapi_geran_system_information_request_t; + +#define NFAPI_GERAN_SYSTEM_INFORMATION_REQUEST_TAG 0x3016 + +typedef struct { + uint8_t si_periodicity; + uint8_t si_repetition_pattern; + uint8_t si_tb_size; + uint8_t number_of_si_index; + uint8_t si_index[NFAPI_MAX_SI_INDEX]; +} nfapi_nb_iot_system_information_si_periodicity_t; + +typedef struct { + nfapi_tl_t tl; + uint16_t earfcn; + uint8_t ro_dl; + uint16_t pci; + uint8_t number_of_si_periodicity; + nfapi_nb_iot_system_information_si_periodicity_t si_periodicity[NFAPI_MAX_SI_PERIODICITY]; + uint8_t si_window_length; + uint32_t timeout; +} nfapi_nb_iot_system_information_request_t; + +#define NFAPI_NB_IOT_SYSTEM_INFORMATION_REQUEST_TAG 0x3027 + +typedef struct { + nfapi_tl_t tl; + uint8_t sib_type; + uint16_t sib_length; + uint8_t sib[NFAPI_MAX_SIB_LENGTH]; +} nfapi_lte_system_information_indication_t; + +#define NFAPI_LTE_SYSTEM_INFORMATION_INDICATION_TAG 0x3018 + +typedef struct { + nfapi_tl_t tl; + uint16_t sib_length; + uint8_t sib[NFAPI_MAX_SIB_LENGTH]; +} nfapi_utran_system_information_indication_t; + +#define NFAPI_UTRAN_SYSTEM_INFORMATION_INDICATION_TAG 0x3019 + +typedef struct { + nfapi_tl_t tl; + uint16_t si_length; + uint8_t si[NFAPI_MAX_SI_LENGTH]; +} nfapi_geran_system_information_indication_t; + +#define NFAPI_GERAN_SYSTEM_INFORMATION_INDICATION_TAG 0x301a + +typedef struct { + nfapi_tl_t tl; + uint8_t sib_type; + uint16_t sib_length; + uint8_t sib[NFAPI_MAX_SIB_LENGTH]; +} nfapi_nb_iot_system_information_indication_t; + +#define NFAPI_NB_IOT_SYSTEM_INFORMATION_INDICATION_TAG 0x3026 + + +// +// Top level NFAP messages +// + +// +// P7 +// + +typedef struct { + nfapi_p7_message_header_t header; + uint16_t sfn_sf; + nfapi_dl_config_request_body_t dl_config_request_body; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_dl_config_request_t; + +typedef struct { + nfapi_p7_message_header_t header; + uint16_t sfn_sf; + nfapi_ul_config_request_body_t ul_config_request_body; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_ul_config_request_t; + +typedef struct { + nfapi_p7_message_header_t header; + uint16_t sfn_sf; + nfapi_hi_dci0_request_body_t hi_dci0_request_body; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_hi_dci0_request_t; + +typedef struct { + nfapi_p7_message_header_t header; + uint16_t sfn_sf; + nfapi_tx_request_body_t tx_request_body; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_tx_request_t; + +typedef struct { + nfapi_p7_message_header_t header; + uint16_t sfn_sf; +} nfapi_subframe_indication_t; + +typedef struct { + nfapi_p7_message_header_t header; + uint16_t sfn_sf; + nfapi_harq_indication_body_t harq_indication_body; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_harq_indication_t; + +typedef struct { + nfapi_p7_message_header_t header; + uint16_t sfn_sf; + nfapi_crc_indication_body_t crc_indication_body; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_crc_indication_t; + +typedef struct { + nfapi_p7_message_header_t header; + uint16_t sfn_sf; + nfapi_sr_indication_body_t sr_indication_body; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_sr_indication_t; + +typedef struct { + nfapi_p7_message_header_t header; + uint16_t sfn_sf; + nfapi_cqi_indication_body_t cqi_indication_body; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_cqi_indication_t; + +typedef struct { + nfapi_p7_message_header_t header; + uint16_t sfn_sf; + nfapi_rach_indication_body_t rach_indication_body; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_rach_indication_t; + +typedef struct { + nfapi_p7_message_header_t header; + uint16_t sfn_sf; + nfapi_srs_indication_body_t srs_indication_body; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_srs_indication_t; + +typedef struct { + nfapi_p7_message_header_t header; + uint16_t sfn_sf; + nfapi_rx_indication_body_t rx_indication_body; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_rx_indication_t; + +typedef struct { + nfapi_p7_message_header_t header; + uint16_t sfn_sf; + nfapi_nb_harq_indication_body_t nb_harq_indication_body; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_nb_harq_indication_t; + +typedef struct { + nfapi_p7_message_header_t header; + uint16_t sfn_sf; + nfapi_nrach_indication_body_t nrach_indication_body; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_nrach_indication_t; + +typedef struct { + nfapi_p7_message_header_t header; + uint16_t sfn_sf; + nfapi_lbt_dl_config_request_body_t lbt_dl_config_request_body; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_lbt_dl_config_request_t; + +typedef struct { + nfapi_p7_message_header_t header; + uint16_t sfn_sf; + nfapi_lbt_dl_indication_body_t lbt_dl_indication_body; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_lbt_dl_indication_t; + + +typedef struct { + nfapi_p7_message_header_t header; + uint8_t message_id; + uint8_t error_code; + union { + nfapi_error_indication_msg_invalid_state msg_invalid_state; + nfapi_error_indication_msg_bch_missing msg_bch_missing; + nfapi_error_indication_sfn_out_of_sync sfn_out_of_sync; + nfapi_error_indication_msg_pdu_err msg_pdu_err; + nfapi_error_indication_msg_invalid_sfn msg_invalid_sfn; + nfapi_error_indication_msg_hi_err msg_hi_err; + nfapi_error_indication_msg_tx_err msg_tx_err; + }; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_error_indication_t; + +// +// P4 Messages +// + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint8_t rat_type; + union { + nfapi_lte_rssi_request_t lte_rssi_request; + nfapi_utran_rssi_request_t utran_rssi_request; + nfapi_geran_rssi_request_t geran_rssi_request; + nfapi_nb_iot_rssi_request_t nb_iot_rssi_request; + }; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_rssi_request_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint32_t error_code; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_rssi_response_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint32_t error_code; + nfapi_rssi_indication_body_t rssi_indication_body; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_rssi_indication_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint8_t rat_type; + union { + nfapi_lte_cell_search_request_t lte_cell_search_request; + nfapi_utran_cell_search_request_t utran_cell_search_request; + nfapi_geran_cell_search_request_t geran_cell_search_request; + nfapi_nb_iot_cell_search_request_t nb_iot_cell_search_request; + }; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_cell_search_request_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint32_t error_code; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_cell_search_response_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint32_t error_code; + nfapi_lte_cell_search_indication_t lte_cell_search_indication; + nfapi_utran_cell_search_indication_t utran_cell_search_indication; + nfapi_geran_cell_search_indication_t geran_cell_search_indication; + nfapi_pnf_cell_search_state_t pnf_cell_search_state; + nfapi_nb_iot_cell_search_indication_t nb_iot_cell_search_indication; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_cell_search_indication_t; + + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint8_t rat_type; + union { + nfapi_lte_broadcast_detect_request_t lte_broadcast_detect_request; + nfapi_utran_broadcast_detect_request_t utran_broadcast_detect_request; + nfapi_nb_iot_broadcast_detect_request_t nb_iot_broadcast_detect_request; + }; + nfapi_pnf_cell_search_state_t pnf_cell_search_state; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_broadcast_detect_request_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint32_t error_code; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_broadcast_detect_response_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint32_t error_code; + nfapi_lte_broadcast_detect_indication_t lte_broadcast_detect_indication; + nfapi_utran_broadcast_detect_indication_t utran_broadcast_detect_indication; + nfapi_nb_iot_broadcast_detect_indication_t nb_iot_broadcast_detect_indication; + nfapi_pnf_cell_broadcast_state_t pnf_cell_broadcast_state; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_broadcast_detect_indication_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint8_t rat_type; + union { + nfapi_lte_system_information_schedule_request_t lte_system_information_schedule_request; + nfapi_nb_iot_system_information_schedule_request_t nb_iot_system_information_schedule_request; + }; + nfapi_pnf_cell_broadcast_state_t pnf_cell_broadcast_state; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_system_information_schedule_request_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint32_t error_code; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_system_information_schedule_response_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint32_t error_code; + nfapi_lte_system_information_indication_t lte_system_information_indication; + nfapi_nb_iot_system_information_indication_t nb_iot_system_information_indication; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_system_information_schedule_indication_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint8_t rat_type; + union { + nfapi_lte_system_information_request_t lte_system_information_request; + nfapi_utran_system_information_request_t utran_system_information_request; + nfapi_geran_system_information_request_t geran_system_information_request; + nfapi_nb_iot_system_information_request_t nb_iot_system_information_request; + }; + nfapi_pnf_cell_broadcast_state_t pnf_cell_broadcast_state; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_system_information_request_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint32_t error_code; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_system_information_response_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint32_t error_code; + nfapi_lte_system_information_indication_t lte_system_information_indication; + nfapi_utran_system_information_indication_t utran_system_information_indication; + nfapi_geran_system_information_indication_t geran_system_information_indication; + nfapi_nb_iot_system_information_indication_t nb_iot_system_information_indication; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_system_information_indication_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_nmm_stop_request_t; + +typedef struct { + nfapi_p4_p5_message_header_t header; + uint32_t error_code; + nfapi_vendor_extension_tlv_t vendor_extension; +} nfapi_nmm_stop_response_t; + +// +// Configuration options for the encode decode functions +// + +/*! Configuration options for the p7 pack unpack functions + * + */ +typedef struct nfapi_p7_codec_config { + + /*! Optional call back to allow the user to define the memory allocator. + * \param size The size of the memory to allocate + * \return a pointer to a valid memory block or 0 if it has failed. + * + * If not set the nfapi unpack functions will use malloc + */ + void* (*allocate)(size_t size); + + /*! Optional call back to allow the user to define the memory deallocator. + * \param ptr A poiner to a memory block allocated by the allocate callback + * + * If not set the client should use free + */ + void (*deallocate)(void* ptr); + + /*! Optional call back function to handle unpacking vendor extension tlv. + * \param tl A pointer to a decoded tag length structure + * \param ppReadPackedMsg A handle to the read buffer. + * \param end The end of the read buffer + * \param ve A handle to a vendor extention structure that the call back should allocate if the structure can be decoded + * \param config A pointer to the p7 codec configuration + * \return return 0 if packed successfully, -1 if failed. + * + * If not set the tlv will be skipped + * + * Client should use the help methods in nfapi.h to decode the vendor extention. + * + * \todo Add code example + */ + int (*unpack_vendor_extension_tlv)(nfapi_tl_t* tl, uint8_t **ppReadPackedMsg, uint8_t *end, void** ve, struct nfapi_p7_codec_config* config); + + /*! Optional call back function to handle packing vendor extension tlv. + * \param ve A pointer to a vendor extention structure. + * \param ppWritePackedMsg A handle to the write buffer + * \param end The end of the write buffer. The callee should make sure not to write beyond the end + * \param config A pointer to the p7 codec configuration + * \return return 0 if packed successfully, -1 if failed. + * + * If not set the the tlv will be skipped + * + * Client should use the help methods in nfapi.h to encode the vendor extention + * + * \todo Add code example + */ + int (*pack_vendor_extension_tlv)(void* ve, uint8_t **ppWritePackedMsg, uint8_t *end, struct nfapi_p7_codec_config* config); + + /*! Optional call back function to handle unpacking vendor extension messages. + * \param header A pointer to a decode P7 message header for the vendor extention message + * \param ppReadPackedMsg A handle to the encoded data buffer + * \param end A pointer to the end of the encoded data buffer + * \param config A pointer to the p7 codec configuration + * \return 0 if unpacked successfully, -1 if failed + * + * If not set the message will be ignored + * + * If the message if is unknown the function should return -1 + */ + int (*unpack_p7_vendor_extension)(nfapi_p7_message_header_t* header, uint8_t **ppReadPackedMsg, uint8_t *end, struct nfapi_p7_codec_config* config); + + /*! Optional call back function to handle packing vendor extension messages. + * \param header A poiner to a P7 message structure for the venfor extention message + * \param ppWritePackedmsg A handle to the buffer to write the encoded message into + * \param end A pointer to the end of the buffer + * \param cofig A pointer to the p7 codec configuration + * \return 0 if packed successfully, -1 if failed + * + * If not set the the message will be ingored + * + * If the message if is unknown the function should return -1 + */ + int (*pack_p7_vendor_extension)(nfapi_p7_message_header_t* header, uint8_t **ppWritePackedmsg, uint8_t *end, struct nfapi_p7_codec_config* config); + + /*! Optional user data that will be passed back with callbacks + */ + void* user_data; + +} nfapi_p7_codec_config_t; + +/*! Configuration options for the p4 & p5 pack unpack functions + * + */ +typedef struct nfapi_p4_p5_codec_config { + + /*! Optional call back to allow the user to define the memory allocator. + * \param size The size of the memory to allocate + * \return a pointer to a valid memory block or 0 if it has failed. + * + * If not set the nfapi unpack functions will use malloc + */ + void* (*allocate)(size_t size); + + /*! Optional call back to allow the user to define the memory deallocator. + * \param ptr A poiner to a memory block allocated by the allocate callback + * + * If not set free will be used + */ + void (*deallocate)(void* ptr); + + /*! Optional call back function to handle unpacking vendor extension tlv. + * \param tl A pointer to a decoded tag length structure + * \param ppReadPackedMsg A handle to the data buffer to decode + * \param end A pointer to the end of the buffer + * \param ve A handle to a vendor extention structure that will be allocated by this callback + * \param config A pointer to the P4/P5 codec configuration + * \return 0 if unpacked successfully, -1 if failed + * + * If not set the tlv will be skipped + */ + int (*unpack_vendor_extension_tlv)(nfapi_tl_t* tl, uint8_t **ppReadPackedMsg, uint8_t *end, void** ve, struct nfapi_p4_p5_codec_config* config); + + /*! Optional call back function to handle packing vendor extension tlv. + * \param ve + * \param ppWritePackedMsg A handle to the data buffer pack the tlv into + * \param end A pointer to the end of the buffer + * \param config A pointer to the P4/P5 codec configuration + * \return 0 if packed successfully, -1 if failed + * + * If not set the the tlv will be skipped + */ + int (*pack_vendor_extension_tlv)(void* ve, uint8_t **ppWritePackedMsg, uint8_t *end, struct nfapi_p4_p5_codec_config* config); + + /*! Optional call back function to handle unpacking vendor extension messages. + * \param header A pointer to a decode P4/P5 message header + * \param ppReadPackgedMsg A handle to the data buffer to decode + * \param end A pointer to the end of the buffer + * \param config A pointer to the P4/P5 codec configuration + * \return 0 if packed successfully, -1 if failed + * + * If not set the message will be ignored + */ + int (*unpack_p4_p5_vendor_extension)(nfapi_p4_p5_message_header_t* header, uint8_t **ppReadPackedMsg, uint8_t *end, struct nfapi_p4_p5_codec_config* config); + + /*! Optional call back function to handle packing vendor extension messages. + * \param header A pointer to the P4/P5 message header to be encoded + * \param ppWritePackedMsg A handle to the data buffer pack the message into + * \param end A pointer to the end of the buffer + * \param config A pointer to the P4/P5 codec configuration + * \return 0 if packed successfully, -1 if failed + * + * If not set the the message will be ingored + */ + int (*pack_p4_p5_vendor_extension)(nfapi_p4_p5_message_header_t* header, uint8_t **ppwritepackedmsg, uint8_t *end, struct nfapi_p4_p5_codec_config* config); + + /*! Optional user data that will be passed back with callbacks + */ + void* user_data; + +} nfapi_p4_p5_codec_config_t; + +// +// Functions +// + +/*! \brief Encodes an NFAPI P4 message to a buffer + * \param pMessageBuf A pointer to a nfapi p4 message structure + * \param messageBufLen The size of the p4 message structure + * \param pPackedBuf A pointer to the buffer that the p4 message will be packed into + * \param packedBufLen The size of the buffer + * \param config A pointer to the nfapi configuration structure + * \return 0 means success, -1 means failure. + * + * The function will encode a nFAPI P4 message structure pointed to be pMessageBuf into a byte stream pointed to by pPackedBuf. + * + */ +int nfapi_p4_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t* config); + +/*! \brief Decodes a NFAPI P4 message header + * \param pMessageBuf A pointer to an encoded P4 message header + * \param messageBufLen The size of the encoded P4 message header + * \param pUnpackedBuf A pointer to the nfapi_message_header + * \param unpackedBufLen The size of nfapi_message_header structure. + * \param config A pointer to the nfapi configuration structure + * \return 0 means success, -1 means failure. + * + * The function will decode a byte stream pointed to by pMessageBuf into a nfapi_p4_p5_message_header structure pointer to by pUnpackedBuf + */ +int nfapi_p4_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t* config); + +/*! \brief Decodes a NFAPI P4 message + * \param pMessageBuf A pointer to an encoded P4 message + * \param messageBufLen The size of the encoded P4 message + * \param pUnpackedBuf A pointer to the nfapi_message_header + * \param unpackedBufLen The size of nfapi_message_header structure. + * \param config A pointer to the nfapi configuration structure + * \return 0 means success, -1 means failure. + * + * The function will decode a byte stream pointed to by pMessageBuf into a nfapi p4 message structure pointer to by pUnpackedBuf + */ +int nfapi_p4_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t* config); + +/*! \brief Encodes an NFAPI P5 message to a buffer + * \param pMessageBuf A pointer to a nfapi p5 message structure + * \param messageBufLen The size of the p5 message structure + * \param pPackedBuf A pointer to the buffer that the p5 message will be packed into + * \param packedBufLen The size of the buffer + * \param config A pointer to the nfapi configuration structure + * \return 0 means success, -1 means failure. + * + * The function will encode a nFAPI P5 message structure pointed to be pMessageBuf into a byte stream pointed to by pPackedBuf. + * + */ +int nfapi_p5_message_pack(void *pMessageBuf, uint32_t messageBufLen, void *pPackedBuf, uint32_t packedBufLen, nfapi_p4_p5_codec_config_t* config); + +/*! \brief Decodes an NFAPI P5 message header + * \param pMessageBuf A pointer to an encoded P5 message header + * \param messageBufLen The size of the encoded P5 message header + * \param pUnpackedBuf A pointer to the nfapi_message_header + * \param unpackedBufLen The size of nfapi_message_header structure. + * \param config A pointer to the nfapi configuration structure + * \return 0 means success, -1 means failure. + * + * The function will decode a byte stream pointed to by pMessageBuf into a nfapi_p4_p5_message_header structure pointer to by pUnpackedBuf + */ +int nfapi_p5_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t* config); + +/*! \brief Decodes a NFAPI P5 message + * \param pMessageBuf A pointer to an encoded P5 message + * \param messageBufLen The size of the encoded P5 message + * \param pUnpackedBuf A pointer to the nfapi_message_header + * \param unpackedBufLen The size of nfapi_message_header structure. + * \param config A pointer to the nfapi configuration structure + * \return 0 means success, -1 means failure. + * + * The function will decode a byte stream pointed to by pMessageBuf into a nfapi p5 message structure pointer to by pUnpackedBuf + */ +int nfapi_p5_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p4_p5_codec_config_t* config); + +/*! \brief Encodes an NFAPI P7 message to a buffer + * \param pMessageBuf A pointer to a nfapi p7 message structure + * \param pPackedBuf A pointer to the buffer that the p7 message will be packed into + * \param packedBufLen The size of the buffer + * \param config A pointer to the nfapi configuration structure + * \return 0 means success, -1 means failure. + * + * The function will encode a nFAPI P7 message structure pointed to be pMessageBuf into a byte stream pointed to by pPackedBuf. + * + */ +int nfapi_p7_message_pack(void *pMessageBuf, void *pPackedBuf, uint32_t packedBufLen, nfapi_p7_codec_config_t* config); + +/*! \brief Decodes an NFAPI P7 message header + * \param pMessageBuf A pointer to an encoded P7 message header + * \param messageBufLen The size of the encoded P7 message header + * \param pUnpackedBuf A pointer to the nfapi_message_header + * \param unpackedBufLen The size of nfapi_message_header structure. + * \param config A pointer to the nfapi configuration structure + * \return 0 means success, -1 means failure. + * + * The function will decode a byte stream pointed to by pMessageBuf into a nfapi_p7_message_header structure pointer to by pUnpackedBuf + + */ +int nfapi_p7_message_header_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config); + +/*! \brief Decodes a NFAPI P7 message + * \param pMessageBuf A pointer to an encoded P7 message + * \param messageBufLen The size of the encoded P7 message + * \param pUnpackedBuf A pointer to the nfapi_message_header + * \param unpackedBufLen The size of nfapi_message_header structure. + * \param config A pointer to the nfapi configuration structure + * \return 0 means success, -1 means failure. + * + * The function will decode a byte stream pointed to by pMessageBuf into a nfapi p7 message structure pointer to by pUnpackedBuf + */ +int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUnpackedBuf, uint32_t unpackedBufLen, nfapi_p7_codec_config_t* config); + +/*! \brief Calculates the checksum of a message + * + * \param buffer Pointer to the packed message + * \param len The length of the message + * \return The checksum. If there is an error the function with return -1 + */ +uint32_t nfapi_p7_calculate_checksum(uint8_t* buffer, uint32_t len); + +/*! \brief Calculates & updates the checksum in the message + * + * \param buffer Pointer to the packed message + * \param len The length of the message + * \return 0 means success, -1 means failure. + */ +int nfapi_p7_update_checksum(uint8_t* buffer, uint32_t len); + +/*! \brief Updates the transmition time stamp in the p7 message header + * + * \param buffer Pointer to the packed message + * \param timestamp The time stamp value + * \return 0 means success, -1 means failure. + */ +int nfapi_p7_update_transmit_timestamp(uint8_t* buffer, uint32_t timestamp); + +#endif /* _NFAPI_INTERFACE_H_ */ From 0a9819876327f37761372cbc0e76d2963736ae4a Mon Sep 17 00:00:00 2001 From: WEI-TAI CHEN Date: Thu, 26 Apr 2018 03:19:29 -0700 Subject: [PATCH 05/13] 1. Modify the wrong name file ans1c to asn1c 2.Update the do_MIB function 3.Update the gNB initial parameter for non-standalone --- cmake_targets/CMakeLists.txt | 2 +- openair2/COMMON/rrc_messages_types.h | 343 +- openair2/ENB_APP/NRRRC_paramsvalues.h | 93 + openair2/ENB_APP/gnb_app.c | 291 + openair2/ENB_APP/gnb_app.h | 38 + openair2/ENB_APP/gnb_config.c | 1958 ++++++ openair2/ENB_APP/gnb_config.h | 110 + openair2/ENB_APP/gnb_paramdef.h | 404 ++ openair2/RRC/NR/MESSAGES/asn1_msg.c | 436 +- openair2/RRC/NR/MESSAGES/asn1_msg.h | 274 + .../ASN1_files/NR-InterNodeDefinitions.asn | 282 + .../asn1c/ASN1_files/NR-RRC-Definitions.asn | 5480 +++++++++++++++++ .../asn1c/ASN1_files/NR-UE-Variables.asn | 46 + .../ASN1_files/extract_asn1_from_spce.pl | 82 + openair2/RRC/NR/defs_NR.h | 9 +- openair2/RRC/NR/rrc_gNB.c | 81 +- 16 files changed, 9565 insertions(+), 364 deletions(-) create mode 100644 openair2/ENB_APP/NRRRC_paramsvalues.h create mode 100644 openair2/ENB_APP/gnb_app.c create mode 100644 openair2/ENB_APP/gnb_app.h create mode 100644 openair2/ENB_APP/gnb_config.c create mode 100644 openair2/ENB_APP/gnb_config.h create mode 100644 openair2/ENB_APP/gnb_paramdef.h create mode 100644 openair2/RRC/NR/MESSAGES/asn1_msg.h create mode 100755 openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-InterNodeDefinitions.asn create mode 100755 openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-RRC-Definitions.asn create mode 100755 openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-UE-Variables.asn create mode 100755 openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/extract_asn1_from_spce.pl diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index d18a7a40bd..6450e7d7db 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -333,7 +333,7 @@ add_custom_command ( add_list2_option(NR_RRC_ASN1_VERSION "Rel15" "ASN.1 version of NR_RRC interface") if (${NR_RRC_ASN1_VERSION} STREQUAL "Rel15") - set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-RRC-Definitions.asn) + set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-RRC-Definitions.asn) endif (${NR_RRC_ASN1_VERSION} STREQUAL "Rel15") set (NR_RRC_FULL_DIR ${asn1_generated_dir}/${NR_RRC_ASN1_VERSION}) diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index efb63eb70b..86612d3b5b 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -64,6 +64,8 @@ typedef UL_DCCH_Message_t RrcUlDcchMessage; #define NBIOTRRC_CONFIGURATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nbiotrrc_configuration_req +#define NRRRC_CONFIGURATION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nrrrc_configuration_req + #define NAS_KENB_REFRESH_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_kenb_refresh_req #define NAS_CELL_SELECTION_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_cell_selection_req #define NAS_CONN_ESTABLI_REQ(mSGpTR) (mSGpTR)->ittiMsg.nas_conn_establi_req @@ -87,13 +89,13 @@ typedef struct RrcStateInd_s { // eNB: ENB_APP -> RRC messages typedef struct RrcConfigurationReq_s { - uint32_t cell_identity; + uint32_t cell_identity; - uint16_t tac; + uint16_t tac; - uint16_t mcc; - uint16_t mnc; - uint8_t mnc_digit_length; + uint16_t mcc; + uint16_t mnc; + uint8_t mnc_digit_length; paging_drx_t default_drx; @@ -171,159 +173,250 @@ typedef struct RrcConfigurationReq_s { } RrcConfigurationReq; #define MAX_NUM_NBIOT_CELEVELS 3 typedef struct NbIoTRrcConfigurationReq_s { - uint32_t cell_identity; + uint32_t cell_identity; - uint16_t tac; + uint16_t tac; - uint16_t mcc; - uint16_t mnc; - uint8_t mnc_digit_length; - lte_frame_type_t frame_type; + uint16_t mcc; + uint16_t mnc; + uint8_t mnc_digit_length; + lte_frame_type_t frame_type; uint8_t tdd_config; uint8_t tdd_config_s; lte_prefix_type_t prefix_type; - lte_prefix_type_t prefix_type_UL; + lte_prefix_type_t prefix_type_UL; int16_t eutra_band; uint32_t downlink_frequency; int32_t uplink_frequency_offset; int16_t Nid_cell;// for testing, change later int16_t N_RB_DL;// for testing, change later //RACH - long rach_raResponseWindowSize_NB; - long rach_macContentionResolutionTimer_NB; - long rach_powerRampingStep_NB; - long rach_preambleInitialReceivedTargetPower_NB; - long rach_preambleTransMax_CE_NB; + long rach_raResponseWindowSize_NB; + long rach_macContentionResolutionTimer_NB; + long rach_powerRampingStep_NB; + long rach_preambleInitialReceivedTargetPower_NB; + long rach_preambleTransMax_CE_NB; //BCCH - long bcch_modificationPeriodCoeff_NB; + long bcch_modificationPeriodCoeff_NB; //PCCH - long pcch_defaultPagingCycle_NB; - long pcch_nB_NB; - long pcch_npdcch_NumRepetitionPaging_NB; + long pcch_defaultPagingCycle_NB; + long pcch_nB_NB; + long pcch_npdcch_NumRepetitionPaging_NB; //NPRACH - long nprach_CP_Length; - long nprach_rsrp_range; - long nprach_Periodicity[MAX_NUM_NBIOT_CELEVELS]; - long nprach_StartTime[MAX_NUM_NBIOT_CELEVELS]; - long nprach_SubcarrierOffset[MAX_NUM_NBIOT_CELEVELS]; - long nprach_NumSubcarriers[MAX_NUM_NBIOT_CELEVELS]; - long numRepetitionsPerPreambleAttempt_NB[MAX_NUM_NBIOT_CELEVELS]; - long nprach_SubcarrierMSG3_RangeStart; - long maxNumPreambleAttemptCE_NB; - long npdcch_NumRepetitions_RA[MAX_NUM_NBIOT_CELEVELS]; - long npdcch_StartSF_CSS_RA[MAX_NUM_NBIOT_CELEVELS]; - long npdcch_Offset_RA[MAX_NUM_NBIOT_CELEVELS]; + long nprach_CP_Length; + long nprach_rsrp_range; + long nprach_Periodicity[MAX_NUM_NBIOT_CELEVELS]; + long nprach_StartTime[MAX_NUM_NBIOT_CELEVELS]; + long nprach_SubcarrierOffset[MAX_NUM_NBIOT_CELEVELS]; + long nprach_NumSubcarriers[MAX_NUM_NBIOT_CELEVELS]; + long numRepetitionsPerPreambleAttempt_NB[MAX_NUM_NBIOT_CELEVELS]; + long nprach_SubcarrierMSG3_RangeStart; + long maxNumPreambleAttemptCE_NB; + long npdcch_NumRepetitions_RA[MAX_NUM_NBIOT_CELEVELS]; + long npdcch_StartSF_CSS_RA[MAX_NUM_NBIOT_CELEVELS]; + long npdcch_Offset_RA[MAX_NUM_NBIOT_CELEVELS]; //NPDSCH - long npdsch_nrs_Power; + long npdsch_nrs_Power; //NPUSCH - long npusch_ack_nack_numRepetitions_NB; - long npusch_srs_SubframeConfig_NB; - long npusch_threeTone_CyclicShift_r13; - long npusch_sixTone_CyclicShift_r13; - BOOLEAN_t npusch_groupHoppingEnabled; - long npusch_groupAssignmentNPUSCH_r13; + long npusch_ack_nack_numRepetitions_NB; + long npusch_srs_SubframeConfig_NB; + long npusch_threeTone_CyclicShift_r13; + long npusch_sixTone_CyclicShift_r13; + BOOLEAN_t npusch_groupHoppingEnabled; + long npusch_groupAssignmentNPUSCH_r13; //DL_GapConfig - long dl_GapThreshold_NB; - long dl_GapPeriodicity_NB; - long dl_GapDurationCoeff_NB; + long dl_GapThreshold_NB; + long dl_GapPeriodicity_NB; + long dl_GapDurationCoeff_NB; //Uplink power control Common - long npusch_p0_NominalNPUSCH; - long npusch_alpha; - long deltaPreambleMsg3; + long npusch_p0_NominalNPUSCH; + long npusch_alpha; + long deltaPreambleMsg3; //UE timers and constants - long ue_TimersAndConstants_t300_NB; - long ue_TimersAndConstants_t301_NB; - long ue_TimersAndConstants_t310_NB; - long ue_TimersAndConstants_t311_NB; - long ue_TimersAndConstants_n310_NB; - long ue_TimersAndConstants_n311_NB; + long ue_TimersAndConstants_t300_NB; + long ue_TimersAndConstants_t301_NB; + long ue_TimersAndConstants_t310_NB; + long ue_TimersAndConstants_t311_NB; + long ue_TimersAndConstants_n310_NB; + long ue_TimersAndConstants_n311_NB; } NbIoTRrcConfigurationReq; -// eNB: ENB_APP -> RRC messages -typedef struct RrcConfigurationReq_s { - uint32_t cell_identity; - - uint16_t tac; - - uint16_t mcc; - uint16_t mnc; - uint8_t mnc_digit_length; - - /* - paging_drx_t default_drx; +// gNB: GNB_APP -> RRC messages +typedef struct NRRrcConfigurationReq_s { + uint32_t cell_identity; + uint16_t tac; + uint16_t mcc; + uint16_t mnc; + uint8_t mnc_digit_length; int16_t nb_cc; lte_frame_type_t frame_type[MAX_NUM_CCs]; uint8_t tdd_config[MAX_NUM_CCs]; uint8_t tdd_config_s[MAX_NUM_CCs]; lte_prefix_type_t prefix_type[MAX_NUM_CCs]; - uint8_t pbch_repetition[MAX_NUM_CCs]; int16_t eutra_band[MAX_NUM_CCs]; uint32_t downlink_frequency[MAX_NUM_CCs]; int32_t uplink_frequency_offset[MAX_NUM_CCs]; int16_t Nid_cell[MAX_NUM_CCs];// for testing, change later int16_t N_RB_DL[MAX_NUM_CCs];// for testing, change later int nb_antenna_ports[MAX_NUM_CCs]; - long prach_root[MAX_NUM_CCs]; - long prach_config_index[MAX_NUM_CCs]; - BOOLEAN_t prach_high_speed[MAX_NUM_CCs]; - long prach_zero_correlation[MAX_NUM_CCs]; - long prach_freq_offset[MAX_NUM_CCs]; - long pucch_delta_shift[MAX_NUM_CCs]; - long pucch_nRB_CQI[MAX_NUM_CCs]; - long pucch_nCS_AN[MAX_NUM_CCs]; -#if !defined(Rel10) && !defined(Rel14) - long pucch_n1_AN[MAX_NUM_CCs]; -#endif - long pdsch_referenceSignalPower[MAX_NUM_CCs]; - long pdsch_p_b[MAX_NUM_CCs]; - long pusch_n_SB[MAX_NUM_CCs]; - long pusch_hoppingMode[MAX_NUM_CCs]; - long pusch_hoppingOffset[MAX_NUM_CCs]; - BOOLEAN_t pusch_enable64QAM[MAX_NUM_CCs]; - BOOLEAN_t pusch_groupHoppingEnabled[MAX_NUM_CCs]; - long pusch_groupAssignment[MAX_NUM_CCs]; - BOOLEAN_t pusch_sequenceHoppingEnabled[MAX_NUM_CCs]; - long pusch_nDMRS1[MAX_NUM_CCs]; - long phich_duration[MAX_NUM_CCs]; - long phich_resource[MAX_NUM_CCs]; - BOOLEAN_t srs_enable[MAX_NUM_CCs]; - long srs_BandwidthConfig[MAX_NUM_CCs]; - long srs_SubframeConfig[MAX_NUM_CCs]; - BOOLEAN_t srs_ackNackST[MAX_NUM_CCs]; - BOOLEAN_t srs_MaxUpPts[MAX_NUM_CCs]; - long pusch_p0_Nominal[MAX_NUM_CCs]; - long pusch_alpha[MAX_NUM_CCs]; - long pucch_p0_Nominal[MAX_NUM_CCs]; - long msg3_delta_Preamble[MAX_NUM_CCs]; - long ul_CyclicPrefixLength[MAX_NUM_CCs]; - e_DeltaFList_PUCCH__deltaF_PUCCH_Format1 pucch_deltaF_Format1[MAX_NUM_CCs]; - e_DeltaFList_PUCCH__deltaF_PUCCH_Format1b pucch_deltaF_Format1b[MAX_NUM_CCs]; - e_DeltaFList_PUCCH__deltaF_PUCCH_Format2 pucch_deltaF_Format2[MAX_NUM_CCs]; - e_DeltaFList_PUCCH__deltaF_PUCCH_Format2a pucch_deltaF_Format2a[MAX_NUM_CCs]; - e_DeltaFList_PUCCH__deltaF_PUCCH_Format2b pucch_deltaF_Format2b[MAX_NUM_CCs]; - long rach_numberOfRA_Preambles[MAX_NUM_CCs]; - BOOLEAN_t rach_preamblesGroupAConfig[MAX_NUM_CCs]; - long rach_sizeOfRA_PreamblesGroupA[MAX_NUM_CCs]; - long rach_messageSizeGroupA[MAX_NUM_CCs]; - e_RACH_ConfigCommon__preambleInfo__preamblesGroupAConfig__messagePowerOffsetGroupB rach_messagePowerOffsetGroupB[MAX_NUM_CCs]; - long rach_powerRampingStep[MAX_NUM_CCs]; - long rach_preambleInitialReceivedTargetPower[MAX_NUM_CCs]; - long rach_preambleTransMax[MAX_NUM_CCs]; - long rach_raResponseWindowSize[MAX_NUM_CCs]; - long rach_macContentionResolutionTimer[MAX_NUM_CCs]; - long rach_maxHARQ_Msg3Tx[MAX_NUM_CCs]; - long bcch_modificationPeriodCoeff[MAX_NUM_CCs]; - long pcch_defaultPagingCycle[MAX_NUM_CCs]; - long pcch_nB[MAX_NUM_CCs]; - long ue_TimersAndConstants_t300[MAX_NUM_CCs]; - long ue_TimersAndConstants_t301[MAX_NUM_CCs]; - long ue_TimersAndConstants_t310[MAX_NUM_CCs]; - long ue_TimersAndConstants_t311[MAX_NUM_CCs]; - long ue_TimersAndConstants_n310[MAX_NUM_CCs]; - long ue_TimersAndConstants_n311[MAX_NUM_CCs]; - long ue_TransmissionMode[MAX_NUM_CCs]; - */ + + ///NR + //NR FrequencyInfoDL + long absoluteFrequencySSB[MAX_NUM_CCs]; + uint32_t ssb_SubcarrierOffset[MAX_NUM_CCs]; + long DL_FreqBandIndicatorNR[MAX_NUM_CCs]; + long DL_absoluteFrequencyPointA[MAX_NUM_CCs]; + + //NR DL SCS-SpecificCarrier + uint32_t DL_offsetToCarrier[MAX_NUM_CCs]; + long DL_SubcarrierSpacing[MAX_NUM_CCs]; + long DL_SCS_SpecificCarrier_k0[MAX_NUM_CCs]; + uint32_t DL_carrierBandwidth[MAX_NUM_CCs]; + + //NR BWP-DownlinkCommon + uint32_t DL_locationAndBandwidth[MAX_NUM_CCs]; + //NR_prefix_type_t DL_prefix_type[MAX_NUM_CCs]; + + //NR FrequencyInfoUL + long UL_FreqBandIndicatorNR[MAX_NUM_CCs]; + long UL_absoluteFrequencyPointA[MAX_NUM_CCs]; + long FrequencyInfoUL_p_Max[MAX_NUM_CCs]; + long frequencyShift7p5khz[MAX_NUM_CCs]; + + //NR UL SCS-SpecificCarrier + uint32_t UL_offsetToCarrier[MAX_NUM_CCs]; + long UL_SubcarrierSpacing[MAX_NUM_CCs]; + long UL_SCS_SpecificCarrier_k0[MAX_NUM_CCs]; + uint32_t UL_carrierBandwidth[MAX_NUM_CCs]; + + // NR BWP-UplinkCommon + uint32_t UL_locationAndBandwidth[MAX_NUM_CCs]; + //NR_prefix_type_t UL_prefix_type[MAX_NUM_CCs]; + + + long ssb_periodicityServingCell[MAX_NUM_CCs]; + long dmrs_TypeA_Position[MAX_NUM_CCs]; + long NIA_SubcarrierSpacing[MAX_NUM_CCs]; ///ServingCellConfigCommon Used only for non-initial access + long ss_PBCH_BlockPower[MAX_NUM_CCs]; + + + //NR TDD-UL-DL-ConfigCommon + long referenceSubcarrierSpacing[MAX_NUM_CCs]; + long dl_UL_TransmissionPeriodicity[MAX_NUM_CCs]; + long nrofDownlinkSlots[MAX_NUM_CCs]; + long nrofDownlinkSymbols[MAX_NUM_CCs]; + long nrofUplinkSlots[MAX_NUM_CCs]; + long nrofUplinkSymbols[MAX_NUM_CCs]; + + //NR RACH-ConfigCommon + long rach_totalNumberOfRA_Preambles[MAX_NUM_CCs]; + long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice[MAX_NUM_CCs]; + long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth[MAX_NUM_CCs]; + long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth[MAX_NUM_CCs]; + long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf[MAX_NUM_CCs]; + long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one[MAX_NUM_CCs]; + long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two[MAX_NUM_CCs]; + uint32_t rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_four[MAX_NUM_CCs]; + uint32_t rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_eight[MAX_NUM_CCs]; + uint32_t rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_sixteen[MAX_NUM_CCs]; + BOOLEAN_t rach_groupBconfigured[MAX_NUM_CCs]; + long rach_ra_Msg3SizeGroupA[MAX_NUM_CCs]; + long rach_messagePowerOffsetGroupB[MAX_NUM_CCs]; + long rach_numberOfRA_PreamblesGroupA[MAX_NUM_CCs]; + long rach_ra_ContentionResolutionTimer[MAX_NUM_CCs]; + long rsrp_ThresholdSSB[MAX_NUM_CCs]; + long rsrp_ThresholdSSB_SUL[MAX_NUM_CCs]; + long prach_RootSequenceIndex_choice[MAX_NUM_CCs]; + uint32_t prach_RootSequenceIndex_l839[MAX_NUM_CCs]; + uint32_t prach_RootSequenceIndex_l139[MAX_NUM_CCs]; + long prach_msg1_SubcarrierSpacing[MAX_NUM_CCs]; + long restrictedSetConfig[MAX_NUM_CCs]; + long msg3_transformPrecoding[MAX_NUM_CCs]; + //ssb-perRACH-OccasionAndCB-PreamblesPerSSB not sure + + //NR RACH-ConfigGeneric + uint32_t prach_ConfigurationIndex[MAX_NUM_CCs]; + long prach_msg1_FDM[MAX_NUM_CCs]; + long prach_msg1_FrequencyStart[MAX_NUM_CCs]; + uint32_t zeroCorrelationZoneConfig[MAX_NUM_CCs]; + long preambleReceivedTargetPower[MAX_NUM_CCs]; + long preambleTransMax[MAX_NUM_CCs]; + long powerRampingStep[MAX_NUM_CCs]; + long ra_ResponseWindow[MAX_NUM_CCs]; + + //NR PUSCH-ConfigCommon + BOOLEAN_t groupHoppingEnabledTransformPrecoding[MAX_NUM_CCs]; + long msg3_DeltaPreamble[MAX_NUM_CCs]; + long p0_NominalWithGrant[MAX_NUM_CCs]; + + ///NR PUSCH-TimeDomainResourceAllocation + uint32_t PUSCH_TimeDomainResourceAllocation_k2[MAX_NUM_CCs]; + long PUSCH_TimeDomainResourceAllocation_mappingType[MAX_NUM_CCs]; + + //NR PUCCH-ConfigCommon + long pucch_GroupHopping[MAX_NUM_CCs]; + long p0_nominal[MAX_NUM_CCs]; + + //NR PDSCH-ConfigCOmmon + //NR PDSCH-TimeDomainResourceAllocation + uint32_t PDSCH_TimeDomainResourceAllocation_k0[MAX_NUM_CCs]; + long PDSCH_TimeDomainResourceAllocation_mappingType[MAX_NUM_CCs]; + + + //NR RateMatchPattern is used to configure one rate matching pattern for PDSCH + long rateMatchPatternId[MAX_NUM_CCs]; + long RateMatchPattern_patternType[MAX_NUM_CCs]; + long symbolsInResourceBlock[MAX_NUM_CCs]; + long periodicityAndPattern[MAX_NUM_CCs]; + long RateMatchPattern_controlResourceSet[MAX_NUM_CCs]; ///ControlResourceSetId + long RateMatchPattern_subcarrierSpacing[MAX_NUM_CCs]; + long RateMatchPattern_mode[MAX_NUM_CCs]; + + //NR PDCCH-ConfigCommon + long searchSpaceSIB1[MAX_NUM_CCs]; + long searchSpaceOtherSystemInformation[MAX_NUM_CCs]; + long pagingSearchSpace[MAX_NUM_CCs]; + long ra_SearchSpace[MAX_NUM_CCs]; + long rach_ra_ControlResourceSet[MAX_NUM_CCs]; + //NR PDCCH-ConfigCommon commonControlResourcesSets + long PDCCH_common_controlResourceSetId[MAX_NUM_CCs]; + long PDCCH_common_ControlResourceSet_duration[MAX_NUM_CCs]; + long PDCCH_cce_REG_MappingType[MAX_NUM_CCs]; + long PDCCH_reg_BundleSize[MAX_NUM_CCs]; + long PDCCH_interleaverSize[MAX_NUM_CCs]; + long PDCCH_shiftIndex[MAX_NUM_CCs]; + long PDCCH_precoderGranularity[MAX_NUM_CCs]; //Corresponds to L1 parameter 'CORESET-precoder-granuality' + BOOLEAN_t tci_PresentInDCI[MAX_NUM_CCs]; + + //NR PDCCH-ConfigCommon commonSearchSpaces + long SearchSpaceId[MAX_NUM_CCs]; + long commonSearchSpaces_controlResourceSetId[MAX_NUM_CCs]; + long SearchSpace_monitoringSlotPeriodicityAndOffset_choice[MAX_NUM_CCs]; + long SearchSpace_monitoringSlotPeriodicityAndOffset_sl1[MAX_NUM_CCs]; + long SearchSpace_monitoringSlotPeriodicityAndOffset_sl2[MAX_NUM_CCs]; + long SearchSpace_monitoringSlotPeriodicityAndOffset_sl4[MAX_NUM_CCs]; + long SearchSpace_monitoringSlotPeriodicityAndOffset_sl5[MAX_NUM_CCs]; + long SearchSpace_monitoringSlotPeriodicityAndOffset_sl8[MAX_NUM_CCs]; + long SearchSpace_monitoringSlotPeriodicityAndOffset_sl10[MAX_NUM_CCs]; + long SearchSpace_monitoringSlotPeriodicityAndOffset_sl16[MAX_NUM_CCs]; + long SearchSpace_monitoringSlotPeriodicityAndOffset_sl20[MAX_NUM_CCs]; + long SearchSpace_nrofCandidates_aggregationLevel1[MAX_NUM_CCs]; + long SearchSpace_nrofCandidates_aggregationLevel2[MAX_NUM_CCs]; + long SearchSpace_nrofCandidates_aggregationLevel4[MAX_NUM_CCs]; + long SearchSpace_nrofCandidates_aggregationLevel8[MAX_NUM_CCs]; + long SearchSpace_nrofCandidates_aggregationLevel16[MAX_NUM_CCs]; + long SearchSpace_searchSpaceType[MAX_NUM_CCs]; + long Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel1[MAX_NUM_CCs]; + long Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel2[MAX_NUM_CCs]; + long Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel4[MAX_NUM_CCs]; + long Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel8[MAX_NUM_CCs]; + long Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel16[MAX_NUM_CCs]; + long Common_dci_Format2_3_monitoringPeriodicity[MAX_NUM_CCs]; + long Common_dci_Format2_3_nrofPDCCH_Candidates[MAX_NUM_CCs]; + long ue_Specific__dci_Formats[MAX_NUM_CCs]; + + } gNB_RrcConfigurationReq; diff --git a/openair2/ENB_APP/NRRRC_paramsvalues.h b/openair2/ENB_APP/NRRRC_paramsvalues.h new file mode 100644 index 0000000000..2dfe59a726 --- /dev/null +++ b/openair2/ENB_APP/NRRRC_paramsvalues.h @@ -0,0 +1,93 @@ +/* + * 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 + */ + +/*! \file openair2/GNB_APP/RRC_paramsvalues.h + * \brief macro definitions for RRC authorized and asn1 parameters values, to be used in paramdef_t/chechedparam_t structure initializations + * \author Francois TABURET + * \date 2017 + * \version 0.1 + * \company NOKIA BellLabs France + * \email: francois.taburet@nokia-bell-labs.com + * \note + * \warning + */ +#ifndef __NRRRC_PARAMSVALUES__H__ +#define __NRRRC_PARAMSVALUES__H__ +/* cell configuration section name */ +#define GNB_CONFIG_STRING_GNB_LIST "gNBs" +/* component carriers configuration section name */ +#define GNB_CONFIG_STRING_COMPONENT_CARRIERS "component_carriers" + +#define GNB_CONFIG_STRING_FRAME_TYPE "frame_type" +#define GNB_CONFIG_STRING_TDD_CONFIG "tdd_config" +#define GNB_CONFIG_STRING_TDD_CONFIG_S "tdd_config_s" +#define GNB_CONFIG_STRING_PREFIX_TYPE "prefix_type" +#define GNB_CONFIG_STRING_PREFIX_TYPE_UL "prefix_type_UL" +#define GNB_CONFIG_STRING_EUTRA_BAND "eutra_band" +#define GNB_CONFIG_STRING_DOWNLINK_FREQUENCY "downlink_frequency" +#define GNB_CONFIG_STRING_UPLINK_FREQUENCY_OFFSET "uplink_frequency_offset" +#define GNB_CONFIG_STRING_NID_CELL "Nid_cell" +#define GNB_CONFIG_STRING_N_RB_DL "N_RB_DL" +#define GNB_CONFIG_STRING_CELL_MBSFN "Nid_cell_mbsfn" + + +#define FRAMETYPE_OKVALUES {"FDD","TDD"} +#define FRAMETYPE_MODVALUES { FDD, TDD} + +#define TDDCFG(A) TDD_Config__subframeAssignment_ ## A +#define TDDCONFIG_OKRANGE { TDDCFG(sa0), TDDCFG(sa6)} + +#define TDDCFGS(A) TDD_Config__specialSubframePatterns_ ## A +#define TDDCONFIGS_OKRANGE { TDDCFGS(ssp0), TDDCFGS(ssp8)} + +#define PREFIX_OKVALUES {"NORMAL","EXTENDED"} +#define PREFIX_MODVALUES { NORMAL, EXTENDED} + +#define PREFIXUL_OKVALUES {"NORMAL","EXTENDED"} +#define PREFIXUL_MODVALUES { NORMAL, EXTENDED} + +#define NRBDL_OKVALUES {6,15,25,50,75,100} + +#define UETIMER_T300_OKVALUES {100,200,300,400,600,1000,1500,2000} +#define UETT300(A) UE_TimersAndConstants__t300_ ## A +#define UETIMER_T300_MODVALUES { UETT300(ms100), UETT300(ms200),UETT300(ms300),UETT300(ms400),UETT300(ms600),UETT300(ms1000),UETT300(ms1500),UETT300(ms2000)} + +#define UETIMER_T301_OKVALUES {100,200,300,400,600,1000,1500,2000} +#define UETT301(A) UE_TimersAndConstants__t301_ ## A +#define UETIMER_T301_MODVALUES { UETT301(ms100), UETT301(ms200),UETT301(ms300),UETT301(ms400),UETT301(ms600),UETT301(ms1000),UETT301(ms1500),UETT301(ms2000)} + +#define UETIMER_T310_OKVALUES {0,50,100,200,500,1000,2000} +#define UETT310(A) UE_TimersAndConstants__t310_ ## A +#define UETIMER_T310_MODVALUES { UETT310(ms0), UETT310(ms50),UETT310(ms100),UETT310(ms200),UETT310(ms500),UETT310(ms1000),UETT310(ms2000)} + +#define UETIMER_T311_OKVALUES {1000,3110,5000,10000,15000,20000,31100} +#define UETT311(A) UE_TimersAndConstants__t311_ ## A +#define UETIMER_T311_MODVALUES { UETT311(ms1000), UETT311(ms3000),UETT311(ms5000),UETT311(ms10000),UETT311(ms15000),UETT311(ms20000),UETT311(ms30000)} + +#define UETIMER_N310_OKVALUES {1,2,3,4,6,8,10,20} +#define UETN310(A) UE_TimersAndConstants__n310_ ## A +#define UETIMER_N310_MODVALUES { UETN310(n1), UETN310(n2),UETN310(n3),UETN310(n4),UETN310(n6),UETN310(n8),UETN310(n10),UETN310(n20)} + +#define UETIMER_N311_OKVALUES {1,2,3,4,5,6,8,10} +#define UETN311(A) UE_TimersAndConstants__n311_ ## A +#define UETIMER_N311_MODVALUES { UETN311(n1), UETN311(n2),UETN311(n3),UETN311(n4),UETN311(n5),UETN311(n6),UETN311(n8),UETN311(n10)} + +#endif diff --git a/openair2/ENB_APP/gnb_app.c b/openair2/ENB_APP/gnb_app.c new file mode 100644 index 0000000000..ccef5e4663 --- /dev/null +++ b/openair2/ENB_APP/gnb_app.c @@ -0,0 +1,291 @@ +/* + * 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 + */ + +/* + gnb_app.c + ------------------- + AUTHOR : Laurent Winckel, Sebastien ROUX, Lionel GAUTHIER, Navid Nikaein + COMPANY : EURECOM + EMAIL : Lionel.Gauthier@eurecom.fr and Navid Nikaein +*/ + +#include +#include + +#include "gnb_app.h" +#include "gnb_config.h" +#include "assertions.h" +#include "common/ran_context.h" + +#include "log.h" + +#if defined(ENABLE_ITTI) +# include "intertask_interface.h" +# include "timer.h" +# if defined(ENABLE_USE_MME) +# include "s1ap_eNB.h" +# include "sctp_eNB_task.h" +# include "gtpv1u_eNB_task.h" +# endif + +extern unsigned char NB_gNB_INST; +#endif + +extern RAN_CONTEXT_t RC; + +#if defined(ENABLE_ITTI) + +/*------------------------------------------------------------------------------*/ +# if defined(ENABLE_USE_MME) +# define ENB_REGISTER_RETRY_DELAY 10 +# endif + +/*------------------------------------------------------------------------------*/ + +/* +static void configure_phy(module_id_t enb_id, const Enb_properties_array_t* enb_properties) +{ + MessageDef *msg_p; + int CC_id; + + msg_p = itti_alloc_new_message (TASK_ENB_APP, PHY_CONFIGURATION_REQ); + + for (CC_id=0; CC_idproperties[enb_id]->frame_type[CC_id]; + PHY_CONFIGURATION_REQ (msg_p).prefix_type[CC_id] = enb_properties->properties[enb_id]->prefix_type[CC_id]; + PHY_CONFIGURATION_REQ (msg_p).downlink_frequency[CC_id] = enb_properties->properties[enb_id]->downlink_frequency[CC_id]; + PHY_CONFIGURATION_REQ (msg_p).uplink_frequency_offset[CC_id] = enb_properties->properties[enb_id]->uplink_frequency_offset[CC_id]; + PHY_CONFIGURATION_REQ (msg_p).nb_antennas_tx[CC_id] = enb_properties->properties[enb_id]->nb_antennas_tx[CC_id]; + PHY_CONFIGURATION_REQ (msg_p).nb_antennas_rx[CC_id] = enb_properties->properties[enb_id]->nb_antennas_rx[CC_id]; + PHY_CONFIGURATION_REQ (msg_p).tx_gain[CC_id] = enb_properties->properties[enb_id]->tx_gain[CC_id]; + PHY_CONFIGURATION_REQ (msg_p).rx_gain[CC_id] = enb_properties->properties[enb_id]->rx_gain[CC_id]; + } + + itti_send_msg_to_task (TASK_PHY_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); +} +*/ + +/*------------------------------------------------------------------------------*/ +static void configure_rrc(uint32_t enb_id) +{ + MessageDef *msg_p = NULL; + // int CC_id; + + msg_p = itti_alloc_new_message (TASK_ENB_APP, RRC_CONFIGURATION_REQ); + + if (RC.rrc[enb_id]) { + RCconfig_NRRRC(msg_p,enb_id, RC.rrc[enb_id]); + + + LOG_I(ENB_APP,"Sending configuration message to RRC task\n"); + itti_send_msg_to_task (TASK_RRC_GNB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); + + } + else AssertFatal(0,"RRC context for eNB %d not allocated\n",enb_id); +} + +/*------------------------------------------------------------------------------*/ +# if defined(ENABLE_USE_MME) +static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end)//, const Enb_properties_array_t *enb_properties) +{ + uint32_t enb_id; + MessageDef *msg_p; + uint32_t register_enb_pending = 0; + + for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { + { + s1ap_register_enb_req_t *s1ap_register_eNB; + + /* note: there is an implicit relationship between the data structure and the message name */ + msg_p = itti_alloc_new_message (TASK_ENB_APP, S1AP_REGISTER_ENB_REQ); + + RCconfig_S1(msg_p, enb_id); + + if (enb_id == 0) RCconfig_gtpu(); + + s1ap_register_eNB = &S1AP_REGISTER_ENB_REQ(msg_p); + LOG_I(ENB_APP,"default drx %d\n",s1ap_register_eNB->default_drx); + + LOG_I(ENB_APP,"[eNB %d] eNB_app_register for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id)); + + itti_send_msg_to_task (TASK_S1AP, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); + + register_enb_pending++; + } + } + + return register_enb_pending; +} +# endif +#endif + +/*------------------------------------------------------------------------------*/ +void *eNB_app_task(void *args_p) +{ +#if defined(ENABLE_ITTI) + uint32_t enb_nb = RC.nb_inst; + uint32_t enb_id_start = 0; + uint32_t enb_id_end = enb_id_start + enb_nb; +# if defined(ENABLE_USE_MME) + uint32_t register_enb_pending; + uint32_t registered_enb; + long enb_register_retry_timer_id; +# endif + uint32_t enb_id; + MessageDef *msg_p = NULL; + const char *msg_name = NULL; + instance_t instance; + int result; + /* for no gcc warnings */ + (void)instance; + + itti_mark_task_ready (TASK_ENB_APP); + + LOG_I(PHY, "%s() Task ready initialise structures\n", __FUNCTION__); + + RCconfig_L1(); + + RCconfig_macrlc(); + + LOG_I(PHY, "%s() RC.nb_L1_inst:%d\n", __FUNCTION__, RC.nb_L1_inst); + + if (RC.nb_L1_inst>0) AssertFatal(l1_north_init_eNB()==0,"could not initialize L1 north interface\n"); + + AssertFatal (enb_nb <= RC.nb_inst, + "Number of eNB is greater than eNB defined in configuration file (%d/%d)!", + enb_nb, RC.nb_inst); + + LOG_I(ENB_APP,"Allocating eNB_RRC_INST for %d instances\n",RC.nb_inst); + + RC.rrc = (eNB_RRC_INST **)malloc(RC.nb_inst*sizeof(eNB_RRC_INST *)); + LOG_I(PHY, "%s() RC.nb_inst:%d RC.rrc:%p\n", __FUNCTION__, RC.nb_inst, RC.rrc); + + for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { + RC.rrc[enb_id] = (eNB_RRC_INST*)malloc(sizeof(eNB_RRC_INST)); + LOG_I(PHY, "%s() Creating RRC instance RC.rrc[%d]:%p (%d of %d)\n", __FUNCTION__, enb_id, RC.rrc[enb_id], enb_id+1, enb_id_end); + memset((void *)RC.rrc[enb_id],0,sizeof(eNB_RRC_INST)); + configure_rrc(enb_id); + } + +# if defined(ENABLE_USE_MME) + /* Try to register each eNB */ + registered_enb = 0; + register_enb_pending = eNB_app_register (enb_id_start, enb_id_end);//, enb_properties_p); +# else + /* Start L2L1 task */ + msg_p = itti_alloc_new_message(TASK_ENB_APP, INITIALIZE_MESSAGE); + itti_send_msg_to_task(TASK_L2L1, INSTANCE_DEFAULT, msg_p); +# endif + + do { + // Wait for a message + itti_receive_msg (TASK_ENB_APP, &msg_p); + + msg_name = ITTI_MSG_NAME (msg_p); + instance = ITTI_MSG_INSTANCE (msg_p); + + switch (ITTI_MSG_ID(msg_p)) { + case TERMINATE_MESSAGE: + LOG_W(ENB_APP, " *** Exiting ENB_APP thread\n"); + itti_exit_task (); + break; + + case MESSAGE_TEST: + LOG_I(ENB_APP, "Received %s\n", ITTI_MSG_NAME(msg_p)); + break; + +# if defined(ENABLE_USE_MME) + + case S1AP_REGISTER_ENB_CNF: + LOG_I(ENB_APP, "[eNB %d] Received %s: associated MME %d\n", instance, msg_name, + S1AP_REGISTER_ENB_CNF(msg_p).nb_mme); + + DevAssert(register_enb_pending > 0); + register_enb_pending--; + + /* Check if at least eNB is registered with one MME */ + if (S1AP_REGISTER_ENB_CNF(msg_p).nb_mme > 0) { + registered_enb++; + } + + /* Check if all register eNB requests have been processed */ + if (register_enb_pending == 0) { + if (registered_enb == enb_nb) { + /* If all eNB are registered, start L2L1 task */ + MessageDef *msg_init_p; + + msg_init_p = itti_alloc_new_message (TASK_ENB_APP, INITIALIZE_MESSAGE); + itti_send_msg_to_task (TASK_L2L1, INSTANCE_DEFAULT, msg_init_p); + + } else { + uint32_t not_associated = enb_nb - registered_enb; + + LOG_W(ENB_APP, " %d eNB %s not associated with a MME, retrying registration in %d seconds ...\n", + not_associated, not_associated > 1 ? "are" : "is", ENB_REGISTER_RETRY_DELAY); + + /* Restart the eNB registration process in ENB_REGISTER_RETRY_DELAY seconds */ + if (timer_setup (ENB_REGISTER_RETRY_DELAY, 0, TASK_ENB_APP, INSTANCE_DEFAULT, TIMER_ONE_SHOT, + NULL, &enb_register_retry_timer_id) < 0) { + LOG_E(ENB_APP, " Can not start eNB register retry timer, use \"sleep\" instead!\n"); + + sleep(ENB_REGISTER_RETRY_DELAY); + /* Restart the registration process */ + registered_enb = 0; + register_enb_pending = eNB_app_register (enb_id_start, enb_id_end);//, enb_properties_p); + } + } + } + + break; + + case S1AP_DEREGISTERED_ENB_IND: + LOG_W(ENB_APP, "[eNB %d] Received %s: associated MME %d\n", instance, msg_name, + S1AP_DEREGISTERED_ENB_IND(msg_p).nb_mme); + + /* TODO handle recovering of registration */ + break; + + case TIMER_HAS_EXPIRED: + LOG_I(ENB_APP, " Received %s: timer_id %ld\n", msg_name, TIMER_HAS_EXPIRED(msg_p).timer_id); + + if (TIMER_HAS_EXPIRED (msg_p).timer_id == enb_register_retry_timer_id) { + /* Restart the registration process */ + registered_enb = 0; + register_enb_pending = eNB_app_register (enb_id_start, enb_id_end);//, enb_properties_p); + } + + break; +# endif + + default: + LOG_E(ENB_APP, "Received unexpected message %s\n", msg_name); + break; + } + + result = itti_free (ITTI_MSG_ORIGIN_ID(msg_p), msg_p); + AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); + } while (1); + +#endif + + + return NULL; +} diff --git a/openair2/ENB_APP/gnb_app.h b/openair2/ENB_APP/gnb_app.h new file mode 100644 index 0000000000..3fd33f38b6 --- /dev/null +++ b/openair2/ENB_APP/gnb_app.h @@ -0,0 +1,38 @@ +/* + * 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 + */ + +/* + gnb_app.h + ------------------- + AUTHOR : Laurent Winckel, Sebastien ROUX, Lionel GAUTHIER, Navid Nikaein + COMPANY : EURECOM + EMAIL : Lionel.Gauthier@eurecom.fr +*/ + +#ifndef GNB_APP_H_ +#define GNB_APP_H_ + +#include + +void *gNB_app_task(void *args_p); + + +#endif /* GNB_APP_H_ */ diff --git a/openair2/ENB_APP/gnb_config.c b/openair2/ENB_APP/gnb_config.c new file mode 100644 index 0000000000..9e341cd7ef --- /dev/null +++ b/openair2/ENB_APP/gnb_config.c @@ -0,0 +1,1958 @@ +#include +#include + +#include "log.h" +#include "log_extern.h" +#include "assertions.h" +#include "gnb_config.h" +#include "UTIL/OTG/otg.h" +#include "UTIL/OTG/otg_externs.h" +#if defined(ENABLE_ITTI) +# include "intertask_interface.h" +# if defined(ENABLE_USE_MME) +# include "s1ap_eNB.h" +# include "sctp_eNB_task.h" +# endif +#endif +#include "sctp_default_values.h" +// #include "SystemInformationBlockType2.h" +// #include "LAYER2/MAC/extern.h" +// #include "LAYER2/MAC/proto.h" +#include "PHY/extern.h" +#include "targets/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.h" +#include "nfapi_vnf.h" +#include "nfapi_pnf.h" + +#include "L1_paramdef.h" +#include "MACRLC_paramdef.h" +#include "common/config/config_userapi.h" +#include "RRC_config_tools.h" +#include "gnb_paramdef.h" + + +int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { + + int num_gnbs = 0; + int num_component_carriers = 0; + int j,k = 0; + int32_t gnb_id = 0; + + int nb_cc = 0; + char* frame_type = NULL; + char* prefix_type = NULL; + + int32_t eutra_band = 0; + long long int downlink_frequency = 0; + int32_t uplink_frequency_offset = 0; + int32_t Nid_cell = 0; +// int32_t Nid_cell_mbsfn = 0; + int32_t N_RB_DL = 0; + int32_t nb_antenna_ports = 0; + + ///NR + //NR FrequencyInfoDL + long absoluteFrequencySSB = 0; + uint32_t ssb_SubcarrierOffset = 0; + long DL_FreqBandIndicatorNR = 0; + long DL_absoluteFrequencyPointA = 0; + + //NR DL SCS-SpecificCarrier + uint32_t DL_offsetToCarrier = 0; + long DL_SubcarrierSpacing = 0; + long DL_SCS_SpecificCarrier_k0 = 0; + uint32_t DL_carrierBandwidth = 0; + + // NR BWP-DownlinkCommon + uint32_t DL_locationAndBandwidth = 0; + //NR_prefix_type_t DL_prefix_type[MAX_NUM_CCs]; + + //NR FrequencyInfoUL + long UL_FreqBandIndicatorNR = 0; + long UL_absoluteFrequencyPointA = 0; + long FrequencyInfoUL_p_Max = 0; + long frequencyShift7p5khz = 0; + + //NR UL SCS-SpecificCarrier + uint32_t UL_offsetToCarrier = 0; + long UL_SubcarrierSpacing = 0; + long UL_SCS_SpecificCarrier_k0 = 0; + uint32_t UL_carrierBandwidth = 0; + + // NR BWP-UplinkCommon + uint32_t UL_locationAndBandwidth = 0; + //NR_prefix_type_t UL_prefix_type; + + + long ssb_periodicityServingCell = 0; + long dmrs_TypeA_Position = 0; + long NIA_SubcarrierSpacing = 0; + long ss_PBCH_BlockPower = 0; + + //NR TDD-UL-DL-ConfigCommon + long referenceSubcarrierSpacing = 0; + long dl_UL_TransmissionPeriodicity = 0; + long nrofDownlinkSlots = 0; + long nrofDownlinkSymbols = 0; + long nrofUplinkSlots = 0; + long nrofUplinkSymbols = 0; + + //NR RACH-ConfigCommon + long rach_totalNumberOfRA_Preambles = 0; + long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice = 0; + long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth = 0; + long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth = 0; + long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf = 0; + long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one = 0; + long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two = 0; + uint32_t rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_four = 0; + uint32_t rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_eight = 0; + uint32_t rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_sixteen = 0; + char* rach_groupBconfigured = NULL; + long rach_ra_Msg3SizeGroupA = 0; + long rach_messagePowerOffsetGroupB = 0; + long rach_numberOfRA_PreamblesGroupA = 0; + long rach_ra_ContentionResolutionTimer = 0; + long rsrp_ThresholdSSB = 0; + long rsrp_ThresholdSSB_SUL = 0; + long prach_RootSequenceIndex_choice = 0; + uint32_t prach_RootSequenceIndex_l839 = 0; + uint32_t prach_RootSequenceIndex_l139 = 0; + long prach_msg1_SubcarrierSpacing = 0; + long restrictedSetConfig = 0; + long msg3_transformPrecoding = 0; + //ssb-perRACH-OccasionAndCB-PreamblesPerSSB not sure + + //NR RACH-ConfigGeneric + long prach_ConfigurationIndex = 0; + long prach_msg1_FDM = 0; + long prach_msg1_FrequencyStart = 0; + long zeroCorrelationZoneConfig = 0; + long preambleReceivedTargetPower = 0; + long preambleTransMax = 0; + long powerRampingStep = 0; + long ra_ResponseWindow = 0; + + //PUSCH-ConfigCommon + char* groupHoppingEnabledTransformPrecoding = NULL; + long msg3_DeltaPreamble = 0; + long p0_NominalWithGrant = 0; + + ///PUSCH-TimeDomainResourceAllocation + long PUSCH_TimeDomainResourceAllocation_k2 = 0; + long PUSCH_TimeDomainResourceAllocation_mappingType = 0; + + //PUCCH-ConfigCommon + long pucch_GroupHopping = 0; + long p0_nominal = 0; + + //PDSCH-ConfigCOmmon + //PDSCH-TimeDomainResourceAllocation + long PDSCH_TimeDomainResourceAllocation_k0 = 0; + long PDSCH_TimeDomainResourceAllocation_mappingType = 0; + + //RateMatchPattern is used to configure one rate matching pattern for PDSCH + long rateMatchPatternId = 0; + long RateMatchPattern_patternType = 0; + long symbolsInResourceBlock = 0; + long periodicityAndPattern = 0; + long RateMatchPattern_controlResourceSet = 0; + long RateMatchPattern_subcarrierSpacing = 0; + long RateMatchPattern_mode = 0; + + //PDCCH-ConfigCommon + long searchSpaceSIB1 = 0; + long searchSpaceOtherSystemInformation = 0; + long pagingSearchSpace = 0; + long ra_SearchSpace = 0; + long rach_ra_ControlResourceSet = 0; + //NR PDCCH-ConfigCommon commonControlResourcesSets + long PDCCH_common_controlResourceSetId = 0; + long PDCCH_common_ControlResourceSet_duration = 0; + long PDCCH_cce_REG_MappingType = 0; + long PDCCH_reg_BundleSize = 0; + long PDCCH_interleaverSize = 0; + long PDCCH_shiftIndex = 0; + long PDCCH_precoderGranularity = 0; + char* tci_PresentInDCI = NULL; + + //NR PDCCH-ConfigCommon commonSearchSpaces + long SearchSpaceId = 0; + long commonSearchSpaces_controlResourceSetId = 0; + long SearchSpace_monitoringSlotPeriodicityAndOffset_choice = 0; + long SearchSpace_monitoringSlotPeriodicityAndOffset_sl1 = 0; + long SearchSpace_monitoringSlotPeriodicityAndOffset_sl2 = 0; + long SearchSpace_monitoringSlotPeriodicityAndOffset_sl4 = 0; + long SearchSpace_monitoringSlotPeriodicityAndOffset_sl5 = 0; + long SearchSpace_monitoringSlotPeriodicityAndOffset_sl8 = 0; + long SearchSpace_monitoringSlotPeriodicityAndOffset_sl10 = 0; + long SearchSpace_monitoringSlotPeriodicityAndOffset_sl16 = 0; + long SearchSpace_monitoringSlotPeriodicityAndOffset_sl20 = 0; + long SearchSpace_nrofCandidates_aggregationLevel1 = 0; + long SearchSpace_nrofCandidates_aggregationLevel2 = 0; + long SearchSpace_nrofCandidates_aggregationLevel4 = 0; + long SearchSpace_nrofCandidates_aggregationLevel8 = 0; + long SearchSpace_nrofCandidates_aggregationLevel16 = 0; + long SearchSpace_searchSpaceType = 0; + long Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel1 = 0; + long Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel2 = 0; + long Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel4 = 0; + long Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel8 = 0; + long Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel16 = 0; + long Common_dci_Format2_3_monitoringPeriodicity = 0; + long Common_dci_Format2_3_nrofPDCCH_Candidates = 0; + long ue_Specific__dci_Formats = 0; + + + int32_t my_int; + + paramdef_t GNBSParams[] = GNBSPARAMS_DESC; + + paramdef_t GNBParams[] = GNBPARAMS_DESC; + paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0}; + + checkedparam_t config_check_CCparams[] = CCPARAMS_CHECK; + paramdef_t CCsParams[] = CCPARAMS_DESC; + paramlist_def_t CCsParamList = {GNB_CONFIG_STRING_COMPONENT_CARRIERS,NULL,0}; + + paramdef_t SRB1Params[] = SRB1PARAMS_DESC; + + /* get global parameters, defined outside any section in the config file */ + + config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL); + num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; + AssertFatal (i0) { + // Output a list of all gNBs. + config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL); + + if (GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr == NULL) { + // Calculate a default gNB ID + # if defined(ENABLE_USE_MME) + uint32_t hash; + hash = s1ap_generate_eNB_id (); + gnb_id = i + (hash & 0xFFFF8); + # else + gnb_id = i; + # endif + } else { + gnb_id = *(GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr); + } + + printf("NRRRC %d: Southbound Transport %s\n",i,*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr)); + + if (strcmp(*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_mac") == 0) { + + } else if (strcmp(*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr), "cudu") == 0) { + rrc->eth_params_s.local_if_name = strdup(*(GNBParamList.paramarray[i][GNB_LOCAL_S_IF_NAME_IDX].strptr)); + rrc->eth_params_s.my_addr = strdup(*(GNBParamList.paramarray[i][GNB_LOCAL_S_ADDRESS_IDX].strptr)); + rrc->eth_params_s.remote_addr = strdup(*(GNBParamList.paramarray[i][GNB_REMOTE_S_ADDRESS_IDX].strptr)); + rrc->eth_params_s.my_portc = *(GNBParamList.paramarray[i][GNB_LOCAL_S_PORTC_IDX].uptr); + rrc->eth_params_s.remote_portc = *(GNBParamList.paramarray[i][GNB_REMOTE_S_PORTC_IDX].uptr); + rrc->eth_params_s.my_portd = *(GNBParamList.paramarray[i][GNB_LOCAL_S_PORTD_IDX].uptr); + rrc->eth_params_s.remote_portd = *(GNBParamList.paramarray[i][GNB_REMOTE_S_PORTD_IDX].uptr); + rrc->eth_params_s.transp_preference = ETH_UDP_MODE; + } else { // other midhaul + } + + // search if in active list + + for (k=0; k 0) { + + char ccspath[MAX_OPTNAME_SIZE*2 + 16]; + + for (j = 0; j < CCsParamList.numelt ;j++) { + + sprintf(ccspath,"%s.%s.[%i]",gnbpath,GNB_CONFIG_STRING_COMPONENT_CARRIERS,j); + config_get( CCsParams,sizeof(CCsParams)/sizeof(paramdef_t),ccspath); + + nb_cc++; + + // NRRRC_CONFIGURATION_REQ (msg_p).tdd_config[j] = tdd_config; + // AssertFatal (tdd_config <= TDD_Config__subframeAssignment_sa6, + // "Failed to parse gNB configuration file %s, gnb %d illegal tdd_config %d (should be 0-%d)!", + // RC.config_file_name, i, tdd_config, TDD_Config__subframeAssignment_sa6); + + // NRRRC_CONFIGURATION_REQ (msg_p).tdd_config_s[j] = tdd_config_s; + // AssertFatal (tdd_config_s <= TDD_Config__specialSubframePatterns_ssp8, + // "Failed to parse gNB configuration file %s, gnb %d illegal tdd_config_s %d (should be 0-%d)!", + // RC.config_file_name, i, tdd_config_s, TDD_Config__specialSubframePatterns_ssp8); + + if (!prefix_type){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d define %s: NORMAL,EXTENDED!\n", + RC.config_file_name, i, GNB_CONFIG_STRING_PREFIX_TYPE); + }else if (strcmp(prefix_type, "NORMAL") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = NORMAL; + }else if (strcmp(prefix_type, "EXTENDED") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = EXTENDED; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for prefix_type choice: NORMAL or EXTENDED !\n", + RC.config_file_name, i, prefix_type); + } + + NRRRC_CONFIGURATION_REQ (msg_p).eutra_band[j] = eutra_band; + NRRRC_CONFIGURATION_REQ (msg_p).downlink_frequency[j] = (uint32_t) downlink_frequency; + NRRRC_CONFIGURATION_REQ (msg_p).uplink_frequency_offset[j] = (unsigned int) uplink_frequency_offset; + NRRRC_CONFIGURATION_REQ (msg_p).Nid_cell[j]= Nid_cell; + + if (Nid_cell>503) { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for Nid_cell choice: 0...503 !\n", + RC.config_file_name, i, Nid_cell); + } + + NRRRC_CONFIGURATION_REQ (msg_p).N_RB_DL[j]= N_RB_DL; + + if ((N_RB_DL!=6) && (N_RB_DL!=15) && (N_RB_DL!=25) && (N_RB_DL!=50) && (N_RB_DL!=75) && (N_RB_DL!=100)) { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for N_RB_DL choice: 6,15,25,50,75,100 !\n", + RC.config_file_name, i, N_RB_DL); + } + + if (strcmp(frame_type, "FDD") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).frame_type[j] = FDD; + }else if (strcmp(frame_type, "TDD") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).frame_type[j] = TDD; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for frame_type choice: FDD or TDD !\n", + RC.config_file_name, i, frame_type); + } + + if (!prefix_type){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d define %s: NORMAL,EXTENDED!\n", + RC.config_file_name, i, ENB_CONFIG_STRING_PREFIX_TYPE); + }else if (strcmp(prefix_type, "NORMAL") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = NORMAL; + }else if (strcmp(prefix_type, "EXTENDED") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = EXTENDED; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for prefix_type choice: NORMAL or EXTENDED !\n", + RC.config_file_name, i, prefix_type); + } + + NRRRC_CONFIGURATION_REQ (msg_p).eutra_band[j] = eutra_band; + NRRRC_CONFIGURATION_REQ (msg_p).downlink_frequency[j] = (uint32_t) downlink_frequency; + NRRRC_CONFIGURATION_REQ (msg_p).uplink_frequency_offset[j] = (unsigned int) uplink_frequency_offset; + + if (config_check_band_frequencies(j, + NRRRC_CONFIGURATION_REQ (msg_p).eutra_band[j], + NRRRC_CONFIGURATION_REQ (msg_p).downlink_frequency[j], + NRRRC_CONFIGURATION_REQ (msg_p).uplink_frequency_offset[j], + NRRRC_CONFIGURATION_REQ (msg_p).frame_type[j])) { + AssertFatal(0, "error calling enb_check_band_frequencies\n"); + } + + if ((nb_antenna_ports <1) || (nb_antenna_ports > 2)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, enb %d unknown value \"%d\" for nb_antenna_ports choice: 1..2 !\n", + RC.config_file_name, i, nb_antenna_ports); + } + NRRRC_CONFIGURATION_REQ (msg_p).nb_antenna_ports[j] = nb_antenna_ports; + + + //////////////////////////////////////////////////////////////////////////////// + //---------------------------NR--------Configuration--------------------------// + //////////////////////////////////////////////////////////////////////////////// + + ////////////////////////////////NR FrequencyInfoDL////////////////////////////// + NRRRC_CONFIGURATION_REQ (msg_p).absoluteFrequencySSB[j] = absoluteFrequencySSB; + if ((absoluteFrequencySSB <0) || (absoluteFrequencySSB > 3279165)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for FreqBandIndicatorNR choice: 0..3279165 !\n", + RC.config_file_name, i, absoluteFrequencySSB); + } + + NRRRC_CONFIGURATION_REQ (msg_p).ssb_SubcarrierOffset[j] = ssb_SubcarrierOffset; + if ((ssb_SubcarrierOffset <1) || (ssb_SubcarrierOffset > 23)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for ssb_SubcarrierOffset choice: 1..23 !\n", + RC.config_file_name, i, ssb_SubcarrierOffset); + } + + NRRRC_CONFIGURATION_REQ (msg_p).DL_FreqBandIndicatorNR[j] = DL_FreqBandIndicatorNR; + if ((DL_FreqBandIndicatorNR <1) || (DL_FreqBandIndicatorNR > 1024)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for DL_FreqBandIndicatorNR choice: 1..1024 !\n", + RC.config_file_name, i, DL_FreqBandIndicatorNR); + } + + NRRRC_CONFIGURATION_REQ (msg_p).DL_absoluteFrequencyPointA[j] = DL_absoluteFrequencyPointA; + if ((DL_absoluteFrequencyPointA <0) || (DL_absoluteFrequencyPointA > 3279165)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for DL_absoluteFrequencyPointA choice: 0..3279165 !\n", + RC.config_file_name, i, DL_absoluteFrequencyPointA); + } + + + /////////////////////////////////NR DL SCS-SpecificCarrier/////////////////////////// + NRRRC_CONFIGURATION_REQ (msg_p).DL_offsetToCarrier[j] = DL_offsetToCarrier; + if ((DL_offsetToCarrier <0) || (DL_offsetToCarrier > 2199)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for DL_offsetToCarrier choice: 0..11 !\n", + RC.config_file_name, i, DL_offsetToCarrier); + } + + if (strcmp(DL_SubcarrierSpacing,"kHz15")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).DL_SubcarrierSpacing[j] = SubcarrierSpacing_kHz15; + }else if (strcmp(pusch_alpha,"kHz30")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).DL_SubcarrierSpacing[j] = SubcarrierSpacing_kHz30; + }else if (strcmp(pusch_alpha,"kHz60")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).DL_SubcarrierSpacing[j] = SubcarrierSpacing_kHz60; + }else if (strcmp(pusch_alpha,"kHz120")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).DL_SubcarrierSpacing[j] = SubcarrierSpacing_kHz120; + }else if (strcmp(pusch_alpha,"kHz240")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).DL_SubcarrierSpacing[j] = SubcarrierSpacing_kHz240; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for DL_SubcarrierSpacing choice: minusinfinity,kHz15,kHz30,kHz60,kHz120,kHz240!\n", + RC.config_file_name, i, DL_SubcarrierSpacing); + } + + switch (DL_SCS_SpecificCarrier_k0) { + case -6: + NRRRC_CONFIGURATION_REQ (msg_p).DL_SCS_SpecificCarrier_k0[j] = SCS_SpecificCarrier__k0_n_6; + break; + + case 0: + NRRRC_CONFIGURATION_REQ (msg_p).DL_SCS_SpecificCarrier_k0[j] = SCS_SpecificCarrier__k0_n0; + break; + + case 6: + NRRRC_CONFIGURATION_REQ (msg_p).DL_SCS_SpecificCarrier_k0[j] = SCS_SpecificCarrier__k0_n6; + break; + + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for DL_SCS_SpecificCarrier_k0 choice: -6,0,6 !\n", + RC.config_file_name, i, DL_SCS_SpecificCarrier_k0); + break; + } + + NRRRC_CONFIGURATION_REQ (msg_p).DL_carrierBandwidth[j] = DL_carrierBandwidth; + if ((DL_carrierBandwidth <1) || (DL_carrierBandwidth > 275)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for DL_carrierBandwidth choice: 1..275 !\n", + RC.config_file_name, i, DL_carrierBandwidth); + } + + /////////////////////////////////NR BWP-DownlinkCommon/////////////////////////// + NRRRC_CONFIGURATION_REQ (msg_p).DL_locationAndBandwidth[j] = DL_locationAndBandwidth; + if ((DL_locationAndBandwidth <0) || (DL_locationAndBandwidth > 37949)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for DL_locationAndBandwidth choice: 0..11 !\n", + RC.config_file_name, i, DL_locationAndBandwidth); + } + + /////////////////////////////////NR FrequencyInfoUL////////////////////////////// + NRRRC_CONFIGURATION_REQ (msg_p).UL_FreqBandIndicatorNR[j] = UL_FreqBandIndicatorNR; + if ((UL_FreqBandIndicatorNR <1) || (UL_FreqBandIndicatorNR > 1024)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for UL_FreqBandIndicatorNR choice: 1..1024 !\n", + RC.config_file_name, i, UL_FreqBandIndicatorNR); + } + + NRRRC_CONFIGURATION_REQ (msg_p).UL_absoluteFrequencyPointA[j] = UL_absoluteFrequencyPointA; + if ((UL_absoluteFrequencyPointA <0) || (UL_absoluteFrequencyPointA > 3279165)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for UL_absoluteFrequencyPointA choice: 0..3279165 !\n", + RC.config_file_name, i, UL_absoluteFrequencyPointA); + } + + NRRRC_CONFIGURATION_REQ (msg_p).FrequencyInfoUL_p_Max[j] = FrequencyInfoUL_p_Max; + if ((FrequencyInfoUL_p_Max <-30) || (FrequencyInfoUL_p_Max > 33)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for FrequencyInfoUL_p_Max choice: -30..33 !\n", + RC.config_file_name, i, FrequencyInfoUL_p_Max); + } + + if (strcmp(frequencyShift7p5khz, "TRUE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).frequencyShift7p5khz[j] = FrequencyInfoUL__frequencyShift7p5khz_true; + } + + /////////////////////////////////NR UL SCS-SpecificCarrier/////////////////////////// + NRRRC_CONFIGURATION_REQ (msg_p).UL_offsetToCarrier[j] = UL_offsetToCarrier; + if ((UL_offsetToCarrier <0) || (UL_offsetToCarrier > 2199)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for UL_offsetToCarrier choice: 0..11 !\n", + RC.config_file_name, i, UL_offsetToCarrier); + } + + if (strcmp(UL_SubcarrierSpacing,"kHz15")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).UL_SubcarrierSpacing[j] = SubcarrierSpacing_kHz15; + }else if (strcmp(pusch_alpha,"kHz30")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).UL_SubcarrierSpacing[j] = SubcarrierSpacing_kHz30; + }else if (strcmp(pusch_alpha,"kHz60")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).UL_SubcarrierSpacing[j] = SubcarrierSpacing_kHz60; + }else if (strcmp(pusch_alpha,"kHz120")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).UL_SubcarrierSpacing[j] = SubcarrierSpacing_kHz120; + }else if (strcmp(pusch_alpha,"kHz240")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).UL_SubcarrierSpacing[j] = SubcarrierSpacing_kHz240; + }else { AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for UL_SubcarrierSpacing choice: minusinfinity,kHz15,kHz30,kHz60,kHz120,kHz240!\n", + RC.config_file_name, i, UL_SubcarrierSpacing); + } + + switch (UL_SCS_SpecificCarrier_k0) { + case -6: + NRRRC_CONFIGURATION_REQ (msg_p).UL_SCS_SpecificCarrier_k0[j] = SCS_SpecificCarrier__k0_n_6; + break; + + case 0: + NRRRC_CONFIGURATION_REQ (msg_p).UL_SCS_SpecificCarrier_k0[j] = SCS_SpecificCarrier__k0_n0; + break; + + case 6: + NRRRC_CONFIGURATION_REQ (msg_p).UL_SCS_SpecificCarrier_k0[j] = SCS_SpecificCarrier__k0_n6; + break; + + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for UL_SCS_SpecificCarrier_k0 choice: -6,0,6 !\n", + RC.config_file_name, i, UL_SCS_SpecificCarrier_k0); + break; + } + + NRRRC_CONFIGURATION_REQ (msg_p).UL_carrierBandwidth[j] = UL_carrierBandwidth; + if ((UL_carrierBandwidth <1) || (UL_carrierBandwidth > 275)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for UL_carrierBandwidth choice: 1..275 !\n", + RC.config_file_name, i, UL_carrierBandwidth); + } + + + + //Not Sure the value selection + NRRRC_CONFIGURATION_REQ (msg_p).absoluteFrequencyPointA[j] = absoluteFrequencyPointA; + + NRRRC_CONFIGURATION_REQ (msg_p).ControlResourceSetId[j] = ControlResourceSetId; + if ((ControlResourceSetId <0) || (ControlResourceSetId > 11)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for ControlResourceSetId choice: 0..11 !\n", + RC.config_file_name, i, ControlResourceSetId); + } + + /////////////////////////////////NR BWP-UplinkCommon/////////////////////////// + NRRRC_CONFIGURATION_REQ (msg_p).UL_locationAndBandwidth[j] = UL_locationAndBandwidth; + if ((UL_locationAndBandwidth <0) || (UL_locationAndBandwidth > 37949)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for UL_locationAndBandwidth choice: 0..11 !\n", + RC.config_file_name, i, UL_locationAndBandwidth); + } + + switch (ssb_periodicityServingCell) { + case 5: + NRRRC_CONFIGURATION_REQ (msg_p).ssb_periodicityServingCell[j] = ServingCellConfigCommon__ssb_periodicityServingCell_ms5; + break; + + case 10: + NRRRC_CONFIGURATION_REQ (msg_p).ssb_periodicityServingCell[j] = ServingCellConfigCommon__ssb_periodicityServingCell_ms10; + break; + + case 20: + NRRRC_CONFIGURATION_REQ (msg_p).ssb_periodicityServingCell[j] = ServingCellConfigCommon__ssb_periodicityServingCell_ms20; + break; + + case 40: + NRRRC_CONFIGURATION_REQ (msg_p).ssb_periodicityServingCell[j] = ServingCellConfigCommon__ssb_periodicityServingCell_ms40; + break; + + case 80: + NRRRC_CONFIGURATION_REQ (msg_p).ssb_periodicityServingCell[j] = ServingCellConfigCommon__ssb_periodicityServingCell_ms80; + break; + + case 160: + NRRRC_CONFIGURATION_REQ (msg_p).ssb_periodicityServingCell[j] = ServingCellConfigCommon__ssb_periodicityServingCell_ms160; + break; + + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for ssb_periodicityServingCell choice: -6,0,6 !\n", + RC.config_file_name, i, ssb_periodicityServingCell); + break; + } + + switch (dmrs_TypeA_Position) { + case 2: + NRRRC_CONFIGURATION_REQ (msg_p).dmrs_TypeA_Position[j] = ServingCellConfigCommon__dmrs_TypeA_Position_pos2; + break; + + case 3: + NRRRC_CONFIGURATION_REQ (msg_p).dmrs_TypeA_Position[j] = ServingCellConfigCommon__dmrs_TypeA_Position_pos3; + break; + + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for dmrs_TypeA_Position choice: -6,0,6 !\n", + RC.config_file_name, i, dmrs_TypeA_Position); + break; + } + + if (strcmp(NIA_SubcarrierSpacing,"kHz15")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).NIA_SubcarrierSpacing[j] = SubcarrierSpacing_kHz15; + }else if (strcmp(pusch_alpha,"kHz30")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).NIA_SubcarrierSpacing[j] = SubcarrierSpacing_kHz30; + }else if (strcmp(pusch_alpha,"kHz60")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).NIA_SubcarrierSpacing[j] = SubcarrierSpacing_kHz60; + }else if (strcmp(pusch_alpha,"kHz120")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).NIA_SubcarrierSpacing[j] = SubcarrierSpacing_kHz120; + }else if (strcmp(pusch_alpha,"kHz240")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).NIA_SubcarrierSpacing[j] = SubcarrierSpacing_kHz240; + }else { AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for NIA_SubcarrierSpacing choice: minusinfinity,kHz15,kHz30,kHz60,kHz120,kHz240!\n", + RC.config_file_name, i, NIA_SubcarrierSpacing); + } + + NRRRC_CONFIGURATION_REQ (msg_p).ss_PBCH_BlockPower[j] = ss_PBCH_BlockPower; + if ((ss_PBCH_BlockPower < -60) || (ss_PBCH_BlockPower > 50)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for ss_PBCH_BlockPower choice: 0..11 !\n", + RC.config_file_name, i, ss_PBCH_BlockPower); + } + + /////////////////////////////////NR TDD-UL-DL-ConfigCommon/////////////////////////// + if (strcmp(referenceSubcarrierSpacing,"kHz15")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).referenceSubcarrierSpacing[j] = SubcarrierSpacing_kHz15; + }else if (strcmp(pusch_alpha,"kHz30")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).referenceSubcarrierSpacing[j] = SubcarrierSpacing_kHz30; + }else if (strcmp(pusch_alpha,"kHz60")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).referenceSubcarrierSpacing[j] = SubcarrierSpacing_kHz60; + }else if (strcmp(pusch_alpha,"kHz120")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).referenceSubcarrierSpacing[j] = SubcarrierSpacing_kHz120; + }else if (strcmp(pusch_alpha,"kHz240")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).referenceSubcarrierSpacing[j] = SubcarrierSpacing_kHz240; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for referenceSubcarrierSpacing choice: minusinfinity,kHz15,kHz30,kHz60,kHz120,kHz240!\n", + RC.config_file_name, i, referenceSubcarrierSpacing); + } + + if (strcmp(dl_UL_TransmissionPeriodicity,"ms0p5")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).dl_UL_TransmissionPeriodicity[j] = TDD_UL_DL_ConfigCommon__dl_UL_TransmissionPeriodicity_ms0p5; + }else if (strcmp(pusch_alpha,"ms0p625")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).dl_UL_TransmissionPeriodicity[j] = TDD_UL_DL_ConfigCommon__dl_UL_TransmissionPeriodicity_ms0p625; + }else if (strcmp(pusch_alpha,"ms1")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).dl_UL_TransmissionPeriodicity[j] = TDD_UL_DL_ConfigCommon__dl_UL_TransmissionPeriodicity_ms1; + }else if (strcmp(pusch_alpha,"ms1p25")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).dl_UL_TransmissionPeriodicity[j] = TDD_UL_DL_ConfigCommon__dl_UL_TransmissionPeriodicity_ms1p25; + }else if (strcmp(pusch_alpha,"ms2")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).dl_UL_TransmissionPeriodicity[j] = TDD_UL_DL_ConfigCommon__dl_UL_TransmissionPeriodicity_ms2; + }else if (strcmp(pusch_alpha,"ms2p5")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).dl_UL_TransmissionPeriodicity[j] = TDD_UL_DL_ConfigCommon__dl_UL_TransmissionPeriodicity_ms2p5; + }else if (strcmp(pusch_alpha,"ms5")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).dl_UL_TransmissionPeriodicity[j] = TDD_UL_DL_ConfigCommon__dl_UL_TransmissionPeriodicity_ms5; + }else if (strcmp(pusch_alpha,"ms10")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).dl_UL_TransmissionPeriodicity[j] = TDD_UL_DL_ConfigCommon__dl_UL_TransmissionPeriodicity_ms10; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for dl_UL_TransmissionPeriodicity choice: minusinfinity,ms0p5,ms0p625,ms1,ms1p25,ms2,ms2p5,ms5,ms10 !\n", + RC.config_file_name, i, dl_UL_TransmissionPeriodicity); + } + + NRRRC_CONFIGURATION_REQ (msg_p).nrofDownlinkSlots[j] = nrofDownlinkSlots; + if ((nrofDownlinkSlots < 0) || (nrofDownlinkSlots > 320)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for nrofDownlinkSlots choice: 0..320 !\n", + RC.config_file_name, i, nrofDownlinkSlots); + } + + NRRRC_CONFIGURATION_REQ (msg_p).nrofDownlinkSymbols[j] = nrofDownlinkSymbols; + if ((nrofDownlinkSymbols < 0) || (nrofDownlinkSymbols > 13)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for nrofDownlinkSymbols choice: 0..13 !\n", + RC.config_file_name, i, nrofDownlinkSymbols); + } + + NRRRC_CONFIGURATION_REQ (msg_p).nrofUplinkSlots[j] = nrofUplinkSlots; + if ((nrofUplinkSlots < 0) || (nrofUplinkSlots > 320)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for nrofUplinkSlots choice: 0..320 !\n", + RC.config_file_name, i, nrofUplinkSlots); + } + + NRRRC_CONFIGURATION_REQ (msg_p).nrofUplinkSymbols[j] = nrofUplinkSymbols; + if ((nrofUplinkSymbols < 0) || (nrofUplinkSymbols > 13)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for nrofUplinkSymbols choice: 0..13 !\n", + RC.config_file_name, i, nrofUplinkSymbols); + } + + /////////////////////////////////NR RACH-ConfigCommon/////////////////////////// + + NRRRC_CONFIGURATION_REQ (msg_p).rach_totalNumberOfRA_Preambles[j] = rach_totalNumberOfRA_Preambles; + if ((rach_totalNumberOfRA_Preambles <1) || (rach_totalNumberOfRA_Preambles>63)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for rach_numberOfRA_Preambles choice: 1..63 !\n", + RC.config_file_name, i, rach_totalNumberOfRA_Preambles); + } + + if (strcmp(rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice,"oneEighth")==0) { + + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth; + switch (rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth){ + case 4: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n4; + break; + case 8: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n8; + break; + case 12: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n12; + break; + case 16: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n16; + break; + case 20: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n20; + break; + case 24: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n24; + break; + case 28: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n28; + break; + case 32: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n32; + break; + case 36: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n36; + break; + case 40: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n40; + break; + case 44: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n44; + break; + case 48: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n48; + break; + case 52: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n52; + break; + case 56: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n56; + break; + case 60: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n60; + break; + case 64: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneEighth_n64; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth choice: 4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64!\n", + RC.config_file_name, i, rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth); + break; + }//End oneEighth + + }else if (strcmp(rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice,"oneFourth")==0) { + + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth; + switch (rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth){ + case 4: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n4; + break; + case 8: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n8; + break; + case 12: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n12; + break; + case 16: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n16; + break; + case 20: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n20; + break; + case 24: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n24; + break; + case 28: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n28; + break; + case 32: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n32; + break; + case 36: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n36; + break; + case 40: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n40; + break; + case 44: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n44; + break; + case 48: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n48; + break; + case 52: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n52; + break; + case 56: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n56; + break; + case 60: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n60; + break; + case 64: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneFourth_n64; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth choice: 4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64!\n", + RC.config_file_name, i, rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth); + break; + }//End oneFourth + + }else if (strcmp(rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice,"oneHalf")==0) { + + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf; + switch (rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf){ + case 4: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n4; + break; + case 8: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n8; + break; + case 12: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n12; + break; + case 16: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n16; + break; + case 20: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n20; + break; + case 24: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n24; + break; + case 28: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n28; + break; + case 32: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n32; + break; + case 36: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n36; + break; + case 40: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n40; + break; + case 44: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n44; + break; + case 48: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n48; + break; + case 52: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n52; + break; + case 56: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n56; + break; + case 60: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n60; + break; + case 64: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__oneHalf_n64; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf choice: 4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64!\n", + RC.config_file_name, i, rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf); + break; + }//End oneHalf + + }else if (strcmp(rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice,"one")==0) { + + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one; + switch (rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one){ + case 4: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n4; + break; + case 8: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n8; + break; + case 12: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n12; + break; + case 16: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n16; + break; + case 20: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n20; + break; + case 24: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n24; + break; + case 28: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n28; + break; + case 32: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n32; + break; + case 36: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n36; + break; + case 40: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n40; + break; + case 44: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n44; + break; + case 48: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n48; + break; + case 52: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n52; + break; + case 56: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n56; + break; + case 60: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n60; + break; + case 64: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__one_n64; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one choice: 4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64!\n", + RC.config_file_name, i, rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one); + break; + }//End one + + }else if (strcmp(rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice,"two")==0) { + + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two; + switch (rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one){ + case 4: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__two_n4; + break; + case 8: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__two_n8; + break; + case 12: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__two_n12; + break; + case 16: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__two_n16; + break; + case 20: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__two_n20; + break; + case 24: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__two_n24; + break; + case 28: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__two_n28; + break; + case 32: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB__two_n32; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two choice: 4,8,12,16,20,24,28,32,36,40,44,48,52,56,60,64!\n", + RC.config_file_name, i, rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two); + break; + }//End two + + }else if (strcmp(rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice,"four")==0) { + + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four; + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_four[j] = rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_four; + if ((rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_four < 1) || (rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_four > 16)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_four choice: 1..16 !\n", + RC.config_file_name, i, rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_four); + }//End four + + }else if (strcmp(rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice,"eight")==0) { + + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight; + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_eight[j] = rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_eight; + if ((rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_eight < 1) || (rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_eight > 8)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_eight choice: 1..8 !\n", + RC.config_file_name, i, rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_eight); + }//End eight + + }else if (strcmp(rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice,"sixteen")==0) { + + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen; + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_sixteen[j] = rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_sixteen; + if ((rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_sixteen < 1) || (rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_sixteen > 4)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_sixteen choice: 1..4 !\n", + RC.config_file_name, i, rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_sixteen); + }//End sixteen + + }else if (strcmp(rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice,"NOTHING")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice[j] = RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_NOTHING; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice: oneEighth,oneFourth,oneHalf,one,two,four,eight,sixteen !\n", + RC.config_file_name, i, rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice); + } + + if (strcmp(rach_groupBconfigured , "ENABLE") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).rach_groupBconfigured [j] = TRUE; + + switch (rach_ra_Msg3SizeGroupA) { + case 56: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ra_Msg3SizeGroupA[j] = RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_b56; + break; + case 144: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ra_Msg3SizeGroupA[j] = RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_b144; + break; + case 208: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ra_Msg3SizeGroupA[j] = RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_b208; + break; + case 256: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ra_Msg3SizeGroupA[j] = RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_b256; + break; + case 282: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ra_Msg3SizeGroupA[j] = RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_b282; + break; + case 480: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ra_Msg3SizeGroupA[j] = RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_b480; + break; + case 640: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ra_Msg3SizeGroupA[j] = RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_b640; + break; + case 800: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ra_Msg3SizeGroupA[j] = RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_b800; + break; + case 1000: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ra_Msg3SizeGroupA[j] = RACH_ConfigCommon__groupBconfigured__ra_Msg3SizeGroupA_b1000; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for rach_ra_Msg3SizeGroupA choice: 56,144,208,256,282,480,640,800,1000!\n", + RC.config_file_name, i, rach_ra_Msg3SizeGroupA); + break; + }// End switch (rach_ra_Msg3SizeGroupA) + + if (strcmp(rach_messagePowerOffsetGroupB,"minusinfinity")==0) { + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__groupBconfigured__messagePowerOffsetGroupB_minusinfinity; + }else if (strcmp(rach_messagePowerOffsetGroupB,"dB0")==0) { + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__groupBconfigured__messagePowerOffsetGroupB_dB0; + }else if (strcmp(rach_messagePowerOffsetGroupB,"dB5")==0) { + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__groupBconfigured__messagePowerOffsetGroupB_dB5; + }else if (strcmp(rach_messagePowerOffsetGroupB,"dB8")==0) { + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__groupBconfigured__messagePowerOffsetGroupB_dB8; + }else if (strcmp(rach_messagePowerOffsetGroupB,"dB10")==0) { + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__groupBconfigured__messagePowerOffsetGroupB_dB10; + }else if (strcmp(rach_messagePowerOffsetGroupB,"dB12")==0) { + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__groupBconfigured__messagePowerOffsetGroupB_dB12; + }else if (strcmp(rach_messagePowerOffsetGroupB,"dB15")==0) { + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__groupBconfigured__messagePowerOffsetGroupB_dB15; + }else if (strcmp(rach_messagePowerOffsetGroupB,"dB18")==0) { + RRC_CONFIGURATION_REQ (msg_p).rach_messagePowerOffsetGroupB[j] = RACH_ConfigCommon__groupBconfigured__messagePowerOffsetGroupB_dB18; + }else{ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for rach_messagePowerOffsetGroupB choice: minusinfinity,dB0,dB5,dB8,dB10,dB12,dB15,dB18!\n", + RC.config_file_name, i, rach_messagePowerOffsetGroupB); + }// End if (strcmp(rach_messagePowerOffsetGroupB,"minusinfinity")==0) + + NRRRC_CONFIGURATION_REQ (msg_p).rach_numberOfRA_PreamblesGroupA[j] = rach_numberOfRA_PreamblesGroupA; + if ((rach_numberOfRA_PreamblesGroupA <1) || (rach_numberOfRA_PreamblesGroupA>64)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for rach_numberOfRA_PreamblesGroupA choice: 1..63 !\n", + RC.config_file_name, i, rach_numberOfRA_PreamblesGroupA); + } + + }// End if (strcmp(rach_groupBconfigured , "ENABLE") == 0) + + switch (rach_ra_ContentionResolutionTimer) { + case 8: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ra_ContentionResolutionTimer[j] = RACH_ConfigCommon__ra_ContentionResolutionTimer_sf8; + break; + case 16: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ra_ContentionResolutionTimer[j] = RACH_ConfigCommon__ra_ContentionResolutionTimer_sf16; + break; + case 24: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ra_ContentionResolutionTimer[j] = RACH_ConfigCommon__ra_ContentionResolutionTimer_sf24; + break; + case 32: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ra_ContentionResolutionTimer[j] = RACH_ConfigCommon__ra_ContentionResolutionTimer_sf32; + break; + case 40: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ra_ContentionResolutionTimer[j] = RACH_ConfigCommon__ra_ContentionResolutionTimer_sf40; + break; + case 48: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ra_ContentionResolutionTimer[j] = RACH_ConfigCommon__ra_ContentionResolutionTimer_sf48; + break; + case 56: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ra_ContentionResolutionTimer[j] = RACH_ConfigCommon__ra_ContentionResolutionTimer_sf56; + break; + case 64: + NRRRC_CONFIGURATION_REQ (msg_p).rach_ra_ContentionResolutionTimer[j] = RACH_ConfigCommon__ra_ContentionResolutionTimer_sf64; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for rach_ra_ContentionResolutionTimer choice: 8,16,24,32,40,48,56,64!\n", + RC.config_file_name, i, rach_ra_ContentionResolutionTimer); + break; + }// End switch (rach_ra_ContentionResolutionTimer) + + + NRRRC_CONFIGURATION_REQ (msg_p).rsrp_ThresholdSSB[j] = rsrp_ThresholdSSB; + if ((rsrp_ThresholdSSB <0) || (rsrp_ThresholdSSB>124)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for rsrp_ThresholdSSB choice: 0..124 !\n", + RC.config_file_name, i, rsrp_ThresholdSSB); + } + + NRRRC_CONFIGURATION_REQ (msg_p).rsrp_ThresholdSSB_SUL[j] = rsrp_ThresholdSSB_SUL; + if ((rsrp_ThresholdSSB_SUL <0) || (rsrp_ThresholdSSB_SUL>124)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for rsrp_ThresholdSSB_SUL choice: 0..124 !\n", + RC.config_file_name, i, rsrp_ThresholdSSB_SUL); + } + + if (strcmp(prach_RootSequenceIndex_choice , "l839") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).prach_RootSequenceIndex_choice[j] = RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839; + NRRRC_CONFIGURATION_REQ (msg_p).prach_RootSequenceIndex_l839[j] = prach_RootSequenceIndex_l839; + }else if (strcmp(prach_RootSequenceIndex_choice , "l139") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).prach_RootSequenceIndex_choice[j] = RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139; + NRRRC_CONFIGURATION_REQ (msg_p).prach_RootSequenceIndex_l139[j] = prach_RootSequenceIndex_l139; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for prach_RootSequenceIndex !\n", + RC.config_file_name, i, prach_RootSequenceIndex); + } + + if (strcmp(prach_msg1_SubcarrierSpacing,"kHz15")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).prach_msg1_SubcarrierSpacing[j] = SubcarrierSpacing_kHz15; + }else if (strcmp(pusch_alpha,"kHz30")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).prach_msg1_SubcarrierSpacing[j] = SubcarrierSpacing_kHz30; + }else if (strcmp(pusch_alpha,"kHz60")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).prach_msg1_SubcarrierSpacing[j] = SubcarrierSpacing_kHz60; + }else if (strcmp(pusch_alpha,"kHz120")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).prach_msg1_SubcarrierSpacing[j] = SubcarrierSpacing_kHz120; + }else if (strcmp(pusch_alpha,"kHz240")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).prach_msg1_SubcarrierSpacing[j] = SubcarrierSpacing_kHz240; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for prach_msg1_SubcarrierSpacing choice: minusinfinity,kHz15,kHz30,kHz60,kHz120,kHz240!\n", + RC.config_file_name, i, prach_msg1_SubcarrierSpacing); + } + + if (strcmp(restrictedSetConfig , "unrestrictedSet") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).restrictedSetConfig[j] = RACH_ConfigCommon__restrictedSetConfig_unrestrictedSet; + }else if (strcmp(restrictedSetConfig , "restrictedSetTypeA") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).restrictedSetConfig[j] = RACH_ConfigCommon__restrictedSetConfig_restrictedSetTypeA; + }else if (strcmp(restrictedSetConfig , "restrictedSetTypeB") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).restrictedSetConfig[j] = RACH_ConfigCommon__restrictedSetConfig_restrictedSetTypeB; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for restrictedSetConfig !\n", + RC.config_file_name, i, restrictedSetConfig); + } + + if (strcmp(msg3_transformPrecoding , "ENABLE") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).msg3_transformPrecoding[j] = RACH_ConfigCommon__msg3_transformPrecoding_enabled; + } + + ////////////////////////////////NR RACH-ConfigGeneric////////////////////////////// + NRRRC_CONFIGURATION_REQ (msg_p).prach_ConfigurationIndex[j] = prach_ConfigurationIndex; + if ((prach_ConfigurationIndex <0) || (prach_ConfigurationIndex>255)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for prach_ConfigurationIndex choice: 0..255 !\n", + RC.config_file_name, i, prach_ConfigurationIndex); + } + + if (strcmp(prach_msg1_FDM , "one") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).prach_msg1_FDM[j] = RACH_ConfigGeneric__msg1_FDM_one; + }else if (strcmp(prach_msg1_FDM , "two") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).prach_msg1_FDM[j] = RACH_ConfigGeneric__msg1_FDM_two; + }else if (strcmp(prach_msg1_FDM , "four") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).prach_msg1_FDM[j] = RACH_ConfigGeneric__msg1_FDM_four; + }else if (strcmp(prach_msg1_FDM , "eight") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).prach_msg1_FDM[j] = RACH_ConfigGeneric__msg1_FDM_eight; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for prach_msg1_FDM !\n", + RC.config_file_name, i, prach_msg1_FDM); + } + + NRRRC_CONFIGURATION_REQ (msg_p).prach_msg1_FrequencyStart[j] = prach_msg1_FrequencyStart; + if ((prach_msg1_FrequencyStart <0) || (prach_msg1_FrequencyStart>274)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for prach_msg1_FrequencyStart choice: 0..274 !\n", + RC.config_file_name, i, prach_msg1_FrequencyStart); + } + + NRRRC_CONFIGURATION_REQ (msg_p).zeroCorrelationZoneConfig[j] = zeroCorrelationZoneConfig; + if ((zeroCorrelationZoneConfig <0) || (zeroCorrelationZoneConfig>15)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for zeroCorrelationZoneConfig choice: 0..15 !\n", + RC.config_file_name, i, zeroCorrelationZoneConfig); + } + + NRRRC_CONFIGURATION_REQ (msg_p).preambleReceivedTargetPower[j] = preambleReceivedTargetPower; + if ((preambleReceivedTargetPower <-200) || (preambleReceivedTargetPower>-74)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for preambleReceivedTargetPower choice: -200..-74 !\n", + RC.config_file_name, i, preambleReceivedTargetPower); + } + + switch (preambleTransMax) { + case 3: + NRRRC_CONFIGURATION_REQ (msg_p).preambleTransMax[j] = RACH_ConfigGeneric__preambleTransMax_n3; + break; + case 4: + NRRRC_CONFIGURATION_REQ (msg_p).preambleTransMax[j] = RACH_ConfigGeneric__preambleTransMax_n4; + break; + case 5: + NRRRC_CONFIGURATION_REQ (msg_p).preambleTransMax[j] = RACH_ConfigGeneric__preambleTransMax_n5; + break; + case 6: + NRRRC_CONFIGURATION_REQ (msg_p).preambleTransMax[j] = RACH_ConfigGeneric__preambleTransMax_n6; + break; + case 7: + NRRRC_CONFIGURATION_REQ (msg_p).preambleTransMax[j] = RACH_ConfigGeneric__preambleTransMax_n7; + break; + case 8: + NRRRC_CONFIGURATION_REQ (msg_p).preambleTransMax[j] = RACH_ConfigGeneric__preambleTransMax_n8; + break; + case 10: + NRRRC_CONFIGURATION_REQ (msg_p).preambleTransMax[j] = RACH_ConfigGeneric__preambleTransMax_n10; + break; + case 20: + NRRRC_CONFIGURATION_REQ (msg_p).preambleTransMax[j] = RACH_ConfigGeneric__preambleTransMax_n20; + break; + case 50: + NRRRC_CONFIGURATION_REQ (msg_p).preambleTransMax[j] = RACH_ConfigGeneric__preambleTransMax_n50; + break; + case 100: + NRRRC_CONFIGURATION_REQ (msg_p).preambleTransMax[j] = RACH_ConfigGeneric__preambleTransMax_n100; + break; + case 200: + NRRRC_CONFIGURATION_REQ (msg_p).preambleTransMax[j] = RACH_ConfigGeneric__preambleTransMax_n200; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for preambleTransMax choice: 3,4,5,6,7,8,10,20,50,100,200 !\n", + RC.config_file_name, i, preambleTransMax); + break; + } + + if (strcmp(powerRampingStep , "dB0") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).powerRampingStep[j] = RACH_ConfigGeneric__powerRampingStep_dB0; + }else if (strcmp(powerRampingStep , "dB2") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).powerRampingStep[j] = RACH_ConfigGeneric__powerRampingStep_dB2; + }else if (strcmp(powerRampingStep , "dB4") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).powerRampingStep[j] = RACH_ConfigGeneric__powerRampingStep_dB4; + }else if (strcmp(powerRampingStep , "dB6") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).powerRampingStep[j] = RACH_ConfigGeneric__powerRampingStep_dB6; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for powerRampingStep !\n", + RC.config_file_name, i, powerRampingStep); + } + + switch (ra_ResponseWindow) { + case 1: + NRRRC_CONFIGURATION_REQ (msg_p).ra_ResponseWindow[j] = RACH_ConfigGeneric__ra_ResponseWindow_sl1; + break; + case 2: + NRRRC_CONFIGURATION_REQ (msg_p).ra_ResponseWindow[j] = RACH_ConfigGeneric__ra_ResponseWindow_sl2; + break; + case 4: + NRRRC_CONFIGURATION_REQ (msg_p).ra_ResponseWindow[j] = RACH_ConfigGeneric__ra_ResponseWindow_sl4; + break; + case 8: + NRRRC_CONFIGURATION_REQ (msg_p).ra_ResponseWindow[j] = RACH_ConfigGeneric__ra_ResponseWindow_sl8; + break; + case 10: + NRRRC_CONFIGURATION_REQ (msg_p).ra_ResponseWindow[j] = RACH_ConfigGeneric__ra_ResponseWindow_sl10; + break; + case 20: + NRRRC_CONFIGURATION_REQ (msg_p).ra_ResponseWindow[j] = RACH_ConfigGeneric__ra_ResponseWindow_sl20; + break; + case 40: + NRRRC_CONFIGURATION_REQ (msg_p).ra_ResponseWindow[j] = RACH_ConfigGeneric__ra_ResponseWindow_sl40; + break; + case 80: + NRRRC_CONFIGURATION_REQ (msg_p).ra_ResponseWindow[j] = RACH_ConfigGeneric__ra_ResponseWindow_sl80; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for ra_ResponseWindow choice: 1,2,4,8,10,20,40,80 !\n", + RC.config_file_name, i, ra_ResponseWindow); + break; + } + + /////////////////////////////////NR PUSCH-ConfigCommon/////////////////////////// + if (strcmp(groupHoppingEnabledTransformPrecoding , "ENABLE") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).groupHoppingEnabledTransformPrecoding[j] = PUSCH_ConfigCommon__groupHoppingEnabledTransformPrecoding_enabled; + } + + NRRRC_CONFIGURATION_REQ (msg_p).msg3_DeltaPreamble[j] = msg3_DeltaPreamble; + if ((msg3_DeltaPreamble <-1) || (msg3_DeltaPreamble>6)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for msg3_DeltaPreamble choice: -1..6 !\n", + RC.config_file_name, i, msg3_DeltaPreamble); + } + + NRRRC_CONFIGURATION_REQ (msg_p).p0_NominalWithGrant[j] = p0_NominalWithGrant; + if ((p0_NominalWithGrant <-202) || (p0_NominalWithGrant>24)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for p0_NominalWithGrant choice: -202..24 !\n", + RC.config_file_name, i, p0_NominalWithGrant); + } + + /////////////////////////////////NR PUSCH-TimeDomainResourceAllocation/////////////////////////// + NRRRC_CONFIGURATION_REQ (msg_p).PUSCH_TimeDomainResourceAllocation_k2[j] = PUSCH_TimeDomainResourceAllocation_k2; + if ((PUSCH_TimeDomainResourceAllocation_k2 <0) || (PUSCH_TimeDomainResourceAllocation_k2>7)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for PUSCH_TimeDomainResourceAllocation_k2 choice: 0..7 !\n", + RC.config_file_name, i, PUSCH_TimeDomainResourceAllocation_k2); + } + + if (strcmp(PUSCH_TimeDomainResourceAllocation_mappingType , "typeA") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).PUSCH_TimeDomainResourceAllocation_mappingType[j] = PUSCH_TimeDomainResourceAllocation__mappingType_typeA; + }else if (strcmp(PUSCH_TimeDomainResourceAllocation_mappingType , "typeB") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).PUSCH_TimeDomainResourceAllocation_mappingType[j] = PUSCH_TimeDomainResourceAllocation__mappingType_typeB; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for PUSCH_TimeDomainResourceAllocation_mappingType !\n", + RC.config_file_name, i, PUSCH_TimeDomainResourceAllocation_mappingType); + } + + /////////////////////////////////NR PUCCH-ConfigCommon/////////////////////////// + if (strcmp(pucch_GroupHopping , "neither") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).pucch_GroupHopping[j] = PUCCH_ConfigCommon__pucch_GroupHopping_neither; + }else if (strcmp(pucch_GroupHopping , "enable") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).pucch_GroupHopping[j] = PUCCH_ConfigCommon__pucch_GroupHopping_enable; + }else if (strcmp(pucch_GroupHopping , "disable") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).pucch_GroupHopping[j] = PUCCH_ConfigCommon__pucch_GroupHopping_disable; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for pucch_GroupHopping !\n", + RC.config_file_name, i, pucch_GroupHopping); + } + + NRRRC_CONFIGURATION_REQ (msg_p).p0_nominal[j] = p0_nominal; + if ((p0_nominal <-202) || (p0_nominal>24)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for p0_nominal choice: -202..24 !\n", + RC.config_file_name, i, p0_nominal); + } + + //////////////////////////////////NR PDSCH-TimeDomainResourceAllocation/////////////////////////// + NRRRC_CONFIGURATION_REQ (msg_p).PDSCH_TimeDomainResourceAllocation_k0[j] = PDSCH_TimeDomainResourceAllocation_k0; + if ((PDSCH_TimeDomainResourceAllocation_k0 <1) || (PDSCH_TimeDomainResourceAllocation_k0>3)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for PDSCH_TimeDomainResourceAllocation_k0 choice: 0..7 !\n", + RC.config_file_name, i, PDSCH_TimeDomainResourceAllocation_k0); + } + + if (strcmp(PDSCH_TimeDomainResourceAllocation_mappingType , "typeA") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).PDSCH_TimeDomainResourceAllocation_mappingType[j] = PDSCH_TimeDomainResourceAllocation__mappingType_typeA; + }else if (strcmp(PDSCH_TimeDomainResourceAllocation_mappingType , "typeB") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).PDSCH_TimeDomainResourceAllocation_mappingType[j] = PDSCH_TimeDomainResourceAllocation__mappingType_typeB; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for PDSCH_TimeDomainResourceAllocation_mappingType !\n", + RC.config_file_name, i, PDSCH_TimeDomainResourceAllocation_mappingType); + } + + //////////////////////////////////NR RateMatchPattern/////////////////////////// + NRRRC_CONFIGURATION_REQ (msg_p).rateMatchPatternId[j] = rateMatchPatternId; + if ((rateMatchPatternId <0) || (rateMatchPatternId>3)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for rateMatchPatternId choice: 0..3 !\n", + RC.config_file_name, i, rateMatchPatternId); + } + + if (strcmp(RateMatchPattern_patternType , "NOTHING") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPattern_patternType[j] = RateMatchPattern__patternType_PR_NOTHING; + }else if (strcmp(RateMatchPattern_patternType , "bitmaps") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPattern_patternType[j] = RateMatchPattern__patternType_PR_bitmaps; + }else if (strcmp(RateMatchPattern_patternType , "controlResourceSet") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPattern_patternType[j] = RateMatchPattern__patternType_PR_controlResourceSet; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for RateMatchPattern_patternType !\n", + RC.config_file_name, i, RateMatchPattern_patternType); + } + + if (strcmp(symbolsInResourceBlock , "NOTHING") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).symbolsInResourceBlock[j] = RateMatchPattern__patternType__bitmaps__symbolsInResourceBlock_PR_NOTHING; + }else if (strcmp(symbolsInResourceBlock , "oneSlot") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).symbolsInResourceBlock[j] = RateMatchPattern__patternType__bitmaps__symbolsInResourceBlock_PR_oneSlot; + }else if (strcmp(symbolsInResourceBlock , "twoSlots") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).symbolsInResourceBlock[j] = RateMatchPattern__patternType__bitmaps__symbolsInResourceBlock_PR_twoSlots; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for symbolsInResourceBlock !\n", + RC.config_file_name, i, symbolsInResourceBlock); + } + + switch(periodicityAndPattern){ + case 2: + NRRRC_CONFIGURATION_REQ (msg_p).periodicityAndPattern[j] = RateMatchPattern__patternType__bitmaps__periodicityAndPattern_PR_n2; + break; + case 4: + NRRRC_CONFIGURATION_REQ (msg_p).periodicityAndPattern[j] = RateMatchPattern__patternType__bitmaps__periodicityAndPattern_PR_n4; + break; + case 5: + NRRRC_CONFIGURATION_REQ (msg_p).periodicityAndPattern[j] = RateMatchPattern__patternType__bitmaps__periodicityAndPattern_PR_n5; + break; + case 8: + NRRRC_CONFIGURATION_REQ (msg_p).periodicityAndPattern[j] = RateMatchPattern__patternType__bitmaps__periodicityAndPattern_PR_n8; + break; + case 10: + NRRRC_CONFIGURATION_REQ (msg_p).periodicityAndPattern[j] = RateMatchPattern__patternType__bitmaps__periodicityAndPattern_PR_n10; + break; + case 20: + NRRRC_CONFIGURATION_REQ (msg_p).periodicityAndPattern[j] = RateMatchPattern__patternType__bitmaps__periodicityAndPattern_PR_n20; + break; + case 40: + NRRRC_CONFIGURATION_REQ (msg_p).periodicityAndPattern[j] = RateMatchPattern__patternType__bitmaps__periodicityAndPattern_PR_n40; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for periodicityAndPattern choice: 2,4,5,8,10,20,40 !\n", + RC.config_file_name, i, periodicityAndPattern); + break; + } + + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPattern_controlResourceSet[j] = RateMatchPattern_controlResourceSet; + if ((RateMatchPattern_controlResourceSet <0) || (RateMatchPattern_controlResourceSet>11)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for RateMatchPattern_controlResourceSet choice: 0..3 !\n", + RC.config_file_name, i, RateMatchPattern_controlResourceSet); + } + + if (strcmp(RateMatchPattern_subcarrierSpacing,"kHz15")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPattern_subcarrierSpacing[j] = SubcarrierSpacing_kHz15; + }else if (strcmp(pusch_alpha,"kHz30")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPattern_subcarrierSpacing[j] = SubcarrierSpacing_kHz30; + }else if (strcmp(pusch_alpha,"kHz60")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPattern_subcarrierSpacing[j] = SubcarrierSpacing_kHz60; + }else if (strcmp(pusch_alpha,"kHz120")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPattern_subcarrierSpacing[j] = SubcarrierSpacing_kHz120; + }else if (strcmp(pusch_alpha,"kHz240")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPattern_subcarrierSpacing[j] = SubcarrierSpacing_kHz240; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for RateMatchPattern_subcarrierSpacing choice: minusinfinity,kHz15,kHz30,kHz60,kHz120,kHz240!\n", + RC.config_file_name, i, RateMatchPattern_subcarrierSpacing); + } + + if (strcmp(RateMatchPattern_mode , "dynamic") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPattern_mode[j] = RateMatchPattern__mode_dynamic; + }else if (strcmp(RateMatchPattern_mode , "semiStatic") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPattern_mode[j] = RateMatchPattern__mode_semiStatic; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for RateMatchPattern_mode !\n", + RC.config_file_name, i, RateMatchPattern_mode); + } + + //////////////////////////////////NR PDCCH-ConfigCommon/////////////////////////// + NRRRC_CONFIGURATION_REQ (msg_p).searchSpaceSIB1[j] = searchSpaceSIB1; + if ((searchSpaceSIB1 <0) || (searchSpaceSIB1>39)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for searchSpaceSIB1 choice: 0..39 !\n", + RC.config_file_name, i, searchSpaceSIB1); + } + + NRRRC_CONFIGURATION_REQ (msg_p).searchSpaceOtherSystemInformation[j] = searchSpaceOtherSystemInformation; + if ((searchSpaceOtherSystemInformation <0) || (searchSpaceOtherSystemInformation>39)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for searchSpaceOtherSystemInformation choice: 0..39 !\n", + RC.config_file_name, i, searchSpaceOtherSystemInformation); + } + + NRRRC_CONFIGURATION_REQ (msg_p).pagingSearchSpace[j] = pagingSearchSpace; + if ((pagingSearchSpace <0) || (pagingSearchSpace>39)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for pagingSearchSpace choice: 0..39 !\n", + RC.config_file_name, i, pagingSearchSpace); + } + + NRRRC_CONFIGURATION_REQ (msg_p).ra_SearchSpace[j] = ra_SearchSpace; + if ((ra_SearchSpace <0) || (ra_SearchSpace>39)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for ra_SearchSpace choice: 0..39 !\n", + RC.config_file_name, i, ra_SearchSpace); + } + + NRRRC_CONFIGURATION_REQ (msg_p).rach_ra_ControlResourceSet[j] = rach_ra_ControlResourceSet; + if ((rach_ra_ControlResourceSet <0) || (rach_ra_ControlResourceSet>11)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for rach_ra_ControlResourceSet choice: 0..11 !\n", + RC.config_file_name, i, rach_ra_ControlResourceSet); + } + + //////////////////////////////////NR PDCCH commonControlResourcesSets/////////////////////////// + NRRRC_CONFIGURATION_REQ (msg_p).PDCCH_common_controlResourceSetId[j] = PDCCH_common_controlResourceSetId; + if ((PDCCH_common_controlResourceSetId <0) || (PDCCH_common_controlResourceSetId>11)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for PDCCH_common_controlResourceSetId choice: 0..11 !\n", + RC.config_file_name, i, PDCCH_common_controlResourceSetId); + } + + NRRRC_CONFIGURATION_REQ (msg_p).PDCCH_common_ControlResourceSet_duration[j] = PDCCH_common_ControlResourceSet_duration; + if ((PDCCH_common_ControlResourceSet_duration <0) || (PDCCH_common_ControlResourceSet_duration>3)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for PDCCH_common_ControlResourceSet_duration choice: 0..11 !\n", + RC.config_file_name, i, PDCCH_common_ControlResourceSet_duration); + } + + if (strcmp(PDCCH_cce_REG_MappingType , "NOTHING") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).PDCCH_cce_REG_MappingType[j] = ControlResourceSet__cce_REG_MappingType_PR_NOTHING; + }else if (strcmp(PDCCH_cce_REG_MappingType , "interleaved") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).PDCCH_cce_REG_MappingType[j] = ControlResourceSet__cce_REG_MappingType_PR_interleaved; + }else if (strcmp(PDCCH_cce_REG_MappingType , "nonInterleaved") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).PDCCH_cce_REG_MappingType[j] = ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for PDCCH_cce_REG_MappingType !\n", + RC.config_file_name, i, PDCCH_cce_REG_MappingType); + } + + switch(PDCCH_reg_BundleSize){ + case 2: + NRRRC_CONFIGURATION_REQ (msg_p).PDCCH_reg_BundleSize[j] = ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n2; + break; + case 3: + NRRRC_CONFIGURATION_REQ (msg_p).PDCCH_reg_BundleSize[j] = ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n3; + break; + case 6: + NRRRC_CONFIGURATION_REQ (msg_p).PDCCH_reg_BundleSize[j] = ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for PDCCH_reg_BundleSize choice: 2,3,6 !\n", + RC.config_file_name, i, PDCCH_reg_BundleSize); + break; + } + + switch(PDCCH_interleaverSize){ + case 2: + NRRRC_CONFIGURATION_REQ (msg_p).PDCCH_interleaverSize[j] = ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n2; + break; + case 3: + NRRRC_CONFIGURATION_REQ (msg_p).PDCCH_interleaverSize[j] = ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n3; + break; + case 6: + NRRRC_CONFIGURATION_REQ (msg_p).PDCCH_interleaverSize[j] = ControlResourceSet__cce_REG_MappingType__interleaved__reg_BundleSize_n6; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for PDCCH_interleaverSize choice: 2,3,6 !\n", + RC.config_file_name, i, PDCCH_interleaverSize); + break; + } + + NRRRC_CONFIGURATION_REQ (msg_p).PDCCH_shiftIndex[j] = PDCCH_shiftIndex; + if ((PDCCH_shiftIndex <0) || (PDCCH_shiftIndex>274)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for PDCCH_shiftIndex choice: 0..274 !\n", + RC.config_file_name, i, PDCCH_shiftIndex); + } + + if (strcmp(PDCCH_precoderGranularity , "sameAsREG-bundle") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).PDCCH_precoderGranularity[j] = ControlResourceSet__precoderGranularity_sameAsREG_bundle; + }else if (strcmp(PDCCH_precoderGranularity , "allContiguousRBs") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).PDCCH_precoderGranularity[j] = ControlResourceSet__precoderGranularity_allContiguousRBs; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for PDCCH_precoderGranularity !\n", + RC.config_file_name, i, PDCCH_precoderGranularity); + } + + if (strcmp(tci_PresentInDCI , "ENABLE") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).tci_PresentInDCI[j] = ControlResourceSet__tci_PresentInDCI_enabled; + } + + //////////////////////////////////NR PDCCH commonControlResourcesSets/////////////////////////// + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpaceId[j] = SearchSpaceId; + if ((SearchSpaceId <0) || (SearchSpaceId>39)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for SearchSpaceId choice: 0..39 !\n", + RC.config_file_name, i, SearchSpaceId); + } + + NRRRC_CONFIGURATION_REQ (msg_p).commonSearchSpaces_controlResourceSetId[j] = commonSearchSpaces_controlResourceSetId; + if ((commonSearchSpaces_controlResourceSetId <0) || (commonSearchSpaces_controlResourceSetId>11)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for commonSearchSpaces_controlResourceSetId choice: 0..11 !\n", + RC.config_file_name, i, commonSearchSpaces_controlResourceSetId); + } + + if (strcmp(SearchSpace_monitoringSlotPeriodicityAndOffset_choice , "sl1") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_monitoringSlotPeriodicityAndOffset_choice[j] = SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1; + + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_monitoringSlotPeriodicityAndOffset_sl1[j] = NULL; + + }else if (strcmp(SearchSpace_monitoringSlotPeriodicityAndOffset_choice , "sl2") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_monitoringSlotPeriodicityAndOffset_choice[j] = SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2; + + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_monitoringSlotPeriodicityAndOffset_sl2[j] = SearchSpace_monitoringSlotPeriodicityAndOffset_sl2; + if ((SearchSpace_monitoringSlotPeriodicityAndOffset_sl2 <0) || (SearchSpace_monitoringSlotPeriodicityAndOffset_sl2>1)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for SearchSpace_monitoringSlotPeriodicityAndOffset_sl2 choice: 0..1 !\n", + RC.config_file_name, i, SearchSpace_monitoringSlotPeriodicityAndOffset_sl2); + } + + }else if (strcmp(SearchSpace_monitoringSlotPeriodicityAndOffset_choice , "sl4") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_monitoringSlotPeriodicityAndOffset_choice[j] = SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4; + + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_monitoringSlotPeriodicityAndOffset_sl4[j] = SearchSpace_monitoringSlotPeriodicityAndOffset_sl4; + if ((SearchSpace_monitoringSlotPeriodicityAndOffset_sl4 <0) || (SearchSpace_monitoringSlotPeriodicityAndOffset_sl4>3)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for SearchSpace_monitoringSlotPeriodicityAndOffset_sl4 choice: 0..3 !\n", + RC.config_file_name, i, SearchSpace_monitoringSlotPeriodicityAndOffset_sl4); + } + + }else if (strcmp(SearchSpace_monitoringSlotPeriodicityAndOffset_choice , "sl5") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_monitoringSlotPeriodicityAndOffset_choice[j] = SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5; + + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_monitoringSlotPeriodicityAndOffset_sl5[j] = SearchSpace_monitoringSlotPeriodicityAndOffset_sl5; + if ((SearchSpace_monitoringSlotPeriodicityAndOffset_sl5 <0) || (SearchSpace_monitoringSlotPeriodicityAndOffset_sl5>4)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for SearchSpace_monitoringSlotPeriodicityAndOffset_sl5 choice: 0..4 !\n", + RC.config_file_name, i, SearchSpace_monitoringSlotPeriodicityAndOffset_sl5); + } + + }else if (strcmp(SearchSpace_monitoringSlotPeriodicityAndOffset_choice , "sl8") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_monitoringSlotPeriodicityAndOffset_choice[j] = SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8; + + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_monitoringSlotPeriodicityAndOffset_sl8[j] = SearchSpace_monitoringSlotPeriodicityAndOffset_sl8; + if ((SearchSpace_monitoringSlotPeriodicityAndOffset_sl8 <0) || (SearchSpace_monitoringSlotPeriodicityAndOffset_sl8>7)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for SearchSpace_monitoringSlotPeriodicityAndOffset_sl8 choice: 0..7 !\n", + RC.config_file_name, i, SearchSpace_monitoringSlotPeriodicityAndOffset_sl8); + } + + }else if (strcmp(SearchSpace_monitoringSlotPeriodicityAndOffset_choice , "sl10") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_monitoringSlotPeriodicityAndOffset_choice[j] = SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10; + + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_monitoringSlotPeriodicityAndOffset_sl10[j] = SearchSpace_monitoringSlotPeriodicityAndOffset_sl10; + if ((SearchSpace_monitoringSlotPeriodicityAndOffset_sl10 <0) || (SearchSpace_monitoringSlotPeriodicityAndOffset_sl10>9)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for SearchSpace_monitoringSlotPeriodicityAndOffset_sl10 choice: 0..9 !\n", + RC.config_file_name, i, SearchSpace_monitoringSlotPeriodicityAndOffset_sl10); + } + + }else if (strcmp(SearchSpace_monitoringSlotPeriodicityAndOffset_choice , "sl16") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_monitoringSlotPeriodicityAndOffset_choice[j] = SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16; + + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_monitoringSlotPeriodicityAndOffset_sl16[j] = SearchSpace_monitoringSlotPeriodicityAndOffset_sl16; + if ((SearchSpace_monitoringSlotPeriodicityAndOffset_sl16 <0) || (SearchSpace_monitoringSlotPeriodicityAndOffset_sl16>15)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for SearchSpace_monitoringSlotPeriodicityAndOffset_sl16 choice: 0..15 !\n", + RC.config_file_name, i, SearchSpace_monitoringSlotPeriodicityAndOffset_sl16); + } + + }else if (strcmp(SearchSpace_monitoringSlotPeriodicityAndOffset_choice , "sl20") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_monitoringSlotPeriodicityAndOffset_choice[j] = SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20; + + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_monitoringSlotPeriodicityAndOffset_sl20[j] = SearchSpace_monitoringSlotPeriodicityAndOffset_sl20; + if ((SearchSpace_monitoringSlotPeriodicityAndOffset_sl20 <0) || (SearchSpace_monitoringSlotPeriodicityAndOffset_sl20>19)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for SearchSpace_monitoringSlotPeriodicityAndOffset_sl20 choice: 0..19 !\n", + RC.config_file_name, i, SearchSpace_monitoringSlotPeriodicityAndOffset_sl20); + } + + }else if (strcmp(SearchSpace_monitoringSlotPeriodicityAndOffset_choice , "UNABLE") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_monitoringSlotPeriodicityAndOffset_choice[j] = SearchSpace__monitoringSlotPeriodicityAndOffset_PR_NOTHING; + + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for SearchSpace_monitoringSlotPeriodicityAndOffset_choice !\n", + RC.config_file_name, i, SearchSpace_monitoringSlotPeriodicityAndOffset_choice); + }// End if (strcmp(SearchSpace_monitoringSlotPeriodicityAndOffset_choice , "sl1") + + + switch(SearchSpace_nrofCandidates_aggregationLevel1){ + case 0: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel1[j] = SearchSpace__nrofCandidates__aggregationLevel1_n0; + break; + case 1: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel1[j] = SearchSpace__nrofCandidates__aggregationLevel1_n1; + break; + case 2: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel1[j] = SearchSpace__nrofCandidates__aggregationLevel1_n2; + break; + case 3: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel1[j] = SearchSpace__nrofCandidates__aggregationLevel1_n3; + break; + case 4: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel1[j] = SearchSpace__nrofCandidates__aggregationLevel1_n4; + break; + case 5: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel1[j] = SearchSpace__nrofCandidates__aggregationLevel1_n5; + break; + case 6: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel1[j] = SearchSpace__nrofCandidates__aggregationLevel1_n6; + break; + case 8: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel1[j] = SearchSpace__nrofCandidates__aggregationLevel1_n8; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for SearchSpace_nrofCandidates_aggregationLevel1 choice: 0,1,2,3,4,5,6,8 !\n", + RC.config_file_name, i, SearchSpace_nrofCandidates_aggregationLevel1); + break; + } + + switch(SearchSpace_nrofCandidates_aggregationLevel2){ + case 0: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel2[j] = SearchSpace__nrofCandidates__aggregationLevel2_n0; + break; + case 1: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel2[j] = SearchSpace__nrofCandidates__aggregationLevel2_n1; + break; + case 2: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel2[j] = SearchSpace__nrofCandidates__aggregationLevel2_n2; + break; + case 3: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel2[j] = SearchSpace__nrofCandidates__aggregationLevel2_n3; + break; + case 4: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel2[j] = SearchSpace__nrofCandidates__aggregationLevel2_n4; + break; + case 5: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel2[j] = SearchSpace__nrofCandidates__aggregationLevel2_n5; + break; + case 6: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel2[j] = SearchSpace__nrofCandidates__aggregationLevel2_n6; + break; + case 8: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel2[j] = SearchSpace__nrofCandidates__aggregationLevel2_n8; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for SearchSpace_nrofCandidates_aggregationLevel2 choice: 0,1,2,3,4,5,6,8 !\n", + RC.config_file_name, i, SearchSpace_nrofCandidates_aggregationLevel2); + break; + } + + switch(SearchSpace_nrofCandidates_aggregationLevel4){ + case 0: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel4[j] = SearchSpace__nrofCandidates__aggregationLevel4_n0; + break; + case 1: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel4[j] = SearchSpace__nrofCandidates__aggregationLevel4_n1; + break; + case 2: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel4[j] = SearchSpace__nrofCandidates__aggregationLevel4_n2; + break; + case 3: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel4[j] = SearchSpace__nrofCandidates__aggregationLevel4_n3; + break; + case 4: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel4[j] = SearchSpace__nrofCandidates__aggregationLevel4_n4; + break; + case 5: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel4[j] = SearchSpace__nrofCandidates__aggregationLevel4_n5; + break; + case 6: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel4[j] = SearchSpace__nrofCandidates__aggregationLevel4_n6; + break; + case 8: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel4[j] = SearchSpace__nrofCandidates__aggregationLevel4_n8; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for SearchSpace_nrofCandidates_aggregationLevel4 choice: 0,1,2,3,4,5,6,8 !\n", + RC.config_file_name, i, SearchSpace_nrofCandidates_aggregationLevel4); + break; + } + + switch(SearchSpace_nrofCandidates_aggregationLevel8){ + case 0: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel8[j] = SearchSpace__nrofCandidates__aggregationLevel8_n0; + break; + case 1: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel8[j] = SearchSpace__nrofCandidates__aggregationLevel8_n1; + break; + case 2: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel8[j] = SearchSpace__nrofCandidates__aggregationLevel8_n2; + break; + case 3: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel8[j] = SearchSpace__nrofCandidates__aggregationLevel8_n3; + break; + case 4: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel8[j] = SearchSpace__nrofCandidates__aggregationLevel8_n4; + break; + case 5: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel8[j] = SearchSpace__nrofCandidates__aggregationLevel8_n5; + break; + case 6: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel8[j] = SearchSpace__nrofCandidates__aggregationLevel8_n6; + break; + case 8: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel8[j] = SearchSpace__nrofCandidates__aggregationLevel8_n8; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for SearchSpace_nrofCandidates_aggregationLevel8 choice: 0,1,2,3,4,5,6,8 !\n", + RC.config_file_name, i, SearchSpace_nrofCandidates_aggregationLevel8); + break; + } + + switch(SearchSpace_nrofCandidates_aggregationLevel16){ + case 0: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel16[j] = SearchSpace__nrofCandidates__aggregationLevel16_n0; + break; + case 1: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel16[j] = SearchSpace__nrofCandidates__aggregationLevel16_n1; + break; + case 2: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel16[j] = SearchSpace__nrofCandidates__aggregationLevel16_n2; + break; + case 3: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel16[j] = SearchSpace__nrofCandidates__aggregationLevel16_n3; + break; + case 4: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel16[j] = SearchSpace__nrofCandidates__aggregationLevel16_n4; + break; + case 5: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel16[j] = SearchSpace__nrofCandidates__aggregationLevel16_n5; + break; + case 6: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel16[j] = SearchSpace__nrofCandidates__aggregationLevel16_n6; + break; + case 8: + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_nrofCandidates_aggregationLevel16[j] = SearchSpace__nrofCandidates__aggregationLevel16_n8; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for SearchSpace_nrofCandidates_aggregationLevel16 choice: 0,1,2,3,4,5,6,8 !\n", + RC.config_file_name, i, SearchSpace_nrofCandidates_aggregationLevel16); + break; + } + + if (strcmp(SearchSpace_searchSpaceType , "NOTHING") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_searchSpaceType[j] = SearchSpace__searchSpaceType_PR_NOTHING; + }else if (strcmp(SearchSpace_searchSpaceType , "common") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_searchSpaceType[j] = SearchSpace__searchSpaceType_PR_common; + }else if (strcmp(SearchSpace_searchSpaceType , "ue_Specific") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).SearchSpace_searchSpaceType[j] = SearchSpace__searchSpaceType_PR_ue_Specific; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for SearchSpace_searchSpaceType !\n", + RC.config_file_name, i, SearchSpace_searchSpaceType); + } + + switch(Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel1){ + case 1: + NRRRC_CONFIGURATION_REQ (msg_p).Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel1[j] = SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel1_n1; + break; + case 2: + NRRRC_CONFIGURATION_REQ (msg_p).Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel1[j] = SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel1_n2; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel1 choice: 1,2 !\n", + RC.config_file_name, i, Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel1); + break; + } + + switch(Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel2){ + case 1: + NRRRC_CONFIGURATION_REQ (msg_p).Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel2[j] = SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel2_n1; + break; + case 2: + NRRRC_CONFIGURATION_REQ (msg_p).Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel2[j] = SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel2_n2; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel2 choice: 1,2 !\n", + RC.config_file_name, i, Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel2); + break; + } + + switch(Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel4){ + case 1: + NRRRC_CONFIGURATION_REQ (msg_p).Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel4[j] = SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel4_n1; + break; + case 2: + NRRRC_CONFIGURATION_REQ (msg_p).Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel4[j] = SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel4_n2; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel4 choice: 1,2 !\n", + RC.config_file_name, i, Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel4); + break; + } + + switch(Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel8){ + case 1: + NRRRC_CONFIGURATION_REQ (msg_p).Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel8[j] = SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel8_n1; + break; + case 2: + NRRRC_CONFIGURATION_REQ (msg_p).Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel8[j] = SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel8_n2; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel8 choice: 1,2 !\n", + RC.config_file_name, i, Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel8); + break; + } + + switch(Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel16){ + case 1: + NRRRC_CONFIGURATION_REQ (msg_p).Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel16[j] = SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel16_n1; + break; + case 2: + NRRRC_CONFIGURATION_REQ (msg_p).Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel16[j] = SearchSpace__searchSpaceType__common__dci_Format2_0__nrofCandidates_SFI__aggregationLevel16_n2; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel16 choice: 1,2 !\n", + RC.config_file_name, i, Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel16); + break; + } + + switch(Common_dci_Format2_3_monitoringPeriodicity){ + case 1: + NRRRC_CONFIGURATION_REQ (msg_p).Common_dci_Format2_3_monitoringPeriodicity[j] = SearchSpace__searchSpaceType__common__dci_Format2_3__monitoringPeriodicity_n1; + break; + case 2: + NRRRC_CONFIGURATION_REQ (msg_p).Common_dci_Format2_3_monitoringPeriodicity[j] = SearchSpace__searchSpaceType__common__dci_Format2_3__monitoringPeriodicity_n2; + break; + case 4: + NRRRC_CONFIGURATION_REQ (msg_p).Common_dci_Format2_3_monitoringPeriodicity[j] = SearchSpace__searchSpaceType__common__dci_Format2_3__monitoringPeriodicity_n4; + break; + case 5: + NRRRC_CONFIGURATION_REQ (msg_p).Common_dci_Format2_3_monitoringPeriodicity[j] = SearchSpace__searchSpaceType__common__dci_Format2_3__monitoringPeriodicity_n5; + break; + case 8: + NRRRC_CONFIGURATION_REQ (msg_p).Common_dci_Format2_3_monitoringPeriodicity[j] = SearchSpace__searchSpaceType__common__dci_Format2_3__monitoringPeriodicity_n8; + break; + case 10: + NRRRC_CONFIGURATION_REQ (msg_p).Common_dci_Format2_3_monitoringPeriodicity[j] = SearchSpace__searchSpaceType__common__dci_Format2_3__monitoringPeriodicity_n10; + break; + case 16: + NRRRC_CONFIGURATION_REQ (msg_p).Common_dci_Format2_3_monitoringPeriodicity[j] = SearchSpace__searchSpaceType__common__dci_Format2_3__monitoringPeriodicity_n16; + break; + case 20: + NRRRC_CONFIGURATION_REQ (msg_p).Common_dci_Format2_3_monitoringPeriodicity[j] = SearchSpace__searchSpaceType__common__dci_Format2_3__monitoringPeriodicity_n20; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for Common_dci_Format2_3_monitoringPeriodicity choice: 1,2,4,5,8,10,16,20 !\n", + RC.config_file_name, i, Common_dci_Format2_3_monitoringPeriodicity); + break; + } + + switch(Common_dci_Format2_3_nrofPDCCH_Candidates){ + case 1: + NRRRC_CONFIGURATION_REQ (msg_p).Common_dci_Format2_3_nrofPDCCH_Candidates[j] = SearchSpace__searchSpaceType__common__dci_Format2_3__nrofPDCCH_Candidates_n1; + break; + case 2: + NRRRC_CONFIGURATION_REQ (msg_p).Common_dci_Format2_3_nrofPDCCH_Candidates[j] = SearchSpace__searchSpaceType__common__dci_Format2_3__nrofPDCCH_Candidates_n2; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for Common_dci_Format2_3_nrofPDCCH_Candidates choice: 1,2 !\n", + RC.config_file_name, i, Common_dci_Format2_3_nrofPDCCH_Candidates); + break; + } + + if (strcmp(ue_Specific__dci_Formats , "formats0-0-And-1-0") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).ue_Specific__dci_Formats[j] = SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_0_And_1_0; + }else if (strcmp(ue_Specific__dci_Formats , "formats0-1-And-1-1") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).ue_Specific__dci_Formats[j] = SearchSpace__searchSpaceType__ue_Specific__dci_Formats_formats0_1_And_1_1; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for ue_Specific__dci_Formats !\n", + RC.config_file_name, i, ue_Specific__dci_Formats); + } + + + }//End for (j = 0; j < CCsParamList.numelt ;j++) + + }//End if ( CCsParamList.numelt> 0) + + }//End for (k=0; k 0) + + +}//End RCconfig_NRRRC function + +void NRRCConfig(void) { + + // paramlist_def_t MACRLCParamList = {CONFIG_STRING_MACRLC_LIST,NULL,0}; + // paramlist_def_t L1ParamList = {CONFIG_STRING_L1_LIST,NULL,0}; + // paramlist_def_t RUParamList = {CONFIG_STRING_RU_LIST,NULL,0}; + paramdef_t GNBSParams[] = GNBSPARAMS_DESC; + paramlist_def_t CCsParamList = {GNB_CONFIG_STRING_COMPONENT_CARRIERS,NULL,0}; + + char aprefix[MAX_OPTNAME_SIZE*2 + 8]; + + + +/* get global parameters, defined outside any section in the config file */ + + printf("Getting GNBSParams\n"); + + config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL); + RC.nb_nr_inst = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; + + if (RC.nb_nr_inst > 0) { + RC.nb_CC = (int *)malloc((1+RC.nb_nr_inst)*sizeof(int)); + for (int i=0;i +#include +#include +#include + +#include "commonDef.h" +#include "platform_types.h" +#include "platform_constants.h" +#include "PHY/impl_defs_lte.h" +#include "PHY/defs.h" +#include "s1ap_messages_types.h" +//#ifdef CMAKER +//#include "SystemInformationBlockType2.h" +//#include "rrc_messages_types.h" +//#else +//#include "RRC/LITE/MESSAGES/SystemInformationBlockType2.h" +//#endif +#include "intertask_interface_types.h" +#include "RRC/NR/defs_NR.h" + +#define IPV4_STR_ADDR_TO_INT_NWBO(AdDr_StR,NwBo,MeSsAgE ) do {\ + struct in_addr inp;\ + if ( inet_aton(AdDr_StR, &inp ) < 0 ) {\ + AssertFatal (0, MeSsAgE);\ + } else {\ + NwBo = inp.s_addr;\ + }\ + } while (0); + +/** @defgroup _enb_app ENB APP + * @ingroup _oai2 + * @{ + */ + +// Hard to find a defined value for max enb... +#define MAX_ENB 16 + +/* +typedef struct mme_ip_address_s { + unsigned ipv4:1; + unsigned ipv6:1; + unsigned active:1; + char *ipv4_address; + char *ipv6_address; +} mme_ip_address_t; + +typedef struct ru_config_s { + // indicates if local or remote rf is used (1 == LOCAL) + unsigned local_rf:1; + // indicates if UDP socket is used + unsigned udp:1; + // indicates if RAW socket is used + unsigned raw:1; + char *ru_if_name; + char *local_address; + char *remote_address; + uint16_t local_port; + uint16_t remote_port; + uint8_t udpif4p5; + uint8_t rawif4p5; + uint8_t rawif5_mobipass; + uint8_t if_compress; +} ru_config_t; +*/ +//extern void RCconfig_RU(void); +//extern void RCconfig_flexran(void); +//extern void RCconfig_L1(void); +//extern void RCconfig_macrlc(void); +//extern int RCconfig_gtpu(void ); +extern void NRRCConfig(void); + +//void enb_config_display(void); +//void ru_config_display(void); + +int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, eNB_RRC_INST *rrc); +//int RCconfig_S1(MessageDef *msg_p, uint32_t i); + +#endif /* GNB_CONFIG_H_ */ +/** @} */ diff --git a/openair2/ENB_APP/gnb_paramdef.h b/openair2/ENB_APP/gnb_paramdef.h new file mode 100644 index 0000000000..e909da3ce5 --- /dev/null +++ b/openair2/ENB_APP/gnb_paramdef.h @@ -0,0 +1,404 @@ +/* + * 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 + */ + +/*! \file openair2/GNB_APP/gnb_paramdef.f + * \brief definition of configuration parameters for all eNodeB modules + * \author Francois TABURET + * \date 2017 + * \version 0.1 + * \company NOKIA BellLabs France + * \email: francois.taburet@nokia-bell-labs.com + * \note + * \warning + */ + +#include "common/config/config_paramdesc.h" +#include "NRRRC_paramsvalues.h" + + +#define GNB_CONFIG_STRING_CC_NODE_FUNCTION "node_function" +#define GNB_CONFIG_STRING_CC_NODE_TIMING "node_timing" +#define GNB_CONFIG_STRING_CC_NODE_SYNCH_REF "node_synch_ref" + + +// OTG config per GNB-UE DL +#define GNB_CONF_STRING_OTG_CONFIG "otg_config" +#define GNB_CONF_STRING_OTG_UE_ID "ue_id" +#define GNB_CONF_STRING_OTG_APP_TYPE "app_type" +#define GNB_CONF_STRING_OTG_BG_TRAFFIC "bg_traffic" + +#if defined(ENABLE_ITTI) && defined(ENABLE_USE_MME) +extern int asn_debug; +extern int asn1_xer_print; +#endif + +#ifdef LIBCONFIG_LONG +#define libconfig_int long +#else +#define libconfig_int int +#endif + +typedef enum { + RU = 0, + L1 = 1, + L2 = 2, + L3 = 3, + S1 = 4, + lastel = 5 +} NRRC_config_functions_t; + +#define CONFIG_STRING_ACTIVE_RUS "Active_RUs" +/*------------------------------------------------------------------------------------------------------------------------------------------*/ +/* RUs configuration section name */ +#define CONFIG_STRING_RU_LIST "RUs" +#define CONFIG_STRING_RU_CONFIG "ru_config" + +/* RUs configuration parameters name */ +#define CONFIG_STRING_RU_LOCAL_IF_NAME "local_if_name" +#define CONFIG_STRING_RU_LOCAL_ADDRESS "local_address" +#define CONFIG_STRING_RU_REMOTE_ADDRESS "remote_address" +#define CONFIG_STRING_RU_LOCAL_PORTC "local_portc" +#define CONFIG_STRING_RU_REMOTE_PORTC "remote_portc" +#define CONFIG_STRING_RU_LOCAL_PORTD "local_portd" +#define CONFIG_STRING_RU_REMOTE_PORTD "remote_portd" +#define CONFIG_STRING_RU_LOCAL_RF "local_rf" +#define CONFIG_STRING_RU_TRANSPORT_PREFERENCE "tr_preference" +#define CONFIG_STRING_RU_BAND_LIST "bands" +#define CONFIG_STRING_RU_GNB_LIST "gNB_instances" +#define CONFIG_STRING_RU_NB_TX "nb_tx" +#define CONFIG_STRING_RU_NB_RX "nb_rx" +#define CONFIG_STRING_RU_ATT_TX "att_tx" +#define CONFIG_STRING_RU_ATT_RX "att_rx" +#define CONFIG_STRING_RU_MAX_RS_EPRE "max_pdschReferenceSignalPower" +#define CONFIG_STRING_RU_MAX_RXGAIN "max_rxgain" +#define CONFIG_STRING_RU_IF_COMPRESSION "if_compression" +#define CONFIG_STRING_RU_NBIOTRRC_LIST "NbIoT_RRC_instances" + +#define RU_LOCAL_IF_NAME_IDX 0 +#define RU_LOCAL_ADDRESS_IDX 1 +#define RU_REMOTE_ADDRESS_IDX 2 +#define RU_LOCAL_PORTC_IDX 3 +#define RU_REMOTE_PORTC_IDX 4 +#define RU_LOCAL_PORTD_IDX 5 +#define RU_REMOTE_PORTD_IDX 6 +#define RU_TRANSPORT_PREFERENCE_IDX 7 +#define RU_LOCAL_RF_IDX 8 +#define RU_NB_TX_IDX 9 +#define RU_NB_RX_IDX 10 +#define RU_MAX_RS_EPRE_IDX 11 +#define RU_MAX_RXGAIN_IDX 12 +#define RU_BAND_LIST_IDX 13 +#define RU_GNB_LIST_IDX 14 +#define RU_ATT_TX_IDX 15 +#define RU_ATT_RX_IDX 16 +#define RU_NBIOTRRC_LIST_IDX 17 + + + +/*-----------------------------------------------------------------------------------------------------------------------------------------*/ +/* RU configuration parameters */ +/* optname helpstr paramflags XXXptr defXXXval type numelt */ +/*-----------------------------------------------------------------------------------------------------------------------------------------*/ +#define RUPARAMS_DESC { \ +{CONFIG_STRING_RU_LOCAL_IF_NAME, NULL, 0, strptr:NULL, defstrval:"lo", TYPE_STRING, 0}, \ +{CONFIG_STRING_RU_LOCAL_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.2", TYPE_STRING, 0}, \ +{CONFIG_STRING_RU_REMOTE_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \ +{CONFIG_STRING_RU_LOCAL_PORTC, NULL, 0, uptr:NULL, defuintval:50000, TYPE_UINT, 0}, \ +{CONFIG_STRING_RU_REMOTE_PORTC, NULL, 0, uptr:NULL, defuintval:50000, TYPE_UINT, 0}, \ +{CONFIG_STRING_RU_LOCAL_PORTD, NULL, 0, uptr:NULL, defuintval:50001, TYPE_UINT, 0}, \ +{CONFIG_STRING_RU_REMOTE_PORTD, NULL, 0, uptr:NULL, defuintval:50001, TYPE_UINT, 0}, \ +{CONFIG_STRING_RU_TRANSPORT_PREFERENCE, NULL, 0, strptr:NULL, defstrval:"udp_if5", TYPE_STRING, 0}, \ +{CONFIG_STRING_RU_LOCAL_RF, NULL, 0, strptr:NULL, defstrval:"yes", TYPE_STRING, 0}, \ +{CONFIG_STRING_RU_NB_TX, NULL, 0, uptr:NULL, defuintval:1, TYPE_UINT, 0}, \ +{CONFIG_STRING_RU_NB_RX, NULL, 0, uptr:NULL, defuintval:1, TYPE_UINT, 0}, \ +{CONFIG_STRING_RU_MAX_RS_EPRE, NULL, 0, iptr:NULL, defintval:-29, TYPE_INT, 0}, \ +{CONFIG_STRING_RU_MAX_RXGAIN, NULL, 0, iptr:NULL, defintval:120, TYPE_INT, 0}, \ +{CONFIG_STRING_RU_BAND_LIST, NULL, 0, uptr:NULL, defintarrayval:DEFBANDS, TYPE_INTARRAY, 1}, \ +{CONFIG_STRING_RU_GNB_LIST, NULL, 0, uptr:NULL, defintarrayval:DEFGNBS, TYPE_INTARRAY, 1}, \ +{CONFIG_STRING_RU_ATT_TX, NULL, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, \ +{CONFIG_STRING_RU_ATT_RX, NULL, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, \ +{CONFIG_STRING_RU_NBIOTRRC_LIST, NULL, 0, uptr:NULL, defintarrayval:DEFGNBS, TYPE_INTARRAY, 1}, \ +} + +/*---------------------------------------------------------------------------------------------------------------------------------------*/ +/*---------------------------------------------------------------------------------------------------------------------------------------*/ +/* value definitions for ASN1 verbosity parameter */ +#define GNB_CONFIG_STRING_ASN1_VERBOSITY_NONE "none" +#define GNB_CONFIG_STRING_ASN1_VERBOSITY_ANNOYING "annoying" +#define GNB_CONFIG_STRING_ASN1_VERBOSITY_INFO "info" + + +/* global parameters, not under a specific section */ +#define GNB_CONFIG_STRING_ASN1_VERBOSITY "Asn1_verbosity" +#define GNB_CONFIG_STRING_ACTIVE_GNBS "Active_gNBs" +/*--------------------------------------------------------------------------------------------------------------------------------------------------------------*/ +/* global configuration parameters */ +/* optname helpstr paramflags XXXptr defXXXval type numelt */ +/*--------------------------------------------------------------------------------------------------------------------------------------------------------------*/ +#define GNBSPARAMS_DESC { \ +{GNB_CONFIG_STRING_ASN1_VERBOSITY, NULL, 0, uptr:NULL, defstrval:GNB_CONFIG_STRING_ASN1_VERBOSITY_NONE, TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_ACTIVE_GNBS, NULL, 0, uptr:NULL, defstrval:NULL, TYPE_STRINGLIST, 0} \ +} +#define GNB_ASN1_VERBOSITY_IDX 0 +#define GNB_ACTIVE_GNBS_IDX 1 + +/*------------------------------------------------------------------------------------------------------------------------------------------*/ +/*------------------------------------------------------------------------------------------------------------------------------------------*/ + + +/* cell configuration parameters names */ +#define GNB_CONFIG_STRING_GNB_ID "gNB_ID" +#define GNB_CONFIG_STRING_CELL_TYPE "cell_type" +#define GNB_CONFIG_STRING_GNB_NAME "gNB_name" +#define GNB_CONFIG_STRING_TRACKING_AREA_CODE "tracking_area_code" +#define GNB_CONFIG_STRING_MOBILE_COUNTRY_CODE "mobile_country_code" +#define GNB_CONFIG_STRING_MOBILE_NETWORK_CODE "mobile_network_code" +#define GNB_CONFIG_STRING_TRANSPORT_S_PREFERENCE "tr_s_preference" +#define GNB_CONFIG_STRING_LOCAL_S_IF_NAME "local_s_if_name" +#define GNB_CONFIG_STRING_LOCAL_S_ADDRESS "local_s_address" +#define GNB_CONFIG_STRING_REMOTE_S_ADDRESS "remote_s_address" +#define GNB_CONFIG_STRING_LOCAL_S_PORTC "local_s_portc" +#define GNB_CONFIG_STRING_REMOTE_S_PORTC "remote_s_portc" +#define GNB_CONFIG_STRING_LOCAL_S_PORTD "local_s_portd" +#define GNB_CONFIG_STRING_REMOTE_S_PORTD "remote_s_portd" + +/*-----------------------------------------------------------------------------------------------------------------------------------------*/ +/* cell configuration parameters */ +/* optname helpstr paramflags XXXptr defXXXval type numelt */ +/*-----------------------------------------------------------------------------------------------------------------------------------------*/ +#define GNBPARAMS_DESC {\ +{GNB_CONFIG_STRING_GNB_ID, NULL, 0, uptr:NULL, defintval:0, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_CELL_TYPE, NULL, 0, strptr:NULL, defstrval:"CELL_MACRO_GNB", TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_GNB_NAME, NULL, 0, strptr:NULL, defstrval:"OAIeNodeB", TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_TRACKING_AREA_CODE, NULL, 0, strptr:NULL, defstrval:"0", TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_MOBILE_COUNTRY_CODE, NULL, 0, strptr:NULL, defstrval:"0", TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_MOBILE_NETWORK_CODE, NULL, 0, strptr:NULL, defstrval:"0", TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_TRANSPORT_S_PREFERENCE, NULL, 0, strptr:NULL, defstrval:"local_mac", TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_LOCAL_S_IF_NAME, NULL, 0, strptr:NULL, defstrval:"lo", TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_LOCAL_S_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_REMOTE_S_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.2", TYPE_STRING, 0}, \ +{GNB_CONFIG_STRING_LOCAL_S_PORTC, NULL, 0, uptr:NULL, defuintval:50000, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_REMOTE_S_PORTC, NULL, 0, uptr:NULL, defuintval:50000, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_LOCAL_S_PORTD, NULL, 0, uptr:NULL, defuintval:50001, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_REMOTE_S_PORTD, NULL, 0, uptr:NULL, defuintval:50001, TYPE_UINT, 0}, \ +} +#define GNB_GNB_ID_IDX 0 +#define GNB_CELL_TYPE_IDX 1 +#define GNB_GNB_NAME_IDX 2 +#define GNB_TRACKING_AREA_CODE_IDX 3 +#define GNB_MOBILE_COUNTRY_CODE_IDX 4 +#define GNB_MOBILE_NETWORK_CODE_IDX 5 +#define GNB_TRANSPORT_S_PREFERENCE_IDX 6 +#define GNB_LOCAL_S_IF_NAME_IDX 7 +#define GNB_LOCAL_S_ADDRESS_IDX 8 +#define GNB_REMOTE_S_ADDRESS_IDX 9 +#define GNB_LOCAL_S_PORTC_IDX 10 +#define GNB_REMOTE_S_PORTC_IDX 11 +#define GNB_LOCAL_S_PORTD_IDX 12 +#define GNB_REMOTE_S_PORTD_IDX 13 +/*-------------------------------------------------------------------------------------------------------------------------------------------------*/ +/*-------------------------------------------------------------------------------------------------------------------------------------------------*/ + + +/* component carries configuration parameters name */ + +#define GNB_CONFIG_STRING_NB_ANT_PORTS "nb_antenna_ports" +#define GNB_CONFIG_STRING_NB_ANT_TX "nb_antennas_tx" +#define GNB_CONFIG_STRING_NB_ANT_RX "nb_antennas_rx" +#define GNB_CONFIG_STRING_TX_GAIN "tx_gain" +#define GNB_CONFIG_STRING_RX_GAIN "rx_gain" + + ///NR + //NR FREQUENCYINFODL +#define GNB_CONFIG_STRING_ABSOLUTEFREQUENCYSSB "absoluteFrequencySSB" +#define GNB_CONFIG_STRING_SSB_SUBCARRIEROFFSET "SubcarrierSpacing" +#define GNB_CONFIG_STRING_DL_FREQBANDINDICATORNR "DL_FreqBandIndicatorNR" +#define GNB_CONFIG_STRING_DL_ABSOLUTEFREQUENCYPOINTA "DL_absoluteFrequencyPointA" + + //NR DL SCS-SPECIFICCARRIER +#define GNB_CONFIG_STRING_DL_OFFSETTOCARRIER "DL_offsetToCarrier" +#define GNB_CONFIG_STRING_DL_SUBCARRIERSPACING "DL_SubcarrierSpacing" +#define GNB_CONFIG_STRING_DL_SCS_SPECIFICCARRIER_K0 "DL_SCS_SpecificCarrier_k0" +#define GNB_CONFIG_STRING_DL_CARRIERBANDWIDTH "DL_carrierBandwidth" + + // NR BWP-DOWNLINKCOMMON +#define GNB_CONFIG_STRING_DL_LOCATIONANDBANDWIDTH "DL_locationAndBandwidth" +///#define GNB_CONFIG_STRING_DL_PREFIX_TYPE; + + //NR FREQUENCYINFOUL +#define GNB_CONFIG_STRING_UL_FREQBANDINDICATORNR "UL_FreqBandIndicatorNR" +#define GNB_CONFIG_STRING_UL_ABSOLUTEFREQUENCYPOINTA "UL_absoluteFrequencyPointA" +#define GNB_CONFIG_STRING_FREQUENCYINFOUL_P_MAX "FrequencyInfoUL_p_Max" +#define GNB_CONFIG_STRING_FREQUENCYSHIFT7P5KHZ "frequencyShift7p5khz" + + //NR UL SCS-SPECIFICCARRIER +#define GNB_CONFIG_STRING_UL_OFFSETTOCARRIER "UL_offsetToCarrier" +#define GNB_CONFIG_STRING_UL_SUBCARRIERSPACING "UL_SubcarrierSpacing" +#define GNB_CONFIG_STRING_UL_SCS_SPECIFICCARRIER_K0 "UL_SCS_SpecificCarrier_k0" +#define GNB_CONFIG_STRING_UL_CARRIERBANDWIDTH "UL_carrierBandwidth" + + // NR BWP-UPLINKCOMMON +#define GNB_CONFIG_STRING_UL_LOCATIONANDBANDWIDTH "UL_locationAndBandwidth" + //NR_PREFIX_TYPE_T UL_PREFIX_TYPE[MAX_NUM_CCS]; + + +#define GNB_CONFIG_STRING_SSB_PERIODICITYSERVINGCELL "ssb_periodicityServingCell" +#define GNB_CONFIG_STRING_DMRS_TYPEA_POSITION "dmrs_TypeA_Position" +#define GNB_CONFIG_STRING_NIA_SUBCARRIERSPACING "NIA_SubcarrierSpacing" +#define GNB_CONFIG_STRING_SS_PBCH_BLOCKPOWER "ss_PBCH_BlockPower" + + + //NR TDD-UL-DL-CONFIGCOMMON +#define GNB_CONFIG_STRING_REFERENCESUBCARRIERSPACING "referenceSubcarrierSpacing" +#define GNB_CONFIG_STRING_DL_UL_TRANSMISSIONPERIODICITY "dl_UL_TransmissionPeriodicity" +#define GNB_CONFIG_STRING_NROFDOWNLINKSLOTS "nrofDownlinkSlots" +#define GNB_CONFIG_STRING_NROFDOWNLINKSYMBOLS "nrofDownlinkSymbols" +#define GNB_CONFIG_STRING_NROFUPLINKSLOTS "nrofUplinkSlots" +#define GNB_CONFIG_STRING_NROFUPLINKSYMBOLS "nrofUplinkSymbols" + + //NR RACH-CONFIGCOMMON +#define GNB_CONFIG_STRING_RACH_TOTALNUMBEROFRA_PREAMBLES "rach_totalNumberOfRA_Preambles" +#define GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_CHOICE "rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice" +#define GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_ONEEIGHTH "rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth" +#define GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_ONEFOURTH "rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth" +#define GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_ONEHALF "rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf" +#define GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_ONE "rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one" +#define GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_TWO "rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two" +#define GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_FOUR "rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_four" +#define GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_EIGHT "rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_eight" +#define GNB_CONFIG_STRING_RACH_SSB_PERRACH_OCCASIONANDCB_PREAMBLESPERSSB_SIXTEEN "rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_sixteen" +#define GNB_CONFIG_STRING_RACH_GROUPBCONFIGURED "rach_groupBconfigured " +#define GNB_CONFIG_STRING_RACH_RA_MSG3SIZEGROUPA "rach_ra_Msg3SizeGroupA" +#define GNB_CONFIG_STRING_RACH_MESSAGEPOWEROFFSETGROUPB "rach_messagePowerOffsetGroupB" +#define GNB_CONFIG_STRING_RACH_NUMBEROFRA_PREAMBLESGROUPA "rach_numberOfRA_PreamblesGroupA" +#define GNB_CONFIG_STRING_RACH_RA_CONTENTIONRESOLUTIONTIMER "rach_ra_ContentionResolutionTimer" +#define GNB_CONFIG_STRING_RSRP_THRESHOLDSSB "rsrp_ThresholdSSB" +#define GNB_CONFIG_STRING_RSRP_THRESHOLDSSB_SUL "rsrp_ThresholdSSB_SUL" +#define GNB_CONFIG_STRING_PRACH_ROOTSEQUENCEINDEX_CHOICE "prach_RootSequenceIndex_choice" +#define GNB_CONFIG_STRING_PRACH_ROOTSEQUENCEINDEX_L839 "prach_RootSequenceIndex_l839" +#define GNB_CONFIG_STRING_PRACH_ROOTSEQUENCEINDEX_L139 "prach_RootSequenceIndex_l139" +#define GNB_CONFIG_STRING_PRACH_MSG1_SUBCARRIERSPACING "prach_msg1_SubcarrierSpacing" +#define GNB_CONFIG_STRING_RESTRICTEDSETCONFIG "restrictedSetConfig" +#define GNB_CONFIG_STRING_MSG3_TRANSFORMPRECODING "msg3_transformPrecoding" + //SSB-PERRACH-OCCASIONANDCB-PREAMBLESPERSSB NOT SURE + + //NR RACH-CONFIGGENERIC +#define GNB_CONFIG_STRING_PRACH_CONFIGURATIONINDEX "prach_ConfigurationIndex" +#define GNB_CONFIG_STRING_PRACH_MSG1_FDM "prach_msg1_FDM" +#define GNB_CONFIG_STRING_PRACH_MSG1_FREQUENCYSTART "prach_msg1_FrequencyStart" +#define GNB_CONFIG_STRING_ZEROCORRELATIONZONECONFIG "zeroCorrelationZoneConfig" +#define GNB_CONFIG_STRING_PREAMBLERECEIVEDTARGETPOWER "preambleReceivedTargetPower" +#define GNB_CONFIG_STRING_PREAMBLETRANSMAX "preambleTransMax" +#define GNB_CONFIG_STRING_POWERRAMPINGSTEP "powerRampingStep" +#define GNB_CONFIG_STRING_RA_RESPONSEWINDOW "ra_ResponseWindow" + + //PUSCH-CONFIGCOMMON +#define GNB_CONFIG_STRING_GROUPHOPPINGENABLEDTRANSFORMPRECODING "groupHoppingEnabledTransformPrecoding" +#define GNB_CONFIG_STRING_MSG3_DELTAPREAMBLE "msg3_DeltaPreamble" +#define GNB_CONFIG_STRING_P0_NOMINALWITHGRANT "p0_NominalWithGrant" + + ///PUSCH-TIMEDOMAINRESOURCEALLOCATION +#define GNB_CONFIG_STRING_PUSCH_TIMEDOMAINRESOURCEALLOCATION_K2 "PUSCH_TimeDomainResourceAllocation_k2" +#define GNB_CONFIG_STRING_PUSCH_TIMEDOMAINRESOURCEALLOCATION_MAPPINGTYPE "PUSCH_TimeDomainResourceAllocation_mappingType" + + //PUCCH-CONFIGCOMMON +#define GNB_CONFIG_STRING_PUCCH_GROUPHOPPING "pucch_GroupHopping" +#define GNB_CONFIG_STRING_P0_NOMINAL "p0_nominal" + + //PDSCH-CONFIGCOMMON + //PDSCH-TIMEDOMAINRESOURCEALLOCATION +#define GNB_CONFIG_STRING_PDSCH_TIMEDOMAINRESOURCEALLOCATION_K0 "PDSCH_TimeDomainResourceAllocation_k0" +#define GNB_CONFIG_STRING_PDSCH_TIMEDOMAINRESOURCEALLOCATION_MAPPINGTYPE "PDSCH_TimeDomainResourceAllocation_mappingType" + + //RATEMATCHPATTERN IS USED TO CONFIGURE ONE RATE MATCHING PATTERN FOR PDSCH +#define GNB_CONFIG_STRING_RATEMATCHPATTERNID "rateMatchPatternId" +#define GNB_CONFIG_STRING_RATEMATCHPATTERN_PATTERNTYPE "RateMatchPattern_patternType" +#define GNB_CONFIG_STRING_SYMBOLSINRESOURCEBLOCK "symbolsInResourceBlock" +#define GNB_CONFIG_STRING_PERIODICITYANDPATTERN "periodicityAndPattern" +#define GNB_CONFIG_STRING_RATEMATCHPATTERN_CONTROLRESOURCESET "RateMatchPattern_controlResourceSet" +#define GNB_CONFIG_STRING_RATEMATCHPATTERN_SUBCARRIERSPACING "RateMatchPattern_subcarrierSpacing" +#define GNB_CONFIG_STRING_RATEMATCHPATTERN_MODE "RateMatchPattern_mode" + + //PDCCH-CONFIGCOMMON +#define GNB_CONFIG_STRING_SEARCHSPACESIB1 "searchSpaceSIB1" +#define GNB_CONFIG_STRING_SEARCHSPACEOTHERSYSTEMINFORMATION "searchSpaceOtherSystemInformation" +#define GNB_CONFIG_STRING_PAGINGSEARCHSPACE "pagingSearchSpace" +#define GNB_CONFIG_STRING_RA_SEARCHSPACE "ra_SearchSpace" +#define GNB_CONFIG_STRING_RACH_RA_CONTROLRESOURCESET "rach_ra_ControlResourceSet" + //NR PDCCH-CONFIGCOMMON COMMONCONTROLRESOURCESSETS +#define GNB_CONFIG_STRING_PDCCH_COMMON_CONTROLRESOURCESETID "PDCCH_common_controlResourceSetId" +#define GNB_CONFIG_STRING_PDCCH_COMMON_CONTROLRESOURCESET_DURATION "PDCCH_common_ControlResourceSet_duration" +#define GNB_CONFIG_STRING_PDCCH_CCE_REG_MAPPINGTYPE "PDCCH_cce_REG_MappingType" +#define GNB_CONFIG_STRING_PDCCH_REG_BUNDLESIZE "PDCCH_reg_BundleSize" +#define GNB_CONFIG_STRING_PDCCH_INTERLEAVERSIZE "PDCCH_interleaverSize" +#define GNB_CONFIG_STRING_PDCCH_SHIFTINDEX "PDCCH_shiftIndex" +#define GNB_CONFIG_STRING_PDCCH_PRECODERGRANULARITY "PDCCH_precoderGranularity" +#define GNB_CONFIG_STRING_TCI_PRESENTINDCI "tci_PresentInDCI" + + //NR PDCCH-ConfigCommon commonSearchSpaces +#define GNB_CONFIG_STRING_SEARCHSPACEID "SearchSpaceId" +#define GNB_CONFIG_STRING_COMMONSEARCHSPACES_CONTROLRESOURCESETID "commonSearchSpaces_controlResourceSetId" +#define GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_CHOICE "SearchSpace_monitoringSlotPeriodicityAndOffset_choice" +#define GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL1 "SearchSpace_monitoringSlotPeriodicityAndOffset_sl1" +#define GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL2 "SearchSpace_monitoringSlotPeriodicityAndOffset_sl2" +#define GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL4 "SearchSpace_monitoringSlotPeriodicityAndOffset_sl4" +#define GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL5 "SearchSpace_monitoringSlotPeriodicityAndOffset_sl5" +#define GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL8 "SearchSpace_monitoringSlotPeriodicityAndOffset_sl8" +#define GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL10 "SearchSpace_monitoringSlotPeriodicityAndOffset_sl10" +#define GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL16 "SearchSpace_monitoringSlotPeriodicityAndOffset_sl16" +#define GNB_CONFIG_STRING_SEARCHSPACE_MONITORINGSLOTPERIODICITYANDOFFSET_SL20 "SearchSpace_monitoringSlotPeriodicityAndOffset_sl20" +#define GNB_CONFIG_STRING_SEARCHSPACE_NROFCANDIDATES_AGGREGATIONLEVEL1 "SearchSpace_nrofCandidates_aggregationLevel1" +#define GNB_CONFIG_STRING_SEARCHSPACE_NROFCANDIDATES_AGGREGATIONLEVEL2 "SearchSpace_nrofCandidates_aggregationLevel2" +#define GNB_CONFIG_STRING_SEARCHSPACE_NROFCANDIDATES_AGGREGATIONLEVEL4 "SearchSpace_nrofCandidates_aggregationLevel4" +#define GNB_CONFIG_STRING_SEARCHSPACE_NROFCANDIDATES_AGGREGATIONLEVEL8 "SearchSpace_nrofCandidates_aggregationLevel8" +#define GNB_CONFIG_STRING_SEARCHSPACE_NROFCANDIDATES_AGGREGATIONLEVEL16 "SearchSpace_nrofCandidates_aggregationLevel16" +#define GNB_CONFIG_STRING_SEARCHSPACE_SEARCHSPACETYPE "SearchSpace_searchSpaceType" +#define GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_0_NROFCANDIDATES_SFI_AGGREGATIONLEVEL1 "Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel1" +#define GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_0_NROFCANDIDATES_SFI_AGGREGATIONLEVEL2 "Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel2" +#define GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_0_NROFCANDIDATES_SFI_AGGREGATIONLEVEL4 "Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel4" +#define GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_0_NROFCANDIDATES_SFI_AGGREGATIONLEVEL8 "Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel8" +#define GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_0_NROFCANDIDATES_SFI_AGGREGATIONLEVEL16 "Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel16" +#define GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_3_MONITORINGPERIODICITY "Common_dci_Format2_3_monitoringPeriodicity" +#define GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_3_NROFPDCCH_CANDIDATES "Common_dci_Format2_3_nrofPDCCH_Candidates" +#define GNB_CONFIG_STRING_UE_SPECIFIC__DCI_FORMATS "ue_Specific__dci_Formats" + + + //PDCCH-CONFIGCOMMON + + //CONTROLRESOURCESET +#define GNB_CONFIG_STRING_CONTROLRESOURCESETID = 0; +#define GNB_CONFIG_STRING_FREQUENCYDOMAINRESOURCES = 0; +#define GNB_CONFIG_STRING_CONTROLRESOURCESET_DURATION = 0; +#define GNB_CONFIG_STRING_PRECODERGRANULARITY = 0; //CORRESPONDS TO L1 PARAMETER 'CORESET-PRECODER-GRANUALITY' +#define GNB_CONFIG_STRING_TCI_PRESENTINDCI = NULL; + + //SEARCHSPACE +#define GNB_CONFIG_STRING_SEARCHSPACEID = 0; +#define GNB_CONFIG_STRING_DCI_FORMAT2_3_MONITORINGPERIODICITY = 0; +#define GNB_CONFIG_STRING_DCI_FORMAT2_3_NROFPDCCH_CANDIDATES = 0; + + + // NR SYNCHRONIZATION SIGNAL BLOCK + +#define GNB_CONFIG_STRING_SSB_PERIODICITYSERVINGCELL = 0; +#define GNB_CONFIG_STRING_SS_PBCH_BLOCKPOWER = 0; + + diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index a05b27ddc3..ab5d69fba3 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -48,41 +48,42 @@ #include /* for _ASN_DEFAULT_STACK_MAX */ #include +#include "RRC/NR/defs_NR.h" +//#include "RRC/LITE/extern.h" + +#if defined(Rel15) #include "assertions.h" -#include "RRCConnectionRequest.h" -#include "UL-CCCH-Message.h" +//#include "RRCConnectionRequest.h" +//#include "UL-CCCH-Message.h" #include "UL-DCCH-Message.h" -#include "DL-CCCH-Message.h" +//#include "DL-CCCH-Message.h" #include "DL-DCCH-Message.h" -#include "EstablishmentCause.h" -#include "RRCConnectionSetup.h" +//#include "EstablishmentCause.h" +//#include "RRCConnectionSetup.h" #include "SRB-ToAddModList.h" #include "DRB-ToAddModList.h" -#if defined(Rel10) || defined(Rel14) -#include "MCCH-Message.h" +//#include "MCCH-Message.h" //#define MRB1 1 -#endif -#include "RRC/LITE/defs.h" -#include "RRC/LITE/extern.h" -#include "RRCConnectionSetupComplete.h" -#include "RRCConnectionReconfigurationComplete.h" -#include "RRCConnectionReconfiguration.h" -#include "MasterInformationBlock.h" -#include "SystemInformation.h" +//#include "RRCConnectionSetupComplete.h" +//#include "RRCConnectionReconfigurationComplete.h" +//#include "RRCConnectionReconfiguration.h" +#include "MIB.h" +//#include "SystemInformation.h" -#include "SystemInformationBlockType1.h" +#include "SIB1.h" -#include "SIB-Type.h" +//#include "SIB-Type.h" -#include "BCCH-DL-SCH-Message.h" +//#include "BCCH-DL-SCH-Message.h" -#include "PHY/defs.h" +//#include "PHY/defs.h" #include "MeasObjectToAddModList.h" #include "ReportConfigToAddModList.h" #include "MeasIdToAddModList.h" #include "enb_config.h" +#endif #if defined(ENABLE_ITTI) # include "intertask_interface.h" @@ -110,7 +111,9 @@ typedef struct xer_sprint_string_s { size_t string_index; } xer_sprint_string_t; -extern unsigned char NB_eNB_INST; +//repplace LTE +//extern unsigned char NB_eNB_INST; +extern unsigned char NB_gNB_INST; extern uint8_t usim_test; extern RAN_CONTEXT_t RC; @@ -129,7 +132,7 @@ uint16_t two_tier_hexagonal_adjacent_cellIds[7][6] = {{1,2,4,5,7,8}, // CellI * This is a helper function for xer_sprint, which directs all incoming data * into the provided string. */ -static int xer__print2s (const void *buffer, size_t size, void *app_key) +static int xer__print2s_NR (const void *buffer, size_t size, void *app_key) { xer_sprint_string_t *string_buffer = (xer_sprint_string_t *) app_key; size_t string_remaining = string_buffer->string_size - string_buffer->string_index; @@ -146,7 +149,7 @@ static int xer__print2s (const void *buffer, size_t size, void *app_key) return 0; } -int xer_sprint (char *string, size_t string_size, asn_TYPE_descriptor_t *td, void *sptr) +int xer_sprint_NR (char *string, size_t string_size, asn_TYPE_descriptor_t *td, void *sptr) { asn_enc_rval_t er; xer_sprint_string_t string_buffer; @@ -170,13 +173,13 @@ int xer_sprint (char *string, size_t string_size, asn_TYPE_descriptor_t *td, voi return er.encoded; } -uint16_t get_adjacent_cell_id(uint8_t Mod_id,uint8_t index) +uint16_t get_adjacent_cell_id_NR(uint8_t Mod_id,uint8_t index) { return(two_tier_hexagonal_adjacent_cellIds[Mod_id][index]); } /* This only works for the hexagonal topology...need a more general function for other topologies */ -uint8_t get_adjacent_cell_mod_id(uint16_t phyCellId) +uint8_t get_adjacent_cell_mod_id_NR(uint16_t phyCellId) { uint8_t i; @@ -190,94 +193,89 @@ uint8_t get_adjacent_cell_mod_id(uint16_t phyCellId) return 0xFF; //error! } -uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich_Resource, uint32_t phich_duration, uint32_t frame) +//------------------------------------------------------------------------------ + +uint8_t do_MIB_NR(rrc_gNB_carrier_data_t *carrier, + uint32_t frame, + uint32_t ssb_SubcarrierOffset, + uint32_t pdcch_ConfigSIB1, + uint32_t subCarrierSpacingCommon, + uint32_t dmrs_TypeA_Position) { asn_enc_rval_t enc_rval; - BCCH_BCH_Message_t *mib=&carrier->mib ; - uint8_t sfn = (uint8_t)((frame>>2)&0xff); - uint16_t *spare= calloc(1, sizeof(uint16_t)); + + BCCH_BCH_Message_t *mib=&carrier->mib_NR ; + memset(mib,0,sizeof(BCCH_BCH_Message_t)); + mib->message.present = BCCH_BCH_MessageType_PR_mib; + + //36.331 SFN BIT STRING (SIZE (8) , 38.331 SFN BIT STRING (SIZE (6)) + uint8_t sfn = (uint8_t)((frame>>4)&0x3f); + mib->message.choice.mib.systemFrameNumber.buf = &sfn; + mib->message.choice.mib.systemFrameNumber.size = 1; + mib->message.choice.mib.systemFrameNumber.bits_unused=0; + + //38.331 spare BIT STRING (SIZE (1)) + uint8_t *spare= calloc(1, sizeof(uint8_t)); if (spare == NULL) abort(); + mib->message.choice.mib.spare.buf = (uint8_t *)spare; + mib->message.choice.mib.spare.size = 1; + mib->message.choice.mib.spare.bits_unused = 7; // This makes a spare of 1 bits - switch (N_RB_DL) { + mib->message.choice.mib.ssb_SubcarrierOffset = ssb_SubcarrierOffset; + mib->message.choice.mib.pdcch_ConfigSIB1 = pdcch_ConfigSIB1; + + switch (subCarrierSpacingCommon) { + case 15: + mib->message.choice.mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs15or60; + break; - case 6: - mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n6; - break; + case 30: + mib->message.choice.mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs30or120; + break; - case 15: - mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n15; - break; + case 60: + mib->message.choice.mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs15or60; + break; - case 25: - mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n25; - break; + case 120: + mib->message.choice.mib.subCarrierSpacingCommon = MIB__subCarrierSpacingCommon_scs30or120; + break; - case 50: - mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n50; - break; - - case 75: - mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n75; - break; - - case 100: - mib->message.dl_Bandwidth = MasterInformationBlock__dl_Bandwidth_n100; - break; - default: - AssertFatal(1==0,"Unknown dl_Bandwidth %d\n",N_RB_DL); + default: + AssertFatal(1==0,"Unknown subCarrierSpacingCommon %d\n",subCarrierSpacingCommon); } - AssertFatal(phich_Resource <= PHICH_Config__phich_Resource_two,"Illegal phich_Resource\n"); - mib->message.phich_Config.phich_Resource = phich_Resource; - AssertFatal(phich_Resource <= PHICH_Config__phich_Duration_extended,"Illegal phich_Duration\n"); - mib->message.phich_Config.phich_Duration = phich_duration; - LOG_I(RRC,"[MIB] systemBandwidth %x, phich_duration %x, phich_resource %x,sfn %x\n", - (uint32_t)mib->message.dl_Bandwidth, - (uint32_t)phich_duration, - (uint32_t)phich_Resource, - (uint32_t)sfn); + switch (dmrs_TypeA_Position) { + case 2: + mib->message.choice.mib.dmrs_TypeA_Position = MIB__dmrs_TypeA_Position_pos2; + break; - mib->message.systemFrameNumber.buf = &sfn; - mib->message.systemFrameNumber.size = 1; - mib->message.systemFrameNumber.bits_unused=0; - mib->message.spare.buf = (uint8_t *)spare; -#ifndef Rel14 - mib->message.spare.size = 2; - mib->message.spare.bits_unused = 6; // This makes a spare of 10 bits -#else - mib->message.spare.size = 1; - mib->message.spare.bits_unused = 3; // This makes a spare of 5 bits - mib->message.schedulingInfoSIB1_BR_r13 = 0; // turn off eMTC -#endif + case 3: + mib->message.choice.mib.dmrs_TypeA_Position = MIB__dmrs_TypeA_Position_pos3; + break; + default: + AssertFatal(1==0,"Unknown dmrs_TypeA_Position %d\n",dmrs_TypeA_Position); + + } + + // assign_enum + mib->message.choice.mib.cellBarred = MIB__cellBarred_notBarred; + // assign_enum + mib->message.choice.mib.intraFreqReselection = MIB__intraFreqReselection_notAllowed; + + + + //encode MIB to data enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message, (void*)mib, - carrier->MIB, + carrier->MIB_NR, 24); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); - /* -#if defined(ENABLE_ITTI) -# if !defined(DISABLE_XER_SPRINT) - { - char message_string[20000]; - size_t message_string_size; - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_BCCH_BCH_Message, (void *) &mib)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_BCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_dl_bcch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_dl_bcch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, enb_module_idP, msg_p); - } - } -# endif -#endif - */ if (enc_rval.encoded==-1) { return(-1); } @@ -285,12 +283,15 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich return((enc_rval.encoded+7)/8); } -uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier, - int Mod_id,int CC_id -#if defined(ENABLE_ITTI) - , RrcConfigurationReq *configuration -#endif - ) +//------------------------------------------------------------------------------ + +uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, + int Mod_id, + int CC_id + #if defined(ENABLE_ITTI) + , gNB_RrcConfigurationReq *configuration + #endif + ) { // SystemInformation_t systemInformation; @@ -302,7 +303,7 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier, uint8_t *buffer = carrier->SIB1; BCCH_DL_SCH_Message_t *bcch_message = &carrier->siblock1; - SystemInformationBlockType1_t **sib1 = &carrier->sib1; + SIB1_t **sib1 = &carrier->sib1; memset(bcch_message,0,sizeof(BCCH_DL_SCH_Message_t)); @@ -494,6 +495,8 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier, return((enc_rval.encoded+7)/8); } +//------------------------------------------------------------------------------ +/* uint8_t do_SIB23(uint8_t Mod_id, int CC_id @@ -960,9 +963,7 @@ uint8_t do_SIB23(uint8_t Mod_id, bcch_message->message.present = BCCH_DL_SCH_MessageType_PR_c1; bcch_message->message.choice.c1.present = BCCH_DL_SCH_MessageType__c1_PR_systemInformation; - /* memcpy((void*)&bcch_message.message.choice.c1.choice.systemInformation, - (void*)systemInformation, - sizeof(SystemInformation_t));*/ + //memcpy((void*)&bcch_message.message.choice.c1.choice.systemInformation,(void*)systemInformation,sizeof(SystemInformation_t)); bcch_message->message.choice.c1.choice.systemInformation.criticalExtensions.present = SystemInformation__criticalExtensions_PR_systemInformation_r8; @@ -1024,7 +1025,11 @@ uint8_t do_SIB23(uint8_t Mod_id, return((enc_rval.encoded+7)/8); } +*/ +//------------------------------------------------------------------------------ + +/* uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) { @@ -1109,7 +1114,11 @@ uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv) return((enc_rval.encoded+7)/8); } +*/ +//------------------------------------------------------------------------------ + +/* uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uint8_t Transaction_id, const int dedicatedInfoNASLength, const char *dedicatedInfoNAS) { @@ -1140,24 +1149,24 @@ uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uin rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME = NULL;//calloc(1,sizeof(*rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME)); - /* - rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->plmn_Identity=NULL; - rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmegi.buf = calloc(2,1); - rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmegi.buf[0] = 0x0; - rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmegi.buf[1] = 0x1; - rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmegi.size=2; - rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmegi.bits_unused=0; - */ + + //rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->plmn_Identity=NULL; + //rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmegi.buf = calloc(2,1); + //rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmegi.buf[0] = 0x0; + //rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmegi.buf[1] = 0x1; + //rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmegi.size=2; + //rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmegi.bits_unused=0; + memset(&rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.dedicatedInfoNAS,0,sizeof(OCTET_STRING_t)); OCTET_STRING_fromBuf(&rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.dedicatedInfoNAS, dedicatedInfoNAS, dedicatedInfoNASLength); - /* - rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.buf = calloc(1,1); - rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.buf[0] = 0x98; - rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.size=1; - rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.bits_unused=0; - */ + + //rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.buf = calloc(1,1); + //rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.buf[0] = 0x98; + //rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.size=1; + //rrcConnectionSetupComplete->criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8.registeredMME->mmec.bits_unused=0; + enc_rval = uper_encode_to_buffer(&asn_DEF_UL_DCCH_Message, (void*)&ul_dcch_msg, @@ -1192,8 +1201,11 @@ uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uin return((enc_rval.encoded+7)/8); } +*/ //------------------------------------------------------------------------------ + +/* uint8_t do_RRCConnectionReconfigurationComplete( const protocol_ctxt_t* const ctxt_pP, @@ -1253,9 +1265,11 @@ do_RRCConnectionReconfigurationComplete( return((enc_rval.encoded+7)/8); } - +*/ //------------------------------------------------------------------------------ + +/* uint8_t do_RRCConnectionSetup( const protocol_ctxt_t* const ctxt_pP, @@ -1444,16 +1458,16 @@ do_RRCConnectionSetup( physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic)); physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = CQI_ReportPeriodic_PR_release; - /* - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = CQI_ReportPeriodic_PR_setup; - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex = 0; // n2_pucch - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex = 0; // Icqi/pmi - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present = CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI; // subband CQI - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.choice.subbandCQI.k=4; + + //physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = CQI_ReportPeriodic_PR_setup; + //physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex = 0; // n2_pucch + //physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex = 0; // Icqi/pmi + //physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present = CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI; // subband CQI + //physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.choice.subbandCQI.k=4; - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex=NULL; - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI=0; - */ + //physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex=NULL; + //physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI=0; + //soundingRS-UL-ConfigDedicated if (rrc->srs_enable[CC_id]==1) { @@ -1516,36 +1530,36 @@ do_RRCConnectionSetup( case 2: physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm2; break; - /* - case 3: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm3; - physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction= CALLOC(1, - sizeof(*physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction)); - physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3; - physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1); - physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0; - physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1; - physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6; + + //case 3: + // physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm3; + // physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction= CALLOC(1, + // sizeof(*physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction)); + // physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = + // AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3; + // physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1); + // physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0; + // physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1; + // physicalConfigDedicated2->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6; - break; + // break; - case 4: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm4; - break; + //case 4: + // physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm4; + // break; - case 5: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm5; - break; + //case 5: + // physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm5; + // break; - case 6: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm6; - break; + //case 6: + // physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm6; + // break; - case 7: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm7; - break; - */ + //case 7: + // physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm7; + // break; + } @@ -1649,8 +1663,11 @@ do_RRCConnectionSetup( return((enc_rval.encoded+7)/8); } +*/ //------------------------------------------------------------------------------ + +/* uint8_t do_SecurityModeCommand( const protocol_ctxt_t* const ctxt_pP, @@ -1728,8 +1745,11 @@ do_SecurityModeCommand( // exit(-1); return((enc_rval.encoded+7)/8); } +*/ //------------------------------------------------------------------------------ + +/* uint8_t do_UECapabilityEnquiry( const protocol_ctxt_t* const ctxt_pP, @@ -1804,8 +1824,11 @@ do_UECapabilityEnquiry( return((enc_rval.encoded+7)/8); } +*/ //------------------------------------------------------------------------------ + +/* uint16_t do_RRCConnectionReconfiguration( const protocol_ctxt_t* const ctxt_pP, @@ -1963,8 +1986,11 @@ do_RRCConnectionReconfiguration( return((enc_rval.encoded+7)/8); } +*/ //------------------------------------------------------------------------------ + +/* uint8_t do_RRCConnectionReestablishmentReject( uint8_t Mod_id, @@ -2021,8 +2047,11 @@ do_RRCConnectionReestablishmentReject( return((enc_rval.encoded+7)/8); } +*/ //------------------------------------------------------------------------------ + +/* uint8_t do_RRCConnectionReject( uint8_t Mod_id, @@ -2043,7 +2072,7 @@ do_RRCConnectionReject( // RRCConnectionReject rrcConnectionReject->criticalExtensions.present = RRCConnectionReject__criticalExtensions_PR_c1; rrcConnectionReject->criticalExtensions.choice.c1.present = RRCConnectionReject__criticalExtensions__c1_PR_rrcConnectionReject_r8; - /* let's put a wait time of 1s for the moment */ + /// let's put a wait time of 1s for the moment rrcConnectionReject->criticalExtensions.choice.c1.choice.rrcConnectionReject_r8.waitTime = 1; #ifdef XER_PRINT @@ -2082,7 +2111,11 @@ do_RRCConnectionReject( return((enc_rval.encoded+7)/8); } +*/ +//------------------------------------------------------------------------------ + +/* uint8_t do_RRCConnectionRelease( uint8_t Mod_id, uint8_t *buffer, @@ -2120,10 +2153,15 @@ uint8_t do_RRCConnectionRelease( return((enc_rval.encoded+7)/8); } +*/ +/* uint8_t TMGI[5] = {4,3,2,1,0};//TMGI is a string of octet, ref. TS 24.008 fig. 10.5.4a +*/ +//------------------------------------------------------------------------------ +/* #if defined(Rel10) || defined(Rel14) uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, uint8_t sync_area, @@ -2190,10 +2228,10 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, pmch_Info_1 = CALLOC(1,sizeof(PMCH_Info_r9_t)); memset((void*)pmch_Info_1,0,sizeof(PMCH_Info_r9_t)); - /* - * take the value of last mbsfn subframe in this CSA period because there is only one PMCH in this mbsfn area - * Note: this has to be set based on the subframeAllocation and CSA - */ + + ///take the value of last mbsfn subframe in this CSA period because there is only one PMCH in this mbsfn area + ///Note: this has to be set based on the subframeAllocation and CSA + pmch_Info_1->pmch_Config_r9.sf_AllocEnd_r9= 3; pmch_Info_1->pmch_Config_r9.dataMCS_r9= 7; pmch_Info_1->pmch_Config_r9.mch_SchedulingPeriod_r9= PMCH_Config_r9__mch_SchedulingPeriod_r9_rf16; @@ -2218,23 +2256,23 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, mbms_Session_1->logicalChannelIdentity_r9= MTCH; ASN_SEQUENCE_ADD(&pmch_Info_1->mbms_SessionInfoList_r9.list,mbms_Session_1); - /* // Session 2 + /// Session 2 //mbms_Session_2 = CALLOC(1,sizeof(MBMS_SessionInfo_r9_t)); - memset(mbms_Session_2,0,sizeof(MBMS_SessionInfo_r9_t)); - // TMGI value - mbms_Session_2->tmgi_r9.plmn_Id_r9.present= TMGI_r9__plmn_Id_r9_PR_plmn_Index_r9; - mbms_Session_2->tmgi_r9.plmn_Id_r9.choice.plmn_Index_r9= 1; - // Service ID - memset(&mbms_Session_2->tmgi_r9.serviceId_r9,0,sizeof(OCTET_STRING_t));// need to check - OCTET_STRING_fromBuf(&mbms_Session_2->tmgi_r9.serviceId_r9,(const char*)&TMGI[3],3); - // Session ID is still missing here - mbms_Session_2->sessionID_r9->buf= MALLOC(1); - mbms_Session_2->sessionID_r9->size= 1; - mbms_Session_2->sessionID_r9->buf[0]= 0x11; - // Logical Channel ID - mbms_Session_2->logicalChannelIdentity_r9= 2; - ASN_SEQUENCE_ADD(&pmch_Info_1->mbms_SessionInfoList_r9.list,mbms_Session_2); - */ + //memset(mbms_Session_2,0,sizeof(MBMS_SessionInfo_r9_t)); + /// TMGI value + //mbms_Session_2->tmgi_r9.plmn_Id_r9.present= TMGI_r9__plmn_Id_r9_PR_plmn_Index_r9; + //mbms_Session_2->tmgi_r9.plmn_Id_r9.choice.plmn_Index_r9= 1; + /// Service ID + //memset(&mbms_Session_2->tmgi_r9.serviceId_r9,0,sizeof(OCTET_STRING_t));// need to check + //OCTET_STRING_fromBuf(&mbms_Session_2->tmgi_r9.serviceId_r9,(const char*)&TMGI[3],3); + /// Session ID is still missing here + //mbms_Session_2->sessionID_r9->buf= MALLOC(1); + //mbms_Session_2->sessionID_r9->size= 1; + //mbms_Session_2->sessionID_r9->buf[0]= 0x11; + /// Logical Channel ID + //mbms_Session_2->logicalChannelIdentity_r9= 2; + //ASN_SEQUENCE_ADD(&pmch_Info_1->mbms_SessionInfoList_r9.list,mbms_Session_2); + ASN_SEQUENCE_ADD(&(*mbsfnAreaConfiguration)->pmch_InfoList_r9.list,pmch_Info_1); #ifdef XER_PRINT @@ -2278,7 +2316,11 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, return((enc_rval.encoded+7)/8); } #endif +*/ +//------------------------------------------------------------------------------ + +/* uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_id,long rsrp_s,long rsrq_s,long rsrp_t,long rsrq_t) { @@ -2406,7 +2448,11 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_ return((enc_rval.encoded+7)/8); } +*/ +//------------------------------------------------------------------------------ + +/* uint8_t do_DLInformationTransfer(uint8_t Mod_id, uint8_t **buffer, uint8_t transaction_id, uint32_t pdu_length, uint8_t *pdu_buffer) { ssize_t encoded; @@ -2427,30 +2473,34 @@ uint8_t do_DLInformationTransfer(uint8_t Mod_id, uint8_t **buffer, uint8_t trans encoded = uper_encode_to_new_buffer (&asn_DEF_DL_DCCH_Message, NULL, (void*) &dl_dcch_msg, (void **) buffer); - /* -#if defined(ENABLE_ITTI) -# if !defined(DISABLE_XER_SPRINT) - { - char message_string[10000]; - size_t message_string_size; + +// #if defined(ENABLE_ITTI) +// # if !defined(DISABLE_XER_SPRINT) +// { +// char message_string[10000]; +// size_t message_string_size; - if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message, (void *)&dl_dcch_msg)) > 0) { - MessageDef *msg_p; +// if ((message_string_size = xer_sprint(message_string, sizeof(message_string), &asn_DEF_DL_DCCH_Message, (void *)&dl_dcch_msg)) > 0) { +// MessageDef *msg_p; - msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText)); - msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size); +// msg_p = itti_alloc_new_message_sized (TASK_RRC_ENB, RRC_DL_DCCH, message_string_size + sizeof (IttiMsgText)); +// msg_p->ittiMsg.rrc_dl_dcch.size = message_string_size; +// memcpy(&msg_p->ittiMsg.rrc_dl_dcch.text, message_string, message_string_size); - itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); - } - } -# endif -#endif - */ +// itti_send_msg_to_task(TASK_UNKNOWN, Mod_id, msg_p); +// } +// } +// # endif +// #endif + return encoded; } +*/ +//------------------------------------------------------------------------------ + +/* uint8_t do_ULInformationTransfer(uint8_t **buffer, uint32_t pdu_length, uint8_t *pdu_buffer) { ssize_t encoded; @@ -2472,10 +2522,14 @@ uint8_t do_ULInformationTransfer(uint8_t **buffer, uint32_t pdu_length, uint8_t return encoded; } +*/ +//------------------------------------------------------------------------------ + +/* OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) { - static OAI_UECapability_t UECapability; /* TODO declared static to allow returning this has an address should be allocated in a cleaner way. */ + static OAI_UECapability_t UECapability; /// TODO declared static to allow returning this has an address should be allocated in a cleaner way. static SupportedBandEUTRA_t Bandlist[4]; // the macro ASN_SEQUENCE_ADD() does not copy the source, but only stores a reference to it static InterFreqBandInfo_t InterFreqBandInfo[4][4]; // the macro ASN_SEQUENCE_ADD() does not copy the source, but only stores a reference to it static BandInfoEUTRA_t BandInfoEUTRA[4]; // the macro ASN_SEQUENCE_ADD() does not copy the source, but only stores a reference to it @@ -2652,7 +2706,7 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname) UECapability.sdu_size, enc_rval.encoded + 7); { char *sdu; - sdu = malloc (3 * UECapability.sdu_size + 1 /* For '\0' */); + //sdu = malloc (3 * UECapability.sdu_size + 1 ); ///* For '\0' for (i = 0; i < UECapability.sdu_size; i++) { sprintf (&sdu[3 * i], "%02x.", UECapability.sdu[i]); diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.h b/openair2/RRC/NR/MESSAGES/asn1_msg.h new file mode 100644 index 0000000000..640c86dade --- /dev/null +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.h @@ -0,0 +1,274 @@ +/* + * 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 + */ + +/*! \file asn1_msg.h +* \brief primitives to build the asn1 messages +* \author Raymond Knopp and Navid Nikaein +* \date 2011 +* \version 1.0 +* \company Eurecom +* \email: raymond.knopp@eurecom.fr and navid.nikaein@eurecom.fr +*/ + +#ifdef USER_MODE +#include +#include +#include /* for atoi(3) */ +#include /* for getopt(3) */ +#include /* for strerror(3) */ +#include /* for EX_* exit codes */ +#include /* for errno */ +#else +#include /* Needed by all modules */ +#endif + +#include +#include /* for _ASN_DEFAULT_STACK_MAX */ + +#include "RRC/NR/defs_NR.h" + +/* + * The variant of the above function which dumps the BASIC-XER (XER_F_BASIC) + * output into the chosen string buffer. + * RETURN VALUES: + * 0: The structure is printed. + * -1: Problem printing the structure. + * WARNING: No sensible errno value is returned. + */ +int xer_sprint_NR(char *string, size_t string_size, struct asn_TYPE_descriptor_s *td, void *sptr); + +uint16_t get_adjacent_cell_id_NR(uint8_t Mod_id,uint8_t index); + +uint8_t get_adjacent_cell_mod_id_NR(uint16_t phyCellId); + +/** +\brief Generate configuration for SIB1 (eNB). +@param carrier pointer to Carrier information +@param N_RB_DL Number of downlink PRBs +@param phich_Resource PHICH resoure parameter +@param phich_duration PHICH duration parameter +@param frame radio frame number +@return size of encoded bit stream in bytes*/ +uint8_t do_MIB_NR(rrc_gNB_carrier_data_t *carrier, + uint32_t frame, + uint32_t ssb_SubcarrierOffset, + uint32_t pdcch_ConfigSIB1, + uint32_t subCarrierSpacingCommon, + uint32_t dmrs_TypeA_Position); +/** +\brief Generate configuration for SIB1 (eNB). +@param carrier pointer to Carrier information +@param Mod_id Instance of eNB +@param Component carrier Component carrier to configure +@param configuration Pointer Configuration Request structure +@return size of encoded bit stream in bytes*/ + +uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,int Mod_id,int CC_id, gNB_RrcConfigurationReq *configuration + ); + +/** +\brief Generate a default configuration for SIB2/SIB3 in one System Information PDU (eNB). +@param Mod_id Index of eNB (used to derive some parameters) +@param buffer Pointer to PER-encoded ASN.1 description of SI PDU +@param systemInformation Pointer to asn1c C representation of SI PDU +@param sib2 Pointer (returned) to sib2 component withing SI PDU +@param sib3 Pointer (returned) to sib3 component withing SI PDU +@param sib13 Pointer (returned) to sib13 component withing SI PDU +@param MBMS_flag Indicates presence of MBMS system information (when 1) +@return size of encoded bit stream in bytes*/ + +/*uint8_t do_SIB23(uint8_t Mod_id, + int CC_id +#if defined(ENABLE_ITTI) + , RrcConfigurationReq *configuration +#endif + ); + +/** +\brief Generate an RRCConnectionRequest UL-CCCH-Message (UE) based on random string or S-TMSI. This +routine only generates an mo-data establishment cause. +@param buffer Pointer to PER-encoded ASN.1 description of UL-DCCH-Message PDU +@param rv 5 byte random string or S-TMSI +@returns Size of encoded bit stream in bytes*/ + +/*uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv); + +/** \brief Generate an RRCConnectionSetupComplete UL-DCCH-Message (UE) +@param buffer Pointer to PER-encoded ASN.1 description of UL-DCCH-Message PDU +@returns Size of encoded bit stream in bytes*/ + +/*uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t* buffer, const uint8_t Transaction_id, const int dedicatedInfoNASLength, + const char* dedicatedInfoNAS); + +/** \brief Generate an RRCConnectionReconfigurationComplete UL-DCCH-Message (UE) +@param buffer Pointer to PER-encoded ASN.1 description of UL-DCCH-Message PDU +@returns Size of encoded bit stream in bytes*/ + +/*uint8_t +do_RRCConnectionReconfigurationComplete( + const protocol_ctxt_t* const ctxt_pP, + uint8_t* buffer, + const uint8_t Transaction_id +); + +/** +\brief Generate an RRCConnectionSetup DL-CCCH-Message (eNB). This routine configures SRB_ToAddMod (SRB1/SRB2) and +PhysicalConfigDedicated IEs. The latter does not enable periodic CQI reporting (PUCCH format 2/2a/2b) or SRS. +@param ctxt_pP Running context +@param ue_context_pP UE context +@param CC_id Component Carrier ID +@param buffer Pointer to PER-encoded ASN.1 description of DL-CCCH-Message PDU +@param transmission_mode Transmission mode for UE (1-9) +@param UE_id UE index for this message +@param Transaction_id Transaction_ID for this message +@param SRB_configList Pointer (returned) to SRB1_config/SRB2_config(later) IEs for this UE +@param physicalConfigDedicated Pointer (returned) to PhysicalConfigDedicated IE for this UE +@returns Size of encoded bit stream in bytes*/ +/*uint8_t +do_RRCConnectionSetup( + const protocol_ctxt_t* const ctxt_pP, + rrc_eNB_ue_context_t* const ue_context_pP, + int CC_id, + uint8_t* const buffer, + const uint8_t transmission_mode, + const uint8_t Transaction_id, + SRB_ToAddModList_t** SRB_configList, + struct PhysicalConfigDedicated** physicalConfigDedicated +); + +/** +\brief Generate an RRCConnectionReconfiguration DL-DCCH-Message (eNB). This routine configures SRBToAddMod (SRB2) and one DRBToAddMod +(DRB3). PhysicalConfigDedicated is not updated. +@param ctxt_pP Running context +@param buffer Pointer to PER-encoded ASN.1 description of DL-CCCH-Message PDU +@param Transaction_id Transaction_ID for this message +@param SRB_list Pointer to SRB List to be added/modified (NULL if no additions/modifications) +@param DRB_list Pointer to DRB List to be added/modified (NULL if no additions/modifications) +@param DRB_list2 Pointer to DRB List to be released (NULL if none to be released) +@param sps_Config Pointer to sps_Config to be modified (NULL if no modifications, or default if initial configuration) +@param physicalConfigDedicated Pointer to PhysicalConfigDedicated to be modified (NULL if no modifications) +@param MeasObj_list Pointer to MeasObj List to be added/modified (NULL if no additions/modifications) +@param ReportConfig_list Pointer to ReportConfig List (NULL if no additions/modifications) +@param QuantityConfig Pointer to QuantityConfig to be modified (NULL if no modifications) +@param MeasId_list Pointer to MeasID List (NULL if no additions/modifications) +@param mobilityInfo mobility control information for handover +@param speedStatePars speed state parameteres for handover +@param mac_MainConfig Pointer to Mac_MainConfig(NULL if no modifications) +@param measGapConfig Pointer to MeasGapConfig (NULL if no modifications) +@param cba_rnti RNTI for the cba transmission +@returns Size of encoded bit stream in bytes*/ + +/*uint16_t +do_RRCConnectionReconfiguration( + const protocol_ctxt_t* const ctxt_pP, + uint8_t *buffer, + uint8_t Transaction_id, + SRB_ToAddModList_t *SRB_list, + DRB_ToAddModList_t *DRB_list, + DRB_ToReleaseList_t *DRB_list2, + struct SPS_Config *sps_Config, + struct PhysicalConfigDedicated *physicalConfigDedicated, + MeasObjectToAddModList_t *MeasObj_list, + ReportConfigToAddModList_t *ReportConfig_list, + QuantityConfig_t *quantityConfig, + MeasIdToAddModList_t *MeasId_list, + MAC_MainConfig_t *mac_MainConfig, + MeasGapConfig_t *measGapConfig, + MobilityControlInfo_t *mobilityInfo, + struct MeasConfig__speedStatePars *speedStatePars, + RSRP_Range_t *rsrp, + C_RNTI_t *cba_rnti, + struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList* dedicatedInfoNASList +#if defined(Rel10) || defined(Rel14) + , SCellToAddMod_r10_t *SCell_config +#endif + ); + +/** +\brief Generate an RRCConnectionReestablishmentReject DL-CCCH-Message (eNB). +@param Mod_id Module ID of eNB +@param buffer Pointer to PER-encoded ASN.1 description of DL-CCCH-Message PDU +@returns Size of encoded bit stream in bytes*/ +/*uint8_t +do_RRCConnectionReestablishmentReject( + uint8_t Mod_id, + uint8_t* const buffer); + +/** +\brief Generate an RRCConnectionReject DL-CCCH-Message (eNB). +@param Mod_id Module ID of eNB +@param buffer Pointer to PER-encoded ASN.1 description of DL-CCCH-Message PDU +@returns Size of encoded bit stream in bytes*/ +/*uint8_t +do_RRCConnectionReject( + uint8_t Mod_id, + uint8_t* const buffer); + +/** +\brief Generate an RRCConnectionRequest UL-CCCH-Message (UE) based on random string or S-TMSI. This +routine only generates an mo-data establishment cause. +@param Mod_id Module ID of eNB +@param buffer Pointer to PER-encoded ASN.1 description of UL-DCCH-Message PDU +@param transaction_id Transaction index +@returns Size of encoded bit stream in bytes*/ + +/*uint8_t do_RRCConnectionRelease(uint8_t Mod_id, uint8_t *buffer,int Transaction_id); + +/*** + * \brief Generate an MCCH-Message (eNB). This routine configures MBSFNAreaConfiguration (PMCH-InfoList and Subframe Allocation for MBMS data) + * @param buffer Pointer to PER-encoded ASN.1 description of MCCH-Message PDU + * @returns Size of encoded bit stream in bytes +*/ +/*uint8_t do_MCCHMessage(uint8_t *buffer); +#if defined(Rel10) || defined(Rel14) +/*** + * \brief Generate an MCCH-Message (eNB). This routine configures MBSFNAreaConfiguration (PMCH-InfoList and Subframe Allocation for MBMS data) + * @param buffer Pointer to PER-encoded ASN.1 description of MCCH-Message PDU + * @returns Size of encoded bit stream in bytes +*/ +/*uint8_t do_MBSFNAreaConfig(uint8_t Mod_id, + uint8_t sync_area, + uint8_t *buffer, + MCCH_Message_t *mcch_message, + MBSFNAreaConfiguration_r9_t **mbsfnAreaConfiguration); +#endif + +uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_id,long rsrp_s,long rsrq_s,long rsrp_t,long rsrq_t); + +uint8_t do_DLInformationTransfer(uint8_t Mod_id, uint8_t **buffer, uint8_t transaction_id, uint32_t pdu_length, uint8_t *pdu_buffer); + +uint8_t do_ULInformationTransfer(uint8_t **buffer, uint32_t pdu_length, uint8_t *pdu_buffer); + +OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer); + +uint8_t +do_UECapabilityEnquiry( + const protocol_ctxt_t* const ctxt_pP, + uint8_t* const buffer, + const uint8_t Transaction_id +); + +uint8_t do_SecurityModeCommand( + const protocol_ctxt_t* const ctxt_pP, + uint8_t* const buffer, + const uint8_t Transaction_id, + const uint8_t cipheringAlgorithm, + const uint8_t integrityProtAlgorithm); diff --git a/openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-InterNodeDefinitions.asn b/openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-InterNodeDefinitions.asn new file mode 100755 index 0000000000..13cbb92584 --- /dev/null +++ b/openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-InterNodeDefinitions.asn @@ -0,0 +1,282 @@ +NR-InterNodeDefinitions DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- TAG-HANDOVER-COMMAND-START + +HandoverCommand ::= SEQUENCE { + criticalExtensions CHOICE { + c1 CHOICE{ + handoverCommand HandoverCommand-IEs, + spare3 NULL, spare2 NULL, spare1 NULL + }, + criticalExtensionsFuture SEQUENCE {} + } +} + +HandoverCommand-IEs ::= SEQUENCE { + handoverCommandMessage OCTET STRING (CONTAINING RRCReconfiguration), + nonCriticalExtension SEQUENCE {} OPTIONAL +} + +-- TAG-HANDOVER-COMMAND-STOP +-- TAG-HANDOVER-PREPARATION-INFORMATION-START + +HandoverPreparationInformation ::= SEQUENCE { + criticalExtensions CHOICE { + c1 CHOICE{ + handoverPreparationInformation HandoverPreparationInformation-IEs, + spare3 NULL, spare2 NULL, spare1 NULL + }, + criticalExtensionsFuture SEQUENCE {} + } +} + +HandoverPreparationInformation-IEs ::= SEQUENCE { + ue-CapabilityRAT-List UE-CapabilityRAT-ContainerList, + sourceConfig OCTET STRING (CONTAINING RRCReconfiguration), + rrm-Config RRM-Config OPTIONAL, + as-Context AS-Context OPTIONAL, + nonCriticalExtension SEQUENCE {} OPTIONAL +} + +AS-Context ::= SEQUENCE { + reestablishmentInfo SEQUENCE { + sourcePhysCellId PhysCellId, + targetCellShortMAC-I ShortMAC-I, + additionalReestabInfoList ReestabNCellInfoList OPTIONAL + } OPTIONAL, + -- FFS Whether to change e.g. move all re-establishment info to Xx + configRestrictInfo ConfigRestrictInfoSCG OPTIONAL, + ... +} + +ReestabNCellInfoList ::= SEQUENCE ( SIZE (1..maxCellPrep) ) OF ReestabNCellInfo + +ReestabNCellInfo::= SEQUENCE{ + cellIdentity CellIdentity, + key-gNodeB-Star BIT STRING (SIZE (256)), + shortMAC-I ShortMAC-I +} + +RRM-Config ::= SEQUENCE { + ue-InactiveTime ENUMERATED { + s1, s2, s3, s5, s7, s10, s15, s20, + s25, s30, s40, s50, min1, min1s20c, min1s40, + min2, min2s30, min3, min3s30, min4, min5, min6, + min7, min8, min9, min10, min12, min14, min17, min20, + min24, min28, min33, min38, min44, min50, hr1, + hr1min30, hr2, hr2min30, hr3, hr3min30, hr4, hr5, hr6, + hr8, hr10, hr13, hr16, hr20, day1, day1hr12, day2, + day2hr12, day3, day4, day5, day7, day10, day14, day19, + day24, day30, dayMoreThan30} OPTIONAL , + candidateCellInfoList CandidateCellInfoList OPTIONAL, + ... +} + +-- TAG-HANDOVER-PREPARATION-INFORMATION-STOP +-- TAG-CG-CONFIG-START + +CG-Config ::= SEQUENCE { + criticalExtensions CHOICE { + c1 CHOICE{ + cg-Config CG-Config-IEs, + spare3 NULL, spare2 NULL, spare1 NULL + }, + criticalExtensionsFuture SEQUENCE {} + } +} + +CG-Config-IEs ::= SEQUENCE { + scg-CellGroupConfig OCTET STRING (CONTAINING RRCReconfiguration) OPTIONAL, + scg-RB-Config OCTET STRING (CONTAINING RadioBearerConfig) OPTIONAL, + configRestrictModReq ConfigRestrictModReqSCG OPTIONAL, + drx-InfoSCG DRX-Info OPTIONAL, + candidateCellInfoListSN OCTET STRING (CONTAINING CandidateCellInfoList) OPTIONAL, + measConfigSN MeasConfigSN OPTIONAL, + selectedBandCombinationNR BandCombinationIndex OPTIONAL, + nonCriticalExtension SEQUENCE {} OPTIONAL +} + +MeasConfigSN ::= SEQUENCE { + measuredFrequenciesFR1 SEQUENCE (SIZE (1..maxMeasFreqsMN)) OF NR-FreqInfo OPTIONAL, + ... +} + +NR-FreqInfo ::= SEQUENCE { + measuredFrequency ARFCN-ValueNR OPTIONAL, + ... +} + +ConfigRestrictModReqSCG ::= SEQUENCE { + requestedBC-MRDC BandCombinationIndex OPTIONAL, + requestedBPC-ListMRDC BPC-IndexList OPTIONAL, + requestedP-MaxFR1 P-Max OPTIONAL, + ... +} + +BandCombinationIndex ::= INTEGER (1..maxBandComb) + +-- TAG-CG-CONFIG-STOP +-- TAG-CG-CONFIG-INFO-START + +CG-ConfigInfo ::= SEQUENCE { + criticalExtensions CHOICE { + c1 CHOICE{ + cg-ConfigInfo CG-ConfigInfo-IEs, + spare3 NULL, spare2 NULL, spare1 NULL + }, + criticalExtensionsFuture SEQUENCE {} + } +} + +CG-ConfigInfo-IEs ::= SEQUENCE { + ue-CapabilityInfo OCTET STRING (CONTAINING UE-CapabilityRAT-ContainerList) OPTIONAL,-- Cond SN-Addition + candidateCellInfoListMN CandidateCellInfoList OPTIONAL, + candidateCellInfoListSN OCTET STRING (CONTAINING CandidateCellInfoList) OPTIONAL, + measResultCellListSFTD MeasResultCellListSFTD OPTIONAL, + scgFailureInfo SEQUENCE { + failureType ENUMERATED { t310-Expiry, randomAccessProblem, + rlc-MaxNumRetx, scg-ChangeFailure, + scg-reconfigFailure, + srb3-IntegrityFailure}, + measResultSCG OCTET STRING (CONTAINING MeasResultSCG-Failure) + } OPTIONAL, + configRestrictInfo ConfigRestrictInfoSCG OPTIONAL, + drx-InfoMCG DRX-Info OPTIONAL, + measConfigMN MeasConfigMN OPTIONAL, + sourceConfigSCG OCTET STRING (CONTAINING RRCReconfiguration) OPTIONAL, + scg-RB-Config OCTET STRING (CONTAINING RadioBearerConfig) OPTIONAL, + mcg-RB-Config OCTET STRING (CONTAINING RadioBearerConfig) OPTIONAL, + nonCriticalExtension SEQUENCE {} OPTIONAL +} + +ConfigRestrictInfoSCG ::= SEQUENCE { + allowedBC-ListMRDC BandCombinationIndexList OPTIONAL, + allowedBPC-ListMRDC BPC-IndexList OPTIONAL, + powerCoordination-FR1 SEQUENCE { + p-maxNR P-Max OPTIONAL, + p-maxEUTRA P-Max OPTIONAL + } OPTIONAL, + servCellIndexRangeSCG SEQUENCE { + lowBound ServCellIndex, + upBound ServCellIndex + } OPTIONAL, -- Cond SN-Addition + maxMeasFreqsSCG-NR INTEGER(1..maxMeasFreqsMN) OPTIONAL, + ... +} + +BandCombinationIndexList ::= SEQUENCE (SIZE (1..maxBandComb)) OF BandCombinationIndex + +BPC-IndexList ::= SEQUENCE (SIZE (1..maxBasebandProcComb)) OF BPC-Index +BPC-Index ::= INTEGER (1..maxBasebandProcComb) + +DRX-Info ::= SEQUENCE { + drx-LongCycleStartOffset CHOICE { + ms10 INTEGER(0..9), + ms20 INTEGER(0..19), + ms32 INTEGER(0..31), + ms40 INTEGER(0..39), + ms60 INTEGER(0..59), + ms64 INTEGER(0..63), + ms70 INTEGER(0..69), + ms80 INTEGER(0..79), + ms128 INTEGER(0..127), + ms160 INTEGER(0..159), + ms256 INTEGER(0..255), + ms320 INTEGER(0..319), + ms512 INTEGER(0..511), + ms640 INTEGER(0..639), + ms1024 INTEGER(0..1023), + ms1280 INTEGER(0..1279), + ms2048 INTEGER(0..2047), + ms2560 INTEGER(0..2559), + ms5120 INTEGER(0..5119), + ms10240 INTEGER(0..10239) + }, + shortDRX SEQUENCE { + drx-ShortCycle ENUMERATED { + ms2, ms3, ms4, ms5, ms6, ms7, ms8, ms10, ms14, ms16, ms20, ms30, ms32, + ms35, ms40, ms64, ms80, ms128, ms160, ms256, ms320, ms512, ms640, spare9, + spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 }, + drx-ShortCycleTimer INTEGER (1..16) + } OPTIONAL +} + +MeasConfigMN ::= SEQUENCE { + measuredFrequenciesMN SEQUENCE (SIZE (1..maxMeasFreqsMN)) OF NR-FreqInfo OPTIONAL, + measGapConfigFR1 GapConfig OPTIONAL, + gapPurpose ENUMERATED {perUE, perFR1} OPTIONAL, + ... +} + + +-- TAG-CG-CONFIG-INFO-STOP +-- TAG-MEASUREMENT-TIMING-CONFIGURATION-START + +MeasurementTimingConfiguration ::= SEQUENCE { + criticalExtensions CHOICE { + c1 CHOICE{ + measTimingConf MeasurementTimingConfiguration-IEs, + spare3 NULL, spare2 NULL, spare1 NULL + }, + criticalExtensionsFuture SEQUENCE {} + } +} + +MeasurementTimingConfiguration-IEs ::= SEQUENCE { + measTiming MeasTimingList OPTIONAL, + nonCriticalExtension SEQUENCE {} OPTIONAL +} + +MeasTimingList ::= SEQUENCE (SIZE (1..maxMeasFreqsMN)) OF MeasTiming + +MeasTiming ::= SEQUENCE { + carrierFreq ARFCN-ValueNR OPTIONAL, + ssb-MeasurementTimingConfiguration ENUMERATED {ffsTypeAndValue} OPTIONAL, + ... +} + +-- TAG-MEASUREMENT-TIMING-CONFIGURATION-STOP +-- TAG-CANDIDATE-CELL-INFO-LIST-START + +CandidateCellInfoList ::= SEQUENCE (SIZE (1.. maxNrofSCells)) OF CandidateCellInfo + +CandidateCellInfo ::= SEQUENCE { + cellIdentification SEQUENCE { + physCellId PhysCellId, + dl-CarrierFreq ARFCN-ValueNR + }, + measResultCell MeasQuantityResults OPTIONAL, + candidateRS-IndexListSSB CandidateRS-IndexInfoListSSB OPTIONAL, + candidateRS-IndexListCSI-RS CandidateRS-IndexInfoListCSI-RS OPTIONAL, + ... +} + +CandidateRS-IndexInfoListSSB ::= SEQUENCE (SIZE (1..maxNrofIndexesToReport)) OF CandidateRS-IndexInfoSSB + +CandidateRS-IndexInfoSSB ::= SEQUENCE { + ssb-Index SSB-Index, + measResultSSB MeasQuantityResults OPTIONAL, + ... +} + +CandidateRS-IndexInfoListCSI-RS ::= SEQUENCE (SIZE (1..maxNrofIndexesToReport)) OF CandidateRS-IndexInfoCSI-RS + +CandidateRS-IndexInfoCSI-RS ::= SEQUENCE { + csi-RS-Index CSI-RS-Index, + measResultCSI-RS MeasQuantityResults OPTIONAL, + ... +} + +-- TAG-CANDIDATE-CELL-INFO-LIST-STOP +-- TAG_NR-MULTIPLICITY-AND-CONSTRAINTS-START + +maxMeasFreqsMN INTEGER ::= 32 -- Maximum number of MN-configured measurement frequencies +maxCellPrep INTEGER ::= 32 -- Maximum number of cells prepared for handover + +-- TAG_NR-MULTIPLICITY-AND-CONSTRAINTS-STOP +-- TAG_NR-INTER-NODE-DEFINITIONS-END-START + +END + diff --git a/openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-RRC-Definitions.asn b/openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-RRC-Definitions.asn new file mode 100755 index 0000000000..84426f50bb --- /dev/null +++ b/openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-RRC-Definitions.asn @@ -0,0 +1,5480 @@ +NR-RRC-Definitions DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- TAG-BCCH-BCH-MESSAGE-START + +BCCH-BCH-Message ::= SEQUENCE { + message BCCH-BCH-MessageType +} + +BCCH-BCH-MessageType ::= CHOICE { + mib MIB, + messageClassExtension SEQUENCE {} +} + +-- TAG-BCCH-BCH-MESSAGE-STOP +-- TAG-DL-DCCH-MESSAGE-START + +DL-DCCH-Message ::= SEQUENCE { + message DL-DCCH-MessageType +} + +DL-DCCH-MessageType ::= CHOICE { + c1 CHOICE { + rrcReconfiguration RRCReconfiguration, + spare15 NULL, spare14 NULL, spare13 NULL, + spare12 NULL, spare11 NULL, spare10 NULL, + spare9 NULL, spare8 NULL, spare7 NULL, + spare6 NULL, spare5 NULL, spare4 NULL, + spare3 NULL, spare2 NULL, spare1 NULL + }, + messageClassExtension SEQUENCE {} +} + +-- TAG-DL-DCCH-MESSAGE-STOP +-- TAG-UL-DCCH-MESSAGE-START + +UL-DCCH-Message ::= SEQUENCE { + message UL-DCCH-MessageType +} + +UL-DCCH-MessageType ::= CHOICE { + c1 CHOICE { + measurementReport MeasurementReport, + rrcReconfigurationComplete RRCReconfigurationComplete, + spare14 NULL, spare13 NULL, spare12 NULL, + spare11 NULL, spare10 NULL, spare9 NULL, + spare8 NULL, spare7 NULL, spare6 NULL, + spare5 NULL, spare4 NULL, spare3 NULL, + spare2 NULL, spare1 NULL + }, + messageClassExtension SEQUENCE {} +} + +-- TAG-UL-DCCH-MESSAGE-STOP +-- TAG-MIB-START + +MIB ::= SEQUENCE { + -- The 6 most significant bit (MSB) of the 10 bit System Frame Number. The 4 LSB of the SFN are conveyed in the PBCH transport block + -- as well but outside the MIB. + systemFrameNumber BIT STRING (SIZE (6)), + + -- Subcarrier spacing for SIB1, Msg.2/4 for initial access and broadcast SI-messages. + -- If the UE acquires this MIB on a carrier frequency <6GHz, the values 15 and 30 kHz are applicable. + -- If the UE acquires this MIB on a carrier frequency >6GHz, the values 60 and 120 kHz are applicable. + subCarrierSpacingCommon ENUMERATED {scs15or60, scs30or120}, + + -- The frequency domain offset between SSB and the overall resource block grid in number of subcarriers. (See 38.211, section 7.4.3.1) + -- Note: For frequencies <6 GHz a fith, this field may comprise only the 4 least significant bits of the ssb-SubcarrierOffset. + -- The codepoint "FFS_RAN1" indicates that this cell does not provide SIB1 and that there is hence no common CORESET. + ssb-SubcarrierOffset INTEGER (0..15), + + -- Position of (first) DL DM-RS. Corresponds to L1 parameter 'DL-DMRS-typeA-pos' (see 38.211, section 7.4.1.1.1) + dmrs-TypeA-Position ENUMERATED {pos2, pos3}, + + -- Determines a bandwidth for PDCCH/SIB, a common ControlResourceSet (CORESET) a common search space and necessary PDCCH parameters. + -- Corresponds to L1 parameter 'RMSI-PDCCH-Config' (see FFS_Specification, section FFS_Section) + pdcch-ConfigSIB1 INTEGER (0..255), + + -- Indicates that UE shall not camp on this cell + cellBarred ENUMERATED {barred, notBarred}, + + -- Controls cell reselection to intra-frequency cells when the highest ranked cell is barred, or treated as barred by the UE, + -- as specified in TS 38.304. + intraFreqReselection ENUMERATED {allowed, notAllowed}, + spare BIT STRING (SIZE (1)) +} + +-- TAG-MIB-STOP +-- TAG-MEASUREMENTREPORT-START + +MeasurementReport ::= SEQUENCE { + criticalExtensions CHOICE { + measurementReport MeasurementReport-IEs, + criticalExtensionsFuture SEQUENCE {} + } +} + +MeasurementReport-IEs ::= SEQUENCE { + measResults MeasResults, + + lateNonCriticalExtension OCTET STRING OPTIONAL, + nonCriticalExtension SEQUENCE{} OPTIONAL +} + +-- TAG-MEASUREMENTREPORT-STOP +-- TAG-RRCRECONFIGURATION-START + +RRCReconfiguration ::= SEQUENCE { + rrc-TransactionIdentifier RRC-TransactionIdentifier, + criticalExtensions CHOICE { + rrcReconfiguration RRCReconfiguration-IEs, + criticalExtensionsFuture SEQUENCE {} + } +} + +RRCReconfiguration-IEs ::= SEQUENCE { + -- Configuration of Radio Bearers (DRBs, SRBs) including SDAP/PDCP. + -- In EN-DC this field may only be present if the RRCReconfiguration + -- is transmitted over SRB3. + radioBearerConfig RadioBearerConfig OPTIONAL, -- Need M + + -- Configuration of secondary cell group (EN-DC): + secondaryCellGroup OCTET STRING (CONTAINING CellGroupConfig) OPTIONAL, -- Need M + + measConfig MeasConfig OPTIONAL, -- Need M + + lateNonCriticalExtension OCTET STRING OPTIONAL, + nonCriticalExtension SEQUENCE {} OPTIONAL +} + +-- TAG-RRCRECONFIGURATION-STOP +-- TAG-RRCRECONFIGURATIONCOMPLETE-START + +RRCReconfigurationComplete ::= SEQUENCE { + rrc-TransactionIdentifier RRC-TransactionIdentifier, + criticalExtensions CHOICE { + rrcReconfigurationComplete RRCReconfigurationComplete-IEs, + criticalExtensionsFuture SEQUENCE {} + } +} + +RRCReconfigurationComplete-IEs ::= SEQUENCE { + lateNonCriticalExtension OCTET STRING OPTIONAL, + nonCriticalExtension SEQUENCE {} OPTIONAL +} + +-- TAG-RRCRECONFIGURATIONCOMPLETE-STOP +-- TAG-SIB1-START + +SIB1 ::= SEQUENCE { + + -- FFS / TODO: Add other parameters. + + -- Frequency offset for the SSB of -5kHz (M=-1) or +5kHz (M=1). When the field is absent, the UE applies no offset (M=0). + -- The offset is only applicable for the frequency range 0-2.65GHz. Corresponds to parameter 'M' (see 38.101, section FFS_Section) + frequencyOffsetSSB ENUMERATED {khz-5, khz5} OPTIONAL, -- Need R + + -- Time domain positions of the transmitted SS-blocks in an SS-Burst-Set (see 38.213, section 4.1) + ssb-PositionsInBurst SEQUENCE { + -- Indicates the presence of the up to 8 SSBs in one group + inOneGroup BIT STRING (SIZE (8)), + -- For above 6 GHz: indicates which groups of SSBs is present + groupPresence BIT STRING (SIZE (8)) OPTIONAL -- Cond above6GHzOnly + }, + + -- The SSB periodicity in msec for the rate matching purpose (see 38.211, section [7.4.3.1]) + ssb-PeriodicityServingCell ENUMERATED {ms5, ms10, ms20, ms40, ms80, ms160, spare1, spare2}, + + -- TX power that the NW used for SSB transmission. The UE uses it to estimate the RA preamble TX power. + -- (see 38.213, section 7.4) + ss-PBCH-BlockPower INTEGER (-60..50), + + uplinkConfigCommon UplinkConfigCommon OPTIONAL, + -- FFS: How to indicate the FrequencyInfoUL for the SUL + supplementaryUplink SEQUENCE { + uplinkConfigCommon UplinkConfigCommon OPTIONAL + -- FFS: Add additional (selection) criteria determining when/whether the UE shall use the SUL frequency + } OPTIONAL, -- Cond SUL + + tdd-UL-DL-Configuration TDD-UL-DL-ConfigCommon OPTIONAL, -- Cond TDD + tdd-UL-DL-configurationCommon2 TDD-UL-DL-ConfigCommon OPTIONAL, -- Cond TDD + + pdcch-ConfigCommon PDCCH-ConfigCommon OPTIONAL, + pucch-ConfigCommon PUCCH-ConfigCommon OPTIONAL, + + lateNonCriticalExtension OCTET STRING OPTIONAL, + nonCriticalExtension SEQUENCE{} OPTIONAL +} + +-- TAG-SIB1-STOP +-- TAG-SETUP-RELEASE-START + +SetupRelease { ElementTypeParam } ::= CHOICE { + release NULL, + setup ElementTypeParam +} + +-- TAG-SETUP-RELEASE-STOP +-- TAG-ADDITIONALSPECTRUMEMISSION-START + +AdditionalSpectrumEmission ::= INTEGER (0..7) + +-- TAG-ADDITIONALSPECTRUMEMISSION-STOP +-- TAG-ALPHA-START + +Alpha ::= ENUMERATED {alpha0, alpha04, alpha05, alpha06, alpha07, alpha08, alpha09, alpha1} + +-- TAG-ALPHA-STOP +-- TAG-ARFCN-VALUE-NR-START + +ARFCN-ValueNR ::= INTEGER (0..3279165) + +-- TAG-ARFCN-VALUE-NR-STOP +-- TAG-BANDWIDTH-PART-START + + +-- Generic parameters used in Uplink- and Downlink bandwidth parts +BWP ::= SEQUENCE { + -- Frequency domain location and bandwidth of this bandwidth part defined commonly in a table (FFS_Section). The location is given as + -- distance (in number of PRBs) to point A (absoluteFrequencyPointA in FrequencyInfoDL). + -- Corresponds to L1 parameter 'DL-BWP-loc'. (see 38.211, section FFS_Section). + -- In case of TDD, a BWP-pair (UL BWP and DL BWP with the same bwp-Id) must have the same location (see 38.211, section REF) + locationAndBandwidth INTEGER (0..37949), + -- Subcarrier spacing to be used in this BWP for all channels and + -- reference signals unless explicitly configured elsewhere. + -- Corresponds to subcarrier spacing according to 38.211, Table 4.2-1. + -- The value kHz15 corresponds to µ=0, kHz30 to µ=1, and so on. Only the values 15 or 30 kHz (<6GHz), 60 or 120 kHz (>6GHz) are + -- applicable. + subcarrierSpacing SubcarrierSpacing, + -- Indicates whether to use the extended cyclic prefix for this bandwidth part. If not set, the UE uses the normal cyclic prefix. + -- Normal CP is supported for all numerologies and slot formats. Extended CP is supported only for 60 kHz subcarrier spacing. + -- (see 38.211, section 4.2.2) + cyclicPrefix ENUMERATED { extended } OPTIONAL -- Need R +} + +BWP-Uplink ::= SEQUENCE { + -- An identifier for this bandwidth part. Other parts of the RRC configuration use the BWP-Id to associate themselves with a particular + -- bandwidth part. The BWP ID=0 is always associated with the initial BWP and may hence not be used here (in other bandwidth parts). + -- The NW may trigger the UE to swtich UL or DL BWP using a DCI field. The four code points in that DCI field map to the RRC-configured + -- BWP-ID as follows: For up to 3 configured BWPs (in addition to the initial BWP) the DCI code point is equivalent to the BWP ID + -- (initial = 0, first dedicated = 1, ...). If the NW configures 4 dedicated bandwidth parts, they are identified by DCI code + -- points 0 to 3. In this case it is not possible to switch to the initial BWP using the DCI field. + -- Corresponds to L1 parameter 'UL-BWP-index'. (see 38.211, 38.213, section 12) + bwp-Id BWP-Id, + bwp-Common BWP-UplinkCommon OPTIONAL, -- Need M + bwp-Dedicated BWP-UplinkDedicated OPTIONAL, -- Need M + ... +} + +BWP-UplinkCommon ::= SEQUENCE { + genericParameters BWP, + -- Configuration of cell specific random access parameters which the UE uses for contention based and contention free random access + -- as well as for contention based beam failure recovery. + rach-ConfigCommon SetupRelease { RACH-ConfigCommon } OPTIONAL, -- Need M + -- Cell specific parameters for the PUSCH + pusch-ConfigCommon SetupRelease { PUSCH-ConfigCommon } OPTIONAL, -- Need M + + -- Cell specific parameters for the PUCCH + pucch-ConfigCommon SetupRelease { PUCCH-ConfigCommon } OPTIONAL, -- Need M + ... +} + +BWP-UplinkDedicated ::= SEQUENCE { + -- PUCCH configuration for one BWP of the regular UL or SUL of a serving cell. If the UE is configured with SUL, the network + -- configures PUCCH only on the BWPs of one of the uplinks (UL or SUL). + pucch-Config SetupRelease { PUCCH-Config } OPTIONAL, -- Need M + -- PUSCH configuration for one BWP of the regular UL or SUL of a serving cell. If the UE is configured with SUL and + -- if it has a PUSCH-Config for both UL and SUL, a carrier indicator field in DCI indicates for which of the two to use an UL grant. + -- See also L1 parameter 'dynamicPUSCHSUL' (see 38.213, section FFS_Section) + pusch-Config SetupRelease { PUSCH-Config } OPTIONAL, -- Need M + -- A Configured-Grant of typ1 or type2. It may be configured for Ul or SUL but in case of type1 [FFS also type2] not for both at a time. + configuredGrantConfig SetupRelease { ConfiguredGrantConfig } OPTIONAL, -- Need M + -- Uplink sounding reference signal configuration + srs-Config SetupRelease { SRS-Config } OPTIONAL, -- Need M + -- Determines how the UE performs Beam Failure Recovery upon detection of a Beam Failure (see RadioLinkMonitoringConfig) + beamFailureRecoveryConfig SetupRelease { BeamFailureRecoveryConfig } OPTIONAL, -- Need M + ... +} + + +BWP-Downlink ::= SEQUENCE { + -- An identifier for this bandwidth part. Other parts of the RRC configuration use the BWP-Id to associate themselves with a particular + -- bandwidth part. The BWP ID=0 is always associated with the initial BWP and may hence not be used here. (in other bandwidth parts). + -- The NW may trigger the UE to swtich UL or DL BWP using a DCI field. The four code points in that DCI field map to the RRC-configured + -- BWP-ID as follows: For up to 3 configured BWPs (in addition to the initial BWP) the DCI code point is equivalent to the BWP ID + -- (initial = 0, first dedicated = 1, ...). If the NW configures 4 dedicated bandwidth parts, they are identified by DCI code + -- points 0 to 3. In this case it is not possible to switch to the initial BWP using the DCI field. + -- Corresponds to L1 parameter 'DL-BWP-index'. (see 38.211, 38.213, section 12) + bwp-Id BWP-Id, + bwp-Common BWP-DownlinkCommon OPTIONAL, -- Need M + bwp-Dedicated BWP-DownlinkDedicated OPTIONAL, -- Need M + ... +} + + +BWP-DownlinkCommon ::= SEQUENCE { + genericParameters BWP, + pdcch-ConfigCommon SetupRelease { PDCCH-ConfigCommon } OPTIONAL, -- Need M + pdsch-ConfigCommon SetupRelease { PDSCH-ConfigCommon } OPTIONAL, -- Need M + ... +} + +BWP-DownlinkDedicated ::= SEQUENCE { + pdcch-Config SetupRelease { PDCCH-Config } OPTIONAL, -- Need M + pdsch-Config SetupRelease { PDSCH-Config } OPTIONAL, -- Need M + sps-Config SetupRelease { SPS-Config } OPTIONAL, -- Need M + radioLinkMonitoringConfig SetupRelease { RadioLinkMonitoringConfig } OPTIONAL, -- Need M + ... +} + + +-- TAG-BANDWIDTH-PART-STOP +-- TAG-BWP-ID-START + +BWP-Id ::= INTEGER (0..maxNrofBWPs) + +-- TAG-BWP-ID-STOP +-- TAG-BEAM-FAILURE-RECOVERY-CONFIG-START + +BeamFailureRecoveryConfig ::= SEQUENCE { + rootSequenceIndex-BFR INTEGER (0..137) OPTIONAL, -- Need M + -- Configuration of contention free random access occasions for BFR + rach-ConfigBFR RACH-ConfigGeneric OPTIONAL, -- Need M + -- L1-RSRP threshold used for determining whether a candidate beam may be used by the UE to attempt contention free + -- Random Access to recover from beam failure. The signalled threshold is applied directly for SSB, a threshold for + -- CSI-RS is determined by linearly scaling singalled value based on Pc_ss corresponding to the CSI-RS resource. + -- (see FFS_Specification, FFS_Section) + candidateBeamThreshold RSRP-Range OPTIONAL, -- Need M + -- A list of reference signals (CSI-RS and/or SSB) identifying the candidate beams for recover and the associated RA parameters + candidateBeamRSList SEQUENCE (SIZE(1..maxNrofCandidateBeams)) OF PRACH-ResourceDedicatedBFR OPTIONAL, -- Need M + -- Explicitly signalled PRACH Mask Index for RA Resource selection in TS 36.321. The mask is valid for all SSB resources + ra-ssb-OccasionMaskIndex INTEGER (0..15) OPTIONAL, -- Need M + -- Control Resource Set that the UE uses to receive the random access response for beam failure recovery. + -- If the field is absent the UE uses the initial CORESET (ControlResourceSetId = 0) + recoveryControlResourceSetId ControlResourceSetId OPTIONAL , -- Need S + -- Search space to use for BFR RAR. If the field is absent, the UE uses the initial Serach Space (SearchSpaceId = 0). + recoverySearchSpaceId SearchSpaceId OPTIONAL, -- Need S + ... +} + +PRACH-ResourceDedicatedBFR ::= CHOICE { + ssb BFR-SSB-Resource, + csi-RS BFR-CSIRS-Resource +} + +BFR-SSB-Resource ::= SEQUENCE { + -- The ID of an SSB transmitted by this serving cell. It determines a candidate beam for beam failure recovery (BFR) + ssb SSB-Index, + -- The preamble index that the UE shall use when performing BFR upon selecting the candidate beams identified by this SSB. + ra-PreambleIndex INTEGER (0..63), + ... +} + +BFR-CSIRS-Resource ::= SEQUENCE { + -- The ID of a NZP-CSI-RS-Resource configured in the CSI-MeasConfig of this serving cell. This reference signal determines a candidate beam + -- for beam failure recovery (BFR). + csi-RS NZP-CSI-RS-ResourceId, + -- RA occasions that the UE shall use when performing BFR upon selecting the candidate beam identified by this CSI-RS. If the field is absent + -- the UE uses the RA occasion associated with the SSB that is QCLed with this CSI-RS. + -- The RA preamble index to use in the RA occasions associated with this CSI-RS. If the field is absent, the UE uses the preamble index + -- associated with the SSB that is QCLed with this CSI-RS. + ra-PreambleIndex INTEGER (0..63) OPTIONAL, -- Need R + ... +} + +-- TAG-BEAM-FAILURE-RECOVERY-CONFIG-STOP +-- TAG-CELL-GROUP-CONFIG-START + +-- Configuration of one Cell-Group: +CellGroupConfig ::= SEQUENCE { + cellGroupId CellGroupId, + + -- Logical Channel configuration and association with radio bearers: + rlc-BearerToAddModList SEQUENCE (SIZE(1..maxLC-ID)) OF RLC-Bearer-Config OPTIONAL, -- Need N + rlc-BearerToReleaseList SEQUENCE (SIZE(1..maxLC-ID)) OF LogicalChannelIdentity OPTIONAL, -- Need N + + -- Parameters applicable for the entire cell group: + mac-CellGroupConfig MAC-CellGroupConfig OPTIONAL, -- Need M + physicalCellGroupConfig PhysicalCellGroupConfig OPTIONAL, -- Need M + + -- Serving Cell specific parameters (SpCell and SCells) + spCellConfig SpCellConfig OPTIONAL, -- Need M + sCellToAddModList SEQUENCE (SIZE (1..maxNrofSCells)) OF SCellConfig OPTIONAL, -- Need N + -- List of seconary serving cells to be released (not applicable for SpCells) + sCellToReleaseList SEQUENCE (SIZE (1..maxNrofSCells)) OF SCellIndex OPTIONAL, -- Need N + ... +} + +-- The ID of a cell group. 0 identifies the master cell group. Other values identify secondary cell groups. +-- In this version of the specification only values 0 and 1 are supported. +-- FFS: This should be moved to be own IE section +CellGroupId ::= INTEGER (0.. maxSecondaryCellGroups) + + +RLC-Bearer-Config ::= SEQUENCE { + -- ID used commonly for the MAC logical channel and for the RLC bearer. + logicalChannelIdentity LogicalChannelIdentity, + + -- Associates the RLC Bearer with an SRB or a DRB. The UE shall deliver DL RLC SDUs received via the RLC entity of this + -- RLC bearer to the PDCP entity of the servedRadioBearer. Furthermore, the UE shall advertise and deliver uplink PDCP PDUs of the + -- uplink PDCP entity of the servedRadioBearer to the uplink RLC entity of this RLC bearer unless the uplink scheduling + -- restrictions ('moreThanOneRLC' in PDCP-Config and the restrictions in LogicalChannelConfig) forbid it to do so. + servedRadioBearer CHOICE { + srb-Identity SRB-Identity, + drb-Identity DRB-Identity + } OPTIONAL, -- Cond LCH-SetupOnly + + reestablishRLC ENUMERATED {true} OPTIONAL, -- Need N + rlc-Config RLC-Config OPTIONAL, -- Cond LCH-Setup + + mac-LogicalChannelConfig LogicalChannelConfig OPTIONAL, -- Cond LCH-Setup + ... +} + +LogicalChannelIdentity ::= INTEGER (1..maxLC-ID) + +-- Cell-Group specific L1 parameters +PhysicalCellGroupConfig ::= SEQUENCE { + -- Enables spatial bundling of HARQ ACKs. It is configured per cell group (i.e. for all the cells within the cell group) for PUCCH + -- reporting of HARQ-ACK. It is only applicable when more than 4 layers are possible to schedule. + -- Corresponds to L1 parameter 'HARQ-ACK-spatial-bundling' (see 38.213, section FFS_Section) + -- Absence indicates that spatial bundling is disabled. + harq-ACK-SpatialBundlingPUCCH ENUMERATED {true} OPTIONAL, -- Need R + + -- Enables spatial bundling of HARQ ACKs. It is configured per cell group (i.e. for all the cells within the cell group) for PUSCH + -- reporting of HARQ-ACK. It is only applicable when more than 4 layers are possible to schedule. + -- Corresponds to L1 parameter 'HARQ-ACK-spatial-bundling' (see 38.213, section FFS_Section) + -- Absence indicates that spatial bundling is disabled. + harq-ACK-SpatialBundlingPUSCH ENUMERATED {true} OPTIONAL, -- Need R + -- The maximum transmit power to be used by the UE in this NR cell group. + p-NR P-Max OPTIONAL, -- Need R + -- The PDSCH HARQ-ACK codebook is either semi-static of dynamic. This is applicable to both CA and none CA operation. + -- Corresponds to L1 parameter 'HARQ-ACK-codebook' (see 38.213, section FFS_Section) + pdsch-HARQ-ACK-Codebook ENUMERATED {semiStatic, dynamic}, + -- RNTI used for SRS TPC commands on DCI. Corresponds to L1 parameter 'TPC-SRS-RNTI' (see 38.213, section 10) + tpc-SRS-RNTI RNTI-Value OPTIONAL, -- Need R + -- RNTI used for PUCCH TPC commands on DCI. Corresponds to L1 parameter 'TPC-PUCCH-RNTI' (see 38.213, section 10). + tpc-PUCCH-RNTI RNTI-Value OPTIONAL, -- Need R + -- RNTI used for PUSCH TPC commands on DCI. Corresponds to L1 parameter 'TPC-PUSCH-RNTI' (see 38.213, section 10) + tpc-PUSCH-RNTI RNTI-Value OPTIONAL,-- Need R + ... +} + + +-- Serving cell specific MAC and PHY parameters for a SpCell: +SpCellConfig ::= SEQUENCE { + -- Serving cell ID of a PSCell (the PCell of the Master Cell Group uses ID = 0) + servCellIndex ServCellIndex OPTIONAL, -- Cond SCG + -- Parameters for the synchronous reconfiguration to the target SpCell: + reconfigurationWithSync ReconfigurationWithSync OPTIONAL, -- Cond ReconfWithSync + rlf-TimersAndConstants SetupRelease { RLF-TimersAndConstants } OPTIONAL, -- Need M + rlmInSyncOutOfSyncThreshold INTEGER (0..1) OPTIONAL, -- Need M + spCellConfigDedicated ServingCellConfig OPTIONAL, -- Need M + ... +} + +ReconfigurationWithSync ::= SEQUENCE { + spCellConfigCommon ServingCellConfigCommon OPTIONAL, -- Need M + newUE-Identity RNTI-Value, + t304 ENUMERATED {ms50, ms100, ms150, ms200, ms500, ms1000, ms2000, ms10000}, + rach-ConfigDedicated CHOICE { + uplink RACH-ConfigDedicated, + supplementaryUplink RACH-ConfigDedicated + } OPTIONAL, -- Need N + ... +} + +SCellConfig ::= SEQUENCE { + sCellIndex SCellIndex, + sCellConfigCommon ServingCellConfigCommon OPTIONAL, -- Cond SCellAdd + sCellConfigDedicated ServingCellConfig OPTIONAL, -- Cond SCellAddMod + ... +} + +-- TAG-CELL-GROUP-CONFIG-STOP +-- TAG-CODEBOOKCONFIG-START +CodebookConfig ::= SEQUENCE { + -- CodebookType including possibly sub-types and the corresponding parameters for each. Corresponds to L1 parameter 'CodebookType' + -- (see 38.214, section 5.2.2.2) + codebookType CHOICE { + type1 SEQUENCE { + subType CHOICE { + typeI-SinglePanel SEQUENCE { + nrOfAntennaPorts CHOICE { + two SEQUENCE { + -- Codebook subset restriction for 2TX codebook + -- Corresponds to L1 parameter ' TypeI-SinglePanel-2Tx-CodebookSubsetRestriction' (see 38.214 section 5.2.2.2.1) + twoTX-CodebookSubsetRestriction BIT STRING (SIZE (6)) + }, + moreThanTwo SEQUENCE { + -- Number of antenna ports in first (n1) and second (n2) dimension and codebook subset restriction + -- Corresponds to L1 parameters 'CodebookConfig-N1', 'CodebookConfig-N2' + -- 'TypeI-SinglePanel-CodebookSubsetRestriction ' (see 38.214 section 5.2.2.2.1) + n1-n2 CHOICE { + two-one-TypeI-SinglePanel-Restriction BIT STRING (SIZE (8)), + two-two-TypeI-SinglePanel-Restriction BIT STRING (SIZE (64)), + four-one-TypeI-SinglePanel-Restriction BIT STRING (SIZE (16)), + three-two-TypeI-SinglePanel-Restriction BIT STRING (SIZE (96)), + six-one-TypeI-SinglePanel-Restriction BIT STRING (SIZE (24)), + four-two-TypeI-SinglePanel-Restriction BIT STRING (SIZE (128)), + eight-one-TypeI-SinglePanel-Restriction BIT STRING (SIZE (32)), + four-three-TypeI-SinglePanel-Restriction BIT STRING (SIZE (192)), + six-two-TypeI-SinglePanel-Restriction BIT STRING (SIZE (192)), + twelve-one-TypeI-SinglePanel-Restriction BIT STRING (SIZE (48)), + four-four-TypeI-SinglePanel-Restriction BIT STRING (SIZE (256)), + eight-two-TypeI-SinglePanel-Restriction BIT STRING (SIZE (256)), + sixteen-one-TypeI-SinglePanel-Restriction BIT STRING (SIZE (64)) + }, + -- i2 codebook subset restriction for Type I Single-panel codebook used when reportQuantity is CRI/Ri/i1/CQI + -- Corresponds to L1 parameter 'TypeI-SinglePanel-CodebookSubsetRestriction-i2' (see 38.214 section 5.2.2.2.1) + typeI-SinglePanel-codebookSubsetRestriction-i2 BIT STRING (SIZE (16)) OPTIONAL + } + }, + -- Restriction for RI for TypeI-SinglePanel-RI-Restriction + -- Corresponds to L1 parameter 'TypeI-SinglePanel-RI-Restriction' (see 38.214, section 5.2.2.2.1) + typeI-SinglePanel-ri-Restriction BIT STRING (SIZE (8)) + }, + typeI-MultiPanel SEQUENCE { + -- Codebook subset restriction for Type I Multi-panel codebook + -- Corresponds to L1 parameter 'TypeI-MultiPanel-CodebookSubsetRestriction' (see 38.214, section 5.2.2.2.2) + ng-n1-n2 CHOICE { + two-two-one-TypeI-MultiPanel-Restriction BIT STRING (SIZE (8)), + two-four-one-TypeI-MultiPanel-Restriction BIT STRING (SIZE (32)), + four-two-one-TypeI-MultiPanel-Restriction BIT STRING (SIZE (32)), + two-two-two-TypeI-MultiPanel-Restriction BIT STRING (SIZE (128)), + two-eight-one-TypeI-MultiPanel-Restriction BIT STRING (SIZE (64)), + four-four-one-TypeI-MultiPanel-Restriction BIT STRING (SIZE (64)), + two-four-two-TypeI-MultiPanel-Restriction BIT STRING (SIZE (256)), + four-two-two-TypeI-MultiPanel-Restriction BIT STRING (SIZE (256)) + }, + -- Restriction for RI for TypeI-MultiPanel-RI-Restriction + -- Corresponds to L1 parameter 'TypeI-MultiPanel-RI-Restriction' (see 38.214, section 5.2.2.2.2) + ri-Restriction BIT STRING (SIZE (4)) + } + }, + -- CodebookMode as specified in 38.214 section 5.2.2.2.2 + codebookMode INTEGER (1..2) + + }, + type2 SEQUENCE { + subType CHOICE { + typeII SEQUENCE { + -- Number of antenna ports in first (n1) and second (n2) dimension and codebook subset restriction + -- Corresponds to L1 parameters 'CodebookConfig-N1', 'CodebookConfig-N2' + -- The CHOICE name indicates the value of n1 and n2, the CHOICE contents is the codebook subset restriction bitmap + -- Corresponds to L1 parameter ' TypeII-CodebookSubsetRestriction' (see 38.214 section 5.2.2.2.3) + -- Number of bits for codebook subset restriction is ceil(log2(nchoosek(O1*O2,4)))+8*n1*n2 where nchoosek(a,b) = a!/(b!(a-b)!) + n1-n2-codebookSubsetRestriction CHOICE { + two-one BIT STRING (SIZE (16)), + two-two BIT STRING (SIZE (139)), + four-one BIT STRING (SIZE (32)), + three-two BIT STRING (SIZE (59)), + six-one BIT STRING (SIZE (49)), + four-two BIT STRING (SIZE (75)), + eight-one BIT STRING (SIZE (65)), + four-three BIT STRING (SIZE (107)), + six-two BIT STRING (SIZE (107)), + twelve-one BIT STRING (SIZE (129)), + four-four BIT STRING (SIZE (139)), + eight-two BIT STRING (SIZE (139)), + sixteen-one BIT STRING (SIZE (129)) + }, + -- Restriction for RI for TypeII-RI-Restriction + -- Corresponds to L1 parameter 'TypeII-RI-Restriction' (see 38.214, section 5.2.2.2.3) + typeII-RI-Restriction BIT STRING (SIZE (2)) + }, + typeII-PortSelection SEQUENCE { + -- The size of the port selection codebook (parameter d) + portSelectionSamplingSize ENUMERATED {n1, n2, n3, n4} OPTIONAL, -- Cond TypeII-PortSelection + -- Restriction for RI for TypeII-PortSelection-RI-Restriction + -- Corresponds to L1 parameter 'TypeII-PortSelection-RI-Restriction' (see 38.214, section 5.2.2.4) + typeII-PortSelectionRI-Restriction BIT STRING (SIZE (2)) + } + }, + -- The size of the PSK alphabet, QPSK or 8-PSK + phaseAlphabetSize ENUMERATED {n4, n8}, + -- If subband amplitude reporting is activated (true) + subbandAmplitude BOOLEAN, + -- Number of beams, L, used for linear combination + numberOfBeams ENUMERATED {two, three, four} + } + } +} + +-- TAG-CODEBOOKCONFIG-STOP +-- TAG-CONFIGUREDGRANTCONFIG-START + +ConfiguredGrantConfig ::= SEQUENCE { + + -- Frequency hopping as agreed in RAN1-AH18776 + frequencyHopping ENUMERATED {mode1, mode2}, + -- DMRS configuration, as agreed in RAN1-AH18776 + cg-DMRS-Configuration DMRS-UplinkConfig, + + -- Indicates the MCS table the UE shall use for PUSCH without transform precoding, as agreed in RAN1-AH18776 + mcs-Table ENUMERATED {qam64, qam256}, + -- Indicates the MCS table the UE shall use for PUSCH with transform precoding, as agreed in RAN1-AH18776 + -- When the field is absent the UE applies the value 64QAM + mcs-TableTransformPrecoder ENUMERATED {qam256} OPTIONAL, -- Need S + -- Selection between and configuration of dynamic and semi-static beta-offset, as agreed in RAN1-AH18776 + -- Note: For Type 1 UL data transmission without grant, "uci-on-PUSCH" should be set to semiStatic + uci-OnPUSCH SetupRelease { CG-UCI-OnPUSCH }, + -- Configuration of resource allocation type 0 and resource allocation type 1, as agreed in RAN1-AH18776 + -- Note: For Type 1 UL data transmission without grant, "resourceAllocation" should be resourceAllocationType0 or resourceAllocationType1 + resourceAllocation ENUMERATED { resourceAllocationType0, resourceAllocationType1, dynamicSwitch }, + -- Selection between config 1 and config 2 for RBG size for PUSCH. When the field is absent the UE applies the value config1. + -- Note: rbg-Size is used when the transformPrecoder parameter is disabled. + rbg-Size ENUMERATED {config2} OPTIONAL, -- Need S + + -- Closed control loop to apply. Corresponds to L1 parameter 'PUSCH-closed-loop-index' (see 38.213, section FFS_Section) + powerControlLoopToUse ENUMERATED {n0, n1}, + -- Index of the P0-PUSCH-AlphaSet to be used for this configuration + p0-PUSCH-Alpha P0-PUSCH-AlphaSetId, + -- Enable transformer precoder for type1 and type2. Absence indicates that it is disabled. + -- Corresponds to L1 parameter 'UL-TWG-tp' (see 38.214, section 6.1.3) + transformPrecoder ENUMERATED {enabled} OPTIONAL, -- Need R + -- The number of HARQ processes configured. It applies for both Type 1 and Type 2 + -- Corresponds to L1 parameter 'UL-TWG-numbHARQproc' (see 38.321, section 5.8.2) + nrofHARQ-Processes INTEGER(1..16), + -- The number or repetitions of K: + repK ENUMERATED {n1, n2, n4, n8}, + -- If repetitions is used, this field indicates the redundancy version (RV) sequence to use. + -- Corresponds to L1 parameter 'UL-TWG-RV-rep' (see 38.321, section 5.8.2) + repK-RV ENUMERATED {s1-0231, s2-0303, s3-0000} OPTIONAL, -- Cond RepK + -- Periodicity for UL transmission without UL grant for type 1 and type 2 + -- Corresponds to L1 parameter 'UL-TWG-periodicity' (see 38.321, section 5.8.2) + + -- The following periodicities are supported depending on the configured subcarrier spacing [symbols]: + -- 15kHz: 2, 7, n*14, where n={1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 320, 640} + -- 30kHz: 2, 7, n*14, where n={1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 256, 320, 640, 1280} + -- 60kHz with normal CP: 2, 7, n*14, where n={1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 256, 320, 512, 640, 1280, 2560} + -- 60kHz with ECP: 2, 6, n*12, where n={1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 256, 320, 512, 640, 1280, 2560} + -- 120kHz: 2, 7, n*14, where n={1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 256, 320, 512, 640, 1024, 1280, 2560, 5120} + -- (see 38.214, Table 6.1.2.3-1) + periodicity ENUMERATED { + sym2, sym7, sym1x14, sym2x14, sym4x14, sym5x14, sym8x14, sym10x14, sym16x14, sym20x14, + sym32x14, sym40x14, sym64x14, sym80x14, sym128x14, sym160x14, sym256x14, sym320x14, sym512x14, + sym640x14, sym1024x14, sym1280x14, sym2560x14, sym5120x14, + + sym6, sym1x12, sym2x12, sym4x12, sym5x12, sym8x12, sym10x12, sym16x12, sym20x12, sym32x12, + sym40x12, sym64x12, sym80x12, sym128x12, sym160x12, sym256x12, sym320x12, sym512x12, sym640x12, + sym1280x12, sym2560x12 + }, + + -- If configured, the UE uses the configured grant timer (see 38.321, section 5.8.2) with this initial timer value. + -- Supported values are as follows in units of symbols: + -- For normal CP: 2, 7, {1, 2, 4, 5, 8, 10, 20, 32, 40, 64, 80, 128, 160, 256, 512, 640 } x 14 + -- For extended CP: 2, 6, {1, 2, 4, 8, 20, 40, 80, 128, 160, 256, 320, 512, 640 } x 12 + configuredGrantTimer ENUMERATED { + sym2, sym7, sym1x14, sym2x14, sym4x14, sym5x14, sym8x14, sym10x14, sym16x14, sym20x14, sym32x14, + sym40x14, sym64x14, sym80x14, sym128x14, sym160x14, sym256x14, sym512x14, sym640x14, + + sym6, sym1x12, sym2x12, sym4x12, sym5x12, sym8x12, sym10x12, sym16x12, sym20x12, sym32x12, + sym40x12, sym64x12, sym80x12, sym128x12, sym256x12, sym320x12, sym512x12, sym640x12 + } OPTIONAL, -- Need R + -- Selection between "configured grant" transmission with fully RRC-configured UL grant (Type1) + -- or with UL grant configured by DCI addressed to CS-RNTI (Type2). + rrc-ConfiguredUplinkGrant SEQUENCE { + -- Offset related to SFN=0 + timeDomainOffset INTEGER (0..5119), + -- Corresponding to the DCI field of time domain resource assignment, and the maximum bit width is 4. + --(see 38.214, section 6.1.2 and 38.212, section 7.3.1) + timeDomainAllocation INTEGER (0..15), -- RAN1 indicated just "Mapping-type,Index-start-len" + -- Corresponding to the DCI field of freq domain resource assignment. + -- (see 38.214, section 6.1.2, and 38.212, section 7.3.1) + frequencyDomainAllocation BIT STRING (SIZE(18)), + -- UE-specific DMRS configuration: corresponding to the DCI field of antenna ports, and the maximum bitwidth is 5. + -- (see 38.214, section 6.1.2, and 38.212, section 7.3.1) + antennaPort INTEGER (0..31), + dmrs-SeqInitialization INTEGER (0..1) OPTIONAL, -- Cond NoTransformPrecoder + precodingAndNumberOfLayers INTEGER (0..63), + srs-ResourceIndicator INTEGER (0..15), + -- The modulation order, target code rate and TB size (see 38.214, section 6.1.2) + mcsAndTBS INTEGER (0..31), + -- Enables intra-slot frequency hopping with the given frequency hopping offset + -- Corresponds to L1 parameter 'UL-TWG-hopping' (see 38.214, section FFS_Section) + + frequencyHoppingOffset INTEGER (1.. maxNrofPhysicalResourceBlocks-1), + pathlossReferenceIndex INTEGER (0..maxNrofPUSCH-PathlossReferenceRSs-1), + ... + } OPTIONAL -- Cond Type1 +} + +CG-UCI-OnPUSCH ::= CHOICE { + dynamic SEQUENCE (SIZE (1..4)) OF BetaOffsets, + semiStatic BetaOffsets +} + +-- TAG-CONFIGUREDGRANTCONFIG-STOP +-- TAG-CONTROLRESOURCESET-START + +ControlResourceSet ::= SEQUENCE { + -- Corresponds to L1 parameter 'CORESET-ID' + -- Value 0 identifies the common CORESET configured in MIB and in ServingCellConfigCommon + -- Values 1..maxNrofControlResourceSets-1 identify CORESETs configured by dedicated signalling + -- The controlResourceSetId is unique among the BWPs of a ServingCell. + controlResourceSetId ControlResourceSetId, + + + -- Frequency domain resources for the CORESET. Each bit corresponds a group of 6 RBs, with grouping starting from PRB 0, which is fully + -- contained in the bandwidth part within which the CORESET is configured. + -- The most significant bit corresponds to the group of lowest frequency which is fully contained in the bandwidth part within which the + -- CORESET is configured, each next subsequent lower significance bit corresponds to the next lowest frequency group fully contained within + -- the bandwidth part within which the CORESET is configured, if any. + -- Bits corresponding to a group not fully contained within the bandwidth part within which the CORESET is configured are set to zero. + -- Corresponds to L1 parameter 'CORESET-freq-dom'(see 38.211, section 7.3.2.2) + frequencyDomainResources BIT STRING (SIZE (45)), + -- Contiguous time duration of the CORESET in number of symbols + -- Corresponds to L1 parameter 'CORESET-time-duration' (see 38.211, section 7.3.2.2FFS_Section) + duration INTEGER (1..maxCoReSetDuration), + -- Mapping of Control Channel Elements (CCE) to Resource Element Groups (REG). + -- Corresponds to L1 parameter 'CORESET-CCE-REG-mapping-type' (see 38.211Section sections 7.3.2.2 and 7.4.1.3.2) + cce-REG-MappingType CHOICE { + interleaved SEQUENCE { + -- Resource Element Groups (REGs) can be bundled to create REG bundles. This parameter defines the size of such bundles. + -- Corresponds to L1 parameter 'CORESET-REG-bundle-size' (see 38.211, section FFS_Section) + reg-BundleSize ENUMERATED {n2, n3, n6}, + -- Corresponds to L1 parameter 'CORESET-interleaver-size' (see 38.211, 38.213, section FFS_Section) + interleaverSize ENUMERATED {n2, n3, n6}, + -- Corresponds to L1 parameter 'CORESET-shift-index' (see 38.211, section 7.3.2.2) + shiftIndex INTEGER(0..maxNrofPhysicalResourceBlocks-1) + }, + nonInterleaved NULL + }, + -- Precoder granularity in frequency domain. + -- Corresponds to L1 parameter 'CORESET-precoder-granuality' (see 38.211, sections 7.3.2.2 and 7.4.1.3.2) + precoderGranularity ENUMERATED {sameAsREG-bundle, allContiguousRBs}, + + -- A subset of the TCI states defined in TCI-States used for providing QCL relationships between the DL RS(s) in one RS Set + -- (TCI-State) and the PDCCH DMRS ports. Corresponds to L1 parameter 'TCI-StatesPDCCH' (see 38.214, section FFS_Section) + tci-StatesPDCCH SEQUENCE(SIZE (1..maxNrofTCI-StatesPDCCH)) OF TCI-StateId OPTIONAL, -- Need R + + -- If at least spatial QCL is configured/indicated, this field indicates if TCI field is present or not present in DL-related DCI. + -- When the field is absent the UE considers the TCI to be absent/disabled. + -- Corresponds to L1 parameter 'TCI-PresentInDCI' (see 38,213, section 5.1.5) + tci-PresentInDCI ENUMERATED {enabled} OPTIONAL, -- Need S + + -- PDCCH DMRS scrambling initalization. Corresponds to L1 parameter 'PDCCH-DMRS-Scrambling-ID' (see 38.214, section 5.1) + -- When the field is absent the UE applies the value '0'. + pdcch-DMRS-ScramblingID BIT STRING (SIZE (16)) OPTIONAL -- Need S +} + +-- TAG-CONTROLRESOURCESET-STOP +-- TAG-CONTROL-RESOURCE-SET-ID-START + +ControlResourceSetId ::= INTEGER (0..maxNrofControlResourceSets-1) + +-- TAG-CONTROL-RESOURCE-SET-ID-STOP + +CrossCarrierSchedulingConfig ::= SEQUENCE { + schedulingCellInfo CHOICE { + own SEQUENCE { -- No cross carrier scheduling + cif-Presence BOOLEAN + }, + other SEQUENCE { -- Cross carrier scheduling + schedulingCellId ServCellIndex, + cif-InSchedulingCell INTEGER (1..7) + } -- Cond SCellOnly + }, + ... +} + +-- TAG-CSI-APERIODICTRIGGERSTATELIST-START + +CSI-AperiodicTriggerStateList ::= SEQUENCE (SIZE (1..maxNrOfCSI-AperiodicTriggers)) OF CSI-AperiodicTriggerState + +CSI-AperiodicTriggerState ::= SEQUENCE { + associatedReportConfigInfoList SEQUENCE (SIZE(1..maxNrofReportConfigPerAperiodicTrigger)) OF CSI-AssociatedReportConfigInfo, + ... +} + +CSI-AssociatedReportConfigInfo ::= SEQUENCE { + -- The reportConfigId of one of the CSI-ReportConfigToAddMod configured in CSI-MeasConfig + reportConfigId CSI-ReportConfigId, + + resourcesForChannel CHOICE { + nzp-CSI-RS SEQUENCE { + -- NZP-CSI-RS-ResourceSet for channel measurements. Entry number in nzp-CSI-RS-ResourceSetList in the CSI-ResourceConfig + -- indicated by resourcesForChannelMeasurement in the CSI-ReportConfig indicated by reportConfigId above + -- (1 corresponds to the first entry, 2 to thesecond entry, and so on). + resourceSet INTEGER (1..maxNrofNZP-CSI-RS-ResourceSetsPerConfig), + + -- List of references to TCI-States for providing the QCL source and QCL type for for each NZP-CSI-RS-Resource + -- listed in nzp-CSI-RS-Resources of the NZP-CSI-RS-ResourceSet indicated by nzp-CSI-RS-ResourcesforChannel. + -- First entry in qcl-info-forChannel corresponds to first entry in nzp-CSI-RS-Resources of that NZP-CSI-RS-ResourceSet, + -- second entry in qcl-info-forChannel corresponds to second entry in nzp-CSI-RS-Resources, + -- and so on. Corresponds to L1 parameter 'QCL-Info-aPeriodicReportingTrigger' (see 38.214, section 5.2.1.5.1) + qcl-info SEQUENCE (SIZE(1..maxNrofAP-CSI-RS-ResourcesPerSet)) OF TCI-StateId + }, + -- CSI-SSB-ResourceSet for channel measurements. Entry number in csi-SSB-ResourceSetList in the CSI-ResourceConfig indicated by + -- resourcesForChannelMeasurement in the CSI-ReportConfig indicated by reportConfigId above (1 corresponds to the first entry, 2 to + -- the second entry, and so on). + csi-SSB-ResourceSet INTEGER (1..maxNrofCSI-SSB-ResourceSetsPerConfig) + }, + + -- CSI-IM-ResourceSet for interference measurement. Entry number in csi-IM-ResourceSetList in the CSI-ResourceConfig indicated by + -- csi-IM-ResourcesForInterference in the CSI-ReportConfig indicated by reportConfigId above (1 corresponds to the first entry, 2 to the second + -- entry, and so on). + -- The indicated CSI-IM-ResourceSet should have exactly the same number of resources like the NZP-CSI-RS-ResourceSet indicated in + -- nzp-CSI-RS-ResourcesforChannel. + -- This field can only be present if the CSI-ReportConfig identified by reportConfigId includes csi-IM-ResourcesForInterference. + csi-IM-ResourcesforInteference INTEGER(1..maxNrofCSI-IM-ResourceSetsPerConfig) OPTIONAL, --Cond CSI-IM-forInterference + + + -- NZP-CSI-RS-ResourceSet for interference measurement. Entry number in nzp-CSI-RS-ResourceSetList in the CSI-ResourceConfig indicated by + -- nzp-CSI-RS-ResourcesForInterference in the CSI-ReportConfig indicated by reportConfigId above (1 corresponds to the first entry, + -- 2 to the second entry, and so on). + -- The indicated NZP-CSI-RS-ResourceSet should have exactly the same number of resources like the NZP-CSI-RS-ResourceSet indicated in + -- nzp-CSI-RS-ResourcesforChannel. + -- This field can only be present if the CSI-ReportConfig identified by reportConfigId includes nzp-CSI-RS-ResourcesForInterference. + nzp-CSI-RS-ResourcesforInterference INTEGER (1..maxNrofNZP-CSI-RS-ResourceSetsPerConfig) OPTIONAL, --Cond LinkedNZP-CSI-RS-forInterference + ... +} + +-- TAG-CSI-APERIODICTRIGGERSTATELIST-STOP +-- TAG-CSI-FREQUENCYOCCUPATION-START + +CSI-FrequencyOccupation ::= SEQUENCE { + -- PRB where this CSI resource starts in relation to PRB 0 of the associated BWP. + -- Only multiples of 4 are allowed (0, 4, ...) + startingRB INTEGER (0..maxNrofPhysicalResourceBlocks-1), + -- Number of PRBs across which this CSI resource spans. Only multiples of 4 are allowed. The smallest configurable + -- number is the minimum of 24 and the width of the associated BWP. + nrofRBs INTEGER (24..maxNrofPhysicalResourceBlocks), + ... +} + +-- TAG-CSI-FREQUENCYOCCUPATION-STOP +-- TAG-CSI-IM-RESOURCE-START +CSI-IM-Resource ::= SEQUENCE { + csi-IM-ResourceId CSI-IM-ResourceId, + + -- The resource element pattern (Pattern0 (2,2) or Pattern1 (4,1)) with corresponding parameters. + -- Corresponds to L1 parameter 'CSI-IM-RE-pattern' (see 38.214, section 5.2.2.3.4) + csi-IM-ResourceElementPattern CHOICE { + pattern0 SEQUENCE { + -- OFDM subcarrier occupancy of the CSI-IM resource for Pattern0 + -- Corresponds to L1 parameter 'CSI-IM-ResourceMapping' (see 38.214, section 5.2.2.3.4) + subcarrierLocation-p0 ENUMERATED { s0, s2, s4, s6, s8, s10 }, + -- OFDM symbol location of the CSI-IM resource for Pattern0 + -- Corresponds to L1 parameter 'CSI-IM-ResourceMapping' (see 38.214, section 5.2.2.3.4) + symbolLocation-p0 INTEGER (0..12) + }, + pattern1 SEQUENCE { + -- OFDM subcarrier occupancy of the CSI-IM resource for Pattern1 + -- Corresponds to L1 parameter 'CSI-IM-ResourceMapping' (see 38.214, section 5.2.2.3.4) + subcarrierLocation-p1 ENUMERATED { s0, s4, s8 }, + -- OFDM symbol location of the CSI-IM resource for Pattern1 + -- Corresponds to L1 parameter 'CSI-IM-ResourceMapping' (see 38.214, section 5.2.2.3.4) + symbolLocation-p1 INTEGER (0..13) + } + } OPTIONAL, --Need M + + -- Frequency-occupancy of CSI-IM. Corresponds to L1 parameter 'CSI-IM-FreqBand' (see 38.214, section 5.2.2.3.2) + freqBand CSI-FrequencyOccupation OPTIONAL, -- Need M + + -- Periodicity and slot offset for periodic/semi-persistent CSI-IM. Corresponds to L1 parameter 'CSI-IM-timeConfig' + periodicityAndOffset CSI-ResourcePeriodicityAndOffset OPTIONAL, --Cond PeriodicOrSemiPersistent + ... +} + +-- TAG-CSI-IM-RESOURCE-STOP +-- TAG-CSI-IM-RESOURCEID-START +CSI-IM-ResourceId ::= INTEGER (0..maxNrofCSI-IM-Resources-1) + +-- TAG-CSI-IM-RESOURCEID-STOP +-- TAG-CSI-IM-RESOURCESET-START +CSI-IM-ResourceSet ::= SEQUENCE { + + csi-IM-ResourceSetId CSI-IM-ResourceSetId, + -- CSI-IM-Resources associated with this CSI-IM-ResourceSet + -- Corresponds to L1 parameter 'CSI-IM-ResourceConfigList' (see 38.214, section 5.2) + csi-IM-Resources SEQUENCE (SIZE(1..maxNrofCSI-IM-ResourcesPerSet)) OF CSI-IM-ResourceId, + ... +} +-- TAG-CSI-IM-RESOURCESET-STOP +-- TAG-CSI-IM-RESOURCESETID-START + +CSI-IM-ResourceSetId ::= INTEGER (0..maxNrofCSI-IM-ResourceSets-1) + +-- TAG-CSI-IM-RESOURCESETID-STOP +-- TAG-CSI-MEAS-CONFIG-START + +CSI-MeasConfig ::= SEQUENCE { + -- Pool of NZP-CSI-RS-Resource which can be referred to from NZP-CSI-RS-ResourceSet + nzp-CSI-RS-ResourceToAddModList SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-Resources)) OF NZP-CSI-RS-Resource OPTIONAL, -- Need N + nzp-CSI-RS-ResourceToReleaseList SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-Resources)) OF NZP-CSI-RS-ResourceId OPTIONAL, -- Need N + + -- Pool of NZP-CSI-RS-ResourceSet which can be referred to from CSI-ResourceConfig or from MAC CEs + nzp-CSI-RS-ResourceSetToAddModList SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-ResourceSets)) OF NZP-CSI-RS-ResourceSet OPTIONAL, -- Need N + nzp-CSI-RS-ResourceSetToReleaseList SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-ResourceSets)) OF NZP-CSI-RS-ResourceSetId OPTIONAL, -- Need N + + -- Pool of CSI-IM-Resource which can be referred to from CSI-IM-ResourceSet + csi-IM-ResourceToAddModList SEQUENCE (SIZE (1..maxNrofCSI-IM-Resources)) OF CSI-IM-Resource OPTIONAL, -- Need N + csi-IM-ResourceToReleaseList SEQUENCE (SIZE (1..maxNrofCSI-IM-Resources)) OF CSI-IM-ResourceId OPTIONAL, -- Need N + + -- Pool of CSI-IM-ResourceSet which can be referred to from CSI-ResourceConfig or from MAC CEs + csi-IM-ResourceSetToAddModList SEQUENCE (SIZE (1..maxNrofCSI-IM-ResourceSets)) OF CSI-IM-ResourceSet OPTIONAL, -- Need N + csi-IM-ResourceSetToReleaseList SEQUENCE (SIZE (1..maxNrofCSI-IM-ResourceSets)) OF CSI-IM-ResourceSetId OPTIONAL, -- Need N + + -- Pool of CSI-SSB-ResourceSet which can be referred to from CSI-ResourceConfig + csi-SSB-ResourceSetToAddModList SEQUENCE (SIZE (1..maxNrofCSI-SSB-ResourceSets)) OF CSI-SSB-ResourceSet OPTIONAL, -- Need N + csi-SSB-ResourceSetToAddReleaseList SEQUENCE (SIZE (1..maxNrofCSI-SSB-ResourceSets)) OF CSI-SSB-ResourceSetId OPTIONAL, -- Need N + + -- Configured CSI resource settings as specified in TS 38.214 section 5.2.1.2 + csi-ResourceConfigToAddModList SEQUENCE (SIZE (1..maxNrofCSI-ResourceConfigurations)) OF CSI-ResourceConfig OPTIONAL, -- Need N + csi-ResourceConfigToReleaseList SEQUENCE (SIZE (1..maxNrofCSI-ResourceConfigurations)) OF CSI-ResourceConfigId OPTIONAL, -- Need N + + -- Configured CSI report settings as specified in TS 38.214 section 5.2.1.1 + csi-ReportConfigToAddModList SEQUENCE (SIZE (1..maxNrofCSI-ReportConfigurations)) OF CSI-ReportConfig OPTIONAL, -- Need N + csi-ReportConfigToReleaseList SEQUENCE (SIZE (1..maxNrofCSI-ReportConfigurations)) OF CSI-ReportConfigId OPTIONAL, -- Need N + + + -- Size of CSI request field in DCI (bits). Corresponds to L1 parameter 'ReportTriggerSize' (see 38.214, section 5.2) + reportTriggerSize INTEGER (0..6) OPTIONAL, + + -- Contains trigger states for dynamically selecting one or more aperiodic and semi-persistent reporting configurations + -- and/or triggering one or more aperiodic CSI-RS resource sets for channel and/or interference measurement. + -- FFS: How to address the MAC-CE configuration + aperiodicTriggerStateList SetupRelease { CSI-AperiodicTriggerStateList } OPTIONAL, -- Need M + semiPersistentOnPUSCH-TriggerStateList SetupRelease { CSI-SemiPersistentOnPUSCH-TriggerStateList } OPTIONAL, -- Need M + ... +} + +maxNrofNZP-CSI-RS-ResourceSets INTEGER ::= 64 +maxNrofNZP-CSI-RS-ResourceSets-1 INTEGER ::= 63 + +maxNrofCSI-SSB-ResourceSets INTEGER ::= 64 +maxNrofCSI-SSB-ResourceSets-1 INTEGER ::= 63 + +maxNrofCSI-IM-ResourceSets INTEGER ::= 64 +maxNrofCSI-IM-ResourceSets-1 INTEGER ::= 63 + +-- TAG-CSI-MEAS-CONFIG-STOP +-- TAG-CSI-REPORTCONFIG-START +-- Configuration of a CSI-Report sent on L1 (e.g. PUCCH) (see 38.214, section 5.2.1) +CSI-ReportConfig ::= SEQUENCE { + reportConfigId CSI-ReportConfigId, + + -- Indicates in which serving cell the CSI-ResourceConfigToAddMod(s) below are to be found. + -- If the field is absent, the resources are on the same serving cell as this report configuration. + carrier ServCellIndex OPTIONAL, -- Need S + + -- Resources for channel measurement. csi-ResourceConfigId of a CSI-ResourceConfig included in the configuration of the serving cell + -- indicated with the field "carrier" above. This CSI-ReportConfig is associated with the DL BWP indicated by bwp-Id in that CSI-ResourceConfig. + resourcesForChannelMeasurement CSI-ResourceConfigId, + + -- CSI IM resources for interference measurement. csi-ResourceConfigId of a CSI-ResourceConfig included in the configuration of the serving cell + -- indicated with the field "carrier" above. The bwp-Id in that CSI-ResourceConfigToAddMod is the same value like the bwp-Id in the + -- CSI-ResourceConfig indicated by resourcesForChannelMeasurement. + csi-IM-ResourcesForInterference CSI-ResourceConfigId OPTIONAL, -- Need R + + -- NZP CSI RS resources for interference measurement. csi-ResourceConfigId of a CSI-ResourceConfigToAddMod included in the configuration of the + -- serving cell indicated with the field "carrier" above. The bwp-Id in that CSI-ResourceConfigToAddMod is the same value like the bwp-Id in the + -- CSI-ResourceConfigToAddMod indicated by resourcesForChannelMeasurement. + nzp-CSI-RS-ResourcesForInterference CSI-ResourceConfigId OPTIONAL, -- Need R + + -- Time domain behavior of reporting configuration + reportConfigType CHOICE { + periodic SEQUENCE { + -- Periodicity and slot offset. Corresponds to L1 parameter 'ReportPeriodicity'and 'ReportSlotOffset' + -- (see 38.214, section section 5.2.1.4). + reportSlotConfig CSI-ReportPeriodicityAndOffset, + -- Indicates which PUCCH resource to use for reporting on PUCCH. + pucch-CSI-ResourceList SEQUENCE (SIZE (1..maxNrofBWPs)) OF PUCCH-CSI-Resource + }, + semiPersistentOnPUCCH SEQUENCE { + -- Periodicity and slot offset. Corresponds to L1 parameter 'ReportPeriodicity' and 'ReportSlotOffset' + -- (see 38.214, section section 5.2.1.4). + reportSlotConfig CSI-ReportPeriodicityAndOffset, + -- Indicates which PUCCH resource to use for reporting on PUCCH. + pucch-CSI-ResourceList SEQUENCE (SIZE (1..maxNrofBWPs)) OF PUCCH-CSI-Resource + }, + semiPersistentOnPUSCH SEQUENCE { + -- Periodicity. Corresponds to L1 parameter 'Reportperiodicity-spCSI'. (see 38.214, section 5.2.1.1?FFS_Section) + reportSlotConfig ENUMERATED {sl5, sl10, sl20, sl40, sl80, sl160, sl320}, + -- Timing offset Y for aperiodic reporting using PUSCH. This field lists the allowed offset values. + -- A particular value is indicated in DCI. The first report is transmitted in slot n+Y, second report in n+Y+P, + -- where P is the configured periodicity. + reportSlotOffsetList SEQUENCE (SIZE (1..4)) OF INTEGER (0..7), + -- RNTI for SP CSI-RNTI, Corresponds to L1 parameter 'SPCSI-RNTI' (see 38.214, section 5.2.1.5.2) + -- FFS: RAN1 models different RNTIs as different Search Spaces with independent configurations. Align the configuration + -- of this one (e.g. group with monitoring periodicity, PDCCH candidate configuration, DCI-Payload size...)? + csi-RNTI RNTI-Value, + -- Index of the p0-alpha set determining the power control for this CSI report transmission. + -- Corresponds to L1 parameter 'SPCSI-p0alpha' (see 38.214, section FFS_Section) + p0alpha P0-PUSCH-AlphaSetId + }, + aperiodic SEQUENCE { + -- Timing offset Y for aperiodic reporting using PUSCH. This field lists the allowed offset values. A particular value is indicated in DCI. + -- (see 38.214, section 5.2.3) + -- FFS_Value: Range wasn’t final in RAN1 table. + -- FFS_FIXME: How are the DCI codepoints mapped to the allowed offsets? + reportSlotOffsetList SEQUENCE (SIZE (1..16)) OF INTEGER (0..7) + } + }, + -- The CSI related quanities to report. Corresponds to L1 parameter 'ReportQuantity' (see 38.214, section REF) + reportQuantity CHOICE { + none NULL, + cri-RI-PMI-CQI NULL, + cri-RI-i1 NULL, + cri-RI-i1-CQI SEQUENCE { + -- PRB bundling size to assume for CQI calcuation when reportQuantity is CRI/RI/i1/CQI + -- Corresponds to L1 parameter 'PDSCH-bundle-size-for-CSI' (see 38.214, section 5.2.1.4) + pdsch-BundleSizeForCSI ENUMERATED {n2, n4} OPTIONAL + }, + cri-RI-CQI NULL, + cri-RSRP NULL, + ssb-Index-RSRP NULL, + cri-RI-LI-PMI-CQI NULL + }, + -- Reporting configuration in the frequency domain. (see 38.214, section 5.2.1.4) + reportFreqConfiguration SEQUENCE { + -- Indicates whether the UE shall report a single (wideband) or multiple (subband) CQI. (see 38.214, section 5.2.1.4) + cqi-FormatIndicator ENUMERATED { widebandCQI, subbandCQI }, + -- Indicates whether the UE shall report a single (wideband) or multiple (subband) PMI. (see 38.214, section 5.2.1.4) + pmi-FormatIndicator ENUMERATED { widebandPMI, subbandPMI }, + -- Indicates a contiguous or non-contigous subset of subbands in the bandwidth part which CSI shall be reported + -- for. Each bit in the bit-string represents one subband. The right-most bit in the bit string represents the + -- lowest subband in the BWP. (see 38.214, section 5.2.1.4) + -- The number of subbands is determined according to 38.214 section 5.2.1.4. It is absent if there are less than 24 PRBs (no sub band) + -- and present otherwise, the number of sub bands can be from 3 (24 PRBs, sub band size 8) to 18 (72 PRBs, sub band size 4). + csi-ReportingBand CHOICE { + subbands3 BIT STRING(SIZE(3)), + subbands4 BIT STRING(SIZE(4)), + subbands5 BIT STRING(SIZE(5)), + subbands6 BIT STRING(SIZE(6)), + subbands7 BIT STRING(SIZE(7)), + subbands8 BIT STRING(SIZE(8)), + subbands9 BIT STRING(SIZE(9)), + subbands10 BIT STRING(SIZE(10)), + subbands11 BIT STRING(SIZE(11)), + subbands12 BIT STRING(SIZE(12)), + subbands13 BIT STRING(SIZE(13)), + subbands14 BIT STRING(SIZE(14)), + subbands15 BIT STRING(SIZE(15)), + subbands16 BIT STRING(SIZE(16)), + subbands17 BIT STRING(SIZE(17)), + subbands18 BIT STRING(SIZE(18)), + ... + } OPTIONAL -- Need S + + }, + -- Time domain measurement restriction for the channel (signal) measurements. + -- Corresponds to L1 parameter 'MeasRestrictionConfig-time-channel' (see 38.214, section 5.2.1.1) + timeRestrictionForChannelMeasurements ENUMERATED {configured, notConfigured}, + -- Time domain measurement restriction for interference measurements. + -- Corresponds to L1 parameter 'MeasRestrictionConfig-time-interference' (see 38.214, section 5.2.1.1) + timeRestrictionForInterferenceMeasurements ENUMERATED {configured, notConfigured}, + -- Codebook configuration for Type-1 or Type-II including codebook subset restriction + codebookConfig CodebookConfig, + -- Maximum number of CQIs per CSI report (cf. 1 for 1-CW, 2 for 2-CW) + nrofCQIsPerReport ENUMERATED {n1, n2}, + -- Turning on/off group beam based reporting (see 38.214, section 5.2.1.4) + groupBasedBeamReporting CHOICE { + enabled NULL, + disabled SEQUENCE { + -- The number (N) of measured RS resources to be reported per report setting in a non-group-based report. + -- N <= N_max, where N_max is either 2 or 4 depending on UE capability. + -- FFS: The signaling mechanism for the gNB to select a subset of N beams for the UE to measure and report. + -- FFS: Note: this parameter may not be needed for certain resource and/or report settings + -- FFS_ASN1: Change groupBasedBeamReporting into a CHOICE and include this field into the "no" option? + -- (see 38.214, section FFS_Section) + -- When the field is absent the UE applies the value 1 + nrofReportedRS ENUMERATED {n1, n2, n3, n4} OPTIONAL -- Need S + } + }, + + -- Which CQI table to use for CQI calculation. Corresponds to L1 parameter 'CQI-table' (see 38.214, section 5.2.2.1) + cqi-Table ENUMERATED {table1, table2, spare2, spare1} OPTIONAL, + -- Indicates one out of two possible BWP-dependent values for the subband size as indicated in 38.214 table 5.2.1.4-2 + -- Corresponds to L1 parameter 'SubbandSize' (see 38.214, section 5.2.1.4) + subbandSize ENUMERATED {value1, value2}, + -- BLER target that the UE shall be assume in its CQI calculation. + -- Corresponds to L1 parameter 'BLER-Target' (see 38.214, section 5.2.2.1) + -- FFS_Values (now filled with spares) + bler-Target ENUMERATED {zerodot1, spare3, space2, spare1} OPTIONAL, + -- Port indication for RI/CQI calculation. For each CSI-RS resource in the linked ResourceConfig for channel measurement, + -- a port indication for each rank R, indicating which R ports to use. Applicable only for non-PMI feedback. + -- Corresponds to L1 parameter 'Non-PMI-PortIndication' (see 38.214, section FFS_Section) + -- The first entry in non-PMI-PortIndication corresponds to the NZP-CSI-RS-Resource indicated by the first entry in + -- nzp-CSI-RS-Resources in the NZP-CSI-RS-ResourceSet indicated in the first entry of nzp-CSI-RS-ResourceSetList of the + -- CSI-ResourceConfig whose CSI-ResourceConfigId is indicated in a CSI-MeasId together with the above CSI-ReportConfigId, + -- the second entry in non-PMI-PortIndication corresponds to the NZP-CSI-RS-Resource indicated by the second entry in + -- nzp-CSI-RS-Resources in the NZP-CSI-RS-ResourceSet indicated in the first entry of nzp-CSI-RS-ResourceSetList of the + -- same CSI-ResourceConfig, and so on until the NZP-CSI-RS-Resource indicated by the last entry in nzp-CSI-RS-Resources + -- in the in the NZP-CSI-RS-ResourceSet indicated in the first entry of nzp-CSI-RS-ResourceSetList of the + -- same CSI-ResourceConfig, then the next entry corresponds to the NZP-CSI-RS-Resource indicated by the first entry + -- in nzp-CSI-RS-Resources in the NZP-CSI-RS-ResourceSet indicated in the second entry of nzp-CSI-RS-ResourceSetList of the + -- same CSI-ResourceConfig and so on. + non-PMI-PortIndication SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-ResourcesPerConfig)) OF PortIndexFor8Ranks OPTIONAL, ... +} + +CSI-ReportPeriodicityAndOffset ::= CHOICE { + slots4 INTEGER(0..3), + slots5 INTEGER(0..4), + slots8 INTEGER(0..7), + slots10 INTEGER(0..9), + slots16 INTEGER(0..15), + slots20 INTEGER(0..19), + slots40 INTEGER(0..39), + slots80 INTEGER(0..79), + slots160 INTEGER(0..159), + slots320 INTEGER(0..319) +} + +PUCCH-CSI-Resource ::= CHOICE { + uplinkBandwidthPartId BWP-Id, + -- PUCCH resource for the associated uplink BWP. Only PUCCH-Resource of format 2, 3 and 4 is supported. + pucch-Resource PUCCH-Resource +} + +-- The PortIndexFor8Ranks allows to indicate port indexes for 1 to 8 ranks using a port index ranges from 0 to 31, or from 0 to 15, or from 0 +-- to 7, or from 0 to 3, or from 0 to 1, or with 0 only. + +PortIndexFor8Ranks ::= CHOICE { + portIndex8 SEQUENCE{ + rank1-8 PortIndex8, + rank2-8 SEQUENCE(SIZE(1..2)) OF PortIndex8, + rank3-8 SEQUENCE(SIZE(1..3)) OF PortIndex8, + rank4-8 SEQUENCE(SIZE(1..4)) OF PortIndex8, + rank5-8 SEQUENCE(SIZE(1..5)) OF PortIndex8, + rank6-8 SEQUENCE(SIZE(1..6)) OF PortIndex8, + rank7-8 SEQUENCE(SIZE(1..7)) OF PortIndex8, + rank8-8 SEQUENCE(SIZE(1..8)) OF PortIndex8 + }, + portIndex4 SEQUENCE{ + rank1-4 PortIndex4, + rank2-4 SEQUENCE(SIZE(1..2)) OF PortIndex4, + rank3-4 SEQUENCE(SIZE(1..3)) OF PortIndex4, + rank4-4 SEQUENCE(SIZE(1..4)) OF PortIndex4 + }, + portIndex2 SEQUENCE{ + rank1-2 PortIndex2, + rank2-2 SEQUENCE(SIZE(1..2)) OF PortIndex2 + }, + portIndex1 NULL +} + +PortIndex8::= INTEGER (0..7) +PortIndex4::= INTEGER (0..3) +PortIndex2::= INTEGER (0..1) + +maxNrofNZP-CSI-RS-ResourcesPerConfig INTEGER ::= 128 +-- TAG-CSI-REPORTCONFIG-STOP +-- TAG-CSI-REPORTCONFIGID-START +CSI-ReportConfigId ::= INTEGER (0..maxNrofCSI-ReportConfigurations-1) + +-- TAG-CSI-REPORTCONFIGID-STOP +-- TAG-CSI-RESOURCECONFIG-START + +-- One CSI resource configuration comprising of one or more resource sets +CSI-ResourceConfig ::= SEQUENCE { + + -- Used in CSI-ReportConfig to refer to an instance of CSI-ResourceConfig + csi-ResourceConfigId CSI-ResourceConfigId, + + -- Contains up to maxNrofNZP-CSI-RS-ResourceSetsPerConfig resource sets if ResourceConfigType is 'aperiodic' and 1 otherwise. + -- Corresponds to L1 parameter 'ResourceSetConfigList' (see 38.214, section 5.2.1.3.1) + csi-RS-ResourceSetList CHOICE { + nzp-CSI-RS-SSB SEQUENCE { + nzp-CSI-RS-ResourceSetList SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-ResourceSetsPerConfig)) OF NZP-CSI-RS-ResourceSetId OPTIONAL, + -- List of SSB resources used for beam measurement and reporting in a resource set + -- Corresponds to L1 parameter 'resource-config-SS-list' (see 38,214, section FFS_Section) + csi-SSB-ResourceSetList SEQUENCE (SIZE (1..maxNrofCSI-SSB-ResourceSetsPerConfig)) OF CSI-SSB-ResourceSetId OPTIONAL + }, + csi-IM-ResourceSetList SEQUENCE (SIZE (1..maxNrofCSI-IM-ResourceSetsPerConfig)) OF CSI-IM-ResourceSetId + }, + + + -- The DL BWP which the CSI-RS associated with this CSI-ResourceConfig are located in. + -- Corresponds to L1 parameter 'BWP-Info' (see 38.214, section 5.2.1.2 + bwp-Id BWP-Id, + + -- Time domain behavior of resource configuration. Corresponds to L1 parameter 'ResourceConfigType' (see 38.214, section 5.2.2.3.5) + resourceType ENUMERATED { aperiodic, semiPersistent, periodic }, + ... +} + +-- TAG-CSI-RESOURCECONFIGTOADDMOD-STOP +-- TAG-CSI-RESOURCECONFIGID-START +CSI-ResourceConfigId ::= INTEGER (0..maxNrofCSI-ResourceConfigurations-1) + +-- TAG-CSI-RESOURCECONFIGID-STOP +-- TAG-CSI-RESOURCEPERIODICITYANDOFFSET-START + +CSI-ResourcePeriodicityAndOffset ::= CHOICE { + slots4 INTEGER (0..3), + slots5 INTEGER (0..4), + slots8 INTEGER (0..7), + slots10 INTEGER (0..9), + slots16 INTEGER (0..15), + slots20 INTEGER (0..19), + slots32 INTEGER (0..31), + slots40 INTEGER (0..39), + slots64 INTEGER (0..63), + slots80 INTEGER (0..79), + slots160 INTEGER (0..159), + slots320 INTEGER (0..319), + slots640 INTEGER (0..639) +} + +-- TAG-CSI-RESIYRCEPERIODICITYANDOFFSET-STOP +-- TAG-CSI-RS-RESOURCEMAPPING-START + +CSI-RS-ResourceMapping ::= SEQUENCE { + -- Frequency domain allocation within a physical resource block in accordance with 38.211, section 7.4.1.5.3 including table 7.4.1.5.2-1. + -- The number of bits that may be set to one depend on the chosen row in that table. For the choice "other", the row can be determined from + -- the parmeters below and from the number of bits set to 1 in frequencyDomainAllocation. + frequencyDomainAllocation CHOICE { + row1 BIT STRING (SIZE (4)), + row2 BIT STRING (SIZE (12)), + row4 BIT STRING (SIZE (3)), + other BIT STRING (SIZE (6)) + }, + -- Number of ports (see 38.214, section 5.2.2.3.1) + nrofPorts ENUMERATED {p1,p2,p4,p8,p12,p16,p24,p32}, + -- Time domain allocation within a physical resource block. The field indicates the first OFDM symbol in the PRB used for CSI-RS. + -- Parameter l0 in 38.211, section 7.4.1.5.3. Value 2 is supported only when DL-DMRS-typeA-pos equals 3. + firstOFDMSymbolInTimeDomain INTEGER (0..13), + -- Time domain allocation within a physical resource block. Parameter l1 in 38.211, section 7.4.1.5.3. + firstOFDMSymbolInTimeDomain2 INTEGER (0..13) OPTIONAL, -- Need R + -- CDM type (see 38.214, section 5.2.2.3.1) + cdm-Type ENUMERATED {noCDM, fd-CDM2, cdm4-FD2-TD2, cdm8-FD2-TD4}, + -- Density of CSI-RS resource measured in RE/port/PRB. Corresponds to L1 parameter 'CSI-RS-Density' (see 38.211, section 7.4.1.5.3) + -- Values 0.5 (dot5), 1 (one) and 3 (three) are allowed for X=1, + -- values 0.5 (dot5) and 1 (one) are allowed for X=2, 16, 24 and 32, + -- value 1 (one) is allowed for X=4, 8, 12. + -- For density = 1/2, includes 1 bit indication for RB level comb offset indicating whether odd or even RBs are occupied by CSI-RS + density CHOICE { + dot5 ENUMERATED {evenPRBs, oddPRBs}, + one NULL, + three NULL, + spare NULL + }, + -- Wideband or partial band CSI-RS. Corresponds to L1 parameter 'CSI-RS-FreqBand' (see 38.214, section 5.2.2.3.1) + freqBand CSI-FrequencyOccupation, + ... +} + +-- TAG-CSI-RS-RESOURCEMAPPING-STOP +-- TAG-CSI-SEMIPERSISTENTONPUSCHTRIGGERSTATELIST-START + +CSI-SemiPersistentOnPUSCH-TriggerStateList ::= SEQUENCE(SIZE (1..maxNrOfSemiPersistentPUSCH-Triggers)) OF CSI-SemiPersistentOnPUSCH-TriggerState +CSI-SemiPersistentOnPUSCH-TriggerState ::= SEQUENCE { + associatedReportConfigInfo CSI-ReportConfigId, + ... +} + +maxNrOfSemiPersistentPUSCH-Triggers INTEGER ::= 64 -- Maximum number of triggers for semi persistent reporting on PUSCH + +-- TAG-CSI-SEMIPERSISTENTONPUSCHTRIGGERSTATELIST-STOP +-- TAG-CSI-SSB-RESOURCESETID-START + +CSI-SSB-ResourceSetId ::= INTEGER (0..maxNrofCSI-SSB-ResourceSets-1) + +-- TAG-CSI-SSB-RESOURCESETID-STOP +-- TAG-CSI-SSB-RESOURCESET-START + +CSI-SSB-ResourceSet ::= SEQUENCE { + csi-SSB-ResourceSetId CSI-SSB-ResourceSetId, + csi-SSB-ResourceList SEQUENCE (SIZE(1..maxNrofCSI-SSB-ResourcePerSet)) OF SSB-Index, + ... +} + +-- TAG-CSI-SSB-RESOURCESET-STOP +-- TAG-DMRS-DOWNLINKCONFIG-START + +DMRS-DownlinkConfig ::= SEQUENCE { + -- Selection of the DMRS type to be used for DL (see 38.211, section 7.4.1.1.1). + -- If the field is absent, the UE uses DMRS type 1. + dmrs-Type ENUMERATED {type2} OPTIONAL, -- Need R + -- Position for additional DM-RS in DL, see Table 7.4.1.1.2-4 in 38.211. + -- The four values represent the cases of 1+0, 1+1, 1+1+1. 1+1+1+1 non-adjacent OFDM symbols for DL. + -- If the field is absent, the UE applies the value pos2. + dmrs-AdditionalPosition ENUMERATED {pos0, pos1, pos3} OPTIONAL, -- Need R + -- DM-RS groups that are QCL:ed, i.e. group 1 (see 38.214, section 5.1) + dmrs-group1 BIT STRING (SIZE (12)) OPTIONAL, -- Need R + -- DM-RS groups that are QCL:ed, i.e. group 2 (see 38.214, section 5.1) + dmrs-group2 BIT STRING (SIZE (12)) OPTIONAL, -- Need R + -- The maximum number of OFDM symbols for DL front loaded DMRS. 'len1' corresponds to value 1. 'len2 corresponds to value 2. + -- If the field is absent, the UE applies value len1. + -- Corresponds to L1 parameter 'DL-DMRS-max-len' (see 38.214, section 5.1) + maxLength ENUMERATED {len2} OPTIONAL, -- Need R + -- DL DMRS scrambling initalization + -- Corresponds to L1 parameter 'n_SCID 0' (see 38.211, section 7.4.1) + -- When the field is absent the UE applies the value Physical cell ID (physCellId) configured for this serving cell." + scramblingID0 INTEGER (0..65535) OPTIONAL, -- Need S + -- DL DMRS scrambling initalization. Corresponds to L1 parameter 'n_SCID 1' (see 38.211, section 7.4.1) + -- When the field is absent the UE applies the value (physCellId) configured for this serving cell. + scramblingID1 INTEGER (0..65535) OPTIONAL, -- Need S + + -- Configures downlink PTRS. If absent of released, the UE assumes that downlink PTRS are not present. See 38.214 section 5.1.6.3 + phaseTrackingRS SetupRelease { PTRS-DownlinkConfig } OPTIONAL, -- Need M + + ... +} + +-- TAG-DMRS-DOWNLINKCONFIG-STOP +-- TAG-DMRS-UPLINKCONFIG-START + +DMRS-UplinkConfig ::= SEQUENCE { + -- Selection of the DMRS type to be used for UL (see section 38.211, section 6.4.1.1.3) + -- If the field is absent, the UE uses DMRS type 1. + dmrs-Type ENUMERATED {type2} OPTIONAL, -- Need R + -- Position for additional DM-RS in UL. Corresponds to L1 parameter 'UL-DMRS-add-pos' (see Table 7.4.1.1.2-4 in 38.211) + -- The four values represent the cases of 1+0, 1+1, 1+1+1. 1+1+1+1 non-adjacent OFDM symbols for UL. + -- If the field is absent, the UE applies the value pos2. + dmrs-AdditionalPosition ENUMERATED {pos0, pos1, pos3} OPTIONAL, -- Need R + -- Configures uplink PTRS (see 38.211, section x.x.x.x) FFS_Ref + phaseTrackingRS SetupRelease { PTRS-UplinkConfig } OPTIONAL, -- Need M + -- The maximum number of OFDM symbols for UL front loaded DMRS. 'len1' corresponds to value 1. 'len2 corresponds to value 2. + -- If the field is absent, the UE applies value len1. + -- Corresponds to L1 parameter 'UL-DMRS-max-len' (see 38.214, section 6.4.1.1.2) + maxLength ENUMERATED {len2} OPTIONAL, -- Need R + + transformPrecoding CHOICE { + -- DMRS related parameters for Cyclic Prefix OFDM + disabled SEQUENCE { + -- UL DMRS scrambling initalization for CP-OFDM + -- Corresponds to L1 parameter 'n_SCID 0' (see 38.214, section 6.4.1.1.2) + -- When the field is absent the UE applies the value Physical cell ID (physCellId) + scramblingID0 INTEGER (0..65535) OPTIONAL, -- Need S + -- UL DMRS scrambling initalization for CP-OFDM. + -- Corresponds to L1 parameter 'n_SCID 1' (see 38.214, section 6.4.1.1.2) + -- When the field is absent the UE applies the value Physical cell ID (physCellId) + scramblingID1 INTEGER (0..65535) OPTIONAL -- Need S + + }, + -- DMRS related parameters for DFT-s-OFDM (Transform Precoding) + enabled SEQUENCE { + -- Parameter: N_ID^(PUSCH) for DFT-s-OFDM DMRS. If the value is absent or released, the UE uses the Physical cell ID. + -- Corresponds to L1 parameter 'nPUSCH-Identity-Transform precoding' (see 38.211, section FFS_Section) + nPUSCH-Identity INTEGER(0..1007) OPTIONAL, -- Need S + -- Sequence-group hopping for PUSCH can be disabled for a certain UE despite being enabled on a cell basis. For DFT-s-OFDM DMRS + -- If the field is released, the UE considers group hopping to be enabled. + -- Corresponds to L1 parameter 'Disable-sequence-group-hopping-Transform-precoding' (see 38.211, section FFS_Section) + disableSequenceGroupHopping ENUMERATED {disabled} OPTIONAL, -- Need S + -- Determines if sequence hopping is enabled or not. For DFT-s-OFDM DMRS. + -- If the field is released, the UE considers sequence hopping to be disabled. + -- Corresponds to L1 parameter 'Sequence-hopping-enabled-Transform-precoding' (see 38.211, section FFS_Section) + sequenceHoppingEnabled ENUMERATED {enabled} OPTIONAL -- Need S + } + }, + ... +} + +-- TAG-DMRS-UPLINKCONFIG-STOP +-- TAG-DOWNLINKPREEMPTION-START + +-- Configuration of downlink preemption indication on PDCCH. +DownlinkPreemption ::= SEQUENCE { + -- RNTI used for indication pre-emption in DL. + -- Corresponds to L1 parameter 'INT-RNTI', where ”INT” stands for ”interruption” (see 38.213, section 10) + int-RNTI RNTI-Value, + + -- Set selection for DL-preemption indication. Corresponds to L1 parameter 'int-TF-unit' (see 38.213, section 10.1) + -- The set determines how the UE interprets the DL preemption DCI payload. + timeFrequencySet ENUMERATED {set0, set1}, + + -- Total length of the DCI payload scrambled with INT-RNTI. The value must be an integer multiple of 14 bit. + -- Corresponds to L1 parameter 'INT-DCI-payload-length' (see 38.213, section 11.2) + dci-PayloadSize INTEGER (0..maxINT-DCI-PayloadSize), + + -- Indicates (per serving cell) the position of the 14 bit INT values inside the DCI payload. + -- Corresponds to L1 parameter 'INT-cell-to-INT' and 'cell-to-INT' (see 38.213, section 11.2) + int-ConfigurationPerServingCell SEQUENCE (SIZE (1..maxNrofServingCells)) OF INT-ConfigurationPerServingCell, + ... +} + +INT-ConfigurationPerServingCell ::= SEQUENCE { + servingCellId ServCellIndex, + -- Starting position (in number of bit) of the 14 bit INT value applicable for this serving cell (servingCellId) within the DCI + -- payload. Must be multiples of 14 (bit). Corresponds to L1 parameter 'INT-values' (see 38.213, section 11.2) + positionInDCI INTEGER (0..maxINT-DCI-PayloadSize-1) +} + +-- TAG-DOWNLINKPREEMPTION-STOP +-- TAG-DRB-IDENTITY-START + +DRB-Identity ::= INTEGER (1..32) + +-- TAG-DRB-IDENTITY-STOP +-- TAG-EUTRA-MBSFN-SUBFRAMECONFIGLIST-START + +EUTRA-MBSFN-SubframeConfigList ::= SEQUENCE (SIZE (1..maxMBSFN-Allocations)) OF EUTRA-MBSFN-SubframeConfig + +EUTRA-MBSFN-SubframeConfig ::= SEQUENCE { + -- Field as defined in MBSFN-SubframeConfig in 36.331 + radioframeAllocationPeriod ENUMERATED {n1, n2, n4, n8, n16, n32}, + -- Field as defined in MBSFN-SubframeConfig in 36.331 + radioframeAllocationOffset INTEGER (0..7), + -- Field as defined in MBSFN-SubframeConfig in 36.331 + subframeAllocation CHOICE { + -- Field as defined in MBSFN-SubframeConfig in 36.331 + oneFrame BIT STRING (SIZE(6)), + -- Field as defined in MBSFN-SubframeConfig in 36.331 + fourFrames BIT STRING (SIZE(24)) + }, + subframeAllocation-v1430 CHOICE { + -- Field as defined in MBSFN-SubframeConfig in 36.331 + oneFrame-v1430 BIT STRING (SIZE(2)), + -- Field as defined in MBSFN-SubframeConfig in 36.331 + fourFrames-v1430 BIT STRING (SIZE(8)) + } OPTIONAL, -- Need R + ... +} + +-- TAG-EUTRA-MBSFN-SUBFRAMECONFIGLIST-STOP + +FilterCoefficient ::= ENUMERATED { + fc0, fc1, fc2, fc3, fc4, fc5, + fc6, fc7, fc8, fc9, fc11, fc13, + fc15, fc17, fc19, spare1, ...} + +-- TAG-FREQBANDINDICATORNR-START + +FreqBandIndicatorNR ::= INTEGER (1..1024) + +-- TAG-FREQBANDINDICATORNR-STOP +-- TAG-FREQUENCY-INFO-DL-START + +FrequencyInfoDL ::= SEQUENCE { + -- Frequency of the SSB to be used for this serving cell. The frequency provided in this field identifies the position of + -- resource element RE=#0 (subcarrier #0) of resource block RB#10 of the SS block. The cell-defining SSB of an SpCell is always on + -- the sync raster. Frequencies are considered to be on the sync raster if they are also identifiable with a GSCN value (see 38.101). + absoluteFrequencySSB ARFCN-ValueNR, + -- The frequency domain offset between SSB and the overall resource block grid in number of subcarriers. + -- Absence of the field indicates that no offset is applied (offset = 0). For FR2 only values up to 11 are applicable. + -- Corresponds to L1 parameter kssb (See 38.211, section 7.4.3.1) + ssb-SubcarrierOffset INTEGER (1..23) OPTIONAL, -- Need S + -- List of one or multiple frequency bands to which this carrier(s) belongs. Multiple values are only supported in + -- system information but not when the FrequencyInfoDL is provided in dedicated signalling (HO or S(p)Cell addition). + frequencyBandList MultiFrequencyBandListNR, + -- Absolute frequency position of the reference resource block (Common RB 0). Its lowest subcarrier is also known as Point A. + -- Note that the lower edge of the actual carrier is not defined by this field but rather in the scs-SpecificCarrierList. + -- Corresponds to L1 parameter 'offset-ref-low-scs-ref-PRB' (see 38.211, section FFS_Section) + absoluteFrequencyPointA ARFCN-ValueNR, + + -- A set of carriers for different subcarrier spacings (numerologies). Defined in relation to Point A. + -- Corresponds to L1 parameter 'offset-pointA-set' (see 38.211, section FFS_Section) + scs-SpecificCarrierList SEQUENCE (SIZE (1..maxSCSs)) OF SCS-SpecificCarrier, + ... +} + +-- TAG-FREQUENCY-INFO-UL-STOP +-- TAG-FREQUENCY-INFO-UL-START + +FrequencyInfoUL ::= SEQUENCE { + -- List of one or multiple frequency bands to which this carrier(s) belongs. Multiple values are only supported in + -- system information but not when the FrequencyInfoDL is provided in dedicated signalling (HO or S(p)Cell addition). + frequencyBandList MultiFrequencyBandListNR OPTIONAL, -- Cond FDD-OrSUL + -- Absolute frequency of the reference resource block (Common RB 0). Its lowest subcarrier is also known as Point A. + -- Corresponds to L1 parameter 'offset-ref-low-scs-ref-PRB' (see 38.211, section FFS_Section) + absoluteFrequencyPointA ARFCN-ValueNR OPTIONAL, -- Cond FDD-OrSUL + -- A set of virtual carriers for different subcarrier spacings (numerologies). Defined in relation to Point A. + -- Note that the lower edge of the actual carrier is not defined by this field but rather in the scs-SpecificCarrierList. + -- Corresponds to L1 parameter 'offset-pointA-set' (see 38.211, section FFS_Section) + scs-SpecificCarriers SEQUENCE (SIZE (1..maxSCSs)) OF SCS-SpecificCarrier, + + -- The additional spectrum emission requirements to be applied by the UE on this uplink. + -- If the field is absent, the UE applies the value FFS_RAN4. (see FFS_section, section FFS_Section) + additionalSpectrumEmission AdditionalSpectrumEmission OPTIONAL, -- Need S + -- FFS_Definition. Corresponds to parameter FFS_RAN4. (see FFS_Spec, section FFS_Section) + -- If the field is absent, the UE applies the value FFS_RAN4. + p-Max P-Max OPTIONAL, -- Need S + -- Enable the NR UL transmission with a 7.5KHz shift to the LTE raster. If the field is absent, the frequency shift is disabled. + frequencyShift7p5khz ENUMERATED {true} OPTIONAL, -- Cond FDD-OrSUL-Optional + ... +} + +-- TAG-FREQUENCY-INFO-UL-STOP +-- TAG-GSCN-VALUE-NR-START + +GSCN-ValueNR ::= INTEGER (1..28557) + + +-- TAG-GSCN-VALUE-NR-STOP + +Hysteresis ::= INTEGER (0..30) + +-- TAG-LOGICAL-CHANNEL-CONFIG-START + +LogicalChannelConfig ::= SEQUENCE { + ul-SpecificParameters SEQUENCE { + priority INTEGER (1..16), + prioritisedBitRate ENUMERATED {kBps0, kBps8, kBps16, kBps32, kBps64, kBps128, kBps256, kBps512, + kBps1024, kBps2048, kBps4096, kBps8192, kBps16384, kBps32768, kBps65536, infinity}, + bucketSizeDuration ENUMERATED {ms50, ms100, ms150, ms300, ms500, ms1000, spare2, spare1}, + + allowedServingCells SEQUENCE (SIZE (1..maxNrofServingCells-1)) OF ServCellIndex OPTIONAL, -- Need R + allowedSCS-List SEQUENCE (SIZE (1..maxSCSs)) OF SubcarrierSpacing OPTIONAL, -- Need R + maxPUSCH-Duration ENUMERATED { ms0p02, ms0p04, ms0p0625, ms0p125, ms0p25, ms0p5, spare2, spare1 } OPTIONAL, -- Need R + configuredGrantType1Allowed ENUMERATED {true} OPTIONAL, -- Need R + + logicalChannelGroup INTEGER (0..maxLCG-ID) OPTIONAL, -- Need R + schedulingRequestID SchedulingRequestId OPTIONAL, -- Need R + logicalChannelSR-Mask BOOLEAN, + logicalChannelSR-DelayTimerApplied BOOLEAN + } OPTIONAL, -- Cond UL + + -- other parameters + ... +} + +-- TAG-LOGICAL-CHANNEL-CONFIG-STOP +-- TAG-MAC-CELL-GROUP-CONFIG-START + +MAC-CellGroupConfig ::= SEQUENCE { + drx-Config SetupRelease { DRX-Config } OPTIONAL, -- Need M + + schedulingRequestConfig SchedulingRequestConfig OPTIONAL, -- Need M + bsr-Config BSR-Config OPTIONAL, -- Need M + tag-Config TAG-Config OPTIONAL, -- Need M + phr-Config SetupRelease { PHR-Config } OPTIONAL, -- Need M + -- FFS : configurable per SCell? + skipUplinkTxDynamic BOOLEAN, + -- RNTI value for downlink SPS (see SPS-config) and uplink configured scheduling (see ConfiguredSchedulingConfig). + cs-RNTI SetupRelease { RNTI-Value } OPTIONAL -- Need M +} + +DRX-Config ::= SEQUENCE { + drx-onDurationTimer CHOICE { + subMilliSeconds INTEGER (1..31), + milliSeconds ENUMERATED { + ms1, ms2, ms3, ms4, ms5, ms6, ms8, ms10, ms20, ms30, ms40, ms50, ms60, + ms80, ms100, ms200, ms300, ms400, ms500, ms600, ms800, ms1000, ms1200, + ms1600, spare9, spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 } + }, + drx-InactivityTimer ENUMERATED { + ms0, ms1, ms2, ms3, ms4, ms5, ms6, ms8, ms10, ms20, ms30, ms40, ms50, ms60, ms80, + ms100, ms200, ms300, ms500, ms750, ms1280, ms1920, ms2560, spare9, spare8, + spare7, spare6, spare5, spare4, spare3, spare2, spare1}, + drx-HARQ-RTT-TimerDL INTEGER (0..56), + drx-HARQ-RTT-TimerUL INTEGER (0..56), + drx-RetransmissionTimerDL ENUMERATED { + sl0, sl1, sl2, sl4, sl6, sl8, sl16, sl24, sl33, sl40, sl64, sl80, sl96, sl112, sl128, + sl160, sl320, spare15, spare14, spare13, spare12, spare11, spare10, spare9, + spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1}, + drx-RetransmissionTimerUL ENUMERATED { + sl0, sl1, sl2, sl4, sl6, sl8, sl16, sl24, sl33, sl40, sl64, sl80, sl96, sl112, sl128, + sl160, sl320, spare15, spare14, spare13, spare12, spare11, spare10, spare9, + spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 }, + drx-LongCycleStartOffset CHOICE { + ms10 INTEGER(0..9), + ms20 INTEGER(0..19), + ms32 INTEGER(0..31), + ms40 INTEGER(0..39), + ms60 INTEGER(0..59), + ms64 INTEGER(0..63), + ms70 INTEGER(0..69), + ms80 INTEGER(0..79), + ms128 INTEGER(0..127), + ms160 INTEGER(0..159), + ms256 INTEGER(0..255), + ms320 INTEGER(0..319), + ms512 INTEGER(0..511), + ms640 INTEGER(0..639), + ms1024 INTEGER(0..1023), + ms1280 INTEGER(0..1279), + ms2048 INTEGER(0..2047), + ms2560 INTEGER(0..2559), + ms5120 INTEGER(0..5119), + ms10240 INTEGER(0..10239) + }, + -- FFS need for finer offset granulary + -- FFS need for shorter values for long and short cycles + shortDRX SEQUENCE { + drx-ShortCycle ENUMERATED { + ms2, ms3, ms4, ms5, ms6, ms7, ms8, ms10, ms14, ms16, ms20, ms30, ms32, + ms35, ms40, ms64, ms80, ms128, ms160, ms256, ms320, ms512, ms640, spare9, + spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 }, + drx-ShortCycleTimer INTEGER (1..16) + } OPTIONAL, -- Need R + drx-SlotOffset INTEGER (0..31) + +} + +PHR-Config ::= SEQUENCE { + phr-PeriodicTimer ENUMERATED {sf10, sf20, sf50, sf100, sf200,sf500, sf1000, infinity}, + phr-ProhibitTimer ENUMERATED {sf0, sf10, sf20, sf50, sf100,sf200, sf500, sf1000}, + phr-Tx-PowerFactorChange ENUMERATED {dB1, dB3, dB6, infinity}, + multiplePHR BOOLEAN, + phr-Type2PCell BOOLEAN, + phr-Type2OtherCell BOOLEAN, + phr-ModeOtherCG ENUMERATED {real, virtual} + +} + + +TAG-Config ::= SEQUENCE { + tag-ToReleaseList SEQUENCE (SIZE (1..maxNrofTAGs)) OF TAG-Id OPTIONAL, -- Need N + tag-ToAddModList SEQUENCE (SIZE (1..maxNrofTAGs)) OF TAG-ToAddMod OPTIONAL -- Need N +} + +TAG-ToAddMod ::= SEQUENCE { + tag-Id TAG-Id, + timeAlignmentTimer TimeAlignmentTimer, + ... +} + +TAG-Id ::= INTEGER (0..maxNrofTAGs-1) + +TimeAlignmentTimer ::= ENUMERATED {ms500, ms750, ms1280, ms1920, ms2560, ms5120, ms10240, infinity} + +BSR-Config ::= SEQUENCE { + periodicBSR-Timer ENUMERATED { + sf1, sf5, sf10, sf16, sf20, sf32, sf40, sf64, sf80, sf128, sf160, sf320, sf640, sf1280, sf2560, infinity}, + retxBSR-Timer ENUMERATED { sf10, sf20, sf40, sf80, sf160, sf320, sf640, sf1280, sf2560, sf5120, sf10240, spare5, spare4, + spare3, spare2, spare1}, + logicalChannelSR-DelayTimer ENUMERATED { sf20, sf40, sf64, sf128, sf512, sf1024, sf2560, spare1} OPTIONAL -- Need R +} + + + +-- TAG-MAC-CELL-GROUP-CONFIG-STOP +-- TAG-MEAS-CONFIG-START + +MeasConfig ::= SEQUENCE { + -- Measurement objects + measObjectToRemoveList MeasObjectToRemoveList OPTIONAL, -- Need N + measObjectToAddModList MeasObjectToAddModList OPTIONAL, -- Need N + + -- Reporting configurations + reportConfigToRemoveList ReportConfigToRemoveList OPTIONAL, -- Need N + reportConfigToAddModList ReportConfigToAddModList OPTIONAL, -- Need N + + -- Measurement identities + measIdToRemoveList MeasIdToRemoveList OPTIONAL, -- Need N + measIdToAddModList MeasIdToAddModList OPTIONAL, -- Need N + + -- Other parameters + --s-Measure config + s-MeasureConfig CHOICE { + ssb-RSRP RSRP-Range, + csi-RSRP RSRP-Range + } OPTIONAL, -- Need M + + quantityConfig QuantityConfig OPTIONAL, -- Need M + + --Placehold for measGapConfig + measGapConfig MeasGapConfig OPTIONAL, -- Need M + ... +} + +MeasObjectToRemoveList ::= SEQUENCE (SIZE (1..maxNrofObjectId)) OF MeasObjectId + +MeasIdToRemoveList ::= SEQUENCE (SIZE (1..maxNrofMeasId)) OF MeasId + +ReportConfigToRemoveList ::= SEQUENCE (SIZE (1..maxReportConfigId)) OF ReportConfigId + +-- TAG-MEAS-CONFIG-STOP +--TAG-MEAS-GAP-CONFIG-START + +MeasGapConfig ::= SEQUENCE { + gapFR2 SetupRelease { GapConfig } OPTIONAL, + ... +} + +GapConfig ::= SEQUENCE { + gapOffset INTEGER (0..159), + mgl ENUMERATED {ms1dot5, ms3, ms3dot5, ms4, ms5dot5, ms6}, + mgrp ENUMERATED {ms20, ms40, ms80, ms160}, + mgta ENUMERATED {ms0, ms0dot25, ms0dot5}, + ... +} + +-- TAG-MEAS-GAP-CONFIG-STOP +-- TAG-MEAS-ID-START + +MeasId ::= INTEGER (1..maxNrofMeasId) + +-- TAG-MEAS-ID-STOP +-- TAG-MEAS-ID-TO-ADD-MOD-LIST-START + +MeasIdToAddModList ::= SEQUENCE (SIZE (1..maxNrofMeasId)) OF MeasIdToAddMod + +MeasIdToAddMod ::= SEQUENCE { + measId MeasId, + measObjectId MeasObjectId, + reportConfigId ReportConfigId +} + +-- TAG-MEAS-ID-TO-ADD-MOD-LIST-STOP +-- TAG-MEAS-OBJECT-ID-START + +MeasObjectId ::= INTEGER (1..maxNrofObjectId) + +-- TAG-MEAS-OBJECT-ID-STOP +-- TAG-MEAS-OBJECT-NR-START + +MeasObjectNR ::= SEQUENCE { + ssbFrequency ARFCN-ValueNR OPTIONAL, + refFreqCSI-RS ARFCN-ValueNR OPTIONAL, + + --RS configuration (e.g. SMTC window, CSI-RS resource, etc.) + referenceSignalConfig ReferenceSignalConfig, + + --Consolidation of L1 measurements per RS index + absThreshSS-BlocksConsolidation ThresholdNR OPTIONAL, -- Need R + absThreshCSI-RS-Consolidation ThresholdNR OPTIONAL, -- Need R + + --Config for cell measurement derivation + nrofSS-BlocksToAverage INTEGER (2..maxNrofSS-BlocksToAverage) OPTIONAL, -- Need R + nrofCSI-RS-ResourcesToAverage INTEGER (2..maxNrofCSI-RS-ResourcesToAverage) OPTIONAL, -- Need R + + -- Filter coefficients applicable to this measurement object + quantityConfigIndex INTEGER (1..maxNrofQuantityConfig), + + --Frequency-specific offsets + offsetFreq Q-OffsetRangeList, + + -- Cell list + cellsToRemoveList PCI-List OPTIONAL, -- Need N + cellsToAddModList CellsToAddModList OPTIONAL, -- Need N + + -- Black list + blackCellsToRemoveList PCI-RangeIndexList OPTIONAL, -- Need N + blackCellsToAddModList BlackCellsToAddModList OPTIONAL, -- Need N + + -- White list + whiteCellsToRemoveList PCI-RangeIndexList OPTIONAL, -- Need N + whiteCellsToAddModList WhiteCellsToAddModList OPTIONAL, -- Need N + ... +} + +ReferenceSignalConfig::= SEQUENCE { + + + -- SSB configuration for mobility (nominal SSBs, timing configuration) + ssb-ConfigMobility SSB-ConfigMobility OPTIONAL, -- Need M + -- CSI-RS resources to be used for CSI-RS based RRM measurements + csi-rs-ResourceConfigMobility SetupRelease { CSI-RS-ResourceConfigMobility } OPTIONAL-- Need M + +} + +-- A measurement timing configuration +SSB-ConfigMobility::= SEQUENCE { + --Only the values 15, 30 or 60 kHz (<6GHz), 60 or 120 kHz (>6GHz) are applicable + subcarrierSpacing SubcarrierSpacing, + -- The set of SS blocks to be measured within the SMTC measurement duration. + -- Corresponds to L1 parameter 'SSB-measured' (see FFS_Spec, section FFS_Section) + -- When the field is absent the UE measures on all SS-blocks + -- FFS_CHECK: Is this IE placed correctly. + ssb-ToMeasure SetupRelease { SSB-ToMeasure } OPTIONAL, -- Need M + + -- Indicates whether the UE can utilize serving cell timing to derive the index of SS block transmitted by neighbour cell: + useServingCellTimingForSync BOOLEAN, + + -- Primary measurement timing configuration. Applicable for intra- and inter-frequency measurements. + smtc1 SEQUENCE { + -- Periodicity and offset of the measurement window in which to receive SS/PBCH blocks. + -- Periodicity and offset are given in number of subframes. + -- FFS_FIXME: This does not match the L1 parameter table! They seem to intend an index to a hidden table in L1 specs. + -- (see 38.213, section REF): + periodicityAndOffset CHOICE { + sf5 INTEGER (0..4), + sf10 INTEGER (0..9), + sf20 INTEGER (0..19), + sf40 INTEGER (0..39), + sf80 INTEGER (0..79), + sf160 INTEGER (0..159) + }, + -- Duration of the measurement window in which to receive SS/PBCH blocks. It is given in number of subframes + -- (see 38.213, section 4.1) + duration ENUMERATED { sf1, sf2, sf3, sf4, sf5 } + }, + + -- Secondary measurement timing confguration for explicitly signalled PCIs. It uses the offset and duration from smtc1. + -- It is supported only for intra-frequency measurements in RRC CONNECTED. + smtc2 SEQUENCE { + -- PCIs that are known to follow this SMTC. + pci-List SEQUENCE (SIZE (1..maxNrofPCIsPerSMTC)) OF PhysCellId OPTIONAL, -- Need M + -- Periodicity for the given PCIs. Timing offset and Duration as provided in smtc1. + periodicity ENUMERATED {sf5, sf10, sf20, sf40, sf80, sf160, spare2, spare1} + } OPTIONAL,-- Cond IntraFreqConnected + ss-RSSI-Measurement SEQUENCE { + measurementSlots CHOICE { + kHz15 BIT STRING (SIZE(1)), + kHz30 BIT STRING (SIZE(2)), + kHz60 BIT STRING (SIZE(4)), + kHz120 BIT STRING (SIZE(8)) + }, + endSymbol INTEGER(0..13) + } OPTIONAL +} + +CSI-RS-ResourceConfigMobility ::= SEQUENCE { + -- MO specific values + isServingCellMO BOOLEAN, + -- Subcarrier spacing of CSI-RS. + -- Only the values 15, 30 or 60 kHz (<6GHz), 60 or 120 kHz (>6GHz) are applicable. + -- Corresponds to L1 parameter 'Numerology' (see 38.211, section FFS_Section) + subcarrierSpacing SubcarrierSpacing, + -- List of cells + csi-RS-CellList-Mobility SEQUENCE (SIZE (1..maxNrofCSI-RS-CellsRRM)) OF CSI-RS-CellMobility + +} + +CSI-RS-CellMobility ::= SEQUENCE { + cellId PhysCellId, + + csi-rs-MeasurementBW SEQUENCE { + -- Allowed size of the measurement BW in PRBs + -- Corresponds to L1 parameter 'CSI-RS-measurementBW-size' (see FFS_Spec, section FFS_Section) + nrofPRBs ENUMERATED { size24, size48, size96, size192, size264}, + -- Starting PRB index of the measurement bandwidth + -- Corresponds to L1 parameter 'CSI-RS-measurement-BW-start' (see FFS_Spec, section FFS_Section) + -- FFS_Value: Upper edge of value range unclear in RAN1 + startPRB INTEGER(0..2169) + }, + + -- Frequency domain density for the 1-port CSI-RS for L3 mobility + -- Corresponds to L1 parameter 'Density' (see FFS_Spec, section FFS_Section) + density ENUMERATED {d1,d3} OPTIONAL, + + +-- List of resources + csi-rs-ResourceList-Mobility SEQUENCE (SIZE (1..maxNrofCSI-RS-ResourcesRRM)) OF CSI-RS-Resource-Mobility +} + + +CSI-RS-Resource-Mobility ::= SEQUENCE { + csi-RS-Index CSI-RS-Index, + -- Contains periodicity and slot offset for periodic/semi-persistent CSI-RS (see 38.211, section x.x.x.x)FFS_Ref + slotConfig CHOICE { + ms4 INTEGER (0..31), + ms5 INTEGER (0..39), + ms10 INTEGER (0..79), + ms20 INTEGER (0..159), + ms40 INTEGER (0..319) + }, + -- Each CSI-RS resource may be associated with one SSB. If such SSB is indicated, the NW also indicates whether the UE may assume + -- quasi-colocation of this SSB with this CSI-RS reosurce. + -- Corresponds to L1 parameter 'Associated-SSB' (see FFS_Spec, section FFS_Section) + + associatedSSB SEQUENCE { + ssb-Index SSB-Index, + -- The CSI-RS resource is either QCL’ed not QCL’ed with the associated SSB in spatial parameters + -- Corresponds to L1 parameter 'QCLed-SSB' (see FFS_Spec, section FFS_Section) + isQuasiColocated BOOLEAN + } OPTIONAL, -- Cond AssociatedSSB + + + -- Frequency domain allocation within a physical resource block in accordance with 38.211, section 7.4.1.5.3 including table 7.4.1.5.2-1. + -- The number of bits that may be set to one depend on the chosen row in that table. For the choice "other", the row can be determined from + -- the parmeters below and from the number of bits set to 1 in frequencyDomainAllocation. + frequencyDomainAllocation CHOICE { + row1 BIT STRING (SIZE (4)), + row2 BIT STRING (SIZE (12)) + }, + + + -- Time domain allocation within a physical resource block. The field indicates the first OFDM symbol in the PRB used for CSI-RS. + -- Parameter l0 in 38.211, section 7.4.1.5.3. Value 2 is supported only when DL-DMRS-typeA-pos equals 3. + firstOFDMSymbolInTimeDomain INTEGER (0..13), + -- Scrambling ID for CSI-RS(see 38.211, section 7.4.1.5.2) + sequenceGenerationConfig INTEGER (0..1023), + ... +} + +CSI-RS-Index ::= INTEGER (0..maxNrofCSI-RS-ResourcesRRM-1) + +Q-OffsetRangeList ::= SEQUENCE { + rsrpOffsetSSB Q-OffsetRange DEFAULT dB0, + rsrqOffsetSSB Q-OffsetRange DEFAULT dB0, + sinrOffsetSSB Q-OffsetRange DEFAULT dB0, + rsrpOffsetCSI-RS Q-OffsetRange DEFAULT dB0, + rsrqOffsetCSI-RS Q-OffsetRange DEFAULT dB0, + sinrOffsetCSI-RS Q-OffsetRange DEFAULT dB0 +} + +SSB-ToMeasure ::= CHOICE { + -- bitmap for sub 3 GHz + shortBitmap BIT STRING (SIZE (4)), + -- bitmap for 3-6 GHz + mediumBitmap BIT STRING (SIZE (8)), + -- bitmap for above 6 GHz + longBitmap BIT STRING (SIZE (64)) +} + + +ThresholdNR ::= SEQUENCE{ + thresholdRSRP RSRP-Range OPTIONAL, + thresholdRSRQ RSRQ-Range OPTIONAL, + thresholdSINR SINR-Range OPTIONAL +} + +CellsToAddModList ::= SEQUENCE (SIZE (1..maxNrofCellMeas)) OF CellsToAddMod + +CellsToAddMod ::= SEQUENCE { + physCellId PhysCellId, + cellIndividualOffset Q-OffsetRangeList +} + +BlackCellsToAddModList ::= SEQUENCE (SIZE (1..maxNrofPCI-Ranges)) OF BlackCellsToAddMod + +BlackCellsToAddMod ::= SEQUENCE { + pci-RangeIndex PCI-RangeIndex, + pci-Range PCI-Range +} + + +WhiteCellsToAddModList ::= SEQUENCE (SIZE (1..maxNrofPCI-Ranges)) OF WhiteCellsToAddMod + +WhiteCellsToAddMod ::= SEQUENCE { + pci-RangeIndex PCI-RangeIndex, + pci-Range PCI-Range +} + +-- TAG-MEAS-OBJECT-NR-STOP +-- TAG-MEAS-OBJECT-TO-ADD-MOD-LIST-START + +MeasObjectToAddModList ::= SEQUENCE (SIZE (1..maxNrofObjectId)) OF MeasObjectToAddMod + +MeasObjectToAddMod ::= SEQUENCE { + measObjectId MeasObjectId, + measObject CHOICE { + measObjectNR MeasObjectNR, + ... + } +} + +-- TAG-MEAS-OBJECT-TO-ADD-MOD-LIST-STOP +-- TAG-MEAS-RESULTS-START + +MeasResults ::= SEQUENCE { + measId MeasId, + measResultServingFreqList MeasResultServFreqList, + measResultNeighCells CHOICE { + measResultListNR MeasResultListNR, + ... + } OPTIONAL, + ... +} + +MeasResultServFreqList ::= SEQUENCE (SIZE (1..maxNrofServingCells)) OF MeasResultServFreq + +MeasResultServFreq ::= SEQUENCE { + servFreqId ServCellIndex, + measResultServingCell MeasResultNR, + measResultBestNeighCell MeasResultNR, + ... +} + +MeasResultListNR ::= SEQUENCE (SIZE (1..maxCellReport)) OF MeasResultNR + +MeasResultNR ::= SEQUENCE { + physCellId PhysCellId OPTIONAL, + --FFS: Details of cgi info + cgi-Info ENUMERATED {ffsTypeAndValue} OPTIONAL, + measResult SEQUENCE { + cellResults SEQUENCE{ + resultsSSB-Cell MeasQuantityResults OPTIONAL, + resultsCSI-RS-Cell MeasQuantityResults OPTIONAL + }, + rsIndexResults SEQUENCE{ + resultsSSB-Indexes ResultsPerSSB-IndexList OPTIONAL, + resultsCSI-RS-Indexes ResultsPerCSI-RS-IndexList OPTIONAL + } OPTIONAL + }, + ... +} + + +MeasQuantityResults ::= SEQUENCE { + rsrp RSRP-Range OPTIONAL, + rsrq RSRQ-Range OPTIONAL, + sinr SINR-Range OPTIONAL +} + +ResultsPerSSB-IndexList::= SEQUENCE (SIZE (1..maxNrofSSBs)) OF ResultsPerSSB-Index + +ResultsPerSSB-Index ::= SEQUENCE { + ssb-Index SSB-Index, + ssb-Results MeasQuantityResults OPTIONAL +} + +ResultsPerCSI-RS-IndexList::= SEQUENCE (SIZE (1..maxNrofCSI-RS)) OF ResultsPerCSI-RS-Index + +ResultsPerCSI-RS-Index ::= SEQUENCE { + csi-RS-Index CSI-RS-Index, + csi-RS-Results MeasQuantityResults OPTIONAL +} + +-- TAG-MEAS-RESULTS-STOP +-- TAG-MEAS-RESULT-SCG-FAILURE-START + +MeasResultSCG-Failure ::= SEQUENCE { + measResultServFreqList MeasResultServFreqList2NR, + measResultNeighCells MeasResultList2NR, + ... +} + +MeasResultServFreqList2NR ::= SEQUENCE (SIZE (1..maxNrofServingCells)) OF MeasResultServFreq2NR + +MeasResultServFreq2NR ::= SEQUENCE { + ssbFrequency ARFCN-ValueNR OPTIONAL, + refFreqCSI-RS ARFCN-ValueNR OPTIONAL, + measResultServingCell MeasResultNR, + measResultBestNeighCell MeasResultNR OPTIONAL +} + +MeasResultList2NR ::= SEQUENCE (SIZE (1..maxFreq)) OF MeasResult2NR + +MeasResult2NR ::= SEQUENCE { + ssbFrequency ARFCN-ValueNR OPTIONAL, + refFreqCSI-RS ARFCN-ValueNR OPTIONAL, + measResultListNR MeasResultListNR +} + +-- TAG-MEAS-RESULT-SCG-FAILURE-STOP +-- TAG-MEASRESULT-CELL-LIST-SFTD-START + +MeasResultCellListSFTD ::= SEQUENCE (SIZE (1..maxCellSFTD)) OF MeasResultCellSFTD + +MeasResultCellSFTD ::= SEQUENCE { + physCellId PhysCellId, + sfn-OffsetResult INTEGER (0..1023), + frameBoundaryOffsetResult INTEGER (-30720..30719), + rsrp-Result RSRP-Range OPTIONAL +} + +-- TAG-MEASRESULT-CELL-LIST-SFTD-STOP +-- TAG-MULTIFREQUENCYBANDLISTNR-START + +MultiFrequencyBandListNR ::= SEQUENCE (SIZE (1..maxNrofMultiBands)) OF FreqBandIndicatorNR + +-- TAG-MULTIFREQUENCYBANDLISTNR-STOP +-- TAG-NZP-CSI-RS-RESOURCESET-START +NZP-CSI-RS-ResourceSet ::= SEQUENCE { + nzp-CSI-ResourceSetId NZP-CSI-RS-ResourceSetId, + + -- NZP-CSI-RS-Resources assocaited with this NZP-CSI-RS resource set. + -- Corresponds to L1 parameter 'CSI-RS-ResourceConfigList' (see 38.214, section 5.2) + -- For CSI, there are at most 8 NZP CSI RS resources per resource set + nzp-CSI-RS-Resources SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-ResourcesPerSet)) OF NZP-CSI-RS-ResourceId, + + -- Indicates whether repetition is on/off. If set to set to 'OFF', the UE may not assume that the + -- NZP-CSI-RS resources within the resource set are transmitted with the same downlink spatial domain transmission filter + -- and with same NrofPorts in every symbol. + -- Corresponds to L1 parameter 'CSI-RS-ResourceRep' (see 38.214, sections 5.2.2.3.1 and 5.1.6.1.2) + -- Can only be configured for CSI-RS resource sets which are associated with CSI-ReportConfig with report of L1 RSRP or “no report” + repetition ENUMERATED { on, off } OPTIONAL, + + -- Offset X between the slot containing the DCI that triggers a set of aperiodic NZP CSI-RS resources and the slot in which the + -- CSI-RS resource set is transmitted. When the field is absent the UE applies the value 0. + -- Corresponds to L1 parameter 'Aperiodic-NZP-CSI-RS-TriggeringOffset' (see 38,214, section FFS_Section) + aperiodicTriggeringOffset INTEGER(0..4) OPTIONAL, -- Need S + + -- Indicates that the antenna port for all NZP-CSI-RS resources in the CSI-RS resource set is same. + -- Corresponds to L1 parameter 'TRS-Info' (see 38.214, section 5.2.2.3.1) + trs-Info ENUMERATED {true} OPTIONAL, + ... +} + +-- TAG-NZP-CSI-RS-RESOURCESET-STOP +-- TAG-NZP-CSI-RS-RESOURCESETID-START +NZP-CSI-RS-ResourceSetId ::= INTEGER (0..maxNrofNZP-CSI-RS-ResourceSets-1) + +-- TAG-NZP-CSI-RS-RESOURCESETID-STOP +-- TAG-NZP-CSI-RS-RESOURCE-START +NZP-CSI-RS-Resource ::= SEQUENCE { + nzp-CSI-RS-ResourceId NZP-CSI-RS-ResourceId, + + -- OFDM symbol location(s) in a slot and subcarrier occupancy in a PRB of the CSI-RS resource + resourceMapping CSI-RS-ResourceMapping, + -- Power offset of NZP CSI-RS RE to PDSCH RE. Value in dB. Corresponds to L1 parameter Pc (see 38.214, sections 5.2.2.3.1 and 4.1) + powerControlOffset INTEGER(-8..15), + -- Power offset of NZP CSI-RS RE to SS RE. Value in dB. Corresponds to L1 parameter 'Pc_SS' (see 38.214, section 5.2.2.3.1) + powerControlOffsetSS ENUMERATED{db-3, db0, db3, db6} OPTIONAL, + -- Scrambling ID (see 38.214, section 5.2.2.3.1) + scramblingID ScramblingId, + + -- Periodicity and slot offset sl1 corresponds to a periodicity of 1 slot, sl2 to a periodicity of two slots, and so on. + -- The corresponding offset is also given in number of slots. Corresponds to L1 parameter 'CSI-RS-timeConfig' (see 38.214, section 5.2.2.3.1) + periodicityAndOffset CSI-ResourcePeriodicityAndOffset OPTIONAL, --Cond PeriodicOrSemiPersistent + + -- For a target periodic CSI-RS, contains a reference to one TCI-State in TCI-States for providing the QCL source and + -- QCL type. For periodic CSI-RS, the source can be SSB or another periodic-CSI-RS. + -- Corresponds to L1 parameter 'QCL-Info-PeriodicCSI-RS' (see 38.214, section 5.2.2.3.1) + qcl-InfoPeriodicCSI-RS TCI-StateId OPTIONAL, --Cond Periodic + ... +} + +-- TAG-NZP-CSI-RS-RESOURCE-STOP +-- TAG-NZP-CSI-RS-RESOURCEID-START +NZP-CSI-RS-ResourceId ::= INTEGER (0..maxNrofNZP-CSI-RS-Resources-1) + +-- TAG-NZP-CSI-RS-RESOURCEID-STOP +-- TAG-P-MAX-START + +P-Max ::= INTEGER (-30..33) + +-- TAG-P-MAX-STOP +-- TAG-PCI-LIST-START + +PCI-List ::= SEQUENCE (SIZE (1..maxNrofCellMeas)) OF PhysCellId + +-- TAG-PCI-LIST-STOP +-- TAG-PCI-RANGE-START + +PCI-Range ::= SEQUENCE { + start PhysCellId, + range ENUMERATED { + n4, n8, n12, n16, n24, n32, n48, n64, n84, + n96, n128, n168, n252, n504, n1008, + spare1} OPTIONAL -- Need Nss +} + +-- TAG-PCI-RANGE-STOP +-- TAG-PCI-RANGE-INDEX-START + +PCI-RangeIndex ::= INTEGER (1..maxNrofPCI-Ranges) + + +-- TAG-PCI-RANGE-INDEX-STOP +-- TAG-PCI-RANGE-INDEX-LIST-START + +PCI-RangeIndexList ::= SEQUENCE (SIZE (1..maxNrofPCI-Ranges)) OF PCI-RangeIndex + +-- TAG-PCI-Range-INDEX-LIST-STOP +-- TAG-PDCCH-CONFIG-START + +PDCCH-Config ::= SEQUENCE { + -- List of UE specifically configured Control Resource Sets (CORESETs) to be used by the UE. + -- The network configures at most 3 CORESETs per BWP per cell (including the initial CORESET). + controlResourceSetToAddModList SEQUENCE(SIZE (1..3)) OF ControlResourceSet OPTIONAL, + controlResourceSetToReleaseList SEQUENCE(SIZE (1..3)) OF ControlResourceSetId OPTIONAL, + + -- List of UE specifically configured Control Resource Sets (CORESETs). + -- The network configures at most 10 Search Spaces per BWP per cell (including the initial Search Space). + searchSpacesToAddModList SEQUENCE(SIZE (1..10)) OF SearchSpace OPTIONAL, + searchSpacesToReleaseList SEQUENCE(SIZE (1..10)) OF SearchSpaceId OPTIONAL, + + -- Configuration of downlink preemtption indications to be monitored in this cell. + -- Corresponds to L1 parameter 'Preemp-DL' (see 38.214, section 11.2) + -- FFS_RAN1: LS R1-1801281 indicates this is "Per Cell (but association with each configured BWP is needed)" => Unclear, keep on BWP for now. + downlinkPreemption SetupRelease { DownlinkPreemption } OPTIONAL, -- Need M + + -- Configuration of Slot-Format-Indicators to be monitored in this cell + + -- FFS_RAN1 discusses still whether this SFI payload configuration is BWP- or Cell-Specific. + slotFormatIndicator SetupRelease { SlotFormatIndicator } OPTIONAL, -- Need M + -- Enable and configure reception of group TPC commands for PUSCH + tpc-PUSCH SetupRelease { PUSCH-TPC-CommandConfig } OPTIONAL, -- Need M + + -- Enable and configure reception of group TPC commands fpr PUCCH + tpc-PUCCH SetupRelease { PUCCH-TPC-CommandConfig } OPTIONAL, -- Cond PUCCH-CellOnly + + ... +} + +-- TAG-PDCCH-CONFIG-STOP +-- TAG-PDCCH-CONFIGCOMMON-START + +PDCCH-ConfigCommon ::= SEQUENCE { + + -- A list of common control resource sets. Only CORESETs with ControlResourceSetId = 0 or 1 are allowed. The CORESET#0 + -- corresponds to the CORESET configured in MIB (see pdcch-ConfigSIB1) and is used to provide that information to the UE + -- by dedicated signalling during handover and (P)SCell addition. The CORESET#1 may be configured an used for RAR + -- (see ra-ControlResourceSet). + commonControlResourcesSets SEQUENCE (SIZE(1..2)) OF ControlResourceSet OPTIONAL, -- Need R + + -- A list of additional common search spaces. + commonSearchSpaces SEQUENCE (SIZE(1..4)) OF SearchSpace OPTIONAL, -- Need R + + -- ID of the search space for SIB1 message. + + -- Corresponds to L1 parameter 'rmsi-SearchSpace' (see 38.213, section 10) + searchSpaceSIB1 SearchSpaceId OPTIONAL, -- Need R + -- ID of the Search space for other system information, i.e., SIB2 and beyond. + -- Corresponds to L1 parameter 'osi-SearchSpace' (see 38.213, section 10) + -- If the field is absent, the monitoring occasions are derived as described in 38.213, section 10.1 and section 13. + searchSpaceOtherSystemInformation SearchSpaceId OPTIONAL, -- Need R + + -- ID of the Search space for paging. Corresponds to L1 parameter 'paging-SearchSpace' (see 38.213, section 10) + -- If the field is absent, the monitoring occasions are derived as described in 38.213, section 10.1 and section 13. + pagingSearchSpace SearchSpaceId OPTIONAL, -- Need R + + -- CORESET configured for random access. When the field is absent the UE uses the CORESET according to pdcch-ConfigSIB1 + -- which is associated with ControlResourceSetId = 0. + -- Corresponds to L1 parameter 'rach-coreset-configuration' (see 38.211?, section FFS_Section) + ra-ControlResourceSet ControlResourceSetId OPTIONAL, -- Need S + -- ID of the Search space for random access procedure. Corresponds to L1 parameter 'ra-SearchSpace' (see 38.214?, section FFS_Section) + -- If the field is absent, the monitoring occasions are derived as described in 38.213, section 10.1 and section 13. + ra-SearchSpace SearchSpaceId OPTIONAL, -- Need R + ... + +} + +-- TAG-PDCCH-CONFIGCOMMON-STOP +-- TAG-PDCP-CONFIG-START + +PDCP-Config ::= SEQUENCE { + drb SEQUENCE { + discardTimer ENUMERATED {ms10, ms20, ms30, ms40, ms50, ms60, ms75, ms100, ms150, ms200, ms250, ms300, ms500, ms750, ms1500, infinity} OPTIONAL, -- Cond Setup + pdcp-SN-SizeUL ENUMERATED {len12bits, len18bits} OPTIONAL, -- Cond Setup2 + pdcp-SN-SizeDL ENUMERATED {len12bits, len18bits} OPTIONAL, -- Cond Setup2 + headerCompression CHOICE { + notUsed NULL, + rohc SEQUENCE { + maxCID INTEGER (1..16383) DEFAULT 15, + profiles SEQUENCE { + profile0x0001 BOOLEAN, + profile0x0002 BOOLEAN, + profile0x0003 BOOLEAN, + profile0x0004 BOOLEAN, + profile0x0006 BOOLEAN, + profile0x0101 BOOLEAN, + profile0x0102 BOOLEAN, + profile0x0103 BOOLEAN, + profile0x0104 BOOLEAN + }, + drb-ContinueROHC BOOLEAN + }, + uplinkOnlyROHC SEQUENCE { + maxCID INTEGER (1..16383) DEFAULT 15, + profiles SEQUENCE { + profile0x0006 BOOLEAN + }, + drb-ContinueROHC BOOLEAN + }, + ... + }, + integrityProtection ENUMERATED { enabled } OPTIONAL, -- Cond ConnectedTo5GC + statusReportRequired ENUMERATED { true } OPTIONAL, -- Cond Rlc-AM + outOfOrderDelivery BOOLEAN + } OPTIONAL, -- Cond DRB + -- FFS / TODO: Handle more than two secondary cell groups + moreThanOneRLC SEQUENCE { + primaryPath SEQUENCE { + cellGroup CellGroupId OPTIONAL, -- Need R + logicalChannel LogicalChannelIdentity OPTIONAL -- Need R + }, + ul-DataSplitThreshold UL-DataSplitThreshold OPTIONAL, -- Cond SplitBearer + pdcp-Duplication ENUMERATED { true } OPTIONAL -- Need R + } OPTIONAL, -- Cond MoreThanOneRLC + + t-Reordering ENUMERATED { + ms0, ms1, ms2, ms4, ms5, ms8, ms10, ms15, ms20, ms30, ms40, ms50, ms60, ms80, ms100, ms120, ms140, ms160, ms180, ms200, ms220, + ms240, ms260, ms280, ms300, ms500, ms750, ms1000, ms1250, ms1500, ms1750, ms2000, ms2250, ms2500, ms2750, + ms3000, spare28, spare27, spare26, spare25, spare24, spare23, spare22, spare21, spare20, + spare19, spare18, spare17, spare16, spare15, spare14, spare13, spare12, spare11, spare10, spare09, + spare08, spare07, spare06, spare05, spare04, spare03, spare02, spare01 } OPTIONAL, -- Need S + + + ... +} + +UL-DataSplitThreshold ::= ENUMERATED { + b0, b100, b200, b400, b800, b1600, b3200, b6400, b12800, b25600, b51200, b102400, b204800, + b409600, b819200, b1228800, b1638400, b2457600, b3276800, b4096000, b4915200, b5734400, + b6553600, infinity, spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1} + +-- TAG-PDCP-CONFIG-STOP +-- TAG-PDSCH-CONFIG-START + +PDSCH-Config ::= SEQUENCE { + -- Identifer used to initalite data scrambling (c_init) for both PDSCH. + -- Corresponds to L1 parameter 'Data-scrambling-Identity' (see 38,214, section FFS_Section) + -- FFS:_Replace by tye ScramblingId used in other places? + dataScramblingIdentityPDSCH INTEGER (0..1007) OPTIONAL, + + -- DMRS configuration for PDSCH transmissions using PDSCH mapping type A (chosen dynamically via PDSCH-TimeDomainResourceAllocation). + dmrs-DownlinkForPDSCH-MappingTypeA SetupRelease { DMRS-DownlinkConfig } OPTIONAL, -- Need M + -- DMRS configuration for PDSCH transmissions using PDSCH mapping type B (chosen dynamically via PDSCH-TimeDomainResourceAllocation). + dmrs-DownlinkForPDSCH-MappingTypeB SetupRelease { DMRS-DownlinkConfig } OPTIONAL, -- Need M + + + -- A list of Transmission Configuration Indicator (TCI) states for dynamically indicating (over DCI) a transmission configuration + -- which includes QCL-relationships between the DL RSs in one RS set and the PDSCH DMRS ports + -- (see 38.214, section 5.1.4) + tci-StatesToAddModList SEQUENCE (SIZE(1..maxNrofTCI-States)) OF TCI-State OPTIONAL, -- Need N + tci-StatesToReleaseList SEQUENCE (SIZE(1..maxNrofTCI-States)) OF TCI-StateId OPTIONAL, -- Need N + + -- Interleaving unit configurable between 2 and 4 PRBs + -- Corresponds to L1 parameter 'VRB-to-PRB-interleaver' (see 38.211, section 6.3.1.6) + vrb-ToPRB-Interleaver ENUMERATED {n2, n4}, + + -- Configuration of resource allocation type 0 and resource allocation type 1 for non-fallback DCI + -- Corresponds to L1 parameter 'Resouce-allocation-config' (see 38.214, section 5.1.2) + resourceAllocation ENUMERATED { resourceAllocationType0, +resourceAllocationType1, +dynamicSwitch}, + + -- List of time-domain configurations for timing of DL assignment to DL data. If configured, the values provided herein + -- override the values received in corresponding PDSCH-ConfigCommon. + pdsch-AllocationList SEQUENCE (SIZE(1..maxNrofDL-Allocations)) OF PDSCH-TimeDomainResourceAllocation OPTIONAL, -- Need R + -- Number of repetitions for data. Corresponds to L1 parameter 'aggregation-factor-DL' (see 38.214, section FFS_Section) + -- When the field is absent the UE applies the value 1 + pdsch-AggregationFactor ENUMERATED { n2, n4, n8 } OPTIONAL, -- Need S + + -- Resources patterns which the UE should rate match PDSCH around. The UE rate matches around the union of all resources + -- indicated in the nexted bitmaps. Corresponds to L1 parameter 'Resource-set-BWP' (see 38.214, section 5.1.2.2.3) + -- FFS: RAN1 indicates that there should be a set of patterns per cell and one per BWP => Having both seems unnecessary. + + rateMatchPatternToAddModList SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPattern OPTIONAL, -- Need N + rateMatchPatternToReleaseList SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPatternId OPTIONAL, -- Need N + + -- The IDs of a first group of RateMatchPatterns defined in the rateMatchPatternToAddModList. + -- Corresponds to L1 parameter 'Resource-set-group-1'. (see 38.214, section FFS_Section) + rateMatchPatternGroup1 SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPatternId OPTIONAL, -- Need R + -- The IDs of a second group of RateMatchPatterns defined in the rateMatchPatternToAddModList + -- Corresponds to L1 parameter 'Resource-set-group-2'. (see 38.214, section FFS_Section) + rateMatchPatternGroup2 SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPatternId OPTIONAL, -- Need R + + + -- Selection between config 1 and config 2 for RBG size for PDSCH. Corresponds to L1 parameter 'RBG-size-PDSCH' (see 38.214, section 5.1.2.2.1) + rbg-Size ENUMERATED {config1, config2}, + + -- Indicates which MCS table the UE shall use for PDSCH. Corresponds to L1 parameter 'MCS-Table-PDSCH' (see 38.214, section 5.1.3.1). + mcs-Table ENUMERATED {qam64, qam256}, + + -- Maximum number of code words that a single DCI may schedule. This changes the number of MCS/RV/NDI bits in the DCI message from 1 to 2. + maxNrofCodeWordsScheduledByDCI ENUMERATED {n1, n2} OPTIONAL, -- Need R + + + -- Indicates the PRB bundle type and bundle size(s). If "dynamic" is chosen, the actual BundleSizeSet to use is indicated via DCI. + -- If a bundleSize(Set) value is absent, the UE applies the value n2. Corresponds to L1 parameter 'PRB_bundling' + -- (see 38.214, section 5.1.2.3) + prb-BundlingType CHOICE { + static SEQUENCE { + bundleSize ENUMERATED { n4, wideband } OPTIONAL -- Need S + }, + dynamic SEQUENCE { + bundleSizeSet1 ENUMERATED { n4, wideband, n2-wideband, n4-wideband } OPTIONAL, -- Need S + bundleSizeSet2 ENUMERATED { n4, wideband } OPTIONAL -- Need S + } + }, + + -- A list of Zero-Power (ZP) CSI-RS resources used for PDSCH rate-matching. + -- Corresponds to L1 parameter 'ZP-CSI-RS-ResourceConfigList' (see 38.214, section FFS_Section) + zp-CSI-RS-ResourceToAddModList SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Resources)) OF ZP-CSI-RS-Resource OPTIONAL, -- Need N + zp-CSI-RS-ResourceToReleaseList SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Resources)) OF ZP-CSI-RS-ResourceId OPTIONAL, -- Need M + + -- A list of sets. Each set contains a set-ID and the IDs of one or more ZP-CSI-RS-Resources (the actual resources are defined in the + -- zp-CSI-RS-ResourceToAddModList). The network triggers a set by indicating its set-ID (ZP-CSI-RS-ResourceSetId) in the DCI payload. + -- The resources referenced in these sets are confgiured with resourceType 'aperiodic'. + -- Corresponds to L1 parameter ' ZP-CSI-RS-ResourceSetConfigList' (see 38.214, section FFS_Section) + aperiodic-ZP-CSI-RS-ResourceSetsToAddModList SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Sets)) OF ZP-CSI-RS-ResourceSet OPTIONAL, -- Need N + aperiodic-ZP-CSI-RS-ResourceSetsToReleaseList SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Sets)) OF ZP-CSI-RS-ResourceSetId OPTIONAL, -- Need N + + -- A list of sets. Each set contains a set-ID and the IDs of one or more ZP-CSI-RS-Resources (the actual resources are defined in the + -- zp-CSI-RS-ResourceToAddModList). The network triggers a set by indicating its set-ID (ZP-CSI-RS-ResourceSetId) in the MAC CE. + -- The resources referenced in these sets are confgiured with resourceType 'semi-persistent'. + -- Corresponds to L1 parameter 'SP-ZP-CSI-RS-Resource-List' (see 38.214, section 5.1.4_Section) + sp-ZP-CSI-RS-ResourceSetsToAddModList SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Sets)) OF ZP-CSI-RS-ResourceSet OPTIONAL, -- Need N + sp-ZP-CSI-RS-ResourceSetsToReleaseList SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Sets)) OF ZP-CSI-RS-ResourceSetId OPTIONAL, -- Need N + + ... +} + + + + +-- TAG-PDSCH-CONFIG-STOP +-- TAG-PDSCH-CONFIGCOMMON-START + +PDSCH-ConfigCommon ::= SEQUENCE { + + -- List of time-domain configurations for timing of DL assignment to DL data + pdsch-AllocationList SEQUENCE (SIZE(1..maxNrofDL-Allocations)) OF PDSCH-TimeDomainResourceAllocation OPTIONAL, -- Need R + + ... +} + +-- TAG-PDSCH-CONFIGCOMMON-STOP +-- TAG-PDSCH-SERVINGCELLCONFIG-START + +PDSCH-ServingCellConfig ::= SEQUENCE { + -- Enables and configures code-block-group (CBG) based transmission (see 38.213, section 9.1.1) + codeBlockGroupTransmission SetupRelease { PDSCH-CodeBlockGroupTransmission } OPTIONAL, -- Need M + -- Accounts for overhead from CSI-RS, CORESET, etc. If the field is absent, the UE applies value xOh0. + -- Corresponds to L1 parameter 'Xoh-PDSCH' (see 38.214, section 5.1.3.2) + xOverhead ENUMERATED { xOh6, xOh12, xOh18 } OPTIONAL, -- Need S + -- The number of HARQ processes to be used on the PDSCH of a serving cell. n2 corresponds to 2 HARQ processes, n4 to 4 HARQ processes + -- and so on. If the field is absent, the UE uses 8 HARQ processes. + -- Corresponds to L1 parameter 'number-HARQ-process-PDSCH' (see 38.214, section REF) + nrofHARQ-ProcessesForPDSCH ENUMERATED {n2, n4, n6, n10, n12, n16} OPTIONAL, -- Need S + -- The ID of the serving cell (of the same cell group) to use for PUCCH. + -- If the field is absent, the UE sends the HARQ feedback on the PUCCH of the SpCell of this cell group. + pucch-Cell ServCellIndex OPTIONAL , -- Cond SCellAddOnly + ... +} + +PDSCH-CodeBlockGroupTransmission ::= SEQUENCE { + -- Maximum number of code-block-groups (CBGs) per TB. In case of multiple CW the maximum CBG is 4 (see 38.213, section 9.1.1) + maxCodeBlockGroupsPerTransportBlock ENUMERATED {n2, n4, n6, n8}, + -- Indicates whether CBGFI for CBG based (re)transmission in DL is enabled (true). (see 38.212, section 7.3.1.2.2) + codeBlockGroupFlushIndicator BOOLEAN, + ... +} + +-- TAG-PDSCH-SERVINGCELLCONFIG-STOP +-- TAG-PDSCH-TIMEDOMAINRESOURCEALLOCATION-START + +PDSCH-TimeDomainResourceAllocation ::= SEQUENCE { + -- Corresponds to L1 parameter 'K0' (see 38.214, section FFS_Section) + -- When the field is absent the UE applies the value 0 + k0 INTEGER (1..3) OPTIONAL, -- Need S + -- PDSCH mapping type. Corresponds to L1 parameter 'Mapping-type' (see 38.214, section FFS_Section) + mappingType ENUMERATED {typeA, typeB}, + -- An index into a table/equation in RAN1 specs capturing valid combinations of start symbol and length (jointly encoded) + -- Corresponds to L1 parameter 'Index-start-len' (see 38.214, section FFS_Section) + startSymbolAndLength BIT STRING (SIZE (7)) +} + +-- TAG-PDSCH-TIMEDOMAINRESOURCEALLOCATION-STOP +-- TAG-PHYS-CELL-ID-START + +PhysCellId ::= INTEGER (0..1007) + +-- TAG-PHYS-CELL-ID-STOP +-- TAG-PRB-ID-START + +PRB-Id ::= INTEGER (0..maxNrofPhysicalResourceBlocks-1) + +-- TAG-PRB-ID-STOP +-- TAG-PTRS-DOWNLINKCONFIG-START + +PTRS-DownlinkConfig ::= SEQUENCE { + -- Presence and frequency density of DL PT-RS as a function of Scheduled BW + -- If the field is absent, the UE uses K_PT-RS = 2. + -- Corresponds to L1 parameter 'DL-PTRS-frequency-density-table' (see 38.214, section 5.1) + frequencyDensity SEQUENCE (SIZE (2)) OF INTEGER (1..276) OPTIONAL, -- Need S + -- Presence and time density of DL PT-RS as a function of MCS. The value 29 is only applicable for MCS Table 5.1.3.1-1 (38.214) + -- If the field is absent, the UE uses L_PT-RS = 1. + -- Corresponds to L1 parameter 'DL-PTRS-time-density-table' (see 38.214, section 5.1) + timeDensity SEQUENCE (SIZE (3)) OF INTEGER (0..29) OPTIONAL, -- Need S + -- EPRE ratio between PTRS and PDSCH. Value 0 correspond to the codepoint ”00” in table 4.1-2. Value 1 corresponds to codepoint ”01” + -- If the field is not provided, the UE applies value 0. Corresponds to L1 parameter 'DL-PTRS-EPRE-ratio' (see 38.214, section 4.1) + epre-RatioPort1 INTEGER (0..3) OPTIONAL, -- Need S + -- EPRE ratio between PTRS and PDSCH. Value 0 correspond to the codepoint ”00” in table 4.1-2. Value 1 corresponds to codepoint ”01”. + -- If the field is not provided, the UE applies value 0. Corresponds to L1 parameter 'DL-PTRS-EPRE-ratio' (see 38.214, section 4.1) + epre-RatioPort2 SEQUENCE (SIZE (1..2)) OF INTEGER (0..3) OPTIONAL, -- Cond TwoPorts + -- Indicates the subcarrier offset for DL PTRS. If the field is absent, the UE applies the value offset00. + -- Corresponds to L1 parameter 'DL-PTRS-RE-offset' (see 38.214, section 5.1.6.3) + resourceElementOffset ENUMERATED { offset01, offset10, offset11 } OPTIONAL, -- Need S + ... +} + +-- TAG-PTRS-DOWNLINKCONFIG-STOP +-- TAG-PTRS-UPLINKCONFIG-START + +PTRS-UplinkConfig ::= SEQUENCE { + + modeSpecificParameters CHOICE { + -- Configuration of UL PTRS for CP-OFDM + cp-OFDM SEQUENCE { + -- Presence and frequency density of UL PT-RS for CP-OFDM waveform as a function of scheduled BW + -- If the field is absent, the UE uses K_PT-RS = 2. + -- Corresponds to L1 parameter 'UL-PTRS-frequency-density-table' (see 38.214, section 6.1) + frequencyDensity SEQUENCE (SIZE (2)) OF INTEGER (1..276) OPTIONAL, -- Need S + -- Presence and time density of UL PT-RS for CP-OFDM waveform as a function of MCS + -- If the field is absent, the UE uses L_PT-RS = 1. + -- Corresponds to L1 parameter 'UL-PTRS-time-density-table' (see 38.214, section 6.1) + timeDensity SEQUENCE (SIZE (3)) OF INTEGER (0..29) OPTIONAL, -- Need S + -- The maximum number of UL PTRS ports for CP-OFDM. + -- Corresponds to L1 parameter 'UL-PTRS-ports' (see 38.214, section 6.2.3.1) + maxNrofPorts ENUMERATED {n1, n2}, + -- Indicates the subcarrier offset for UL PTRS for CP-OFDM. + -- Corresponds to L1 parameter 'UL-PTRS-RE-offset' (see 38.214, section 6.1) + resourceElementOffset ENUMERATED {offset01, offset10, offset11 } OPTIONAL, -- Need S + -- UL PTRS power boosting factor per PTRS port. Corresponds to L1 parameter 'UL-PTRS-power' (see 38.214, section 6.1, table 6.2.3-5) + ptrs-Power ENUMERATED {p00, p01, p10, p11} + }, + -- Configuration of UL PTRS for DFT-S-OFDM. + dft-S-OFDM SEQUENCE { + -- Sample density of PT-RS for DFT-s-OFDM, pre-DFT, indicating a set of thresholds T={NRBn,n=0,1,2,3,4}, + -- that indicates dependency between presence of PT-RS and scheduled BW and the values of X and K the UE should + -- use depending on the scheduled BW according to the table in 38.214 FFS_Section. + -- Corresponds to L1 parameter 'UL-PTRS-pre-DFT-density' (see 38.214, section 6.1, 6.2.3-3) + sampleDensity SEQUENCE (SIZE (5)) OF INTEGER (1..276), + -- Time density (OFDM symbol level) of PT-RS for DFT-s-OFDM. If the value is absent, the UE applies value d1. + -- Corresponds to L1 parameter 'UL-PTRS-time-density-transform-precoding' (see 38.214, section 6.1) + timeDensity ENUMERATED {d2} OPTIONAL -- Need S + } + } OPTIONAL, -- Cond M + ... +} + +-- TAG-PTRS-UPLINKCONFIG-STOP +-- TAG-PUCCH-CONFIG-START + +PUCCH-Config ::= SEQUENCE { + -- Lists for adding and releasing PUCCH resource sets (see 38.213, section 9.2) + resourceSetToAddModList SEQUENCE (SIZE (1..maxNrofPUCCH-ResourceSets)) OF PUCCH-ResourceSet OPTIONAL, -- Need N + resourceSetToReleaseList SEQUENCE (SIZE (1..maxNrofPUCCH-ResourceSets)) OF PUCCH-ResourceSetId OPTIONAL, -- Need N + + -- Lists for adding and releasing PUCCH resources applicable for the UL BWP and serving cell in which the PUCCH-Config + -- is defined. The resources defined herein are referred to from other parts of the configuration to determine which + -- resource the UE shall use for which report. + resourceToAddModList SEQUENCE (SIZE (1..maxNrofPUCCH-Resources)) OF PUCCH-Resource OPTIONAL, -- Need N + resourceToReleaseList SEQUENCE (SIZE (1..maxNrofPUCCH-Resources)) OF PUCCH-ResourceId OPTIONAL, -- Need N + + -- Parameters that are common for all PUCCH resources of format 1 + format1 SetupRelease { PUCCH-FormatConfig } OPTIONAL, -- Need M + -- Parameters that are common for all PUCCH resources of format 2 + format2 SetupRelease { PUCCH-FormatConfig } OPTIONAL, -- Need M + -- Parameters that are common for all PUCCH resources of format 3 + format3 SetupRelease { PUCCH-FormatConfig } OPTIONAL, -- Need M + -- Parameters that are common for all PUCCH resources of format 4 + format4 SetupRelease { PUCCH-FormatConfig } OPTIONAL, -- Need M + + schedulingRequestResourceToAddModList SEQUENCE (SIZE (1..maxNrofSR-Resources)) OF SchedulingRequestResourceConfig OPTIONAL, -- Need M + schedulingRequestResourceToReleaseList SEQUENCE (SIZE (1..maxNrofSR-Resources)) OF SchedulingRequestResourceId OPTIONAL, -- Need M + + multi-CSI-PUCCH-ResourceList SEQUENCE (SIZE (1..2)) OF PUCCH-ResourceId OPTIONAL,-- Need M + + -- List of timiing for given PDSCH to the DL ACK. In this version of the specification only the values [0..8] are applicable. + -- Corresponds to L1 parameter 'Slot-timing-value-K1' (see 38.213, section FFS_Section) + dl-DataToUL-ACK SEQUENCE (SIZE (8)) OF INTEGER (0..15) OPTIONAL, -- Need M + + -- Configuration of the spatial relation between a reference RS and PUCCH. Reference RS can be SSB/CSI-RS/SRS. + -- If the list has more than one element, MAC-CE selects a single element (see 38.321, section FFS_Section). + -- Corresponds to L1 parameter 'PUCCH-SpatialRelationInfo' (see 38.213, section FFS_Section) + spatialRelationInfoToAddModList SEQUENCE (SIZE (1..maxNrofSpatialRelationInfos)) OF PUCCH-SpatialRelationInfo OPTIONAL, -- Need N + spatialRelationInfoToReleaseList SEQUENCE (SIZE (1..maxNrofSpatialRelationInfos)) OF PUCCH-SpatialRelationInfoId OPTIONAL, -- Need N + + pucch-PowerControl PUCCH-PowerControl OPTIONAL, -- Need M + ... +} + +PUCCH-FormatConfig ::= SEQUENCE { + -- Enabling inter-slot frequency hopping when PUCCH Format 1, 3 or 4 is repetead over multiple slots. + -- The field is not applicable for format 2. + interslotFrequencyHopping ENUMERATED {enabled} OPTIONAL, -- Need R + -- Enabling 2 DMRS symbols per hop of a PUCCH Format 3 or 4 if both hops are more than X symbols when FH is enabled (X=4). + -- Enabling 4 DMRS sybmols for a PUCCH Format 3 or 4 with more than 2X+1 symbols when FH is disabled (X=4). + -- Corresponds to L1 parameter 'PUCCH-F3-F4-additional-DMRS' (see 38.213, section 9.2.1) + -- The field is not applicable for format 1 and 2. + additionalDMRS ENUMERATED {true} OPTIONAL, -- Need R + -- Max coding rate to determine how to feedback UCI on PUCCH for format 2, 3 or 4 + -- Corresponds to L1 parameter 'PUCCH-F2-maximum-coderate', 'PUCCH-F3-maximum-coderate' and 'PUCCH-F4-maximum-coderate' + -- (see 38.213, section 9.2.5) + -- The field is not applicable for format 1. + maxCodeRate PUCCH-MaxCodeRate OPTIONAL, -- Need R + -- Number of slots with the same PUCCH F1, F3 or F4. When the field is absent the UE applies the value n1. + -- Corresponds to L1 parameter 'PUCCH-F1-number-of-slots', 'PUCCH-F3-number-of-slots' and 'PUCCH-F4-number-of-slots' + -- (see 38.213, section 9.2.6) + -- The field is not applicable for format 2. + nrofSlots ENUMERATED {n2,n4,n8} OPTIONAL, -- Need S + -- Enabling pi/2 BPSK for UCI symbols instead of QPSK for PUCCH. + -- Corresponds to L1 parameter 'PUCCH-PF3-PF4-pi/2PBSK' (see 38.213, section 9.2.5) + -- The field is not applicable for format 1 and 2. + pi2PBSK ENUMERATED {enabled} OPTIONAL, -- Need R + -- Enabling simultaneous transmission of CSI and HARQ-ACK feedback with or without SR with PUCCH Format 2, 3 or 4 + -- Corresponds to L1 parameter 'PUCCH-F2-Simultaneous-HARQ-ACK-CSI', 'PUCCH-F3-Simultaneous-HARQ-ACK-CSI' and + -- 'PUCCH-F4-Simultaneous-HARQ-ACK-CSI' (see 38.213, section 9.2.5) + -- When the field is absent the UE applies the value OFF + -- The field is not applicable for format 1. + simultaneousHARQ-ACK-CSI ENUMERATED {true} OPTIONAL -- Need R +} + +PUCCH-MaxCodeRate ::= ENUMERATED {zeroDot08, zeroDot15, zeroDot25, zeroDot35, zeroDot45, zeroDot60, zeroDot80} + +PUCCH-SpatialRelationInfo ::= SEQUENCE { + pucch-SpatialRelationInfoId PUCCH-SpatialRelationInfoId, + referenceSignal CHOICE { + ssb-Index SSB-Index, + csi-RS-Index NZP-CSI-RS-ResourceId, + srs SRS-ResourceId + }, + pucch-PathlossReferenceRS-Id PUCCH-PathlossReferenceRS-Id, + p0-PUCCH-Id P0-PUCCH-Id, + closedLoopIndex ENUMERATED { i0, i1 } +} + +PUCCH-SpatialRelationInfoId ::= INTEGER (1..maxNrofSpatialRelationInfos) + +-- A set with one or more PUCCH resources +PUCCH-ResourceSet ::= SEQUENCE { + pucch-ResourceSetId PUCCH-ResourceSetId, + + -- PUCCH resources of format0 and format1 are only allowed in the first PUCCH reosurce set, + -- i.e., in a PUCCH-ResourceSet with pucch-ResourceSetId = 0. This set may contain between 8 and 32 resources. + -- PUCCH resources of format2, format3 and format4 are only allowed in a PUCCH-ReosurceSet with pucch-ResourceSetId > 0. If present, these sets must contain 8 resources each. + -- The UE chooses a PUCCH-Resource from this list based on the 3-bit PUCCH resource indicator field in DCI as + -- speciied in 38.213, FFS_section. + -- Note that this list contains only a list of resource IDs. The actual resources are configured in PUCCH-Config. + resources SEQUENCE (SIZE (8..maxNrofPUCCH-ResourcesPerSet)) OF PUCCH-ResourceId, + + -- Maximum number of payload bits minus 1 that the UE may transmit using this PUCCH resource set. In a PUCCH occurrence, the UE + -- chooses the first of its PUCCH-ResourceSet which supports the number of bits that the UE wants to transmit. + -- The field is not present in the first set (Set0) since the maximum Size of Set0 is specified to be 3 bit. + -- The field is not present in the last configured set since the UE derives its maximum payload size as specified in 38.213. + -- This field can take integer values that are multiples of 4. Corresponds to L1 parameter 'N_2' or 'N_3' (see 38.213, section 9.2) + maxPayloadMinus1 INTEGER (4..256) OPTIONAL -- Need R +} + +PUCCH-ResourceSetId ::= INTEGER (0..maxNrofPUCCH-ResourceSets-1) + +PUCCH-Resource ::= SEQUENCE { + pucch-ResourceId PUCCH-ResourceId, + + startingPRB PRB-Id, + -- Corresponds to the L1 parameter 'PUCCH-frequency-hopping' (see 38.213, section 9.2) + intraSlotFrequencyHopping ENUMERATED { enabled } OPTIONAL, -- Need R + -- Index of starting PRB for second hop of PUCCH in case of FH. This value is appliable for intra-slot frequency hopping. + -- Corresponds to L1 parameter 'PUCCH-2nd-hop-PRB' (see 38.213, section 9.2) + secondHopPRB PRB-Id OPTIONAL, -- Need R + + -- Selection of the PUCCH format and format-specific parameters + format CHOICE { + format0 PUCCH-format0, -- Cond InFirstSetOnly + format1 PUCCH-format1, -- Cond InFirstSetOnly + format2 PUCCH-format2, -- Cond NotInFirstSet + format3 PUCCH-format3, -- Cond NotInFirstSet + format4 PUCCH-format4 -- Cond NotInFirstSet + } +} + +PUCCH-ResourceId ::= INTEGER (0..maxNrofPUCCH-Resources-1) + + +-- A PUCCH Format 0 resource configuration (see 38.213, section 9.2) +-- Corresponds to L1 parameter 'PUCCH-format0' (see 38.213, section 9.2.1) +PUCCH-format0 ::= SEQUENCE { + initialCyclicShift INTEGER(0..11), + nrofSymbols INTEGER (1..2), + startingSymbolIndex INTEGER(0..13) +} + +-- A PUCCH Format 1 resource configuration (see 38.213, section 9.2) +-- Corresponds to L1 parameter 'PUCCH-format1' (see 38.213, section 9.2.1) +PUCCH-format1 ::= SEQUENCE { + initialCyclicShift INTEGER(0..11), + nrofSymbols INTEGER (4..14), + startingSymbolIndex INTEGER(0..10), + timeDomainOCC INTEGER(0..6) +} + +-- A PUCCH Format 2 resource configuration (see 38.213, section 9.2) +-- Corresponds to L1 parameter 'PUCCH-format2onfig' (see 38.213, section 9.2.1) +PUCCH-format2 ::= SEQUENCE { + nrofPRBs INTEGER (1..16), + nrofSymbols INTEGER (1..2), + startingSymbolIndex INTEGER(0..13) +} + +-- A PUCCH Format 3 resource configuration(see 38.213, section 9.2) +-- Corresponds to L1 parameter 'PUCCH-format3' (see 38.213, section 9.2.1) +PUCCH-format3 ::= SEQUENCE { + -- The supported values are 1,2,3,4,5,6,8,9,10,12,15 and 16 + nrofPRBs INTEGER (1..16), + nrofSymbols INTEGER (4..14), + startingSymbolIndex INTEGER(0..10) +} + +-- A PUCCH Format 4 resource configuration (see 38.213, section 9.2) +-- Corresponds to L1 parameter 'PUCCH-format4' (see 38.213, section 9.2.1) +PUCCH-format4 ::= SEQUENCE { + nrofSymbols INTEGER (4..14), + occ-Length ENUMERATED {n2,n4}, + occ-Index ENUMERATED {n0,n1,n2,n3}, + startingSymbolIndex INTEGER(0..10) +} + +-- TAG-PUCCH-CONFIG-STOP +-- TAG-PUCCH-CONFIGCOMMON-START + +PUCCH-ConfigCommon ::= SEQUENCE { + -- An entry into a 16-row table where each row configures a set of cell-specific PUCCH resources/parameters. The UE uses + -- those PUCCH resources during initial access on the initial uplink BWP. Once the network provides a dedicated PUCCH-Config + -- for that bandwidth part the UE applies that one instead of the one provided in this field. + -- Corresponds to L1 parameter 'PUCCH-resource-common' (see 38.213, section 9.2) + pucch-ResourceCommon BIT STRING (SIZE (4)) OPTIONAL, -- Need R + + -- Configuration of group- and sequence hopping for all the PUCCH formats 0, 1, 3 and 4. "neither" implies neither group + -- or sequence hopping is enabled. "enable" enables group hopping and disables sequence hopping. "disable"” disables group + -- hopping and enables sequence hopping. Corresponds to L1 parameter 'PUCCH-GroupHopping' (see 38.211, section 6.4.1.3) + pucch-GroupHopping ENUMERATED { neither, enable, disable }, + -- Cell-Specific scrambling ID for group hoppping and sequence hopping if enabled. + -- Corresponds to L1 parameter 'HoppingID' (see 38.211, section 6.3.2.2) + hoppingId BIT STRING (SIZE (10)) OPTIONAL, -- Need R + + -- Power control parameter P0 for PUCCH transmissions. Value in dBm. Only even values (step size 2) allowed. + -- Corresponds to L1 parameter 'p0-nominal-pucch' (see 38.213, section 7.2) + p0-nominal INTEGER (-202..24) OPTIONAL, -- Need R + + ... +} + +-- TAG-PUCCH-CONFIGCOMMON-STOP +-- TAG-PUCCH-POWERCONTROL-START +PUCCH-PowerControl ::= SEQUENCE { + + -- deltaF for PUCCH format 0 with 1dB step size (see 38.213, section 7.2) + deltaF-PUCCH-f0 INTEGER (-16..15) OPTIONAL, -- Need R + -- deltaF for PUCCH format 1 with 1dB step size (see 38.213, section 7.2) + deltaF-PUCCH-f1 INTEGER (-16..15) OPTIONAL, -- Need R + -- deltaF for PUCCH format 2 with 1dB step size (see 38.213, section 7.2) + deltaF-PUCCH-f2 INTEGER (-16..15) OPTIONAL, -- Need R + -- deltaF for PUCCH format 3 with 1dB step size (see 38.213, section 7.2) + deltaF-PUCCH-f3 INTEGER (-16..15) OPTIONAL, -- Need R + -- deltaF for PUCCH format 4 with 1dB step size (see 38.213, section 7.2) + deltaF-PUCCH-f4 INTEGER (-16..15) OPTIONAL, -- Need R + + -- A set with dedicated P0 values for PUCCH, i.e., {P01, P02,... }. Corresponds to L1 parameter 'p0-pucch-set' (see 38.213, section 7.2) + p0-Set SEQUENCE (SIZE (1..maxNrofPUCCH-P0-PerSet)) OF P0-PUCCH OPTIONAL, -- Need M + + -- A set of Reference Signals (e.g. a CSI-RS config or a SSblock) to be used for PUCCH pathloss estimation. + -- Up to maxNrofPUCCH-PathlossReference-RSs may be configured + -- FFS_CHECK: Is it possible not to configure it at all? What does the UE use then? Any SSB? + -- Corresponds to L1 parameter 'pucch-pathlossReference-rs-config' (see 38.213, section 7.2) + pathlossReferenceRSs SEQUENCE (SIZE (1..maxNrofPUCCH-PathlossReferenceRSs)) OF PUCCH-PathlossReferenceRS OPTIONAL, -- Need M + -- Number of PUCCH power control adjustment states maintained by the UE (i.e., g(i)). If the field is present (n2) the UE maintains + -- two power control states (i.e., g(i,0) and g(i,1)). Otherwise, it applies one (i.e., g(i,0)). + -- Corresponds to L1 parameter 'num-pucch-pcadjustment-states' (see 38.213, section 7.2) + twoPUCCH-PC-AdjustmentStates ENUMERATED {twoStates} OPTIONAL, -- Need R + ... +} + +-- P0 value for PUCCH. Corresponds to L1 parameter 'p0-pucch' (see 3,213, section 7.2) +P0-PUCCH ::= SEQUENCE { + p0-PUCCH-Id P0-PUCCH-Id, + -- P0 value for PUCCH with 1dB step size. + p0-PUCCH-Value INTEGER (-16..15) +} + +P0-PUCCH-Id ::= INTEGER (1..8) + +-- A reference signal (RS) configured as pathloss reference signal for PUCCH power control +-- Corresponds to L1 parameter 'pucch-pathlossReference-rs' (see 38.213, section 7.2) +PUCCH-PathlossReferenceRS ::= SEQUENCE { + pucch-PathlossReferenceRS-Id PUCCH-PathlossReferenceRS-Id, + referenceSignal CHOICE { + ssb-Index SSB-Index, + csi-RS-Index NZP-CSI-RS-ResourceId + } +} + +-- ID for a referemce signal (RS) configured as PUCCH pathloss reference +-- Corresponds to L1 parameter 'pucch-pathlossreference-index' (see 38.213, section 7.2) +-- FFS_CHECK: Is this ID used anywhere except inside the PUCCH-PathlossReference-RS itself? If not, remove. +PUCCH-PathlossReferenceRS-Id ::= INTEGER (0..maxNrofPUCCH-PathlossReferenceRSs-1) + +-- TAG-PUCCH-POWERCONTROL-STOP +-- TAG-PUCCH-TPC-COMMANDCONFIG-START + +PUCCH-TPC-CommandConfig ::= SEQUENCE { + -- An index determining the position of the first bit of TPC command (applicable to the SpCell) inside the DCI format 2-2 payload. + tpc-IndexPCell INTEGER (1..15) OPTIONAL, -- Cond PUCCH-SCell + -- An index determining the position of the first bit of TPC command (applicable to the PUCCH-SCell) inside the DCI format 2-2 payload. + tpc-IndexPUCCH-SCell INTEGER (1..15) OPTIONAL, -- Cond PUCCH-SCellOnly + ... +} + +-- TAG-PUCCH-TPC-COMMANDCONFIG-STOP +-- TAG-PUSCH-CONFIG-START + +PUSCH-Config ::= SEQUENCE { + -- Identifer used to initalite data scrambling (c_init) for both PUSCH. + -- Corresponds to L1 parameter 'Data-scrambling-Identity' (see 38,214, section FFS_Section) + dataScramblingIdentityPUSCH INTEGER (0..1007) OPTIONAL, -- Need M + -- Whether UE uses codebook based or non-codebook based transmission. Corresponds to L1 parameter 'ulTxConfig' (see 38.214, section 6.1.1) + txConfig ENUMERATED {codebook, nonCodebook}, + + -- DMRS configuration for PUSCH transmissions using PUSCH mapping type A (chosen dynamically via PUSCH-TimeDomainResourceAllocation). + dmrs-UplinkForPUSCH-MappingTypeA SetupRelease { DMRS-UplinkConfig } OPTIONAL, -- Need M + -- DMRS configuration for PUSCH transmissions using PUSCH mapping type B (chosen dynamically via PUSCH-TimeDomainResourceAllocation) + dmrs-UplinkForPUSCH-MappingTypeB SetupRelease { DMRS-UplinkConfig } OPTIONAL, -- Need M + + pusch-PowerControl PUSCH-PowerControl OPTIONAL, -- Need M + -- Configured one of two supported frequency hopping mode. If not configured frequency hopping is not configured + -- Corresponds to L1 parameter 'Frequency-hopping-PUSCH' (see 38.214, section 6) + -- When the field is absent the UE applies the value Not configured + frequencyHopping ENUMERATED {mode1, mode2} OPTIONAL, -- Need S + -- Set of frequency hopping offsets used when frequency hopping is enabled for granted transmission (not msg3) and type 2 + -- Corresponds to L1 parameter 'Frequency-hopping-offsets-set' (see 38.214, section 6.3) + frequencyHoppingOffsetLists SEQUENCE (SIZE (1..4)) OF INTEGER (1.. maxNrofPhysicalResourceBlocks-1) OPTIONAL, -- Need M + -- Configuration of resource allocation type 0 and resource allocation type 1 for non-fallback DCI + -- Corresponds to L1 parameter 'Resouce-allocation-config' (see 38.214, section 6.1.2) + resourceAllocation ENUMERATED { resourceAllocationType0, resourceAllocationType1, dynamicSwitch}, + + -- List of time domain allocations for timing of UL assignment to UL data. If configured, the values provided herein + -- override the values received in corresponding PUSCH-ConfigCommon. + pusch-AllocationList SEQUENCE (SIZE(1..maxNrofUL-Allocations)) OF PUSCH-TimeDomainResourceAllocation OPTIONAL, -- Need R, + -- Number of repetitions for data. Corresponds to L1 parameter 'aggregation-factor-UL' (see 38.214, section FFS_Section) + -- When the field is absent the UE applies the value 1. + pusch-AggregationFactor ENUMERATED { n2, n4, n8 } OPTIONAL, -- Need S + + -- Indicates which MCS table the UE shall use for PUSCH without transform precoder + -- Corresponds to L1 parameter 'MCS-Table-PUSCH' (see 38.214, section 6.1.4) + -- When the field is absent the UE applies the value 64QAM + mcs-Table ENUMERATED {qam256} OPTIONAL, -- Need S + -- Indicates which MCS table the UE shall use for PUSCH with transform precoding + -- Corresponds to L1 parameter 'MCS-Table-PUSCH-transform-precoding' (see 38.214, section 6.1.4) + -- When the field is absent the UE applies the value 64QAM + mcs-TableTransformPrecoder ENUMERATED { qam256} OPTIONAL, -- Need S + -- The UE specific selection of transformer precoder for PUSCH. When the field is absent the UE applies the value msg3-tp. + -- Corresponds to L1 parameter 'PUSCH-tp' (see 38.211, section 6.3.1.4) + transformPrecoder ENUMERATED {enabled, disabled} OPTIONAL, -- Need S + -- Subset of PMIs addressed by TPMI, where PMIs are those supported by UEs with maximum coherence capabilities + -- Corresponds to L1 parameter 'ULCodebookSubset' (see 38.211, section 6.3.1.5) + codebookSubset ENUMERATED {fullyAndPartialAndNonCoherent, partialAndNonCoherent, nonCoherent}, + -- Subset of PMIs addressed by TRIs from 1 to ULmaxRank. Corresponds to L1 parameter 'ULmaxRank' (see 38.211, section 6.3.1.5) + maxRank INTEGER (1..4), + + -- Selection between config 1 and config 2 for RBG size for PUSCH. When the field is absent the UE applies the value config1. + -- Corresponds to L1 parameter 'RBG-size-PUSCH' (see 38.214, section 6.1.2.2.1) + rbg-Size ENUMERATED { config2} OPTIONAL, -- Need S + + -- Selection between and configuration of dynamic and semi-static beta-offset. + -- If the field is absent or released, the UE applies the value 'semiStatic' and the BetaOffsets according to + -- FFS [BetaOffsets and/or section 9.x.x). + -- Corresponds to L1 parameter 'UCI-on-PUSCH' (see 38.213, section 9.3) + uci-OnPUSCH SetupRelease { UCI-OnPUSCH} OPTIONAL, -- Need M + -- Interleaving unit configurable between 2 and 4 PRBs + -- Corresponds to L1 parameter 'VRB-to-PRB-interleaver' (see 38.211, section 6.3.1.6) + vrb-ToPRB-Interleaver ENUMERATED {n2, n4}, + ... +} + +UCI-OnPUSCH ::= SEQUENCE { + betaOffsets CHOICE { + dynamic SEQUENCE (SIZE (4)) OF BetaOffsets, + semiStatic BetaOffsets + } OPTIONAL, -- Need M + -- Indicates a scaling factor to limit the number of resource elements assigned to UCI on PUSCH. + -- Value f0p5 corresponds to 0.5, value f0p65 corresponds to 0.65, and so on. + -- Corresponds to L1 parameter 'uci-on-pusch-scaling' (see 38.212, section 6.3) + scaling ENUMERATED { f0p5, f0p65, f0p8, f1 } +} + +-- TAG-PUSCH-CONFIG-STOP +-- TAG-PUSCH-CONFIGCOMMON-START + +PUSCH-ConfigCommon ::= SEQUENCE { + -- Sequence-group hopping can be enabled or disabled by means of this cell-specific parameter. + -- Corresponds to L1 parameter 'Group-hopping-enabled-Transform-precoding' (see 38.211, section FFS_Section) + -- This field is Cell specific + groupHoppingEnabledTransformPrecoding ENUMERATED {enabled} OPTIONAL, -- Need R + + -- List of time domain allocations for timing of UL assignment to UL data + pusch-AllocationList SEQUENCE (SIZE(1..maxNrofUL-Allocations)) OF PUSCH-TimeDomainResourceAllocation OPTIONAL, -- Need R + + -- ------------------------ + -- Power control parameters + + -- Power offset between msg3 and RACH preamble transmission in steps of 1dB. + -- Corresponds to L1 parameter 'Delta-preamble-msg3' (see 38.213, section 7.1) + msg3-DeltaPreamble INTEGER (-1..6) OPTIONAL, -- Need R + + -- P0 value for PUSCH with grant (except msg3). Value in dBm. Only even values (step size 2) allowed. + -- Corresponds to L1 parameter 'p0-nominal-pusch-withgrant' (see 38.213, section 7.1) + -- This field is cell specific + p0-NominalWithGrant INTEGER (-202..24) OPTIONAL, -- Need R + ... +} + +-- TAG-PUSCH-CONFIGCOMMON-STOP +-- TAG-PUSCH-POWERCONTROL-START + +PUSCH-PowerControl ::= SEQUENCE { + + -- If enabled, UE applies TPC commands via accumulation. If not enabled, UE applies the TPC command without accumulation. + -- If absent, TPC accumulation is enabled. Corresponds to L1 parameter 'Accumulation-enabled' (see 38.213, section 7.1) + tpc-Accumulation ENUMERATED { disabled } OPTIONAL, -- Need R + + -- Dedicated alpha value for msg3 PUSCH. Corresponds to L1 parameter 'alpha-ue-pusch-msg3' (see 38.213, section 7.1) + -- When the field is absent the UE applies the value 1. + msg3-Alpha Alpha OPTIONAL, -- Need S + + -- P0 value for UL grant-free/SPS based PUSCH. Value in dBm. Only even values (step size 2) allowed. + -- Corresponds to L1 parameter 'p0-nominal-pusch-withoutgrant' (see 38.213, section 7.1) + p0-NominalWithoutGrant INTEGER (-202..24) OPTIONAL, -- Need M, + -- configuration {p0-pusch,alpha} sets for PUSCH (except msg3), i.e., { {p0,alpha,index1}, {p0,alpha,index2},...}. + -- Corresponds to L1 parameter 'p0-push-alpha-setconfig' (see 38,213, section 7.1) + p0-AlphaSets SEQUENCE (SIZE (1..maxNrofP0-PUSCH-AlphaSets)) OF P0-PUSCH-AlphaSet OPTIONAL, -- Need M, + + -- A set of Reference Signals (e.g. a CSI-RS config or a SSblock) to be used for PUSCH path loss estimation. + -- Up to maxNrofPUSCH-PathlossReferenceRSs may be configured when 'PUSCH beam indication' is present (FFS: in DCI???). + -- Otherwise, there may be only one entry. + -- Corresponds to L1 parameter 'pusch-pathlossReference-rs-config' (see 38.213, section 7.1) + pathlossReferenceRSToAddModList SEQUENCE (SIZE (1..maxNrofPUSCH-PathlossReferenceRSs)) OF PUSCH-PathlossReferenceRS + OPTIONAL, -- Need N + pathlossReferenceRSToReleaseList SEQUENCE (SIZE (1..maxNrofPUSCH-PathlossReferenceRSs)) OF PUSCH-PathlossReferenceRS-Id + OPTIONAL, -- Need N + + -- Number of PUSCH power control adjustment states maintained by the UE (i.e., fc(i)). If the field is present (n2) the UE maintains + -- two power control states (i.e., fc(i,1) and fc(i,2)). Otherwise, it applies one (i.e., fc(i,1)). + -- Corresponds to L1 parameter 'num-pusch-pcadjustment-states' (see 38.213, section 7.1) + twoPUSCH-PC-AdjustmentStates ENUMERATED {twoStates} OPTIONAL, -- Need S + + -- Indicates whether to apply dela MCS. When the field is absent, the UE applies Ks = 0 in delta_TFC formula for PUSCH. + -- Corresponds to L1 parameter 'deltaMCS-Enabled' (see 38.213, section 7.1) + deltaMCS ENUMERATED {enabled} OPTIONAL, -- Need S + + -- A list of SRI-PUSCH-PowerControl elements among which one is selected by the SRI field in DCI. + -- Corresponds to L1 parameter 'SRI-PUSCHPowerControl-mapping' (see 38.213, section 7.1) + sri-PUSCH-MappingToAddModList SEQUENCE (SIZE (1..maxNrofSRI-PUSCH-Mappings)) OF SRI-PUSCH-PowerControl OPTIONAL, -- Need M + sri-PUSCH-MappingToReleaseList SEQUENCE (SIZE (1..maxNrofSRI-PUSCH-Mappings)) OF SRI-PUSCH-PowerControlId OPTIONAL -- Need M +} + +-- A set of p0-pusch and alpha used for PUSCH with grant. 'PUSCH beam indication' (if present) gives the index of the set to +-- be used for a particular PUSCH transmission. +-- FFS_CHECK: Is the ”PUSCH beam indication” in DCI which schedules the PUSCH? If so, clarify in field description +-- Corresponds to L1 parameter 'p0-pusch-alpha-set' (see 38.213, section 7.1) +P0-PUSCH-AlphaSet ::= SEQUENCE { + p0-PUSCH-AlphaSetId P0-PUSCH-AlphaSetId, + -- P0 value for PUSCH with grant (except msg3) in steps of 1dB. Corresponds to L1 parameter 'p0-pusch' (see 38,213, section 7.1) + p0 INTEGER (-16..15) OPTIONAL, + -- alpha value for PUSCH with grant (except msg3) (see 38.213, section 7.1) + -- When the field is absent the UE applies the value 1 + alpha Alpha OPTIONAL -- Need S +} + +-- ID for a P0-PUSCH-AlphaSet. Corresponds to L1 parameter 'p0alphasetindex' (see 38.213, section 7.1) +P0-PUSCH-AlphaSetId ::= INTEGER (0..maxNrofP0-PUSCH-AlphaSets-1) + +-- A reference signal (RS) configured as pathloss reference signal for PUSCH power control +-- Corresponds to L1 parameter 'pusch-pathlossReference-rs' (see 38.213, section 7.1) +PUSCH-PathlossReferenceRS ::= SEQUENCE { + pusch-PathlossReferenceRS-Id PUSCH-PathlossReferenceRS-Id, + referenceSignal CHOICE { + ssb-Index SSB-Index, + csi-RS-Index NZP-CSI-RS-ResourceId + } +} + +-- ID for a referemce signal (RS) configured as PUSCH pathloss reference +-- Corresponds to L1 parameter 'pathlossreference-index' (see 38.213, section 7.1) +-- FFS_CHECK: Is this ID used anywhere except inside the PUSCH-PathlossReference-RS itself? +PUSCH-PathlossReferenceRS-Id ::= INTEGER (0..maxNrofPUSCH-PathlossReferenceRSs-1) + + +-- A set of PUSCH power control parameters associated with one SRS-ResourceIndex (SRI) +SRI-PUSCH-PowerControl ::= SEQUENCE { + -- The ID of this SRI-PUSCH-PowerControl configuration. It is used as the codepoint (payload) in the SRI DCI field. + sri-PUSCH-PowerControlId SRI-PUSCH-PowerControlId, + -- The ID of PUSCH-PathlossReferenceRS as configured in the pathlossReferenceRSToAddModList in PUSCH-PowerControl. + sri-PUSCH-PathlossReferenceRS-Id PUSCH-PathlossReferenceRS-Id, + -- The ID of a P0-PUSCH-AlphaSet as configured in p0-AlphaSets in PUSCH-PowerControl. + sri-P0-PUSCH-AlphaSetId P0-PUSCH-AlphaSetId, + -- The index of the closed power control loop associated with this SRI-PUSCH-PowerControl + sri-PUSCH-ClosedLoopIndex ENUMERATED { i0, i1 } +} + +SRI-PUSCH-PowerControlId ::= INTEGER (0..maxNrofSRI-PUSCH-Mappings-1) + +-- A set of beta-offset values +BetaOffsets ::= SEQUENCE { + -- Up to 2 bits HARQ-ACK. Corresponds to L1 parameter 'betaOffset-ACK-Index-1' (see 38.213, section 9.3) + -- When the field is absent the UE applies the value 11 + betaOffsetACK-Index1 INTEGER(0..31) OPTIONAL, -- Need S + -- Up to 11 bits HARQ-ACK. Corresponds to L1 parameter 'betaOffset-ACK-Index-2' (see 38.213, section 9.3) + -- When the field is absent the UE applies the value 11 + betaOffsetACK-Index2 INTEGER(0..31) OPTIONAL, -- Need S + -- Above 11 bits HARQ-ACK. Corresponds to L1 parameter 'betaOffset-ACK-Index-3' (see 38.213, section 9.3) + -- When the field is absent the UE applies the value 11 + betaOffsetACK-Index3 INTEGER(0..31) OPTIONAL, -- Need S + -- Up to 11 bits of CSI part 1 bits. Corresponds to L1 parameter 'betaOffset-CSI-part-1-Index-1' (see 38.213, section 9.3) + -- When the field is absent the UE applies the value 13 + betaOffsetCSI-Part1-Index1 INTEGER(0..31) OPTIONAL, -- Need S + -- Above 11 bits of CSI part 1 bits. Corresponds to L1 parameter 'betaOffset-CSI-part-1-Index-2' (see 38.213, section 9.3) + -- When the field is absent the UE applies the value 13 + betaOffsetCSI-Part1-Index2 INTEGER(0..31) OPTIONAL, -- Need S + -- Up to 11 bits of CSI part 2 bits. Corresponds to L1 parameter 'betaOffset-CSI-part-2-Index-1' (see 38.213, section 9.3) + -- When the field is absent the UE applies the value 13 + betaOffsetCSI-Part2-Index1 INTEGER(0..31) OPTIONAL, -- Need S + -- Above 11 bits of CSI part 2 bits. Corresponds to L1 parameter 'betaOffset-CSI-part-2-Index-2' (see 38.213, section 9.3) + -- When the field is absent the UE applies the value 13 + betaOffsetCSI-Part2-Index2 INTEGER(0..31) OPTIONAL -- Need S +} + +-- TAG-PUSCH-POWERCONTROL-STOP +-- TAG-PUSCH-SERVINGCELLCONFIG-START + +PUSCH-ServingCellConfig ::= SEQUENCE { + -- Enables and configures code-block-group (CBG) based transmission (see 38.214, section FFS_Section) + codeBlockGroupTransmission SetupRelease { PUSCH-CodeBlockGroupGransmission } OPTIONAL, -- Need M + -- Enables LBRM (Limited buffer rate-matching). When the field is absent the UE applies FBRM (Full buffer rate-matchingLBRM). + -- Corresponds to L1 parameter 'LBRM-FBRM-selection' (see 38.212, section 5.4.2) + rateMatching ENUMERATED {limitedBufferRM} OPTIONAL, -- Need S + -- Accounts for overhead from CSI-RS, CORESET, etc. If the field is absent, the UE applies the value 'xoh0'. + -- Corresponds to L1 parameter 'Xoh-PUSCH' (see 38.214, section 5.1.3.2) + xOverhead ENUMERATED {xoh6, xoh12, xoh18} OPTIONAL, -- Need S + ... +} + +PUSCH-CodeBlockGroupGransmission ::= SEQUENCE { + -- Maximum number of code-block-groups (CBGs) per TB (see 38.xxx, section x.x.x, FFS_Ref) + -- For 2 codewords, only the values { n2, n4 } are valid. + maxCodeBlockGroupsPerTransportBlock ENUMERATED {n2, n4, n6, n8}, + ... +} + +-- TAG-PUSCH-SERVINGCELLCONFIG-STOP +-- TAG-PUSCH-TIMEDOMAINRESOURCEALLOCATION-START + +PUSCH-TimeDomainResourceAllocation ::= SEQUENCE { + -- Corresponds to L1 parameter 'K2' (see 38.214, section FFS_Section) + -- When the field is absent the UE applies the value 01 when PUSCH SCS is 15/30KHz; 2 when PUSCH SCS is 60KHz and 3 when PUSCH SCS is 120KHz. + k2 INTEGER (0..7) OPTIONAL, -- Need S + -- Mapping type. Corresponds to L1 parameter 'Mapping-type' (see 38.214, section FFS_Section) + mappingType ENUMERATED {typeA, typeB}, + -- An index into a table/equation in RAN1 specs capturing valid combinations of start symbol and length (jointly encoded) + -- Corresponds to L1 parameter 'Index-start-len' (see 38.214, section FFS_Section) + startSymbolAndLength BIT STRING (SIZE (7)) +} + +-- TAG-PUSCH-TIMEDOMAINRESOURCEALLOCATION-STOP +-- TAG-PUSCH-TPC-COMMANDCONFIG-START + +PUSCH-TPC-CommandConfig ::= SEQUENCE { + -- An index determining the position of the first bit of TPC command inside the DCI format 2-2 payload. + tpc-Index INTEGER (1..15) OPTIONAL, -- Cond SUL + -- An index determining the position of the first bit of TPC command inside the DCI format 2-2 payload. + tpc-IndexSUL INTEGER (1..15) OPTIONAL, -- Cond SUL-Only + -- The serving cell to which the acquired power control commands are applicable. If the value is absent, the UE applies the + -- TPC commands to the serving cell on which the command has been received. + targetCell ServCellIndex OPTIONAL, -- Need S + ... +} + +-- TAG-PUSCH-TPC-COMMANDCONFIG-STOP + +Q-OffsetRange ::= ENUMERATED { + dB-24, dB-22, dB-20, dB-18, dB-16, dB-14, + dB-12, dB-10, dB-8, dB-6, dB-5, dB-4, dB-3, + dB-2, dB-1, dB0, dB1, dB2, dB3, dB4, dB5, + dB6, dB8, dB10, dB12, dB14, dB16, dB18, + dB20, dB22, dB24} + +-- TAG-QUANTITY-CONFIG-START + + +QuantityConfig ::= SEQUENCE { + quantityConfigNR-List QuantityConfigNR-List OPTIONAL, -- Need M + ... +} + +QuantityConfigNR-List::= SEQUENCE (SIZE (1..maxNrofQuantityConfig)) OF QuantityConfigNR + +QuantityConfigNR::= SEQUENCE { + quantityConfigCell QuantityConfigRS, + quantityConfigRS-Index QuantityConfigRS OPTIONAL -- Need M +} + +QuantityConfigRS ::= SEQUENCE { + -- SS Block based L3 filter configurations: + ssb-FilterConfig FilterConfig, + + -- CSI-RS basedL3 filter configurations: + cs-RS-FilterConfig FilterConfig +} + +FilterConfig ::= SEQUENCE { + filterCoefficientRSRP FilterCoefficient DEFAULT fc4, + filterCoefficientRSRQ FilterCoefficient DEFAULT fc4, + filterCoefficientRS-SINR FilterCoefficient DEFAULT fc4 +} + +-- TAG-QUANTITY-CONFIG-STOP +-- TAG-RACH-CONFIG-COMMON-START + +RACH-ConfigCommon ::= SEQUENCE { + -- Generic RACH parameters + rach-ConfigGeneric RACH-ConfigGeneric, + + -- Total number of preambles used for contention based and contention free random access, excluding + -- preambles used for other purposes (e.g. for SI request). If the field is absent, the UE may use all 64 preambles for RA. + totalNumberOfRA-Preambles INTEGER (1..63) OPTIONAL, -- Need S + + -- Number of SSBs per RACH occasion (L1 parameter 'SSB-per-rach-occasion') and the number of Contention Based preambles per SSB + -- (L1 parameter 'CB-preambles-per-SSB'). By multiplying the two values, the UE determines the total number of CB preambles. + ssb-perRACH-OccasionAndCB-PreamblesPerSSB CHOICE { + oneEighth ENUMERATED {n4,n8,n12,n16,n20,n24,n28,n32,n36,n40,n44,n48,n52,n56,n60,n64}, + oneFourth ENUMERATED {n4,n8,n12,n16,n20,n24,n28,n32,n36,n40,n44,n48,n52,n56,n60,n64}, + oneHalf ENUMERATED {n4,n8,n12,n16,n20,n24,n28,n32,n36,n40,n44,n48,n52,n56,n60,n64}, + one ENUMERATED {n4,n8,n12,n16,n20,n24,n28,n32,n36,n40,n44,n48,n52,n56,n60,n64}, + two ENUMERATED {n4,n8,n12,n16,n20,n24,n28,n32}, + four INTEGER (1..16), + eight INTEGER (1..8), + sixteen INTEGER (1..4) + } OPTIONAL, -- Need M + + groupBconfigured SEQUENCE { + -- Transport Blocks size threshold in bit below which the UE shall use a contention based RA premable + -- of group A. (see 38.321, section 5.1.2) + ra-Msg3SizeGroupA ENUMERATED {b56, b144, b208, b256, b282, b480, b640, b800, b1000, spare7, spare6, spare5, + spare4, spare3, spare2, spare1}, + -- Threshold for preamble selection. Value in dB. Value minusinfinity corresponds to –infinity. + -- Value dB0 corresponds to 0 dB, dB5 corresponds to 5 dB and so on. (see FFS_Spec, section FFS_Section) + messagePowerOffsetGroupB ENUMERATED { minusinfinity, dB0, dB5, dB8, dB10, dB12, dB15, dB18}, + -- The number of CB preambles per SSB in group A. This determines implicitly the number of CB preambles per SSB available in group B. + -- (see 38.321, section 5.1.1) + numberOfRA-PreamblesGroupA INTEGER (1..64) + } OPTIONAL, -- Need R + + -- The initial value for the contention resolution timer (see 38.321, section 5.1.5) + ra-ContentionResolutionTimer ENUMERATED { sf8, sf16, sf24, sf32, sf40, sf48, sf56, sf64}, + + -- UE may select the SS block and corresponding PRACH resource for path-loss estimation and (re)transmission + -- based on SS blocks that satisfy the threshold (see 38.213, section REF) + rsrp-ThresholdSSB RSRP-Range OPTIONAL, -- Need R + -- UE may select the SS block and corresponding PRACH resource for path-loss estimation and (re)transmission on the SUL carrier + -- based on SS blocks that satisfy the threshold + -- Corresponds to L1 parameter 'SUL-RSRP-Threshold' (see FFS_Spec, section FFS_Section) + rsrp-ThresholdSSB-SUL RSRP-Range OPTIONAL, -- Need R + + -- PRACH root sequence index. Corresponds to L1 parameter 'PRACHRootSequenceIndex' (see 38.211, section 6.3.3.1). + -- The value range depends on whether L=839 or L=139 + prach-RootSequenceIndex CHOICE { + l839 INTEGER (0..837), + l139 INTEGER (0..137) + }, + + -- Subcarrier spacing of PRACH. Only the values 15 or 30 kHz (<6GHz), 60 or 120 kHz (>6GHz) are applicable. + -- Corresponds to L1 parameter 'prach-Msg1SubcarrierSpacing' (see 38.211, section FFS_Section) + msg1-SubcarrierSpacing SubcarrierSpacing, + + -- Configuration of an unrestricted set or one of two types of restricted sets, see 38.211 6.3.3.1 + restrictedSetConfig ENUMERATED {unrestrictedSet, restrictedSetTypeA, restrictedSetTypeB}, + -- Indicates to a UE whether transform precoding is enabled for Msg3 transmission. + -- Corresponds to L1 parameter 'msg3-tp' (see 38.213, section 8.1) + msg3-transformPrecoding ENUMERATED {enabled} OPTIONAL, -- Need R + ... +} + +-- TAG-RACH-CONFIG-COMMON-STOP +-- TAG-RACH-CONFIG-GENERIC-START + +RACH-ConfigGeneric ::= SEQUENCE { + -- PRACH configuration index. Corresponds to L1 parameter 'PRACHConfigurationIndex' (see 38.211, section 6.3.3.2) + prach-ConfigurationIndex INTEGER (0..255), + -- The number of PRACH transmission occasions FDMed in one time instance. + -- Corresponds to L1 parameter 'prach-FDM' (see 38.211, section FFS_Section) + msg1-FDM ENUMERATED {one, two, four, eight}, + -- Offset of lowest PRACH transmission occasion in frequency domain with respective to PRB 0. + -- The value is configured so that the corresponding RACH resource is entirely within the bandwidth of the UL BWP. + -- Corresponds to L1 parameter 'prach-frequency-start' (see 38,211, section FFS_Section) + msg1-FrequencyStart INTEGER (0..maxNrofPhysicalResourceBlocks-1), + -- N-CS configuration, see Table 6.3.3.1-3 in 38.211 + zeroCorrelationZoneConfig INTEGER(0..15), + -- The target power level at the network receiver side (see 38.213, section 7.4, 38.321, section 5.1.2, 5.1.3) + -- Only multiples of 2 dBm may be chosen (e.g. -200, -198, ...). + -- FFS-Value: Actual values to be updated based on input from RAN4 (see LS in R2-1800004 and R4-1803466). + preambleReceivedTargetPower INTEGER (-200..-74), + -- Max number of RA preamble transmission perfomed before declaring a failure (see 38.321, section 5.1.4, 5.1.5) + preambleTransMax ENUMERATED {n3, n4, n5, n6, n7, n8, n10, n20, n50, n100, n200}, + -- Power ramping steps for PRACH (see 38.321,5.1.3) + powerRampingStep ENUMERATED {dB0, dB2, dB4, dB6}, + -- Msg2 (RAR) window length in number of slots. The network configures a value lower than or euqal to 10 ms (see 38.321, section 5.1.4) + ra-ResponseWindow ENUMERATED {sl1, sl2, sl4, sl8, sl10, sl20, sl40, sl80} +} + +-- TAG-RACH-CONFIG-GENERIC-STOP +-- TAG-RACH-CONFIG-DEDICATED-START + +-- FFS_Standlone: resources for msg1-based on-demand SI request + +RACH-ConfigDedicated ::= SEQUENCE { + -- Resources for contention free random access to a given target cell + cfra-Resources CFRA-Resources, + ... +} + +CFRA-Resources ::= CHOICE { + ssb SEQUENCE { + ssb-ResourceList SEQUENCE (SIZE(1..maxRA-SSB-Resources)) OF CFRA-SSB-Resource, + -- Explicitly signalled PRACH Mask Index for RA Resource selection in TS 36.321. The mask is valid for all SSB + -- resources signalled in ssb-ResourceList + ra-ssb-OccasionMaskIndex INTEGER (0..15) + }, + csirs SEQUENCE { + csirs-ResourceList SEQUENCE (SIZE(1..maxRA-CSIRS-Resources)) OF CFRA-CSIRS-Resource, + cfra-csirs-DedicatedRACH-Threshold RSRP-Range + } +} + +CFRA-SSB-Resource ::= SEQUENCE { + -- The ID of an SSB transmitted by this serving cell. + ssb SSB-Index, + -- The preamble index that the UE shall use when performing CF-RA upon selecting the candidate beams identified by this SSB. + ra-PreambleIndex INTEGER (0..63), + ... +} + +CFRA-CSIRS-Resource ::= SEQUENCE { + -- The ID of a CSI-RS resource defined in the measurement object associated with this serving cell. + csi-RS CSI-RS-Index, + -- RA occasions that the UE shall use when performing CF-RA upon selecting the candidate beam identified by this CSI-RS. + ra-OccasionList SEQUENCE (SIZE(1..maxRA-OccasionsPerCSIRS)) OF INTEGER (0..maxRA-Occasions-1), + -- The RA preamble index to use in the RA occasions assoicated with this CSI-RS. + ra-PreambleIndex INTEGER (0..63), + ... +} + +-- TAG-RACH-CONFIG-DEDICATED-STOP +-- TAG-RADIO-BEARER-CONFIG-START + +RadioBearerConfig ::= SEQUENCE { + srb-ToAddModList SRB-ToAddModList OPTIONAL, -- Need N + srb3-ToRelease ENUMERATED{true} OPTIONAL, -- Need N + drb-ToAddModList DRB-ToAddModList OPTIONAL, -- Need N + drb-ToReleaseList DRB-ToReleaseList OPTIONAL, -- Need N + securityConfig SecurityConfig OPTIONAL, -- Cond M + ... +} + +SRB-ToAddModList ::= SEQUENCE (SIZE (1..2)) OF SRB-ToAddMod +SRB-ToAddMod ::= SEQUENCE { + srb-Identity SRB-Identity, + -- may only be set if the cell groups of all linked logical channels are reset or released + reestablishPDCP ENUMERATED{true} OPTIONAL, -- Need N + discardOnPDCP ENUMERATED{true} OPTIONAL, -- Need N + pdcp-Config PDCP-Config OPTIONAL, -- Cond PDCP + ... +} + + +DRB-ToAddModList ::= SEQUENCE (SIZE (1..maxDRB)) OF DRB-ToAddMod +DRB-ToAddMod ::= SEQUENCE { + cnAssociation CHOICE { + -- The EPS bearer ID determines the EPS bearer when NR connects to EPC using EN-DC + eps-BearerIdentity INTEGER (0..15), -- EPS-DRB-Setup + -- The SDAP configuration determines how to map QoS flows to DRBs when NR connects to the 5GC + sdap-Config SDAP-Config -- 5GC + } OPTIONAL, -- Cond DRBSetup + drb-Identity DRB-Identity, + + -- may only be set if the cell groups of all linked logical channels are reset or released + reestablishPDCP ENUMERATED{true} OPTIONAL, -- Need N + recoverPDCP ENUMERATED{true} OPTIONAL, -- Need N + pdcp-Config PDCP-Config OPTIONAL, -- Cond PDCP + ... +} + +DRB-ToReleaseList ::= SEQUENCE (SIZE (1..maxDRB)) OF DRB-Identity + + +SecurityConfig ::= SEQUENCE { + securityAlgorithmConfig SecurityAlgorithmConfig OPTIONAL, -- Cond RBTermChange + keyToUse ENUMERATED{keNB, s-KgNB} OPTIONAL, -- Cond RBTermChange + ... +} + +-- TAG-RADIO-BEARER-CONFIG-STOP +-- TAG-RADIOLINKMONITORINGCONFIG-START + +RadioLinkMonitoringConfig ::= SEQUENCE { + -- A list of reference signals for detecting beam failure and/or cell level radio link failure (RLF). + -- The network configures at most two detectionResources per BWP for the purpose "beamFailure" or "both". + -- If no RSs are provided for the purpose of beam failure detection, the UE performs beam monitoring based on the activated TCI-State + -- for PDCCH. However, if the activated TCI state refers to an aperiodic or semi-persistent CSI-RS, the gNB configures the failure + -- detection resources explicitly (FFS_RAN1: TBC by RAN1). + -- If no RSs are provided in this list at all (neither for Cell- nor for Beam-RLM), the UE performs also Cell-RLM based + -- on the activated TCI-State of PDCCH (FFS_RAN1: TBC by RAN1). + -- When the network reconfigures this field, the UE resets on-going RLF timers and counters. + failureDetectionResources SEQUENCE (SIZE(1..maxNrofFailureDetectionResources)) OF RadioLinkMonitoringRS OPTIONAL, -- Need M + -- This field determines after how many beam failure events the UE triggers beam failure recovery (see 38.321, section 5.17). + -- Value n1 corresponds to 1 beam failure instance, n2 corresponds to 2 beam failure instances and so on. + -- When the network reconfigures this field, the UE resets on-going RLF timers and counters. + -- If the field is absent, the UE does not trigger beam failure recovery. + beamFailureInstanceMaxCount ENUMERATED {n1, n2, n3, n4, n5, n6, n8, n10} OPTIONAL, -- Need S + -- Timer for beam failure detection (see 38.321, section FFS_Section). See also the BeamFailureRecoveryConfig IE. + -- Value in number of "periods of Beam Failure Detection" Reference Signal. Value pbfd1 corresponds to 1 period of Beam Failure + -- Detection Reference Signal, value pbfd2 corresponds to 2 periods of Beam Failure Detection Reference Signal and so on. + -- When the network reconfigures this field, the UE resets on-going RLF timers and counters. + beamFailureDetectionTimer ENUMERATED {pbfd1, pbfd2, pbfd3, pbfd4, pbfd5, pbfd6, pbfd8, pbfd10} OPTIONAL, -- Need R + ... +} + +RadioLinkMonitoringRS ::= SEQUENCE { + -- Determines whether the UE shall monitor the associated reference signal for the purpose of cell- and/or beam failure detection. + purpose ENUMERATED {beamFailure, rlf, both}, + -- A reference signal that the UE shall use for radio link monitoring. The network provides an ssb-Index only if + -- the purpose is set to rlf. + detectionResource CHOICE { + ssb-Index SSB-Index, + csi-RS-Index NZP-CSI-RS-ResourceId + }, + ... +} + +-- TAG-RADIOLINKMONITORINGCONFIG-STOP +-- TAG-RATEMATCHPATTERN-START +RateMatchPattern ::= SEQUENCE { + rateMatchPatternId RateMatchPatternId, + + patternType CHOICE { + bitmaps SEQUENCE { + -- A resource block level bitmap in the frequency domain. It indicates the PRBs to which the symbolsInResourceBlock bitmap applies. + -- Corresponds to L1 parameter 'rate-match-PDSCH-bitmap1' (see 38.214, section FFS_Section) + -- FFS_ASN1: Consider multiple options with different number of bits (for narrower carriers) + resourceBlocks BIT STRING (SIZE (275)), + + -- A symbol level bitmap in time domain. It indicates (FFS: with a bit set to true) the symbols which the UE shall rate match around. + -- This pattern recurs (in time domain) with the configured periodicityAndOffset. + -- Corresponds to L1 parameter 'rate-match-PDSCH-bitmap2' (see 38.214, section FFS_Section) + -- FFS: Why not split it into two BIT STRINGs of 14 bit each? + symbolsInResourceBlock CHOICE { + oneSlot BIT STRING (SIZE (14)), + twoSlots BIT STRING (SIZE (28)) + }, + + -- A time domain repetition pattern. at which the symbolsInResourceBlock + -- pattern recurs. This slot pattern repeats itself continuously. Absence of this field indicates the value n1, i.e., the + -- symbolsInResourceBlock recurs every 14 symbols. + -- Corresponds to L1 parameter 'rate-match-PDSCH-bitmap3' (see 38.214, section FFS_Section) + periodicityAndPattern CHOICE { + n2 BIT STRING (SIZE (2)), + n4 BIT STRING (SIZE (4)), + n5 BIT STRING (SIZE (5)), + n8 BIT STRING (SIZE (8)), + n10 BIT STRING (SIZE (10)), + n20 BIT STRING (SIZE (20)), + n40 BIT STRING (SIZE (40)) + } OPTIONAL, -- Need S + ... + }, + -- This ControlResourceSet us used as a PDSCH rate matching pattern, i.e., PDSCH reception rate matches around it. + controlResourceSet ControlResourceSetId + }, + -- The SubcarrierSpacing for this resource pattern. If the field is absent, the UE applies the SCS of the associcated BWP. + -- The value kHz15 corresponds to µ=0, kHz30 to µ=1, and so on. Only the values 15 or 30 kHz (<6GHz), 60 or 120 kHz (>6GHz) are + -- applicable. Corresponds to L1 parameter 'resource-pattern-scs' (see 38.214, section FFS_Section) + subcarrierSpacing SubcarrierSpacing OPTIONAL, -- Cond CellLevel + -- FFS_Description, FFS_Section + mode ENUMERATED { dynamic, semiStatic }, + ... +} + +-- TAG-RATEMATCHPATTERN-STOP +-- TAG-RATEMATCHPATTERNID-START + +RateMatchPatternId ::= INTEGER (0..maxNrofRateMatchPatterns-1) + +-- TAG-RATEMATCHPATTERNID-STOP +-- TAG-RATEMATCHPATTERNLTE-CRS-START + +RateMatchPatternLTE-CRS ::= SEQUENCE { + -- Center of the LTE carrier. Corresponds to L1 parameter 'center-subcarrier-location' (see 38.214, section 5.1.4) + carrierFreqDL INTEGER (0..16383), + -- BW of the LTE carrier in numbewr of PRBs. Corresponds to L1 parameter 'BW' (see 38.214, section 5.1.4) + carrierBandwidthDL ENUMERATED {n6, n15, n25, n50, n75, n100, spare2, spare1}, + -- LTE MBSFN subframe configuration. Corresponds to L1 parameter 'MBSFN-subframconfig' (see 38.214, section 5.1.4) + -- FFS_ASN1: Import the LTE MBSFN-SubframeConfigList + mbsfn-SubframeConfigList EUTRA-MBSFN-SubframeConfigList OPTIONAL, -- Need M + -- Number of LTE CRS antenna port to rate-match around. + -- Corresponds to L1 parameter 'rate-match-resources-numb-LTE-CRS-antenna-port' (see 38.214, section 5.1.4) + nrofCRS-Ports ENUMERATED {n1, n2, n4}, + -- Shifting value v-shift in LTE to rate match around LTE CRS + -- Corresponds to L1 parameter 'rate-match-resources-LTE-CRS-v-shift' (see 38.214, section 5.1.4) + v-Shift ENUMERATED {n0, n1, n2, n3, n4, n5} +} + +-- TAG-RATEMATCHPATTERNLTE-CRS-STOP +-- TAG-REPORT-CONFIG-ID-START + +ReportConfigId ::= INTEGER (1..maxReportConfigId) + +-- TAG-REPORT-CONFIG-ID-STOP +-- TAG-REPORT-CONFIG-START + +ReportConfigNR ::= SEQUENCE { + reportType CHOICE { + periodical PeriodicalReportConfig, + eventTriggered EventTriggerConfig, +-- reportCGI is to be completed before the end of Rel-15. + reportCGI ENUMERATED {ffsTypeAndValue}, + ... + } +} + +-- FFS / TODO: Consider separating trgger configuration (trigger, periodic, ...) from report configuration. +-- Current structure allows easier definiton of new events and new report types e.g. CGI, etc. +EventTriggerConfig::= SEQUENCE { + eventId CHOICE { + eventA1 SEQUENCE { + a1-Threshold MeasTriggerQuantity, + reportOnLeave BOOLEAN, + hysteresis Hysteresis, + timeToTrigger TimeToTrigger + }, + eventA2 SEQUENCE { + a2-Threshold MeasTriggerQuantity, + reportOnLeave BOOLEAN, + hysteresis Hysteresis, + timeToTrigger TimeToTrigger + }, + eventA3 SEQUENCE { + a3-Offset MeasTriggerQuantityOffset, + reportOnLeave BOOLEAN, + hysteresis Hysteresis, + timeToTrigger TimeToTrigger, + useWhiteCellList BOOLEAN + }, + eventA4 SEQUENCE { + a4-Threshold MeasTriggerQuantity, + reportOnLeave BOOLEAN, + hysteresis Hysteresis, + timeToTrigger TimeToTrigger, + useWhiteCellList BOOLEAN + }, + eventA5 SEQUENCE { + a5-Threshold1 MeasTriggerQuantity, + a5-Threshold2 MeasTriggerQuantity, + reportOnLeave BOOLEAN, + hysteresis Hysteresis, + timeToTrigger TimeToTrigger, + useWhiteCellList BOOLEAN + }, + eventA6 SEQUENCE { + a6-Offset MeasTriggerQuantityOffset, + reportOnLeave BOOLEAN, + hysteresis Hysteresis, + timeToTrigger TimeToTrigger, + useWhiteCellList BOOLEAN + }, + ... + }, + + rsType NR-RS-Type, + + -- Common reporting config (at least to periodical and eventTriggered) + reportInterval ReportInterval, + reportAmount ENUMERATED {r1, r2, r4, r8, r16, r32, r64, infinity}, + + -- Cell reporting configuration + reportQuantityCell MeasReportQuantity, + maxReportCells INTEGER (1..maxCellReport), + + -- RS index reporting configuration + reportQuantityRsIndexes MeasReportQuantity OPTIONAL, -- Need M + maxNrofRSIndexesToReport INTEGER (1..maxNrofIndexesToReport) OPTIONAL, -- Need M + includeBeamMeasurements BOOLEAN, + -- If configured the UE includes the best neighbour cells per serving frequency + reportAddNeighMeas ENUMERATED {setup} OPTIONAL, -- Need R + ... + +} + +PeriodicalReportConfig ::= SEQUENCE { + rsType NR-RS-Type, + + -- Common reporting config (at least to periodical and eventTriggered) + reportInterval ReportInterval, + reportAmount ENUMERATED {r1, r2, r4, r8, r16, r32, r64, infinity}, + + -- Cell reporting configuration + reportQuantityCell MeasReportQuantity, + maxReportCells INTEGER (1..maxCellReport), + + -- RS index reporting configuration + reportQuantityRsIndexes MeasReportQuantity OPTIONAL, -- Need R + maxNrofRsIndexesToReport INTEGER (1..maxNrofIndexesToReport) OPTIONAL, -- Need R + includeBeamMeasurements BOOLEAN, + useWhiteCellList BOOLEAN, + ... + +} + +NR-RS-Type ::= ENUMERATED {ssb, csi-rs} + +MeasTriggerQuantity ::= CHOICE { + rsrp RSRP-Range, + rsrq RSRQ-Range, + sinr SINR-Range +} + +MeasTriggerQuantityOffset ::= CHOICE { + rsrp INTEGER (-30..30), + rsrq INTEGER (-30..30), + sinr INTEGER (-30..30) +} + + +MeasReportQuantity ::= SEQUENCE { + rsrp BOOLEAN, + rsrq BOOLEAN, + sinr BOOLEAN +} + + +-- TAG-REPORT-CONFIG-START +-- TAG-REPORT-CONFIG-TO-ADD-MOD-LIST-START + +ReportConfigToAddModList ::= SEQUENCE (SIZE (1..maxReportConfigId)) OF ReportConfigToAddMod + +ReportConfigToAddMod ::= SEQUENCE { + reportConfigId ReportConfigId, + reportConfig CHOICE { + reportConfigNR ReportConfigNR, + ... + } +} + +-- TAG- REPORT-CONFIG-TO-ADD-MOD-LIST-STOP + +ReportInterval ::= ENUMERATED {ms120, ms240, ms480, ms640, ms1024, ms2048, ms5120, ms10240, ms20480, ms40960, min1, + min6, min12, min30 } + +-- TAG-RLC-CONFIG-START + +RLC-Config ::= CHOICE { + am SEQUENCE { + ul-AM-RLC UL-AM-RLC, + dl-AM-RLC DL-AM-RLC + }, + um-Bi-Directional SEQUENCE { + ul-UM-RLC UL-UM-RLC, + dl-UM-RLC DL-UM-RLC + }, + um-Uni-Directional-UL SEQUENCE { + ul-UM-RLC UL-UM-RLC + }, + um-Uni-Directional-DL SEQUENCE { + dl-UM-RLC DL-UM-RLC + }, + ... +} + +UL-AM-RLC ::= SEQUENCE { + sn-FieldLength SN-FieldLengthAM, + t-PollRetransmit T-PollRetransmit, + pollPDU PollPDU, + pollByte PollByte, + maxRetxThreshold ENUMERATED { t1, t2, t3, t4, t6, t8, t16, t32 } +} + +DL-AM-RLC ::= SEQUENCE { + sn-FieldLength SN-FieldLengthAM, + t-Reassembly T-Reassembly, + t-StatusProhibit T-StatusProhibit +} + +UL-UM-RLC ::= SEQUENCE { + sn-FieldLength SN-FieldLengthUM +} + +DL-UM-RLC ::= SEQUENCE { + sn-FieldLength SN-FieldLengthUM, + t-Reassembly T-Reassembly +} + +T-PollRetransmit ::= ENUMERATED { + ms5, ms10, ms15, ms20, ms25, ms30, ms35, + ms40, ms45, ms50, ms55, ms60, ms65, ms70, + ms75, ms80, ms85, ms90, ms95, ms100, ms105, + ms110, ms115, ms120, ms125, ms130, ms135, + ms140, ms145, ms150, ms155, ms160, ms165, + ms170, ms175, ms180, ms185, ms190, ms195, + ms200, ms205, ms210, ms215, ms220, ms225, + ms230, ms235, ms240, ms245, ms250, ms300, + ms350, ms400, ms450, ms500, ms800, ms1000, + ms2000, ms4000, spare5, spare4, spare3, + spare2, spare1} + + +PollPDU ::= ENUMERATED { + p4, p8, p16, p32, p64, p128, p256, p512, p1024, p2048, p4096, p6144, p8192, p12288, p16384, p20480, + p24576, p28672, p32768, p40960, p49152, p57344, p65536, infinity, spare8, spare7, spare6, spare5, spare4, + spare3, spare2, spare1} + +PollByte ::= ENUMERATED { + kB1, kB2, kB5, kB8, kB10, kB15, kB25, kB50, kB75, + kB100, kB125, kB250, kB375, kB500, kB750, kB1000, + kB1250, kB1500, kB2000, kB3000, kB4000, kB4500, + kB5000, kB5500, kB6000, kB6500, kB7000, kB7500, + mB8, mB9, mB10, mB11, mB12, mB13, mB14, mB15, + mB16, mB17, mB18, mB20, mB25, mB30, mB40, infinity, + spare20, spare19, spare18, spare17, spare16, + spare15, spare14, spare13, spare12, spare11, + spare10, spare9, spare8, spare7, spare6, spare5, + spare4, spare3, spare2, spare1} + +T-Reassembly ::= ENUMERATED { + ms0, ms5, ms10, ms15, ms20, ms25, ms30, ms35, + ms40, ms45, ms50, ms55, ms60, ms65, ms70, + ms75, ms80, ms85, ms90, ms95, ms100, ms110, + ms120, ms130, ms140, ms150, ms160, ms170, + ms180, ms190, ms200, spare1} + +T-StatusProhibit ::= ENUMERATED { + ms0, ms5, ms10, ms15, ms20, ms25, ms30, ms35, + ms40, ms45, ms50, ms55, ms60, ms65, ms70, + ms75, ms80, ms85, ms90, ms95, ms100, ms105, + ms110, ms115, ms120, ms125, ms130, ms135, + ms140, ms145, ms150, ms155, ms160, ms165, + ms170, ms175, ms180, ms185, ms190, ms195, + ms200, ms205, ms210, ms215, ms220, ms225, + ms230, ms235, ms240, ms245, ms250, ms300, + ms350, ms400, ms450, ms500, ms800, ms1000, + ms1200, ms1600, ms2000, ms2400, spare2, spare1} + +SN-FieldLengthUM ::= ENUMERATED {size6, size12} +SN-FieldLengthAM ::= ENUMERATED {size12, size18} + +-- TAG-RLC-CONFIG-STOP +-- TAG-RLF-TIMERS-AND-CONSTANTS-START + +RLF-TimersAndConstants ::= SEQUENCE { + t310 ENUMERATED {ms0, ms50, ms100, ms200, ms500, ms1000, ms2000, ms4000, ms6000}, + n310 ENUMERATED {n1, n2, n3, n4, n6, n8, n10, n20}, + n311 ENUMERATED {n1, n2, n3, n4, n5, n6, n8, n10}, + ... +} + +-- TAG-RLF-TIMERS-AND-CONSTANTS-STOP +-- TAG-RNTI-VALUE-START + +RNTI-Value ::= INTEGER (0..65535) + +-- TAG-RNTI-VALUE-STOP +-- TAG-RSRP-RANGE-START + +RSRP-Range ::= INTEGER(0..124) + +-- TAG-RSRP-RANGE-STOP +-- TAG-RSRQ-RANGE-START + +RSRQ-Range ::= INTEGER(0..127) + +-- TAG-RSRQ-RANGE-STOP +-- TAG-SCELL-INDEX-START + +-- The value range is shared across the Cell Groups +SCellIndex ::= INTEGER (1..31) + +-- TAG-SCELL-INDEX-STOP +-- TAG-SCHEDULING-REQUEST-CONFIG-START + +SchedulingRequestConfig ::= SEQUENCE { + schedulingRequestToAddModList SEQUENCE (SIZE (1..maxNrofSR-ConfigPerCellGroup)) OF SchedulingRequestToAddMod OPTIONAL, -- Need N + schedulingRequestToReleaseList SEQUENCE (SIZE (1..maxNrofSR-ConfigPerCellGroup)) OF SchedulingRequestId OPTIONAL -- Need N +} + +SchedulingRequestToAddMod ::= SEQUENCE { + sr-ConfigIndex SchedulingRequestId, + + sr-ProhibitTimer ENUMERATED {ms1, ms2, ms4, ms8, ms16, ms32, ms64, ms128} OPTIONAL, -- Need S + sr-TransMax ENUMERATED { n4, n8, n16, n32, n64, spare3, spare2, spare1} +} + +SchedulingRequestId ::= INTEGER (0..7) + +-- FFS_TODO: provide resources for each SchedulingRequestID in ServingCellConfig (TBD whether directly, in PUCCH-Config, in each BWP) + +-- TAG-SCHEDULING-REQUEST-CONFIG-STOP +-- TAG-SCHEDULING-REQUEST-RESOURCE-CONFIG-START + +SchedulingRequestResourceConfig ::= SEQUENCE { + schedulingRequestResourceId SchedulingRequestResourceId, + -- The ID of the SchedulingRequestConfig that uses this scheduling request resource. + schedulingRequestID SchedulingRequestId, + -- SR periodicity and offset in number of slots. Corresponds to L1 parameter 'SR-periodicity' and 'SR-offset' (see 38.213, section 9.2.2) + -- The following periodicities may be configured depending on the chosen subcarrier spacing: + -- SCS = 15 kHz: 2sym, 7sym, 1sl, 2sl, 4sl, 5sl, 8sl, 10sl, 16sl, 20sl, 40sl, 80sl + -- SCS = 30 kHz: 2sym, 7sym, 1sl, 2sl, 4sl, 8sl, 10sl, 16sl, 20sl, 40sl, 80sl, 160sl + -- SCS = 60 kHz: 2sym, 7sym/6sym, 1sl, 2sl, 4sl, 8sl, 16sl, 20sl, 40sl, 80sl, 160sl, 320sl + -- SCS = 120 kHz: 2sym, 7sym, 1sl, 2sl, 4sl, 8sl, 16sl, 40sl, 80sl, 160sl, 320sl, sl640 + -- sym6or7 corresponds to 6 symbols if extended cyclic prefix and a SCS of 60 kHz are configured, otherwise it corresponds to 7 symbols. + -- For periodicities sym2, sym7 and sl1 the UE assumes an offset of 0 slots. + periodicityAndOffset CHOICE { + sym2 NULL, + sym6or7 NULL, + sl1 NULL, -- Recurs in every slot + sl2 INTEGER (0..1), + sl4 INTEGER (0..3), + sl5 INTEGER (0..4), + sl8 INTEGER (0..7), + sl10 INTEGER (0..9), + sl16 INTEGER (0..15), + sl20 INTEGER (0..19), + sl40 INTEGER (0..39), + sl80 INTEGER (0..79), + sl160 INTEGER (0..159), + sl320 INTEGER (0..319), + sl640 INTEGER (0..639) + } OPTIONAL, -- Need M + -- ID of the PUCCH resource in which the UE shall send the scheduling request. The + -- actual PUCCH-Resource is configured in PUCCH-Config of the same UL BWP and serving cell as this SchedulingRequestResourceConfig. + -- The network configures a PUCCH-Resource of PUCCH-format0 or PUCCH-format1 + -- (other formats not supported). Corresponds to L1 parameter 'SR-resource' (see 38.213, section 9.2.2) + resource PUCCH-ResourceId OPTIONAL -- Need M +} + +-- TAG-SCHEDULING-REQUEST-RESOURCE-CONFIG-STOP +-- TAG-SCHEDULINGREQUESTRESOURCEID-START + +SchedulingRequestResourceId ::= INTEGER (1..maxNrofSR-Resources) + +-- TAG-SCHEDULINGREQUESTRESOURCEID-STOP +-- TAG-SCRAMBLING-ID-START + +ScramblingId ::= INTEGER (0..1023) + +-- TAG-SCRAMBLING-ID-STOP +-- TAG-SCS-SPECIFIC-CARRIER-START + +SCS-SpecificCarrier ::= SEQUENCE { + -- Offset in frequency domain between Point A (lowest subcarrier of common RB 0) and the lowest usable subcarrier on this carrier + -- in number of PRBs (using the subcarrierSpacing defined for this carrier). The maximum value corresponds to 275*8-1. + -- Corresponds to L1 parameter 'offset-pointA-low-scs' (see 38.211, section FFS_Section) + offsetToCarrier INTEGER (0..2199), + -- Subcarrier spacing of this carrier. It is used to convert the offsetToCarrier into an actual frequency. + -- Only the values 15 or 30 kHz (<6GHz), 60 or 120 kHz (>6GHz) are applicable. + -- Corresponds to L1 parameter 'ref-scs' (see 38.211, section FFS_Section) + subcarrierSpacing SubcarrierSpacing, + -- Corresponds to L1 parameter k0 (see 38.211, section 5.3.1). n-6 corresponds to value -6, n0 corresponds to value 0 and n6 corresponds + -- to value +6. + k0 ENUMERATED {n-6, n0, n6}, + -- Width of this carrier in number of PRBs (using the subcarrierSpacing defined for this carrier) + -- Corresponds to L1 parameter 'BW' (see 38.211, section FFS_Section) + carrierBandwidth INTEGER (1..maxNrofPhysicalResourceBlocks), + ... +} + +-- TAG-SCS-SPECIFIC-CARRIER-STOP +-- TAG-SDAP-CONFIG-START + +SDAP-Config ::= SEQUENCE { + pdu-Session PDU-SessionID, + + -- FFS: separate configuration for UL and DL + sdap-HeaderDL ENUMERATED {present, absent}, + sdap-HeaderUL ENUMERATED {present, absent}, + defaultDRB BOOLEAN, + + -- A list of QoS-Flow-IDs that the UE shall map to the DRB of this SDAP-Config. + mappedQoS-FlowsToAdd SEQUENCE (SIZE (1..maxNrofQFIs)) OF QFI OPTIONAL, -- Need N + -- A list of QoS-Flow-IDs that the UE shall no longer map to the DRB of this SDAP-Config. + mappedQoS-FlowsToRelease SEQUENCE (SIZE (1..maxNrofQFIs)) OF QFI OPTIONAL, -- Need N + ... +} + +QFI ::= INTEGER (0..maxQFI) + +PDU-SessionID ::= INTEGER (0..255) + +-- TAG-SDAP-CONFIG-STOP +-- TAG-SEARCHSPACE-START + +SearchSpace ::= SEQUENCE { + -- Identity of the search space. SearchSpaceId = 0 identifies the SearchSpace configured via PBCH (MIB) or ServingCellConfigCommon. + -- The searchSpaceId is unique among the BWPs of a Serving Cell. + searchSpaceId SearchSpaceId, + + -- The CORESET applicable for this SearchSpace. + -- Value 0 identifies the common CORESET configured in MIB and in ServingCellConfigCommon + -- Values 1..maxNrofControlResourceSets-1 identify CORESETs configured by dedicated signalling + controlResourceSetId ControlResourceSetId OPTIONAL, -- Cond SetupOnly + + -- Slots for PDCCH Monitoring configured as periodicity and offset. Corresponds to L1 parameters 'Montoring-periodicity-PDCCH-slot' and + -- 'Montoring-offset-PDCCH-slot' (see 38.213, section 10) + monitoringSlotPeriodicityAndOffset CHOICE { + sl1 NULL, + sl2 INTEGER (0..1), + sl4 INTEGER (0..3), + sl5 INTEGER (0..4), + sl8 INTEGER (0..7), + sl10 INTEGER (0..9), + sl16 INTEGER (0..15), + sl20 INTEGER (0..19) + } OPTIONAL, -- Cond Setup + + -- Symbols for PDCCH monitoring in the slots configured for PDCCH monitoring (see monitoringSlotPeriodicityAndOffset). + -- The most significant (left) bit represents the first OFDM in a slot. The least significant (right) bit represents the last symbol. + -- Corresponds to L1 parameter 'Montoring-symbols-PDCCH-within-slot' (see 38.213, section 10) + monitoringSymbolsWithinSlot BIT STRING (SIZE (14)) OPTIONAL, -- Cond Setup + + -- Number of PDCCH candidates per aggregation level. Corresponds to L1 parameter 'Aggregation-level-1' to 'Aggregation-level-8'. + -- The number of candidates and aggregation levels configured here applies to all formats unless a particular value is specified or + -- a format-specific value is provided (see inside searchSpaceType). + -- (see 38.213, section 10) + nrofCandidates SEQUENCE { + aggregationLevel1 ENUMERATED {n0, n1, n2, n3, n4, n5, n6, n8}, + aggregationLevel2 ENUMERATED {n0, n1, n2, n3, n4, n5, n6, n8}, + aggregationLevel4 ENUMERATED {n0, n1, n2, n3, n4, n5, n6, n8}, + aggregationLevel8 ENUMERATED {n0, n1, n2, n3, n4, n5, n6, n8}, + aggregationLevel16 ENUMERATED {n0, n1, n2, n3, n4, n5, n6, n8} + } OPTIONAL, -- Cond Setup + + -- Indicates whether this is a common search space (present) or a UE specific search space as well as DCI formats to monitor for. + searchSpaceType CHOICE { + -- Configures this search space as common search space (CSS) and DCI formats to monitor. + common SEQUENCE { + -- If configured, the UE monitors the DCI formats 0_0 and 1_0 with CRC scrambled by C-RNTI, CS-RNTI (if configured), + -- SP-CSI-RNTI (if configured), RA-RNTI, TC-RNTI, P-RNTI, SI-RNTI + dci-Format0-0-AndFormat1-0 SEQUENCE { + ... + } OPTIONAL, -- Need R + -- If configured, UE monitors the DCI format format 2_0 with CRC scrambled by SFI-RNTI + dci-Format2-0 SEQUENCE { + -- The number of PDCCH candidates specifically for format 2-0 for the configured aggregation level. + -- If an aggregation level is absent, the UE does not search for any candidates with that aggregation level. + -- Corresponds to L1 parameters 'SFI-Num-PDCCH-cand' and 'SFI-Aggregation-Level' (see 38.213, section 11.1.1). + nrofCandidates-SFI SEQUENCE { + aggregationLevel1 ENUMERATED {n1, n2} OPTIONAL, -- Need R + aggregationLevel2 ENUMERATED {n1, n2} OPTIONAL, -- Need R + aggregationLevel4 ENUMERATED {n1, n2} OPTIONAL, -- Need R + aggregationLevel8 ENUMERATED {n1, n2} OPTIONAL, -- Need R + aggregationLevel16 ENUMERATED {n1, n2} OPTIONAL -- Need R + }, + ... + } OPTIONAL, -- Need R + -- If configured, UE monitors the DCI format format 2_1 with CRC scrambled by INT-RNTI + dci-Format2-1 SEQUENCE { + ... + } OPTIONAL, -- Need R + -- If configured, UE monitors the DCI format 2_2 with CRC scrambled by TPC-PUSCH-RNTI or TPC-PUCCH-RNTI + dci-Format2-2 SEQUENCE { + ... + } OPTIONAL, -- Need R + -- If configured, UE monitors the DCI format 2_3 with CRC scrambled by TPC-SRS-RNTI + dci-Format2-3 SEQUENCE { + -- Monitoring periodicity of SRS PDCCH in number of slots for DCI format 2-3. + -- Corresponds to L1 parameter 'SRS-monitoring-periodicity' (see 38.212, 38.213, section 7.3.1, 11.3) + monitoringPeriodicity ENUMERATED {n1, n2, n4, n5, n8, n10, n16, n20 } OPTIONAL, -- Cond Setup + + -- The number of PDCCH candidates for DCI format 2-3 for the configured aggregation level. + -- Corresponds to L1 parameter 'SRS-Num-PDCCH-cand' (see 38.212, 38.213, section 7.3.1, 11.3) + nrofPDCCH-Candidates ENUMERATED {n1, n2}, + ... + } OPTIONAL -- Need R + }, + -- Configures this search space as UE specific search space (USS). The UE monitors the DCI format with CRC scrambled + -- by C-RNTI, CS-RNTI (if configured), TC-RNTI (if a certain condition is met), and SP-CSI-RNTI (if configured) + ue-Specific SEQUENCE { + -- Indicates whether the UE monitors in this USS for DCI formats 0-0 and 1-0 or for formats 0-1 and 1-1. + dci-Formats ENUMERATED {formats0-0-And-1-0, formats0-1-And-1-1}, + ... + } + } OPTIONAL -- Cond Setup +} +-- TAG-SEARCHSPACE-STOP +-- TAG-SEARCHSPACEID-START + +SearchSpaceId ::= INTEGER (0..maxNrofSearchSpaces-1) + +-- TAG-SEARCHSPACEID-STOP +-- TAG-SECURITY-ALGORITHM-CONFIG-START + +SecurityAlgorithmConfig ::= SEQUENCE { + cipheringAlgorithm CipheringAlgorithm, + integrityProtAlgorithm IntegrityProtAlgorithm OPTIONAL, -- Need R + ... +} + +IntegrityProtAlgorithm ::= ENUMERATED { + nia0, nia1, nia2, nia3, spare4, spare3, + spare2, spare1, ...} + +CipheringAlgorithm ::= ENUMERATED { + nea0, nea1, nea2, nea3, spare4, spare3, + spare2, spare1, ...} + +-- TAG-SECURITY-ALGORITHM-CONFIG-STOP +-- TAG-SERV-CELL-INDEX-START + +ServCellIndex ::= INTEGER (0..maxNrofServingCells-1) + +-- TAG-SERV-CELL-INDEX-STOP +-- TAG-SERVING-CELL-CONFIG-START + +ServingCellConfig ::= SEQUENCE { + -- L1 parameters: + + tdd-UL-DL-ConfigurationDedicated TDD-UL-DL-ConfigDedicated OPTIONAL, -- Cond TDD + + -- The dedicated (UE-specific) configuration for the initial downlink bandwidth-part. + initialDownlinkBWP BWP-DownlinkDedicated OPTIONAL, -- Cond ServCellAdd + + -- List of additional downlink bandwidth parts to be released. (see 38.211, 38.213, section 12). + downlinkBWP-ToReleaseList SEQUENCE (SIZE (1..maxNrofBWPs)) OF BWP-Id OPTIONAL, -- Need N + -- List of additional downlink bandwidth parts to be added or modified. (see 38.211, 38.213, section 12). + downlinkBWP-ToAddModList SEQUENCE (SIZE (1..maxNrofBWPs)) OF BWP-Downlink OPTIONAL, -- Need N + + -- If configured for an SpCell, this field contains the ID of the DL BWP to be activated upon performing the reconfiguration + -- in which it is received. If the field is absent, the RRC reconfiguration does not impose a BWP switch (corresponds to L1 + -- parameter 'active-BWP-DL-Pcell'). + -- If configured for an SCell, this field contains the ID of the downlink bandwidth part to be used upon MAC-activation of an SCell. + -- If not provided, the UE uses the default BWP. + -- The initial bandwidth part is referred to by BWP-Id = 0. + firstActiveDownlinkBWP-Id BWP-Id OPTIONAL, -- Need R + + -- The duration in ms after which the UE falls back to the default Bandwidth Part. (see 38.321, section 5.15) + -- The value 0.5 ms is only applicable for carriers >6 GHz. + -- When the network releases the timer configuration, the UE stops the timer without swithching to the default BWP. + bwp-InactivityTimer ENUMERATED {ms2, ms3, ms4, ms5, ms6, ms8, ms10, ms20, ms30, ms40,ms50, ms60, ms80, + ms100, ms200, ms300, ms500, ms750, ms1280, ms1920, ms2560, spare10, spare9, + spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 } OPTIONAL, -- Need R + + -- Corresponds to L1 parameter 'default-DL-BWP'. The initial bandwidth part is referred to by BWP-Id = 0. + -- ID of the downlink bandwidth part to be used upon expiry of txxx. + -- This field is UE specific. When the field is absent the UE uses the the initial BWP as default BWP. + -- (see 38.211, 38.213, section 12 and 38.321, section 5.15) + defaultDownlinkBWP-Id BWP-Id OPTIONAL, -- Need M + + uplinkConfig UplinkConfig OPTIONAL, -- Cond ServCellAdd-UL + supplementaryUplink UplinkConfig OPTIONAL, -- Cond ServCellAdd-SUL + + + -- PDSCH releated parameters that are not BWP-specific. + pdsch-ServingCellConfig SetupRelease { PDSCH-ServingCellConfig } OPTIONAL, -- Need M + csi-MeasConfig SetupRelease { CSI-MeasConfig } OPTIONAL, -- Need M + + -- Includes parameters for configuration of carrier based SRS switching + -- Corresponds to L1 parameter 'SRS-CarrierSwitching' (see 38,214, section FFS_Section) + carrierSwitching SetupRelease { SRS-CarrierSwitching } OPTIONAL, -- Need M + -- MAC parameters: + sCellDeactivationTimer ENUMERATED {ms20, ms40, ms80, ms160, ms200, ms240, ms320, ms400, ms480, ms520, ms640, + ms720, ms840, ms1280, spare2,spare1} OPTIONAL, -- Cond ServingCellWithoutPUCCH + + -- Indicates whether this SCell is cross-carrier scheduled by another serving cell. + crossCarrierSchedulingConfig CrossCarrierSchedulingConfig OPTIONAL, -- Need M + + -- Timing Advance Group ID, as specified in TS 38.321 [3], which this cell belongs to. + tag-Id TAG-Id, + -- Enables the "UE beam lock function (UBF)", which disable changes to the UE beamforming configuration when in NR_RRC_CONNECTED. + -- FFS: Parameter added preliminary based on RAN4 LS in R4-1711823. Decide where to place it (maybe ServingCellConfigCommon or + -- in a BeamManagement IE??) + ue-BeamLockFunction ENUMERATED {enabled} OPTIONAL, -- Need R + + -- Indicates whether UE shall apply as pathloss reference either the downlink of PCell or of SCell that corresponds with this uplink + -- (see 38.213, section 7) + pathlossReferenceLinking ENUMERATED {pCell, sCell} OPTIONAL -- Cond SCellOnly +} + +UplinkConfig ::= SEQUENCE { + -- Configuration of UL BWPs (including BWP-specific parameters: + + -- The dedicated (UE-specific) configuration for the initial uplink bandwidth-part. + initialUplinkBWP BWP-UplinkDedicated OPTIONAL, -- Cond ServCellAdd + + -- The additional bandwidth parts for uplink. In case of TDD uplink- and downlink BWP with the same bandwidthPartId are considered + -- as a BWP pair and must have the same center frequency. + uplinkBWP-ToReleaseList SEQUENCE (SIZE (1..maxNrofBWPs)) OF BWP-Id OPTIONAL, -- Need N + uplinkBWP-ToAddModList SEQUENCE (SIZE (1..maxNrofBWPs)) OF BWP-Uplink OPTIONAL, -- Need N + + -- If configured for an SpCell, this field contains the ID of the DL BWP to be activated upon performing the reconfiguration + -- in which it is received. If the field is absent, the RRC reconfiguration does not impose a BWP switch (corresponds to + -- L1 parameter 'active-BWP-UL-Pcell'). + -- If configured for an SCell, this field contains the ID of the uplink bandwidth part to be used upon MAC-activation of an SCell. + -- If not provided, the UE uses the FFS: default BWP. + -- The initial bandwidth part is referred to by BandiwdthPartId = 0. + firstActiveUplinkBWP-Id BWP-Id OPTIONAL, -- Need R + + -- Configuration that is common across the UL BWPs: + + -- PUSCH related parameters that are not BWP-specific. + pusch-ServingCellConfig SetupRelease { PUSCH-ServingCellConfig } OPTIONAL, -- Need M + ... +} + +-- TAG-SERVING-CELL-CONFIG-STOP +-- TAG-SERVING-CELL-CONFIG-COMMON-START + +ServingCellConfigCommon ::= SEQUENCE { + physCellId PhysCellId OPTIONAL, -- Cond HOAndServCellAdd, + frequencyInfoDL FrequencyInfoDL OPTIONAL, -- Cond InterFreqHOAndServCellAdd + -- The initial downlink BWP configuration for a SpCell (PCell of MCG or SCG). + initialDownlinkBWP BWP-DownlinkCommon OPTIONAL, -- Cond ServCellAdd + + uplinkConfigCommon UplinkConfigCommon OPTIONAL, -- Cond ServCellAdd-UL + supplementaryUplinkConfig UplinkConfigCommon OPTIONAL, -- Cond ServCellAdd-SUL + + + -- Indicates the time domain positions of the transmitted SS-blocks in an SS-burst. The first/ leftmost bit corresponds to SS/PBCH + -- block index 0, the second bit corresponds to SS/PBCH block index 1, and so on. Value 0 in the bitmap indicates that the + -- corresponding SS/PBCH block is not transmitted while value 1 indicates that the corresponding SS/PBCH block is transmitted. + -- Corresponds to L1 parameter 'SSB-Transmitted' (see 38.213, section 4.1) + ssb-PositionsInBurst CHOICE { + -- bitmap for sub 3 GHz + shortBitmap BIT STRING (SIZE (4)), + -- bitmap for 3-6 GHz + mediumBitmap BIT STRING (SIZE (8)), + -- bitmap for above 6 GHz + longBitmap BIT STRING (SIZE (64)) + } OPTIONAL, -- Need R, + -- The SSB periodicity in msec for the rate matching purpose. If the field is absent, the UE applies the value ms5. + -- (see 38.211, section [7.4.3.1]) + ssb-periodicityServingCell ENUMERATED { ms5, ms10, ms20, ms40, ms80, ms160, spare2, spare1 } OPTIONAL, -- Need S + -- Position of (first) DL DM-RS (see 38.211, section 7.4.1.1.1) + dmrs-TypeA-Position ENUMERATED {pos2, pos3}, + + -- Parameters to determine an LTE CRS pattern that the UE shall rate match around. + lte-CRS-ToMatchAround SetupRelease { RateMatchPatternLTE-CRS } OPTIONAL, -- Need M + + -- Resources patterns which the UE should rate match PDSCH around. The UE rate matches around the union of all resources + -- indicated in the nested bitmaps. Rate match patterns defined here on cell level apply only to PDSCH of the same numerology. + -- Corresponds to L1 parameter 'Resource-set-cekk' (see 38.214, section 5.1.2.2.3) + rateMatchPatternToAddModList SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPattern OPTIONAL, -- Need N + rateMatchPatternToReleaseList SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPatternId OPTIONAL, -- Need N + + -- Subcarrier spacing of SSB. Used only for non-initial access (e.g. SCells, PCell of SCG). + -- If the field is absent the UE shall assume the default value of the band. + -- Only the values 15 or 30 kHz (<6GHz), 120 or 240 kHz (>6GHz) are applicable. + subcarrierSpacing SubcarrierSpacing OPTIONAL, -- Need S + -- A cell-specific TDD UL/DL configuration. Corresponds to L1 parameter 'UL-DL-configuration-common' (see 38.213, section 11.1) + tdd-UL-DL-ConfigurationCommon TDD-UL-DL-ConfigCommon OPTIONAL, -- Cond TDD + -- A second cell-specific TDD UL/DL configuration. When tdd-UL-DL-ConfigurationCommon2 is configured, the cell specific DL/UL + -- pattern is a concatenation of the pattern specified in tdd-UL-DL-ConfigurationCommon and the pattern specified in + -- tdd-UL-DL-ConfigurationCommon2. Corresponds to L1 parameter 'UL-DL-configuration-common-Set2' (see 38.211, section 11.1) + tdd-UL-DL-ConfigurationCommon2 TDD-UL-DL-ConfigCommon OPTIONAL, -- Cond TDD + -- TX power that the NW used for SSB transmission. The UE uses it to estimate the RA preamble TX power. + -- (see 38.213, section 7.4) + ss-PBCH-BlockPower INTEGER (-60..50), + ... +} + +UplinkConfigCommon ::= SEQUENCE { + -- Absolute uplink frequency configuration and subcarrier specific virtual carriers. + frequencyInfoUL FrequencyInfoUL OPTIONAL, -- Cond InterFreqHOAndServCellAdd + -- The initial uplink BWP configuration for a SpCell (PCell of MCG or SCG). Corresponds to L1 parameter 'initial-UL-BWP'. + -- (see 38.331, section FFS_Section). + initialUplinkBWP BWP-UplinkCommon OPTIONAL -- Cond ServCellAdd +} + +-- TAG-SERVING-CELL-CONFIG-COMMON-STOP +-- TAG-SINR-RANGE-START + +SINR-Range ::= INTEGER(0..127) + +-- TAG-SINR-RANGE-STOP +-- TAG-SLOTFORMATCOMBINATIONSPERCELL-START + +-- The SlotFormatCombinations applicable for one serving cell. Corresponds to L1 parameter 'cell-to-SFI' (see 38.213, section 11.1.1) +SlotFormatCombinationsPerCell ::= SEQUENCE { + -- The ID of the serving cell for which the slotFormatCombinations are applicable + servingCellId ServCellIndex, + + -- Reference subcarrier spacing for this Slot Format Combination. Corresponds to L1 parameter 'SFI-scs' (see 38.213, section FFS_Section) + subcarrierSpacing SubcarrierSpacing, + -- Reference subcarrier spacing for a Slot Format Combination on an FDD or SUL cell. + -- Corresponds to L1 parameter 'SFI-scs2' (see 38.213, section FFS_Section). + -- For FDD, subcarrierSpacing (SFI-scs) is the reference SCS for DL BWP and subcarrierSpacing2 (SFI-scs2) is the reference SCS for UL BWP. + -- For SUL, subcarrierSpacing (SFI-scs) is the reference SCS for non-SUL carrier and subcarrierSpacing2 (SFI-scs2) is the reference + -- SCS for SUL carrier. + subcarrierSpacing2 SubcarrierSpacing OPTIONAL, -- Need R + + -- A list with SlotFormatCombinations. Each SlotFormatCombination comprises of one or more SlotFormats (see 38.211, section 4.3.2) + -- FFS_CHECK: RAN1 indicates that the combinations could be of two different types... but they don't specify the second + slotFormatCombinations SEQUENCE (SIZE (1..maxNrofSlotFormatCombinationsPerSet)) OF SlotFormatCombination OPTIONAL, + + -- The (starting) position (bit) of the slotFormatCombinationId (SFI-Index) for this serving cell (servingCellId) within the DCI payload. + -- Corresponds to L1 parameter 'SFI-values' (see 38.213, section FFS_Section) + positionInDCI INTEGER(0..maxSFI-DCI-PayloadSize-1) OPTIONAL, + ... +} + +SlotFormatCombination ::= SEQUENCE { + -- This ID is used in the DCI payload to dynamically select this SlotFormatCombination. + -- Corresponds to L1 parameter 'SFI-index' (see 38.213, section FFS_Section) + slotFormatCombinationId SlotFormatCombinationId, + -- Slot formats that occur in consecutive slots in time domain order as listed here. The the slot formats are + -- defined in 38.211, table 4.3.2-3 and numbered with 0..255. + slotFormats SEQUENCE (SIZE (1..maxNrofSlotFormatsPerCombination)) OF INTEGER (0..255) +} + +-- SFI index that is assoicated with a certian slot-format-combination +-- Corresponds to L1 parameter 'SFI-index' (see 38.213, section FFS_Section) +SlotFormatCombinationId ::= INTEGER (0..maxNrofSlotFormatCombinationsPerSet-1) + +-- TAG-SLOTFORMATCOMBINATIONSPERCELL-STOP +-- TAG-SLOTFORMATINDICATOR-START + +SlotFormatIndicator ::= SEQUENCE { + -- RNTI used for SFI on the given cell + -- Corresponds to L1 parameter 'SFI-RNTI' (see 38.213, section 11.1.1) + sfi-RNTI RNTI-Value, + + -- Total length of the DCI payload scrambled with SFI-RNTI. + -- Corresponds to L1 parameter 'SFI-DCI-payload-length' (see 38.213, section 11.1.1) + dci-PayloadSize INTEGER (1..maxSFI-DCI-PayloadSize), + + -- A list of SlotFormatCombinations for the UE's serving cells. + -- Corresponds to L1 parameter 'SFI-cell-to-SFI' (see 38.213, section 11.1.1) + slotFormatCombToAddModList SEQUENCE (SIZE(1..maxNrofAggregatedCellsPerCellGroup)) OF SlotFormatCombinationsPerCell OPTIONAL, -- Need N + slotFormatCombToReleaseList SEQUENCE (SIZE(1..maxNrofAggregatedCellsPerCellGroup)) OF ServCellIndex OPTIONAL, -- Need N + ... +} + +-- TAG-SLOTFORMATINDICATOR-STOP +-- TAG-SPS-CONFIG-START + +-- Downlink SPS may be configured on the PCell as well as on SCells. But it shall not be configured for more than +-- one serving cell of a cell group at once. +SPS-Config ::= SEQUENCE { + -- Periodicity for DL SPS + -- Corresponds to L1 parameter 'semiPersistSchedIntervalDL' (see 38.214 and 38.321, section FFS_Section) + -- FFS-Value: Support also shorter periodicities for DL? + periodicity ENUMERATED {ms10, ms20, ms32, ms40, ms64, ms80, ms128, ms160, ms320, ms640, + spare6, spare5, spare4, spare3, spare2, spare1}, + -- Number of configured HARQ processes for SPS DL. Corresponds to L1 parameter 'numberOfConfSPS-Processes' (see 38.214, section FFS_Section) + nrofHARQ-Processes INTEGER (1..8), + -- HARQ resource for PUCCH for DL SPS. The network configures the resource either as format0 or format1. (see 38.214, section FFS_Section) + n1PUCCH-AN PUCCH-Resource OPTIONAL -- Need M +} + +-- TAG-SPS-CONFIG-STOP +-- TAG-SRB-IDENTITY-START + +SRB-Identity ::= INTEGER (1..3) + +-- TAG-SRB-IDENTITY-STOP +-- TAG-SRS-CONFIG-START + +SRS-Config ::= SEQUENCE { + srs-ResourceSetToReleaseList SEQUENCE (SIZE(0..maxNrofSRS-ResourceSets)) OF SRS-ResourceSetId OPTIONAL, -- Need N + srs-ResourceSetToAddModList SEQUENCE (SIZE(0..maxNrofSRS-ResourceSets)) OF SRS-ResourceSet OPTIONAL, -- Need N + + srs-ResourceToReleaseList SEQUENCE (SIZE(1..maxNrofSRS-Resources)) OF SRS-ResourceId OPTIONAL, -- Need N + srs-ResourceToAddModList SEQUENCE (SIZE(1..maxNrofSRS-Resources)) OF SRS-Resource OPTIONAL, -- Need N + + + -- If absent, UE applies TPC commands via accumulation. If disabled, UE applies the TPC command without accumulation + -- (this applies to SRS when a separate closed loop is configured for SRS) + -- Corresponds to L1 parameter 'Accumulation-enabled-srs' (see 38,213, section 7.3) + tpc-Accumulation ENUMERATED {disabled} OPTIONAL, -- Need S + ... +} + +SRS-ResourceSet ::= SEQUENCE { + -- The ID of this resource set. It is unique in the context of the BWP in which the parent SRS-Config is defined. + srs-ResourceSetId SRS-ResourceSetId, + -- The IDs of the SRS-Reosurces used in this SRS-ResourceSet + srs-ResourceIdList SEQUENCE (SIZE(1..maxNrofSRS-ResourcesPerSet)) OF SRS-ResourceId OPTIONAL, -- Cond Setup + + resourceType CHOICE { + aperiodic SEQUENCE { + -- The DCI "code point" upon which the UE shall transmit SRS according to this SRS resource set configuration. + -- Corresponds to L1 parameter 'AperiodicSRS-ResourceTrigger' (see 38.214, section 6.1.1.2) + aperiodicSRS-ResourceTrigger INTEGER (0..maxNrofSRS-TriggerStates-1), + -- ID of CSI-RS resource associated with this SRS resource set. (see 38.214, section 6.1.1.2) + csi-RS NZP-CSI-RS-ResourceId, + -- An offset in number of slots between the triggering DCI and the actual transmission of this SRS-ResourceSet. + -- If the field is absent the UE applies no offset (value 0) + slotOffset INTEGER (1..8) OPTIONAL, -- Need S + ... + }, + semi-persistent SEQUENCE { + -- ID of CSI-RS resource associated with this SRS resource set in non-codebook based operation. + -- Corresponds to L1 parameter 'SRS-AssocCSIRS' (see 38.214, section 6.2.1) + associatedCSI-RS NZP-CSI-RS-ResourceId OPTIONAL, -- Cond nonCodebook + ... + }, + periodic SEQUENCE { + -- ID of CSI-RS resource associated with this SRS resource set in non-codebook based operation. + -- Corresponds to L1 parameter 'SRS-AssocCSIRS' (see 38.214, section 6.2.1) + associatedCSI-RS NZP-CSI-RS-ResourceId OPTIONAL, -- Cond nonCodebook + ... + } + }, + -- Indicates if the SRS resource set is used for beam management vs. used for either codebook based or non-codebook based transmission. + -- Corresponds to L1 parameter 'SRS-SetUse' (see 38.214, section 6.2.1) + -- FFS_CHECK: Isn't codebook/noncodebook already known from the ulTxConfig in the SRS-Config? If so, isn't the only distinction + -- in the set between BeamManagement, AtennaSwitching and "Other”? Or what happens if SRS-Config=Codebook but a Set=NonCodebook? + usage ENUMERATED {beamManagement, codebook, nonCodebook, antennaSwitching}, + + -- alpha value for SRS power control. Corresponds to L1 parameter 'alpha-srs' (see 38.213, section 7.3) + -- When the field is absent the UE applies the value 1 + alpha Alpha OPTIONAL, -- Need S + -- P0 value for SRS power control. The value is in dBm. Only even values (step size 2) are allowed. + -- Corresponds to L1 parameter 'p0-srs' (see 38.213, section 7.3) + p0 INTEGER (-202..24) OPTIONAL, -- Cond Setup + -- A reference signal (e.g. a CSI-RS config or a SSblock) to be used for SRS path loss estimation. + -- Corresponds to L1 parameter 'srs-pathlossReference-rs-config' (see 38.213, section 7.3) + pathlossReferenceRS CHOICE { + ssb-Index SSB-Index, + csi-RS-Index NZP-CSI-RS-ResourceId + } OPTIONAL, -- Need M + -- Indicates whether hsrs,c(i) = fc(i,1) or hsrs,c(i) = fc(i,2) (if twoPUSCH-PC-AdjustmentStates are configured) + -- or serarate close loop is configured for SRS. This parameter is applicable only for Uls on which UE also transmits PUSCH. + -- If absent or release, the UE applies the value sameAs-Fci1 + -- Corresponds to L1 parameter 'srs-pcadjustment-state-config' (see 38.213, section 7.3) + srs-PowerControlAdjustmentStates ENUMERATED { sameAsFci2, separateClosedLoop} OPTIONAL, -- Need S + ... +} + +SRS-ResourceSetId ::= INTEGER (0..maxNrofSRS-ResourceSets-1) + +SRS-Resource ::= SEQUENCE { + srs-ResourceId SRS-ResourceId, + nrofSRS-Ports ENUMERATED {port1, ports2, ports4}, + -- The PTRS port index for this SRS resource for non-codebook based UL MIMO. This is only applicable when the corresponding + -- PTRS-UplinkConfig is set to CP-OFDM. The ptrs-PortIndex configured here must be smaller than or equal to the maxNnrofPorts + -- configured in the PTRS-UplinkConfig. + -- Corresponds to L1 parameter 'UL-PTRS-SRS-mapping-non-CB' (see 38.214, section 6.1) + ptrs-PortIndex ENUMERATED {n0, n1 } OPTIONAL, -- Need R + -- Comb value (2 or 4) and comb offset (0..combValue-1). Corresponds to L1 parameter 'SRS-TransmissionComb' (see 38.214, section 6.2.1) + transmissionComb CHOICE { + n2 SEQUENCE { + combOffset-n2 INTEGER (0..1), + -- Cyclic shift configuration. Corresponds to L1 parameter 'SRS-CyclicShiftConfig' (see 38.214, section 6.2.1) + cyclicShift-n2 INTEGER (0..7) + }, + n4 SEQUENCE { + combOffset-n4 INTEGER (0..3), + -- Cyclic shift configuration. Corresponds to L1 parameter 'SRS-CyclicShiftConfig' (see 38.214, section 6.2.1) + cyclicShift-n4 INTEGER (0..11) + } + }, + -- OFDM symbol location of the SRS resource within a slot including number of OFDM symbols (N = 1, 2 or 4 per SRS resource), + -- startPosition (SRSSymbolStartPosition = 0..5; "0" refers to the last symbol, "1" refers to the second last symbol) and + -- RepetitionFactor (r = 1, 2 or 4). + -- Corresponds to L1 parameter 'SRS-ResourceMapping' (see 38.214, section 6.2.1 and 38.211, section 6.4.1.4). + -- FFS: Apparently, RAN1 considers replacing these three fields by a table in RAN1 specs and a corresponding index in ASN.1?! + resourceMapping SEQUENCE { + startPosition INTEGER (0..5), + nrofSymbols ENUMERATED {n1, n2, n4}, + repetitionFactor ENUMERATED {n1, n2, n4} + }, + -- Parameter(s) defining frequency domain position and configurable shift to align SRS allocation to 4 PRB grid. + -- Corresponds to L1 parameter 'SRS-FreqDomainPosition' (see 38.214, section 6.2.1) + freqDomainPosition INTEGER (0..67), + freqDomainShift INTEGER (0..268), + -- Includes parameters capturing SRS frequency hopping + -- Corresponds to L1 parameter 'SRS-FreqHopping' (see 38.214, section 6.2.1) + freqHopping SEQUENCE { + c-SRS INTEGER (0..63), + b-SRS INTEGER (0..3), + b-hop INTEGER (0..3) + }, + -- Parameter(s) for configuring group or sequence hopping + -- Corresponds to L1 parameter 'SRS-GroupSequenceHopping' (see 38.211, section FFS_Section) + groupOrSequenceHopping ENUMERATED { neither, groupHopping, sequenceHopping }, + -- Time domain behavior of SRS resource configuration. + -- Corresponds to L1 parameter 'SRS-ResourceConfigType' (see 38.214, section 6.2.1). + -- For codebook based uplink transmission, the network configures SRS resources in the same resource set with the same + -- time domain behavior on periodic, aperiodic and semi-persistent SRS. + -- FFS: Add configuration parameters for the different SRS resource types? + resourceType CHOICE { + aperiodic SEQUENCE { + ... + }, + semi-persistent SEQUENCE { + -- Periodicity and slot offset for for this SRS resource. All values in "number of slots". + -- sl1 corresponds to a periodicity of 1 slot, value sl2 corresponds to a periodicity of 2 slots, and so on. + -- For each periodicity the corresponding offset is given in number of slots. For periodicity sl1 the offset is 0 slots. + -- Corresponds to L1 parameter 'SRS-SlotConfig' (see 38.214, section 6.2.1) + periodicityAndOffset-sp SRS-PeriodicityAndOffset, + ... + }, + periodic SEQUENCE { + -- Periodicity and slot offset for for this SRS resource. All values in "number of slots" + -- sl1 corresponds to a periodicity of 1 slot, value sl2 corresponds to a periodicity of 2 slots, and so on. + -- For each periodicity the corresponding offset is given in number of slots. For periodicity sl1 the offset is 0 slots. + -- Corresponds to L1 parameter 'SRS-SlotConfig' (see 38.214, section 6.2.1) + periodicityAndOffset-p SRS-PeriodicityAndOffset, + ... + } + }, + -- Sequence ID used to initialize psedo random group and sequence hopping. + -- Corresponds to L1 parameter 'SRS-SequenceId' (see 38.214, section 6.2.1) + sequenceId BIT STRING (SIZE (10)), + + -- Configuration of the spatial relation between a reference RS and the target SRS. Reference RS can be SSB/CSI-RS/SRS + -- Corresponds to L1 parameter 'SRS-SpatialRelationInfo' (see 38.214, section 6.2.1) + spatialRelationInfo CHOICE { + ssb-Index SSB-Index, + csi-RS-Index NZP-CSI-RS-ResourceId, + srs SRS-ResourceId + } OPTIONAL, -- Need R + ... +} + +SRS-ResourceId ::= INTEGER (0..maxNrofSRS-Resources-1) + +SRS-PeriodicityAndOffset ::= CHOICE { + sl1 NULL, + sl2 INTEGER(0..1), + sl4 INTEGER(0..3), + sl5 INTEGER(0..4), + sl8 INTEGER(0..7), + sl10 INTEGER(0..9), + sl16 INTEGER(0..15), + sl20 INTEGER(0..19), + sl32 INTEGER(0..31), + sl40 INTEGER(0..39), + sl64 INTEGER(0..63), + sl80 INTEGER(0..79), + sl160 INTEGER(0..159), + sl320 INTEGER(0..319), + sl640 INTEGER(0..639), + sl1280 INTEGER(0..1279), + sl2560 INTEGER(0..2559) +} + +-- TAG-SRS-CONFIG-STOP +-- TAG-SRS-CARRIERSWITCHING-START +SRS-CarrierSwitching ::= SEQUENCE { + + -- Indicates the serving cell whose UL transmission may be interrupted during SRS transmission on a PUSCH-less cell. + -- During SRS transmission on a PUSCH-less cell, the UE may temporarily suspend the UL transmission on a serving cell with PUSCH + -- in the same CG to allow the PUSCH-less cell to transmit SRS. (see 38.214, section 6.2.1.3) + srs-SwitchFromServCellIndex INTEGER (0..31) OPTIONAL, -- Cond Setup + + -- Network configures the UE with either typeA-SRS-TPC-PDCCH-Group or typeB-SRS-TPC-PDCCH-Group, if any. + srs-TPC-PDCCH-Group CHOICE { + -- Type A trigger configuration for SRS transmission on a PUSCH-less SCell. + -- Corresponds to L1 parameter 'typeA-SRS-TPC-PDCCH-Group' (see 38.212, 38.213, section 7.3.1, 11.3) + typeA SEQUENCE (SIZE (1..32)) OF SRS-TPC-PDCCH-Config, + -- Type B trigger configuration for SRS transmission on a PUSCH-less SCell. + -- Corresponds to L1 parameter 'typeB-SRS-TPC-PDCCH-Config' (see 38.212, 38.213, section 7.3.1, 11.3) + typeB SRS-TPC-PDCCH-Config + } OPTIONAL, -- Cond Setup + + -- Maps a specific cell to a given SFI value within the DCI message + -- Corresponds to L1 parameter 'SRS-cell-to-SFI' (see 38.212, 38.213, section 7.3.1, 11.3) + srs-CellToSFI SEQUENCE (SIZE (1..maxNrofServingCells)) OF SlotFormatCombinationsPerCell OPTIONAL, -- Cond Setup + + -- A set of serving cells for monitoring PDCCH conveying SRS DCI format with CRC scrambled by TPC-SRS-RNTI + -- Corresponds to L1 parameter 'SRS-monitoring-cells' (see 38.212, 38.213, section 7.3.1, 11.3) + monitoringCells SEQUENCE (SIZE (1..maxNrofServingCells)) OF ServCellIndex OPTIONAL, -- Cond Setup + ... +} + +-- One trigger configuration for SRS-Carrier Switching. (see 38.212, 38.213, section 7.3.1, 11.3) +SRS-TPC-PDCCH-Config ::= SEQUENCE { + -- The starting bit position of a block within the group DCI with SRS request fields (optional) and TPC commands + -- for a PUSCH-less SCell. (see 38.212, 38.213, section 7.3.1, 11.3) + startingBitOfFormat2-3 INTEGER (1..31) OPTIONAL, -- Cond Setup + -- The type of a field within the group DCI with SRS request fields (optional) for a PUSCH-less SCell, + -- which indicates how many bits in the field are for SRS request (0 or 1/2). + -- Note that for Type A, there is a common SRS request field for all SCells in the set, but each SCell has its + -- own TPC command bits. See TS 38.212. Network configures this field with the same value for all PUSCH-less SCells. + -- (see 38.212, 38.213, section 7.3.1, 11.3) + fieldTypeFormat2-3 INTEGER (0..1) OPTIONAL, -- Cond Setup + -- A list of paris of [cc-SetIndex; cc-IndexInOneCC-Set] (see 38.212, 38.213, section 7.3.1, 11.3) + -- FFS: Improve description. What is a "CC"? Where is a CC-Set defined? ... + srs-CC-SetIndexlist SEQUENCE (SIZE(1..4)) OF SRS-CC-SetIndex OPTIONAL -- Cond Setup +} + +SRS-CC-SetIndex ::= SEQUENCE { + -- Indicates the CC set index for Type A associated (see 38.212, 38.213, section 7.3.1, 11.3) + cc-SetIndex INTEGER (0..3) OPTIONAL, -- Cond Setup + -- Indicates the CC index in one CC set for Type A (see 38.212, 38.213, section 7.3.1, 11.3) + cc-IndexInOneCC-Set INTEGER (0..7) OPTIONAL -- Cond Setup +} + +-- TAG-SRS-CARRIERSWITCHING-STOP +-- TAG-SSB-INDEX-START + +SSB-Index ::= INTEGER (0..63) + +-- TAG-SSB-INDEX-STOP +-- TAG-SUBCARRIER-SPACING-START + +-- The subcarrier spacing supported in NR. Restrictions applicable for certain frequencies, channels or signals are clarified +-- in the fields that use this IE. +SubcarrierSpacing ::= ENUMERATED {kHz15, kHz30, kHz60, kHz120, kHz240, spare3, spare2, spare1} + + +-- TAG-SUBCARRIER-SPACING-STOP +-- TAG-TCI-STATE-START + +TCI-State ::= SEQUENCE { + tci-StateId TCI-StateId, + qcl-Type1 QCL-Info, + qcl-Type2 QCL-Info OPTIONAL, -- Need R + nrofPTRS-Ports ENUMERATED {n1, n2} OPTIONAL, -- Need R + ... +} + +QCL-Info ::= SEQUENCE { + + -- The carrier which the RS is located in. If the field is absent, it applies to the serving cell in which the TCI-State is configured + cell ServCellIndex OPTIONAL, -- Need R + + -- The DL BWP which the RS is located in. + bwp-Id BWP-Id OPTIONAL, -- Cond CSI-RS-Indicated + -- Cond NZP-CSI-RS-Indicated: mandatory if csi-rs or csi-RS-for-tracking is included, absent otherwise + referenceSignal CHOICE { + csi-rs NZP-CSI-RS-ResourceId, + ssb SSB-Index, + -- A set of CSI-RS resources for tracking + csi-RS-for-tracking NZP-CSI-RS-ResourceSetId + }, + qcl-Type ENUMERATED {typeA, typeB, typeC, typeD}, + ... +} + +-- TAG-TCI-STATE-STOP +-- TAG-TCI-STATEID-START + +TCI-StateId ::= INTEGER (0..maxNrofTCI-States-1) + +-- TAG-TCI-STATEID-STOP +-- TAG-TDD-UL-DL-CONFIG-START + +TDD-UL-DL-ConfigCommon ::= SEQUENCE { + -- Reference SCS used to determine the time domain boundaries in the UL-DL pattern which must be common across all subcarrier specific + -- virtual carriers, i.e., independent of the actual subcarrier spacing using for data transmission. + -- Only the values 15 or 30 kHz (<6GHz), 60 or 120 kHz (>6GHz) are applicable. + -- Corresponds to L1 parameter 'reference-SCS' (see 38.211, section FFS_Section) + referenceSubcarrierSpacing SubcarrierSpacing OPTIONAL, + -- Periodicity of the DL-UL pattern. Corresponds to L1 parameter 'DL-UL-transmission-periodicity' (see 38.211, section FFS_Section) + dl-UL-TransmissionPeriodicity ENUMERATED {ms0p5, ms0p625, ms1, ms1p25, ms2, ms2p5, ms5, ms10} OPTIONAL, + + -- Number of consecutive full DL slots at the beginning of each DL-UL pattern. + -- Corresponds to L1 parameter 'number-of-DL-slots' (see 38.211, Table 4.3.2-1) + nrofDownlinkSlots INTEGER (0..maxNrofSlots) OPTIONAL, + + -- Number of consecutive DL symbols in the beginning of the slot following the last full DL slot (as derived from nrofDownlinkSlots). + -- If the field is absent or released, there is no partial-downlink slot. + -- Corresponds to L1 parameter 'number-of-DL-symbols-common' (see 38.211, section FFS_Section). + nrofDownlinkSymbols INTEGER (0..maxNrofSymbols-1) OPTIONAL, -- Need R + + -- Number of consecutive full UL slots at the end of each DL-UL pattern. + -- Corresponds to L1 parameter 'number-of-UL-slots' (see 38.211, Table 4.3.2-1) + nrofUplinkSlots INTEGER (0..maxNrofSlots) OPTIONAL, + + -- Number of consecutive UL symbols in the end of the slot preceding the first full UL slot (as derived from nrofUplinkSlots). + -- If the field is absent or released, there is no partial-uplink slot. + -- Corresponds to L1 parameter 'number-of-UL-symbols-common' (see 38.211, section FFS_Section) + nrofUplinkSymbols INTEGER (0..maxNrofSymbols-1) OPTIONAL -- Need R +} + +TDD-UL-DL-ConfigDedicated ::= SEQUENCE { + -- The slotSpecificConfiguration allows overriding UL/DL allocations provided in tdd-UL-DL-configurationCommon. + -- FFS_ASN1: Consider making this an AddMod/Release list + -- FFS_ASN1: Replace absolute numbers by variables... once RAN1 confirms. + -- FFS_CHECK: This list will grow very large if used for many slots. + slotSpecificConfigurationsToAddModList SEQUENCE (SIZE (1..maxNrofSlots)) OF TDD-UL-DL-SlotConfig OPTIONAL, -- Need N + slotSpecificConfigurationsToreleaseList SEQUENCE (SIZE (1..maxNrofSlots)) OF TDD-UL-DL-SlotIndex OPTIONAL -- Need N +} + +TDD-UL-DL-SlotConfig ::= SEQUENCE { + -- Identifies a slot within a dl-UL-TransmissionPeriodicity (given in tdd-UL-DL-configurationCommon) + slotIndex TDD-UL-DL-SlotIndex, + + -- The direction (downlink or uplink) for the symbols in this slot. "allDownlink" indicates that all symbols in this slot are used + -- for downlink; "allUplink" indicates that all symbols in this slot are used for uplink; "explicit" indicates explicitly how many symbols + -- in the beginning and end of this slot are allocated to downlink and uplink, respectively. + symbols CHOICE { + allDownlink NULL, + allUplink NULL, + explicit SEQUENCE { + -- Number of consecutive DL symbols in the beginning of the slot identified by slotIndex. + -- If the field is absent the UE assumes that there are no leading DL symbols. + -- Corresponds to L1 parameter 'number-of-DL-symbols-dedicated' (see 38.211, section FFS_Section) + nrofDownlinkSymbols INTEGER (1..maxNrofSymbols-1) OPTIONAL, -- Need S + + -- Number of consecutive UL symbols in the end of the slot identified by slotIndex. + -- If the field is absent the UE assumes that there are no trailing UL symbols. + -- Corresponds to L1 parameter 'number-of-UL-symbols-dedicated' (see 38.211, section FFS_Section) + nrofUplinkSymbols INTEGER (1..maxNrofSymbols-1) OPTIONAL -- Need S + } + } +} + +TDD-UL-DL-SlotIndex ::= INTEGER (0..maxNrofSlots-1) + +-- TAG-TDD-UL-DL-CONFIG-STOP + +TimeToTrigger ::= ENUMERATED { + ms0, ms40, ms64, ms80, ms100, ms128, ms160, ms256, + ms320, ms480, ms512, ms640, ms1024, ms1280, ms2560, + ms5120} + +-- TAG-ZP-CSI-RS-RESOURCE-START + +ZP-CSI-RS-Resource ::= SEQUENCE { + -- ZP CSI-RS resource configuration ID + -- Corresponds to L1 parameter 'ZP-CSI-RS-ResourceConfigId' (see 38.214, section 5.1.4.2) + zp-CSI-RS-ResourceId ZP-CSI-RS-ResourceId, + -- OFDM symbol and subcarrier occupancy of the ZP-CSI-RS resource within a slot + resourceMapping CSI-RS-ResourceMapping, + -- Periodicity and slot offset for periodic/semi-persistent ZP-CSI-RS + -- Corresponds to L1 parameter 'ZP-CSI-RS-timeConfig' (see 38.214, section 5.1.4.2) + periodicityAndOffset CSI-ResourcePeriodicityAndOffset OPTIONAL, --Cond PeriodicOrSemiPersistent + + ... +} + +ZP-CSI-RS-ResourceId ::= INTEGER (0..maxNrofZP-CSI-RS-Resources-1) + +-- TAG-ZP-CSI-RS-RESOURCE-STOP +-- TAG-ZP-CSI-RS-RESOURCESET-START + +ZP-CSI-RS-ResourceSet ::= SEQUENCE { + zp-CSI-RS-ResourceSetId ZP-CSI-RS-ResourceSetId, + -- The list of ZP-CSI-RS-ResourceId identifying the ZP-CSI-RS-Resource elements belonging to this set. + zp-CSI-RS-ResourceIdList SEQUENCE (SIZE(1..maxNrofZP-CSI-RS-ResourcesPerSet)) OF ZP-CSI-RS-ResourceId, + -- Time domain behavior of ZP-CSI-RS resource configuration. + -- Corresponds to L1 parameter 'ZP-CSI-RS-ResourceConfigType' (see 38.214, section 5.1.4.2) + resourceType ENUMERATED {aperiodic, semiPersistent, periodic}, + ... +} + +-- TAG-ZP-CSI-RS-RESOURCESET-STOP +-- TAG-ZP-CSI-RS-RESOURCESETID-START + +ZP-CSI-RS-ResourceSetId ::= INTEGER (0..maxNrofZP-CSI-RS-ResourceSets-1) + +-- TAG-ZP-CSI-RS-RESOURCESETID-STOP +-- TAG-BANDCOMBINATIONLIST-START + +BandCombinationList ::= SEQUENCE (SIZE (1..maxBandComb)) OF BandCombination + +BandCombination ::= SEQUENCE { + bandAndDL-ParametersList BandAndDL-ParametersList, + bandCombinationsUL BIT STRING (SIZE (1.. maxBandComb)), + bandCombinationParametersList SEQUENCE (SIZE (1..maxBandComb)) OF BandCombinationParameters OPTIONAL +} + +BandAndDL-ParametersList ::= SEQUENCE (SIZE (1..maxSimultaneousBands)) OF BandAndDL-Parameters + +BandAndDL-Parameters ::= CHOICE { + bandAndDL-ParametersEUTRA BandAndDL-ParametersEUTRA, + bandAndDL-ParametersNR BandAndDL-ParametersNR +} +BandCombinationParameters ::= SEQUENCE { + ca-ParametersNR CA-ParametersNR OPTIONAL, + mrdc-Parameters MRDC-Parameters OPTIONAL +} + +CA-ParametersNR ::= SEQUENCE { + multipleTimingAdvances ENUMERATED {supported} OPTIONAL, +-- R4 2-5: Simultaneous reception and transmission for inter band CA (TDD-TDD or TDD-FDD) + simultaneousRxTxInterBandCA ENUMERATED {supported} OPTIONAL, +-- BCS related to R4 2-1 and Updated CA BW class in R4-1803374 + supportedBandwidthCombinationSet BIT STRING (SIZE (1..32)) OPTIONAL +} + +MRDC-Parameters ::= SEQUENCE { + singleUL-Transmission ENUMERATED {supported} OPTIONAL, +-- R4 1-10: Support of EN-DC with LTE-NR coexistence in UL sharing from UE perspective + ul-SharingEUTRA-NR ENUMERATED {supported} OPTIONAL, +-- R4 1-11: Switching time between LTE UL and NR UL for EN-DC with LTE-NR coexistence in UL sharing from UE perspective + ul-SwitchingTimeEUTRA-NR ENUMERATED {type1, type2} OPTIONAL, +-- R4 2-4: Simultaneous reception and transmission for inter-band EN-DC (TDD-TDD or TDD-FDD) + simultaneousRxTxInterBandENDC ENUMERATED {supported} OPTIONAL, +-- R4 2-6: Asynchronous FDD-FDD intra-band EN-DC + asyncIntraBandENDC ENUMERATED {supported} OPTIONAL, + basebandProcesingCombinationMRDC BasebandProcessingCombinationMRDC +} + +BandAndDL-ParametersEUTRA ::= SEQUENCE { + bandEUTRA FreqBandIndicatorEUTRA, + ca-BandwidthClassDL-EUTRA CA-BandwidthClassEUTRA OPTIONAL, + intraBandContiguousCC-InfoDL-EUTRA-List SEQUENCE (SIZE (1.. maxNrofServingCellsEUTRA)) OF IntraBandContiguousCC-InfoDL-EUTRA OPTIONAL +} + +BandAndDL-ParametersNR ::= SEQUENCE { + bandNR FreqBandIndicatorNR, + ca-BandwidthClassDL CA-BandwidthClassNR OPTIONAL, +-- R4 2-3: Non-contiguous intra-band CA frequency separation class for FR2 as in the RAN4 LS R4-1803363 + intraBandFreqSeparationDL FreqSeparationClass OPTIONAL, + intraBandContiguousCC-InfoDL-List SEQUENCE (SIZE (1.. maxNrofServingCells)) OF IntraBandContiguousCC-InfoDL OPTIONAL +} + +IntraBandContiguousCC-InfoDL ::= SEQUENCE { +-- Related to RAN4 LS R2-1804078 + maxNumberMIMO-LayersPDSCH MIMO-LayersDL OPTIONAL +} + +IntraBandContiguousCC-InfoDL-EUTRA ::= SEQUENCE { +-- Related to RAN4 LS R2-1804078 + mimo-CapabilityDL ENUMERATED {twoLayers, fourLayers, eightLayers} OPTIONAL +} + +-- TAG-BANDCOMBINATIONLIST-STOP +-- TAG-BANDCOMBINATIONPARAMETERSULLIST-START + +BandCombinationParametersUL-List ::= SEQUENCE (SIZE (1..maxBandComb)) OF BandCombinationParametersUL + +BandCombinationParametersUL ::= SEQUENCE (SIZE (1.. maxSimultaneousBands)) OF BandParametersUL + +BandParametersUL ::= CHOICE { + bandParametersUL-EUTRA BandParametersUL-EUTRA, + bandParametersUL-NR BandParametersUL-NR +} + +BandParametersUL-EUTRA ::= SEQUENCE { + ca-BandwidthClassUL-EUTRA CA-BandwidthClassEUTRA OPTIONAL, + intraBandContiguousCC-InfoUL-EUTRA-List SEQUENCE (SIZE (1.. maxNrofServingCellsEUTRA)) OF IntraBandContiguousCC-InfoUL-EUTRA OPTIONAL +} + +BandParametersUL-NR ::= SEQUENCE { + ca-BandwidthClassUL CA-BandwidthClassNR OPTIONAL, +-- R4 2-3: Non-contiguous intra-band CA frequency separation class for FR2 as in the RAN4 LS R4-1803363 + intraBandFreqSeparationUL FreqSeparationClass OPTIONAL, + intraBandContiguousCC-InfoUL-List SEQUENCE (SIZE (1.. maxNrofServingCells)) OF IntraBandContiguousCC-InfoUL OPTIONAL +} + +IntraBandContiguousCC-InfoUL ::= SEQUENCE { +-- Related to RAN4 LS R2-1804078 + maxNumberMIMO-LayersCB-PUSCH MIMO-LayersUL OPTIONAL, + maxNumberMIMO-LayersNonCB-PUSCH MIMO-LayersUL OPTIONAL +} + +IntraBandContiguousCC-InfoUL-EUTRA ::= SEQUENCE { +-- Related to RAN4 LS R2-1804078 + mimo-CapabilityUL ENUMERATED {twoLayers, fourLayers} OPTIONAL +} + +-- TAG-BANDCOMBINATIONPARAMETERSULLIST-STOP +-- TAG-BASEBANDCOMBINATIONPARAMETERSULLIST-START + +BasebandCombinationParametersUL-List ::= SEQUENCE (SIZE (1..maxBasebandProcComb)) OF BasebandCombinationParametersUL + +BasebandCombinationParametersUL ::= SEQUENCE (SIZE (1..maxSimultaneousBands)) OF BasebandParametersPerBandUL + +BasebandParametersPerBandUL ::= SEQUENCE { + ca-BandwidthClassUL CA-BandwidthClassNR, + freqRange ENUMERATED {fr1, fr2}, + basebandParametersPerCC-UL SEQUENCE (SIZE (1.. maxNrofServingCells)) OF BasebandParametersPerCC-UL +} + +BasebandParametersPerCC-UL ::= SEQUENCE { +-- R4 2-2: Simultaneous reception or transmission with same or different numerologies in CA +-- It is expressed by the combination of SCS whether simultaneous RxTx is supported or not. + supportedSubcarrierSpacingUL SubcarrierSpacing, +-- Accoding to the RAN4 LS R4-1803563, maximum Bandwidth supported per CC is added in BPC +-- FFS how to work together with BCS and max BW for each CC to be defined for each CA band combination in the RAN4 spec. + supportedBandwidthUL CHOICE { + fr1 ENUMERATED {mhz5, mhz10, mhz15, mhz20, mhz25, mhz30, mhz40, mhz50, mhz60, mhz80, mhz100}, + fr2 ENUMERATED {mhz50, mhz100, mhz200, mhz400} + }, + -- R2-1800012. To be confirmed by RAN1 + scalingFactor0dot75 ENUMERATED {supported} OPTIONAL, +-- R1 2-14: Codebook based PUSCH MIMO transmission. Absence of this field implies that CB-based PUSCH is not supported. + maxNumberMIMO-LayersCB-PUSCH MIMO-LayersUL OPTIONAL, +-- R1 2-15: Non-codebook based PUSCH MIMO transmission. Absence of this field implies that Non-CB-based PUSCH is not supported. + maxNumberMIMO-LayersNonCB-PUSCH MIMO-LayersUL OPTIONAL, +-- Accoding to the RAN4 LS R4-1803563, modulation order is added per CC granularity in BPC +-- FFS whether all of modulation order specified in the spec need to be signalled. +-- FFS how to address the requirements agreed by RAN4, e.g. mandaotry w/o capabiltiy for 64QAM. mandaotry with capabiltiy for DL 256QAM in FR1. + supportedModulationOrderUL ModulationOrder OPTIONAL, +-- R1 2-53: SRS resources + supportedSRS-Resources SRS-Resources OPTIONAL, +-- R1 2-55: SRS Tx switch + srs-TxSwitch SRS-TxSwitch OPTIONAL, +-- R1 2-57: Support low latency CSI feedback + lowLatencyCSI-Feedback ENUMERATED {supported} OPTIONAL, +-- R1 5-12 & 5-12a: Up to 2/7 PUSCHs per slot for different TBs + pusch-DifferentTB-PerSlot SEQUENCE { + scs-15kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-30kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-60kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-120kHz ENUMERATED {upto2, upto7} OPTIONAL + } OPTIONAL, +-- R1 6-7: Two PUCCH group + twoPUCCH-Group ENUMERATED {supported} OPTIONAL, +-- R1 6-8: Different numerology across PUCCH groups + diffNumerologyAcrossPUCCH-Group ENUMERATED {supported} OPTIONAL, +-- R1 6-9: Different numerologies across carriers within the same PUCCH group + diffNumerologyWithinPUCCH-Group ENUMERATED {supported} OPTIONAL, +-- R1 6-10: Cross carrier scheduling + crossCarrierScheduling ENUMERATED {supported} OPTIONAL, +-- R1 6-11: Number of supported TAGs + supportedNumberTAG ENUMERATED {n2, n3, n4} OPTIONAL, +-- R1 6-18: Supplemental uplink with dynamic switch + dynamicSwitchSUL ENUMERATED {supported} OPTIONAL, +-- R1 6-19: Simultaneous transmission of SRS on an SUL/non-SUL carrier and PUSCH/PUCCH/SRS/PRACH on the other UL carrier in the same cell +-- Details on the channel/signal combination are to be described in TS 38.306 + simultaneousTxSUL-NonSUL ENUMERATED {supported} OPTIONAL, +-- R1 6-22: UL search space sharing for CA + searchSpaceSharingCA-UL ENUMERATED {supported} OPTIONAL +} + +-- TAG-BASEBANDCOMBINATIONPARAMETERSULLIST-STOP +-- TAG-BASEBANDPROCESSINGCOMBINATIONMRDC-START + +BasebandProcessingCombinationMRDC ::= SEQUENCE (SIZE (1..maxBasebandProcComb)) OF BasebandProcessingCombinationLink + +BasebandProcessingCombinationLink ::= SEQUENCE { + basebandProcessingCombinationIndexMN BasebandProcessingCombinationIndex, + basebandProcessingCombinationLinkedIndexSN SEQUENCE (SIZE (1..maxBasebandProcComb)) OF BasebandProcessingCombinationIndex +} + +BasebandProcessingCombinationIndex ::= INTEGER (1..maxBasebandProcComb) + +-- TAG-BASEBANDPROCESSINGCOMBINATIONMRDC-STOP +-- TAG-CA-BANDWIDTHCLASSNR-START + +-- Updated based on R4-1803374 +CA-BandwidthClassNR ::= ENUMERATED {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, ...} + +-- TAG-CA-BANDWIDTHCLASSNR-STOP +-- TAG-CA-BANDWIDTHCLASSEUTRA-START + +CA-BandwidthClassEUTRA ::= ENUMERATED {a, b, c, d, e, f, ...} + +-- TAG-CA-BANDWIDTHCLASSEUTRA-STOP +-- TAG-FREQ-BAND-INDICATOR-EUTRA-START + +FreqBandIndicatorEUTRA ::= INTEGER (1..maxBandsEUTRA) + +-- TAG-FREQ-BAND-INDICATOR-EUTRA-STOP +-- TAG-FREQBANDLIST-START + +FreqBandList ::= SEQUENCE (SIZE (1..maxBandsMRDC)) OF FreqBandInformation + +FreqBandInformation ::= CHOICE { + bandEUTRA FreqBandIndicatorEUTRA, + bandNR FreqBandIndicatorNR +} + +-- TAG-FREQBANDLIST-STOP +-- TAG-FREQSEPARATIONCLASS-START + +FreqSeparationClass ::= ENUMERATED {c1, c2, c3, ...} + +-- TAG-FREQSEPARATIONCLASS-STOP +-- TAG-MIMO-LAYERS-START + +MIMO-LayersDL ::= ENUMERATED {twoLayers, fourLayers, eightLayers} + +MIMO-LayersUL ::= ENUMERATED {oneLayer, twoLayers, fourLayers} + +-- TAG-MIMO-LAYERS-STOP +-- TAG-MODULATION-ORDER-START + +ModulationOrder ::= ENUMERATED {bpsk-halfpi, bpsk, qpsk, qam16, qam64, qam256} + +-- TAG-MODULATION-ORDER-STOP +-- TAG-RAT-TYPE-START + +RAT-Type ::= ENUMERATED {nr, eutra-nr, spare2, spare1, ...} + +-- TAG-RAT-TYPE-STOP +-- TAG-SUPPORTEDBASEBANDPROCESSINGCOMBINATION-START + +SupportedBasebandProcessingCombination ::= SEQUENCE (SIZE (1..maxBasebandProcComb)) OF BasebandProcessingCombination + +BasebandProcessingCombination ::= SEQUENCE { + basebandParametersDL SEQUENCE (SIZE (1..maxSimultaneousBands)) OF BasebandParametersPerBandDL, + basebandParametersUL BIT STRING (SIZE (1..maxBasebandProcComb))} + +BasebandParametersPerBandDL ::= SEQUENCE { + ca-BandwidthClassDL CA-BandwidthClassNR, + freqRange ENUMERATED {fr1, fr2}, + basebandParametersPerCC-DL SEQUENCE (SIZE (1.. maxNrofServingCells)) OF BasebandParametersPerCC-DL +} + +BasebandParametersPerCC-DL ::= SEQUENCE { +-- R4 2-2: Simultaneous reception or transmission with same or different numerologies in CA +-- It is expressed by the combination of SCS whether simultaneous RxTx is supported or not. + supportedSubcarrierSpacingDL SubcarrierSpacing, +-- Accoding to the RAN4 LS R4-1803563, maximum Bandwidth supported per CC is added in BPC +-- FFS how to work together with BCS and max BW for each CC to be defined for each CA band combination in the RAN4 spec. + supportedBandwidthDL CHOICE { + fr1 ENUMERATED {mhz5, mhz10, mhz15, mhz20, mhz25, mhz30, mhz40, mhz50, mhz60, mhz80, mhz100}, + fr2 ENUMERATED {mhz50, mhz100, mhz200, mhz400} + }, +-- R2-1800012. To be confirmed by RAN1 + scalingFactor0dot75 ENUMERATED {supported} OPTIONAL, +-- R1 2-2: PDSCH beam switching + timeDurationForQCL SEQUENCE { + scs-60kHz ENUMERATED {s7, s14, s28} OPTIONAL, + sch-120kHz ENUMERATED {s14, s28} OPTIONAL + } OPTIONAL, +-- R1 1-10: Support of SCell without SS/PBCH block + scellWithoutSSB ENUMERATED {supported} OPTIONAL, +-- R1 1-11: Support of CSI-RS RRM measurement for SCell without SS/PBCH block + csi-RS-MeasSCellWithoutSSB ENUMERATED {supported} OPTIONAL, +-- R1 2-3: PDSCH MIMO layers. Absence of this field implies support of one layer. + maxNumberMIMO-LayersPDSCH MIMO-LayersDL OPTIONAL, +-- Accoding to the RAN4 LS R4-1803563, modulation order is added per CC granularity in BPC +-- FFS whether all of modulation order specified in the spec need to be signalled. +-- FFS how to address the requirements agreed by RAN4, e.g. mandaotry w/o capabiltiy for 64QAM. mandaotry with capabiltiy for DL 256QAM in FR1. + supportedModulationOrderDL ModulationOrder OPTIONAL, +-- R1 2-15a: Association between CSI-RS and SRS + srs-AssocCSI-RS ENUMERATED {supported} OPTIONAL, +-- R1 3-1a: For type 1 CSS with dedicated RRC configuration and for type 3 CSS, UE specific SS, CORESET resource allocation of 6RB bit-map and duration 3 OFDM symbols for FR2 + type1-3-CSS ENUMERATED {supported} OPTIONAL, +-- R1 3-5 & 3-5a: For type 1 with dedicated RRC configuration, type 3, and UE-SS,, monitoring occasion can be any OFDM symbol(s) of a slot for Case 2 (with a DCI gap) + pdcchMonitoringAnyOccasions ENUMERATED {withoutDCI-gap, withDCI-gap} OPTIONAL, +-- R1 5-1a: UE specific RRC configure UL/DL assignment + ue-SpecificUL-DL-Assignment ENUMERATED {supported} OPTIONAL, +-- R1 5-11 & 5-11a: Up to 2/7 unicast PDSCHs per slot for different TBs + pdsch-DifferentTB-PerSlot SEQUENCE { + scs-15kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-30kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-60kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-120kHz ENUMERATED {upto2, upto7} OPTIONAL + } OPTIONAL, +-- R1 6-10: Cross carrier scheduling + crossCarrierScheduling ENUMERATED {supported} OPTIONAL, +-- R1 6-21: DL search space sharing for CA + searchSpaceSharingCA-DL ENUMERATED {supported} OPTIONAL +} + +-- TAG-SUPPORTEDBASEBANDPROCESSINGCOMBINATION-STOP +-- TAG-UE-CAPABILITY-RAT-CONTAINER-LIST-START + +UE-CapabilityRAT-ContainerList ::=SEQUENCE (SIZE (0.. maxRAT-CapabilityContainers)) OF UE-CapabilityRAT-Container + +UE-CapabilityRAT-Container ::= SEQUENCE { + rat-Type RAT-Type, + ue-CapabilityRAT-Container OCTET STRING +} + +-- TAG-UE-CAPABILITY-RAT-CONTAINER-LIST-STOP +-- TAG-UE-MRDC-CAPABILITY-START + +UE-MRDC-Capability ::= SEQUENCE { + measParametersMRDC MeasParametersMRDC OPTIONAL, + rf-ParametersMRDC RF-ParametersMRDC, + phy-ParametersMRDC Phy-ParametersMRDC OPTIONAL, + generalParametersMRDC GeneralParametersMRDC-XDD-Diff OPTIONAL, + fdd-Add-UE-MRDC-Capabilities UE-MRDC-CapabilityAddXDD-Mode OPTIONAL, + tdd-Add-UE-MRDC-Capabilities UE-MRDC-CapabilityAddXDD-Mode OPTIONAL, + fr1-Add-UE-MRDC-Capabilities UE-MRDC-CapabilityAddFRX-Mode OPTIONAL, + fr2-Add-UE-MRDC-Capabilities UE-MRDC-CapabilityAddFRX-Mode OPTIONAL, + lateNonCriticalExtension OCTET STRING OPTIONAL, + nonCriticalExtension SEQUENCE {} OPTIONAL +} + +UE-MRDC-CapabilityAddXDD-Mode ::= SEQUENCE { + phy-ParametersMRDC-XDD-Diff Phy-ParametersMRDC-XDD-Diff OPTIONAL, + measParametersMRDC-XDD-Diff MeasParametersMRDC-XDD-Diff OPTIONAL, + generalParametersMRDC-XDD-Diff GeneralParametersMRDC-XDD-Diff OPTIONAL +} + +UE-MRDC-CapabilityAddFRX-Mode ::= SEQUENCE { + phy-ParametersMRDC-FRX-Diff Phy-ParametersMRDC-FRX-Diff OPTIONAL, + measParametersMRDC-FRX-Diff MeasParametersMRDC-FRX-Diff +} + +RF-ParametersMRDC ::= SEQUENCE { + supportedBandCombination BandCombinationList, + bandCombinationParametersUL-List BandCombinationParametersUL-List +} + +Phy-ParametersMRDC ::= SEQUENCE { + phy-ParametersMRDC-XDD-Diff Phy-ParametersMRDC-XDD-Diff OPTIONAL, + phy-ParametersMRDC-FRX-Diff Phy-ParametersMRDC-FRX-Diff OPTIONAL +} + +Phy-ParametersMRDC-XDD-Diff ::= SEQUENCE { +-- R1 8-1: Dynamic power sharing for LTE-NR DC + dynamicPowerSharing ENUMERATED {supported} OPTIONAL, +-- R1 6-13 & 8-2: Case 1 Single Tx UL LTE-NR DC + tdm-Pattern ENUMERATED {supported} OPTIONAL +} +Phy-ParametersMRDC-FRX-Diff ::= SEQUENCE { +-- R1 8-1: Dynamic power sharing for LTE-NR DC + dynamicPowerSharing ENUMERATED {supported} OPTIONAL, +-- R1 6-13 & 8-2: Case 1 Single Tx UL LTE-NR DC + tdm-Pattern ENUMERATED {supported} OPTIONAL +} + +MeasParametersMRDC ::= SEQUENCE { + measParametersMRDC-Common MeasParametersMRDC-Common, + measParametersMRDC-XDD-Diff MeasParametersMRDC-XDD-Diff OPTIONAL, + measParametersMRDC-FRX-Diff MeasParametersMRDC-FRX-Diff +} + +MeasParametersMRDC-Common ::= SEQUENCE { +-- R4 3-1: Independent measurement gap configurations for FR1 and FR2 + independentGapConfig ENUMERATED {supported} OPTIONAL +} + +MeasParametersMRDC-XDD-Diff ::= SEQUENCE { + sftd-MeasPSCell ENUMERATED {supported} OPTIONAL, + sftd-MeasNR-Cell ENUMERATED {supported} OPTIONAL +} + +MeasParametersMRDC-FRX-Diff ::= SEQUENCE { +-- R4 3-2: Simultaneous reception of data and SS block with different numerologies when UE conducts the serving cell measurement or intra-frequency measurement + simultaneousRxDataSSB-DiffNumerology ENUMERATED {supported} OPTIONAL +} + +GeneralParametersMRDC-XDD-Diff ::= SEQUENCE { + splitSRB-WithOneUL-Path ENUMERATED {supported} OPTIONAL, + splitDRB-withUL-Both-MCG-SCG ENUMERATED {supported} OPTIONAL, + srb3 ENUMERATED {supported} OPTIONAL +} + +-- TAG-UE-MRDC-CAPABILITY-STOP +-- TAG-UE-NR-CAPABILITY-START + +UE-NR-Capability ::= SEQUENCE { + pdcp-Parameters PDCP-Parameters, + rlc-Parameters RLC-Parameters OPTIONAL, + mac-Parameters MAC-Parameters OPTIONAL, + phy-Parameters Phy-Parameters, + rf-Parameters RF-Parameters, + measParameters MeasParameters OPTIONAL, + fdd-Add-UE-NR-Capabilities UE-NR-CapabilityAddXDD-Mode OPTIONAL, + tdd-Add-UE-NR-Capabilities UE-NR-CapabilityAddXDD-Mode OPTIONAL, + fr1-Add-UE-NR-Capabilities UE-NR-CapabilityAddFRX-Mode OPTIONAL, + fr2-Add-UE-NR-Capabilities UE-NR-CapabilityAddFRX-Mode OPTIONAL, + lateNonCriticalExtension OCTET STRING OPTIONAL, + nonCriticalExtension SEQUENCE {} OPTIONAL +} + +UE-NR-CapabilityAddXDD-Mode ::= SEQUENCE { + phy-ParametersXDD-Diff Phy-ParametersXDD-Diff OPTIONAL, + mac-ParametersXDD-Diff MAC-ParametersXDD-Diff OPTIONAL, + measParametersXDD-Diff MeasParametersXDD-Diff OPTIONAL +} + +UE-NR-CapabilityAddFRX-Mode ::= SEQUENCE { + phy-ParametersFRX-Diff Phy-ParametersFRX-Diff OPTIONAL, + measParametersFRX-Diff MeasParametersFRX-Diff OPTIONAL +} + +Phy-Parameters ::= SEQUENCE { + phy-ParametersCommon Phy-ParametersCommon OPTIONAL, + phy-ParametersXDD-Diff Phy-ParametersXDD-Diff OPTIONAL, + phy-ParametersFRX-Diff Phy-ParametersFRX-Diff OPTIONAL, + phy-ParametersFR1 Phy-ParametersFR1 OPTIONAL, + phy-ParametersFR2 Phy-ParametersFR2 OPTIONAL, + supportedBasebandProcessingCombination SupportedBasebandProcessingCombination, + basebandCombinationParametersUL-List BasebandCombinationParametersUL-List +} + +Phy-ParametersCommon ::= SEQUENCE { +-- R1 1-9: CSI-RS based CFRA for HO + csi-RS-CFRA-ForHO ENUMERATED {supported} OPTIONAL, +-- R1 2-11: Downlink dynamic PRB bundling (DL) + dynamicPRB-BundlingDL ENUMERATED {supported} OPTIONAL, +-- R1 2-32a: Semi-persistent CSI report on PUCCH + sp-CSI-ReportPUCCH ENUMERATED {supported} OPTIONAL, +-- R1 2-32b: Semi-persistent CSI report on PUSCH + sp-CSI-ReportPUSCH ENUMERATED {supported} OPTIONAL, +-- R1 2-34: NZP-CSI-RS based interference measurement + nzp-CSI-RS-IntefMgmt ENUMERATED {supported} OPTIONAL, +-- R1 2-42: Support Type II SP-CSI feedback on long PUCCH + type2-SP-CSI-Feedback-LongPUCCH ENUMERATED {supported} OPTIONAL, +-- R1 3-3: More than one CORESET per BWP (in addition to CORESET #0) + multipleCORESET ENUMERATED {supported} OPTIONAL, +-- R1 3-6: Dynamic SFI monitoring and dynamic UL/DL determination + dynamicSFI ENUMERATED {supported} OPTIONAL, +-- R1 3-7: Precoder-granularity of CORESET size + precoderGranularityCORESET ENUMERATED {supported} OPTIONAL, +-- R1 4-10: Dynamic HARQ-ACK codebook + dynamicHARQ-ACK-Codebook ENUMERATED {supported} OPTIONAL, +-- R1 4-11: Semi-static HARQ-ACK codebook + semiStaticHARQ-ACK-Codebook ENUMERATED {supported} OPTIONAL, +-- R1 4-12: HARQ-ACK spatial bundling for PUCCH or PUSCH per PUCCH group + spatialBundlingHARQ-ACK ENUMERATED {supported} OPTIONAL, +-- R1 4-21: Dynamic beta-offset configuration and indication for HARQ-ACK and/or CSI + dynamicBetaOffsetInd-HARQ-ACK-CSI ENUMERATED {supported} OPTIONAL, +-- R1 4-23: Repetitions for PUCCH format 1, 3,and 4 over multiple slots with K = 1, 2, 4, 8 + pucch-Repetition-F1-3-4 ENUMERATED {supported} OPTIONAL, +-- R1 5-2: RA type 0 for PUSCH + ra-Type0-PUSCH ENUMERATED {supported} OPTIONAL, +-- R1 5-3: Dynamic switching between RA type 0 and RA type 1 for PDSCH + dynamicSwitchRA-Type0-1-PDSCH ENUMERATED {supported} OPTIONAL, +-- R1 5-4: Dynamic switching between RA type 0 andRA type 1 for PUSCH + dynamicSwitchRA-Type0-1-PUSCH ENUMERATED {supported} OPTIONAL, +-- R1 5-6: PDSCH mapping type A with less than 7 OFDM symbols + pdsch-MappingTypeA ENUMERATED {supported} OPTIONAL, +-- R1 5-6a: PDSCH mapping type B + pdsch-MappingTypeB ENUMERATED {supported} OPTIONAL, +-- R1 5-7: Interleaving for VRB-to-PRB mapping for PDSCH + interleavingVRB-ToPRB-PDSCH ENUMERATED {supported} OPTIONAL, +-- R1 5-8: Interleaving for VRB-to-PRB mapping for PUSCH + interleavingVRB-ToPRB-PUSCH ENUMERATED {supported} OPTIONAL, +-- R1 5-10: Inter-slot frequency hopping for PUSCH + interSlotFreqHopping-PUSCH ENUMERATED {supported} OPTIONAL, +-- R1 5-13: Type 1 configured PUSCH repetitions within a slot + type1-PUSCH-RepetitionOneSlot ENUMERATED {supported} OPTIONAL, +-- R1 5-14: Type 1 configured PUSCH repetitions over multiple slots + type1-PUSCH-RepetitionMultiSlots ENUMERATED {supported} OPTIONAL, +-- R1 5-15: Type 2 configured PUSCH repetitions within a slot + type2-PUSCH-RepetitionOneSlot ENUMERATED {supported} OPTIONAL, +-- R1 5-16: Type 2 configured PUSCH repetitions over multiple slots + type2-PUSCH-RepetitionMultiSlots ENUMERATED {supported} OPTIONAL, +-- R1 5-17: PUSCH repetitions over multiple slots + pusch-RepetitionMultiSlots ENUMERATED {supported} OPTIONAL, +-- R1 5-17a: PDSCH repetitions over multiple slots + pdsch-RepetitionMultiSlots ENUMERATED {supported} OPTIONAL, +-- R1 5-18: DL SPS + downlinkSPS ENUMERATED {supported} OPTIONAL, +-- R1 5-19: Type 1 Configured UL grant + configuredUL-GrantType1 ENUMERATED {supported} OPTIONAL, +-- R1 5-20: Type 2 Configured UL grant + configuredUL-GrantType2 ENUMERATED {supported} OPTIONAL, +-- R1 5-21: Pre-emption indication for DL + pre-EmptIndication-DL ENUMERATED {supported} OPTIONAL, +-- R1 5-22 & 5-25: CBG-based re-transmission for DL/UL using CBGTI + cbg-TransIndication BIT STRING (SIZE (2)) OPTIONAL, +-- R1 5-23: CBGFI for CBG-based re-transmission for DL + cbg-FlushIndication-DL ENUMERATED {supported} OPTIONAL, +-- R1 5-24: Dynamic HARQ-ACK codebook using sub-codebooks for CBG-based re-transmission for DL + dynamicHARQ-ACK-CodeB-CBG-Retx-DL ENUMERATED {supported} OPTIONAL, +-- R1 5-26: Semi-static rate-matching resource set configuration for DL + rateMatchingResrcSetSemi-Static ENUMERATED {supported} OPTIONAL, +-- R1 5-27: Dynamic rate-matching resource set configuration for DL + rateMatchingResrcSetDynamic ENUMERATED {supported} OPTIONAL, +-- R1 5-28: Rate-matching around LTE CRS + rateMatchingLTE-CRS ENUMERATED {supported} OPTIONAL, +-- R4 1-8: BWP switching delay + bwp-SwitchingDelay ENUMERATED {type1, type2} OPTIONAL +} + +Phy-ParametersXDD-Diff ::= SEQUENCE { +-- R1 4-2: 2 PUCCH of format 0 or 2 in consecutive symbols + twoPUCCH-F0-2-ConsecSymbols ENUMERATED {supported} OPTIONAL, +-- R1 8-7: UL power control with 2 PUSCH closed loops + twoDifferentTPC-Loop-PUSCH ENUMERATED {supported} OPTIONAL, +-- R1 8-8: UL power control with 2 PUCCH closed loops + twoDifferentTPC-Loop-PUCCH ENUMERATED {supported} OPTIONAL +} + +Phy-ParametersFRX-Diff ::= SEQUENCE { +-- R1 2-6 & 2-16b: Support 1+2 DMRS (DL/UL) + oneFL-DMRS-TwoAdditionalDMRS BIT STRING (SIZE (2)) OPTIONAL, +-- R1 2-7 & 2-18: Supported 2 symbols front-loaded DMRS(DL/UL) + twoFL-DMRS BIT STRING (SIZE (2)) OPTIONAL, +-- R1 2-8 & 2-18a: Supported 2 symbols front-loaded +2 symbols additional DMRS(DL/UL) + twoFL-DMRS-TwoAdditionalDMRS BIT STRING (SIZE (2)) OPTIONAL, +-- R1 2-9 & 2-19: Support 1+3 DMRS (DL/UL) + oneFL-DMRS-ThreeAdditionalDMRS BIT STRING (SIZE (2)) OPTIONAL, +-- R1 2-10: Support DMRS type (DL) + supportedDMRS-TypeDL ENUMERATED {type1, type2} OPTIONAL, +-- R1 2-17: Support DMRS type (UL) + supportedDMRS-TypeUL ENUMERATED {type1, type2} OPTIONAL, +-- R1 2-37: Support Semi-open loop CSI + semiOpenLoopCSI ENUMERATED {supported} OPTIONAL, +-- R1 2-38: CSI report without PMI + csi-ReportWithoutPMI ENUMERATED {supported} OPTIONAL, +-- R1 2-39: CSI report with CRI + csi-ReportWithCRI ENUMERATED {supported} OPTIONAL, +-- R1 2-39a: CSI report without CQI + csi-ReportWithoutCQI ENUMERATED {supported} OPTIONAL, +-- R1 2-44 & 2-47: 1 port of DL/UL PTRS + onePortsPTRS BIT STRING (SIZE (2)) OPTIONAL, +-- R1 4-2: 2 PUCCH of format 0 or 2 in consecutive symbols + twoPUCCH-F0-2-ConsecSymbols ENUMERATED {supported} OPTIONAL, +-- R1 4-3: PUCCH format 2 over 1 – 2 OFDM symbols once per slot with FH + pucch-F2-WithFH ENUMERATED {supported} OPTIONAL, +-- R1 4-4: PUCCH format 3 over 4 – 14 OFDM symbols once per slot with FH + pucch-F3-WithFH ENUMERATED {supported} OPTIONAL, +-- R1 4-5: PUCCH format 4 over 4 – 14 OFDM symbols once per slot with FH + pucch-F4-WithFH ENUMERATED {supported} OPTIONAL, +-- R1 4-6: Non-frequency hopping for PUCCH formats 0 and 2 + freqHoppingPUCCH-F0-2 ENUMERATED {notSupported} OPTIONAL, +-- R1 4-7: Non-frequency hopping for PUCCH format 1, 3, and 4 + freqHoppingPUCCH-F1-3-4 ENUMERATED {notSupported} OPTIONAL, +-- R1 4-19: SR/HARQ-ACK/CSI multiplexing once per slot using a PUCCH (or piggybacked on a PUSCH) + mux-SR-HARQ-ACK-CSI-PUCCH ENUMERATED {supported} OPTIONAL, +-- R1 4-20: UCI code-block segmentation + uci-CodeBlockSegmentation ENUMERATED {supported} OPTIONAL, +-- R1 4-22: 1 long PUCCH format and 1 short PUCCH format in the same slot + onePUCCH-LongAndShortFormat ENUMERATED {supported} OPTIONAL, +-- R1 4-22a: 2 PUCCH transmissions in the same slot which are not covered by 4-22 and 4-2 + twoPUCCH-AnyOthersInSlot ENUMERATED {supported} OPTIONAL, +-- R1 5-9: Intra-slot frequency-hopping for PUSCH except for PUSCH scheduled by Type 1 before RRC connection + intraSlotFreqHopping-PUSCH ENUMERATED {supported} OPTIONAL, +-- R1 5-29: LBRM for PUSCH + pusch-LBRM ENUMERATED {supported} OPTIONAL, +-- R1 6-5a: PDCCH blind detection capability for CA + pdcch-BlindDetectionCA ENUMERATED {supported} OPTIONAL, +-- R1 8-3: TPC-PUSCH-RNTI + tpc-PUSCH-RNTI ENUMERATED {supported} OPTIONAL, +-- R1 8-4: TPC-PUCCH-RNTI + tpc-PUCCH-RNTI ENUMERATED {supported} OPTIONAL, +-- R1 8-5: TPC-SRS-RNTI + tpc-SRS-RNTI ENUMERATED {supported} OPTIONAL, +-- R1 8-6: Absolute TPC command mode + absoluteTPC-Command ENUMERATED {supported} OPTIONAL, +-- R1 8-7: UL power control with 2 PUSCH closed loops + twoDifferentTPC-Loop-PUSCH ENUMERATED {supported} OPTIONAL, +-- R1 8-8: UL power control with 2 PUCCH closed loops + twoDifferentTPC-Loop-PUCCH ENUMERATED {supported} OPTIONAL, +-- R4 1-6: pi/2-BPSK for PUSCH + pusch-HalfPi-BPSK ENUMERATED {supported} OPTIONAL, +-- R4 1-7: pi/2-BPSK for PUCCH format 3/4 + pucch-F3-4-HalfPi-BPSK ENUMERATED {supported} OPTIONAL, +-- R4 1-9: 1-symbol GP in unpaired spectrum + oneSymbolGP-TDD ENUMERATED {supported} OPTIONAL, +-- R4 2-7: Almost contiguous UL CP-OFDM + almostContiguousCP-OFDM-UL ENUMERATED {supported} OPTIONAL +} + +Phy-ParametersFR1 ::= SEQUENCE { +-- R1 3-2: Unicast PDCCH monitoring following Case 1-2 + pdcchMonitoringSingleOccasion ENUMERATED {supported} OPTIONAL, +-- R4 1-1: 60kHz of subcarrier spacing for FR1 + scs-60kHz ENUMERATED {supported} OPTIONAL, +-- R4 1-4: 256QAM for PDSCH in FR1 + pdsch-256QAM-FR1 ENUMERATED {supported} OPTIONAL +} + +Phy-ParametersFR2 ::= SEQUENCE { +-- R4 2-8: PA calibration gap + calibrationGapPA ENUMERATED {supported} OPTIONAL +} + +RF-Parameters ::= SEQUENCE { + supportedBandListNR SupportedBandListNR, + supportedBandCombination BandCombinationList, + bandCombinationParametersUL-List BandCombinationParametersUL-List +} + +SupportedBandListNR ::= SEQUENCE (SIZE (1..maxBands)) OF BandNR + +BandNR ::= SEQUENCE { + bandNR FreqBandIndicatorNR, +-- Modified MPR behaviour as in RAN4 LS R2-1804077, which is needed for NSA as well as SA + modifiedMPR-Behaviour BIT STRING (SIZE (8)) OPTIONAL, +-- R4 2-1: Maximum channel bandwidth supported in each band for DL and UL separately and for each SCS that UE supports within a single CC +-- RAN4 agreed that 400 MHz is optional for FR2. The other values defined for FR1/fR2 in TS 38.101 are mandatory w/o capability bit. + maxChannelBW-PerCC ENUMERATED {mhz400} OPTIONAL, + mimo-ParametersPerBand MIMO-ParametersPerBand OPTIONAL, +-- R1 0-10: Extended CP + extendedCP ENUMERATED {supported} OPTIONAL, +-- R1 0-13: Phase coherence across non-contiguous UL symbols in slot in the transmission of one channel + phaseCoherenceUL ENUMERATED {supported} OPTIONAL, +-- R1 1-10: Support of SCell without SS/PBCH block + scellWithoutSSB ENUMERATED {supported} OPTIONAL, +-- R1 1-11: Support of CSI-RS RRM measurement for SCell without SS/PBCH block + csi-RS-MeasSCellWithoutSSB ENUMERATED {supported} OPTIONAL, +-- R1 2-15a: Association between CSI-RS and SRS + srs-AssocCSI-RS ENUMERATED {supported} OPTIONAL, +-- R1 3-1a: For type 1 CSS with dedicated RRC configuration and for type 3 CSS, UE specific SS, CORESET resource allocation of 6RB bit-map and duration 3 OFDM symbols for FR2 + type1-3-CSS ENUMERATED {supported} OPTIONAL, +-- R1 3-4: More than one TCI state configurations per CORESET + multipleTCI ENUMERATED {supported} OPTIONAL, +-- R1 3-5 & 3-5a: For type 1 with dedicated RRC configuration, type 3, and UE-SS,, monitoring occasion can be any OFDM symbol(s) of a slot for Case 2 (with a DCI gap) + pdcchMonitoringAnyOccasions ENUMERATED {withoutDCI-gap, withDCI-gap} OPTIONAL, +-- R1 5-1a: UE specific RRC configure UL/DL assignment + ue-SpecificUL-DL-Assignment ENUMERATED {supported} OPTIONAL, +-- R1 5-11 & 5-11a: Up to 2/7 unicast PDSCHs per slot for different TBs + pdsch-DifferentTB-PerSlot SEQUENCE { + scs-15kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-30kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-60kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-120kHz ENUMERATED {upto2, upto7} OPTIONAL + } OPTIONAL, +-- R1 5-12 & 5-12a: Up to 2/7 PUSCHs per slot for different TBs + pusch-DifferentTB-PerSlot SEQUENCE { + scs-15kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-30kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-60kHz ENUMERATED {upto2, upto7} OPTIONAL, + scs-120kHz ENUMERATED {upto2, upto7} OPTIONAL + } OPTIONAL, +-- R1 6-2 & 6-3: Type A/B BWP adaptation (up to 2/4 BWPs) with same numerology + bwp-SameNumerology ENUMERATED {upto2, upto4} OPTIONAL, +-- R1 6-4: BWP adaptation (up to 4 BWPs) with different numerologies + bwp-DiffNumerology ENUMERATED {upto4} OPTIONAL, +-- R1 6-7: Two PUCCH group + twoPUCCH-Group ENUMERATED {supported} OPTIONAL, +-- R1 6-8: Different numerology across PUCCH groups + diffNumerologyAcrossPUCCH-Group ENUMERATED {supported} OPTIONAL, +-- R1 6-9: Different numerologies across carriers within the same PUCCH group + diffNumerologyWithinPUCCH-Group ENUMERATED {supported} OPTIONAL, +-- R1 6-10: Cross carrier scheduling + crossCarrierScheduling ENUMERATED {supported} OPTIONAL, +-- R1 6-11: Number of supported TAGs + supportedNumberTAG ENUMERATED {n2, n3, n4} OPTIONAL, +-- R1 6-19: Simultaneous transmission of SRS on an SUL/non-SUL carrier and PUSCH/PUCCH/SRS/PRACH on the other UL carrier in the same cell +-- Details on the channel/signal combination are to be described in TS 38.306 + simultaneousTxSUL-NonSUL ENUMERATED {supported} OPTIONAL, +-- R1 6-21: DL search space sharing for CA + searchSpaceSharingCA-DL ENUMERATED {supported} OPTIONAL, +-- R1 6-22: UL search space sharing for CA + searchSpaceSharingCA-UL ENUMERATED {supported} OPTIONAL, +-- R4 1-4: 256QAM for PDSCH in FR2 + pdsch-256QAM-FR2 ENUMERATED {supported} OPTIONAL, +-- R4 1-5: 256QAM for PUSCH + pusch-256QAM ENUMERATED {supported} OPTIONAL +} + +MIMO-ParametersPerBand ::= SEQUENCE { +-- R1 2-2: PDSCH beam switching + timeDurationForQCL SEQUENCE { + scs-60kHz ENUMERATED {s7, s14, s28} OPTIONAL, + sch-120kHz ENUMERATED {s14, s28} OPTIONAL + } OPTIONAL, +-- R1 2-3: PDSCH MIMO layers. Absence of this field implies support of one layer. + maxNumberMIMO-LayersPDSCH MIMO-LayersDL OPTIONAL, +-- R1 2-14: Codebook based PUSCH MIMO transmission. Absence of this field implies that CB-based PUSCH is not supported. + maxNumberMIMO-LayersCB-PUSCH MIMO-LayersUL OPTIONAL, +-- R1 2-15: Non-codebook based PUSCH MIMO transmission. Absence of this field implies that Non-CB-based PUSCH is not supported. + maxNumberMIMO-LayersNonCB-PUSCH MIMO-LayersUL OPTIONAL, +-- R1 2-4: TCI states for PDSCH + maxNumberConfiguredTCIstates ENUMERATED {n4, n8, n16, n32, n64} OPTIONAL, + maxNumberActiveTCI-PerCC ENUMERATED {n1, n2, n4, n8} OPTIONAL, +-- R1 2-13: PUSCH transmission coherence + pusch-TransCoherence ENUMERATED {nonCoherent, partialNonCoherent, fullCoherent} OPTIONAL, +-- R1 2-20: Beam correspondence + beamCorrespondence ENUMERATED {supported} OPTIONAL, +-- R1 2-21: Periodic beam report on PUCCH + periodicBeamReport ENUMERATED {supported} OPTIONAL, +-- R1 2-22: Aperiodic beam report on PUSCH + aperiodicBeamReport ENUMERATED {supported} OPTIONAL, +-- R1 2-23: Semi-persistent beam report on PUCCH + sp-BeamReportPUCCH ENUMERATED {supported} OPTIONAL, +-- R1 2-23a: Semi-persistent beam report on PUSCH + sp-BeamReportPUSCH ENUMERATED {supported} OPTIONAL, +-- R1 2-24: SSB/CSI-RS for beam management + beamManagementSSB-CSI-RS BeamManagementSSB-CSI-RS OPTIONAL, +-- R1 2-26: Receiving beam selection using CSI-RS resource repetition "ON" + maxNumberRxBeam INTEGER (2..8) OPTIONAL, +-- R1 2-27: Beam switching (including SSB and CSI-RS) + maxNumberRxTxBeamSwitchDL SEQUENCE { + scs-15kHz ENUMERATED {n4, n7, n14} OPTIONAL, + scs-30kHz ENUMERATED {n4, n7, n14} OPTIONAL, + scs-60kHz ENUMERATED {n4, n7, n14} OPTIONAL, + scs-120kHz ENUMERATED {n4, n7, n14} OPTIONAL, + scs-240kHz ENUMERATED {n4, n7, n14} OPTIONAL + } OPTIONAL, +-- R1 2-29: Non-group based beam reporting + maxNumberNonGroupBeamReporting ENUMERATED {n1, n2, n4} OPTIONAL, +-- R1 2-29a: Group based beam reporting + groupBeamReporting ENUMERATED {supported} OPTIONAL, +-- R1 2-30: UL beam management + uplinkBeamManagement SEQUENCE { + maxNumberSRS-ResourcePerSet ENUMERATED {n8, n16, n32}, + maxNumberSRS-ResourceSet INTEGER (1..8) + } OPTIONAL, +-- R1 2-31: Beam failure recovery + maxNumberCSI-RS-BFR INTEGER (1..64) OPTIONAL, + maxNumberSSB-BFR INTEGER (1..64) OPTIONAL, + maxNumberCSI-RS-SSB-BFR INTEGER (1..256) OPTIONAL, +-- R1 2-45 & 2-48: 2 ports of DL/UL PTRS + twoPortsPTRS BIT STRING (SIZE (2)) OPTIONAL, +-- R1 2-53: SRS resources + supportedSRS-Resources SRS-Resources OPTIONAL, +-- R1 2-55: SRS Tx switch + srs-TxSwitch SRS-TxSwitch OPTIONAL, +-- R1 2-54a: Simultaneous SRS Tx + maxNumberSimultaneousSRS-PerCC INTEGER (1..4) OPTIONAL, +-- R1 2-57: Support low latency CSI feedback + lowLatencyCSI-Feedback ENUMERATED {supported} OPTIONAL +} + +-- R1 2-24: SSB/CSI-RS for beam management +BeamManagementSSB-CSI-RS ::= SEQUENCE { + maxNumberSSB-CSI-RS-ResourceOneTx ENUMERATED {n8, n16, n32, n64}, + maxNumberSSB-CSI-RS-ResourceTwoTx ENUMERATED {n0, n4, n8, n16, n32, n64}, + supportedCSI-RS-Density ENUMERATED {one, three, oneAndThree} +} + +-- R1 2-53: SRS resources +SRS-Resources ::= SEQUENCE { + maxNumberAperiodicSRS-PerBWP ENUMERATED {n1, n2, n4, n8, n16}, + maxNumberAperiodicSRS-PerBWP-PerSlot INTEGER (1..6), + maxNumberPeriodicSRS-PerBWP ENUMERATED {n1, n2, n4, n8, n16}, + maxNumberPeriodicSRS-PerBWP-PerSlot INTEGER (1..6), + maxNumberSemiPersitentSRS-PerBWP ENUMERATED {n0, n1, n2, n4, n8, n16}, + maxNumberSP-SRS-PerBWP-PerSlot INTEGER (0..6), + maxNumberSRS-Ports-PerResource ENUMERATED {n1, n2, n4} +} +-- R1 2-55: SRS Tx switch +SRS-TxSwitch ::= SEQUENCE { + supportedSRS-TxPortSwitch ENUMERATED {t1r2, t1r4, t2r4, t1r4-t2r4}, + txSwitchImpactToRx ENUMERATED {true} OPTIONAL +} + +PDCP-Parameters ::= SEQUENCE { + supportedROHC-Profiles SEQUENCE { + profile0x0000 BOOLEAN, + profile0x0001 BOOLEAN, + profile0x0002 BOOLEAN, + profile0x0003 BOOLEAN, + profile0x0004 BOOLEAN, + profile0x0006 BOOLEAN, + profile0x0101 BOOLEAN, + profile0x0102 BOOLEAN, + profile0x0103 BOOLEAN, + profile0x0104 BOOLEAN + }, + maxNumberROHC-ContextSessions ENUMERATED {cs2, cs4, cs8, cs12, cs16, cs24, cs32, cs48, cs64, cs128, cs256, cs512, cs1024, cs16384, spare2, spare1}, + uplinkOnlyROHC-Profiles ENUMERATED {supported} OPTIONAL, + continueROHC-Context ENUMERATED {supported} OPTIONAL, + outOfOrderDelivery ENUMERATED {supported} OPTIONAL, + shortSN ENUMERATED {supported} OPTIONAL +} + +RLC-Parameters ::= SEQUENCE { + am-WithShortSN ENUMERATED {supported} OPTIONAL, + um-WithShortSN ENUMERATED {supported} OPTIONAL, + um-WIthLongSN ENUMERATED {supported} OPTIONAL +} + +MAC-Parameters ::= SEQUENCE { + mac-ParametersCommon MAC-ParametersCommon OPTIONAL, + mac-ParametersXDD-Diff MAC-ParametersXDD-Diff OPTIONAL +} + +MAC-ParametersCommon ::= SEQUENCE { + lcp-Restriction ENUMERATED {supported} OPTIONAL, +-- R1 4-24: PUCCH-spatialrelationinfo indication by a MAC CE per PUCCH resource + pucch-SpatialRelInfoMAC-CE ENUMERATED {supported} OPTIONAL +} + +MAC-ParametersXDD-Diff ::= SEQUENCE { + skipUplinkTxDynamic ENUMERATED {supported} OPTIONAL, + logicalChannelSR-DelayTimer ENUMERATED {supported} OPTIONAL, + longDRX-Cycle ENUMERATED {supported} OPTIONAL, + shortDRX-Cycle ENUMERATED {supported} OPTIONAL, + multipleSR-Configurations ENUMERATED {supported} OPTIONAL, + -- If supported UE supports 8 SR configurations, otherwise 1 SR config is supported. + -- Confirmation is needed whether to align the number to what the configuration signalling can support. + multipleConfiguredGrantConfigurations ENUMERATED {supported} OPTIONAL + -- If supported UE supports 16 configured grant configurations, otherwise 1 ConfiguredGrant config is supported. + -- Confirmation is needed whether to align the number to what the configuration signalling can support, and to consider whether the 16 refers + -- to the configurations or the active ones only (as they are within the BWP). +} + +MeasParameters ::= SEQUENCE { + measParametersXDD-Diff MeasParametersXDD-Diff OPTIONAL, + measParametersFRX-Diff MeasParametersFRX-Diff OPTIONAL +} + +MeasParametersXDD-Diff ::= SEQUENCE { + intraAndInterF-MeasAndReport ENUMERATED {supported} OPTIONAL, + eventA-MeasAndReport ENUMERATED {supported} OPTIONAL + -- Confirmation is needed on the need of capability/IOT signaling in LTE for support of the additional measurement gap configurations. +} + +MeasParametersFRX-Diff ::= SEQUENCE { +-- R1 1-3: SSB based SINR measurement + ss-SINR-Meas ENUMERATED {supported} OPTIONAL, +-- R1 1-5: CSI-RS based RRM measurement with associated SS-block + csi-RSRP-AndRSRQ-MeasWithSSB ENUMERATED {supported} OPTIONAL, +-- R1 1-5a: CSI-RS based RRM measurement without associated SS-block + csi-RSRP-AndRSRQ-MeasWithoutSSB ENUMERATED {supported} OPTIONAL, +-- R1 1-6: CSI-RS based SINR measurement + csi-SINR-Meas ENUMERATED {supported} OPTIONAL, +-- R1 1-7: CSI-RS based RLM + csi-RS-RLM ENUMERATED {supported} OPTIONAL +} + +-- TAG-UE-NR-CAPABILITY-STOP +-- TAG-RRC-TRANSACTIONIDENTIFIER-START + +RRC-TransactionIdentifier ::= INTEGER (0..3) + +-- TAG-RRC-TRANSACTIONIDENTIFIER-STOP +-- TAG-MULTIPLICITY-AND-TYPE-CONSTRAINT-DEFINITIONS-START + +maxBandComb INTEGER ::= 65536 -- Maximum number of DL band combinations +maxBasebandProcComb INTEGER ::= 65536 -- Maximum number of baseband processing combinations +maxNrofServingCells INTEGER ::= 32 -- Max number of serving cells (SpCell + SCells) per cell group +maxNrofServingCells-1 INTEGER ::= 31 -- Max number of serving cells (SpCell + SCells) per cell group minus 1 +maxNrofAggregatedCellsPerCellGroup INTEGER ::= 16 +maxNrofSCells INTEGER ::= 31 -- Max number of secondary serving cells per cell group +maxNrofCellMeas INTEGER ::= 32 -- Maximum number of entries in each of the cell lists in a measurement object +maxNrofSS-BlocksToAverage INTEGER ::= 16 -- Max number for the (max) number of SS blocks to average to determine cell + -- measurement +maxNrofCSI-RS-ResourcesToAverage INTEGER ::= 16 -- Max number for the (max) number of CSI-RS to average to determine cell + -- measurement +maxNrofDL-Allocations INTEGER ::= 16 -- Maximum number of PDSCH time domain resource allocations + +maxNrofSR-ConfigPerCellGroup INTEGER ::= 8 -- Maximum number of SR configurations per cell group + +maxLCG-ID INTEGER ::= 7 -- Maximum value of LCG ID +maxLC-ID INTEGER ::= 32 -- Maximum value of Logical Channel ID +maxNrofTAGs INTEGER ::= 4 -- Maximum number of Timing Advance Groups +maxNrofTAGs-1 INTEGER ::= 3 -- Maximum number of Timing Advance Groups minus 1 + +maxNrofBWPs INTEGER ::= 4 -- Maximum number of BWPs per serving cell +maxNrofSymbols-1 INTEGER ::= 13 -- Maximum index identifying a symbol within a slot (14 symbols, indexed from 0..13) +maxNrofSlots INTEGER ::= 320 -- Maximum number of slots in a 10 ms period +maxNrofSlots-1 INTEGER ::= 319 -- Maximum number of slots in a 10 ms period minus 1 + +maxNrofPhysicalResourceBlocks INTEGER ::= 275 -- Maximum number of PRBs +maxNrofPhysicalResourceBlocks-1 INTEGER ::= 274 -- Maximum number of PRBs +maxNrofControlResourceSets INTEGER ::= 12 -- Max number of CoReSets configurable on a serving cell +maxNrofControlResourceSets-1 INTEGER ::= 11 -- Max number of CoReSets configurable on a serving cell minus 1 +maxCoReSetDuration INTEGER ::= 3 -- Max number of OFDM symbols in a control resource set +maxNrofSearchSpaces INTEGER ::= 40 -- Max number of Search Spaces +maxNrofSearchSpaces-1 INTEGER ::= 39 -- Max number of Search Spaces minus 1 +maxSFI-DCI-PayloadSize INTEGER ::= 128 -- Max number payload of a DCI scrambled with SFI-RNTI +maxSFI-DCI-PayloadSize-1 INTEGER ::= 127 -- Max number payload of a DCI scrambled with SFI-RNTI minus 1 +maxINT-DCI-PayloadSize INTEGER ::= 126 -- Max number payload of a DCI scrambled with INT-RNTI +maxINT-DCI-PayloadSize-1 INTEGER ::= 125 -- Max number payload of a DCI scrambled with INT-RNTI minus 1 +maxNrofRateMatchPatterns INTEGER ::= 4 -- Max number of rate matching patterns that may be configured +maxNrofRateMatchPatterns-1 INTEGER ::= 3 -- Max number of rate matching patterns that may be configured minus 1 + +maxNrofCSI-ReportConfigurations INTEGER ::= 48 -- Maximum number of report configurations +maxNrofCSI-ReportConfigurations-1 INTEGER ::= 47 -- Maximum number of report configurations minus 1 + +maxNrofCSI-ResourceConfigurations INTEGER ::= 112 -- Maximum number of resource configurations +maxNrofCSI-ResourceConfigurations-1 INTEGER ::= 111 -- Maximum number of resource configurations minus 1 + +maxNrofAP-CSI-RS-ResourcesPerSet INTEGER ::= 16 +maxNrOfCSI-AperiodicTriggers INTEGER ::= 128 -- Maximum number of triggers for aperiodic CSI reporting +maxNrofReportConfigPerAperiodicTrigger INTEGER ::= 16 -- Maximum number of report configurations per trigger state for aperiodic reporting + +maxNrofNZP-CSI-RS-Resources INTEGER ::= 192 -- Maximum number of Non-Zero-Power (NZP) CSI-RS resources +maxNrofNZP-CSI-RS-Resources-1 INTEGER ::= 191 -- Maximum number of Non-Zero-Power (NZP) CSI-RS resources minus 1 +maxNrofNZP-CSI-RS-ResourcesPerSet INTEGER ::= 64 -- Maximum number of NZP CSI-RS resources per resource set +maxNrofNZP-CSI-RS-ResourceSetsPerConfig INTEGER ::= 16 -- Maximum number of resource sets per resource configuration + +maxNrofZP-CSI-RS-Resources INTEGER ::= 32 -- Maximum number of Zero-Power (NZP) CSI-RS resources +maxNrofZP-CSI-RS-Resources-1 INTEGER ::= 31 -- Maximum number of Zero-Power (NZP) CSI-RS resources minus 1 +maxNrofZP-CSI-RS-ResourceSets-1 INTEGER ::= 16 +maxNrofZP-CSI-RS-ResourcesPerSet INTEGER ::= 16 +maxNrofZP-CSI-RS-Sets INTEGER ::= 16 + +maxNrofCSI-IM-Resources INTEGER ::= 32 -- Maximum number of CSI-IM resources. See CSI-IM-ResourceMax in 38.214. +maxNrofCSI-IM-Resources-1 INTEGER ::= 31 -- Maximum number of CSI-IM resources minus 1. See CSI-IM-ResourceMax in 38.214. +maxNrofCSI-IM-ResourcesPerSet INTEGER ::= 8 -- Maximum number of CSI-IM resources per set. See CSI-IM-ResourcePerSetMax in 38.214 +maxNrofCSI-IM-ResourceSetsPerConfig INTEGER ::= 16 -- Maximum number of CSI IM resource sets per resource configuration + +maxNrofSSB-Resources-1 INTEGER ::= 63 -- Maximum number of SSB resources in a resource set minus 1 +maxNrofCSI-SSB-ResourcePerSet INTEGER ::= 64 +maxNrofCSI-SSB-ResourceSetsPerConfig INTEGER ::= 1 -- Maximum number of CSI SSB resource sets per resource configuration + +maxNrofFailureDetectionResources INTEGER ::= 10 -- Maximum number of failure detection resources + +maxNrofObjectId INTEGER ::= 64 -- Maximum number of measurement objects +maxNrofPCI-Ranges INTEGER ::= 8 -- Maximum number of PCI ranges +maxNrofCSI-RS-ResourcesRRM INTEGER ::= 96 -- Maximum number of CSI-RS resources for an RRM measurement object +maxNrofCSI-RS-ResourcesRRM-1 INTEGER ::= 95 -- Maximum number of CSI-RS resources for an RRM measurement object minus 1 +maxNrofMeasId INTEGER ::= 64 -- Maximum number of configured measurements +maxNrofQuantityConfig INTEGER ::= 2 -- Maximum number of quantity configurations +maxNrofCSI-RS-CellsRRM INTEGER ::= 96 -- Maximum number of FFS + +maxNrofSRS-ResourceSets INTEGER ::= 16 -- Maximum number of SRS resource sets in a BWP. +maxNrofSRS-ResourceSets-1 INTEGER ::= 15 -- Maximum number of SRS resource sets in a BWP minus 1. +maxNrofSRS-Resources INTEGER ::= 64 -- Maximum number of SRS resources in an SRS resource set. +maxNrofSRS-Resources-1 INTEGER ::= 63 -- Maximum number of SRS resources in an SRS resource set minus 1. +maxNrofSRS-TriggerStates-1 INTEGER ::= 3 -- Maximum number of SRS trigger states minus 1, i.e., the largest code point. +maxRAT-CapabilityContainers INTEGER ::= 8 -- Maximum number of interworking RAT containers (incl NR and MRDC) +maxSimultaneousBands INTEGER ::= 32 -- Maximum number of simultaneously aggregated bands + + +maxNrofSlotFormatCombinationsPerCell INTEGER ::= 16 -- Maximum number of +maxNrofSlotFormatCombinationsPerSet INTEGER ::= 4096 -- Maximum number of Slot Format Combinations in a SF-Set. +maxNrofSlotFormatCombinationsPerSet-1 INTEGER ::= 4095 -- Maximum number of Slot Format Combinations in a SF-Set minus 1. +maxNrofPUCCH-Resources INTEGER ::= 128 +maxNrofPUCCH-Resources-1 INTEGER ::= 127 +maxNrofPUCCH-ResourceSets INTEGER ::= 4 -- Maximum number of PUCCH Resource Sets +maxNrofPUCCH-ResourceSets-1 INTEGER ::= 3 -- Maximum number of PUCCH Resource Sets minus 1. +maxNrofPUCCH-ResourcesPerSet INTEGER ::= 32 -- Maximum number of PUCCH Resources per PUCCH-ResourceSet +maxNrofPUCCH-ResourcesPerSet-1 INTEGER ::= 31 -- Maximum number of PUCCH Resources per PUCCH-ResourceSet minus 1. +maxNrofPUCCH-P0-PerSet INTEGER ::= 8 -- Maximum number of P0-pucch present in a p0-pucch set +maxNrofPUCCH-PathlossReferenceRSs INTEGER ::= 4 -- Maximum number of RSs used as pathloss reference for PUCCH power control. +maxNrofPUCCH-PathlossReferenceRSs-1 INTEGER ::= 3 -- Maximum number of RSs used as pathloss reference for PUCCH power control minus 1. + +maxNrofP0-PUSCH-AlphaSets INTEGER ::= 30 -- Maximum number of P0-pusch-alpha-sets (see 38,213, section 7.1) +maxNrofP0-PUSCH-AlphaSets-1 INTEGER ::= 29 -- Maximum number of P0-pusch-alpha-sets minus 1 (see 38,213, section 7.1) +maxNrofPUSCH-PathlossReferenceRSs INTEGER ::= 4 -- Maximum number of RSs used as pathloss reference for PUSCH power control. +maxNrofPUSCH-PathlossReferenceRSs-1 INTEGER ::= 3 -- Maximum number of RSs used as pathloss reference for PUSCH power control minus 1. + +maxBands INTEGER ::= 1024 -- Maximum number of supported bands in UE capability. +maxBandsMRDC INTEGER ::= 1280 +maxBandsEUTRA INTEGER ::= 256 +maxCellPrep INTEGER ::= 32 +maxCellReport INTEGER ::= 8 +maxDRB INTEGER ::= 29 -- Maximum number of DRBs (that can be added in DRB-ToAddModLIst). +maxFreq INTEGER ::= 8 -- Max number of non-serving frequencies in MeasResultSCG-Failure. +maxNrofCSI-RS INTEGER ::= 64 +maxNrofCandidateBeams INTEGER ::= 16 -- Max number of PRACH-ResourceDedicatedBFR that in BFR config. +maxNrofPCIsPerSMTC INTEGER ::= 64 -- Maximun number of PCIs per SMTC. +maxNrofQFIs INTEGER ::= 64 +maxNrofSR-Resources INTEGER ::= 8 -- Maximum number of SR resources per BWP in a cell. +maxNrofSlotFormatsPerCombination INTEGER ::= 256 +maxNrofSpatialRelationInfos INTEGER ::= 8 +maxNrofSRS-ResourcesPerSet INTEGER ::= 16 +maxNrofIndexesToReport INTEGER ::= 32 +maxNrofSSBs INTEGER ::= 64 -- Maximum number of SSB resources in a resource set. +maxNrofSSBs-1 INTEGER ::= 63 -- Maximum number of SSB resources in a resource set minus 1. + +maxNrofTCI-StatesPDCCH INTEGER ::= 64 +maxNrofTCI-States INTEGER ::= 64 -- Maximum number of TCI states. +maxNrofTCI-States-1 INTEGER ::= 63 -- Maximum number of TCI states minus 1. +maxNrofUL-Allocations INTEGER ::= 16 -- Maximum number of PUSCH time domain resource allocations. +maxQFI INTEGER ::= 63 +maxRA-CSIRS-Resources INTEGER ::= 96 +maxRA-OccasionsPerCSIRS INTEGER ::= 64 -- Maximum number of RA occasions for one CSI-RS +maxRA-Occasions-1 INTEGER ::= 511 -- Maximum number of RA occasions in the system +maxRA-SSB-Resources INTEGER ::= 64 +maxSCSs INTEGER ::= 5 +maxSecondaryCellGroups INTEGER ::= 3 +maxNrofServingCellsEUTRA INTEGER ::= 32 +maxMBSFN-Allocations INTEGER ::= 8 +maxNrofMultiBands INTEGER ::= 8 +maxCellSFTD INTEGER ::= 3 -- Maximum number of cells for SFTD reporting +maxReportConfigId INTEGER ::= 64 + +maxNrofSRI-PUSCH-Mappings INTEGER ::= 16 +maxNrofSRI-PUSCH-Mappings-1 INTEGER ::= 15 + +-- Editor’s Note: Targeted for completion in June 2018. Not used in EN-DC drop. +CellIdentity ::= ENUMERATED {ffsTypeAndValue} +ShortMAC-I ::= ENUMERATED {ffsTypeAndValue} + +-- TAG-MULTIPLICITY-AND-TYPE-CONSTRAINT-DEFINITIONS-STOP + +END + diff --git a/openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-UE-Variables.asn b/openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-UE-Variables.asn new file mode 100755 index 0000000000..3eeec31891 --- /dev/null +++ b/openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-UE-Variables.asn @@ -0,0 +1,46 @@ +NR-UE-Variables DEFINITIONS AUTOMATIC TAGS ::= + +BEGIN + +-- TAG-VAR-MEAS-CONFIG-START + +VarMeasConfig ::= SEQUENCE { + -- Measurement identities + measIdList MeasIdToAddModList OPTIONAL, + -- Measurement objects + measObjectList MeasObjectToAddModList OPTIONAL, + -- Reporting configurations + reportConfigList ReportConfigToAddModList OPTIONAL, + -- Other parameters + quantityConfig QuantityConfig OPTIONAL, + + s-MeasureConfig CHOICE { + ssb-RSRP RSRP-Range, + csi-RSRP RSRP-Range + } OPTIONAL + +} + +-- TAG-VAR-MEAS-CONFIG-STOP +-- TAG-VAR-MEAS-REPORT-START + +VarMeasReportList ::= SEQUENCE (SIZE (1..maxNrofMeasId)) OF VarMeasReport + +VarMeasReport ::= SEQUENCE { + -- List of measurement that have been triggered + measId MeasId, + cellsTriggeredList CellsTriggeredList OPTIONAL, + numberOfReportsSent INTEGER +} + +CellsTriggeredList ::= SEQUENCE (SIZE (1..maxNrofCellMeas)) OF CHOICE { + physCellId PhysCellId, +-- Not needed for EN-DC. + physCellIdEUTRA ENUMERATED {ffsTypeAndValue} + } + + +-- TAG-VAR-MEAS-REPORT-STOP + +END + diff --git a/openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/extract_asn1_from_spce.pl b/openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/extract_asn1_from_spce.pl new file mode 100755 index 0000000000..18f6792a8c --- /dev/null +++ b/openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/extract_asn1_from_spce.pl @@ -0,0 +1,82 @@ +#!/usr/bin/perl +# This script extracts the ASN1 definition from and TS 38.331 and generates 3 output files that can be processed by asn2wrs +# First download the specification from 3gpp.org as a word document and open it +# Then in "view" menu, select normal or web layout (needed to removed page header and footers) +# Finally save the document as a text file +# Call the script: "perl extract_asn1_from_spec.pl 38331-xxx.txt" +# It should generate: NR-RRC-Definitions.asn, NR-UE-Variables.asn and NR-InterNodeDefinitions +use warnings; +$input_file = $ARGV[0]; +$NR_def_output_file = "NR-RRC-Definitions.asn"; +$NR_var_output_file = "NR-UE-Variables.asn"; +$NR_internode_output_file = "NR-InterNodeDefinitions.asn"; + + +sub extract_asn1; + +open(INPUT_FILE, "< $input_file") or die "Can not open file $input_file"; + +while () { + + # Process the NR-RRC-Definitions section + if( m/NR-RRC-Definitions DEFINITIONS AUTOMATIC TAGS ::=/){ + open(OUTPUT_FILE, "> $NR_def_output_file") or die "Can not open file $def_output_file"; + syswrite OUTPUT_FILE,"$_ \n"; + syswrite OUTPUT_FILE,"BEGIN\n\n"; + + # Get all the text delimited by -- ASN1START and -- ASN1STOP + extract_asn1(); + + syswrite OUTPUT_FILE,"END\n\n"; + close(OUTPUT_FILE); + } + + # Process the NR-UE-Variables section + if( m/NR-UE-Variables DEFINITIONS AUTOMATIC TAGS ::=/){ + open(OUTPUT_FILE, "> $NR_var_output_file") or die "Can not open file $def_output_file"; + syswrite OUTPUT_FILE,"$_ \n"; + syswrite OUTPUT_FILE,"BEGIN\n\n"; + + # Get all the text delimited by -- ASN1START and -- ASN1STOP + extract_asn1(); + + syswrite OUTPUT_FILE,"END\n\n"; + close(OUTPUT_FILE); + } + # Process the NR-InterNodeDefinitions section + if( m/NR-InterNodeDefinitions DEFINITIONS AUTOMATIC TAGS ::=/){ + open(OUTPUT_FILE, "> $NR_internode_output_file") or die "Can not open file $def_output_file"; + syswrite OUTPUT_FILE,"$_ \n"; + syswrite OUTPUT_FILE,"BEGIN\n\n"; + + # Get all the text delimited by -- ASN1START and -- ASN1STOP + extract_asn1(); + + syswrite OUTPUT_FILE,"END\n\n"; + close(OUTPUT_FILE); + } + +} + +close(INPUT_FILE); + +# This subroutine copies the text delimited by -- ASN1START and -- ASN1STOP in INPUT_FILE +# and copies it into OUTPUT_FILE. +# It stops when it meets the keyword "END" +sub extract_asn1 { + my $line = ; + my $is_asn1 = 0; + + while(($line ne "END\n") && ($line ne "END\r\n")){ + if ($line =~ m/-- ASN1STOP/) { + $is_asn1 = 0; + } + if ($is_asn1 == 1){ + syswrite OUTPUT_FILE,"$line"; + } + if ($line =~ m/-- ASN1START/) { + $is_asn1 = 1; + } + $line = ; + } +} diff --git a/openair2/RRC/NR/defs_NR.h b/openair2/RRC/NR/defs_NR.h index 88d2510fb6..0a2b19f65c 100644 --- a/openair2/RRC/NR/defs_NR.h +++ b/openair2/RRC/NR/defs_NR.h @@ -92,7 +92,7 @@ typedef unsigned int uid_NR_t; typedef struct uid_linear_allocator_NR_s { unsigned int bitmap[UID_LINEAR_ALLOCATOR_BITMAP_SIZE_NR]; } uid_allocator_NR_t; - + #define PROTOCOL_RRC_CTXT_UE_FMT PROTOCOL_CTXT_FMT #define PROTOCOL_RRC_CTXT_UE_ARGS(CTXT_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp) @@ -391,9 +391,10 @@ typedef struct { // buffer that contains the encoded messages uint8_t *MIB_NR; uint8_t sizeof_MIB_NR; + + uint8_t *SIB1_NR; + uint8_t sizeof_SIB1_NR; /* - uint8_t *SIB1_NB_IoT; - uint8_t sizeof_SIB1_NB_IoT; uint8_t *SIB23_NB_IoT; uint8_t sizeof_SIB23_NB_IoT; */ @@ -425,7 +426,7 @@ typedef struct { uint32_t dl_CarrierFreq; //detected by the UE uint32_t ul_CarrierFreq; //detected by the UE uint16_t physCellId; //not stored in the MIB-NB but is getting through NPSS/NSSS - + //are the only static one (memory has been already allocated) BCCH_BCH_Message_t mib_NR; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index ef3658af07..75c6c195d1 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -89,7 +89,7 @@ #if defined(ENABLE_ITTI) # include "intertask_interface.h" #endif - + #if ENABLE_RAL # include "rrc_eNB_ral.h" #endif @@ -138,59 +138,54 @@ init_SI( const int CC_id #if defined(ENABLE_ITTI) , - RrcConfigurationReq * configuration + gNB_RrcConfigurationReq * configuration #endif ) //----------------------------------------------------------------------------- { -#if defined(Rel10) || defined(Rel14) int i; -#endif - -#ifdef Rel14 - SystemInformationBlockType1_v1310_IEs_t *sib1_v13ext=(SystemInformationBlockType1_v1310_IEs_t *)NULL; -#endif LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__); - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MIB = (uint8_t*) malloc16(4); // copy basic parameters - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId = configuration->Nid_cell[CC_id]; - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB = configuration->nb_antenna_ports[CC_id]; - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Ncp = configuration->prefix_type[CC_id]; - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq = configuration->downlink_frequency[CC_id]; - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].ul_CarrierFreq = configuration->downlink_frequency[CC_id]+ configuration->uplink_frequency_offset[CC_id]; -#ifdef Rel14 - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].pbch_repetition = configuration->pbch_repetition[CC_id]; -#endif - LOG_I(RRC, "Configuring MIB (N_RB_DL %d,phich_Resource %d,phich_Duration %d)\n", - (int)configuration->N_RB_DL[CC_id], - (int)configuration->phich_resource[CC_id], - (int)configuration->phich_duration[CC_id]); - do_MIB(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id], -#ifdef ENABLE_ITTI - configuration->N_RB_DL[CC_id], - configuration->phich_resource[CC_id], - configuration->phich_duration[CC_id] -#else - 50,0,0 -#endif - ,0); + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId = configuration->Nid_cell[CC_id]; + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB = configuration->nb_antenna_ports[CC_id]; + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].Ncp = configuration->prefix_type[CC_id]; + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq = configuration->downlink_frequency[CC_id]; + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].ul_CarrierFreq = configuration->downlink_frequency[CC_id]+ configuration->uplink_frequency_offset[CC_id]; + ///MIB + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_MIB_NR = 0; + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].MIB_NR = (uint8_t*) malloc16(4); + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_MIB_NR = do_MIB_NR(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],0, + #ifdef ENABLE_ITTI + configuration->ssb_SubcarrierOffset[CC_id], + configuration->pdcch_ConfigSIB1[CC_id], + configuration->subCarrierSpacingCommon[CC_id], + configuration->dmrs_TypeA_Position[CC_id] + #else + 0,0,15,2 + #endif + ); - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 = 0; + ///SIB1 + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1_NR = 0; + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1_NR = (uint8_t*) malloc16(32); + AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1_NR! = NULL,PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for NR SIB1 allocated\n",PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1_NR = do_SIB1_NR(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id], + ctxt_pP->module_id, + CC_id + #if defined(ENABLE_ITTI) + , configuration + #endif + ); + + AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 != 255,"FATAL, RC.nr_rrc[enb_mod_idP].carrier[CC_id].sizeof_SIB1_NR == 255"); + + +/* RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 = 0; - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1 = (uint8_t*) malloc16(32); - - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1!=NULL,PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for SIB1 allocated\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 = do_SIB1(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],ctxt_pP->module_id,CC_id -#if defined(ENABLE_ITTI) - , configuration -#endif - ); - - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 != 255,"FATAL, RC.rrc[enb_mod_idP].carrier[CC_id].sizeof_SIB1 == 255"); RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23 = (uint8_t*) malloc16(64); AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23!=NULL,"cannot allocate memory for SIB"); @@ -301,7 +296,7 @@ init_SI( #endif LOG_D(RRC, "About to call rrc_mac_config_req_eNB\n"); - +*/ rrc_mac_config_req_eNB(ctxt_pP->module_id, CC_id, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId, RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, From fa42fa81eb19b5287c472fef7b0be86628b73d7b Mon Sep 17 00:00:00 2001 From: WEI-TAI CHEN Date: Thu, 3 May 2018 10:48:52 -0700 Subject: [PATCH 06/13] maintain NR configuration --- openair2/COMMON/rrc_messages_types.h | 25 +- openair2/ENB_APP/NRRRC_paramsvalues.h | 24 +- openair2/ENB_APP/gnb_app.c | 156 +- openair2/ENB_APP/gnb_config.c | 394 +- openair2/ENB_APP/gnb_paramdef.h | 567 +- .../ASN1_files/NR-InterNodeDefinitions.asn | 282 - .../ans1c/ASN1_files/NR-RRC-Definitions.asn | 5480 ------------- .../ans1c/ASN1_files/NR-UE-Variables.asn | 46 - .../ASN1_files/extract_asn1_from_spce.pl | 82 - openair2/RRC/NR/defs_NR.h | 8 +- openair2/RRC/NR/rrc_gNB.c | 7239 +---------------- openair2/RRC/NR/rrc_types_NR.h | 12 +- .../CONF/enb.band7.tm1.50PRB.usrpb210.conf | 309 +- 13 files changed, 1154 insertions(+), 13470 deletions(-) delete mode 100755 openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-InterNodeDefinitions.asn delete mode 100755 openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-RRC-Definitions.asn delete mode 100755 openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-UE-Variables.asn delete mode 100755 openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/extract_asn1_from_spce.pl diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 86612d3b5b..8398b135b1 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -253,7 +253,8 @@ typedef struct NRRrcConfigurationReq_s { lte_frame_type_t frame_type[MAX_NUM_CCs]; uint8_t tdd_config[MAX_NUM_CCs]; uint8_t tdd_config_s[MAX_NUM_CCs]; - lte_prefix_type_t prefix_type[MAX_NUM_CCs]; + lte_prefix_type_t DL_prefix_type[MAX_NUM_CCs]; + lte_prefix_type_t UL_prefix_type[MAX_NUM_CCs]; int16_t eutra_band[MAX_NUM_CCs]; uint32_t downlink_frequency[MAX_NUM_CCs]; int32_t uplink_frequency_offset[MAX_NUM_CCs]; @@ -262,6 +263,15 @@ typedef struct NRRrcConfigurationReq_s { int nb_antenna_ports[MAX_NUM_CCs]; ///NR + //MIB + long MIB_subCarrierSpacingCommon[MAX_NUM_CCs]; + long MIB_dmrs_TypeA_Position[MAX_NUM_CCs]; + uint32_t pdcch_ConfigSIB1[MAX_NUM_CCs]; + + //SIB1 + long SIB1_frequencyOffsetSSB[MAX_NUM_CCs]; + long SIB1_ssb_PeriodicityServingCell[MAX_NUM_CCs]; + long SIB1_ss_PBCH_BlockPower[MAX_NUM_CCs]; //NR FrequencyInfoDL long absoluteFrequencySSB[MAX_NUM_CCs]; uint32_t ssb_SubcarrierOffset[MAX_NUM_CCs]; @@ -275,8 +285,7 @@ typedef struct NRRrcConfigurationReq_s { uint32_t DL_carrierBandwidth[MAX_NUM_CCs]; //NR BWP-DownlinkCommon - uint32_t DL_locationAndBandwidth[MAX_NUM_CCs]; - //NR_prefix_type_t DL_prefix_type[MAX_NUM_CCs]; + uint32_t DL_locationAndBandwidth[MAX_NUM_CCs]; //NR FrequencyInfoUL long UL_FreqBandIndicatorNR[MAX_NUM_CCs]; @@ -292,13 +301,11 @@ typedef struct NRRrcConfigurationReq_s { // NR BWP-UplinkCommon uint32_t UL_locationAndBandwidth[MAX_NUM_CCs]; - //NR_prefix_type_t UL_prefix_type[MAX_NUM_CCs]; - - long ssb_periodicityServingCell[MAX_NUM_CCs]; - long dmrs_TypeA_Position[MAX_NUM_CCs]; - long NIA_SubcarrierSpacing[MAX_NUM_CCs]; ///ServingCellConfigCommon Used only for non-initial access - long ss_PBCH_BlockPower[MAX_NUM_CCs]; + long ServingCellConfigCommon_ssb_periodicityServingCell[MAX_NUM_CCs]; //ServingCellConfigCommon + long ServingCellConfigCommon_dmrs_TypeA_Position[MAX_NUM_CCs]; //ServingCellConfigCommon + long NIA_SubcarrierSpacing[MAX_NUM_CCs]; //ServingCellConfigCommon Used only for non-initial access + long ServingCellConfigCommon_ss_PBCH_BlockPower[MAX_NUM_CCs]; //ServingCellConfigCommon //NR TDD-UL-DL-ConfigCommon diff --git a/openair2/ENB_APP/NRRRC_paramsvalues.h b/openair2/ENB_APP/NRRRC_paramsvalues.h index 2dfe59a726..aae1fc3300 100644 --- a/openair2/ENB_APP/NRRRC_paramsvalues.h +++ b/openair2/ENB_APP/NRRRC_paramsvalues.h @@ -32,21 +32,19 @@ #ifndef __NRRRC_PARAMSVALUES__H__ #define __NRRRC_PARAMSVALUES__H__ /* cell configuration section name */ -#define GNB_CONFIG_STRING_GNB_LIST "gNBs" +#define GNB_CONFIG_STRING_GNB_LIST "gNBs" /* component carriers configuration section name */ -#define GNB_CONFIG_STRING_COMPONENT_CARRIERS "component_carriers" +#define GNB_CONFIG_STRING_COMPONENT_CARRIERS "component_carriers" -#define GNB_CONFIG_STRING_FRAME_TYPE "frame_type" -#define GNB_CONFIG_STRING_TDD_CONFIG "tdd_config" -#define GNB_CONFIG_STRING_TDD_CONFIG_S "tdd_config_s" -#define GNB_CONFIG_STRING_PREFIX_TYPE "prefix_type" -#define GNB_CONFIG_STRING_PREFIX_TYPE_UL "prefix_type_UL" -#define GNB_CONFIG_STRING_EUTRA_BAND "eutra_band" -#define GNB_CONFIG_STRING_DOWNLINK_FREQUENCY "downlink_frequency" -#define GNB_CONFIG_STRING_UPLINK_FREQUENCY_OFFSET "uplink_frequency_offset" -#define GNB_CONFIG_STRING_NID_CELL "Nid_cell" -#define GNB_CONFIG_STRING_N_RB_DL "N_RB_DL" -#define GNB_CONFIG_STRING_CELL_MBSFN "Nid_cell_mbsfn" +#define GNB_CONFIG_STRING_FRAME_TYPE "frame_type" +#define GNB_CONFIG_STRING_DL_PREFIX_TYPE "DL_prefix_type" +#define GNB_CONFIG_STRING_UL_PREFIX_TYPE "UL_prefix_type" +#define GNB_CONFIG_STRING_EUTRA_BAND "eutra_band" +#define GNB_CONFIG_STRING_DOWNLINK_FREQUENCY "downlink_frequency" +#define GNB_CONFIG_STRING_UPLINK_FREQUENCY_OFFSET "uplink_frequency_offset" +#define GNB_CONFIG_STRING_NID_CELL "Nid_cell" +#define GNB_CONFIG_STRING_N_RB_DL "N_RB_DL" +#define GNB_CONFIG_STRING_CELL_MBSFN "Nid_cell_mbsfn" #define FRAMETYPE_OKVALUES {"FDD","TDD"} diff --git a/openair2/ENB_APP/gnb_app.c b/openair2/ENB_APP/gnb_app.c index ccef5e4663..12222a2515 100644 --- a/openair2/ENB_APP/gnb_app.c +++ b/openair2/ENB_APP/gnb_app.c @@ -55,7 +55,7 @@ extern RAN_CONTEXT_t RC; /*------------------------------------------------------------------------------*/ # if defined(ENABLE_USE_MME) -# define ENB_REGISTER_RETRY_DELAY 10 +# define GNB_REGISTER_RETRY_DELAY 10 # endif /*------------------------------------------------------------------------------*/ @@ -84,72 +84,72 @@ static void configure_phy(module_id_t enb_id, const Enb_properties_array_t* enb_ */ /*------------------------------------------------------------------------------*/ -static void configure_rrc(uint32_t enb_id) +static void configure_nrrrc(uint32_t gnb_id) { MessageDef *msg_p = NULL; // int CC_id; - msg_p = itti_alloc_new_message (TASK_ENB_APP, RRC_CONFIGURATION_REQ); + msg_p = itti_alloc_new_message (TASK_GNB_APP, NRRRC_CONFIGURATION_REQ); - if (RC.rrc[enb_id]) { - RCconfig_NRRRC(msg_p,enb_id, RC.rrc[enb_id]); + if (RC.nr_rrc[gnb_id]) { + RCconfig_NRRRC(msg_p,gnb_id, RC.nr_rrc[gnb_id]); - LOG_I(ENB_APP,"Sending configuration message to RRC task\n"); - itti_send_msg_to_task (TASK_RRC_GNB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); + LOG_I(GNB_APP,"Sending configuration message to NR_RRC task\n"); + itti_send_msg_to_task (TASK_RRC_GNB, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p); } - else AssertFatal(0,"RRC context for eNB %d not allocated\n",enb_id); + else AssertFatal(0,"NRRRC context for gNB %d not allocated\n",gnb_id); } /*------------------------------------------------------------------------------*/ # if defined(ENABLE_USE_MME) -static uint32_t eNB_app_register(uint32_t enb_id_start, uint32_t enb_id_end)//, const Enb_properties_array_t *enb_properties) +static uint32_t gNB_app_register(uint32_t gnb_id_start, uint32_t gnb_id_end)//, const Enb_properties_array_t *enb_properties) { - uint32_t enb_id; + uint32_t gnb_id; MessageDef *msg_p; - uint32_t register_enb_pending = 0; + uint32_t register_gnb_pending = 0; - for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { + for (gnb_id = gnb_id_start; (gnb_id < gnb_id_end) ; gnb_id++) { { - s1ap_register_enb_req_t *s1ap_register_eNB; + s1ap_register_gnb_req_t *s1ap_register_gNB; /* note: there is an implicit relationship between the data structure and the message name */ - msg_p = itti_alloc_new_message (TASK_ENB_APP, S1AP_REGISTER_ENB_REQ); + msg_p = itti_alloc_new_message (TASK_GNB_APP, S1AP_REGISTER_GNB_REQ); - RCconfig_S1(msg_p, enb_id); + RCconfig_S1(msg_p, gnb_id); - if (enb_id == 0) RCconfig_gtpu(); + if (gnb_id == 0) RCconfig_gtpu(); - s1ap_register_eNB = &S1AP_REGISTER_ENB_REQ(msg_p); - LOG_I(ENB_APP,"default drx %d\n",s1ap_register_eNB->default_drx); + s1ap_register_gNB = &S1AP_REGISTER_GNB_REQ(msg_p); + LOG_I(GNB_APP,"default drx %d\n",s1ap_register_gNB->default_drx); - LOG_I(ENB_APP,"[eNB %d] eNB_app_register for instance %d\n", enb_id, ENB_MODULE_ID_TO_INSTANCE(enb_id)); + LOG_I(GNB_APP,"[gNB %d] gNB_app_register for instance %d\n", gnb_id, GNB_MODULE_ID_TO_INSTANCE(gnb_id)); - itti_send_msg_to_task (TASK_S1AP, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p); + itti_send_msg_to_task (TASK_S1AP, GNB_MODULE_ID_TO_INSTANCE(gnb_id), msg_p); - register_enb_pending++; + register_gnb_pending++; } } - return register_enb_pending; + return register_gnb_pending; } # endif #endif /*------------------------------------------------------------------------------*/ -void *eNB_app_task(void *args_p) +void *gNB_app_task(void *args_p) { #if defined(ENABLE_ITTI) - uint32_t enb_nb = RC.nb_inst; - uint32_t enb_id_start = 0; - uint32_t enb_id_end = enb_id_start + enb_nb; + uint32_t gnb_nb = RC.nb_nr_inst; + uint32_t gnb_id_start = 0; + uint32_t gnb_id_end = gnb_id_start + gnb_nb; # if defined(ENABLE_USE_MME) - uint32_t register_enb_pending; - uint32_t registered_enb; - long enb_register_retry_timer_id; + uint32_t register_gnb_pending; + uint32_t registered_gnb; + long gnb_register_retry_timer_id; # endif - uint32_t enb_id; + uint32_t gnb_id; MessageDef *msg_p = NULL; const char *msg_name = NULL; instance_t instance; @@ -157,99 +157,99 @@ void *eNB_app_task(void *args_p) /* for no gcc warnings */ (void)instance; - itti_mark_task_ready (TASK_ENB_APP); + itti_mark_task_ready (TASK_GNB_APP); LOG_I(PHY, "%s() Task ready initialise structures\n", __FUNCTION__); - RCconfig_L1(); + //RCconfig_L1(); - RCconfig_macrlc(); + //RCconfig_macrlc(); LOG_I(PHY, "%s() RC.nb_L1_inst:%d\n", __FUNCTION__, RC.nb_L1_inst); - if (RC.nb_L1_inst>0) AssertFatal(l1_north_init_eNB()==0,"could not initialize L1 north interface\n"); + if (RC.nb_L1_inst>0) AssertFatal(l1_north_init_gNB()==0,"could not initialize L1 north interface\n"); - AssertFatal (enb_nb <= RC.nb_inst, - "Number of eNB is greater than eNB defined in configuration file (%d/%d)!", - enb_nb, RC.nb_inst); + AssertFatal (gnb_nb <= RC.nb_nr_inst, + "Number of gNB is greater than gNB defined in configuration file (%d/%d)!", + gnb_nb, RC.nb_nr_inst); - LOG_I(ENB_APP,"Allocating eNB_RRC_INST for %d instances\n",RC.nb_inst); + LOG_I(GNB_APP,"Allocating gNB_RRC_INST for %d instances\n",RC.nb_nr_inst); - RC.rrc = (eNB_RRC_INST **)malloc(RC.nb_inst*sizeof(eNB_RRC_INST *)); - LOG_I(PHY, "%s() RC.nb_inst:%d RC.rrc:%p\n", __FUNCTION__, RC.nb_inst, RC.rrc); + RC.rrc = (gNB_RRC_INST **)malloc(RC.nb_nr_inst*sizeof(gNB_RRC_INST *)); + LOG_I(PHY, "%s() RC.nb_nr_inst:%d RC.rrc:%p\n", __FUNCTION__, RC.nb_nr_inst, RC.rrc); - for (enb_id = enb_id_start; (enb_id < enb_id_end) ; enb_id++) { - RC.rrc[enb_id] = (eNB_RRC_INST*)malloc(sizeof(eNB_RRC_INST)); - LOG_I(PHY, "%s() Creating RRC instance RC.rrc[%d]:%p (%d of %d)\n", __FUNCTION__, enb_id, RC.rrc[enb_id], enb_id+1, enb_id_end); - memset((void *)RC.rrc[enb_id],0,sizeof(eNB_RRC_INST)); - configure_rrc(enb_id); + for (gnb_id = gnb_id_start; (gnb_id < gnb_id_end) ; gnb_id++) { + RC.rrc[gnb_id] = (gNB_RRC_INST*)malloc(sizeof(gNB_RRC_INST)); + LOG_I(PHY, "%s() Creating RRC instance RC.rrc[%d]:%p (%d of %d)\n", __FUNCTION__, gnb_id, RC.rrc[gnb_id], gnb_id+1, gnb_id_end); + memset((void *)RC.rrc[gnb_id],0,sizeof(gNB_RRC_INST)); + configure_nrrrc(gnb_id); } # if defined(ENABLE_USE_MME) - /* Try to register each eNB */ - registered_enb = 0; - register_enb_pending = eNB_app_register (enb_id_start, enb_id_end);//, enb_properties_p); + /* Try to register each gNB */ + registered_gnb = 0; + register_gnb_pending = gNB_app_register (gnb_id_start, gnb_id_end);//, gnb_properties_p); # else /* Start L2L1 task */ - msg_p = itti_alloc_new_message(TASK_ENB_APP, INITIALIZE_MESSAGE); + msg_p = itti_alloc_new_message(TASK_GNB_APP, INITIALIZE_MESSAGE); itti_send_msg_to_task(TASK_L2L1, INSTANCE_DEFAULT, msg_p); # endif do { // Wait for a message - itti_receive_msg (TASK_ENB_APP, &msg_p); + itti_receive_msg (TASK_GNB_APP, &msg_p); msg_name = ITTI_MSG_NAME (msg_p); instance = ITTI_MSG_INSTANCE (msg_p); switch (ITTI_MSG_ID(msg_p)) { case TERMINATE_MESSAGE: - LOG_W(ENB_APP, " *** Exiting ENB_APP thread\n"); + LOG_W(GNB_APP, " *** Exiting GNB_APP thread\n"); itti_exit_task (); break; case MESSAGE_TEST: - LOG_I(ENB_APP, "Received %s\n", ITTI_MSG_NAME(msg_p)); + LOG_I(GNB_APP, "Received %s\n", ITTI_MSG_NAME(msg_p)); break; # if defined(ENABLE_USE_MME) case S1AP_REGISTER_ENB_CNF: - LOG_I(ENB_APP, "[eNB %d] Received %s: associated MME %d\n", instance, msg_name, + LOG_I(GNB_APP, "[gNB %d] Received %s: associated MME %d\n", instance, msg_name, S1AP_REGISTER_ENB_CNF(msg_p).nb_mme); - DevAssert(register_enb_pending > 0); - register_enb_pending--; + DevAssert(register_gnb_pending > 0); + register_gnb_pending--; - /* Check if at least eNB is registered with one MME */ + /* Check if at least gNB is registered with one MME */ if (S1AP_REGISTER_ENB_CNF(msg_p).nb_mme > 0) { - registered_enb++; + registered_gnb++; } - /* Check if all register eNB requests have been processed */ - if (register_enb_pending == 0) { - if (registered_enb == enb_nb) { - /* If all eNB are registered, start L2L1 task */ + /* Check if all register gNB requests have been processed */ + if (register_gnb_pending == 0) { + if (registered_gnb == gnb_nb) { + /* If all gNB are registered, start L2L1 task */ MessageDef *msg_init_p; - msg_init_p = itti_alloc_new_message (TASK_ENB_APP, INITIALIZE_MESSAGE); + msg_init_p = itti_alloc_new_message (TASK_GNB_APP, INITIALIZE_MESSAGE); itti_send_msg_to_task (TASK_L2L1, INSTANCE_DEFAULT, msg_init_p); } else { - uint32_t not_associated = enb_nb - registered_enb; + uint32_t not_associated = gnb_nb - registered_gnb; - LOG_W(ENB_APP, " %d eNB %s not associated with a MME, retrying registration in %d seconds ...\n", - not_associated, not_associated > 1 ? "are" : "is", ENB_REGISTER_RETRY_DELAY); + LOG_W(GNB_APP, " %d gNB %s not associated with a MME, retrying registration in %d seconds ...\n", + not_associated, not_associated > 1 ? "are" : "is", GNB_REGISTER_RETRY_DELAY); - /* Restart the eNB registration process in ENB_REGISTER_RETRY_DELAY seconds */ - if (timer_setup (ENB_REGISTER_RETRY_DELAY, 0, TASK_ENB_APP, INSTANCE_DEFAULT, TIMER_ONE_SHOT, - NULL, &enb_register_retry_timer_id) < 0) { - LOG_E(ENB_APP, " Can not start eNB register retry timer, use \"sleep\" instead!\n"); + /* Restart the gNB registration process in GNB_REGISTER_RETRY_DELAY seconds */ + if (timer_setup (GNB_REGISTER_RETRY_DELAY, 0, TASK_GNB_APP, INSTANCE_DEFAULT, TIMER_ONE_SHOT, + NULL, &gnb_register_retry_timer_id) < 0) { + LOG_E(GNB_APP, " Can not start gNB register retry timer, use \"sleep\" instead!\n"); - sleep(ENB_REGISTER_RETRY_DELAY); + sleep(GNB_REGISTER_RETRY_DELAY); /* Restart the registration process */ - registered_enb = 0; - register_enb_pending = eNB_app_register (enb_id_start, enb_id_end);//, enb_properties_p); + registered_gnb = 0; + register_gnb_pending = gNB_app_register (gnb_id_start, gnb_id_end);//, gnb_properties_p); } } } @@ -257,26 +257,26 @@ void *eNB_app_task(void *args_p) break; case S1AP_DEREGISTERED_ENB_IND: - LOG_W(ENB_APP, "[eNB %d] Received %s: associated MME %d\n", instance, msg_name, + LOG_W(GNB_APP, "[gNB %d] Received %s: associated MME %d\n", instance, msg_name, S1AP_DEREGISTERED_ENB_IND(msg_p).nb_mme); /* TODO handle recovering of registration */ break; case TIMER_HAS_EXPIRED: - LOG_I(ENB_APP, " Received %s: timer_id %ld\n", msg_name, TIMER_HAS_EXPIRED(msg_p).timer_id); + LOG_I(GNB_APP, " Received %s: timer_id %ld\n", msg_name, TIMER_HAS_EXPIRED(msg_p).timer_id); - if (TIMER_HAS_EXPIRED (msg_p).timer_id == enb_register_retry_timer_id) { + if (TIMER_HAS_EXPIRED (msg_p).timer_id == gnb_register_retry_timer_id) { /* Restart the registration process */ - registered_enb = 0; - register_enb_pending = eNB_app_register (enb_id_start, enb_id_end);//, enb_properties_p); + registered_gnb = 0; + register_gnb_pending = gNB_app_register(gnb_id_start, gnb_id_end);//, gnb_properties_p); } break; # endif default: - LOG_E(ENB_APP, "Received unexpected message %s\n", msg_name); + LOG_E(GNB_APP, "Received unexpected message %s\n", msg_name); break; } diff --git a/openair2/ENB_APP/gnb_config.c b/openair2/ENB_APP/gnb_config.c index 9e341cd7ef..08273aca8d 100644 --- a/openair2/ENB_APP/gnb_config.c +++ b/openair2/ENB_APP/gnb_config.c @@ -32,184 +32,193 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { - int num_gnbs = 0; - int num_component_carriers = 0; - int j,k = 0; - int32_t gnb_id = 0; + int num_gnbs = 0; + int num_component_carriers = 0; + int j,k = 0; + int32_t gnb_id = 0; - int nb_cc = 0; - char* frame_type = NULL; - char* prefix_type = NULL; + int nb_cc = 0; + char* frame_type = NULL; + char* DL_prefix_type = NULL; + char* UL_prefix_type = NULL; - int32_t eutra_band = 0; - long long int downlink_frequency = 0; - int32_t uplink_frequency_offset = 0; - int32_t Nid_cell = 0; -// int32_t Nid_cell_mbsfn = 0; - int32_t N_RB_DL = 0; - int32_t nb_antenna_ports = 0; + int32_t eutra_band = 0; + long long int downlink_frequency = 0; + int32_t uplink_frequency_offset = 0; + int32_t Nid_cell = 0; + int32_t N_RB_DL = 0; + int32_t nb_antenna_ports = 0; ///NR + //MIB + int32_t MIB_subCarrierSpacingCommon = 0; + int32_t MIB_dmrs_TypeA_Position = 0; + uint32_t pdcch_ConfigSIB1 = 0; + + //SIB1 + int32_t SIB1_frequencyOffsetSSB = 0; + int32_t SIB1_ssb_PeriodicityServingCell = 0; + int32_t SIB1_ss_PBCH_BlockPower = 0; //NR FrequencyInfoDL - long absoluteFrequencySSB = 0; - uint32_t ssb_SubcarrierOffset = 0; - long DL_FreqBandIndicatorNR = 0; - long DL_absoluteFrequencyPointA = 0; + int32_t absoluteFrequencySSB = 0; + uint32_t ssb_SubcarrierOffset = 0; + int32_t DL_FreqBandIndicatorNR = 0; + int32_t DL_absoluteFrequencyPointA = 0; //NR DL SCS-SpecificCarrier - uint32_t DL_offsetToCarrier = 0; - long DL_SubcarrierSpacing = 0; - long DL_SCS_SpecificCarrier_k0 = 0; - uint32_t DL_carrierBandwidth = 0; + uint32_t DL_offsetToCarrier = 0; + int32_t DL_SubcarrierSpacing = 0; + int32_t DL_SCS_SpecificCarrier_k0 = 0; + uint32_t DL_carrierBandwidth = 0; // NR BWP-DownlinkCommon - uint32_t DL_locationAndBandwidth = 0; - //NR_prefix_type_t DL_prefix_type[MAX_NUM_CCs]; + uint32_t DL_locationAndBandwidth = 0; //NR FrequencyInfoUL - long UL_FreqBandIndicatorNR = 0; - long UL_absoluteFrequencyPointA = 0; - long FrequencyInfoUL_p_Max = 0; - long frequencyShift7p5khz = 0; + int32_t UL_FreqBandIndicatorNR = 0; + int32_t UL_absoluteFrequencyPointA = 0; + int32_t FrequencyInfoUL_p_Max = 0; + int32_t frequencyShift7p5khz = 0; //NR UL SCS-SpecificCarrier - uint32_t UL_offsetToCarrier = 0; - long UL_SubcarrierSpacing = 0; - long UL_SCS_SpecificCarrier_k0 = 0; - uint32_t UL_carrierBandwidth = 0; + uint32_t UL_offsetToCarrier = 0; + int32_t UL_SubcarrierSpacing = 0; + int32_t UL_SCS_SpecificCarrier_k0 = 0; + uint32_t UL_carrierBandwidth = 0; // NR BWP-UplinkCommon - uint32_t UL_locationAndBandwidth = 0; - //NR_prefix_type_t UL_prefix_type; + uint32_t UL_locationAndBandwidth = 0; - - long ssb_periodicityServingCell = 0; - long dmrs_TypeA_Position = 0; - long NIA_SubcarrierSpacing = 0; - long ss_PBCH_BlockPower = 0; + int32_t subCarrierSpacingCommon = 0; + uint32_t pdcch_ConfigSIB1 = 0; + int32_t frequencyOffsetSSB = 0; + int32_t ServingCellConfigCommon_ssb_periodicityServingCell = 0; + int32_t ServingCellConfigCommon_dmrs_TypeA_Position = 0; + int32_t NIA_SubcarrierSpacing = 0; + int32_t ServingCellConfigCommon_ss_PBCH_BlockPower = 0; //NR TDD-UL-DL-ConfigCommon - long referenceSubcarrierSpacing = 0; - long dl_UL_TransmissionPeriodicity = 0; - long nrofDownlinkSlots = 0; - long nrofDownlinkSymbols = 0; - long nrofUplinkSlots = 0; - long nrofUplinkSymbols = 0; + int32_t referenceSubcarrierSpacing = 0; + int32_t dl_UL_TransmissionPeriodicity = 0; + int32_t nrofDownlinkSlots = 0; + int32_t nrofDownlinkSymbols = 0; + int32_t nrofUplinkSlots = 0; + int32_t nrofUplinkSymbols = 0; //NR RACH-ConfigCommon - long rach_totalNumberOfRA_Preambles = 0; - long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice = 0; - long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth = 0; - long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth = 0; - long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf = 0; - long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one = 0; - long rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two = 0; - uint32_t rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_four = 0; - uint32_t rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_eight = 0; - uint32_t rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_sixteen = 0; - char* rach_groupBconfigured = NULL; - long rach_ra_Msg3SizeGroupA = 0; - long rach_messagePowerOffsetGroupB = 0; - long rach_numberOfRA_PreamblesGroupA = 0; - long rach_ra_ContentionResolutionTimer = 0; - long rsrp_ThresholdSSB = 0; - long rsrp_ThresholdSSB_SUL = 0; - long prach_RootSequenceIndex_choice = 0; - uint32_t prach_RootSequenceIndex_l839 = 0; - uint32_t prach_RootSequenceIndex_l139 = 0; - long prach_msg1_SubcarrierSpacing = 0; - long restrictedSetConfig = 0; - long msg3_transformPrecoding = 0; + int32_t rach_totalNumberOfRA_Preambles = 0; + int32_t rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice = 0; + int32_t rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth = 0; + int32_t rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth = 0; + int32_t rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf = 0; + int32_t rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one = 0; + int32_t rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two = 0; + uint32_t rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_four = 0; + uint32_t rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_eight = 0; + uint32_t rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_sixteen = 0; + char* rach_groupBconfigured = NULL; + int32_t rach_ra_Msg3SizeGroupA = 0; + int32_t rach_messagePowerOffsetGroupB = 0; + int32_t rach_numberOfRA_PreamblesGroupA = 0; + int32_t rach_ra_ContentionResolutionTimer = 0; + int32_t rsrp_ThresholdSSB = 0; + int32_t rsrp_ThresholdSSB_SUL = 0; + int32_t prach_RootSequenceIndex_choice = 0; + uint32_t prach_RootSequenceIndex_l839 = 0; + uint32_t prach_RootSequenceIndex_l139 = 0; + int32_t prach_msg1_SubcarrierSpacing = 0; + int32_t restrictedSetConfig = 0; + int32_t msg3_transformPrecoding = 0; //ssb-perRACH-OccasionAndCB-PreamblesPerSSB not sure //NR RACH-ConfigGeneric - long prach_ConfigurationIndex = 0; - long prach_msg1_FDM = 0; - long prach_msg1_FrequencyStart = 0; - long zeroCorrelationZoneConfig = 0; - long preambleReceivedTargetPower = 0; - long preambleTransMax = 0; - long powerRampingStep = 0; - long ra_ResponseWindow = 0; + int32_t prach_ConfigurationIndex = 0; + int32_t prach_msg1_FDM = 0; + int32_t prach_msg1_FrequencyStart = 0; + int32_t zeroCorrelationZoneConfig = 0; + int32_t preambleReceivedTargetPower = 0; + int32_t preambleTransMax = 0; + int32_t powerRampingStep = 0; + int32_t ra_ResponseWindow = 0; //PUSCH-ConfigCommon - char* groupHoppingEnabledTransformPrecoding = NULL; - long msg3_DeltaPreamble = 0; - long p0_NominalWithGrant = 0; + char* groupHoppingEnabledTransformPrecoding = NULL; + int32_t msg3_DeltaPreamble = 0; + int32_t p0_NominalWithGrant = 0; ///PUSCH-TimeDomainResourceAllocation - long PUSCH_TimeDomainResourceAllocation_k2 = 0; - long PUSCH_TimeDomainResourceAllocation_mappingType = 0; + int32_t PUSCH_TimeDomainResourceAllocation_k2 = 0; + int32_t PUSCH_TimeDomainResourceAllocation_mappingType = 0; //PUCCH-ConfigCommon - long pucch_GroupHopping = 0; - long p0_nominal = 0; + int32_t pucch_GroupHopping = 0; + int32_t p0_nominal = 0; //PDSCH-ConfigCOmmon //PDSCH-TimeDomainResourceAllocation - long PDSCH_TimeDomainResourceAllocation_k0 = 0; - long PDSCH_TimeDomainResourceAllocation_mappingType = 0; + int32_t PDSCH_TimeDomainResourceAllocation_k0 = 0; + int32_t PDSCH_TimeDomainResourceAllocation_mappingType = 0; //RateMatchPattern is used to configure one rate matching pattern for PDSCH - long rateMatchPatternId = 0; - long RateMatchPattern_patternType = 0; - long symbolsInResourceBlock = 0; - long periodicityAndPattern = 0; - long RateMatchPattern_controlResourceSet = 0; - long RateMatchPattern_subcarrierSpacing = 0; - long RateMatchPattern_mode = 0; + int32_t rateMatchPatternId = 0; + int32_t RateMatchPattern_patternType = 0; + int32_t symbolsInResourceBlock = 0; + int32_t periodicityAndPattern = 0; + int32_t RateMatchPattern_controlResourceSet = 0; + int32_t RateMatchPattern_subcarrierSpacing = 0; + int32_t RateMatchPattern_mode = 0; //PDCCH-ConfigCommon - long searchSpaceSIB1 = 0; - long searchSpaceOtherSystemInformation = 0; - long pagingSearchSpace = 0; - long ra_SearchSpace = 0; - long rach_ra_ControlResourceSet = 0; + int32_t searchSpaceSIB1 = 0; + int32_t searchSpaceOtherSystemInformation = 0; + int32_t pagingSearchSpace = 0; + int32_t ra_SearchSpace = 0; + int32_t rach_ra_ControlResourceSet = 0; //NR PDCCH-ConfigCommon commonControlResourcesSets - long PDCCH_common_controlResourceSetId = 0; - long PDCCH_common_ControlResourceSet_duration = 0; - long PDCCH_cce_REG_MappingType = 0; - long PDCCH_reg_BundleSize = 0; - long PDCCH_interleaverSize = 0; - long PDCCH_shiftIndex = 0; - long PDCCH_precoderGranularity = 0; - char* tci_PresentInDCI = NULL; + int32_t PDCCH_common_controlResourceSetId = 0; + int32_t PDCCH_common_ControlResourceSet_duration = 0; + int32_t PDCCH_cce_REG_MappingType = 0; + int32_t PDCCH_reg_BundleSize = 0; + int32_t PDCCH_interleaverSize = 0; + int32_t PDCCH_shiftIndex = 0; + int32_t PDCCH_precoderGranularity = 0; + char* tci_PresentInDCI = NULL; //NR PDCCH-ConfigCommon commonSearchSpaces - long SearchSpaceId = 0; - long commonSearchSpaces_controlResourceSetId = 0; - long SearchSpace_monitoringSlotPeriodicityAndOffset_choice = 0; - long SearchSpace_monitoringSlotPeriodicityAndOffset_sl1 = 0; - long SearchSpace_monitoringSlotPeriodicityAndOffset_sl2 = 0; - long SearchSpace_monitoringSlotPeriodicityAndOffset_sl4 = 0; - long SearchSpace_monitoringSlotPeriodicityAndOffset_sl5 = 0; - long SearchSpace_monitoringSlotPeriodicityAndOffset_sl8 = 0; - long SearchSpace_monitoringSlotPeriodicityAndOffset_sl10 = 0; - long SearchSpace_monitoringSlotPeriodicityAndOffset_sl16 = 0; - long SearchSpace_monitoringSlotPeriodicityAndOffset_sl20 = 0; - long SearchSpace_nrofCandidates_aggregationLevel1 = 0; - long SearchSpace_nrofCandidates_aggregationLevel2 = 0; - long SearchSpace_nrofCandidates_aggregationLevel4 = 0; - long SearchSpace_nrofCandidates_aggregationLevel8 = 0; - long SearchSpace_nrofCandidates_aggregationLevel16 = 0; - long SearchSpace_searchSpaceType = 0; - long Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel1 = 0; - long Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel2 = 0; - long Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel4 = 0; - long Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel8 = 0; - long Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel16 = 0; - long Common_dci_Format2_3_monitoringPeriodicity = 0; - long Common_dci_Format2_3_nrofPDCCH_Candidates = 0; - long ue_Specific__dci_Formats = 0; + int32_t SearchSpaceId = 0; + int32_t commonSearchSpaces_controlResourceSetId = 0; + int32_t SearchSpace_monitoringSlotPeriodicityAndOffset_choice = 0; + int32_t SearchSpace_monitoringSlotPeriodicityAndOffset_sl1 = 0; + int32_t SearchSpace_monitoringSlotPeriodicityAndOffset_sl2 = 0; + int32_t SearchSpace_monitoringSlotPeriodicityAndOffset_sl4 = 0; + int32_t SearchSpace_monitoringSlotPeriodicityAndOffset_sl5 = 0; + int32_t SearchSpace_monitoringSlotPeriodicityAndOffset_sl8 = 0; + int32_t SearchSpace_monitoringSlotPeriodicityAndOffset_sl10 = 0; + int32_t SearchSpace_monitoringSlotPeriodicityAndOffset_sl16 = 0; + int32_t SearchSpace_monitoringSlotPeriodicityAndOffset_sl20 = 0; + int32_t SearchSpace_nrofCandidates_aggregationLevel1 = 0; + int32_t SearchSpace_nrofCandidates_aggregationLevel2 = 0; + int32_t SearchSpace_nrofCandidates_aggregationLevel4 = 0; + int32_t SearchSpace_nrofCandidates_aggregationLevel8 = 0; + int32_t SearchSpace_nrofCandidates_aggregationLevel16 = 0; + int32_t SearchSpace_searchSpaceType = 0; + int32_t Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel1 = 0; + int32_t Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel2 = 0; + int32_t Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel4 = 0; + int32_t Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel8 = 0; + int32_t Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel16 = 0; + int32_t Common_dci_Format2_3_monitoringPeriodicity = 0; + int32_t Common_dci_Format2_3_nrofPDCCH_Candidates = 0; + int32_t ue_Specific__dci_Formats = 0; - int32_t my_int; + int32_t my_int; paramdef_t GNBSParams[] = GNBSPARAMS_DESC; - + ////////// Identification parameters paramdef_t GNBParams[] = GNBPARAMS_DESC; paramlist_def_t GNBParamList = {GNB_CONFIG_STRING_GNB_LIST,NULL,0}; - + ////////// Physical parameters checkedparam_t config_check_CCparams[] = CCPARAMS_CHECK; paramdef_t CCsParams[] = CCPARAMS_DESC; paramlist_def_t CCsParamList = {GNB_CONFIG_STRING_COMPONENT_CARRIERS,NULL,0}; @@ -217,7 +226,7 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { paramdef_t SRB1Params[] = SRB1PARAMS_DESC; /* get global parameters, defined outside any section in the config file */ - + config_get( GNBSParams,sizeof(GNBSParams)/sizeof(paramdef_t),NULL); num_gnbs = GNBSParams[GNB_ACTIVE_GNBS_IDX].numelt; AssertFatal (i0) { - // Output a list of all gNBs. + // Output a list of all gNBs. ////////// Identification parameters config_getlist( &GNBParamList,GNBParams,sizeof(GNBParams)/sizeof(paramdef_t),NULL); if (GNBParamList.paramarray[i][GNB_GNB_ID_IDX].uptr == NULL) { @@ -316,18 +325,30 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { // "Failed to parse gNB configuration file %s, gnb %d illegal tdd_config_s %d (should be 0-%d)!", // RC.config_file_name, i, tdd_config_s, TDD_Config__specialSubframePatterns_ssp8); - if (!prefix_type){ + if (!DL_prefix_type){ AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d define %s: NORMAL,EXTENDED!\n", - RC.config_file_name, i, GNB_CONFIG_STRING_PREFIX_TYPE); - }else if (strcmp(prefix_type, "NORMAL") == 0) { - NRRRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = NORMAL; - }else if (strcmp(prefix_type, "EXTENDED") == 0) { - NRRRC_CONFIGURATION_REQ (msg_p).prefix_type[j] = EXTENDED; + RC.config_file_name, i, GNB_CONFIG_STRING_DL_PREFIX_TYPE); + }else if (strcmp(DL_prefix_type, "NORMAL") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).DL_prefix_type[j] = NORMAL; + }else if (strcmp(DL_prefix_type, "EXTENDED") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).DL_prefix_type[j] = EXTENDED; }else { - AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for prefix_type choice: NORMAL or EXTENDED !\n", - RC.config_file_name, i, prefix_type); + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for DL_prefix_type choice: NORMAL or EXTENDED !\n", + RC.config_file_name, i, DL_prefix_type); } + if (!UL_prefix_type){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d define %s: NORMAL,EXTENDED!\n", + RC.config_file_name, i, GNB_CONFIG_STRING_UL_PREFIX_TYPE); + }else if (strcmp(UL_prefix_type, "NORMAL") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).UL_prefix_type[j] = NORMAL; + }else if (strcmp(UL_prefix_type, "EXTENDED") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).UL_prefix_type[j] = EXTENDED; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for UL_prefix_type choice: NORMAL or EXTENDED !\n", + RC.config_file_name, i, UL_prefix_type); + } + NRRRC_CONFIGURATION_REQ (msg_p).eutra_band[j] = eutra_band; NRRRC_CONFIGURATION_REQ (msg_p).downlink_frequency[j] = (uint32_t) downlink_frequency; NRRRC_CONFIGURATION_REQ (msg_p).uplink_frequency_offset[j] = (unsigned int) uplink_frequency_offset; @@ -388,11 +409,57 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { //////////////////////////////////////////////////////////////////////////////// //---------------------------NR--------Configuration--------------------------// //////////////////////////////////////////////////////////////////////////////// + /////////////////////////////////MIB/////////////////////////////// + NRRRC_CONFIGURATION_REQ (msg_p).MIB_subCarrierSpacingCommon[j] = MIB_subCarrierSpacingCommon; + if ((MIB_subCarrierSpacingCommon !=15) && (MIB_subCarrierSpacingCommon !=30) && (MIB_subCarrierSpacingCommon !=60) && (MIB_subCarrierSpacingCommon !=120)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for MIB_subCarrierSpacingCommon choice: 15,30,60,120 !\n", + RC.config_file_name, i, MIB_subCarrierSpacingCommon); + } + + NRRRC_CONFIGURATION_REQ (msg_p).MIB_dmrs_TypeA_Position[j] = MIB_dmrs_TypeA_Position; + if ((MIB_dmrs_TypeA_Position !=2) && (MIB_dmrs_TypeA_Position !=3)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for MIB_dmrs_TypeA_Position choice:2,3 !\n", + RC.config_file_name, i, MIB_dmrs_TypeA_Position); + } + + NRRRC_CONFIGURATION_REQ (msg_p).pdcch_ConfigSIB1[j] = pdcch_ConfigSIB1; + if ((pdcch_ConfigSIB1 <0) || (pdcch_ConfigSIB1 > 255)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for pdcch_ConfigSIB1 choice: 0..3279165 !\n", + RC.config_file_name, i, pdcch_ConfigSIB1); + } + + ////////////////////////////////SIB1////////////////////////////// + + if (strcmp(SIB1_frequencyOffsetSSB , "khz-5") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).SIB1_frequencyOffsetSSB[j] = -5; + }else if (strcmp(SIB1_frequencyOffsetSSB , "khz5") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).SIB1_frequencyOffsetSSB[j] = 5; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for SIB1_frequencyOffsetSSB !\n", + RC.config_file_name, i, SIB1_frequencyOffsetSSB); + } + + NRRRC_CONFIGURATION_REQ (msg_p).SIB1_ssb_PeriodicityServingCell[j] = SIB1_ssb_PeriodicityServingCell; + if ((SIB1_ssb_PeriodicityServingCell !=5) && + (SIB1_ssb_PeriodicityServingCell !=10) && + (SIB1_ssb_PeriodicityServingCell !=20) && + (SIB1_ssb_PeriodicityServingCell !=40) && + (SIB1_ssb_PeriodicityServingCell !=80) && + (SIB1_ssb_PeriodicityServingCell !=160)&&){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for SIB1_ssb_PeriodicityServingCell choice: 5,10,20,40,80,160 !\n", + RC.config_file_name, i, SIB1_ssb_PeriodicityServingCell); + } + + NRRRC_CONFIGURATION_REQ (msg_p).SIB1_ss_PBCH_BlockPower[j] = SIB1_ss_PBCH_BlockPower; + if ((SIB1_ss_PBCH_BlockPower < -60) || (SIB1_ss_PBCH_BlockPower > 50)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for SIB1_ss_PBCH_BlockPower choice: -60..50 !\n", + RC.config_file_name, i, SIB1_ss_PBCH_BlockPower); + } ////////////////////////////////NR FrequencyInfoDL////////////////////////////// NRRRC_CONFIGURATION_REQ (msg_p).absoluteFrequencySSB[j] = absoluteFrequencySSB; if ((absoluteFrequencySSB <0) || (absoluteFrequencySSB > 3279165)){ - AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for FreqBandIndicatorNR choice: 0..3279165 !\n", + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for absoluteFrequencySSB choice: 0..3279165 !\n", RC.config_file_name, i, absoluteFrequencySSB); } @@ -556,49 +623,50 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { RC.config_file_name, i, UL_locationAndBandwidth); } - switch (ssb_periodicityServingCell) { + switch (ServingCellConfigCommon_ssb_periodicityServingCell) { case 5: - NRRRC_CONFIGURATION_REQ (msg_p).ssb_periodicityServingCell[j] = ServingCellConfigCommon__ssb_periodicityServingCell_ms5; + NRRRC_CONFIGURATION_REQ (msg_p).ServingCellConfigCommon_ssb_periodicityServingCell[j] = ServingCellConfigCommon__ssb_periodicityServingCell_ms5; break; case 10: - NRRRC_CONFIGURATION_REQ (msg_p).ssb_periodicityServingCell[j] = ServingCellConfigCommon__ssb_periodicityServingCell_ms10; + NRRRC_CONFIGURATION_REQ (msg_p).ServingCellConfigCommon_ssb_periodicityServingCell[j] = ServingCellConfigCommon__ssb_periodicityServingCell_ms10; break; case 20: - NRRRC_CONFIGURATION_REQ (msg_p).ssb_periodicityServingCell[j] = ServingCellConfigCommon__ssb_periodicityServingCell_ms20; + NRRRC_CONFIGURATION_REQ (msg_p).ServingCellConfigCommon_ssb_periodicityServingCell[j] = ServingCellConfigCommon__ssb_periodicityServingCell_ms20; break; case 40: - NRRRC_CONFIGURATION_REQ (msg_p).ssb_periodicityServingCell[j] = ServingCellConfigCommon__ssb_periodicityServingCell_ms40; + NRRRC_CONFIGURATION_REQ (msg_p).ServingCellConfigCommon_ssb_periodicityServingCell[j] = ServingCellConfigCommon__ssb_periodicityServingCell_ms40; break; case 80: - NRRRC_CONFIGURATION_REQ (msg_p).ssb_periodicityServingCell[j] = ServingCellConfigCommon__ssb_periodicityServingCell_ms80; + NRRRC_CONFIGURATION_REQ (msg_p).ServingCellConfigCommon_ssb_periodicityServingCell[j] = ServingCellConfigCommon__ssb_periodicityServingCell_ms80; break; case 160: - NRRRC_CONFIGURATION_REQ (msg_p).ssb_periodicityServingCell[j] = ServingCellConfigCommon__ssb_periodicityServingCell_ms160; + NRRRC_CONFIGURATION_REQ (msg_p).ServingCellConfigCommon_ssb_periodicityServingCell[j] = ServingCellConfigCommon__ssb_periodicityServingCell_ms160; break; default: - AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for ssb_periodicityServingCell choice: -6,0,6 !\n", - RC.config_file_name, i, ssb_periodicityServingCell); + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for ServingCellConfigCommon_ssb_periodicityServingCell choice: -6,0,6 !\n", + RC.config_file_name, i, ServingCellConfigCommon_ssb_periodicityServingCell); break; } - switch (dmrs_TypeA_Position) { + + switch (ServingCellConfigCommon_dmrs_TypeA_Position) { case 2: - NRRRC_CONFIGURATION_REQ (msg_p).dmrs_TypeA_Position[j] = ServingCellConfigCommon__dmrs_TypeA_Position_pos2; + NRRRC_CONFIGURATION_REQ (msg_p).ServingCellConfigCommon_dmrs_TypeA_Position[j] = ServingCellConfigCommon__dmrs_TypeA_Position_pos2; break; case 3: - NRRRC_CONFIGURATION_REQ (msg_p).dmrs_TypeA_Position[j] = ServingCellConfigCommon__dmrs_TypeA_Position_pos3; + NRRRC_CONFIGURATION_REQ (msg_p).ServingCellConfigCommon_dmrs_TypeA_Position[j] = ServingCellConfigCommon__dmrs_TypeA_Position_pos3; break; default: - AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for dmrs_TypeA_Position choice: -6,0,6 !\n", - RC.config_file_name, i, dmrs_TypeA_Position); + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for ServingCellConfigCommon_dmrs_TypeA_Position choice: -6,0,6 !\n", + RC.config_file_name, i, ServingCellConfigCommon_dmrs_TypeA_Position); break; } @@ -616,10 +684,10 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { RC.config_file_name, i, NIA_SubcarrierSpacing); } - NRRRC_CONFIGURATION_REQ (msg_p).ss_PBCH_BlockPower[j] = ss_PBCH_BlockPower; - if ((ss_PBCH_BlockPower < -60) || (ss_PBCH_BlockPower > 50)){ - AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for ss_PBCH_BlockPower choice: 0..11 !\n", - RC.config_file_name, i, ss_PBCH_BlockPower); + NRRRC_CONFIGURATION_REQ (msg_p).ServingCellConfigCommon_ss_PBCH_BlockPower[j] = ServingCellConfigCommon_ss_PBCH_BlockPower; + if ((ServingCellConfigCommon_ss_PBCH_BlockPower < -60) || (ServingCellConfigCommon_ss_PBCH_BlockPower > 50)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for ServingCellConfigCommon_ss_PBCH_BlockPower choice: 0..11 !\n", + RC.config_file_name, i, ServingCellConfigCommon_ss_PBCH_BlockPower); } /////////////////////////////////NR TDD-UL-DL-ConfigCommon/////////////////////////// @@ -1937,7 +2005,7 @@ void NRRCConfig(void) { for (int i=0;i6GHz, the values 60 and 120 kHz are applicable. - subCarrierSpacingCommon ENUMERATED {scs15or60, scs30or120}, - - -- The frequency domain offset between SSB and the overall resource block grid in number of subcarriers. (See 38.211, section 7.4.3.1) - -- Note: For frequencies <6 GHz a fith, this field may comprise only the 4 least significant bits of the ssb-SubcarrierOffset. - -- The codepoint "FFS_RAN1" indicates that this cell does not provide SIB1 and that there is hence no common CORESET. - ssb-SubcarrierOffset INTEGER (0..15), - - -- Position of (first) DL DM-RS. Corresponds to L1 parameter 'DL-DMRS-typeA-pos' (see 38.211, section 7.4.1.1.1) - dmrs-TypeA-Position ENUMERATED {pos2, pos3}, - - -- Determines a bandwidth for PDCCH/SIB, a common ControlResourceSet (CORESET) a common search space and necessary PDCCH parameters. - -- Corresponds to L1 parameter 'RMSI-PDCCH-Config' (see FFS_Specification, section FFS_Section) - pdcch-ConfigSIB1 INTEGER (0..255), - - -- Indicates that UE shall not camp on this cell - cellBarred ENUMERATED {barred, notBarred}, - - -- Controls cell reselection to intra-frequency cells when the highest ranked cell is barred, or treated as barred by the UE, - -- as specified in TS 38.304. - intraFreqReselection ENUMERATED {allowed, notAllowed}, - spare BIT STRING (SIZE (1)) -} - --- TAG-MIB-STOP --- TAG-MEASUREMENTREPORT-START - -MeasurementReport ::= SEQUENCE { - criticalExtensions CHOICE { - measurementReport MeasurementReport-IEs, - criticalExtensionsFuture SEQUENCE {} - } -} - -MeasurementReport-IEs ::= SEQUENCE { - measResults MeasResults, - - lateNonCriticalExtension OCTET STRING OPTIONAL, - nonCriticalExtension SEQUENCE{} OPTIONAL -} - --- TAG-MEASUREMENTREPORT-STOP --- TAG-RRCRECONFIGURATION-START - -RRCReconfiguration ::= SEQUENCE { - rrc-TransactionIdentifier RRC-TransactionIdentifier, - criticalExtensions CHOICE { - rrcReconfiguration RRCReconfiguration-IEs, - criticalExtensionsFuture SEQUENCE {} - } -} - -RRCReconfiguration-IEs ::= SEQUENCE { - -- Configuration of Radio Bearers (DRBs, SRBs) including SDAP/PDCP. - -- In EN-DC this field may only be present if the RRCReconfiguration - -- is transmitted over SRB3. - radioBearerConfig RadioBearerConfig OPTIONAL, -- Need M - - -- Configuration of secondary cell group (EN-DC): - secondaryCellGroup OCTET STRING (CONTAINING CellGroupConfig) OPTIONAL, -- Need M - - measConfig MeasConfig OPTIONAL, -- Need M - - lateNonCriticalExtension OCTET STRING OPTIONAL, - nonCriticalExtension SEQUENCE {} OPTIONAL -} - --- TAG-RRCRECONFIGURATION-STOP --- TAG-RRCRECONFIGURATIONCOMPLETE-START - -RRCReconfigurationComplete ::= SEQUENCE { - rrc-TransactionIdentifier RRC-TransactionIdentifier, - criticalExtensions CHOICE { - rrcReconfigurationComplete RRCReconfigurationComplete-IEs, - criticalExtensionsFuture SEQUENCE {} - } -} - -RRCReconfigurationComplete-IEs ::= SEQUENCE { - lateNonCriticalExtension OCTET STRING OPTIONAL, - nonCriticalExtension SEQUENCE {} OPTIONAL -} - --- TAG-RRCRECONFIGURATIONCOMPLETE-STOP --- TAG-SIB1-START - -SIB1 ::= SEQUENCE { - - -- FFS / TODO: Add other parameters. - - -- Frequency offset for the SSB of -5kHz (M=-1) or +5kHz (M=1). When the field is absent, the UE applies no offset (M=0). - -- The offset is only applicable for the frequency range 0-2.65GHz. Corresponds to parameter 'M' (see 38.101, section FFS_Section) - frequencyOffsetSSB ENUMERATED {khz-5, khz5} OPTIONAL, -- Need R - - -- Time domain positions of the transmitted SS-blocks in an SS-Burst-Set (see 38.213, section 4.1) - ssb-PositionsInBurst SEQUENCE { - -- Indicates the presence of the up to 8 SSBs in one group - inOneGroup BIT STRING (SIZE (8)), - -- For above 6 GHz: indicates which groups of SSBs is present - groupPresence BIT STRING (SIZE (8)) OPTIONAL -- Cond above6GHzOnly - }, - - -- The SSB periodicity in msec for the rate matching purpose (see 38.211, section [7.4.3.1]) - ssb-PeriodicityServingCell ENUMERATED {ms5, ms10, ms20, ms40, ms80, ms160, spare1, spare2}, - - -- TX power that the NW used for SSB transmission. The UE uses it to estimate the RA preamble TX power. - -- (see 38.213, section 7.4) - ss-PBCH-BlockPower INTEGER (-60..50), - - uplinkConfigCommon UplinkConfigCommon OPTIONAL, - -- FFS: How to indicate the FrequencyInfoUL for the SUL - supplementaryUplink SEQUENCE { - uplinkConfigCommon UplinkConfigCommon OPTIONAL - -- FFS: Add additional (selection) criteria determining when/whether the UE shall use the SUL frequency - } OPTIONAL, -- Cond SUL - - tdd-UL-DL-Configuration TDD-UL-DL-ConfigCommon OPTIONAL, -- Cond TDD - tdd-UL-DL-configurationCommon2 TDD-UL-DL-ConfigCommon OPTIONAL, -- Cond TDD - - pdcch-ConfigCommon PDCCH-ConfigCommon OPTIONAL, - pucch-ConfigCommon PUCCH-ConfigCommon OPTIONAL, - - lateNonCriticalExtension OCTET STRING OPTIONAL, - nonCriticalExtension SEQUENCE{} OPTIONAL -} - --- TAG-SIB1-STOP --- TAG-SETUP-RELEASE-START - -SetupRelease { ElementTypeParam } ::= CHOICE { - release NULL, - setup ElementTypeParam -} - --- TAG-SETUP-RELEASE-STOP --- TAG-ADDITIONALSPECTRUMEMISSION-START - -AdditionalSpectrumEmission ::= INTEGER (0..7) - --- TAG-ADDITIONALSPECTRUMEMISSION-STOP --- TAG-ALPHA-START - -Alpha ::= ENUMERATED {alpha0, alpha04, alpha05, alpha06, alpha07, alpha08, alpha09, alpha1} - --- TAG-ALPHA-STOP --- TAG-ARFCN-VALUE-NR-START - -ARFCN-ValueNR ::= INTEGER (0..3279165) - --- TAG-ARFCN-VALUE-NR-STOP --- TAG-BANDWIDTH-PART-START - - --- Generic parameters used in Uplink- and Downlink bandwidth parts -BWP ::= SEQUENCE { - -- Frequency domain location and bandwidth of this bandwidth part defined commonly in a table (FFS_Section). The location is given as - -- distance (in number of PRBs) to point A (absoluteFrequencyPointA in FrequencyInfoDL). - -- Corresponds to L1 parameter 'DL-BWP-loc'. (see 38.211, section FFS_Section). - -- In case of TDD, a BWP-pair (UL BWP and DL BWP with the same bwp-Id) must have the same location (see 38.211, section REF) - locationAndBandwidth INTEGER (0..37949), - -- Subcarrier spacing to be used in this BWP for all channels and - -- reference signals unless explicitly configured elsewhere. - -- Corresponds to subcarrier spacing according to 38.211, Table 4.2-1. - -- The value kHz15 corresponds to µ=0, kHz30 to µ=1, and so on. Only the values 15 or 30 kHz (<6GHz), 60 or 120 kHz (>6GHz) are - -- applicable. - subcarrierSpacing SubcarrierSpacing, - -- Indicates whether to use the extended cyclic prefix for this bandwidth part. If not set, the UE uses the normal cyclic prefix. - -- Normal CP is supported for all numerologies and slot formats. Extended CP is supported only for 60 kHz subcarrier spacing. - -- (see 38.211, section 4.2.2) - cyclicPrefix ENUMERATED { extended } OPTIONAL -- Need R -} - -BWP-Uplink ::= SEQUENCE { - -- An identifier for this bandwidth part. Other parts of the RRC configuration use the BWP-Id to associate themselves with a particular - -- bandwidth part. The BWP ID=0 is always associated with the initial BWP and may hence not be used here (in other bandwidth parts). - -- The NW may trigger the UE to swtich UL or DL BWP using a DCI field. The four code points in that DCI field map to the RRC-configured - -- BWP-ID as follows: For up to 3 configured BWPs (in addition to the initial BWP) the DCI code point is equivalent to the BWP ID - -- (initial = 0, first dedicated = 1, ...). If the NW configures 4 dedicated bandwidth parts, they are identified by DCI code - -- points 0 to 3. In this case it is not possible to switch to the initial BWP using the DCI field. - -- Corresponds to L1 parameter 'UL-BWP-index'. (see 38.211, 38.213, section 12) - bwp-Id BWP-Id, - bwp-Common BWP-UplinkCommon OPTIONAL, -- Need M - bwp-Dedicated BWP-UplinkDedicated OPTIONAL, -- Need M - ... -} - -BWP-UplinkCommon ::= SEQUENCE { - genericParameters BWP, - -- Configuration of cell specific random access parameters which the UE uses for contention based and contention free random access - -- as well as for contention based beam failure recovery. - rach-ConfigCommon SetupRelease { RACH-ConfigCommon } OPTIONAL, -- Need M - -- Cell specific parameters for the PUSCH - pusch-ConfigCommon SetupRelease { PUSCH-ConfigCommon } OPTIONAL, -- Need M - - -- Cell specific parameters for the PUCCH - pucch-ConfigCommon SetupRelease { PUCCH-ConfigCommon } OPTIONAL, -- Need M - ... -} - -BWP-UplinkDedicated ::= SEQUENCE { - -- PUCCH configuration for one BWP of the regular UL or SUL of a serving cell. If the UE is configured with SUL, the network - -- configures PUCCH only on the BWPs of one of the uplinks (UL or SUL). - pucch-Config SetupRelease { PUCCH-Config } OPTIONAL, -- Need M - -- PUSCH configuration for one BWP of the regular UL or SUL of a serving cell. If the UE is configured with SUL and - -- if it has a PUSCH-Config for both UL and SUL, a carrier indicator field in DCI indicates for which of the two to use an UL grant. - -- See also L1 parameter 'dynamicPUSCHSUL' (see 38.213, section FFS_Section) - pusch-Config SetupRelease { PUSCH-Config } OPTIONAL, -- Need M - -- A Configured-Grant of typ1 or type2. It may be configured for Ul or SUL but in case of type1 [FFS also type2] not for both at a time. - configuredGrantConfig SetupRelease { ConfiguredGrantConfig } OPTIONAL, -- Need M - -- Uplink sounding reference signal configuration - srs-Config SetupRelease { SRS-Config } OPTIONAL, -- Need M - -- Determines how the UE performs Beam Failure Recovery upon detection of a Beam Failure (see RadioLinkMonitoringConfig) - beamFailureRecoveryConfig SetupRelease { BeamFailureRecoveryConfig } OPTIONAL, -- Need M - ... -} - - -BWP-Downlink ::= SEQUENCE { - -- An identifier for this bandwidth part. Other parts of the RRC configuration use the BWP-Id to associate themselves with a particular - -- bandwidth part. The BWP ID=0 is always associated with the initial BWP and may hence not be used here. (in other bandwidth parts). - -- The NW may trigger the UE to swtich UL or DL BWP using a DCI field. The four code points in that DCI field map to the RRC-configured - -- BWP-ID as follows: For up to 3 configured BWPs (in addition to the initial BWP) the DCI code point is equivalent to the BWP ID - -- (initial = 0, first dedicated = 1, ...). If the NW configures 4 dedicated bandwidth parts, they are identified by DCI code - -- points 0 to 3. In this case it is not possible to switch to the initial BWP using the DCI field. - -- Corresponds to L1 parameter 'DL-BWP-index'. (see 38.211, 38.213, section 12) - bwp-Id BWP-Id, - bwp-Common BWP-DownlinkCommon OPTIONAL, -- Need M - bwp-Dedicated BWP-DownlinkDedicated OPTIONAL, -- Need M - ... -} - - -BWP-DownlinkCommon ::= SEQUENCE { - genericParameters BWP, - pdcch-ConfigCommon SetupRelease { PDCCH-ConfigCommon } OPTIONAL, -- Need M - pdsch-ConfigCommon SetupRelease { PDSCH-ConfigCommon } OPTIONAL, -- Need M - ... -} - -BWP-DownlinkDedicated ::= SEQUENCE { - pdcch-Config SetupRelease { PDCCH-Config } OPTIONAL, -- Need M - pdsch-Config SetupRelease { PDSCH-Config } OPTIONAL, -- Need M - sps-Config SetupRelease { SPS-Config } OPTIONAL, -- Need M - radioLinkMonitoringConfig SetupRelease { RadioLinkMonitoringConfig } OPTIONAL, -- Need M - ... -} - - --- TAG-BANDWIDTH-PART-STOP --- TAG-BWP-ID-START - -BWP-Id ::= INTEGER (0..maxNrofBWPs) - --- TAG-BWP-ID-STOP --- TAG-BEAM-FAILURE-RECOVERY-CONFIG-START - -BeamFailureRecoveryConfig ::= SEQUENCE { - rootSequenceIndex-BFR INTEGER (0..137) OPTIONAL, -- Need M - -- Configuration of contention free random access occasions for BFR - rach-ConfigBFR RACH-ConfigGeneric OPTIONAL, -- Need M - -- L1-RSRP threshold used for determining whether a candidate beam may be used by the UE to attempt contention free - -- Random Access to recover from beam failure. The signalled threshold is applied directly for SSB, a threshold for - -- CSI-RS is determined by linearly scaling singalled value based on Pc_ss corresponding to the CSI-RS resource. - -- (see FFS_Specification, FFS_Section) - candidateBeamThreshold RSRP-Range OPTIONAL, -- Need M - -- A list of reference signals (CSI-RS and/or SSB) identifying the candidate beams for recover and the associated RA parameters - candidateBeamRSList SEQUENCE (SIZE(1..maxNrofCandidateBeams)) OF PRACH-ResourceDedicatedBFR OPTIONAL, -- Need M - -- Explicitly signalled PRACH Mask Index for RA Resource selection in TS 36.321. The mask is valid for all SSB resources - ra-ssb-OccasionMaskIndex INTEGER (0..15) OPTIONAL, -- Need M - -- Control Resource Set that the UE uses to receive the random access response for beam failure recovery. - -- If the field is absent the UE uses the initial CORESET (ControlResourceSetId = 0) - recoveryControlResourceSetId ControlResourceSetId OPTIONAL , -- Need S - -- Search space to use for BFR RAR. If the field is absent, the UE uses the initial Serach Space (SearchSpaceId = 0). - recoverySearchSpaceId SearchSpaceId OPTIONAL, -- Need S - ... -} - -PRACH-ResourceDedicatedBFR ::= CHOICE { - ssb BFR-SSB-Resource, - csi-RS BFR-CSIRS-Resource -} - -BFR-SSB-Resource ::= SEQUENCE { - -- The ID of an SSB transmitted by this serving cell. It determines a candidate beam for beam failure recovery (BFR) - ssb SSB-Index, - -- The preamble index that the UE shall use when performing BFR upon selecting the candidate beams identified by this SSB. - ra-PreambleIndex INTEGER (0..63), - ... -} - -BFR-CSIRS-Resource ::= SEQUENCE { - -- The ID of a NZP-CSI-RS-Resource configured in the CSI-MeasConfig of this serving cell. This reference signal determines a candidate beam - -- for beam failure recovery (BFR). - csi-RS NZP-CSI-RS-ResourceId, - -- RA occasions that the UE shall use when performing BFR upon selecting the candidate beam identified by this CSI-RS. If the field is absent - -- the UE uses the RA occasion associated with the SSB that is QCLed with this CSI-RS. - -- The RA preamble index to use in the RA occasions associated with this CSI-RS. If the field is absent, the UE uses the preamble index - -- associated with the SSB that is QCLed with this CSI-RS. - ra-PreambleIndex INTEGER (0..63) OPTIONAL, -- Need R - ... -} - --- TAG-BEAM-FAILURE-RECOVERY-CONFIG-STOP --- TAG-CELL-GROUP-CONFIG-START - --- Configuration of one Cell-Group: -CellGroupConfig ::= SEQUENCE { - cellGroupId CellGroupId, - - -- Logical Channel configuration and association with radio bearers: - rlc-BearerToAddModList SEQUENCE (SIZE(1..maxLC-ID)) OF RLC-Bearer-Config OPTIONAL, -- Need N - rlc-BearerToReleaseList SEQUENCE (SIZE(1..maxLC-ID)) OF LogicalChannelIdentity OPTIONAL, -- Need N - - -- Parameters applicable for the entire cell group: - mac-CellGroupConfig MAC-CellGroupConfig OPTIONAL, -- Need M - physicalCellGroupConfig PhysicalCellGroupConfig OPTIONAL, -- Need M - - -- Serving Cell specific parameters (SpCell and SCells) - spCellConfig SpCellConfig OPTIONAL, -- Need M - sCellToAddModList SEQUENCE (SIZE (1..maxNrofSCells)) OF SCellConfig OPTIONAL, -- Need N - -- List of seconary serving cells to be released (not applicable for SpCells) - sCellToReleaseList SEQUENCE (SIZE (1..maxNrofSCells)) OF SCellIndex OPTIONAL, -- Need N - ... -} - --- The ID of a cell group. 0 identifies the master cell group. Other values identify secondary cell groups. --- In this version of the specification only values 0 and 1 are supported. --- FFS: This should be moved to be own IE section -CellGroupId ::= INTEGER (0.. maxSecondaryCellGroups) - - -RLC-Bearer-Config ::= SEQUENCE { - -- ID used commonly for the MAC logical channel and for the RLC bearer. - logicalChannelIdentity LogicalChannelIdentity, - - -- Associates the RLC Bearer with an SRB or a DRB. The UE shall deliver DL RLC SDUs received via the RLC entity of this - -- RLC bearer to the PDCP entity of the servedRadioBearer. Furthermore, the UE shall advertise and deliver uplink PDCP PDUs of the - -- uplink PDCP entity of the servedRadioBearer to the uplink RLC entity of this RLC bearer unless the uplink scheduling - -- restrictions ('moreThanOneRLC' in PDCP-Config and the restrictions in LogicalChannelConfig) forbid it to do so. - servedRadioBearer CHOICE { - srb-Identity SRB-Identity, - drb-Identity DRB-Identity - } OPTIONAL, -- Cond LCH-SetupOnly - - reestablishRLC ENUMERATED {true} OPTIONAL, -- Need N - rlc-Config RLC-Config OPTIONAL, -- Cond LCH-Setup - - mac-LogicalChannelConfig LogicalChannelConfig OPTIONAL, -- Cond LCH-Setup - ... -} - -LogicalChannelIdentity ::= INTEGER (1..maxLC-ID) - --- Cell-Group specific L1 parameters -PhysicalCellGroupConfig ::= SEQUENCE { - -- Enables spatial bundling of HARQ ACKs. It is configured per cell group (i.e. for all the cells within the cell group) for PUCCH - -- reporting of HARQ-ACK. It is only applicable when more than 4 layers are possible to schedule. - -- Corresponds to L1 parameter 'HARQ-ACK-spatial-bundling' (see 38.213, section FFS_Section) - -- Absence indicates that spatial bundling is disabled. - harq-ACK-SpatialBundlingPUCCH ENUMERATED {true} OPTIONAL, -- Need R - - -- Enables spatial bundling of HARQ ACKs. It is configured per cell group (i.e. for all the cells within the cell group) for PUSCH - -- reporting of HARQ-ACK. It is only applicable when more than 4 layers are possible to schedule. - -- Corresponds to L1 parameter 'HARQ-ACK-spatial-bundling' (see 38.213, section FFS_Section) - -- Absence indicates that spatial bundling is disabled. - harq-ACK-SpatialBundlingPUSCH ENUMERATED {true} OPTIONAL, -- Need R - -- The maximum transmit power to be used by the UE in this NR cell group. - p-NR P-Max OPTIONAL, -- Need R - -- The PDSCH HARQ-ACK codebook is either semi-static of dynamic. This is applicable to both CA and none CA operation. - -- Corresponds to L1 parameter 'HARQ-ACK-codebook' (see 38.213, section FFS_Section) - pdsch-HARQ-ACK-Codebook ENUMERATED {semiStatic, dynamic}, - -- RNTI used for SRS TPC commands on DCI. Corresponds to L1 parameter 'TPC-SRS-RNTI' (see 38.213, section 10) - tpc-SRS-RNTI RNTI-Value OPTIONAL, -- Need R - -- RNTI used for PUCCH TPC commands on DCI. Corresponds to L1 parameter 'TPC-PUCCH-RNTI' (see 38.213, section 10). - tpc-PUCCH-RNTI RNTI-Value OPTIONAL, -- Need R - -- RNTI used for PUSCH TPC commands on DCI. Corresponds to L1 parameter 'TPC-PUSCH-RNTI' (see 38.213, section 10) - tpc-PUSCH-RNTI RNTI-Value OPTIONAL,-- Need R - ... -} - - --- Serving cell specific MAC and PHY parameters for a SpCell: -SpCellConfig ::= SEQUENCE { - -- Serving cell ID of a PSCell (the PCell of the Master Cell Group uses ID = 0) - servCellIndex ServCellIndex OPTIONAL, -- Cond SCG - -- Parameters for the synchronous reconfiguration to the target SpCell: - reconfigurationWithSync ReconfigurationWithSync OPTIONAL, -- Cond ReconfWithSync - rlf-TimersAndConstants SetupRelease { RLF-TimersAndConstants } OPTIONAL, -- Need M - rlmInSyncOutOfSyncThreshold INTEGER (0..1) OPTIONAL, -- Need M - spCellConfigDedicated ServingCellConfig OPTIONAL, -- Need M - ... -} - -ReconfigurationWithSync ::= SEQUENCE { - spCellConfigCommon ServingCellConfigCommon OPTIONAL, -- Need M - newUE-Identity RNTI-Value, - t304 ENUMERATED {ms50, ms100, ms150, ms200, ms500, ms1000, ms2000, ms10000}, - rach-ConfigDedicated CHOICE { - uplink RACH-ConfigDedicated, - supplementaryUplink RACH-ConfigDedicated - } OPTIONAL, -- Need N - ... -} - -SCellConfig ::= SEQUENCE { - sCellIndex SCellIndex, - sCellConfigCommon ServingCellConfigCommon OPTIONAL, -- Cond SCellAdd - sCellConfigDedicated ServingCellConfig OPTIONAL, -- Cond SCellAddMod - ... -} - --- TAG-CELL-GROUP-CONFIG-STOP --- TAG-CODEBOOKCONFIG-START -CodebookConfig ::= SEQUENCE { - -- CodebookType including possibly sub-types and the corresponding parameters for each. Corresponds to L1 parameter 'CodebookType' - -- (see 38.214, section 5.2.2.2) - codebookType CHOICE { - type1 SEQUENCE { - subType CHOICE { - typeI-SinglePanel SEQUENCE { - nrOfAntennaPorts CHOICE { - two SEQUENCE { - -- Codebook subset restriction for 2TX codebook - -- Corresponds to L1 parameter ' TypeI-SinglePanel-2Tx-CodebookSubsetRestriction' (see 38.214 section 5.2.2.2.1) - twoTX-CodebookSubsetRestriction BIT STRING (SIZE (6)) - }, - moreThanTwo SEQUENCE { - -- Number of antenna ports in first (n1) and second (n2) dimension and codebook subset restriction - -- Corresponds to L1 parameters 'CodebookConfig-N1', 'CodebookConfig-N2' - -- 'TypeI-SinglePanel-CodebookSubsetRestriction ' (see 38.214 section 5.2.2.2.1) - n1-n2 CHOICE { - two-one-TypeI-SinglePanel-Restriction BIT STRING (SIZE (8)), - two-two-TypeI-SinglePanel-Restriction BIT STRING (SIZE (64)), - four-one-TypeI-SinglePanel-Restriction BIT STRING (SIZE (16)), - three-two-TypeI-SinglePanel-Restriction BIT STRING (SIZE (96)), - six-one-TypeI-SinglePanel-Restriction BIT STRING (SIZE (24)), - four-two-TypeI-SinglePanel-Restriction BIT STRING (SIZE (128)), - eight-one-TypeI-SinglePanel-Restriction BIT STRING (SIZE (32)), - four-three-TypeI-SinglePanel-Restriction BIT STRING (SIZE (192)), - six-two-TypeI-SinglePanel-Restriction BIT STRING (SIZE (192)), - twelve-one-TypeI-SinglePanel-Restriction BIT STRING (SIZE (48)), - four-four-TypeI-SinglePanel-Restriction BIT STRING (SIZE (256)), - eight-two-TypeI-SinglePanel-Restriction BIT STRING (SIZE (256)), - sixteen-one-TypeI-SinglePanel-Restriction BIT STRING (SIZE (64)) - }, - -- i2 codebook subset restriction for Type I Single-panel codebook used when reportQuantity is CRI/Ri/i1/CQI - -- Corresponds to L1 parameter 'TypeI-SinglePanel-CodebookSubsetRestriction-i2' (see 38.214 section 5.2.2.2.1) - typeI-SinglePanel-codebookSubsetRestriction-i2 BIT STRING (SIZE (16)) OPTIONAL - } - }, - -- Restriction for RI for TypeI-SinglePanel-RI-Restriction - -- Corresponds to L1 parameter 'TypeI-SinglePanel-RI-Restriction' (see 38.214, section 5.2.2.2.1) - typeI-SinglePanel-ri-Restriction BIT STRING (SIZE (8)) - }, - typeI-MultiPanel SEQUENCE { - -- Codebook subset restriction for Type I Multi-panel codebook - -- Corresponds to L1 parameter 'TypeI-MultiPanel-CodebookSubsetRestriction' (see 38.214, section 5.2.2.2.2) - ng-n1-n2 CHOICE { - two-two-one-TypeI-MultiPanel-Restriction BIT STRING (SIZE (8)), - two-four-one-TypeI-MultiPanel-Restriction BIT STRING (SIZE (32)), - four-two-one-TypeI-MultiPanel-Restriction BIT STRING (SIZE (32)), - two-two-two-TypeI-MultiPanel-Restriction BIT STRING (SIZE (128)), - two-eight-one-TypeI-MultiPanel-Restriction BIT STRING (SIZE (64)), - four-four-one-TypeI-MultiPanel-Restriction BIT STRING (SIZE (64)), - two-four-two-TypeI-MultiPanel-Restriction BIT STRING (SIZE (256)), - four-two-two-TypeI-MultiPanel-Restriction BIT STRING (SIZE (256)) - }, - -- Restriction for RI for TypeI-MultiPanel-RI-Restriction - -- Corresponds to L1 parameter 'TypeI-MultiPanel-RI-Restriction' (see 38.214, section 5.2.2.2.2) - ri-Restriction BIT STRING (SIZE (4)) - } - }, - -- CodebookMode as specified in 38.214 section 5.2.2.2.2 - codebookMode INTEGER (1..2) - - }, - type2 SEQUENCE { - subType CHOICE { - typeII SEQUENCE { - -- Number of antenna ports in first (n1) and second (n2) dimension and codebook subset restriction - -- Corresponds to L1 parameters 'CodebookConfig-N1', 'CodebookConfig-N2' - -- The CHOICE name indicates the value of n1 and n2, the CHOICE contents is the codebook subset restriction bitmap - -- Corresponds to L1 parameter ' TypeII-CodebookSubsetRestriction' (see 38.214 section 5.2.2.2.3) - -- Number of bits for codebook subset restriction is ceil(log2(nchoosek(O1*O2,4)))+8*n1*n2 where nchoosek(a,b) = a!/(b!(a-b)!) - n1-n2-codebookSubsetRestriction CHOICE { - two-one BIT STRING (SIZE (16)), - two-two BIT STRING (SIZE (139)), - four-one BIT STRING (SIZE (32)), - three-two BIT STRING (SIZE (59)), - six-one BIT STRING (SIZE (49)), - four-two BIT STRING (SIZE (75)), - eight-one BIT STRING (SIZE (65)), - four-three BIT STRING (SIZE (107)), - six-two BIT STRING (SIZE (107)), - twelve-one BIT STRING (SIZE (129)), - four-four BIT STRING (SIZE (139)), - eight-two BIT STRING (SIZE (139)), - sixteen-one BIT STRING (SIZE (129)) - }, - -- Restriction for RI for TypeII-RI-Restriction - -- Corresponds to L1 parameter 'TypeII-RI-Restriction' (see 38.214, section 5.2.2.2.3) - typeII-RI-Restriction BIT STRING (SIZE (2)) - }, - typeII-PortSelection SEQUENCE { - -- The size of the port selection codebook (parameter d) - portSelectionSamplingSize ENUMERATED {n1, n2, n3, n4} OPTIONAL, -- Cond TypeII-PortSelection - -- Restriction for RI for TypeII-PortSelection-RI-Restriction - -- Corresponds to L1 parameter 'TypeII-PortSelection-RI-Restriction' (see 38.214, section 5.2.2.4) - typeII-PortSelectionRI-Restriction BIT STRING (SIZE (2)) - } - }, - -- The size of the PSK alphabet, QPSK or 8-PSK - phaseAlphabetSize ENUMERATED {n4, n8}, - -- If subband amplitude reporting is activated (true) - subbandAmplitude BOOLEAN, - -- Number of beams, L, used for linear combination - numberOfBeams ENUMERATED {two, three, four} - } - } -} - --- TAG-CODEBOOKCONFIG-STOP --- TAG-CONFIGUREDGRANTCONFIG-START - -ConfiguredGrantConfig ::= SEQUENCE { - - -- Frequency hopping as agreed in RAN1-AH18776 - frequencyHopping ENUMERATED {mode1, mode2}, - -- DMRS configuration, as agreed in RAN1-AH18776 - cg-DMRS-Configuration DMRS-UplinkConfig, - - -- Indicates the MCS table the UE shall use for PUSCH without transform precoding, as agreed in RAN1-AH18776 - mcs-Table ENUMERATED {qam64, qam256}, - -- Indicates the MCS table the UE shall use for PUSCH with transform precoding, as agreed in RAN1-AH18776 - -- When the field is absent the UE applies the value 64QAM - mcs-TableTransformPrecoder ENUMERATED {qam256} OPTIONAL, -- Need S - -- Selection between and configuration of dynamic and semi-static beta-offset, as agreed in RAN1-AH18776 - -- Note: For Type 1 UL data transmission without grant, "uci-on-PUSCH" should be set to semiStatic - uci-OnPUSCH SetupRelease { CG-UCI-OnPUSCH }, - -- Configuration of resource allocation type 0 and resource allocation type 1, as agreed in RAN1-AH18776 - -- Note: For Type 1 UL data transmission without grant, "resourceAllocation" should be resourceAllocationType0 or resourceAllocationType1 - resourceAllocation ENUMERATED { resourceAllocationType0, resourceAllocationType1, dynamicSwitch }, - -- Selection between config 1 and config 2 for RBG size for PUSCH. When the field is absent the UE applies the value config1. - -- Note: rbg-Size is used when the transformPrecoder parameter is disabled. - rbg-Size ENUMERATED {config2} OPTIONAL, -- Need S - - -- Closed control loop to apply. Corresponds to L1 parameter 'PUSCH-closed-loop-index' (see 38.213, section FFS_Section) - powerControlLoopToUse ENUMERATED {n0, n1}, - -- Index of the P0-PUSCH-AlphaSet to be used for this configuration - p0-PUSCH-Alpha P0-PUSCH-AlphaSetId, - -- Enable transformer precoder for type1 and type2. Absence indicates that it is disabled. - -- Corresponds to L1 parameter 'UL-TWG-tp' (see 38.214, section 6.1.3) - transformPrecoder ENUMERATED {enabled} OPTIONAL, -- Need R - -- The number of HARQ processes configured. It applies for both Type 1 and Type 2 - -- Corresponds to L1 parameter 'UL-TWG-numbHARQproc' (see 38.321, section 5.8.2) - nrofHARQ-Processes INTEGER(1..16), - -- The number or repetitions of K: - repK ENUMERATED {n1, n2, n4, n8}, - -- If repetitions is used, this field indicates the redundancy version (RV) sequence to use. - -- Corresponds to L1 parameter 'UL-TWG-RV-rep' (see 38.321, section 5.8.2) - repK-RV ENUMERATED {s1-0231, s2-0303, s3-0000} OPTIONAL, -- Cond RepK - -- Periodicity for UL transmission without UL grant for type 1 and type 2 - -- Corresponds to L1 parameter 'UL-TWG-periodicity' (see 38.321, section 5.8.2) - - -- The following periodicities are supported depending on the configured subcarrier spacing [symbols]: - -- 15kHz: 2, 7, n*14, where n={1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 320, 640} - -- 30kHz: 2, 7, n*14, where n={1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 256, 320, 640, 1280} - -- 60kHz with normal CP: 2, 7, n*14, where n={1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 256, 320, 512, 640, 1280, 2560} - -- 60kHz with ECP: 2, 6, n*12, where n={1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 256, 320, 512, 640, 1280, 2560} - -- 120kHz: 2, 7, n*14, where n={1, 2, 4, 5, 8, 10, 16, 20, 32, 40, 64, 80, 128, 160, 256, 320, 512, 640, 1024, 1280, 2560, 5120} - -- (see 38.214, Table 6.1.2.3-1) - periodicity ENUMERATED { - sym2, sym7, sym1x14, sym2x14, sym4x14, sym5x14, sym8x14, sym10x14, sym16x14, sym20x14, - sym32x14, sym40x14, sym64x14, sym80x14, sym128x14, sym160x14, sym256x14, sym320x14, sym512x14, - sym640x14, sym1024x14, sym1280x14, sym2560x14, sym5120x14, - - sym6, sym1x12, sym2x12, sym4x12, sym5x12, sym8x12, sym10x12, sym16x12, sym20x12, sym32x12, - sym40x12, sym64x12, sym80x12, sym128x12, sym160x12, sym256x12, sym320x12, sym512x12, sym640x12, - sym1280x12, sym2560x12 - }, - - -- If configured, the UE uses the configured grant timer (see 38.321, section 5.8.2) with this initial timer value. - -- Supported values are as follows in units of symbols: - -- For normal CP: 2, 7, {1, 2, 4, 5, 8, 10, 20, 32, 40, 64, 80, 128, 160, 256, 512, 640 } x 14 - -- For extended CP: 2, 6, {1, 2, 4, 8, 20, 40, 80, 128, 160, 256, 320, 512, 640 } x 12 - configuredGrantTimer ENUMERATED { - sym2, sym7, sym1x14, sym2x14, sym4x14, sym5x14, sym8x14, sym10x14, sym16x14, sym20x14, sym32x14, - sym40x14, sym64x14, sym80x14, sym128x14, sym160x14, sym256x14, sym512x14, sym640x14, - - sym6, sym1x12, sym2x12, sym4x12, sym5x12, sym8x12, sym10x12, sym16x12, sym20x12, sym32x12, - sym40x12, sym64x12, sym80x12, sym128x12, sym256x12, sym320x12, sym512x12, sym640x12 - } OPTIONAL, -- Need R - -- Selection between "configured grant" transmission with fully RRC-configured UL grant (Type1) - -- or with UL grant configured by DCI addressed to CS-RNTI (Type2). - rrc-ConfiguredUplinkGrant SEQUENCE { - -- Offset related to SFN=0 - timeDomainOffset INTEGER (0..5119), - -- Corresponding to the DCI field of time domain resource assignment, and the maximum bit width is 4. - --(see 38.214, section 6.1.2 and 38.212, section 7.3.1) - timeDomainAllocation INTEGER (0..15), -- RAN1 indicated just "Mapping-type,Index-start-len" - -- Corresponding to the DCI field of freq domain resource assignment. - -- (see 38.214, section 6.1.2, and 38.212, section 7.3.1) - frequencyDomainAllocation BIT STRING (SIZE(18)), - -- UE-specific DMRS configuration: corresponding to the DCI field of antenna ports, and the maximum bitwidth is 5. - -- (see 38.214, section 6.1.2, and 38.212, section 7.3.1) - antennaPort INTEGER (0..31), - dmrs-SeqInitialization INTEGER (0..1) OPTIONAL, -- Cond NoTransformPrecoder - precodingAndNumberOfLayers INTEGER (0..63), - srs-ResourceIndicator INTEGER (0..15), - -- The modulation order, target code rate and TB size (see 38.214, section 6.1.2) - mcsAndTBS INTEGER (0..31), - -- Enables intra-slot frequency hopping with the given frequency hopping offset - -- Corresponds to L1 parameter 'UL-TWG-hopping' (see 38.214, section FFS_Section) - - frequencyHoppingOffset INTEGER (1.. maxNrofPhysicalResourceBlocks-1), - pathlossReferenceIndex INTEGER (0..maxNrofPUSCH-PathlossReferenceRSs-1), - ... - } OPTIONAL -- Cond Type1 -} - -CG-UCI-OnPUSCH ::= CHOICE { - dynamic SEQUENCE (SIZE (1..4)) OF BetaOffsets, - semiStatic BetaOffsets -} - --- TAG-CONFIGUREDGRANTCONFIG-STOP --- TAG-CONTROLRESOURCESET-START - -ControlResourceSet ::= SEQUENCE { - -- Corresponds to L1 parameter 'CORESET-ID' - -- Value 0 identifies the common CORESET configured in MIB and in ServingCellConfigCommon - -- Values 1..maxNrofControlResourceSets-1 identify CORESETs configured by dedicated signalling - -- The controlResourceSetId is unique among the BWPs of a ServingCell. - controlResourceSetId ControlResourceSetId, - - - -- Frequency domain resources for the CORESET. Each bit corresponds a group of 6 RBs, with grouping starting from PRB 0, which is fully - -- contained in the bandwidth part within which the CORESET is configured. - -- The most significant bit corresponds to the group of lowest frequency which is fully contained in the bandwidth part within which the - -- CORESET is configured, each next subsequent lower significance bit corresponds to the next lowest frequency group fully contained within - -- the bandwidth part within which the CORESET is configured, if any. - -- Bits corresponding to a group not fully contained within the bandwidth part within which the CORESET is configured are set to zero. - -- Corresponds to L1 parameter 'CORESET-freq-dom'(see 38.211, section 7.3.2.2) - frequencyDomainResources BIT STRING (SIZE (45)), - -- Contiguous time duration of the CORESET in number of symbols - -- Corresponds to L1 parameter 'CORESET-time-duration' (see 38.211, section 7.3.2.2FFS_Section) - duration INTEGER (1..maxCoReSetDuration), - -- Mapping of Control Channel Elements (CCE) to Resource Element Groups (REG). - -- Corresponds to L1 parameter 'CORESET-CCE-REG-mapping-type' (see 38.211Section sections 7.3.2.2 and 7.4.1.3.2) - cce-REG-MappingType CHOICE { - interleaved SEQUENCE { - -- Resource Element Groups (REGs) can be bundled to create REG bundles. This parameter defines the size of such bundles. - -- Corresponds to L1 parameter 'CORESET-REG-bundle-size' (see 38.211, section FFS_Section) - reg-BundleSize ENUMERATED {n2, n3, n6}, - -- Corresponds to L1 parameter 'CORESET-interleaver-size' (see 38.211, 38.213, section FFS_Section) - interleaverSize ENUMERATED {n2, n3, n6}, - -- Corresponds to L1 parameter 'CORESET-shift-index' (see 38.211, section 7.3.2.2) - shiftIndex INTEGER(0..maxNrofPhysicalResourceBlocks-1) - }, - nonInterleaved NULL - }, - -- Precoder granularity in frequency domain. - -- Corresponds to L1 parameter 'CORESET-precoder-granuality' (see 38.211, sections 7.3.2.2 and 7.4.1.3.2) - precoderGranularity ENUMERATED {sameAsREG-bundle, allContiguousRBs}, - - -- A subset of the TCI states defined in TCI-States used for providing QCL relationships between the DL RS(s) in one RS Set - -- (TCI-State) and the PDCCH DMRS ports. Corresponds to L1 parameter 'TCI-StatesPDCCH' (see 38.214, section FFS_Section) - tci-StatesPDCCH SEQUENCE(SIZE (1..maxNrofTCI-StatesPDCCH)) OF TCI-StateId OPTIONAL, -- Need R - - -- If at least spatial QCL is configured/indicated, this field indicates if TCI field is present or not present in DL-related DCI. - -- When the field is absent the UE considers the TCI to be absent/disabled. - -- Corresponds to L1 parameter 'TCI-PresentInDCI' (see 38,213, section 5.1.5) - tci-PresentInDCI ENUMERATED {enabled} OPTIONAL, -- Need S - - -- PDCCH DMRS scrambling initalization. Corresponds to L1 parameter 'PDCCH-DMRS-Scrambling-ID' (see 38.214, section 5.1) - -- When the field is absent the UE applies the value '0'. - pdcch-DMRS-ScramblingID BIT STRING (SIZE (16)) OPTIONAL -- Need S -} - --- TAG-CONTROLRESOURCESET-STOP --- TAG-CONTROL-RESOURCE-SET-ID-START - -ControlResourceSetId ::= INTEGER (0..maxNrofControlResourceSets-1) - --- TAG-CONTROL-RESOURCE-SET-ID-STOP - -CrossCarrierSchedulingConfig ::= SEQUENCE { - schedulingCellInfo CHOICE { - own SEQUENCE { -- No cross carrier scheduling - cif-Presence BOOLEAN - }, - other SEQUENCE { -- Cross carrier scheduling - schedulingCellId ServCellIndex, - cif-InSchedulingCell INTEGER (1..7) - } -- Cond SCellOnly - }, - ... -} - --- TAG-CSI-APERIODICTRIGGERSTATELIST-START - -CSI-AperiodicTriggerStateList ::= SEQUENCE (SIZE (1..maxNrOfCSI-AperiodicTriggers)) OF CSI-AperiodicTriggerState - -CSI-AperiodicTriggerState ::= SEQUENCE { - associatedReportConfigInfoList SEQUENCE (SIZE(1..maxNrofReportConfigPerAperiodicTrigger)) OF CSI-AssociatedReportConfigInfo, - ... -} - -CSI-AssociatedReportConfigInfo ::= SEQUENCE { - -- The reportConfigId of one of the CSI-ReportConfigToAddMod configured in CSI-MeasConfig - reportConfigId CSI-ReportConfigId, - - resourcesForChannel CHOICE { - nzp-CSI-RS SEQUENCE { - -- NZP-CSI-RS-ResourceSet for channel measurements. Entry number in nzp-CSI-RS-ResourceSetList in the CSI-ResourceConfig - -- indicated by resourcesForChannelMeasurement in the CSI-ReportConfig indicated by reportConfigId above - -- (1 corresponds to the first entry, 2 to thesecond entry, and so on). - resourceSet INTEGER (1..maxNrofNZP-CSI-RS-ResourceSetsPerConfig), - - -- List of references to TCI-States for providing the QCL source and QCL type for for each NZP-CSI-RS-Resource - -- listed in nzp-CSI-RS-Resources of the NZP-CSI-RS-ResourceSet indicated by nzp-CSI-RS-ResourcesforChannel. - -- First entry in qcl-info-forChannel corresponds to first entry in nzp-CSI-RS-Resources of that NZP-CSI-RS-ResourceSet, - -- second entry in qcl-info-forChannel corresponds to second entry in nzp-CSI-RS-Resources, - -- and so on. Corresponds to L1 parameter 'QCL-Info-aPeriodicReportingTrigger' (see 38.214, section 5.2.1.5.1) - qcl-info SEQUENCE (SIZE(1..maxNrofAP-CSI-RS-ResourcesPerSet)) OF TCI-StateId - }, - -- CSI-SSB-ResourceSet for channel measurements. Entry number in csi-SSB-ResourceSetList in the CSI-ResourceConfig indicated by - -- resourcesForChannelMeasurement in the CSI-ReportConfig indicated by reportConfigId above (1 corresponds to the first entry, 2 to - -- the second entry, and so on). - csi-SSB-ResourceSet INTEGER (1..maxNrofCSI-SSB-ResourceSetsPerConfig) - }, - - -- CSI-IM-ResourceSet for interference measurement. Entry number in csi-IM-ResourceSetList in the CSI-ResourceConfig indicated by - -- csi-IM-ResourcesForInterference in the CSI-ReportConfig indicated by reportConfigId above (1 corresponds to the first entry, 2 to the second - -- entry, and so on). - -- The indicated CSI-IM-ResourceSet should have exactly the same number of resources like the NZP-CSI-RS-ResourceSet indicated in - -- nzp-CSI-RS-ResourcesforChannel. - -- This field can only be present if the CSI-ReportConfig identified by reportConfigId includes csi-IM-ResourcesForInterference. - csi-IM-ResourcesforInteference INTEGER(1..maxNrofCSI-IM-ResourceSetsPerConfig) OPTIONAL, --Cond CSI-IM-forInterference - - - -- NZP-CSI-RS-ResourceSet for interference measurement. Entry number in nzp-CSI-RS-ResourceSetList in the CSI-ResourceConfig indicated by - -- nzp-CSI-RS-ResourcesForInterference in the CSI-ReportConfig indicated by reportConfigId above (1 corresponds to the first entry, - -- 2 to the second entry, and so on). - -- The indicated NZP-CSI-RS-ResourceSet should have exactly the same number of resources like the NZP-CSI-RS-ResourceSet indicated in - -- nzp-CSI-RS-ResourcesforChannel. - -- This field can only be present if the CSI-ReportConfig identified by reportConfigId includes nzp-CSI-RS-ResourcesForInterference. - nzp-CSI-RS-ResourcesforInterference INTEGER (1..maxNrofNZP-CSI-RS-ResourceSetsPerConfig) OPTIONAL, --Cond LinkedNZP-CSI-RS-forInterference - ... -} - --- TAG-CSI-APERIODICTRIGGERSTATELIST-STOP --- TAG-CSI-FREQUENCYOCCUPATION-START - -CSI-FrequencyOccupation ::= SEQUENCE { - -- PRB where this CSI resource starts in relation to PRB 0 of the associated BWP. - -- Only multiples of 4 are allowed (0, 4, ...) - startingRB INTEGER (0..maxNrofPhysicalResourceBlocks-1), - -- Number of PRBs across which this CSI resource spans. Only multiples of 4 are allowed. The smallest configurable - -- number is the minimum of 24 and the width of the associated BWP. - nrofRBs INTEGER (24..maxNrofPhysicalResourceBlocks), - ... -} - --- TAG-CSI-FREQUENCYOCCUPATION-STOP --- TAG-CSI-IM-RESOURCE-START -CSI-IM-Resource ::= SEQUENCE { - csi-IM-ResourceId CSI-IM-ResourceId, - - -- The resource element pattern (Pattern0 (2,2) or Pattern1 (4,1)) with corresponding parameters. - -- Corresponds to L1 parameter 'CSI-IM-RE-pattern' (see 38.214, section 5.2.2.3.4) - csi-IM-ResourceElementPattern CHOICE { - pattern0 SEQUENCE { - -- OFDM subcarrier occupancy of the CSI-IM resource for Pattern0 - -- Corresponds to L1 parameter 'CSI-IM-ResourceMapping' (see 38.214, section 5.2.2.3.4) - subcarrierLocation-p0 ENUMERATED { s0, s2, s4, s6, s8, s10 }, - -- OFDM symbol location of the CSI-IM resource for Pattern0 - -- Corresponds to L1 parameter 'CSI-IM-ResourceMapping' (see 38.214, section 5.2.2.3.4) - symbolLocation-p0 INTEGER (0..12) - }, - pattern1 SEQUENCE { - -- OFDM subcarrier occupancy of the CSI-IM resource for Pattern1 - -- Corresponds to L1 parameter 'CSI-IM-ResourceMapping' (see 38.214, section 5.2.2.3.4) - subcarrierLocation-p1 ENUMERATED { s0, s4, s8 }, - -- OFDM symbol location of the CSI-IM resource for Pattern1 - -- Corresponds to L1 parameter 'CSI-IM-ResourceMapping' (see 38.214, section 5.2.2.3.4) - symbolLocation-p1 INTEGER (0..13) - } - } OPTIONAL, --Need M - - -- Frequency-occupancy of CSI-IM. Corresponds to L1 parameter 'CSI-IM-FreqBand' (see 38.214, section 5.2.2.3.2) - freqBand CSI-FrequencyOccupation OPTIONAL, -- Need M - - -- Periodicity and slot offset for periodic/semi-persistent CSI-IM. Corresponds to L1 parameter 'CSI-IM-timeConfig' - periodicityAndOffset CSI-ResourcePeriodicityAndOffset OPTIONAL, --Cond PeriodicOrSemiPersistent - ... -} - --- TAG-CSI-IM-RESOURCE-STOP --- TAG-CSI-IM-RESOURCEID-START -CSI-IM-ResourceId ::= INTEGER (0..maxNrofCSI-IM-Resources-1) - --- TAG-CSI-IM-RESOURCEID-STOP --- TAG-CSI-IM-RESOURCESET-START -CSI-IM-ResourceSet ::= SEQUENCE { - - csi-IM-ResourceSetId CSI-IM-ResourceSetId, - -- CSI-IM-Resources associated with this CSI-IM-ResourceSet - -- Corresponds to L1 parameter 'CSI-IM-ResourceConfigList' (see 38.214, section 5.2) - csi-IM-Resources SEQUENCE (SIZE(1..maxNrofCSI-IM-ResourcesPerSet)) OF CSI-IM-ResourceId, - ... -} --- TAG-CSI-IM-RESOURCESET-STOP --- TAG-CSI-IM-RESOURCESETID-START - -CSI-IM-ResourceSetId ::= INTEGER (0..maxNrofCSI-IM-ResourceSets-1) - --- TAG-CSI-IM-RESOURCESETID-STOP --- TAG-CSI-MEAS-CONFIG-START - -CSI-MeasConfig ::= SEQUENCE { - -- Pool of NZP-CSI-RS-Resource which can be referred to from NZP-CSI-RS-ResourceSet - nzp-CSI-RS-ResourceToAddModList SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-Resources)) OF NZP-CSI-RS-Resource OPTIONAL, -- Need N - nzp-CSI-RS-ResourceToReleaseList SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-Resources)) OF NZP-CSI-RS-ResourceId OPTIONAL, -- Need N - - -- Pool of NZP-CSI-RS-ResourceSet which can be referred to from CSI-ResourceConfig or from MAC CEs - nzp-CSI-RS-ResourceSetToAddModList SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-ResourceSets)) OF NZP-CSI-RS-ResourceSet OPTIONAL, -- Need N - nzp-CSI-RS-ResourceSetToReleaseList SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-ResourceSets)) OF NZP-CSI-RS-ResourceSetId OPTIONAL, -- Need N - - -- Pool of CSI-IM-Resource which can be referred to from CSI-IM-ResourceSet - csi-IM-ResourceToAddModList SEQUENCE (SIZE (1..maxNrofCSI-IM-Resources)) OF CSI-IM-Resource OPTIONAL, -- Need N - csi-IM-ResourceToReleaseList SEQUENCE (SIZE (1..maxNrofCSI-IM-Resources)) OF CSI-IM-ResourceId OPTIONAL, -- Need N - - -- Pool of CSI-IM-ResourceSet which can be referred to from CSI-ResourceConfig or from MAC CEs - csi-IM-ResourceSetToAddModList SEQUENCE (SIZE (1..maxNrofCSI-IM-ResourceSets)) OF CSI-IM-ResourceSet OPTIONAL, -- Need N - csi-IM-ResourceSetToReleaseList SEQUENCE (SIZE (1..maxNrofCSI-IM-ResourceSets)) OF CSI-IM-ResourceSetId OPTIONAL, -- Need N - - -- Pool of CSI-SSB-ResourceSet which can be referred to from CSI-ResourceConfig - csi-SSB-ResourceSetToAddModList SEQUENCE (SIZE (1..maxNrofCSI-SSB-ResourceSets)) OF CSI-SSB-ResourceSet OPTIONAL, -- Need N - csi-SSB-ResourceSetToAddReleaseList SEQUENCE (SIZE (1..maxNrofCSI-SSB-ResourceSets)) OF CSI-SSB-ResourceSetId OPTIONAL, -- Need N - - -- Configured CSI resource settings as specified in TS 38.214 section 5.2.1.2 - csi-ResourceConfigToAddModList SEQUENCE (SIZE (1..maxNrofCSI-ResourceConfigurations)) OF CSI-ResourceConfig OPTIONAL, -- Need N - csi-ResourceConfigToReleaseList SEQUENCE (SIZE (1..maxNrofCSI-ResourceConfigurations)) OF CSI-ResourceConfigId OPTIONAL, -- Need N - - -- Configured CSI report settings as specified in TS 38.214 section 5.2.1.1 - csi-ReportConfigToAddModList SEQUENCE (SIZE (1..maxNrofCSI-ReportConfigurations)) OF CSI-ReportConfig OPTIONAL, -- Need N - csi-ReportConfigToReleaseList SEQUENCE (SIZE (1..maxNrofCSI-ReportConfigurations)) OF CSI-ReportConfigId OPTIONAL, -- Need N - - - -- Size of CSI request field in DCI (bits). Corresponds to L1 parameter 'ReportTriggerSize' (see 38.214, section 5.2) - reportTriggerSize INTEGER (0..6) OPTIONAL, - - -- Contains trigger states for dynamically selecting one or more aperiodic and semi-persistent reporting configurations - -- and/or triggering one or more aperiodic CSI-RS resource sets for channel and/or interference measurement. - -- FFS: How to address the MAC-CE configuration - aperiodicTriggerStateList SetupRelease { CSI-AperiodicTriggerStateList } OPTIONAL, -- Need M - semiPersistentOnPUSCH-TriggerStateList SetupRelease { CSI-SemiPersistentOnPUSCH-TriggerStateList } OPTIONAL, -- Need M - ... -} - -maxNrofNZP-CSI-RS-ResourceSets INTEGER ::= 64 -maxNrofNZP-CSI-RS-ResourceSets-1 INTEGER ::= 63 - -maxNrofCSI-SSB-ResourceSets INTEGER ::= 64 -maxNrofCSI-SSB-ResourceSets-1 INTEGER ::= 63 - -maxNrofCSI-IM-ResourceSets INTEGER ::= 64 -maxNrofCSI-IM-ResourceSets-1 INTEGER ::= 63 - --- TAG-CSI-MEAS-CONFIG-STOP --- TAG-CSI-REPORTCONFIG-START --- Configuration of a CSI-Report sent on L1 (e.g. PUCCH) (see 38.214, section 5.2.1) -CSI-ReportConfig ::= SEQUENCE { - reportConfigId CSI-ReportConfigId, - - -- Indicates in which serving cell the CSI-ResourceConfigToAddMod(s) below are to be found. - -- If the field is absent, the resources are on the same serving cell as this report configuration. - carrier ServCellIndex OPTIONAL, -- Need S - - -- Resources for channel measurement. csi-ResourceConfigId of a CSI-ResourceConfig included in the configuration of the serving cell - -- indicated with the field "carrier" above. This CSI-ReportConfig is associated with the DL BWP indicated by bwp-Id in that CSI-ResourceConfig. - resourcesForChannelMeasurement CSI-ResourceConfigId, - - -- CSI IM resources for interference measurement. csi-ResourceConfigId of a CSI-ResourceConfig included in the configuration of the serving cell - -- indicated with the field "carrier" above. The bwp-Id in that CSI-ResourceConfigToAddMod is the same value like the bwp-Id in the - -- CSI-ResourceConfig indicated by resourcesForChannelMeasurement. - csi-IM-ResourcesForInterference CSI-ResourceConfigId OPTIONAL, -- Need R - - -- NZP CSI RS resources for interference measurement. csi-ResourceConfigId of a CSI-ResourceConfigToAddMod included in the configuration of the - -- serving cell indicated with the field "carrier" above. The bwp-Id in that CSI-ResourceConfigToAddMod is the same value like the bwp-Id in the - -- CSI-ResourceConfigToAddMod indicated by resourcesForChannelMeasurement. - nzp-CSI-RS-ResourcesForInterference CSI-ResourceConfigId OPTIONAL, -- Need R - - -- Time domain behavior of reporting configuration - reportConfigType CHOICE { - periodic SEQUENCE { - -- Periodicity and slot offset. Corresponds to L1 parameter 'ReportPeriodicity'and 'ReportSlotOffset' - -- (see 38.214, section section 5.2.1.4). - reportSlotConfig CSI-ReportPeriodicityAndOffset, - -- Indicates which PUCCH resource to use for reporting on PUCCH. - pucch-CSI-ResourceList SEQUENCE (SIZE (1..maxNrofBWPs)) OF PUCCH-CSI-Resource - }, - semiPersistentOnPUCCH SEQUENCE { - -- Periodicity and slot offset. Corresponds to L1 parameter 'ReportPeriodicity' and 'ReportSlotOffset' - -- (see 38.214, section section 5.2.1.4). - reportSlotConfig CSI-ReportPeriodicityAndOffset, - -- Indicates which PUCCH resource to use for reporting on PUCCH. - pucch-CSI-ResourceList SEQUENCE (SIZE (1..maxNrofBWPs)) OF PUCCH-CSI-Resource - }, - semiPersistentOnPUSCH SEQUENCE { - -- Periodicity. Corresponds to L1 parameter 'Reportperiodicity-spCSI'. (see 38.214, section 5.2.1.1?FFS_Section) - reportSlotConfig ENUMERATED {sl5, sl10, sl20, sl40, sl80, sl160, sl320}, - -- Timing offset Y for aperiodic reporting using PUSCH. This field lists the allowed offset values. - -- A particular value is indicated in DCI. The first report is transmitted in slot n+Y, second report in n+Y+P, - -- where P is the configured periodicity. - reportSlotOffsetList SEQUENCE (SIZE (1..4)) OF INTEGER (0..7), - -- RNTI for SP CSI-RNTI, Corresponds to L1 parameter 'SPCSI-RNTI' (see 38.214, section 5.2.1.5.2) - -- FFS: RAN1 models different RNTIs as different Search Spaces with independent configurations. Align the configuration - -- of this one (e.g. group with monitoring periodicity, PDCCH candidate configuration, DCI-Payload size...)? - csi-RNTI RNTI-Value, - -- Index of the p0-alpha set determining the power control for this CSI report transmission. - -- Corresponds to L1 parameter 'SPCSI-p0alpha' (see 38.214, section FFS_Section) - p0alpha P0-PUSCH-AlphaSetId - }, - aperiodic SEQUENCE { - -- Timing offset Y for aperiodic reporting using PUSCH. This field lists the allowed offset values. A particular value is indicated in DCI. - -- (see 38.214, section 5.2.3) - -- FFS_Value: Range wasn’t final in RAN1 table. - -- FFS_FIXME: How are the DCI codepoints mapped to the allowed offsets? - reportSlotOffsetList SEQUENCE (SIZE (1..16)) OF INTEGER (0..7) - } - }, - -- The CSI related quanities to report. Corresponds to L1 parameter 'ReportQuantity' (see 38.214, section REF) - reportQuantity CHOICE { - none NULL, - cri-RI-PMI-CQI NULL, - cri-RI-i1 NULL, - cri-RI-i1-CQI SEQUENCE { - -- PRB bundling size to assume for CQI calcuation when reportQuantity is CRI/RI/i1/CQI - -- Corresponds to L1 parameter 'PDSCH-bundle-size-for-CSI' (see 38.214, section 5.2.1.4) - pdsch-BundleSizeForCSI ENUMERATED {n2, n4} OPTIONAL - }, - cri-RI-CQI NULL, - cri-RSRP NULL, - ssb-Index-RSRP NULL, - cri-RI-LI-PMI-CQI NULL - }, - -- Reporting configuration in the frequency domain. (see 38.214, section 5.2.1.4) - reportFreqConfiguration SEQUENCE { - -- Indicates whether the UE shall report a single (wideband) or multiple (subband) CQI. (see 38.214, section 5.2.1.4) - cqi-FormatIndicator ENUMERATED { widebandCQI, subbandCQI }, - -- Indicates whether the UE shall report a single (wideband) or multiple (subband) PMI. (see 38.214, section 5.2.1.4) - pmi-FormatIndicator ENUMERATED { widebandPMI, subbandPMI }, - -- Indicates a contiguous or non-contigous subset of subbands in the bandwidth part which CSI shall be reported - -- for. Each bit in the bit-string represents one subband. The right-most bit in the bit string represents the - -- lowest subband in the BWP. (see 38.214, section 5.2.1.4) - -- The number of subbands is determined according to 38.214 section 5.2.1.4. It is absent if there are less than 24 PRBs (no sub band) - -- and present otherwise, the number of sub bands can be from 3 (24 PRBs, sub band size 8) to 18 (72 PRBs, sub band size 4). - csi-ReportingBand CHOICE { - subbands3 BIT STRING(SIZE(3)), - subbands4 BIT STRING(SIZE(4)), - subbands5 BIT STRING(SIZE(5)), - subbands6 BIT STRING(SIZE(6)), - subbands7 BIT STRING(SIZE(7)), - subbands8 BIT STRING(SIZE(8)), - subbands9 BIT STRING(SIZE(9)), - subbands10 BIT STRING(SIZE(10)), - subbands11 BIT STRING(SIZE(11)), - subbands12 BIT STRING(SIZE(12)), - subbands13 BIT STRING(SIZE(13)), - subbands14 BIT STRING(SIZE(14)), - subbands15 BIT STRING(SIZE(15)), - subbands16 BIT STRING(SIZE(16)), - subbands17 BIT STRING(SIZE(17)), - subbands18 BIT STRING(SIZE(18)), - ... - } OPTIONAL -- Need S - - }, - -- Time domain measurement restriction for the channel (signal) measurements. - -- Corresponds to L1 parameter 'MeasRestrictionConfig-time-channel' (see 38.214, section 5.2.1.1) - timeRestrictionForChannelMeasurements ENUMERATED {configured, notConfigured}, - -- Time domain measurement restriction for interference measurements. - -- Corresponds to L1 parameter 'MeasRestrictionConfig-time-interference' (see 38.214, section 5.2.1.1) - timeRestrictionForInterferenceMeasurements ENUMERATED {configured, notConfigured}, - -- Codebook configuration for Type-1 or Type-II including codebook subset restriction - codebookConfig CodebookConfig, - -- Maximum number of CQIs per CSI report (cf. 1 for 1-CW, 2 for 2-CW) - nrofCQIsPerReport ENUMERATED {n1, n2}, - -- Turning on/off group beam based reporting (see 38.214, section 5.2.1.4) - groupBasedBeamReporting CHOICE { - enabled NULL, - disabled SEQUENCE { - -- The number (N) of measured RS resources to be reported per report setting in a non-group-based report. - -- N <= N_max, where N_max is either 2 or 4 depending on UE capability. - -- FFS: The signaling mechanism for the gNB to select a subset of N beams for the UE to measure and report. - -- FFS: Note: this parameter may not be needed for certain resource and/or report settings - -- FFS_ASN1: Change groupBasedBeamReporting into a CHOICE and include this field into the "no" option? - -- (see 38.214, section FFS_Section) - -- When the field is absent the UE applies the value 1 - nrofReportedRS ENUMERATED {n1, n2, n3, n4} OPTIONAL -- Need S - } - }, - - -- Which CQI table to use for CQI calculation. Corresponds to L1 parameter 'CQI-table' (see 38.214, section 5.2.2.1) - cqi-Table ENUMERATED {table1, table2, spare2, spare1} OPTIONAL, - -- Indicates one out of two possible BWP-dependent values for the subband size as indicated in 38.214 table 5.2.1.4-2 - -- Corresponds to L1 parameter 'SubbandSize' (see 38.214, section 5.2.1.4) - subbandSize ENUMERATED {value1, value2}, - -- BLER target that the UE shall be assume in its CQI calculation. - -- Corresponds to L1 parameter 'BLER-Target' (see 38.214, section 5.2.2.1) - -- FFS_Values (now filled with spares) - bler-Target ENUMERATED {zerodot1, spare3, space2, spare1} OPTIONAL, - -- Port indication for RI/CQI calculation. For each CSI-RS resource in the linked ResourceConfig for channel measurement, - -- a port indication for each rank R, indicating which R ports to use. Applicable only for non-PMI feedback. - -- Corresponds to L1 parameter 'Non-PMI-PortIndication' (see 38.214, section FFS_Section) - -- The first entry in non-PMI-PortIndication corresponds to the NZP-CSI-RS-Resource indicated by the first entry in - -- nzp-CSI-RS-Resources in the NZP-CSI-RS-ResourceSet indicated in the first entry of nzp-CSI-RS-ResourceSetList of the - -- CSI-ResourceConfig whose CSI-ResourceConfigId is indicated in a CSI-MeasId together with the above CSI-ReportConfigId, - -- the second entry in non-PMI-PortIndication corresponds to the NZP-CSI-RS-Resource indicated by the second entry in - -- nzp-CSI-RS-Resources in the NZP-CSI-RS-ResourceSet indicated in the first entry of nzp-CSI-RS-ResourceSetList of the - -- same CSI-ResourceConfig, and so on until the NZP-CSI-RS-Resource indicated by the last entry in nzp-CSI-RS-Resources - -- in the in the NZP-CSI-RS-ResourceSet indicated in the first entry of nzp-CSI-RS-ResourceSetList of the - -- same CSI-ResourceConfig, then the next entry corresponds to the NZP-CSI-RS-Resource indicated by the first entry - -- in nzp-CSI-RS-Resources in the NZP-CSI-RS-ResourceSet indicated in the second entry of nzp-CSI-RS-ResourceSetList of the - -- same CSI-ResourceConfig and so on. - non-PMI-PortIndication SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-ResourcesPerConfig)) OF PortIndexFor8Ranks OPTIONAL, ... -} - -CSI-ReportPeriodicityAndOffset ::= CHOICE { - slots4 INTEGER(0..3), - slots5 INTEGER(0..4), - slots8 INTEGER(0..7), - slots10 INTEGER(0..9), - slots16 INTEGER(0..15), - slots20 INTEGER(0..19), - slots40 INTEGER(0..39), - slots80 INTEGER(0..79), - slots160 INTEGER(0..159), - slots320 INTEGER(0..319) -} - -PUCCH-CSI-Resource ::= CHOICE { - uplinkBandwidthPartId BWP-Id, - -- PUCCH resource for the associated uplink BWP. Only PUCCH-Resource of format 2, 3 and 4 is supported. - pucch-Resource PUCCH-Resource -} - --- The PortIndexFor8Ranks allows to indicate port indexes for 1 to 8 ranks using a port index ranges from 0 to 31, or from 0 to 15, or from 0 --- to 7, or from 0 to 3, or from 0 to 1, or with 0 only. - -PortIndexFor8Ranks ::= CHOICE { - portIndex8 SEQUENCE{ - rank1-8 PortIndex8, - rank2-8 SEQUENCE(SIZE(1..2)) OF PortIndex8, - rank3-8 SEQUENCE(SIZE(1..3)) OF PortIndex8, - rank4-8 SEQUENCE(SIZE(1..4)) OF PortIndex8, - rank5-8 SEQUENCE(SIZE(1..5)) OF PortIndex8, - rank6-8 SEQUENCE(SIZE(1..6)) OF PortIndex8, - rank7-8 SEQUENCE(SIZE(1..7)) OF PortIndex8, - rank8-8 SEQUENCE(SIZE(1..8)) OF PortIndex8 - }, - portIndex4 SEQUENCE{ - rank1-4 PortIndex4, - rank2-4 SEQUENCE(SIZE(1..2)) OF PortIndex4, - rank3-4 SEQUENCE(SIZE(1..3)) OF PortIndex4, - rank4-4 SEQUENCE(SIZE(1..4)) OF PortIndex4 - }, - portIndex2 SEQUENCE{ - rank1-2 PortIndex2, - rank2-2 SEQUENCE(SIZE(1..2)) OF PortIndex2 - }, - portIndex1 NULL -} - -PortIndex8::= INTEGER (0..7) -PortIndex4::= INTEGER (0..3) -PortIndex2::= INTEGER (0..1) - -maxNrofNZP-CSI-RS-ResourcesPerConfig INTEGER ::= 128 --- TAG-CSI-REPORTCONFIG-STOP --- TAG-CSI-REPORTCONFIGID-START -CSI-ReportConfigId ::= INTEGER (0..maxNrofCSI-ReportConfigurations-1) - --- TAG-CSI-REPORTCONFIGID-STOP --- TAG-CSI-RESOURCECONFIG-START - --- One CSI resource configuration comprising of one or more resource sets -CSI-ResourceConfig ::= SEQUENCE { - - -- Used in CSI-ReportConfig to refer to an instance of CSI-ResourceConfig - csi-ResourceConfigId CSI-ResourceConfigId, - - -- Contains up to maxNrofNZP-CSI-RS-ResourceSetsPerConfig resource sets if ResourceConfigType is 'aperiodic' and 1 otherwise. - -- Corresponds to L1 parameter 'ResourceSetConfigList' (see 38.214, section 5.2.1.3.1) - csi-RS-ResourceSetList CHOICE { - nzp-CSI-RS-SSB SEQUENCE { - nzp-CSI-RS-ResourceSetList SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-ResourceSetsPerConfig)) OF NZP-CSI-RS-ResourceSetId OPTIONAL, - -- List of SSB resources used for beam measurement and reporting in a resource set - -- Corresponds to L1 parameter 'resource-config-SS-list' (see 38,214, section FFS_Section) - csi-SSB-ResourceSetList SEQUENCE (SIZE (1..maxNrofCSI-SSB-ResourceSetsPerConfig)) OF CSI-SSB-ResourceSetId OPTIONAL - }, - csi-IM-ResourceSetList SEQUENCE (SIZE (1..maxNrofCSI-IM-ResourceSetsPerConfig)) OF CSI-IM-ResourceSetId - }, - - - -- The DL BWP which the CSI-RS associated with this CSI-ResourceConfig are located in. - -- Corresponds to L1 parameter 'BWP-Info' (see 38.214, section 5.2.1.2 - bwp-Id BWP-Id, - - -- Time domain behavior of resource configuration. Corresponds to L1 parameter 'ResourceConfigType' (see 38.214, section 5.2.2.3.5) - resourceType ENUMERATED { aperiodic, semiPersistent, periodic }, - ... -} - --- TAG-CSI-RESOURCECONFIGTOADDMOD-STOP --- TAG-CSI-RESOURCECONFIGID-START -CSI-ResourceConfigId ::= INTEGER (0..maxNrofCSI-ResourceConfigurations-1) - --- TAG-CSI-RESOURCECONFIGID-STOP --- TAG-CSI-RESOURCEPERIODICITYANDOFFSET-START - -CSI-ResourcePeriodicityAndOffset ::= CHOICE { - slots4 INTEGER (0..3), - slots5 INTEGER (0..4), - slots8 INTEGER (0..7), - slots10 INTEGER (0..9), - slots16 INTEGER (0..15), - slots20 INTEGER (0..19), - slots32 INTEGER (0..31), - slots40 INTEGER (0..39), - slots64 INTEGER (0..63), - slots80 INTEGER (0..79), - slots160 INTEGER (0..159), - slots320 INTEGER (0..319), - slots640 INTEGER (0..639) -} - --- TAG-CSI-RESIYRCEPERIODICITYANDOFFSET-STOP --- TAG-CSI-RS-RESOURCEMAPPING-START - -CSI-RS-ResourceMapping ::= SEQUENCE { - -- Frequency domain allocation within a physical resource block in accordance with 38.211, section 7.4.1.5.3 including table 7.4.1.5.2-1. - -- The number of bits that may be set to one depend on the chosen row in that table. For the choice "other", the row can be determined from - -- the parmeters below and from the number of bits set to 1 in frequencyDomainAllocation. - frequencyDomainAllocation CHOICE { - row1 BIT STRING (SIZE (4)), - row2 BIT STRING (SIZE (12)), - row4 BIT STRING (SIZE (3)), - other BIT STRING (SIZE (6)) - }, - -- Number of ports (see 38.214, section 5.2.2.3.1) - nrofPorts ENUMERATED {p1,p2,p4,p8,p12,p16,p24,p32}, - -- Time domain allocation within a physical resource block. The field indicates the first OFDM symbol in the PRB used for CSI-RS. - -- Parameter l0 in 38.211, section 7.4.1.5.3. Value 2 is supported only when DL-DMRS-typeA-pos equals 3. - firstOFDMSymbolInTimeDomain INTEGER (0..13), - -- Time domain allocation within a physical resource block. Parameter l1 in 38.211, section 7.4.1.5.3. - firstOFDMSymbolInTimeDomain2 INTEGER (0..13) OPTIONAL, -- Need R - -- CDM type (see 38.214, section 5.2.2.3.1) - cdm-Type ENUMERATED {noCDM, fd-CDM2, cdm4-FD2-TD2, cdm8-FD2-TD4}, - -- Density of CSI-RS resource measured in RE/port/PRB. Corresponds to L1 parameter 'CSI-RS-Density' (see 38.211, section 7.4.1.5.3) - -- Values 0.5 (dot5), 1 (one) and 3 (three) are allowed for X=1, - -- values 0.5 (dot5) and 1 (one) are allowed for X=2, 16, 24 and 32, - -- value 1 (one) is allowed for X=4, 8, 12. - -- For density = 1/2, includes 1 bit indication for RB level comb offset indicating whether odd or even RBs are occupied by CSI-RS - density CHOICE { - dot5 ENUMERATED {evenPRBs, oddPRBs}, - one NULL, - three NULL, - spare NULL - }, - -- Wideband or partial band CSI-RS. Corresponds to L1 parameter 'CSI-RS-FreqBand' (see 38.214, section 5.2.2.3.1) - freqBand CSI-FrequencyOccupation, - ... -} - --- TAG-CSI-RS-RESOURCEMAPPING-STOP --- TAG-CSI-SEMIPERSISTENTONPUSCHTRIGGERSTATELIST-START - -CSI-SemiPersistentOnPUSCH-TriggerStateList ::= SEQUENCE(SIZE (1..maxNrOfSemiPersistentPUSCH-Triggers)) OF CSI-SemiPersistentOnPUSCH-TriggerState -CSI-SemiPersistentOnPUSCH-TriggerState ::= SEQUENCE { - associatedReportConfigInfo CSI-ReportConfigId, - ... -} - -maxNrOfSemiPersistentPUSCH-Triggers INTEGER ::= 64 -- Maximum number of triggers for semi persistent reporting on PUSCH - --- TAG-CSI-SEMIPERSISTENTONPUSCHTRIGGERSTATELIST-STOP --- TAG-CSI-SSB-RESOURCESETID-START - -CSI-SSB-ResourceSetId ::= INTEGER (0..maxNrofCSI-SSB-ResourceSets-1) - --- TAG-CSI-SSB-RESOURCESETID-STOP --- TAG-CSI-SSB-RESOURCESET-START - -CSI-SSB-ResourceSet ::= SEQUENCE { - csi-SSB-ResourceSetId CSI-SSB-ResourceSetId, - csi-SSB-ResourceList SEQUENCE (SIZE(1..maxNrofCSI-SSB-ResourcePerSet)) OF SSB-Index, - ... -} - --- TAG-CSI-SSB-RESOURCESET-STOP --- TAG-DMRS-DOWNLINKCONFIG-START - -DMRS-DownlinkConfig ::= SEQUENCE { - -- Selection of the DMRS type to be used for DL (see 38.211, section 7.4.1.1.1). - -- If the field is absent, the UE uses DMRS type 1. - dmrs-Type ENUMERATED {type2} OPTIONAL, -- Need R - -- Position for additional DM-RS in DL, see Table 7.4.1.1.2-4 in 38.211. - -- The four values represent the cases of 1+0, 1+1, 1+1+1. 1+1+1+1 non-adjacent OFDM symbols for DL. - -- If the field is absent, the UE applies the value pos2. - dmrs-AdditionalPosition ENUMERATED {pos0, pos1, pos3} OPTIONAL, -- Need R - -- DM-RS groups that are QCL:ed, i.e. group 1 (see 38.214, section 5.1) - dmrs-group1 BIT STRING (SIZE (12)) OPTIONAL, -- Need R - -- DM-RS groups that are QCL:ed, i.e. group 2 (see 38.214, section 5.1) - dmrs-group2 BIT STRING (SIZE (12)) OPTIONAL, -- Need R - -- The maximum number of OFDM symbols for DL front loaded DMRS. 'len1' corresponds to value 1. 'len2 corresponds to value 2. - -- If the field is absent, the UE applies value len1. - -- Corresponds to L1 parameter 'DL-DMRS-max-len' (see 38.214, section 5.1) - maxLength ENUMERATED {len2} OPTIONAL, -- Need R - -- DL DMRS scrambling initalization - -- Corresponds to L1 parameter 'n_SCID 0' (see 38.211, section 7.4.1) - -- When the field is absent the UE applies the value Physical cell ID (physCellId) configured for this serving cell." - scramblingID0 INTEGER (0..65535) OPTIONAL, -- Need S - -- DL DMRS scrambling initalization. Corresponds to L1 parameter 'n_SCID 1' (see 38.211, section 7.4.1) - -- When the field is absent the UE applies the value (physCellId) configured for this serving cell. - scramblingID1 INTEGER (0..65535) OPTIONAL, -- Need S - - -- Configures downlink PTRS. If absent of released, the UE assumes that downlink PTRS are not present. See 38.214 section 5.1.6.3 - phaseTrackingRS SetupRelease { PTRS-DownlinkConfig } OPTIONAL, -- Need M - - ... -} - --- TAG-DMRS-DOWNLINKCONFIG-STOP --- TAG-DMRS-UPLINKCONFIG-START - -DMRS-UplinkConfig ::= SEQUENCE { - -- Selection of the DMRS type to be used for UL (see section 38.211, section 6.4.1.1.3) - -- If the field is absent, the UE uses DMRS type 1. - dmrs-Type ENUMERATED {type2} OPTIONAL, -- Need R - -- Position for additional DM-RS in UL. Corresponds to L1 parameter 'UL-DMRS-add-pos' (see Table 7.4.1.1.2-4 in 38.211) - -- The four values represent the cases of 1+0, 1+1, 1+1+1. 1+1+1+1 non-adjacent OFDM symbols for UL. - -- If the field is absent, the UE applies the value pos2. - dmrs-AdditionalPosition ENUMERATED {pos0, pos1, pos3} OPTIONAL, -- Need R - -- Configures uplink PTRS (see 38.211, section x.x.x.x) FFS_Ref - phaseTrackingRS SetupRelease { PTRS-UplinkConfig } OPTIONAL, -- Need M - -- The maximum number of OFDM symbols for UL front loaded DMRS. 'len1' corresponds to value 1. 'len2 corresponds to value 2. - -- If the field is absent, the UE applies value len1. - -- Corresponds to L1 parameter 'UL-DMRS-max-len' (see 38.214, section 6.4.1.1.2) - maxLength ENUMERATED {len2} OPTIONAL, -- Need R - - transformPrecoding CHOICE { - -- DMRS related parameters for Cyclic Prefix OFDM - disabled SEQUENCE { - -- UL DMRS scrambling initalization for CP-OFDM - -- Corresponds to L1 parameter 'n_SCID 0' (see 38.214, section 6.4.1.1.2) - -- When the field is absent the UE applies the value Physical cell ID (physCellId) - scramblingID0 INTEGER (0..65535) OPTIONAL, -- Need S - -- UL DMRS scrambling initalization for CP-OFDM. - -- Corresponds to L1 parameter 'n_SCID 1' (see 38.214, section 6.4.1.1.2) - -- When the field is absent the UE applies the value Physical cell ID (physCellId) - scramblingID1 INTEGER (0..65535) OPTIONAL -- Need S - - }, - -- DMRS related parameters for DFT-s-OFDM (Transform Precoding) - enabled SEQUENCE { - -- Parameter: N_ID^(PUSCH) for DFT-s-OFDM DMRS. If the value is absent or released, the UE uses the Physical cell ID. - -- Corresponds to L1 parameter 'nPUSCH-Identity-Transform precoding' (see 38.211, section FFS_Section) - nPUSCH-Identity INTEGER(0..1007) OPTIONAL, -- Need S - -- Sequence-group hopping for PUSCH can be disabled for a certain UE despite being enabled on a cell basis. For DFT-s-OFDM DMRS - -- If the field is released, the UE considers group hopping to be enabled. - -- Corresponds to L1 parameter 'Disable-sequence-group-hopping-Transform-precoding' (see 38.211, section FFS_Section) - disableSequenceGroupHopping ENUMERATED {disabled} OPTIONAL, -- Need S - -- Determines if sequence hopping is enabled or not. For DFT-s-OFDM DMRS. - -- If the field is released, the UE considers sequence hopping to be disabled. - -- Corresponds to L1 parameter 'Sequence-hopping-enabled-Transform-precoding' (see 38.211, section FFS_Section) - sequenceHoppingEnabled ENUMERATED {enabled} OPTIONAL -- Need S - } - }, - ... -} - --- TAG-DMRS-UPLINKCONFIG-STOP --- TAG-DOWNLINKPREEMPTION-START - --- Configuration of downlink preemption indication on PDCCH. -DownlinkPreemption ::= SEQUENCE { - -- RNTI used for indication pre-emption in DL. - -- Corresponds to L1 parameter 'INT-RNTI', where ”INT” stands for ”interruption” (see 38.213, section 10) - int-RNTI RNTI-Value, - - -- Set selection for DL-preemption indication. Corresponds to L1 parameter 'int-TF-unit' (see 38.213, section 10.1) - -- The set determines how the UE interprets the DL preemption DCI payload. - timeFrequencySet ENUMERATED {set0, set1}, - - -- Total length of the DCI payload scrambled with INT-RNTI. The value must be an integer multiple of 14 bit. - -- Corresponds to L1 parameter 'INT-DCI-payload-length' (see 38.213, section 11.2) - dci-PayloadSize INTEGER (0..maxINT-DCI-PayloadSize), - - -- Indicates (per serving cell) the position of the 14 bit INT values inside the DCI payload. - -- Corresponds to L1 parameter 'INT-cell-to-INT' and 'cell-to-INT' (see 38.213, section 11.2) - int-ConfigurationPerServingCell SEQUENCE (SIZE (1..maxNrofServingCells)) OF INT-ConfigurationPerServingCell, - ... -} - -INT-ConfigurationPerServingCell ::= SEQUENCE { - servingCellId ServCellIndex, - -- Starting position (in number of bit) of the 14 bit INT value applicable for this serving cell (servingCellId) within the DCI - -- payload. Must be multiples of 14 (bit). Corresponds to L1 parameter 'INT-values' (see 38.213, section 11.2) - positionInDCI INTEGER (0..maxINT-DCI-PayloadSize-1) -} - --- TAG-DOWNLINKPREEMPTION-STOP --- TAG-DRB-IDENTITY-START - -DRB-Identity ::= INTEGER (1..32) - --- TAG-DRB-IDENTITY-STOP --- TAG-EUTRA-MBSFN-SUBFRAMECONFIGLIST-START - -EUTRA-MBSFN-SubframeConfigList ::= SEQUENCE (SIZE (1..maxMBSFN-Allocations)) OF EUTRA-MBSFN-SubframeConfig - -EUTRA-MBSFN-SubframeConfig ::= SEQUENCE { - -- Field as defined in MBSFN-SubframeConfig in 36.331 - radioframeAllocationPeriod ENUMERATED {n1, n2, n4, n8, n16, n32}, - -- Field as defined in MBSFN-SubframeConfig in 36.331 - radioframeAllocationOffset INTEGER (0..7), - -- Field as defined in MBSFN-SubframeConfig in 36.331 - subframeAllocation CHOICE { - -- Field as defined in MBSFN-SubframeConfig in 36.331 - oneFrame BIT STRING (SIZE(6)), - -- Field as defined in MBSFN-SubframeConfig in 36.331 - fourFrames BIT STRING (SIZE(24)) - }, - subframeAllocation-v1430 CHOICE { - -- Field as defined in MBSFN-SubframeConfig in 36.331 - oneFrame-v1430 BIT STRING (SIZE(2)), - -- Field as defined in MBSFN-SubframeConfig in 36.331 - fourFrames-v1430 BIT STRING (SIZE(8)) - } OPTIONAL, -- Need R - ... -} - --- TAG-EUTRA-MBSFN-SUBFRAMECONFIGLIST-STOP - -FilterCoefficient ::= ENUMERATED { - fc0, fc1, fc2, fc3, fc4, fc5, - fc6, fc7, fc8, fc9, fc11, fc13, - fc15, fc17, fc19, spare1, ...} - --- TAG-FREQBANDINDICATORNR-START - -FreqBandIndicatorNR ::= INTEGER (1..1024) - --- TAG-FREQBANDINDICATORNR-STOP --- TAG-FREQUENCY-INFO-DL-START - -FrequencyInfoDL ::= SEQUENCE { - -- Frequency of the SSB to be used for this serving cell. The frequency provided in this field identifies the position of - -- resource element RE=#0 (subcarrier #0) of resource block RB#10 of the SS block. The cell-defining SSB of an SpCell is always on - -- the sync raster. Frequencies are considered to be on the sync raster if they are also identifiable with a GSCN value (see 38.101). - absoluteFrequencySSB ARFCN-ValueNR, - -- The frequency domain offset between SSB and the overall resource block grid in number of subcarriers. - -- Absence of the field indicates that no offset is applied (offset = 0). For FR2 only values up to 11 are applicable. - -- Corresponds to L1 parameter kssb (See 38.211, section 7.4.3.1) - ssb-SubcarrierOffset INTEGER (1..23) OPTIONAL, -- Need S - -- List of one or multiple frequency bands to which this carrier(s) belongs. Multiple values are only supported in - -- system information but not when the FrequencyInfoDL is provided in dedicated signalling (HO or S(p)Cell addition). - frequencyBandList MultiFrequencyBandListNR, - -- Absolute frequency position of the reference resource block (Common RB 0). Its lowest subcarrier is also known as Point A. - -- Note that the lower edge of the actual carrier is not defined by this field but rather in the scs-SpecificCarrierList. - -- Corresponds to L1 parameter 'offset-ref-low-scs-ref-PRB' (see 38.211, section FFS_Section) - absoluteFrequencyPointA ARFCN-ValueNR, - - -- A set of carriers for different subcarrier spacings (numerologies). Defined in relation to Point A. - -- Corresponds to L1 parameter 'offset-pointA-set' (see 38.211, section FFS_Section) - scs-SpecificCarrierList SEQUENCE (SIZE (1..maxSCSs)) OF SCS-SpecificCarrier, - ... -} - --- TAG-FREQUENCY-INFO-UL-STOP --- TAG-FREQUENCY-INFO-UL-START - -FrequencyInfoUL ::= SEQUENCE { - -- List of one or multiple frequency bands to which this carrier(s) belongs. Multiple values are only supported in - -- system information but not when the FrequencyInfoDL is provided in dedicated signalling (HO or S(p)Cell addition). - frequencyBandList MultiFrequencyBandListNR OPTIONAL, -- Cond FDD-OrSUL - -- Absolute frequency of the reference resource block (Common RB 0). Its lowest subcarrier is also known as Point A. - -- Corresponds to L1 parameter 'offset-ref-low-scs-ref-PRB' (see 38.211, section FFS_Section) - absoluteFrequencyPointA ARFCN-ValueNR OPTIONAL, -- Cond FDD-OrSUL - -- A set of virtual carriers for different subcarrier spacings (numerologies). Defined in relation to Point A. - -- Note that the lower edge of the actual carrier is not defined by this field but rather in the scs-SpecificCarrierList. - -- Corresponds to L1 parameter 'offset-pointA-set' (see 38.211, section FFS_Section) - scs-SpecificCarriers SEQUENCE (SIZE (1..maxSCSs)) OF SCS-SpecificCarrier, - - -- The additional spectrum emission requirements to be applied by the UE on this uplink. - -- If the field is absent, the UE applies the value FFS_RAN4. (see FFS_section, section FFS_Section) - additionalSpectrumEmission AdditionalSpectrumEmission OPTIONAL, -- Need S - -- FFS_Definition. Corresponds to parameter FFS_RAN4. (see FFS_Spec, section FFS_Section) - -- If the field is absent, the UE applies the value FFS_RAN4. - p-Max P-Max OPTIONAL, -- Need S - -- Enable the NR UL transmission with a 7.5KHz shift to the LTE raster. If the field is absent, the frequency shift is disabled. - frequencyShift7p5khz ENUMERATED {true} OPTIONAL, -- Cond FDD-OrSUL-Optional - ... -} - --- TAG-FREQUENCY-INFO-UL-STOP --- TAG-GSCN-VALUE-NR-START - -GSCN-ValueNR ::= INTEGER (1..28557) - - --- TAG-GSCN-VALUE-NR-STOP - -Hysteresis ::= INTEGER (0..30) - --- TAG-LOGICAL-CHANNEL-CONFIG-START - -LogicalChannelConfig ::= SEQUENCE { - ul-SpecificParameters SEQUENCE { - priority INTEGER (1..16), - prioritisedBitRate ENUMERATED {kBps0, kBps8, kBps16, kBps32, kBps64, kBps128, kBps256, kBps512, - kBps1024, kBps2048, kBps4096, kBps8192, kBps16384, kBps32768, kBps65536, infinity}, - bucketSizeDuration ENUMERATED {ms50, ms100, ms150, ms300, ms500, ms1000, spare2, spare1}, - - allowedServingCells SEQUENCE (SIZE (1..maxNrofServingCells-1)) OF ServCellIndex OPTIONAL, -- Need R - allowedSCS-List SEQUENCE (SIZE (1..maxSCSs)) OF SubcarrierSpacing OPTIONAL, -- Need R - maxPUSCH-Duration ENUMERATED { ms0p02, ms0p04, ms0p0625, ms0p125, ms0p25, ms0p5, spare2, spare1 } OPTIONAL, -- Need R - configuredGrantType1Allowed ENUMERATED {true} OPTIONAL, -- Need R - - logicalChannelGroup INTEGER (0..maxLCG-ID) OPTIONAL, -- Need R - schedulingRequestID SchedulingRequestId OPTIONAL, -- Need R - logicalChannelSR-Mask BOOLEAN, - logicalChannelSR-DelayTimerApplied BOOLEAN - } OPTIONAL, -- Cond UL - - -- other parameters - ... -} - --- TAG-LOGICAL-CHANNEL-CONFIG-STOP --- TAG-MAC-CELL-GROUP-CONFIG-START - -MAC-CellGroupConfig ::= SEQUENCE { - drx-Config SetupRelease { DRX-Config } OPTIONAL, -- Need M - - schedulingRequestConfig SchedulingRequestConfig OPTIONAL, -- Need M - bsr-Config BSR-Config OPTIONAL, -- Need M - tag-Config TAG-Config OPTIONAL, -- Need M - phr-Config SetupRelease { PHR-Config } OPTIONAL, -- Need M - -- FFS : configurable per SCell? - skipUplinkTxDynamic BOOLEAN, - -- RNTI value for downlink SPS (see SPS-config) and uplink configured scheduling (see ConfiguredSchedulingConfig). - cs-RNTI SetupRelease { RNTI-Value } OPTIONAL -- Need M -} - -DRX-Config ::= SEQUENCE { - drx-onDurationTimer CHOICE { - subMilliSeconds INTEGER (1..31), - milliSeconds ENUMERATED { - ms1, ms2, ms3, ms4, ms5, ms6, ms8, ms10, ms20, ms30, ms40, ms50, ms60, - ms80, ms100, ms200, ms300, ms400, ms500, ms600, ms800, ms1000, ms1200, - ms1600, spare9, spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 } - }, - drx-InactivityTimer ENUMERATED { - ms0, ms1, ms2, ms3, ms4, ms5, ms6, ms8, ms10, ms20, ms30, ms40, ms50, ms60, ms80, - ms100, ms200, ms300, ms500, ms750, ms1280, ms1920, ms2560, spare9, spare8, - spare7, spare6, spare5, spare4, spare3, spare2, spare1}, - drx-HARQ-RTT-TimerDL INTEGER (0..56), - drx-HARQ-RTT-TimerUL INTEGER (0..56), - drx-RetransmissionTimerDL ENUMERATED { - sl0, sl1, sl2, sl4, sl6, sl8, sl16, sl24, sl33, sl40, sl64, sl80, sl96, sl112, sl128, - sl160, sl320, spare15, spare14, spare13, spare12, spare11, spare10, spare9, - spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1}, - drx-RetransmissionTimerUL ENUMERATED { - sl0, sl1, sl2, sl4, sl6, sl8, sl16, sl24, sl33, sl40, sl64, sl80, sl96, sl112, sl128, - sl160, sl320, spare15, spare14, spare13, spare12, spare11, spare10, spare9, - spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 }, - drx-LongCycleStartOffset CHOICE { - ms10 INTEGER(0..9), - ms20 INTEGER(0..19), - ms32 INTEGER(0..31), - ms40 INTEGER(0..39), - ms60 INTEGER(0..59), - ms64 INTEGER(0..63), - ms70 INTEGER(0..69), - ms80 INTEGER(0..79), - ms128 INTEGER(0..127), - ms160 INTEGER(0..159), - ms256 INTEGER(0..255), - ms320 INTEGER(0..319), - ms512 INTEGER(0..511), - ms640 INTEGER(0..639), - ms1024 INTEGER(0..1023), - ms1280 INTEGER(0..1279), - ms2048 INTEGER(0..2047), - ms2560 INTEGER(0..2559), - ms5120 INTEGER(0..5119), - ms10240 INTEGER(0..10239) - }, - -- FFS need for finer offset granulary - -- FFS need for shorter values for long and short cycles - shortDRX SEQUENCE { - drx-ShortCycle ENUMERATED { - ms2, ms3, ms4, ms5, ms6, ms7, ms8, ms10, ms14, ms16, ms20, ms30, ms32, - ms35, ms40, ms64, ms80, ms128, ms160, ms256, ms320, ms512, ms640, spare9, - spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 }, - drx-ShortCycleTimer INTEGER (1..16) - } OPTIONAL, -- Need R - drx-SlotOffset INTEGER (0..31) - -} - -PHR-Config ::= SEQUENCE { - phr-PeriodicTimer ENUMERATED {sf10, sf20, sf50, sf100, sf200,sf500, sf1000, infinity}, - phr-ProhibitTimer ENUMERATED {sf0, sf10, sf20, sf50, sf100,sf200, sf500, sf1000}, - phr-Tx-PowerFactorChange ENUMERATED {dB1, dB3, dB6, infinity}, - multiplePHR BOOLEAN, - phr-Type2PCell BOOLEAN, - phr-Type2OtherCell BOOLEAN, - phr-ModeOtherCG ENUMERATED {real, virtual} - -} - - -TAG-Config ::= SEQUENCE { - tag-ToReleaseList SEQUENCE (SIZE (1..maxNrofTAGs)) OF TAG-Id OPTIONAL, -- Need N - tag-ToAddModList SEQUENCE (SIZE (1..maxNrofTAGs)) OF TAG-ToAddMod OPTIONAL -- Need N -} - -TAG-ToAddMod ::= SEQUENCE { - tag-Id TAG-Id, - timeAlignmentTimer TimeAlignmentTimer, - ... -} - -TAG-Id ::= INTEGER (0..maxNrofTAGs-1) - -TimeAlignmentTimer ::= ENUMERATED {ms500, ms750, ms1280, ms1920, ms2560, ms5120, ms10240, infinity} - -BSR-Config ::= SEQUENCE { - periodicBSR-Timer ENUMERATED { - sf1, sf5, sf10, sf16, sf20, sf32, sf40, sf64, sf80, sf128, sf160, sf320, sf640, sf1280, sf2560, infinity}, - retxBSR-Timer ENUMERATED { sf10, sf20, sf40, sf80, sf160, sf320, sf640, sf1280, sf2560, sf5120, sf10240, spare5, spare4, - spare3, spare2, spare1}, - logicalChannelSR-DelayTimer ENUMERATED { sf20, sf40, sf64, sf128, sf512, sf1024, sf2560, spare1} OPTIONAL -- Need R -} - - - --- TAG-MAC-CELL-GROUP-CONFIG-STOP --- TAG-MEAS-CONFIG-START - -MeasConfig ::= SEQUENCE { - -- Measurement objects - measObjectToRemoveList MeasObjectToRemoveList OPTIONAL, -- Need N - measObjectToAddModList MeasObjectToAddModList OPTIONAL, -- Need N - - -- Reporting configurations - reportConfigToRemoveList ReportConfigToRemoveList OPTIONAL, -- Need N - reportConfigToAddModList ReportConfigToAddModList OPTIONAL, -- Need N - - -- Measurement identities - measIdToRemoveList MeasIdToRemoveList OPTIONAL, -- Need N - measIdToAddModList MeasIdToAddModList OPTIONAL, -- Need N - - -- Other parameters - --s-Measure config - s-MeasureConfig CHOICE { - ssb-RSRP RSRP-Range, - csi-RSRP RSRP-Range - } OPTIONAL, -- Need M - - quantityConfig QuantityConfig OPTIONAL, -- Need M - - --Placehold for measGapConfig - measGapConfig MeasGapConfig OPTIONAL, -- Need M - ... -} - -MeasObjectToRemoveList ::= SEQUENCE (SIZE (1..maxNrofObjectId)) OF MeasObjectId - -MeasIdToRemoveList ::= SEQUENCE (SIZE (1..maxNrofMeasId)) OF MeasId - -ReportConfigToRemoveList ::= SEQUENCE (SIZE (1..maxReportConfigId)) OF ReportConfigId - --- TAG-MEAS-CONFIG-STOP ---TAG-MEAS-GAP-CONFIG-START - -MeasGapConfig ::= SEQUENCE { - gapFR2 SetupRelease { GapConfig } OPTIONAL, - ... -} - -GapConfig ::= SEQUENCE { - gapOffset INTEGER (0..159), - mgl ENUMERATED {ms1dot5, ms3, ms3dot5, ms4, ms5dot5, ms6}, - mgrp ENUMERATED {ms20, ms40, ms80, ms160}, - mgta ENUMERATED {ms0, ms0dot25, ms0dot5}, - ... -} - --- TAG-MEAS-GAP-CONFIG-STOP --- TAG-MEAS-ID-START - -MeasId ::= INTEGER (1..maxNrofMeasId) - --- TAG-MEAS-ID-STOP --- TAG-MEAS-ID-TO-ADD-MOD-LIST-START - -MeasIdToAddModList ::= SEQUENCE (SIZE (1..maxNrofMeasId)) OF MeasIdToAddMod - -MeasIdToAddMod ::= SEQUENCE { - measId MeasId, - measObjectId MeasObjectId, - reportConfigId ReportConfigId -} - --- TAG-MEAS-ID-TO-ADD-MOD-LIST-STOP --- TAG-MEAS-OBJECT-ID-START - -MeasObjectId ::= INTEGER (1..maxNrofObjectId) - --- TAG-MEAS-OBJECT-ID-STOP --- TAG-MEAS-OBJECT-NR-START - -MeasObjectNR ::= SEQUENCE { - ssbFrequency ARFCN-ValueNR OPTIONAL, - refFreqCSI-RS ARFCN-ValueNR OPTIONAL, - - --RS configuration (e.g. SMTC window, CSI-RS resource, etc.) - referenceSignalConfig ReferenceSignalConfig, - - --Consolidation of L1 measurements per RS index - absThreshSS-BlocksConsolidation ThresholdNR OPTIONAL, -- Need R - absThreshCSI-RS-Consolidation ThresholdNR OPTIONAL, -- Need R - - --Config for cell measurement derivation - nrofSS-BlocksToAverage INTEGER (2..maxNrofSS-BlocksToAverage) OPTIONAL, -- Need R - nrofCSI-RS-ResourcesToAverage INTEGER (2..maxNrofCSI-RS-ResourcesToAverage) OPTIONAL, -- Need R - - -- Filter coefficients applicable to this measurement object - quantityConfigIndex INTEGER (1..maxNrofQuantityConfig), - - --Frequency-specific offsets - offsetFreq Q-OffsetRangeList, - - -- Cell list - cellsToRemoveList PCI-List OPTIONAL, -- Need N - cellsToAddModList CellsToAddModList OPTIONAL, -- Need N - - -- Black list - blackCellsToRemoveList PCI-RangeIndexList OPTIONAL, -- Need N - blackCellsToAddModList BlackCellsToAddModList OPTIONAL, -- Need N - - -- White list - whiteCellsToRemoveList PCI-RangeIndexList OPTIONAL, -- Need N - whiteCellsToAddModList WhiteCellsToAddModList OPTIONAL, -- Need N - ... -} - -ReferenceSignalConfig::= SEQUENCE { - - - -- SSB configuration for mobility (nominal SSBs, timing configuration) - ssb-ConfigMobility SSB-ConfigMobility OPTIONAL, -- Need M - -- CSI-RS resources to be used for CSI-RS based RRM measurements - csi-rs-ResourceConfigMobility SetupRelease { CSI-RS-ResourceConfigMobility } OPTIONAL-- Need M - -} - --- A measurement timing configuration -SSB-ConfigMobility::= SEQUENCE { - --Only the values 15, 30 or 60 kHz (<6GHz), 60 or 120 kHz (>6GHz) are applicable - subcarrierSpacing SubcarrierSpacing, - -- The set of SS blocks to be measured within the SMTC measurement duration. - -- Corresponds to L1 parameter 'SSB-measured' (see FFS_Spec, section FFS_Section) - -- When the field is absent the UE measures on all SS-blocks - -- FFS_CHECK: Is this IE placed correctly. - ssb-ToMeasure SetupRelease { SSB-ToMeasure } OPTIONAL, -- Need M - - -- Indicates whether the UE can utilize serving cell timing to derive the index of SS block transmitted by neighbour cell: - useServingCellTimingForSync BOOLEAN, - - -- Primary measurement timing configuration. Applicable for intra- and inter-frequency measurements. - smtc1 SEQUENCE { - -- Periodicity and offset of the measurement window in which to receive SS/PBCH blocks. - -- Periodicity and offset are given in number of subframes. - -- FFS_FIXME: This does not match the L1 parameter table! They seem to intend an index to a hidden table in L1 specs. - -- (see 38.213, section REF): - periodicityAndOffset CHOICE { - sf5 INTEGER (0..4), - sf10 INTEGER (0..9), - sf20 INTEGER (0..19), - sf40 INTEGER (0..39), - sf80 INTEGER (0..79), - sf160 INTEGER (0..159) - }, - -- Duration of the measurement window in which to receive SS/PBCH blocks. It is given in number of subframes - -- (see 38.213, section 4.1) - duration ENUMERATED { sf1, sf2, sf3, sf4, sf5 } - }, - - -- Secondary measurement timing confguration for explicitly signalled PCIs. It uses the offset and duration from smtc1. - -- It is supported only for intra-frequency measurements in RRC CONNECTED. - smtc2 SEQUENCE { - -- PCIs that are known to follow this SMTC. - pci-List SEQUENCE (SIZE (1..maxNrofPCIsPerSMTC)) OF PhysCellId OPTIONAL, -- Need M - -- Periodicity for the given PCIs. Timing offset and Duration as provided in smtc1. - periodicity ENUMERATED {sf5, sf10, sf20, sf40, sf80, sf160, spare2, spare1} - } OPTIONAL,-- Cond IntraFreqConnected - ss-RSSI-Measurement SEQUENCE { - measurementSlots CHOICE { - kHz15 BIT STRING (SIZE(1)), - kHz30 BIT STRING (SIZE(2)), - kHz60 BIT STRING (SIZE(4)), - kHz120 BIT STRING (SIZE(8)) - }, - endSymbol INTEGER(0..13) - } OPTIONAL -} - -CSI-RS-ResourceConfigMobility ::= SEQUENCE { - -- MO specific values - isServingCellMO BOOLEAN, - -- Subcarrier spacing of CSI-RS. - -- Only the values 15, 30 or 60 kHz (<6GHz), 60 or 120 kHz (>6GHz) are applicable. - -- Corresponds to L1 parameter 'Numerology' (see 38.211, section FFS_Section) - subcarrierSpacing SubcarrierSpacing, - -- List of cells - csi-RS-CellList-Mobility SEQUENCE (SIZE (1..maxNrofCSI-RS-CellsRRM)) OF CSI-RS-CellMobility - -} - -CSI-RS-CellMobility ::= SEQUENCE { - cellId PhysCellId, - - csi-rs-MeasurementBW SEQUENCE { - -- Allowed size of the measurement BW in PRBs - -- Corresponds to L1 parameter 'CSI-RS-measurementBW-size' (see FFS_Spec, section FFS_Section) - nrofPRBs ENUMERATED { size24, size48, size96, size192, size264}, - -- Starting PRB index of the measurement bandwidth - -- Corresponds to L1 parameter 'CSI-RS-measurement-BW-start' (see FFS_Spec, section FFS_Section) - -- FFS_Value: Upper edge of value range unclear in RAN1 - startPRB INTEGER(0..2169) - }, - - -- Frequency domain density for the 1-port CSI-RS for L3 mobility - -- Corresponds to L1 parameter 'Density' (see FFS_Spec, section FFS_Section) - density ENUMERATED {d1,d3} OPTIONAL, - - --- List of resources - csi-rs-ResourceList-Mobility SEQUENCE (SIZE (1..maxNrofCSI-RS-ResourcesRRM)) OF CSI-RS-Resource-Mobility -} - - -CSI-RS-Resource-Mobility ::= SEQUENCE { - csi-RS-Index CSI-RS-Index, - -- Contains periodicity and slot offset for periodic/semi-persistent CSI-RS (see 38.211, section x.x.x.x)FFS_Ref - slotConfig CHOICE { - ms4 INTEGER (0..31), - ms5 INTEGER (0..39), - ms10 INTEGER (0..79), - ms20 INTEGER (0..159), - ms40 INTEGER (0..319) - }, - -- Each CSI-RS resource may be associated with one SSB. If such SSB is indicated, the NW also indicates whether the UE may assume - -- quasi-colocation of this SSB with this CSI-RS reosurce. - -- Corresponds to L1 parameter 'Associated-SSB' (see FFS_Spec, section FFS_Section) - - associatedSSB SEQUENCE { - ssb-Index SSB-Index, - -- The CSI-RS resource is either QCL’ed not QCL’ed with the associated SSB in spatial parameters - -- Corresponds to L1 parameter 'QCLed-SSB' (see FFS_Spec, section FFS_Section) - isQuasiColocated BOOLEAN - } OPTIONAL, -- Cond AssociatedSSB - - - -- Frequency domain allocation within a physical resource block in accordance with 38.211, section 7.4.1.5.3 including table 7.4.1.5.2-1. - -- The number of bits that may be set to one depend on the chosen row in that table. For the choice "other", the row can be determined from - -- the parmeters below and from the number of bits set to 1 in frequencyDomainAllocation. - frequencyDomainAllocation CHOICE { - row1 BIT STRING (SIZE (4)), - row2 BIT STRING (SIZE (12)) - }, - - - -- Time domain allocation within a physical resource block. The field indicates the first OFDM symbol in the PRB used for CSI-RS. - -- Parameter l0 in 38.211, section 7.4.1.5.3. Value 2 is supported only when DL-DMRS-typeA-pos equals 3. - firstOFDMSymbolInTimeDomain INTEGER (0..13), - -- Scrambling ID for CSI-RS(see 38.211, section 7.4.1.5.2) - sequenceGenerationConfig INTEGER (0..1023), - ... -} - -CSI-RS-Index ::= INTEGER (0..maxNrofCSI-RS-ResourcesRRM-1) - -Q-OffsetRangeList ::= SEQUENCE { - rsrpOffsetSSB Q-OffsetRange DEFAULT dB0, - rsrqOffsetSSB Q-OffsetRange DEFAULT dB0, - sinrOffsetSSB Q-OffsetRange DEFAULT dB0, - rsrpOffsetCSI-RS Q-OffsetRange DEFAULT dB0, - rsrqOffsetCSI-RS Q-OffsetRange DEFAULT dB0, - sinrOffsetCSI-RS Q-OffsetRange DEFAULT dB0 -} - -SSB-ToMeasure ::= CHOICE { - -- bitmap for sub 3 GHz - shortBitmap BIT STRING (SIZE (4)), - -- bitmap for 3-6 GHz - mediumBitmap BIT STRING (SIZE (8)), - -- bitmap for above 6 GHz - longBitmap BIT STRING (SIZE (64)) -} - - -ThresholdNR ::= SEQUENCE{ - thresholdRSRP RSRP-Range OPTIONAL, - thresholdRSRQ RSRQ-Range OPTIONAL, - thresholdSINR SINR-Range OPTIONAL -} - -CellsToAddModList ::= SEQUENCE (SIZE (1..maxNrofCellMeas)) OF CellsToAddMod - -CellsToAddMod ::= SEQUENCE { - physCellId PhysCellId, - cellIndividualOffset Q-OffsetRangeList -} - -BlackCellsToAddModList ::= SEQUENCE (SIZE (1..maxNrofPCI-Ranges)) OF BlackCellsToAddMod - -BlackCellsToAddMod ::= SEQUENCE { - pci-RangeIndex PCI-RangeIndex, - pci-Range PCI-Range -} - - -WhiteCellsToAddModList ::= SEQUENCE (SIZE (1..maxNrofPCI-Ranges)) OF WhiteCellsToAddMod - -WhiteCellsToAddMod ::= SEQUENCE { - pci-RangeIndex PCI-RangeIndex, - pci-Range PCI-Range -} - --- TAG-MEAS-OBJECT-NR-STOP --- TAG-MEAS-OBJECT-TO-ADD-MOD-LIST-START - -MeasObjectToAddModList ::= SEQUENCE (SIZE (1..maxNrofObjectId)) OF MeasObjectToAddMod - -MeasObjectToAddMod ::= SEQUENCE { - measObjectId MeasObjectId, - measObject CHOICE { - measObjectNR MeasObjectNR, - ... - } -} - --- TAG-MEAS-OBJECT-TO-ADD-MOD-LIST-STOP --- TAG-MEAS-RESULTS-START - -MeasResults ::= SEQUENCE { - measId MeasId, - measResultServingFreqList MeasResultServFreqList, - measResultNeighCells CHOICE { - measResultListNR MeasResultListNR, - ... - } OPTIONAL, - ... -} - -MeasResultServFreqList ::= SEQUENCE (SIZE (1..maxNrofServingCells)) OF MeasResultServFreq - -MeasResultServFreq ::= SEQUENCE { - servFreqId ServCellIndex, - measResultServingCell MeasResultNR, - measResultBestNeighCell MeasResultNR, - ... -} - -MeasResultListNR ::= SEQUENCE (SIZE (1..maxCellReport)) OF MeasResultNR - -MeasResultNR ::= SEQUENCE { - physCellId PhysCellId OPTIONAL, - --FFS: Details of cgi info - cgi-Info ENUMERATED {ffsTypeAndValue} OPTIONAL, - measResult SEQUENCE { - cellResults SEQUENCE{ - resultsSSB-Cell MeasQuantityResults OPTIONAL, - resultsCSI-RS-Cell MeasQuantityResults OPTIONAL - }, - rsIndexResults SEQUENCE{ - resultsSSB-Indexes ResultsPerSSB-IndexList OPTIONAL, - resultsCSI-RS-Indexes ResultsPerCSI-RS-IndexList OPTIONAL - } OPTIONAL - }, - ... -} - - -MeasQuantityResults ::= SEQUENCE { - rsrp RSRP-Range OPTIONAL, - rsrq RSRQ-Range OPTIONAL, - sinr SINR-Range OPTIONAL -} - -ResultsPerSSB-IndexList::= SEQUENCE (SIZE (1..maxNrofSSBs)) OF ResultsPerSSB-Index - -ResultsPerSSB-Index ::= SEQUENCE { - ssb-Index SSB-Index, - ssb-Results MeasQuantityResults OPTIONAL -} - -ResultsPerCSI-RS-IndexList::= SEQUENCE (SIZE (1..maxNrofCSI-RS)) OF ResultsPerCSI-RS-Index - -ResultsPerCSI-RS-Index ::= SEQUENCE { - csi-RS-Index CSI-RS-Index, - csi-RS-Results MeasQuantityResults OPTIONAL -} - --- TAG-MEAS-RESULTS-STOP --- TAG-MEAS-RESULT-SCG-FAILURE-START - -MeasResultSCG-Failure ::= SEQUENCE { - measResultServFreqList MeasResultServFreqList2NR, - measResultNeighCells MeasResultList2NR, - ... -} - -MeasResultServFreqList2NR ::= SEQUENCE (SIZE (1..maxNrofServingCells)) OF MeasResultServFreq2NR - -MeasResultServFreq2NR ::= SEQUENCE { - ssbFrequency ARFCN-ValueNR OPTIONAL, - refFreqCSI-RS ARFCN-ValueNR OPTIONAL, - measResultServingCell MeasResultNR, - measResultBestNeighCell MeasResultNR OPTIONAL -} - -MeasResultList2NR ::= SEQUENCE (SIZE (1..maxFreq)) OF MeasResult2NR - -MeasResult2NR ::= SEQUENCE { - ssbFrequency ARFCN-ValueNR OPTIONAL, - refFreqCSI-RS ARFCN-ValueNR OPTIONAL, - measResultListNR MeasResultListNR -} - --- TAG-MEAS-RESULT-SCG-FAILURE-STOP --- TAG-MEASRESULT-CELL-LIST-SFTD-START - -MeasResultCellListSFTD ::= SEQUENCE (SIZE (1..maxCellSFTD)) OF MeasResultCellSFTD - -MeasResultCellSFTD ::= SEQUENCE { - physCellId PhysCellId, - sfn-OffsetResult INTEGER (0..1023), - frameBoundaryOffsetResult INTEGER (-30720..30719), - rsrp-Result RSRP-Range OPTIONAL -} - --- TAG-MEASRESULT-CELL-LIST-SFTD-STOP --- TAG-MULTIFREQUENCYBANDLISTNR-START - -MultiFrequencyBandListNR ::= SEQUENCE (SIZE (1..maxNrofMultiBands)) OF FreqBandIndicatorNR - --- TAG-MULTIFREQUENCYBANDLISTNR-STOP --- TAG-NZP-CSI-RS-RESOURCESET-START -NZP-CSI-RS-ResourceSet ::= SEQUENCE { - nzp-CSI-ResourceSetId NZP-CSI-RS-ResourceSetId, - - -- NZP-CSI-RS-Resources assocaited with this NZP-CSI-RS resource set. - -- Corresponds to L1 parameter 'CSI-RS-ResourceConfigList' (see 38.214, section 5.2) - -- For CSI, there are at most 8 NZP CSI RS resources per resource set - nzp-CSI-RS-Resources SEQUENCE (SIZE (1..maxNrofNZP-CSI-RS-ResourcesPerSet)) OF NZP-CSI-RS-ResourceId, - - -- Indicates whether repetition is on/off. If set to set to 'OFF', the UE may not assume that the - -- NZP-CSI-RS resources within the resource set are transmitted with the same downlink spatial domain transmission filter - -- and with same NrofPorts in every symbol. - -- Corresponds to L1 parameter 'CSI-RS-ResourceRep' (see 38.214, sections 5.2.2.3.1 and 5.1.6.1.2) - -- Can only be configured for CSI-RS resource sets which are associated with CSI-ReportConfig with report of L1 RSRP or “no report” - repetition ENUMERATED { on, off } OPTIONAL, - - -- Offset X between the slot containing the DCI that triggers a set of aperiodic NZP CSI-RS resources and the slot in which the - -- CSI-RS resource set is transmitted. When the field is absent the UE applies the value 0. - -- Corresponds to L1 parameter 'Aperiodic-NZP-CSI-RS-TriggeringOffset' (see 38,214, section FFS_Section) - aperiodicTriggeringOffset INTEGER(0..4) OPTIONAL, -- Need S - - -- Indicates that the antenna port for all NZP-CSI-RS resources in the CSI-RS resource set is same. - -- Corresponds to L1 parameter 'TRS-Info' (see 38.214, section 5.2.2.3.1) - trs-Info ENUMERATED {true} OPTIONAL, - ... -} - --- TAG-NZP-CSI-RS-RESOURCESET-STOP --- TAG-NZP-CSI-RS-RESOURCESETID-START -NZP-CSI-RS-ResourceSetId ::= INTEGER (0..maxNrofNZP-CSI-RS-ResourceSets-1) - --- TAG-NZP-CSI-RS-RESOURCESETID-STOP --- TAG-NZP-CSI-RS-RESOURCE-START -NZP-CSI-RS-Resource ::= SEQUENCE { - nzp-CSI-RS-ResourceId NZP-CSI-RS-ResourceId, - - -- OFDM symbol location(s) in a slot and subcarrier occupancy in a PRB of the CSI-RS resource - resourceMapping CSI-RS-ResourceMapping, - -- Power offset of NZP CSI-RS RE to PDSCH RE. Value in dB. Corresponds to L1 parameter Pc (see 38.214, sections 5.2.2.3.1 and 4.1) - powerControlOffset INTEGER(-8..15), - -- Power offset of NZP CSI-RS RE to SS RE. Value in dB. Corresponds to L1 parameter 'Pc_SS' (see 38.214, section 5.2.2.3.1) - powerControlOffsetSS ENUMERATED{db-3, db0, db3, db6} OPTIONAL, - -- Scrambling ID (see 38.214, section 5.2.2.3.1) - scramblingID ScramblingId, - - -- Periodicity and slot offset sl1 corresponds to a periodicity of 1 slot, sl2 to a periodicity of two slots, and so on. - -- The corresponding offset is also given in number of slots. Corresponds to L1 parameter 'CSI-RS-timeConfig' (see 38.214, section 5.2.2.3.1) - periodicityAndOffset CSI-ResourcePeriodicityAndOffset OPTIONAL, --Cond PeriodicOrSemiPersistent - - -- For a target periodic CSI-RS, contains a reference to one TCI-State in TCI-States for providing the QCL source and - -- QCL type. For periodic CSI-RS, the source can be SSB or another periodic-CSI-RS. - -- Corresponds to L1 parameter 'QCL-Info-PeriodicCSI-RS' (see 38.214, section 5.2.2.3.1) - qcl-InfoPeriodicCSI-RS TCI-StateId OPTIONAL, --Cond Periodic - ... -} - --- TAG-NZP-CSI-RS-RESOURCE-STOP --- TAG-NZP-CSI-RS-RESOURCEID-START -NZP-CSI-RS-ResourceId ::= INTEGER (0..maxNrofNZP-CSI-RS-Resources-1) - --- TAG-NZP-CSI-RS-RESOURCEID-STOP --- TAG-P-MAX-START - -P-Max ::= INTEGER (-30..33) - --- TAG-P-MAX-STOP --- TAG-PCI-LIST-START - -PCI-List ::= SEQUENCE (SIZE (1..maxNrofCellMeas)) OF PhysCellId - --- TAG-PCI-LIST-STOP --- TAG-PCI-RANGE-START - -PCI-Range ::= SEQUENCE { - start PhysCellId, - range ENUMERATED { - n4, n8, n12, n16, n24, n32, n48, n64, n84, - n96, n128, n168, n252, n504, n1008, - spare1} OPTIONAL -- Need Nss -} - --- TAG-PCI-RANGE-STOP --- TAG-PCI-RANGE-INDEX-START - -PCI-RangeIndex ::= INTEGER (1..maxNrofPCI-Ranges) - - --- TAG-PCI-RANGE-INDEX-STOP --- TAG-PCI-RANGE-INDEX-LIST-START - -PCI-RangeIndexList ::= SEQUENCE (SIZE (1..maxNrofPCI-Ranges)) OF PCI-RangeIndex - --- TAG-PCI-Range-INDEX-LIST-STOP --- TAG-PDCCH-CONFIG-START - -PDCCH-Config ::= SEQUENCE { - -- List of UE specifically configured Control Resource Sets (CORESETs) to be used by the UE. - -- The network configures at most 3 CORESETs per BWP per cell (including the initial CORESET). - controlResourceSetToAddModList SEQUENCE(SIZE (1..3)) OF ControlResourceSet OPTIONAL, - controlResourceSetToReleaseList SEQUENCE(SIZE (1..3)) OF ControlResourceSetId OPTIONAL, - - -- List of UE specifically configured Control Resource Sets (CORESETs). - -- The network configures at most 10 Search Spaces per BWP per cell (including the initial Search Space). - searchSpacesToAddModList SEQUENCE(SIZE (1..10)) OF SearchSpace OPTIONAL, - searchSpacesToReleaseList SEQUENCE(SIZE (1..10)) OF SearchSpaceId OPTIONAL, - - -- Configuration of downlink preemtption indications to be monitored in this cell. - -- Corresponds to L1 parameter 'Preemp-DL' (see 38.214, section 11.2) - -- FFS_RAN1: LS R1-1801281 indicates this is "Per Cell (but association with each configured BWP is needed)" => Unclear, keep on BWP for now. - downlinkPreemption SetupRelease { DownlinkPreemption } OPTIONAL, -- Need M - - -- Configuration of Slot-Format-Indicators to be monitored in this cell - - -- FFS_RAN1 discusses still whether this SFI payload configuration is BWP- or Cell-Specific. - slotFormatIndicator SetupRelease { SlotFormatIndicator } OPTIONAL, -- Need M - -- Enable and configure reception of group TPC commands for PUSCH - tpc-PUSCH SetupRelease { PUSCH-TPC-CommandConfig } OPTIONAL, -- Need M - - -- Enable and configure reception of group TPC commands fpr PUCCH - tpc-PUCCH SetupRelease { PUCCH-TPC-CommandConfig } OPTIONAL, -- Cond PUCCH-CellOnly - - ... -} - --- TAG-PDCCH-CONFIG-STOP --- TAG-PDCCH-CONFIGCOMMON-START - -PDCCH-ConfigCommon ::= SEQUENCE { - - -- A list of common control resource sets. Only CORESETs with ControlResourceSetId = 0 or 1 are allowed. The CORESET#0 - -- corresponds to the CORESET configured in MIB (see pdcch-ConfigSIB1) and is used to provide that information to the UE - -- by dedicated signalling during handover and (P)SCell addition. The CORESET#1 may be configured an used for RAR - -- (see ra-ControlResourceSet). - commonControlResourcesSets SEQUENCE (SIZE(1..2)) OF ControlResourceSet OPTIONAL, -- Need R - - -- A list of additional common search spaces. - commonSearchSpaces SEQUENCE (SIZE(1..4)) OF SearchSpace OPTIONAL, -- Need R - - -- ID of the search space for SIB1 message. - - -- Corresponds to L1 parameter 'rmsi-SearchSpace' (see 38.213, section 10) - searchSpaceSIB1 SearchSpaceId OPTIONAL, -- Need R - -- ID of the Search space for other system information, i.e., SIB2 and beyond. - -- Corresponds to L1 parameter 'osi-SearchSpace' (see 38.213, section 10) - -- If the field is absent, the monitoring occasions are derived as described in 38.213, section 10.1 and section 13. - searchSpaceOtherSystemInformation SearchSpaceId OPTIONAL, -- Need R - - -- ID of the Search space for paging. Corresponds to L1 parameter 'paging-SearchSpace' (see 38.213, section 10) - -- If the field is absent, the monitoring occasions are derived as described in 38.213, section 10.1 and section 13. - pagingSearchSpace SearchSpaceId OPTIONAL, -- Need R - - -- CORESET configured for random access. When the field is absent the UE uses the CORESET according to pdcch-ConfigSIB1 - -- which is associated with ControlResourceSetId = 0. - -- Corresponds to L1 parameter 'rach-coreset-configuration' (see 38.211?, section FFS_Section) - ra-ControlResourceSet ControlResourceSetId OPTIONAL, -- Need S - -- ID of the Search space for random access procedure. Corresponds to L1 parameter 'ra-SearchSpace' (see 38.214?, section FFS_Section) - -- If the field is absent, the monitoring occasions are derived as described in 38.213, section 10.1 and section 13. - ra-SearchSpace SearchSpaceId OPTIONAL, -- Need R - ... - -} - --- TAG-PDCCH-CONFIGCOMMON-STOP --- TAG-PDCP-CONFIG-START - -PDCP-Config ::= SEQUENCE { - drb SEQUENCE { - discardTimer ENUMERATED {ms10, ms20, ms30, ms40, ms50, ms60, ms75, ms100, ms150, ms200, ms250, ms300, ms500, ms750, ms1500, infinity} OPTIONAL, -- Cond Setup - pdcp-SN-SizeUL ENUMERATED {len12bits, len18bits} OPTIONAL, -- Cond Setup2 - pdcp-SN-SizeDL ENUMERATED {len12bits, len18bits} OPTIONAL, -- Cond Setup2 - headerCompression CHOICE { - notUsed NULL, - rohc SEQUENCE { - maxCID INTEGER (1..16383) DEFAULT 15, - profiles SEQUENCE { - profile0x0001 BOOLEAN, - profile0x0002 BOOLEAN, - profile0x0003 BOOLEAN, - profile0x0004 BOOLEAN, - profile0x0006 BOOLEAN, - profile0x0101 BOOLEAN, - profile0x0102 BOOLEAN, - profile0x0103 BOOLEAN, - profile0x0104 BOOLEAN - }, - drb-ContinueROHC BOOLEAN - }, - uplinkOnlyROHC SEQUENCE { - maxCID INTEGER (1..16383) DEFAULT 15, - profiles SEQUENCE { - profile0x0006 BOOLEAN - }, - drb-ContinueROHC BOOLEAN - }, - ... - }, - integrityProtection ENUMERATED { enabled } OPTIONAL, -- Cond ConnectedTo5GC - statusReportRequired ENUMERATED { true } OPTIONAL, -- Cond Rlc-AM - outOfOrderDelivery BOOLEAN - } OPTIONAL, -- Cond DRB - -- FFS / TODO: Handle more than two secondary cell groups - moreThanOneRLC SEQUENCE { - primaryPath SEQUENCE { - cellGroup CellGroupId OPTIONAL, -- Need R - logicalChannel LogicalChannelIdentity OPTIONAL -- Need R - }, - ul-DataSplitThreshold UL-DataSplitThreshold OPTIONAL, -- Cond SplitBearer - pdcp-Duplication ENUMERATED { true } OPTIONAL -- Need R - } OPTIONAL, -- Cond MoreThanOneRLC - - t-Reordering ENUMERATED { - ms0, ms1, ms2, ms4, ms5, ms8, ms10, ms15, ms20, ms30, ms40, ms50, ms60, ms80, ms100, ms120, ms140, ms160, ms180, ms200, ms220, - ms240, ms260, ms280, ms300, ms500, ms750, ms1000, ms1250, ms1500, ms1750, ms2000, ms2250, ms2500, ms2750, - ms3000, spare28, spare27, spare26, spare25, spare24, spare23, spare22, spare21, spare20, - spare19, spare18, spare17, spare16, spare15, spare14, spare13, spare12, spare11, spare10, spare09, - spare08, spare07, spare06, spare05, spare04, spare03, spare02, spare01 } OPTIONAL, -- Need S - - - ... -} - -UL-DataSplitThreshold ::= ENUMERATED { - b0, b100, b200, b400, b800, b1600, b3200, b6400, b12800, b25600, b51200, b102400, b204800, - b409600, b819200, b1228800, b1638400, b2457600, b3276800, b4096000, b4915200, b5734400, - b6553600, infinity, spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1} - --- TAG-PDCP-CONFIG-STOP --- TAG-PDSCH-CONFIG-START - -PDSCH-Config ::= SEQUENCE { - -- Identifer used to initalite data scrambling (c_init) for both PDSCH. - -- Corresponds to L1 parameter 'Data-scrambling-Identity' (see 38,214, section FFS_Section) - -- FFS:_Replace by tye ScramblingId used in other places? - dataScramblingIdentityPDSCH INTEGER (0..1007) OPTIONAL, - - -- DMRS configuration for PDSCH transmissions using PDSCH mapping type A (chosen dynamically via PDSCH-TimeDomainResourceAllocation). - dmrs-DownlinkForPDSCH-MappingTypeA SetupRelease { DMRS-DownlinkConfig } OPTIONAL, -- Need M - -- DMRS configuration for PDSCH transmissions using PDSCH mapping type B (chosen dynamically via PDSCH-TimeDomainResourceAllocation). - dmrs-DownlinkForPDSCH-MappingTypeB SetupRelease { DMRS-DownlinkConfig } OPTIONAL, -- Need M - - - -- A list of Transmission Configuration Indicator (TCI) states for dynamically indicating (over DCI) a transmission configuration - -- which includes QCL-relationships between the DL RSs in one RS set and the PDSCH DMRS ports - -- (see 38.214, section 5.1.4) - tci-StatesToAddModList SEQUENCE (SIZE(1..maxNrofTCI-States)) OF TCI-State OPTIONAL, -- Need N - tci-StatesToReleaseList SEQUENCE (SIZE(1..maxNrofTCI-States)) OF TCI-StateId OPTIONAL, -- Need N - - -- Interleaving unit configurable between 2 and 4 PRBs - -- Corresponds to L1 parameter 'VRB-to-PRB-interleaver' (see 38.211, section 6.3.1.6) - vrb-ToPRB-Interleaver ENUMERATED {n2, n4}, - - -- Configuration of resource allocation type 0 and resource allocation type 1 for non-fallback DCI - -- Corresponds to L1 parameter 'Resouce-allocation-config' (see 38.214, section 5.1.2) - resourceAllocation ENUMERATED { resourceAllocationType0, -resourceAllocationType1, -dynamicSwitch}, - - -- List of time-domain configurations for timing of DL assignment to DL data. If configured, the values provided herein - -- override the values received in corresponding PDSCH-ConfigCommon. - pdsch-AllocationList SEQUENCE (SIZE(1..maxNrofDL-Allocations)) OF PDSCH-TimeDomainResourceAllocation OPTIONAL, -- Need R - -- Number of repetitions for data. Corresponds to L1 parameter 'aggregation-factor-DL' (see 38.214, section FFS_Section) - -- When the field is absent the UE applies the value 1 - pdsch-AggregationFactor ENUMERATED { n2, n4, n8 } OPTIONAL, -- Need S - - -- Resources patterns which the UE should rate match PDSCH around. The UE rate matches around the union of all resources - -- indicated in the nexted bitmaps. Corresponds to L1 parameter 'Resource-set-BWP' (see 38.214, section 5.1.2.2.3) - -- FFS: RAN1 indicates that there should be a set of patterns per cell and one per BWP => Having both seems unnecessary. - - rateMatchPatternToAddModList SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPattern OPTIONAL, -- Need N - rateMatchPatternToReleaseList SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPatternId OPTIONAL, -- Need N - - -- The IDs of a first group of RateMatchPatterns defined in the rateMatchPatternToAddModList. - -- Corresponds to L1 parameter 'Resource-set-group-1'. (see 38.214, section FFS_Section) - rateMatchPatternGroup1 SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPatternId OPTIONAL, -- Need R - -- The IDs of a second group of RateMatchPatterns defined in the rateMatchPatternToAddModList - -- Corresponds to L1 parameter 'Resource-set-group-2'. (see 38.214, section FFS_Section) - rateMatchPatternGroup2 SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPatternId OPTIONAL, -- Need R - - - -- Selection between config 1 and config 2 for RBG size for PDSCH. Corresponds to L1 parameter 'RBG-size-PDSCH' (see 38.214, section 5.1.2.2.1) - rbg-Size ENUMERATED {config1, config2}, - - -- Indicates which MCS table the UE shall use for PDSCH. Corresponds to L1 parameter 'MCS-Table-PDSCH' (see 38.214, section 5.1.3.1). - mcs-Table ENUMERATED {qam64, qam256}, - - -- Maximum number of code words that a single DCI may schedule. This changes the number of MCS/RV/NDI bits in the DCI message from 1 to 2. - maxNrofCodeWordsScheduledByDCI ENUMERATED {n1, n2} OPTIONAL, -- Need R - - - -- Indicates the PRB bundle type and bundle size(s). If "dynamic" is chosen, the actual BundleSizeSet to use is indicated via DCI. - -- If a bundleSize(Set) value is absent, the UE applies the value n2. Corresponds to L1 parameter 'PRB_bundling' - -- (see 38.214, section 5.1.2.3) - prb-BundlingType CHOICE { - static SEQUENCE { - bundleSize ENUMERATED { n4, wideband } OPTIONAL -- Need S - }, - dynamic SEQUENCE { - bundleSizeSet1 ENUMERATED { n4, wideband, n2-wideband, n4-wideband } OPTIONAL, -- Need S - bundleSizeSet2 ENUMERATED { n4, wideband } OPTIONAL -- Need S - } - }, - - -- A list of Zero-Power (ZP) CSI-RS resources used for PDSCH rate-matching. - -- Corresponds to L1 parameter 'ZP-CSI-RS-ResourceConfigList' (see 38.214, section FFS_Section) - zp-CSI-RS-ResourceToAddModList SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Resources)) OF ZP-CSI-RS-Resource OPTIONAL, -- Need N - zp-CSI-RS-ResourceToReleaseList SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Resources)) OF ZP-CSI-RS-ResourceId OPTIONAL, -- Need M - - -- A list of sets. Each set contains a set-ID and the IDs of one or more ZP-CSI-RS-Resources (the actual resources are defined in the - -- zp-CSI-RS-ResourceToAddModList). The network triggers a set by indicating its set-ID (ZP-CSI-RS-ResourceSetId) in the DCI payload. - -- The resources referenced in these sets are confgiured with resourceType 'aperiodic'. - -- Corresponds to L1 parameter ' ZP-CSI-RS-ResourceSetConfigList' (see 38.214, section FFS_Section) - aperiodic-ZP-CSI-RS-ResourceSetsToAddModList SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Sets)) OF ZP-CSI-RS-ResourceSet OPTIONAL, -- Need N - aperiodic-ZP-CSI-RS-ResourceSetsToReleaseList SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Sets)) OF ZP-CSI-RS-ResourceSetId OPTIONAL, -- Need N - - -- A list of sets. Each set contains a set-ID and the IDs of one or more ZP-CSI-RS-Resources (the actual resources are defined in the - -- zp-CSI-RS-ResourceToAddModList). The network triggers a set by indicating its set-ID (ZP-CSI-RS-ResourceSetId) in the MAC CE. - -- The resources referenced in these sets are confgiured with resourceType 'semi-persistent'. - -- Corresponds to L1 parameter 'SP-ZP-CSI-RS-Resource-List' (see 38.214, section 5.1.4_Section) - sp-ZP-CSI-RS-ResourceSetsToAddModList SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Sets)) OF ZP-CSI-RS-ResourceSet OPTIONAL, -- Need N - sp-ZP-CSI-RS-ResourceSetsToReleaseList SEQUENCE (SIZE (1..maxNrofZP-CSI-RS-Sets)) OF ZP-CSI-RS-ResourceSetId OPTIONAL, -- Need N - - ... -} - - - - --- TAG-PDSCH-CONFIG-STOP --- TAG-PDSCH-CONFIGCOMMON-START - -PDSCH-ConfigCommon ::= SEQUENCE { - - -- List of time-domain configurations for timing of DL assignment to DL data - pdsch-AllocationList SEQUENCE (SIZE(1..maxNrofDL-Allocations)) OF PDSCH-TimeDomainResourceAllocation OPTIONAL, -- Need R - - ... -} - --- TAG-PDSCH-CONFIGCOMMON-STOP --- TAG-PDSCH-SERVINGCELLCONFIG-START - -PDSCH-ServingCellConfig ::= SEQUENCE { - -- Enables and configures code-block-group (CBG) based transmission (see 38.213, section 9.1.1) - codeBlockGroupTransmission SetupRelease { PDSCH-CodeBlockGroupTransmission } OPTIONAL, -- Need M - -- Accounts for overhead from CSI-RS, CORESET, etc. If the field is absent, the UE applies value xOh0. - -- Corresponds to L1 parameter 'Xoh-PDSCH' (see 38.214, section 5.1.3.2) - xOverhead ENUMERATED { xOh6, xOh12, xOh18 } OPTIONAL, -- Need S - -- The number of HARQ processes to be used on the PDSCH of a serving cell. n2 corresponds to 2 HARQ processes, n4 to 4 HARQ processes - -- and so on. If the field is absent, the UE uses 8 HARQ processes. - -- Corresponds to L1 parameter 'number-HARQ-process-PDSCH' (see 38.214, section REF) - nrofHARQ-ProcessesForPDSCH ENUMERATED {n2, n4, n6, n10, n12, n16} OPTIONAL, -- Need S - -- The ID of the serving cell (of the same cell group) to use for PUCCH. - -- If the field is absent, the UE sends the HARQ feedback on the PUCCH of the SpCell of this cell group. - pucch-Cell ServCellIndex OPTIONAL , -- Cond SCellAddOnly - ... -} - -PDSCH-CodeBlockGroupTransmission ::= SEQUENCE { - -- Maximum number of code-block-groups (CBGs) per TB. In case of multiple CW the maximum CBG is 4 (see 38.213, section 9.1.1) - maxCodeBlockGroupsPerTransportBlock ENUMERATED {n2, n4, n6, n8}, - -- Indicates whether CBGFI for CBG based (re)transmission in DL is enabled (true). (see 38.212, section 7.3.1.2.2) - codeBlockGroupFlushIndicator BOOLEAN, - ... -} - --- TAG-PDSCH-SERVINGCELLCONFIG-STOP --- TAG-PDSCH-TIMEDOMAINRESOURCEALLOCATION-START - -PDSCH-TimeDomainResourceAllocation ::= SEQUENCE { - -- Corresponds to L1 parameter 'K0' (see 38.214, section FFS_Section) - -- When the field is absent the UE applies the value 0 - k0 INTEGER (1..3) OPTIONAL, -- Need S - -- PDSCH mapping type. Corresponds to L1 parameter 'Mapping-type' (see 38.214, section FFS_Section) - mappingType ENUMERATED {typeA, typeB}, - -- An index into a table/equation in RAN1 specs capturing valid combinations of start symbol and length (jointly encoded) - -- Corresponds to L1 parameter 'Index-start-len' (see 38.214, section FFS_Section) - startSymbolAndLength BIT STRING (SIZE (7)) -} - --- TAG-PDSCH-TIMEDOMAINRESOURCEALLOCATION-STOP --- TAG-PHYS-CELL-ID-START - -PhysCellId ::= INTEGER (0..1007) - --- TAG-PHYS-CELL-ID-STOP --- TAG-PRB-ID-START - -PRB-Id ::= INTEGER (0..maxNrofPhysicalResourceBlocks-1) - --- TAG-PRB-ID-STOP --- TAG-PTRS-DOWNLINKCONFIG-START - -PTRS-DownlinkConfig ::= SEQUENCE { - -- Presence and frequency density of DL PT-RS as a function of Scheduled BW - -- If the field is absent, the UE uses K_PT-RS = 2. - -- Corresponds to L1 parameter 'DL-PTRS-frequency-density-table' (see 38.214, section 5.1) - frequencyDensity SEQUENCE (SIZE (2)) OF INTEGER (1..276) OPTIONAL, -- Need S - -- Presence and time density of DL PT-RS as a function of MCS. The value 29 is only applicable for MCS Table 5.1.3.1-1 (38.214) - -- If the field is absent, the UE uses L_PT-RS = 1. - -- Corresponds to L1 parameter 'DL-PTRS-time-density-table' (see 38.214, section 5.1) - timeDensity SEQUENCE (SIZE (3)) OF INTEGER (0..29) OPTIONAL, -- Need S - -- EPRE ratio between PTRS and PDSCH. Value 0 correspond to the codepoint ”00” in table 4.1-2. Value 1 corresponds to codepoint ”01” - -- If the field is not provided, the UE applies value 0. Corresponds to L1 parameter 'DL-PTRS-EPRE-ratio' (see 38.214, section 4.1) - epre-RatioPort1 INTEGER (0..3) OPTIONAL, -- Need S - -- EPRE ratio between PTRS and PDSCH. Value 0 correspond to the codepoint ”00” in table 4.1-2. Value 1 corresponds to codepoint ”01”. - -- If the field is not provided, the UE applies value 0. Corresponds to L1 parameter 'DL-PTRS-EPRE-ratio' (see 38.214, section 4.1) - epre-RatioPort2 SEQUENCE (SIZE (1..2)) OF INTEGER (0..3) OPTIONAL, -- Cond TwoPorts - -- Indicates the subcarrier offset for DL PTRS. If the field is absent, the UE applies the value offset00. - -- Corresponds to L1 parameter 'DL-PTRS-RE-offset' (see 38.214, section 5.1.6.3) - resourceElementOffset ENUMERATED { offset01, offset10, offset11 } OPTIONAL, -- Need S - ... -} - --- TAG-PTRS-DOWNLINKCONFIG-STOP --- TAG-PTRS-UPLINKCONFIG-START - -PTRS-UplinkConfig ::= SEQUENCE { - - modeSpecificParameters CHOICE { - -- Configuration of UL PTRS for CP-OFDM - cp-OFDM SEQUENCE { - -- Presence and frequency density of UL PT-RS for CP-OFDM waveform as a function of scheduled BW - -- If the field is absent, the UE uses K_PT-RS = 2. - -- Corresponds to L1 parameter 'UL-PTRS-frequency-density-table' (see 38.214, section 6.1) - frequencyDensity SEQUENCE (SIZE (2)) OF INTEGER (1..276) OPTIONAL, -- Need S - -- Presence and time density of UL PT-RS for CP-OFDM waveform as a function of MCS - -- If the field is absent, the UE uses L_PT-RS = 1. - -- Corresponds to L1 parameter 'UL-PTRS-time-density-table' (see 38.214, section 6.1) - timeDensity SEQUENCE (SIZE (3)) OF INTEGER (0..29) OPTIONAL, -- Need S - -- The maximum number of UL PTRS ports for CP-OFDM. - -- Corresponds to L1 parameter 'UL-PTRS-ports' (see 38.214, section 6.2.3.1) - maxNrofPorts ENUMERATED {n1, n2}, - -- Indicates the subcarrier offset for UL PTRS for CP-OFDM. - -- Corresponds to L1 parameter 'UL-PTRS-RE-offset' (see 38.214, section 6.1) - resourceElementOffset ENUMERATED {offset01, offset10, offset11 } OPTIONAL, -- Need S - -- UL PTRS power boosting factor per PTRS port. Corresponds to L1 parameter 'UL-PTRS-power' (see 38.214, section 6.1, table 6.2.3-5) - ptrs-Power ENUMERATED {p00, p01, p10, p11} - }, - -- Configuration of UL PTRS for DFT-S-OFDM. - dft-S-OFDM SEQUENCE { - -- Sample density of PT-RS for DFT-s-OFDM, pre-DFT, indicating a set of thresholds T={NRBn,n=0,1,2,3,4}, - -- that indicates dependency between presence of PT-RS and scheduled BW and the values of X and K the UE should - -- use depending on the scheduled BW according to the table in 38.214 FFS_Section. - -- Corresponds to L1 parameter 'UL-PTRS-pre-DFT-density' (see 38.214, section 6.1, 6.2.3-3) - sampleDensity SEQUENCE (SIZE (5)) OF INTEGER (1..276), - -- Time density (OFDM symbol level) of PT-RS for DFT-s-OFDM. If the value is absent, the UE applies value d1. - -- Corresponds to L1 parameter 'UL-PTRS-time-density-transform-precoding' (see 38.214, section 6.1) - timeDensity ENUMERATED {d2} OPTIONAL -- Need S - } - } OPTIONAL, -- Cond M - ... -} - --- TAG-PTRS-UPLINKCONFIG-STOP --- TAG-PUCCH-CONFIG-START - -PUCCH-Config ::= SEQUENCE { - -- Lists for adding and releasing PUCCH resource sets (see 38.213, section 9.2) - resourceSetToAddModList SEQUENCE (SIZE (1..maxNrofPUCCH-ResourceSets)) OF PUCCH-ResourceSet OPTIONAL, -- Need N - resourceSetToReleaseList SEQUENCE (SIZE (1..maxNrofPUCCH-ResourceSets)) OF PUCCH-ResourceSetId OPTIONAL, -- Need N - - -- Lists for adding and releasing PUCCH resources applicable for the UL BWP and serving cell in which the PUCCH-Config - -- is defined. The resources defined herein are referred to from other parts of the configuration to determine which - -- resource the UE shall use for which report. - resourceToAddModList SEQUENCE (SIZE (1..maxNrofPUCCH-Resources)) OF PUCCH-Resource OPTIONAL, -- Need N - resourceToReleaseList SEQUENCE (SIZE (1..maxNrofPUCCH-Resources)) OF PUCCH-ResourceId OPTIONAL, -- Need N - - -- Parameters that are common for all PUCCH resources of format 1 - format1 SetupRelease { PUCCH-FormatConfig } OPTIONAL, -- Need M - -- Parameters that are common for all PUCCH resources of format 2 - format2 SetupRelease { PUCCH-FormatConfig } OPTIONAL, -- Need M - -- Parameters that are common for all PUCCH resources of format 3 - format3 SetupRelease { PUCCH-FormatConfig } OPTIONAL, -- Need M - -- Parameters that are common for all PUCCH resources of format 4 - format4 SetupRelease { PUCCH-FormatConfig } OPTIONAL, -- Need M - - schedulingRequestResourceToAddModList SEQUENCE (SIZE (1..maxNrofSR-Resources)) OF SchedulingRequestResourceConfig OPTIONAL, -- Need M - schedulingRequestResourceToReleaseList SEQUENCE (SIZE (1..maxNrofSR-Resources)) OF SchedulingRequestResourceId OPTIONAL, -- Need M - - multi-CSI-PUCCH-ResourceList SEQUENCE (SIZE (1..2)) OF PUCCH-ResourceId OPTIONAL,-- Need M - - -- List of timiing for given PDSCH to the DL ACK. In this version of the specification only the values [0..8] are applicable. - -- Corresponds to L1 parameter 'Slot-timing-value-K1' (see 38.213, section FFS_Section) - dl-DataToUL-ACK SEQUENCE (SIZE (8)) OF INTEGER (0..15) OPTIONAL, -- Need M - - -- Configuration of the spatial relation between a reference RS and PUCCH. Reference RS can be SSB/CSI-RS/SRS. - -- If the list has more than one element, MAC-CE selects a single element (see 38.321, section FFS_Section). - -- Corresponds to L1 parameter 'PUCCH-SpatialRelationInfo' (see 38.213, section FFS_Section) - spatialRelationInfoToAddModList SEQUENCE (SIZE (1..maxNrofSpatialRelationInfos)) OF PUCCH-SpatialRelationInfo OPTIONAL, -- Need N - spatialRelationInfoToReleaseList SEQUENCE (SIZE (1..maxNrofSpatialRelationInfos)) OF PUCCH-SpatialRelationInfoId OPTIONAL, -- Need N - - pucch-PowerControl PUCCH-PowerControl OPTIONAL, -- Need M - ... -} - -PUCCH-FormatConfig ::= SEQUENCE { - -- Enabling inter-slot frequency hopping when PUCCH Format 1, 3 or 4 is repetead over multiple slots. - -- The field is not applicable for format 2. - interslotFrequencyHopping ENUMERATED {enabled} OPTIONAL, -- Need R - -- Enabling 2 DMRS symbols per hop of a PUCCH Format 3 or 4 if both hops are more than X symbols when FH is enabled (X=4). - -- Enabling 4 DMRS sybmols for a PUCCH Format 3 or 4 with more than 2X+1 symbols when FH is disabled (X=4). - -- Corresponds to L1 parameter 'PUCCH-F3-F4-additional-DMRS' (see 38.213, section 9.2.1) - -- The field is not applicable for format 1 and 2. - additionalDMRS ENUMERATED {true} OPTIONAL, -- Need R - -- Max coding rate to determine how to feedback UCI on PUCCH for format 2, 3 or 4 - -- Corresponds to L1 parameter 'PUCCH-F2-maximum-coderate', 'PUCCH-F3-maximum-coderate' and 'PUCCH-F4-maximum-coderate' - -- (see 38.213, section 9.2.5) - -- The field is not applicable for format 1. - maxCodeRate PUCCH-MaxCodeRate OPTIONAL, -- Need R - -- Number of slots with the same PUCCH F1, F3 or F4. When the field is absent the UE applies the value n1. - -- Corresponds to L1 parameter 'PUCCH-F1-number-of-slots', 'PUCCH-F3-number-of-slots' and 'PUCCH-F4-number-of-slots' - -- (see 38.213, section 9.2.6) - -- The field is not applicable for format 2. - nrofSlots ENUMERATED {n2,n4,n8} OPTIONAL, -- Need S - -- Enabling pi/2 BPSK for UCI symbols instead of QPSK for PUCCH. - -- Corresponds to L1 parameter 'PUCCH-PF3-PF4-pi/2PBSK' (see 38.213, section 9.2.5) - -- The field is not applicable for format 1 and 2. - pi2PBSK ENUMERATED {enabled} OPTIONAL, -- Need R - -- Enabling simultaneous transmission of CSI and HARQ-ACK feedback with or without SR with PUCCH Format 2, 3 or 4 - -- Corresponds to L1 parameter 'PUCCH-F2-Simultaneous-HARQ-ACK-CSI', 'PUCCH-F3-Simultaneous-HARQ-ACK-CSI' and - -- 'PUCCH-F4-Simultaneous-HARQ-ACK-CSI' (see 38.213, section 9.2.5) - -- When the field is absent the UE applies the value OFF - -- The field is not applicable for format 1. - simultaneousHARQ-ACK-CSI ENUMERATED {true} OPTIONAL -- Need R -} - -PUCCH-MaxCodeRate ::= ENUMERATED {zeroDot08, zeroDot15, zeroDot25, zeroDot35, zeroDot45, zeroDot60, zeroDot80} - -PUCCH-SpatialRelationInfo ::= SEQUENCE { - pucch-SpatialRelationInfoId PUCCH-SpatialRelationInfoId, - referenceSignal CHOICE { - ssb-Index SSB-Index, - csi-RS-Index NZP-CSI-RS-ResourceId, - srs SRS-ResourceId - }, - pucch-PathlossReferenceRS-Id PUCCH-PathlossReferenceRS-Id, - p0-PUCCH-Id P0-PUCCH-Id, - closedLoopIndex ENUMERATED { i0, i1 } -} - -PUCCH-SpatialRelationInfoId ::= INTEGER (1..maxNrofSpatialRelationInfos) - --- A set with one or more PUCCH resources -PUCCH-ResourceSet ::= SEQUENCE { - pucch-ResourceSetId PUCCH-ResourceSetId, - - -- PUCCH resources of format0 and format1 are only allowed in the first PUCCH reosurce set, - -- i.e., in a PUCCH-ResourceSet with pucch-ResourceSetId = 0. This set may contain between 8 and 32 resources. - -- PUCCH resources of format2, format3 and format4 are only allowed in a PUCCH-ReosurceSet with pucch-ResourceSetId > 0. If present, these sets must contain 8 resources each. - -- The UE chooses a PUCCH-Resource from this list based on the 3-bit PUCCH resource indicator field in DCI as - -- speciied in 38.213, FFS_section. - -- Note that this list contains only a list of resource IDs. The actual resources are configured in PUCCH-Config. - resources SEQUENCE (SIZE (8..maxNrofPUCCH-ResourcesPerSet)) OF PUCCH-ResourceId, - - -- Maximum number of payload bits minus 1 that the UE may transmit using this PUCCH resource set. In a PUCCH occurrence, the UE - -- chooses the first of its PUCCH-ResourceSet which supports the number of bits that the UE wants to transmit. - -- The field is not present in the first set (Set0) since the maximum Size of Set0 is specified to be 3 bit. - -- The field is not present in the last configured set since the UE derives its maximum payload size as specified in 38.213. - -- This field can take integer values that are multiples of 4. Corresponds to L1 parameter 'N_2' or 'N_3' (see 38.213, section 9.2) - maxPayloadMinus1 INTEGER (4..256) OPTIONAL -- Need R -} - -PUCCH-ResourceSetId ::= INTEGER (0..maxNrofPUCCH-ResourceSets-1) - -PUCCH-Resource ::= SEQUENCE { - pucch-ResourceId PUCCH-ResourceId, - - startingPRB PRB-Id, - -- Corresponds to the L1 parameter 'PUCCH-frequency-hopping' (see 38.213, section 9.2) - intraSlotFrequencyHopping ENUMERATED { enabled } OPTIONAL, -- Need R - -- Index of starting PRB for second hop of PUCCH in case of FH. This value is appliable for intra-slot frequency hopping. - -- Corresponds to L1 parameter 'PUCCH-2nd-hop-PRB' (see 38.213, section 9.2) - secondHopPRB PRB-Id OPTIONAL, -- Need R - - -- Selection of the PUCCH format and format-specific parameters - format CHOICE { - format0 PUCCH-format0, -- Cond InFirstSetOnly - format1 PUCCH-format1, -- Cond InFirstSetOnly - format2 PUCCH-format2, -- Cond NotInFirstSet - format3 PUCCH-format3, -- Cond NotInFirstSet - format4 PUCCH-format4 -- Cond NotInFirstSet - } -} - -PUCCH-ResourceId ::= INTEGER (0..maxNrofPUCCH-Resources-1) - - --- A PUCCH Format 0 resource configuration (see 38.213, section 9.2) --- Corresponds to L1 parameter 'PUCCH-format0' (see 38.213, section 9.2.1) -PUCCH-format0 ::= SEQUENCE { - initialCyclicShift INTEGER(0..11), - nrofSymbols INTEGER (1..2), - startingSymbolIndex INTEGER(0..13) -} - --- A PUCCH Format 1 resource configuration (see 38.213, section 9.2) --- Corresponds to L1 parameter 'PUCCH-format1' (see 38.213, section 9.2.1) -PUCCH-format1 ::= SEQUENCE { - initialCyclicShift INTEGER(0..11), - nrofSymbols INTEGER (4..14), - startingSymbolIndex INTEGER(0..10), - timeDomainOCC INTEGER(0..6) -} - --- A PUCCH Format 2 resource configuration (see 38.213, section 9.2) --- Corresponds to L1 parameter 'PUCCH-format2onfig' (see 38.213, section 9.2.1) -PUCCH-format2 ::= SEQUENCE { - nrofPRBs INTEGER (1..16), - nrofSymbols INTEGER (1..2), - startingSymbolIndex INTEGER(0..13) -} - --- A PUCCH Format 3 resource configuration(see 38.213, section 9.2) --- Corresponds to L1 parameter 'PUCCH-format3' (see 38.213, section 9.2.1) -PUCCH-format3 ::= SEQUENCE { - -- The supported values are 1,2,3,4,5,6,8,9,10,12,15 and 16 - nrofPRBs INTEGER (1..16), - nrofSymbols INTEGER (4..14), - startingSymbolIndex INTEGER(0..10) -} - --- A PUCCH Format 4 resource configuration (see 38.213, section 9.2) --- Corresponds to L1 parameter 'PUCCH-format4' (see 38.213, section 9.2.1) -PUCCH-format4 ::= SEQUENCE { - nrofSymbols INTEGER (4..14), - occ-Length ENUMERATED {n2,n4}, - occ-Index ENUMERATED {n0,n1,n2,n3}, - startingSymbolIndex INTEGER(0..10) -} - --- TAG-PUCCH-CONFIG-STOP --- TAG-PUCCH-CONFIGCOMMON-START - -PUCCH-ConfigCommon ::= SEQUENCE { - -- An entry into a 16-row table where each row configures a set of cell-specific PUCCH resources/parameters. The UE uses - -- those PUCCH resources during initial access on the initial uplink BWP. Once the network provides a dedicated PUCCH-Config - -- for that bandwidth part the UE applies that one instead of the one provided in this field. - -- Corresponds to L1 parameter 'PUCCH-resource-common' (see 38.213, section 9.2) - pucch-ResourceCommon BIT STRING (SIZE (4)) OPTIONAL, -- Need R - - -- Configuration of group- and sequence hopping for all the PUCCH formats 0, 1, 3 and 4. "neither" implies neither group - -- or sequence hopping is enabled. "enable" enables group hopping and disables sequence hopping. "disable"” disables group - -- hopping and enables sequence hopping. Corresponds to L1 parameter 'PUCCH-GroupHopping' (see 38.211, section 6.4.1.3) - pucch-GroupHopping ENUMERATED { neither, enable, disable }, - -- Cell-Specific scrambling ID for group hoppping and sequence hopping if enabled. - -- Corresponds to L1 parameter 'HoppingID' (see 38.211, section 6.3.2.2) - hoppingId BIT STRING (SIZE (10)) OPTIONAL, -- Need R - - -- Power control parameter P0 for PUCCH transmissions. Value in dBm. Only even values (step size 2) allowed. - -- Corresponds to L1 parameter 'p0-nominal-pucch' (see 38.213, section 7.2) - p0-nominal INTEGER (-202..24) OPTIONAL, -- Need R - - ... -} - --- TAG-PUCCH-CONFIGCOMMON-STOP --- TAG-PUCCH-POWERCONTROL-START -PUCCH-PowerControl ::= SEQUENCE { - - -- deltaF for PUCCH format 0 with 1dB step size (see 38.213, section 7.2) - deltaF-PUCCH-f0 INTEGER (-16..15) OPTIONAL, -- Need R - -- deltaF for PUCCH format 1 with 1dB step size (see 38.213, section 7.2) - deltaF-PUCCH-f1 INTEGER (-16..15) OPTIONAL, -- Need R - -- deltaF for PUCCH format 2 with 1dB step size (see 38.213, section 7.2) - deltaF-PUCCH-f2 INTEGER (-16..15) OPTIONAL, -- Need R - -- deltaF for PUCCH format 3 with 1dB step size (see 38.213, section 7.2) - deltaF-PUCCH-f3 INTEGER (-16..15) OPTIONAL, -- Need R - -- deltaF for PUCCH format 4 with 1dB step size (see 38.213, section 7.2) - deltaF-PUCCH-f4 INTEGER (-16..15) OPTIONAL, -- Need R - - -- A set with dedicated P0 values for PUCCH, i.e., {P01, P02,... }. Corresponds to L1 parameter 'p0-pucch-set' (see 38.213, section 7.2) - p0-Set SEQUENCE (SIZE (1..maxNrofPUCCH-P0-PerSet)) OF P0-PUCCH OPTIONAL, -- Need M - - -- A set of Reference Signals (e.g. a CSI-RS config or a SSblock) to be used for PUCCH pathloss estimation. - -- Up to maxNrofPUCCH-PathlossReference-RSs may be configured - -- FFS_CHECK: Is it possible not to configure it at all? What does the UE use then? Any SSB? - -- Corresponds to L1 parameter 'pucch-pathlossReference-rs-config' (see 38.213, section 7.2) - pathlossReferenceRSs SEQUENCE (SIZE (1..maxNrofPUCCH-PathlossReferenceRSs)) OF PUCCH-PathlossReferenceRS OPTIONAL, -- Need M - -- Number of PUCCH power control adjustment states maintained by the UE (i.e., g(i)). If the field is present (n2) the UE maintains - -- two power control states (i.e., g(i,0) and g(i,1)). Otherwise, it applies one (i.e., g(i,0)). - -- Corresponds to L1 parameter 'num-pucch-pcadjustment-states' (see 38.213, section 7.2) - twoPUCCH-PC-AdjustmentStates ENUMERATED {twoStates} OPTIONAL, -- Need R - ... -} - --- P0 value for PUCCH. Corresponds to L1 parameter 'p0-pucch' (see 3,213, section 7.2) -P0-PUCCH ::= SEQUENCE { - p0-PUCCH-Id P0-PUCCH-Id, - -- P0 value for PUCCH with 1dB step size. - p0-PUCCH-Value INTEGER (-16..15) -} - -P0-PUCCH-Id ::= INTEGER (1..8) - --- A reference signal (RS) configured as pathloss reference signal for PUCCH power control --- Corresponds to L1 parameter 'pucch-pathlossReference-rs' (see 38.213, section 7.2) -PUCCH-PathlossReferenceRS ::= SEQUENCE { - pucch-PathlossReferenceRS-Id PUCCH-PathlossReferenceRS-Id, - referenceSignal CHOICE { - ssb-Index SSB-Index, - csi-RS-Index NZP-CSI-RS-ResourceId - } -} - --- ID for a referemce signal (RS) configured as PUCCH pathloss reference --- Corresponds to L1 parameter 'pucch-pathlossreference-index' (see 38.213, section 7.2) --- FFS_CHECK: Is this ID used anywhere except inside the PUCCH-PathlossReference-RS itself? If not, remove. -PUCCH-PathlossReferenceRS-Id ::= INTEGER (0..maxNrofPUCCH-PathlossReferenceRSs-1) - --- TAG-PUCCH-POWERCONTROL-STOP --- TAG-PUCCH-TPC-COMMANDCONFIG-START - -PUCCH-TPC-CommandConfig ::= SEQUENCE { - -- An index determining the position of the first bit of TPC command (applicable to the SpCell) inside the DCI format 2-2 payload. - tpc-IndexPCell INTEGER (1..15) OPTIONAL, -- Cond PUCCH-SCell - -- An index determining the position of the first bit of TPC command (applicable to the PUCCH-SCell) inside the DCI format 2-2 payload. - tpc-IndexPUCCH-SCell INTEGER (1..15) OPTIONAL, -- Cond PUCCH-SCellOnly - ... -} - --- TAG-PUCCH-TPC-COMMANDCONFIG-STOP --- TAG-PUSCH-CONFIG-START - -PUSCH-Config ::= SEQUENCE { - -- Identifer used to initalite data scrambling (c_init) for both PUSCH. - -- Corresponds to L1 parameter 'Data-scrambling-Identity' (see 38,214, section FFS_Section) - dataScramblingIdentityPUSCH INTEGER (0..1007) OPTIONAL, -- Need M - -- Whether UE uses codebook based or non-codebook based transmission. Corresponds to L1 parameter 'ulTxConfig' (see 38.214, section 6.1.1) - txConfig ENUMERATED {codebook, nonCodebook}, - - -- DMRS configuration for PUSCH transmissions using PUSCH mapping type A (chosen dynamically via PUSCH-TimeDomainResourceAllocation). - dmrs-UplinkForPUSCH-MappingTypeA SetupRelease { DMRS-UplinkConfig } OPTIONAL, -- Need M - -- DMRS configuration for PUSCH transmissions using PUSCH mapping type B (chosen dynamically via PUSCH-TimeDomainResourceAllocation) - dmrs-UplinkForPUSCH-MappingTypeB SetupRelease { DMRS-UplinkConfig } OPTIONAL, -- Need M - - pusch-PowerControl PUSCH-PowerControl OPTIONAL, -- Need M - -- Configured one of two supported frequency hopping mode. If not configured frequency hopping is not configured - -- Corresponds to L1 parameter 'Frequency-hopping-PUSCH' (see 38.214, section 6) - -- When the field is absent the UE applies the value Not configured - frequencyHopping ENUMERATED {mode1, mode2} OPTIONAL, -- Need S - -- Set of frequency hopping offsets used when frequency hopping is enabled for granted transmission (not msg3) and type 2 - -- Corresponds to L1 parameter 'Frequency-hopping-offsets-set' (see 38.214, section 6.3) - frequencyHoppingOffsetLists SEQUENCE (SIZE (1..4)) OF INTEGER (1.. maxNrofPhysicalResourceBlocks-1) OPTIONAL, -- Need M - -- Configuration of resource allocation type 0 and resource allocation type 1 for non-fallback DCI - -- Corresponds to L1 parameter 'Resouce-allocation-config' (see 38.214, section 6.1.2) - resourceAllocation ENUMERATED { resourceAllocationType0, resourceAllocationType1, dynamicSwitch}, - - -- List of time domain allocations for timing of UL assignment to UL data. If configured, the values provided herein - -- override the values received in corresponding PUSCH-ConfigCommon. - pusch-AllocationList SEQUENCE (SIZE(1..maxNrofUL-Allocations)) OF PUSCH-TimeDomainResourceAllocation OPTIONAL, -- Need R, - -- Number of repetitions for data. Corresponds to L1 parameter 'aggregation-factor-UL' (see 38.214, section FFS_Section) - -- When the field is absent the UE applies the value 1. - pusch-AggregationFactor ENUMERATED { n2, n4, n8 } OPTIONAL, -- Need S - - -- Indicates which MCS table the UE shall use for PUSCH without transform precoder - -- Corresponds to L1 parameter 'MCS-Table-PUSCH' (see 38.214, section 6.1.4) - -- When the field is absent the UE applies the value 64QAM - mcs-Table ENUMERATED {qam256} OPTIONAL, -- Need S - -- Indicates which MCS table the UE shall use for PUSCH with transform precoding - -- Corresponds to L1 parameter 'MCS-Table-PUSCH-transform-precoding' (see 38.214, section 6.1.4) - -- When the field is absent the UE applies the value 64QAM - mcs-TableTransformPrecoder ENUMERATED { qam256} OPTIONAL, -- Need S - -- The UE specific selection of transformer precoder for PUSCH. When the field is absent the UE applies the value msg3-tp. - -- Corresponds to L1 parameter 'PUSCH-tp' (see 38.211, section 6.3.1.4) - transformPrecoder ENUMERATED {enabled, disabled} OPTIONAL, -- Need S - -- Subset of PMIs addressed by TPMI, where PMIs are those supported by UEs with maximum coherence capabilities - -- Corresponds to L1 parameter 'ULCodebookSubset' (see 38.211, section 6.3.1.5) - codebookSubset ENUMERATED {fullyAndPartialAndNonCoherent, partialAndNonCoherent, nonCoherent}, - -- Subset of PMIs addressed by TRIs from 1 to ULmaxRank. Corresponds to L1 parameter 'ULmaxRank' (see 38.211, section 6.3.1.5) - maxRank INTEGER (1..4), - - -- Selection between config 1 and config 2 for RBG size for PUSCH. When the field is absent the UE applies the value config1. - -- Corresponds to L1 parameter 'RBG-size-PUSCH' (see 38.214, section 6.1.2.2.1) - rbg-Size ENUMERATED { config2} OPTIONAL, -- Need S - - -- Selection between and configuration of dynamic and semi-static beta-offset. - -- If the field is absent or released, the UE applies the value 'semiStatic' and the BetaOffsets according to - -- FFS [BetaOffsets and/or section 9.x.x). - -- Corresponds to L1 parameter 'UCI-on-PUSCH' (see 38.213, section 9.3) - uci-OnPUSCH SetupRelease { UCI-OnPUSCH} OPTIONAL, -- Need M - -- Interleaving unit configurable between 2 and 4 PRBs - -- Corresponds to L1 parameter 'VRB-to-PRB-interleaver' (see 38.211, section 6.3.1.6) - vrb-ToPRB-Interleaver ENUMERATED {n2, n4}, - ... -} - -UCI-OnPUSCH ::= SEQUENCE { - betaOffsets CHOICE { - dynamic SEQUENCE (SIZE (4)) OF BetaOffsets, - semiStatic BetaOffsets - } OPTIONAL, -- Need M - -- Indicates a scaling factor to limit the number of resource elements assigned to UCI on PUSCH. - -- Value f0p5 corresponds to 0.5, value f0p65 corresponds to 0.65, and so on. - -- Corresponds to L1 parameter 'uci-on-pusch-scaling' (see 38.212, section 6.3) - scaling ENUMERATED { f0p5, f0p65, f0p8, f1 } -} - --- TAG-PUSCH-CONFIG-STOP --- TAG-PUSCH-CONFIGCOMMON-START - -PUSCH-ConfigCommon ::= SEQUENCE { - -- Sequence-group hopping can be enabled or disabled by means of this cell-specific parameter. - -- Corresponds to L1 parameter 'Group-hopping-enabled-Transform-precoding' (see 38.211, section FFS_Section) - -- This field is Cell specific - groupHoppingEnabledTransformPrecoding ENUMERATED {enabled} OPTIONAL, -- Need R - - -- List of time domain allocations for timing of UL assignment to UL data - pusch-AllocationList SEQUENCE (SIZE(1..maxNrofUL-Allocations)) OF PUSCH-TimeDomainResourceAllocation OPTIONAL, -- Need R - - -- ------------------------ - -- Power control parameters - - -- Power offset between msg3 and RACH preamble transmission in steps of 1dB. - -- Corresponds to L1 parameter 'Delta-preamble-msg3' (see 38.213, section 7.1) - msg3-DeltaPreamble INTEGER (-1..6) OPTIONAL, -- Need R - - -- P0 value for PUSCH with grant (except msg3). Value in dBm. Only even values (step size 2) allowed. - -- Corresponds to L1 parameter 'p0-nominal-pusch-withgrant' (see 38.213, section 7.1) - -- This field is cell specific - p0-NominalWithGrant INTEGER (-202..24) OPTIONAL, -- Need R - ... -} - --- TAG-PUSCH-CONFIGCOMMON-STOP --- TAG-PUSCH-POWERCONTROL-START - -PUSCH-PowerControl ::= SEQUENCE { - - -- If enabled, UE applies TPC commands via accumulation. If not enabled, UE applies the TPC command without accumulation. - -- If absent, TPC accumulation is enabled. Corresponds to L1 parameter 'Accumulation-enabled' (see 38.213, section 7.1) - tpc-Accumulation ENUMERATED { disabled } OPTIONAL, -- Need R - - -- Dedicated alpha value for msg3 PUSCH. Corresponds to L1 parameter 'alpha-ue-pusch-msg3' (see 38.213, section 7.1) - -- When the field is absent the UE applies the value 1. - msg3-Alpha Alpha OPTIONAL, -- Need S - - -- P0 value for UL grant-free/SPS based PUSCH. Value in dBm. Only even values (step size 2) allowed. - -- Corresponds to L1 parameter 'p0-nominal-pusch-withoutgrant' (see 38.213, section 7.1) - p0-NominalWithoutGrant INTEGER (-202..24) OPTIONAL, -- Need M, - -- configuration {p0-pusch,alpha} sets for PUSCH (except msg3), i.e., { {p0,alpha,index1}, {p0,alpha,index2},...}. - -- Corresponds to L1 parameter 'p0-push-alpha-setconfig' (see 38,213, section 7.1) - p0-AlphaSets SEQUENCE (SIZE (1..maxNrofP0-PUSCH-AlphaSets)) OF P0-PUSCH-AlphaSet OPTIONAL, -- Need M, - - -- A set of Reference Signals (e.g. a CSI-RS config or a SSblock) to be used for PUSCH path loss estimation. - -- Up to maxNrofPUSCH-PathlossReferenceRSs may be configured when 'PUSCH beam indication' is present (FFS: in DCI???). - -- Otherwise, there may be only one entry. - -- Corresponds to L1 parameter 'pusch-pathlossReference-rs-config' (see 38.213, section 7.1) - pathlossReferenceRSToAddModList SEQUENCE (SIZE (1..maxNrofPUSCH-PathlossReferenceRSs)) OF PUSCH-PathlossReferenceRS - OPTIONAL, -- Need N - pathlossReferenceRSToReleaseList SEQUENCE (SIZE (1..maxNrofPUSCH-PathlossReferenceRSs)) OF PUSCH-PathlossReferenceRS-Id - OPTIONAL, -- Need N - - -- Number of PUSCH power control adjustment states maintained by the UE (i.e., fc(i)). If the field is present (n2) the UE maintains - -- two power control states (i.e., fc(i,1) and fc(i,2)). Otherwise, it applies one (i.e., fc(i,1)). - -- Corresponds to L1 parameter 'num-pusch-pcadjustment-states' (see 38.213, section 7.1) - twoPUSCH-PC-AdjustmentStates ENUMERATED {twoStates} OPTIONAL, -- Need S - - -- Indicates whether to apply dela MCS. When the field is absent, the UE applies Ks = 0 in delta_TFC formula for PUSCH. - -- Corresponds to L1 parameter 'deltaMCS-Enabled' (see 38.213, section 7.1) - deltaMCS ENUMERATED {enabled} OPTIONAL, -- Need S - - -- A list of SRI-PUSCH-PowerControl elements among which one is selected by the SRI field in DCI. - -- Corresponds to L1 parameter 'SRI-PUSCHPowerControl-mapping' (see 38.213, section 7.1) - sri-PUSCH-MappingToAddModList SEQUENCE (SIZE (1..maxNrofSRI-PUSCH-Mappings)) OF SRI-PUSCH-PowerControl OPTIONAL, -- Need M - sri-PUSCH-MappingToReleaseList SEQUENCE (SIZE (1..maxNrofSRI-PUSCH-Mappings)) OF SRI-PUSCH-PowerControlId OPTIONAL -- Need M -} - --- A set of p0-pusch and alpha used for PUSCH with grant. 'PUSCH beam indication' (if present) gives the index of the set to --- be used for a particular PUSCH transmission. --- FFS_CHECK: Is the ”PUSCH beam indication” in DCI which schedules the PUSCH? If so, clarify in field description --- Corresponds to L1 parameter 'p0-pusch-alpha-set' (see 38.213, section 7.1) -P0-PUSCH-AlphaSet ::= SEQUENCE { - p0-PUSCH-AlphaSetId P0-PUSCH-AlphaSetId, - -- P0 value for PUSCH with grant (except msg3) in steps of 1dB. Corresponds to L1 parameter 'p0-pusch' (see 38,213, section 7.1) - p0 INTEGER (-16..15) OPTIONAL, - -- alpha value for PUSCH with grant (except msg3) (see 38.213, section 7.1) - -- When the field is absent the UE applies the value 1 - alpha Alpha OPTIONAL -- Need S -} - --- ID for a P0-PUSCH-AlphaSet. Corresponds to L1 parameter 'p0alphasetindex' (see 38.213, section 7.1) -P0-PUSCH-AlphaSetId ::= INTEGER (0..maxNrofP0-PUSCH-AlphaSets-1) - --- A reference signal (RS) configured as pathloss reference signal for PUSCH power control --- Corresponds to L1 parameter 'pusch-pathlossReference-rs' (see 38.213, section 7.1) -PUSCH-PathlossReferenceRS ::= SEQUENCE { - pusch-PathlossReferenceRS-Id PUSCH-PathlossReferenceRS-Id, - referenceSignal CHOICE { - ssb-Index SSB-Index, - csi-RS-Index NZP-CSI-RS-ResourceId - } -} - --- ID for a referemce signal (RS) configured as PUSCH pathloss reference --- Corresponds to L1 parameter 'pathlossreference-index' (see 38.213, section 7.1) --- FFS_CHECK: Is this ID used anywhere except inside the PUSCH-PathlossReference-RS itself? -PUSCH-PathlossReferenceRS-Id ::= INTEGER (0..maxNrofPUSCH-PathlossReferenceRSs-1) - - --- A set of PUSCH power control parameters associated with one SRS-ResourceIndex (SRI) -SRI-PUSCH-PowerControl ::= SEQUENCE { - -- The ID of this SRI-PUSCH-PowerControl configuration. It is used as the codepoint (payload) in the SRI DCI field. - sri-PUSCH-PowerControlId SRI-PUSCH-PowerControlId, - -- The ID of PUSCH-PathlossReferenceRS as configured in the pathlossReferenceRSToAddModList in PUSCH-PowerControl. - sri-PUSCH-PathlossReferenceRS-Id PUSCH-PathlossReferenceRS-Id, - -- The ID of a P0-PUSCH-AlphaSet as configured in p0-AlphaSets in PUSCH-PowerControl. - sri-P0-PUSCH-AlphaSetId P0-PUSCH-AlphaSetId, - -- The index of the closed power control loop associated with this SRI-PUSCH-PowerControl - sri-PUSCH-ClosedLoopIndex ENUMERATED { i0, i1 } -} - -SRI-PUSCH-PowerControlId ::= INTEGER (0..maxNrofSRI-PUSCH-Mappings-1) - --- A set of beta-offset values -BetaOffsets ::= SEQUENCE { - -- Up to 2 bits HARQ-ACK. Corresponds to L1 parameter 'betaOffset-ACK-Index-1' (see 38.213, section 9.3) - -- When the field is absent the UE applies the value 11 - betaOffsetACK-Index1 INTEGER(0..31) OPTIONAL, -- Need S - -- Up to 11 bits HARQ-ACK. Corresponds to L1 parameter 'betaOffset-ACK-Index-2' (see 38.213, section 9.3) - -- When the field is absent the UE applies the value 11 - betaOffsetACK-Index2 INTEGER(0..31) OPTIONAL, -- Need S - -- Above 11 bits HARQ-ACK. Corresponds to L1 parameter 'betaOffset-ACK-Index-3' (see 38.213, section 9.3) - -- When the field is absent the UE applies the value 11 - betaOffsetACK-Index3 INTEGER(0..31) OPTIONAL, -- Need S - -- Up to 11 bits of CSI part 1 bits. Corresponds to L1 parameter 'betaOffset-CSI-part-1-Index-1' (see 38.213, section 9.3) - -- When the field is absent the UE applies the value 13 - betaOffsetCSI-Part1-Index1 INTEGER(0..31) OPTIONAL, -- Need S - -- Above 11 bits of CSI part 1 bits. Corresponds to L1 parameter 'betaOffset-CSI-part-1-Index-2' (see 38.213, section 9.3) - -- When the field is absent the UE applies the value 13 - betaOffsetCSI-Part1-Index2 INTEGER(0..31) OPTIONAL, -- Need S - -- Up to 11 bits of CSI part 2 bits. Corresponds to L1 parameter 'betaOffset-CSI-part-2-Index-1' (see 38.213, section 9.3) - -- When the field is absent the UE applies the value 13 - betaOffsetCSI-Part2-Index1 INTEGER(0..31) OPTIONAL, -- Need S - -- Above 11 bits of CSI part 2 bits. Corresponds to L1 parameter 'betaOffset-CSI-part-2-Index-2' (see 38.213, section 9.3) - -- When the field is absent the UE applies the value 13 - betaOffsetCSI-Part2-Index2 INTEGER(0..31) OPTIONAL -- Need S -} - --- TAG-PUSCH-POWERCONTROL-STOP --- TAG-PUSCH-SERVINGCELLCONFIG-START - -PUSCH-ServingCellConfig ::= SEQUENCE { - -- Enables and configures code-block-group (CBG) based transmission (see 38.214, section FFS_Section) - codeBlockGroupTransmission SetupRelease { PUSCH-CodeBlockGroupGransmission } OPTIONAL, -- Need M - -- Enables LBRM (Limited buffer rate-matching). When the field is absent the UE applies FBRM (Full buffer rate-matchingLBRM). - -- Corresponds to L1 parameter 'LBRM-FBRM-selection' (see 38.212, section 5.4.2) - rateMatching ENUMERATED {limitedBufferRM} OPTIONAL, -- Need S - -- Accounts for overhead from CSI-RS, CORESET, etc. If the field is absent, the UE applies the value 'xoh0'. - -- Corresponds to L1 parameter 'Xoh-PUSCH' (see 38.214, section 5.1.3.2) - xOverhead ENUMERATED {xoh6, xoh12, xoh18} OPTIONAL, -- Need S - ... -} - -PUSCH-CodeBlockGroupGransmission ::= SEQUENCE { - -- Maximum number of code-block-groups (CBGs) per TB (see 38.xxx, section x.x.x, FFS_Ref) - -- For 2 codewords, only the values { n2, n4 } are valid. - maxCodeBlockGroupsPerTransportBlock ENUMERATED {n2, n4, n6, n8}, - ... -} - --- TAG-PUSCH-SERVINGCELLCONFIG-STOP --- TAG-PUSCH-TIMEDOMAINRESOURCEALLOCATION-START - -PUSCH-TimeDomainResourceAllocation ::= SEQUENCE { - -- Corresponds to L1 parameter 'K2' (see 38.214, section FFS_Section) - -- When the field is absent the UE applies the value 01 when PUSCH SCS is 15/30KHz; 2 when PUSCH SCS is 60KHz and 3 when PUSCH SCS is 120KHz. - k2 INTEGER (0..7) OPTIONAL, -- Need S - -- Mapping type. Corresponds to L1 parameter 'Mapping-type' (see 38.214, section FFS_Section) - mappingType ENUMERATED {typeA, typeB}, - -- An index into a table/equation in RAN1 specs capturing valid combinations of start symbol and length (jointly encoded) - -- Corresponds to L1 parameter 'Index-start-len' (see 38.214, section FFS_Section) - startSymbolAndLength BIT STRING (SIZE (7)) -} - --- TAG-PUSCH-TIMEDOMAINRESOURCEALLOCATION-STOP --- TAG-PUSCH-TPC-COMMANDCONFIG-START - -PUSCH-TPC-CommandConfig ::= SEQUENCE { - -- An index determining the position of the first bit of TPC command inside the DCI format 2-2 payload. - tpc-Index INTEGER (1..15) OPTIONAL, -- Cond SUL - -- An index determining the position of the first bit of TPC command inside the DCI format 2-2 payload. - tpc-IndexSUL INTEGER (1..15) OPTIONAL, -- Cond SUL-Only - -- The serving cell to which the acquired power control commands are applicable. If the value is absent, the UE applies the - -- TPC commands to the serving cell on which the command has been received. - targetCell ServCellIndex OPTIONAL, -- Need S - ... -} - --- TAG-PUSCH-TPC-COMMANDCONFIG-STOP - -Q-OffsetRange ::= ENUMERATED { - dB-24, dB-22, dB-20, dB-18, dB-16, dB-14, - dB-12, dB-10, dB-8, dB-6, dB-5, dB-4, dB-3, - dB-2, dB-1, dB0, dB1, dB2, dB3, dB4, dB5, - dB6, dB8, dB10, dB12, dB14, dB16, dB18, - dB20, dB22, dB24} - --- TAG-QUANTITY-CONFIG-START - - -QuantityConfig ::= SEQUENCE { - quantityConfigNR-List QuantityConfigNR-List OPTIONAL, -- Need M - ... -} - -QuantityConfigNR-List::= SEQUENCE (SIZE (1..maxNrofQuantityConfig)) OF QuantityConfigNR - -QuantityConfigNR::= SEQUENCE { - quantityConfigCell QuantityConfigRS, - quantityConfigRS-Index QuantityConfigRS OPTIONAL -- Need M -} - -QuantityConfigRS ::= SEQUENCE { - -- SS Block based L3 filter configurations: - ssb-FilterConfig FilterConfig, - - -- CSI-RS basedL3 filter configurations: - cs-RS-FilterConfig FilterConfig -} - -FilterConfig ::= SEQUENCE { - filterCoefficientRSRP FilterCoefficient DEFAULT fc4, - filterCoefficientRSRQ FilterCoefficient DEFAULT fc4, - filterCoefficientRS-SINR FilterCoefficient DEFAULT fc4 -} - --- TAG-QUANTITY-CONFIG-STOP --- TAG-RACH-CONFIG-COMMON-START - -RACH-ConfigCommon ::= SEQUENCE { - -- Generic RACH parameters - rach-ConfigGeneric RACH-ConfigGeneric, - - -- Total number of preambles used for contention based and contention free random access, excluding - -- preambles used for other purposes (e.g. for SI request). If the field is absent, the UE may use all 64 preambles for RA. - totalNumberOfRA-Preambles INTEGER (1..63) OPTIONAL, -- Need S - - -- Number of SSBs per RACH occasion (L1 parameter 'SSB-per-rach-occasion') and the number of Contention Based preambles per SSB - -- (L1 parameter 'CB-preambles-per-SSB'). By multiplying the two values, the UE determines the total number of CB preambles. - ssb-perRACH-OccasionAndCB-PreamblesPerSSB CHOICE { - oneEighth ENUMERATED {n4,n8,n12,n16,n20,n24,n28,n32,n36,n40,n44,n48,n52,n56,n60,n64}, - oneFourth ENUMERATED {n4,n8,n12,n16,n20,n24,n28,n32,n36,n40,n44,n48,n52,n56,n60,n64}, - oneHalf ENUMERATED {n4,n8,n12,n16,n20,n24,n28,n32,n36,n40,n44,n48,n52,n56,n60,n64}, - one ENUMERATED {n4,n8,n12,n16,n20,n24,n28,n32,n36,n40,n44,n48,n52,n56,n60,n64}, - two ENUMERATED {n4,n8,n12,n16,n20,n24,n28,n32}, - four INTEGER (1..16), - eight INTEGER (1..8), - sixteen INTEGER (1..4) - } OPTIONAL, -- Need M - - groupBconfigured SEQUENCE { - -- Transport Blocks size threshold in bit below which the UE shall use a contention based RA premable - -- of group A. (see 38.321, section 5.1.2) - ra-Msg3SizeGroupA ENUMERATED {b56, b144, b208, b256, b282, b480, b640, b800, b1000, spare7, spare6, spare5, - spare4, spare3, spare2, spare1}, - -- Threshold for preamble selection. Value in dB. Value minusinfinity corresponds to –infinity. - -- Value dB0 corresponds to 0 dB, dB5 corresponds to 5 dB and so on. (see FFS_Spec, section FFS_Section) - messagePowerOffsetGroupB ENUMERATED { minusinfinity, dB0, dB5, dB8, dB10, dB12, dB15, dB18}, - -- The number of CB preambles per SSB in group A. This determines implicitly the number of CB preambles per SSB available in group B. - -- (see 38.321, section 5.1.1) - numberOfRA-PreamblesGroupA INTEGER (1..64) - } OPTIONAL, -- Need R - - -- The initial value for the contention resolution timer (see 38.321, section 5.1.5) - ra-ContentionResolutionTimer ENUMERATED { sf8, sf16, sf24, sf32, sf40, sf48, sf56, sf64}, - - -- UE may select the SS block and corresponding PRACH resource for path-loss estimation and (re)transmission - -- based on SS blocks that satisfy the threshold (see 38.213, section REF) - rsrp-ThresholdSSB RSRP-Range OPTIONAL, -- Need R - -- UE may select the SS block and corresponding PRACH resource for path-loss estimation and (re)transmission on the SUL carrier - -- based on SS blocks that satisfy the threshold - -- Corresponds to L1 parameter 'SUL-RSRP-Threshold' (see FFS_Spec, section FFS_Section) - rsrp-ThresholdSSB-SUL RSRP-Range OPTIONAL, -- Need R - - -- PRACH root sequence index. Corresponds to L1 parameter 'PRACHRootSequenceIndex' (see 38.211, section 6.3.3.1). - -- The value range depends on whether L=839 or L=139 - prach-RootSequenceIndex CHOICE { - l839 INTEGER (0..837), - l139 INTEGER (0..137) - }, - - -- Subcarrier spacing of PRACH. Only the values 15 or 30 kHz (<6GHz), 60 or 120 kHz (>6GHz) are applicable. - -- Corresponds to L1 parameter 'prach-Msg1SubcarrierSpacing' (see 38.211, section FFS_Section) - msg1-SubcarrierSpacing SubcarrierSpacing, - - -- Configuration of an unrestricted set or one of two types of restricted sets, see 38.211 6.3.3.1 - restrictedSetConfig ENUMERATED {unrestrictedSet, restrictedSetTypeA, restrictedSetTypeB}, - -- Indicates to a UE whether transform precoding is enabled for Msg3 transmission. - -- Corresponds to L1 parameter 'msg3-tp' (see 38.213, section 8.1) - msg3-transformPrecoding ENUMERATED {enabled} OPTIONAL, -- Need R - ... -} - --- TAG-RACH-CONFIG-COMMON-STOP --- TAG-RACH-CONFIG-GENERIC-START - -RACH-ConfigGeneric ::= SEQUENCE { - -- PRACH configuration index. Corresponds to L1 parameter 'PRACHConfigurationIndex' (see 38.211, section 6.3.3.2) - prach-ConfigurationIndex INTEGER (0..255), - -- The number of PRACH transmission occasions FDMed in one time instance. - -- Corresponds to L1 parameter 'prach-FDM' (see 38.211, section FFS_Section) - msg1-FDM ENUMERATED {one, two, four, eight}, - -- Offset of lowest PRACH transmission occasion in frequency domain with respective to PRB 0. - -- The value is configured so that the corresponding RACH resource is entirely within the bandwidth of the UL BWP. - -- Corresponds to L1 parameter 'prach-frequency-start' (see 38,211, section FFS_Section) - msg1-FrequencyStart INTEGER (0..maxNrofPhysicalResourceBlocks-1), - -- N-CS configuration, see Table 6.3.3.1-3 in 38.211 - zeroCorrelationZoneConfig INTEGER(0..15), - -- The target power level at the network receiver side (see 38.213, section 7.4, 38.321, section 5.1.2, 5.1.3) - -- Only multiples of 2 dBm may be chosen (e.g. -200, -198, ...). - -- FFS-Value: Actual values to be updated based on input from RAN4 (see LS in R2-1800004 and R4-1803466). - preambleReceivedTargetPower INTEGER (-200..-74), - -- Max number of RA preamble transmission perfomed before declaring a failure (see 38.321, section 5.1.4, 5.1.5) - preambleTransMax ENUMERATED {n3, n4, n5, n6, n7, n8, n10, n20, n50, n100, n200}, - -- Power ramping steps for PRACH (see 38.321,5.1.3) - powerRampingStep ENUMERATED {dB0, dB2, dB4, dB6}, - -- Msg2 (RAR) window length in number of slots. The network configures a value lower than or euqal to 10 ms (see 38.321, section 5.1.4) - ra-ResponseWindow ENUMERATED {sl1, sl2, sl4, sl8, sl10, sl20, sl40, sl80} -} - --- TAG-RACH-CONFIG-GENERIC-STOP --- TAG-RACH-CONFIG-DEDICATED-START - --- FFS_Standlone: resources for msg1-based on-demand SI request - -RACH-ConfigDedicated ::= SEQUENCE { - -- Resources for contention free random access to a given target cell - cfra-Resources CFRA-Resources, - ... -} - -CFRA-Resources ::= CHOICE { - ssb SEQUENCE { - ssb-ResourceList SEQUENCE (SIZE(1..maxRA-SSB-Resources)) OF CFRA-SSB-Resource, - -- Explicitly signalled PRACH Mask Index for RA Resource selection in TS 36.321. The mask is valid for all SSB - -- resources signalled in ssb-ResourceList - ra-ssb-OccasionMaskIndex INTEGER (0..15) - }, - csirs SEQUENCE { - csirs-ResourceList SEQUENCE (SIZE(1..maxRA-CSIRS-Resources)) OF CFRA-CSIRS-Resource, - cfra-csirs-DedicatedRACH-Threshold RSRP-Range - } -} - -CFRA-SSB-Resource ::= SEQUENCE { - -- The ID of an SSB transmitted by this serving cell. - ssb SSB-Index, - -- The preamble index that the UE shall use when performing CF-RA upon selecting the candidate beams identified by this SSB. - ra-PreambleIndex INTEGER (0..63), - ... -} - -CFRA-CSIRS-Resource ::= SEQUENCE { - -- The ID of a CSI-RS resource defined in the measurement object associated with this serving cell. - csi-RS CSI-RS-Index, - -- RA occasions that the UE shall use when performing CF-RA upon selecting the candidate beam identified by this CSI-RS. - ra-OccasionList SEQUENCE (SIZE(1..maxRA-OccasionsPerCSIRS)) OF INTEGER (0..maxRA-Occasions-1), - -- The RA preamble index to use in the RA occasions assoicated with this CSI-RS. - ra-PreambleIndex INTEGER (0..63), - ... -} - --- TAG-RACH-CONFIG-DEDICATED-STOP --- TAG-RADIO-BEARER-CONFIG-START - -RadioBearerConfig ::= SEQUENCE { - srb-ToAddModList SRB-ToAddModList OPTIONAL, -- Need N - srb3-ToRelease ENUMERATED{true} OPTIONAL, -- Need N - drb-ToAddModList DRB-ToAddModList OPTIONAL, -- Need N - drb-ToReleaseList DRB-ToReleaseList OPTIONAL, -- Need N - securityConfig SecurityConfig OPTIONAL, -- Cond M - ... -} - -SRB-ToAddModList ::= SEQUENCE (SIZE (1..2)) OF SRB-ToAddMod -SRB-ToAddMod ::= SEQUENCE { - srb-Identity SRB-Identity, - -- may only be set if the cell groups of all linked logical channels are reset or released - reestablishPDCP ENUMERATED{true} OPTIONAL, -- Need N - discardOnPDCP ENUMERATED{true} OPTIONAL, -- Need N - pdcp-Config PDCP-Config OPTIONAL, -- Cond PDCP - ... -} - - -DRB-ToAddModList ::= SEQUENCE (SIZE (1..maxDRB)) OF DRB-ToAddMod -DRB-ToAddMod ::= SEQUENCE { - cnAssociation CHOICE { - -- The EPS bearer ID determines the EPS bearer when NR connects to EPC using EN-DC - eps-BearerIdentity INTEGER (0..15), -- EPS-DRB-Setup - -- The SDAP configuration determines how to map QoS flows to DRBs when NR connects to the 5GC - sdap-Config SDAP-Config -- 5GC - } OPTIONAL, -- Cond DRBSetup - drb-Identity DRB-Identity, - - -- may only be set if the cell groups of all linked logical channels are reset or released - reestablishPDCP ENUMERATED{true} OPTIONAL, -- Need N - recoverPDCP ENUMERATED{true} OPTIONAL, -- Need N - pdcp-Config PDCP-Config OPTIONAL, -- Cond PDCP - ... -} - -DRB-ToReleaseList ::= SEQUENCE (SIZE (1..maxDRB)) OF DRB-Identity - - -SecurityConfig ::= SEQUENCE { - securityAlgorithmConfig SecurityAlgorithmConfig OPTIONAL, -- Cond RBTermChange - keyToUse ENUMERATED{keNB, s-KgNB} OPTIONAL, -- Cond RBTermChange - ... -} - --- TAG-RADIO-BEARER-CONFIG-STOP --- TAG-RADIOLINKMONITORINGCONFIG-START - -RadioLinkMonitoringConfig ::= SEQUENCE { - -- A list of reference signals for detecting beam failure and/or cell level radio link failure (RLF). - -- The network configures at most two detectionResources per BWP for the purpose "beamFailure" or "both". - -- If no RSs are provided for the purpose of beam failure detection, the UE performs beam monitoring based on the activated TCI-State - -- for PDCCH. However, if the activated TCI state refers to an aperiodic or semi-persistent CSI-RS, the gNB configures the failure - -- detection resources explicitly (FFS_RAN1: TBC by RAN1). - -- If no RSs are provided in this list at all (neither for Cell- nor for Beam-RLM), the UE performs also Cell-RLM based - -- on the activated TCI-State of PDCCH (FFS_RAN1: TBC by RAN1). - -- When the network reconfigures this field, the UE resets on-going RLF timers and counters. - failureDetectionResources SEQUENCE (SIZE(1..maxNrofFailureDetectionResources)) OF RadioLinkMonitoringRS OPTIONAL, -- Need M - -- This field determines after how many beam failure events the UE triggers beam failure recovery (see 38.321, section 5.17). - -- Value n1 corresponds to 1 beam failure instance, n2 corresponds to 2 beam failure instances and so on. - -- When the network reconfigures this field, the UE resets on-going RLF timers and counters. - -- If the field is absent, the UE does not trigger beam failure recovery. - beamFailureInstanceMaxCount ENUMERATED {n1, n2, n3, n4, n5, n6, n8, n10} OPTIONAL, -- Need S - -- Timer for beam failure detection (see 38.321, section FFS_Section). See also the BeamFailureRecoveryConfig IE. - -- Value in number of "periods of Beam Failure Detection" Reference Signal. Value pbfd1 corresponds to 1 period of Beam Failure - -- Detection Reference Signal, value pbfd2 corresponds to 2 periods of Beam Failure Detection Reference Signal and so on. - -- When the network reconfigures this field, the UE resets on-going RLF timers and counters. - beamFailureDetectionTimer ENUMERATED {pbfd1, pbfd2, pbfd3, pbfd4, pbfd5, pbfd6, pbfd8, pbfd10} OPTIONAL, -- Need R - ... -} - -RadioLinkMonitoringRS ::= SEQUENCE { - -- Determines whether the UE shall monitor the associated reference signal for the purpose of cell- and/or beam failure detection. - purpose ENUMERATED {beamFailure, rlf, both}, - -- A reference signal that the UE shall use for radio link monitoring. The network provides an ssb-Index only if - -- the purpose is set to rlf. - detectionResource CHOICE { - ssb-Index SSB-Index, - csi-RS-Index NZP-CSI-RS-ResourceId - }, - ... -} - --- TAG-RADIOLINKMONITORINGCONFIG-STOP --- TAG-RATEMATCHPATTERN-START -RateMatchPattern ::= SEQUENCE { - rateMatchPatternId RateMatchPatternId, - - patternType CHOICE { - bitmaps SEQUENCE { - -- A resource block level bitmap in the frequency domain. It indicates the PRBs to which the symbolsInResourceBlock bitmap applies. - -- Corresponds to L1 parameter 'rate-match-PDSCH-bitmap1' (see 38.214, section FFS_Section) - -- FFS_ASN1: Consider multiple options with different number of bits (for narrower carriers) - resourceBlocks BIT STRING (SIZE (275)), - - -- A symbol level bitmap in time domain. It indicates (FFS: with a bit set to true) the symbols which the UE shall rate match around. - -- This pattern recurs (in time domain) with the configured periodicityAndOffset. - -- Corresponds to L1 parameter 'rate-match-PDSCH-bitmap2' (see 38.214, section FFS_Section) - -- FFS: Why not split it into two BIT STRINGs of 14 bit each? - symbolsInResourceBlock CHOICE { - oneSlot BIT STRING (SIZE (14)), - twoSlots BIT STRING (SIZE (28)) - }, - - -- A time domain repetition pattern. at which the symbolsInResourceBlock - -- pattern recurs. This slot pattern repeats itself continuously. Absence of this field indicates the value n1, i.e., the - -- symbolsInResourceBlock recurs every 14 symbols. - -- Corresponds to L1 parameter 'rate-match-PDSCH-bitmap3' (see 38.214, section FFS_Section) - periodicityAndPattern CHOICE { - n2 BIT STRING (SIZE (2)), - n4 BIT STRING (SIZE (4)), - n5 BIT STRING (SIZE (5)), - n8 BIT STRING (SIZE (8)), - n10 BIT STRING (SIZE (10)), - n20 BIT STRING (SIZE (20)), - n40 BIT STRING (SIZE (40)) - } OPTIONAL, -- Need S - ... - }, - -- This ControlResourceSet us used as a PDSCH rate matching pattern, i.e., PDSCH reception rate matches around it. - controlResourceSet ControlResourceSetId - }, - -- The SubcarrierSpacing for this resource pattern. If the field is absent, the UE applies the SCS of the associcated BWP. - -- The value kHz15 corresponds to µ=0, kHz30 to µ=1, and so on. Only the values 15 or 30 kHz (<6GHz), 60 or 120 kHz (>6GHz) are - -- applicable. Corresponds to L1 parameter 'resource-pattern-scs' (see 38.214, section FFS_Section) - subcarrierSpacing SubcarrierSpacing OPTIONAL, -- Cond CellLevel - -- FFS_Description, FFS_Section - mode ENUMERATED { dynamic, semiStatic }, - ... -} - --- TAG-RATEMATCHPATTERN-STOP --- TAG-RATEMATCHPATTERNID-START - -RateMatchPatternId ::= INTEGER (0..maxNrofRateMatchPatterns-1) - --- TAG-RATEMATCHPATTERNID-STOP --- TAG-RATEMATCHPATTERNLTE-CRS-START - -RateMatchPatternLTE-CRS ::= SEQUENCE { - -- Center of the LTE carrier. Corresponds to L1 parameter 'center-subcarrier-location' (see 38.214, section 5.1.4) - carrierFreqDL INTEGER (0..16383), - -- BW of the LTE carrier in numbewr of PRBs. Corresponds to L1 parameter 'BW' (see 38.214, section 5.1.4) - carrierBandwidthDL ENUMERATED {n6, n15, n25, n50, n75, n100, spare2, spare1}, - -- LTE MBSFN subframe configuration. Corresponds to L1 parameter 'MBSFN-subframconfig' (see 38.214, section 5.1.4) - -- FFS_ASN1: Import the LTE MBSFN-SubframeConfigList - mbsfn-SubframeConfigList EUTRA-MBSFN-SubframeConfigList OPTIONAL, -- Need M - -- Number of LTE CRS antenna port to rate-match around. - -- Corresponds to L1 parameter 'rate-match-resources-numb-LTE-CRS-antenna-port' (see 38.214, section 5.1.4) - nrofCRS-Ports ENUMERATED {n1, n2, n4}, - -- Shifting value v-shift in LTE to rate match around LTE CRS - -- Corresponds to L1 parameter 'rate-match-resources-LTE-CRS-v-shift' (see 38.214, section 5.1.4) - v-Shift ENUMERATED {n0, n1, n2, n3, n4, n5} -} - --- TAG-RATEMATCHPATTERNLTE-CRS-STOP --- TAG-REPORT-CONFIG-ID-START - -ReportConfigId ::= INTEGER (1..maxReportConfigId) - --- TAG-REPORT-CONFIG-ID-STOP --- TAG-REPORT-CONFIG-START - -ReportConfigNR ::= SEQUENCE { - reportType CHOICE { - periodical PeriodicalReportConfig, - eventTriggered EventTriggerConfig, --- reportCGI is to be completed before the end of Rel-15. - reportCGI ENUMERATED {ffsTypeAndValue}, - ... - } -} - --- FFS / TODO: Consider separating trgger configuration (trigger, periodic, ...) from report configuration. --- Current structure allows easier definiton of new events and new report types e.g. CGI, etc. -EventTriggerConfig::= SEQUENCE { - eventId CHOICE { - eventA1 SEQUENCE { - a1-Threshold MeasTriggerQuantity, - reportOnLeave BOOLEAN, - hysteresis Hysteresis, - timeToTrigger TimeToTrigger - }, - eventA2 SEQUENCE { - a2-Threshold MeasTriggerQuantity, - reportOnLeave BOOLEAN, - hysteresis Hysteresis, - timeToTrigger TimeToTrigger - }, - eventA3 SEQUENCE { - a3-Offset MeasTriggerQuantityOffset, - reportOnLeave BOOLEAN, - hysteresis Hysteresis, - timeToTrigger TimeToTrigger, - useWhiteCellList BOOLEAN - }, - eventA4 SEQUENCE { - a4-Threshold MeasTriggerQuantity, - reportOnLeave BOOLEAN, - hysteresis Hysteresis, - timeToTrigger TimeToTrigger, - useWhiteCellList BOOLEAN - }, - eventA5 SEQUENCE { - a5-Threshold1 MeasTriggerQuantity, - a5-Threshold2 MeasTriggerQuantity, - reportOnLeave BOOLEAN, - hysteresis Hysteresis, - timeToTrigger TimeToTrigger, - useWhiteCellList BOOLEAN - }, - eventA6 SEQUENCE { - a6-Offset MeasTriggerQuantityOffset, - reportOnLeave BOOLEAN, - hysteresis Hysteresis, - timeToTrigger TimeToTrigger, - useWhiteCellList BOOLEAN - }, - ... - }, - - rsType NR-RS-Type, - - -- Common reporting config (at least to periodical and eventTriggered) - reportInterval ReportInterval, - reportAmount ENUMERATED {r1, r2, r4, r8, r16, r32, r64, infinity}, - - -- Cell reporting configuration - reportQuantityCell MeasReportQuantity, - maxReportCells INTEGER (1..maxCellReport), - - -- RS index reporting configuration - reportQuantityRsIndexes MeasReportQuantity OPTIONAL, -- Need M - maxNrofRSIndexesToReport INTEGER (1..maxNrofIndexesToReport) OPTIONAL, -- Need M - includeBeamMeasurements BOOLEAN, - -- If configured the UE includes the best neighbour cells per serving frequency - reportAddNeighMeas ENUMERATED {setup} OPTIONAL, -- Need R - ... - -} - -PeriodicalReportConfig ::= SEQUENCE { - rsType NR-RS-Type, - - -- Common reporting config (at least to periodical and eventTriggered) - reportInterval ReportInterval, - reportAmount ENUMERATED {r1, r2, r4, r8, r16, r32, r64, infinity}, - - -- Cell reporting configuration - reportQuantityCell MeasReportQuantity, - maxReportCells INTEGER (1..maxCellReport), - - -- RS index reporting configuration - reportQuantityRsIndexes MeasReportQuantity OPTIONAL, -- Need R - maxNrofRsIndexesToReport INTEGER (1..maxNrofIndexesToReport) OPTIONAL, -- Need R - includeBeamMeasurements BOOLEAN, - useWhiteCellList BOOLEAN, - ... - -} - -NR-RS-Type ::= ENUMERATED {ssb, csi-rs} - -MeasTriggerQuantity ::= CHOICE { - rsrp RSRP-Range, - rsrq RSRQ-Range, - sinr SINR-Range -} - -MeasTriggerQuantityOffset ::= CHOICE { - rsrp INTEGER (-30..30), - rsrq INTEGER (-30..30), - sinr INTEGER (-30..30) -} - - -MeasReportQuantity ::= SEQUENCE { - rsrp BOOLEAN, - rsrq BOOLEAN, - sinr BOOLEAN -} - - --- TAG-REPORT-CONFIG-START --- TAG-REPORT-CONFIG-TO-ADD-MOD-LIST-START - -ReportConfigToAddModList ::= SEQUENCE (SIZE (1..maxReportConfigId)) OF ReportConfigToAddMod - -ReportConfigToAddMod ::= SEQUENCE { - reportConfigId ReportConfigId, - reportConfig CHOICE { - reportConfigNR ReportConfigNR, - ... - } -} - --- TAG- REPORT-CONFIG-TO-ADD-MOD-LIST-STOP - -ReportInterval ::= ENUMERATED {ms120, ms240, ms480, ms640, ms1024, ms2048, ms5120, ms10240, ms20480, ms40960, min1, - min6, min12, min30 } - --- TAG-RLC-CONFIG-START - -RLC-Config ::= CHOICE { - am SEQUENCE { - ul-AM-RLC UL-AM-RLC, - dl-AM-RLC DL-AM-RLC - }, - um-Bi-Directional SEQUENCE { - ul-UM-RLC UL-UM-RLC, - dl-UM-RLC DL-UM-RLC - }, - um-Uni-Directional-UL SEQUENCE { - ul-UM-RLC UL-UM-RLC - }, - um-Uni-Directional-DL SEQUENCE { - dl-UM-RLC DL-UM-RLC - }, - ... -} - -UL-AM-RLC ::= SEQUENCE { - sn-FieldLength SN-FieldLengthAM, - t-PollRetransmit T-PollRetransmit, - pollPDU PollPDU, - pollByte PollByte, - maxRetxThreshold ENUMERATED { t1, t2, t3, t4, t6, t8, t16, t32 } -} - -DL-AM-RLC ::= SEQUENCE { - sn-FieldLength SN-FieldLengthAM, - t-Reassembly T-Reassembly, - t-StatusProhibit T-StatusProhibit -} - -UL-UM-RLC ::= SEQUENCE { - sn-FieldLength SN-FieldLengthUM -} - -DL-UM-RLC ::= SEQUENCE { - sn-FieldLength SN-FieldLengthUM, - t-Reassembly T-Reassembly -} - -T-PollRetransmit ::= ENUMERATED { - ms5, ms10, ms15, ms20, ms25, ms30, ms35, - ms40, ms45, ms50, ms55, ms60, ms65, ms70, - ms75, ms80, ms85, ms90, ms95, ms100, ms105, - ms110, ms115, ms120, ms125, ms130, ms135, - ms140, ms145, ms150, ms155, ms160, ms165, - ms170, ms175, ms180, ms185, ms190, ms195, - ms200, ms205, ms210, ms215, ms220, ms225, - ms230, ms235, ms240, ms245, ms250, ms300, - ms350, ms400, ms450, ms500, ms800, ms1000, - ms2000, ms4000, spare5, spare4, spare3, - spare2, spare1} - - -PollPDU ::= ENUMERATED { - p4, p8, p16, p32, p64, p128, p256, p512, p1024, p2048, p4096, p6144, p8192, p12288, p16384, p20480, - p24576, p28672, p32768, p40960, p49152, p57344, p65536, infinity, spare8, spare7, spare6, spare5, spare4, - spare3, spare2, spare1} - -PollByte ::= ENUMERATED { - kB1, kB2, kB5, kB8, kB10, kB15, kB25, kB50, kB75, - kB100, kB125, kB250, kB375, kB500, kB750, kB1000, - kB1250, kB1500, kB2000, kB3000, kB4000, kB4500, - kB5000, kB5500, kB6000, kB6500, kB7000, kB7500, - mB8, mB9, mB10, mB11, mB12, mB13, mB14, mB15, - mB16, mB17, mB18, mB20, mB25, mB30, mB40, infinity, - spare20, spare19, spare18, spare17, spare16, - spare15, spare14, spare13, spare12, spare11, - spare10, spare9, spare8, spare7, spare6, spare5, - spare4, spare3, spare2, spare1} - -T-Reassembly ::= ENUMERATED { - ms0, ms5, ms10, ms15, ms20, ms25, ms30, ms35, - ms40, ms45, ms50, ms55, ms60, ms65, ms70, - ms75, ms80, ms85, ms90, ms95, ms100, ms110, - ms120, ms130, ms140, ms150, ms160, ms170, - ms180, ms190, ms200, spare1} - -T-StatusProhibit ::= ENUMERATED { - ms0, ms5, ms10, ms15, ms20, ms25, ms30, ms35, - ms40, ms45, ms50, ms55, ms60, ms65, ms70, - ms75, ms80, ms85, ms90, ms95, ms100, ms105, - ms110, ms115, ms120, ms125, ms130, ms135, - ms140, ms145, ms150, ms155, ms160, ms165, - ms170, ms175, ms180, ms185, ms190, ms195, - ms200, ms205, ms210, ms215, ms220, ms225, - ms230, ms235, ms240, ms245, ms250, ms300, - ms350, ms400, ms450, ms500, ms800, ms1000, - ms1200, ms1600, ms2000, ms2400, spare2, spare1} - -SN-FieldLengthUM ::= ENUMERATED {size6, size12} -SN-FieldLengthAM ::= ENUMERATED {size12, size18} - --- TAG-RLC-CONFIG-STOP --- TAG-RLF-TIMERS-AND-CONSTANTS-START - -RLF-TimersAndConstants ::= SEQUENCE { - t310 ENUMERATED {ms0, ms50, ms100, ms200, ms500, ms1000, ms2000, ms4000, ms6000}, - n310 ENUMERATED {n1, n2, n3, n4, n6, n8, n10, n20}, - n311 ENUMERATED {n1, n2, n3, n4, n5, n6, n8, n10}, - ... -} - --- TAG-RLF-TIMERS-AND-CONSTANTS-STOP --- TAG-RNTI-VALUE-START - -RNTI-Value ::= INTEGER (0..65535) - --- TAG-RNTI-VALUE-STOP --- TAG-RSRP-RANGE-START - -RSRP-Range ::= INTEGER(0..124) - --- TAG-RSRP-RANGE-STOP --- TAG-RSRQ-RANGE-START - -RSRQ-Range ::= INTEGER(0..127) - --- TAG-RSRQ-RANGE-STOP --- TAG-SCELL-INDEX-START - --- The value range is shared across the Cell Groups -SCellIndex ::= INTEGER (1..31) - --- TAG-SCELL-INDEX-STOP --- TAG-SCHEDULING-REQUEST-CONFIG-START - -SchedulingRequestConfig ::= SEQUENCE { - schedulingRequestToAddModList SEQUENCE (SIZE (1..maxNrofSR-ConfigPerCellGroup)) OF SchedulingRequestToAddMod OPTIONAL, -- Need N - schedulingRequestToReleaseList SEQUENCE (SIZE (1..maxNrofSR-ConfigPerCellGroup)) OF SchedulingRequestId OPTIONAL -- Need N -} - -SchedulingRequestToAddMod ::= SEQUENCE { - sr-ConfigIndex SchedulingRequestId, - - sr-ProhibitTimer ENUMERATED {ms1, ms2, ms4, ms8, ms16, ms32, ms64, ms128} OPTIONAL, -- Need S - sr-TransMax ENUMERATED { n4, n8, n16, n32, n64, spare3, spare2, spare1} -} - -SchedulingRequestId ::= INTEGER (0..7) - --- FFS_TODO: provide resources for each SchedulingRequestID in ServingCellConfig (TBD whether directly, in PUCCH-Config, in each BWP) - --- TAG-SCHEDULING-REQUEST-CONFIG-STOP --- TAG-SCHEDULING-REQUEST-RESOURCE-CONFIG-START - -SchedulingRequestResourceConfig ::= SEQUENCE { - schedulingRequestResourceId SchedulingRequestResourceId, - -- The ID of the SchedulingRequestConfig that uses this scheduling request resource. - schedulingRequestID SchedulingRequestId, - -- SR periodicity and offset in number of slots. Corresponds to L1 parameter 'SR-periodicity' and 'SR-offset' (see 38.213, section 9.2.2) - -- The following periodicities may be configured depending on the chosen subcarrier spacing: - -- SCS = 15 kHz: 2sym, 7sym, 1sl, 2sl, 4sl, 5sl, 8sl, 10sl, 16sl, 20sl, 40sl, 80sl - -- SCS = 30 kHz: 2sym, 7sym, 1sl, 2sl, 4sl, 8sl, 10sl, 16sl, 20sl, 40sl, 80sl, 160sl - -- SCS = 60 kHz: 2sym, 7sym/6sym, 1sl, 2sl, 4sl, 8sl, 16sl, 20sl, 40sl, 80sl, 160sl, 320sl - -- SCS = 120 kHz: 2sym, 7sym, 1sl, 2sl, 4sl, 8sl, 16sl, 40sl, 80sl, 160sl, 320sl, sl640 - -- sym6or7 corresponds to 6 symbols if extended cyclic prefix and a SCS of 60 kHz are configured, otherwise it corresponds to 7 symbols. - -- For periodicities sym2, sym7 and sl1 the UE assumes an offset of 0 slots. - periodicityAndOffset CHOICE { - sym2 NULL, - sym6or7 NULL, - sl1 NULL, -- Recurs in every slot - sl2 INTEGER (0..1), - sl4 INTEGER (0..3), - sl5 INTEGER (0..4), - sl8 INTEGER (0..7), - sl10 INTEGER (0..9), - sl16 INTEGER (0..15), - sl20 INTEGER (0..19), - sl40 INTEGER (0..39), - sl80 INTEGER (0..79), - sl160 INTEGER (0..159), - sl320 INTEGER (0..319), - sl640 INTEGER (0..639) - } OPTIONAL, -- Need M - -- ID of the PUCCH resource in which the UE shall send the scheduling request. The - -- actual PUCCH-Resource is configured in PUCCH-Config of the same UL BWP and serving cell as this SchedulingRequestResourceConfig. - -- The network configures a PUCCH-Resource of PUCCH-format0 or PUCCH-format1 - -- (other formats not supported). Corresponds to L1 parameter 'SR-resource' (see 38.213, section 9.2.2) - resource PUCCH-ResourceId OPTIONAL -- Need M -} - --- TAG-SCHEDULING-REQUEST-RESOURCE-CONFIG-STOP --- TAG-SCHEDULINGREQUESTRESOURCEID-START - -SchedulingRequestResourceId ::= INTEGER (1..maxNrofSR-Resources) - --- TAG-SCHEDULINGREQUESTRESOURCEID-STOP --- TAG-SCRAMBLING-ID-START - -ScramblingId ::= INTEGER (0..1023) - --- TAG-SCRAMBLING-ID-STOP --- TAG-SCS-SPECIFIC-CARRIER-START - -SCS-SpecificCarrier ::= SEQUENCE { - -- Offset in frequency domain between Point A (lowest subcarrier of common RB 0) and the lowest usable subcarrier on this carrier - -- in number of PRBs (using the subcarrierSpacing defined for this carrier). The maximum value corresponds to 275*8-1. - -- Corresponds to L1 parameter 'offset-pointA-low-scs' (see 38.211, section FFS_Section) - offsetToCarrier INTEGER (0..2199), - -- Subcarrier spacing of this carrier. It is used to convert the offsetToCarrier into an actual frequency. - -- Only the values 15 or 30 kHz (<6GHz), 60 or 120 kHz (>6GHz) are applicable. - -- Corresponds to L1 parameter 'ref-scs' (see 38.211, section FFS_Section) - subcarrierSpacing SubcarrierSpacing, - -- Corresponds to L1 parameter k0 (see 38.211, section 5.3.1). n-6 corresponds to value -6, n0 corresponds to value 0 and n6 corresponds - -- to value +6. - k0 ENUMERATED {n-6, n0, n6}, - -- Width of this carrier in number of PRBs (using the subcarrierSpacing defined for this carrier) - -- Corresponds to L1 parameter 'BW' (see 38.211, section FFS_Section) - carrierBandwidth INTEGER (1..maxNrofPhysicalResourceBlocks), - ... -} - --- TAG-SCS-SPECIFIC-CARRIER-STOP --- TAG-SDAP-CONFIG-START - -SDAP-Config ::= SEQUENCE { - pdu-Session PDU-SessionID, - - -- FFS: separate configuration for UL and DL - sdap-HeaderDL ENUMERATED {present, absent}, - sdap-HeaderUL ENUMERATED {present, absent}, - defaultDRB BOOLEAN, - - -- A list of QoS-Flow-IDs that the UE shall map to the DRB of this SDAP-Config. - mappedQoS-FlowsToAdd SEQUENCE (SIZE (1..maxNrofQFIs)) OF QFI OPTIONAL, -- Need N - -- A list of QoS-Flow-IDs that the UE shall no longer map to the DRB of this SDAP-Config. - mappedQoS-FlowsToRelease SEQUENCE (SIZE (1..maxNrofQFIs)) OF QFI OPTIONAL, -- Need N - ... -} - -QFI ::= INTEGER (0..maxQFI) - -PDU-SessionID ::= INTEGER (0..255) - --- TAG-SDAP-CONFIG-STOP --- TAG-SEARCHSPACE-START - -SearchSpace ::= SEQUENCE { - -- Identity of the search space. SearchSpaceId = 0 identifies the SearchSpace configured via PBCH (MIB) or ServingCellConfigCommon. - -- The searchSpaceId is unique among the BWPs of a Serving Cell. - searchSpaceId SearchSpaceId, - - -- The CORESET applicable for this SearchSpace. - -- Value 0 identifies the common CORESET configured in MIB and in ServingCellConfigCommon - -- Values 1..maxNrofControlResourceSets-1 identify CORESETs configured by dedicated signalling - controlResourceSetId ControlResourceSetId OPTIONAL, -- Cond SetupOnly - - -- Slots for PDCCH Monitoring configured as periodicity and offset. Corresponds to L1 parameters 'Montoring-periodicity-PDCCH-slot' and - -- 'Montoring-offset-PDCCH-slot' (see 38.213, section 10) - monitoringSlotPeriodicityAndOffset CHOICE { - sl1 NULL, - sl2 INTEGER (0..1), - sl4 INTEGER (0..3), - sl5 INTEGER (0..4), - sl8 INTEGER (0..7), - sl10 INTEGER (0..9), - sl16 INTEGER (0..15), - sl20 INTEGER (0..19) - } OPTIONAL, -- Cond Setup - - -- Symbols for PDCCH monitoring in the slots configured for PDCCH monitoring (see monitoringSlotPeriodicityAndOffset). - -- The most significant (left) bit represents the first OFDM in a slot. The least significant (right) bit represents the last symbol. - -- Corresponds to L1 parameter 'Montoring-symbols-PDCCH-within-slot' (see 38.213, section 10) - monitoringSymbolsWithinSlot BIT STRING (SIZE (14)) OPTIONAL, -- Cond Setup - - -- Number of PDCCH candidates per aggregation level. Corresponds to L1 parameter 'Aggregation-level-1' to 'Aggregation-level-8'. - -- The number of candidates and aggregation levels configured here applies to all formats unless a particular value is specified or - -- a format-specific value is provided (see inside searchSpaceType). - -- (see 38.213, section 10) - nrofCandidates SEQUENCE { - aggregationLevel1 ENUMERATED {n0, n1, n2, n3, n4, n5, n6, n8}, - aggregationLevel2 ENUMERATED {n0, n1, n2, n3, n4, n5, n6, n8}, - aggregationLevel4 ENUMERATED {n0, n1, n2, n3, n4, n5, n6, n8}, - aggregationLevel8 ENUMERATED {n0, n1, n2, n3, n4, n5, n6, n8}, - aggregationLevel16 ENUMERATED {n0, n1, n2, n3, n4, n5, n6, n8} - } OPTIONAL, -- Cond Setup - - -- Indicates whether this is a common search space (present) or a UE specific search space as well as DCI formats to monitor for. - searchSpaceType CHOICE { - -- Configures this search space as common search space (CSS) and DCI formats to monitor. - common SEQUENCE { - -- If configured, the UE monitors the DCI formats 0_0 and 1_0 with CRC scrambled by C-RNTI, CS-RNTI (if configured), - -- SP-CSI-RNTI (if configured), RA-RNTI, TC-RNTI, P-RNTI, SI-RNTI - dci-Format0-0-AndFormat1-0 SEQUENCE { - ... - } OPTIONAL, -- Need R - -- If configured, UE monitors the DCI format format 2_0 with CRC scrambled by SFI-RNTI - dci-Format2-0 SEQUENCE { - -- The number of PDCCH candidates specifically for format 2-0 for the configured aggregation level. - -- If an aggregation level is absent, the UE does not search for any candidates with that aggregation level. - -- Corresponds to L1 parameters 'SFI-Num-PDCCH-cand' and 'SFI-Aggregation-Level' (see 38.213, section 11.1.1). - nrofCandidates-SFI SEQUENCE { - aggregationLevel1 ENUMERATED {n1, n2} OPTIONAL, -- Need R - aggregationLevel2 ENUMERATED {n1, n2} OPTIONAL, -- Need R - aggregationLevel4 ENUMERATED {n1, n2} OPTIONAL, -- Need R - aggregationLevel8 ENUMERATED {n1, n2} OPTIONAL, -- Need R - aggregationLevel16 ENUMERATED {n1, n2} OPTIONAL -- Need R - }, - ... - } OPTIONAL, -- Need R - -- If configured, UE monitors the DCI format format 2_1 with CRC scrambled by INT-RNTI - dci-Format2-1 SEQUENCE { - ... - } OPTIONAL, -- Need R - -- If configured, UE monitors the DCI format 2_2 with CRC scrambled by TPC-PUSCH-RNTI or TPC-PUCCH-RNTI - dci-Format2-2 SEQUENCE { - ... - } OPTIONAL, -- Need R - -- If configured, UE monitors the DCI format 2_3 with CRC scrambled by TPC-SRS-RNTI - dci-Format2-3 SEQUENCE { - -- Monitoring periodicity of SRS PDCCH in number of slots for DCI format 2-3. - -- Corresponds to L1 parameter 'SRS-monitoring-periodicity' (see 38.212, 38.213, section 7.3.1, 11.3) - monitoringPeriodicity ENUMERATED {n1, n2, n4, n5, n8, n10, n16, n20 } OPTIONAL, -- Cond Setup - - -- The number of PDCCH candidates for DCI format 2-3 for the configured aggregation level. - -- Corresponds to L1 parameter 'SRS-Num-PDCCH-cand' (see 38.212, 38.213, section 7.3.1, 11.3) - nrofPDCCH-Candidates ENUMERATED {n1, n2}, - ... - } OPTIONAL -- Need R - }, - -- Configures this search space as UE specific search space (USS). The UE monitors the DCI format with CRC scrambled - -- by C-RNTI, CS-RNTI (if configured), TC-RNTI (if a certain condition is met), and SP-CSI-RNTI (if configured) - ue-Specific SEQUENCE { - -- Indicates whether the UE monitors in this USS for DCI formats 0-0 and 1-0 or for formats 0-1 and 1-1. - dci-Formats ENUMERATED {formats0-0-And-1-0, formats0-1-And-1-1}, - ... - } - } OPTIONAL -- Cond Setup -} --- TAG-SEARCHSPACE-STOP --- TAG-SEARCHSPACEID-START - -SearchSpaceId ::= INTEGER (0..maxNrofSearchSpaces-1) - --- TAG-SEARCHSPACEID-STOP --- TAG-SECURITY-ALGORITHM-CONFIG-START - -SecurityAlgorithmConfig ::= SEQUENCE { - cipheringAlgorithm CipheringAlgorithm, - integrityProtAlgorithm IntegrityProtAlgorithm OPTIONAL, -- Need R - ... -} - -IntegrityProtAlgorithm ::= ENUMERATED { - nia0, nia1, nia2, nia3, spare4, spare3, - spare2, spare1, ...} - -CipheringAlgorithm ::= ENUMERATED { - nea0, nea1, nea2, nea3, spare4, spare3, - spare2, spare1, ...} - --- TAG-SECURITY-ALGORITHM-CONFIG-STOP --- TAG-SERV-CELL-INDEX-START - -ServCellIndex ::= INTEGER (0..maxNrofServingCells-1) - --- TAG-SERV-CELL-INDEX-STOP --- TAG-SERVING-CELL-CONFIG-START - -ServingCellConfig ::= SEQUENCE { - -- L1 parameters: - - tdd-UL-DL-ConfigurationDedicated TDD-UL-DL-ConfigDedicated OPTIONAL, -- Cond TDD - - -- The dedicated (UE-specific) configuration for the initial downlink bandwidth-part. - initialDownlinkBWP BWP-DownlinkDedicated OPTIONAL, -- Cond ServCellAdd - - -- List of additional downlink bandwidth parts to be released. (see 38.211, 38.213, section 12). - downlinkBWP-ToReleaseList SEQUENCE (SIZE (1..maxNrofBWPs)) OF BWP-Id OPTIONAL, -- Need N - -- List of additional downlink bandwidth parts to be added or modified. (see 38.211, 38.213, section 12). - downlinkBWP-ToAddModList SEQUENCE (SIZE (1..maxNrofBWPs)) OF BWP-Downlink OPTIONAL, -- Need N - - -- If configured for an SpCell, this field contains the ID of the DL BWP to be activated upon performing the reconfiguration - -- in which it is received. If the field is absent, the RRC reconfiguration does not impose a BWP switch (corresponds to L1 - -- parameter 'active-BWP-DL-Pcell'). - -- If configured for an SCell, this field contains the ID of the downlink bandwidth part to be used upon MAC-activation of an SCell. - -- If not provided, the UE uses the default BWP. - -- The initial bandwidth part is referred to by BWP-Id = 0. - firstActiveDownlinkBWP-Id BWP-Id OPTIONAL, -- Need R - - -- The duration in ms after which the UE falls back to the default Bandwidth Part. (see 38.321, section 5.15) - -- The value 0.5 ms is only applicable for carriers >6 GHz. - -- When the network releases the timer configuration, the UE stops the timer without swithching to the default BWP. - bwp-InactivityTimer ENUMERATED {ms2, ms3, ms4, ms5, ms6, ms8, ms10, ms20, ms30, ms40,ms50, ms60, ms80, - ms100, ms200, ms300, ms500, ms750, ms1280, ms1920, ms2560, spare10, spare9, - spare8, spare7, spare6, spare5, spare4, spare3, spare2, spare1 } OPTIONAL, -- Need R - - -- Corresponds to L1 parameter 'default-DL-BWP'. The initial bandwidth part is referred to by BWP-Id = 0. - -- ID of the downlink bandwidth part to be used upon expiry of txxx. - -- This field is UE specific. When the field is absent the UE uses the the initial BWP as default BWP. - -- (see 38.211, 38.213, section 12 and 38.321, section 5.15) - defaultDownlinkBWP-Id BWP-Id OPTIONAL, -- Need M - - uplinkConfig UplinkConfig OPTIONAL, -- Cond ServCellAdd-UL - supplementaryUplink UplinkConfig OPTIONAL, -- Cond ServCellAdd-SUL - - - -- PDSCH releated parameters that are not BWP-specific. - pdsch-ServingCellConfig SetupRelease { PDSCH-ServingCellConfig } OPTIONAL, -- Need M - csi-MeasConfig SetupRelease { CSI-MeasConfig } OPTIONAL, -- Need M - - -- Includes parameters for configuration of carrier based SRS switching - -- Corresponds to L1 parameter 'SRS-CarrierSwitching' (see 38,214, section FFS_Section) - carrierSwitching SetupRelease { SRS-CarrierSwitching } OPTIONAL, -- Need M - -- MAC parameters: - sCellDeactivationTimer ENUMERATED {ms20, ms40, ms80, ms160, ms200, ms240, ms320, ms400, ms480, ms520, ms640, - ms720, ms840, ms1280, spare2,spare1} OPTIONAL, -- Cond ServingCellWithoutPUCCH - - -- Indicates whether this SCell is cross-carrier scheduled by another serving cell. - crossCarrierSchedulingConfig CrossCarrierSchedulingConfig OPTIONAL, -- Need M - - -- Timing Advance Group ID, as specified in TS 38.321 [3], which this cell belongs to. - tag-Id TAG-Id, - -- Enables the "UE beam lock function (UBF)", which disable changes to the UE beamforming configuration when in NR_RRC_CONNECTED. - -- FFS: Parameter added preliminary based on RAN4 LS in R4-1711823. Decide where to place it (maybe ServingCellConfigCommon or - -- in a BeamManagement IE??) - ue-BeamLockFunction ENUMERATED {enabled} OPTIONAL, -- Need R - - -- Indicates whether UE shall apply as pathloss reference either the downlink of PCell or of SCell that corresponds with this uplink - -- (see 38.213, section 7) - pathlossReferenceLinking ENUMERATED {pCell, sCell} OPTIONAL -- Cond SCellOnly -} - -UplinkConfig ::= SEQUENCE { - -- Configuration of UL BWPs (including BWP-specific parameters: - - -- The dedicated (UE-specific) configuration for the initial uplink bandwidth-part. - initialUplinkBWP BWP-UplinkDedicated OPTIONAL, -- Cond ServCellAdd - - -- The additional bandwidth parts for uplink. In case of TDD uplink- and downlink BWP with the same bandwidthPartId are considered - -- as a BWP pair and must have the same center frequency. - uplinkBWP-ToReleaseList SEQUENCE (SIZE (1..maxNrofBWPs)) OF BWP-Id OPTIONAL, -- Need N - uplinkBWP-ToAddModList SEQUENCE (SIZE (1..maxNrofBWPs)) OF BWP-Uplink OPTIONAL, -- Need N - - -- If configured for an SpCell, this field contains the ID of the DL BWP to be activated upon performing the reconfiguration - -- in which it is received. If the field is absent, the RRC reconfiguration does not impose a BWP switch (corresponds to - -- L1 parameter 'active-BWP-UL-Pcell'). - -- If configured for an SCell, this field contains the ID of the uplink bandwidth part to be used upon MAC-activation of an SCell. - -- If not provided, the UE uses the FFS: default BWP. - -- The initial bandwidth part is referred to by BandiwdthPartId = 0. - firstActiveUplinkBWP-Id BWP-Id OPTIONAL, -- Need R - - -- Configuration that is common across the UL BWPs: - - -- PUSCH related parameters that are not BWP-specific. - pusch-ServingCellConfig SetupRelease { PUSCH-ServingCellConfig } OPTIONAL, -- Need M - ... -} - --- TAG-SERVING-CELL-CONFIG-STOP --- TAG-SERVING-CELL-CONFIG-COMMON-START - -ServingCellConfigCommon ::= SEQUENCE { - physCellId PhysCellId OPTIONAL, -- Cond HOAndServCellAdd, - frequencyInfoDL FrequencyInfoDL OPTIONAL, -- Cond InterFreqHOAndServCellAdd - -- The initial downlink BWP configuration for a SpCell (PCell of MCG or SCG). - initialDownlinkBWP BWP-DownlinkCommon OPTIONAL, -- Cond ServCellAdd - - uplinkConfigCommon UplinkConfigCommon OPTIONAL, -- Cond ServCellAdd-UL - supplementaryUplinkConfig UplinkConfigCommon OPTIONAL, -- Cond ServCellAdd-SUL - - - -- Indicates the time domain positions of the transmitted SS-blocks in an SS-burst. The first/ leftmost bit corresponds to SS/PBCH - -- block index 0, the second bit corresponds to SS/PBCH block index 1, and so on. Value 0 in the bitmap indicates that the - -- corresponding SS/PBCH block is not transmitted while value 1 indicates that the corresponding SS/PBCH block is transmitted. - -- Corresponds to L1 parameter 'SSB-Transmitted' (see 38.213, section 4.1) - ssb-PositionsInBurst CHOICE { - -- bitmap for sub 3 GHz - shortBitmap BIT STRING (SIZE (4)), - -- bitmap for 3-6 GHz - mediumBitmap BIT STRING (SIZE (8)), - -- bitmap for above 6 GHz - longBitmap BIT STRING (SIZE (64)) - } OPTIONAL, -- Need R, - -- The SSB periodicity in msec for the rate matching purpose. If the field is absent, the UE applies the value ms5. - -- (see 38.211, section [7.4.3.1]) - ssb-periodicityServingCell ENUMERATED { ms5, ms10, ms20, ms40, ms80, ms160, spare2, spare1 } OPTIONAL, -- Need S - -- Position of (first) DL DM-RS (see 38.211, section 7.4.1.1.1) - dmrs-TypeA-Position ENUMERATED {pos2, pos3}, - - -- Parameters to determine an LTE CRS pattern that the UE shall rate match around. - lte-CRS-ToMatchAround SetupRelease { RateMatchPatternLTE-CRS } OPTIONAL, -- Need M - - -- Resources patterns which the UE should rate match PDSCH around. The UE rate matches around the union of all resources - -- indicated in the nested bitmaps. Rate match patterns defined here on cell level apply only to PDSCH of the same numerology. - -- Corresponds to L1 parameter 'Resource-set-cekk' (see 38.214, section 5.1.2.2.3) - rateMatchPatternToAddModList SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPattern OPTIONAL, -- Need N - rateMatchPatternToReleaseList SEQUENCE (SIZE (1..maxNrofRateMatchPatterns)) OF RateMatchPatternId OPTIONAL, -- Need N - - -- Subcarrier spacing of SSB. Used only for non-initial access (e.g. SCells, PCell of SCG). - -- If the field is absent the UE shall assume the default value of the band. - -- Only the values 15 or 30 kHz (<6GHz), 120 or 240 kHz (>6GHz) are applicable. - subcarrierSpacing SubcarrierSpacing OPTIONAL, -- Need S - -- A cell-specific TDD UL/DL configuration. Corresponds to L1 parameter 'UL-DL-configuration-common' (see 38.213, section 11.1) - tdd-UL-DL-ConfigurationCommon TDD-UL-DL-ConfigCommon OPTIONAL, -- Cond TDD - -- A second cell-specific TDD UL/DL configuration. When tdd-UL-DL-ConfigurationCommon2 is configured, the cell specific DL/UL - -- pattern is a concatenation of the pattern specified in tdd-UL-DL-ConfigurationCommon and the pattern specified in - -- tdd-UL-DL-ConfigurationCommon2. Corresponds to L1 parameter 'UL-DL-configuration-common-Set2' (see 38.211, section 11.1) - tdd-UL-DL-ConfigurationCommon2 TDD-UL-DL-ConfigCommon OPTIONAL, -- Cond TDD - -- TX power that the NW used for SSB transmission. The UE uses it to estimate the RA preamble TX power. - -- (see 38.213, section 7.4) - ss-PBCH-BlockPower INTEGER (-60..50), - ... -} - -UplinkConfigCommon ::= SEQUENCE { - -- Absolute uplink frequency configuration and subcarrier specific virtual carriers. - frequencyInfoUL FrequencyInfoUL OPTIONAL, -- Cond InterFreqHOAndServCellAdd - -- The initial uplink BWP configuration for a SpCell (PCell of MCG or SCG). Corresponds to L1 parameter 'initial-UL-BWP'. - -- (see 38.331, section FFS_Section). - initialUplinkBWP BWP-UplinkCommon OPTIONAL -- Cond ServCellAdd -} - --- TAG-SERVING-CELL-CONFIG-COMMON-STOP --- TAG-SINR-RANGE-START - -SINR-Range ::= INTEGER(0..127) - --- TAG-SINR-RANGE-STOP --- TAG-SLOTFORMATCOMBINATIONSPERCELL-START - --- The SlotFormatCombinations applicable for one serving cell. Corresponds to L1 parameter 'cell-to-SFI' (see 38.213, section 11.1.1) -SlotFormatCombinationsPerCell ::= SEQUENCE { - -- The ID of the serving cell for which the slotFormatCombinations are applicable - servingCellId ServCellIndex, - - -- Reference subcarrier spacing for this Slot Format Combination. Corresponds to L1 parameter 'SFI-scs' (see 38.213, section FFS_Section) - subcarrierSpacing SubcarrierSpacing, - -- Reference subcarrier spacing for a Slot Format Combination on an FDD or SUL cell. - -- Corresponds to L1 parameter 'SFI-scs2' (see 38.213, section FFS_Section). - -- For FDD, subcarrierSpacing (SFI-scs) is the reference SCS for DL BWP and subcarrierSpacing2 (SFI-scs2) is the reference SCS for UL BWP. - -- For SUL, subcarrierSpacing (SFI-scs) is the reference SCS for non-SUL carrier and subcarrierSpacing2 (SFI-scs2) is the reference - -- SCS for SUL carrier. - subcarrierSpacing2 SubcarrierSpacing OPTIONAL, -- Need R - - -- A list with SlotFormatCombinations. Each SlotFormatCombination comprises of one or more SlotFormats (see 38.211, section 4.3.2) - -- FFS_CHECK: RAN1 indicates that the combinations could be of two different types... but they don't specify the second - slotFormatCombinations SEQUENCE (SIZE (1..maxNrofSlotFormatCombinationsPerSet)) OF SlotFormatCombination OPTIONAL, - - -- The (starting) position (bit) of the slotFormatCombinationId (SFI-Index) for this serving cell (servingCellId) within the DCI payload. - -- Corresponds to L1 parameter 'SFI-values' (see 38.213, section FFS_Section) - positionInDCI INTEGER(0..maxSFI-DCI-PayloadSize-1) OPTIONAL, - ... -} - -SlotFormatCombination ::= SEQUENCE { - -- This ID is used in the DCI payload to dynamically select this SlotFormatCombination. - -- Corresponds to L1 parameter 'SFI-index' (see 38.213, section FFS_Section) - slotFormatCombinationId SlotFormatCombinationId, - -- Slot formats that occur in consecutive slots in time domain order as listed here. The the slot formats are - -- defined in 38.211, table 4.3.2-3 and numbered with 0..255. - slotFormats SEQUENCE (SIZE (1..maxNrofSlotFormatsPerCombination)) OF INTEGER (0..255) -} - --- SFI index that is assoicated with a certian slot-format-combination --- Corresponds to L1 parameter 'SFI-index' (see 38.213, section FFS_Section) -SlotFormatCombinationId ::= INTEGER (0..maxNrofSlotFormatCombinationsPerSet-1) - --- TAG-SLOTFORMATCOMBINATIONSPERCELL-STOP --- TAG-SLOTFORMATINDICATOR-START - -SlotFormatIndicator ::= SEQUENCE { - -- RNTI used for SFI on the given cell - -- Corresponds to L1 parameter 'SFI-RNTI' (see 38.213, section 11.1.1) - sfi-RNTI RNTI-Value, - - -- Total length of the DCI payload scrambled with SFI-RNTI. - -- Corresponds to L1 parameter 'SFI-DCI-payload-length' (see 38.213, section 11.1.1) - dci-PayloadSize INTEGER (1..maxSFI-DCI-PayloadSize), - - -- A list of SlotFormatCombinations for the UE's serving cells. - -- Corresponds to L1 parameter 'SFI-cell-to-SFI' (see 38.213, section 11.1.1) - slotFormatCombToAddModList SEQUENCE (SIZE(1..maxNrofAggregatedCellsPerCellGroup)) OF SlotFormatCombinationsPerCell OPTIONAL, -- Need N - slotFormatCombToReleaseList SEQUENCE (SIZE(1..maxNrofAggregatedCellsPerCellGroup)) OF ServCellIndex OPTIONAL, -- Need N - ... -} - --- TAG-SLOTFORMATINDICATOR-STOP --- TAG-SPS-CONFIG-START - --- Downlink SPS may be configured on the PCell as well as on SCells. But it shall not be configured for more than --- one serving cell of a cell group at once. -SPS-Config ::= SEQUENCE { - -- Periodicity for DL SPS - -- Corresponds to L1 parameter 'semiPersistSchedIntervalDL' (see 38.214 and 38.321, section FFS_Section) - -- FFS-Value: Support also shorter periodicities for DL? - periodicity ENUMERATED {ms10, ms20, ms32, ms40, ms64, ms80, ms128, ms160, ms320, ms640, - spare6, spare5, spare4, spare3, spare2, spare1}, - -- Number of configured HARQ processes for SPS DL. Corresponds to L1 parameter 'numberOfConfSPS-Processes' (see 38.214, section FFS_Section) - nrofHARQ-Processes INTEGER (1..8), - -- HARQ resource for PUCCH for DL SPS. The network configures the resource either as format0 or format1. (see 38.214, section FFS_Section) - n1PUCCH-AN PUCCH-Resource OPTIONAL -- Need M -} - --- TAG-SPS-CONFIG-STOP --- TAG-SRB-IDENTITY-START - -SRB-Identity ::= INTEGER (1..3) - --- TAG-SRB-IDENTITY-STOP --- TAG-SRS-CONFIG-START - -SRS-Config ::= SEQUENCE { - srs-ResourceSetToReleaseList SEQUENCE (SIZE(0..maxNrofSRS-ResourceSets)) OF SRS-ResourceSetId OPTIONAL, -- Need N - srs-ResourceSetToAddModList SEQUENCE (SIZE(0..maxNrofSRS-ResourceSets)) OF SRS-ResourceSet OPTIONAL, -- Need N - - srs-ResourceToReleaseList SEQUENCE (SIZE(1..maxNrofSRS-Resources)) OF SRS-ResourceId OPTIONAL, -- Need N - srs-ResourceToAddModList SEQUENCE (SIZE(1..maxNrofSRS-Resources)) OF SRS-Resource OPTIONAL, -- Need N - - - -- If absent, UE applies TPC commands via accumulation. If disabled, UE applies the TPC command without accumulation - -- (this applies to SRS when a separate closed loop is configured for SRS) - -- Corresponds to L1 parameter 'Accumulation-enabled-srs' (see 38,213, section 7.3) - tpc-Accumulation ENUMERATED {disabled} OPTIONAL, -- Need S - ... -} - -SRS-ResourceSet ::= SEQUENCE { - -- The ID of this resource set. It is unique in the context of the BWP in which the parent SRS-Config is defined. - srs-ResourceSetId SRS-ResourceSetId, - -- The IDs of the SRS-Reosurces used in this SRS-ResourceSet - srs-ResourceIdList SEQUENCE (SIZE(1..maxNrofSRS-ResourcesPerSet)) OF SRS-ResourceId OPTIONAL, -- Cond Setup - - resourceType CHOICE { - aperiodic SEQUENCE { - -- The DCI "code point" upon which the UE shall transmit SRS according to this SRS resource set configuration. - -- Corresponds to L1 parameter 'AperiodicSRS-ResourceTrigger' (see 38.214, section 6.1.1.2) - aperiodicSRS-ResourceTrigger INTEGER (0..maxNrofSRS-TriggerStates-1), - -- ID of CSI-RS resource associated with this SRS resource set. (see 38.214, section 6.1.1.2) - csi-RS NZP-CSI-RS-ResourceId, - -- An offset in number of slots between the triggering DCI and the actual transmission of this SRS-ResourceSet. - -- If the field is absent the UE applies no offset (value 0) - slotOffset INTEGER (1..8) OPTIONAL, -- Need S - ... - }, - semi-persistent SEQUENCE { - -- ID of CSI-RS resource associated with this SRS resource set in non-codebook based operation. - -- Corresponds to L1 parameter 'SRS-AssocCSIRS' (see 38.214, section 6.2.1) - associatedCSI-RS NZP-CSI-RS-ResourceId OPTIONAL, -- Cond nonCodebook - ... - }, - periodic SEQUENCE { - -- ID of CSI-RS resource associated with this SRS resource set in non-codebook based operation. - -- Corresponds to L1 parameter 'SRS-AssocCSIRS' (see 38.214, section 6.2.1) - associatedCSI-RS NZP-CSI-RS-ResourceId OPTIONAL, -- Cond nonCodebook - ... - } - }, - -- Indicates if the SRS resource set is used for beam management vs. used for either codebook based or non-codebook based transmission. - -- Corresponds to L1 parameter 'SRS-SetUse' (see 38.214, section 6.2.1) - -- FFS_CHECK: Isn't codebook/noncodebook already known from the ulTxConfig in the SRS-Config? If so, isn't the only distinction - -- in the set between BeamManagement, AtennaSwitching and "Other”? Or what happens if SRS-Config=Codebook but a Set=NonCodebook? - usage ENUMERATED {beamManagement, codebook, nonCodebook, antennaSwitching}, - - -- alpha value for SRS power control. Corresponds to L1 parameter 'alpha-srs' (see 38.213, section 7.3) - -- When the field is absent the UE applies the value 1 - alpha Alpha OPTIONAL, -- Need S - -- P0 value for SRS power control. The value is in dBm. Only even values (step size 2) are allowed. - -- Corresponds to L1 parameter 'p0-srs' (see 38.213, section 7.3) - p0 INTEGER (-202..24) OPTIONAL, -- Cond Setup - -- A reference signal (e.g. a CSI-RS config or a SSblock) to be used for SRS path loss estimation. - -- Corresponds to L1 parameter 'srs-pathlossReference-rs-config' (see 38.213, section 7.3) - pathlossReferenceRS CHOICE { - ssb-Index SSB-Index, - csi-RS-Index NZP-CSI-RS-ResourceId - } OPTIONAL, -- Need M - -- Indicates whether hsrs,c(i) = fc(i,1) or hsrs,c(i) = fc(i,2) (if twoPUSCH-PC-AdjustmentStates are configured) - -- or serarate close loop is configured for SRS. This parameter is applicable only for Uls on which UE also transmits PUSCH. - -- If absent or release, the UE applies the value sameAs-Fci1 - -- Corresponds to L1 parameter 'srs-pcadjustment-state-config' (see 38.213, section 7.3) - srs-PowerControlAdjustmentStates ENUMERATED { sameAsFci2, separateClosedLoop} OPTIONAL, -- Need S - ... -} - -SRS-ResourceSetId ::= INTEGER (0..maxNrofSRS-ResourceSets-1) - -SRS-Resource ::= SEQUENCE { - srs-ResourceId SRS-ResourceId, - nrofSRS-Ports ENUMERATED {port1, ports2, ports4}, - -- The PTRS port index for this SRS resource for non-codebook based UL MIMO. This is only applicable when the corresponding - -- PTRS-UplinkConfig is set to CP-OFDM. The ptrs-PortIndex configured here must be smaller than or equal to the maxNnrofPorts - -- configured in the PTRS-UplinkConfig. - -- Corresponds to L1 parameter 'UL-PTRS-SRS-mapping-non-CB' (see 38.214, section 6.1) - ptrs-PortIndex ENUMERATED {n0, n1 } OPTIONAL, -- Need R - -- Comb value (2 or 4) and comb offset (0..combValue-1). Corresponds to L1 parameter 'SRS-TransmissionComb' (see 38.214, section 6.2.1) - transmissionComb CHOICE { - n2 SEQUENCE { - combOffset-n2 INTEGER (0..1), - -- Cyclic shift configuration. Corresponds to L1 parameter 'SRS-CyclicShiftConfig' (see 38.214, section 6.2.1) - cyclicShift-n2 INTEGER (0..7) - }, - n4 SEQUENCE { - combOffset-n4 INTEGER (0..3), - -- Cyclic shift configuration. Corresponds to L1 parameter 'SRS-CyclicShiftConfig' (see 38.214, section 6.2.1) - cyclicShift-n4 INTEGER (0..11) - } - }, - -- OFDM symbol location of the SRS resource within a slot including number of OFDM symbols (N = 1, 2 or 4 per SRS resource), - -- startPosition (SRSSymbolStartPosition = 0..5; "0" refers to the last symbol, "1" refers to the second last symbol) and - -- RepetitionFactor (r = 1, 2 or 4). - -- Corresponds to L1 parameter 'SRS-ResourceMapping' (see 38.214, section 6.2.1 and 38.211, section 6.4.1.4). - -- FFS: Apparently, RAN1 considers replacing these three fields by a table in RAN1 specs and a corresponding index in ASN.1?! - resourceMapping SEQUENCE { - startPosition INTEGER (0..5), - nrofSymbols ENUMERATED {n1, n2, n4}, - repetitionFactor ENUMERATED {n1, n2, n4} - }, - -- Parameter(s) defining frequency domain position and configurable shift to align SRS allocation to 4 PRB grid. - -- Corresponds to L1 parameter 'SRS-FreqDomainPosition' (see 38.214, section 6.2.1) - freqDomainPosition INTEGER (0..67), - freqDomainShift INTEGER (0..268), - -- Includes parameters capturing SRS frequency hopping - -- Corresponds to L1 parameter 'SRS-FreqHopping' (see 38.214, section 6.2.1) - freqHopping SEQUENCE { - c-SRS INTEGER (0..63), - b-SRS INTEGER (0..3), - b-hop INTEGER (0..3) - }, - -- Parameter(s) for configuring group or sequence hopping - -- Corresponds to L1 parameter 'SRS-GroupSequenceHopping' (see 38.211, section FFS_Section) - groupOrSequenceHopping ENUMERATED { neither, groupHopping, sequenceHopping }, - -- Time domain behavior of SRS resource configuration. - -- Corresponds to L1 parameter 'SRS-ResourceConfigType' (see 38.214, section 6.2.1). - -- For codebook based uplink transmission, the network configures SRS resources in the same resource set with the same - -- time domain behavior on periodic, aperiodic and semi-persistent SRS. - -- FFS: Add configuration parameters for the different SRS resource types? - resourceType CHOICE { - aperiodic SEQUENCE { - ... - }, - semi-persistent SEQUENCE { - -- Periodicity and slot offset for for this SRS resource. All values in "number of slots". - -- sl1 corresponds to a periodicity of 1 slot, value sl2 corresponds to a periodicity of 2 slots, and so on. - -- For each periodicity the corresponding offset is given in number of slots. For periodicity sl1 the offset is 0 slots. - -- Corresponds to L1 parameter 'SRS-SlotConfig' (see 38.214, section 6.2.1) - periodicityAndOffset-sp SRS-PeriodicityAndOffset, - ... - }, - periodic SEQUENCE { - -- Periodicity and slot offset for for this SRS resource. All values in "number of slots" - -- sl1 corresponds to a periodicity of 1 slot, value sl2 corresponds to a periodicity of 2 slots, and so on. - -- For each periodicity the corresponding offset is given in number of slots. For periodicity sl1 the offset is 0 slots. - -- Corresponds to L1 parameter 'SRS-SlotConfig' (see 38.214, section 6.2.1) - periodicityAndOffset-p SRS-PeriodicityAndOffset, - ... - } - }, - -- Sequence ID used to initialize psedo random group and sequence hopping. - -- Corresponds to L1 parameter 'SRS-SequenceId' (see 38.214, section 6.2.1) - sequenceId BIT STRING (SIZE (10)), - - -- Configuration of the spatial relation between a reference RS and the target SRS. Reference RS can be SSB/CSI-RS/SRS - -- Corresponds to L1 parameter 'SRS-SpatialRelationInfo' (see 38.214, section 6.2.1) - spatialRelationInfo CHOICE { - ssb-Index SSB-Index, - csi-RS-Index NZP-CSI-RS-ResourceId, - srs SRS-ResourceId - } OPTIONAL, -- Need R - ... -} - -SRS-ResourceId ::= INTEGER (0..maxNrofSRS-Resources-1) - -SRS-PeriodicityAndOffset ::= CHOICE { - sl1 NULL, - sl2 INTEGER(0..1), - sl4 INTEGER(0..3), - sl5 INTEGER(0..4), - sl8 INTEGER(0..7), - sl10 INTEGER(0..9), - sl16 INTEGER(0..15), - sl20 INTEGER(0..19), - sl32 INTEGER(0..31), - sl40 INTEGER(0..39), - sl64 INTEGER(0..63), - sl80 INTEGER(0..79), - sl160 INTEGER(0..159), - sl320 INTEGER(0..319), - sl640 INTEGER(0..639), - sl1280 INTEGER(0..1279), - sl2560 INTEGER(0..2559) -} - --- TAG-SRS-CONFIG-STOP --- TAG-SRS-CARRIERSWITCHING-START -SRS-CarrierSwitching ::= SEQUENCE { - - -- Indicates the serving cell whose UL transmission may be interrupted during SRS transmission on a PUSCH-less cell. - -- During SRS transmission on a PUSCH-less cell, the UE may temporarily suspend the UL transmission on a serving cell with PUSCH - -- in the same CG to allow the PUSCH-less cell to transmit SRS. (see 38.214, section 6.2.1.3) - srs-SwitchFromServCellIndex INTEGER (0..31) OPTIONAL, -- Cond Setup - - -- Network configures the UE with either typeA-SRS-TPC-PDCCH-Group or typeB-SRS-TPC-PDCCH-Group, if any. - srs-TPC-PDCCH-Group CHOICE { - -- Type A trigger configuration for SRS transmission on a PUSCH-less SCell. - -- Corresponds to L1 parameter 'typeA-SRS-TPC-PDCCH-Group' (see 38.212, 38.213, section 7.3.1, 11.3) - typeA SEQUENCE (SIZE (1..32)) OF SRS-TPC-PDCCH-Config, - -- Type B trigger configuration for SRS transmission on a PUSCH-less SCell. - -- Corresponds to L1 parameter 'typeB-SRS-TPC-PDCCH-Config' (see 38.212, 38.213, section 7.3.1, 11.3) - typeB SRS-TPC-PDCCH-Config - } OPTIONAL, -- Cond Setup - - -- Maps a specific cell to a given SFI value within the DCI message - -- Corresponds to L1 parameter 'SRS-cell-to-SFI' (see 38.212, 38.213, section 7.3.1, 11.3) - srs-CellToSFI SEQUENCE (SIZE (1..maxNrofServingCells)) OF SlotFormatCombinationsPerCell OPTIONAL, -- Cond Setup - - -- A set of serving cells for monitoring PDCCH conveying SRS DCI format with CRC scrambled by TPC-SRS-RNTI - -- Corresponds to L1 parameter 'SRS-monitoring-cells' (see 38.212, 38.213, section 7.3.1, 11.3) - monitoringCells SEQUENCE (SIZE (1..maxNrofServingCells)) OF ServCellIndex OPTIONAL, -- Cond Setup - ... -} - --- One trigger configuration for SRS-Carrier Switching. (see 38.212, 38.213, section 7.3.1, 11.3) -SRS-TPC-PDCCH-Config ::= SEQUENCE { - -- The starting bit position of a block within the group DCI with SRS request fields (optional) and TPC commands - -- for a PUSCH-less SCell. (see 38.212, 38.213, section 7.3.1, 11.3) - startingBitOfFormat2-3 INTEGER (1..31) OPTIONAL, -- Cond Setup - -- The type of a field within the group DCI with SRS request fields (optional) for a PUSCH-less SCell, - -- which indicates how many bits in the field are for SRS request (0 or 1/2). - -- Note that for Type A, there is a common SRS request field for all SCells in the set, but each SCell has its - -- own TPC command bits. See TS 38.212. Network configures this field with the same value for all PUSCH-less SCells. - -- (see 38.212, 38.213, section 7.3.1, 11.3) - fieldTypeFormat2-3 INTEGER (0..1) OPTIONAL, -- Cond Setup - -- A list of paris of [cc-SetIndex; cc-IndexInOneCC-Set] (see 38.212, 38.213, section 7.3.1, 11.3) - -- FFS: Improve description. What is a "CC"? Where is a CC-Set defined? ... - srs-CC-SetIndexlist SEQUENCE (SIZE(1..4)) OF SRS-CC-SetIndex OPTIONAL -- Cond Setup -} - -SRS-CC-SetIndex ::= SEQUENCE { - -- Indicates the CC set index for Type A associated (see 38.212, 38.213, section 7.3.1, 11.3) - cc-SetIndex INTEGER (0..3) OPTIONAL, -- Cond Setup - -- Indicates the CC index in one CC set for Type A (see 38.212, 38.213, section 7.3.1, 11.3) - cc-IndexInOneCC-Set INTEGER (0..7) OPTIONAL -- Cond Setup -} - --- TAG-SRS-CARRIERSWITCHING-STOP --- TAG-SSB-INDEX-START - -SSB-Index ::= INTEGER (0..63) - --- TAG-SSB-INDEX-STOP --- TAG-SUBCARRIER-SPACING-START - --- The subcarrier spacing supported in NR. Restrictions applicable for certain frequencies, channels or signals are clarified --- in the fields that use this IE. -SubcarrierSpacing ::= ENUMERATED {kHz15, kHz30, kHz60, kHz120, kHz240, spare3, spare2, spare1} - - --- TAG-SUBCARRIER-SPACING-STOP --- TAG-TCI-STATE-START - -TCI-State ::= SEQUENCE { - tci-StateId TCI-StateId, - qcl-Type1 QCL-Info, - qcl-Type2 QCL-Info OPTIONAL, -- Need R - nrofPTRS-Ports ENUMERATED {n1, n2} OPTIONAL, -- Need R - ... -} - -QCL-Info ::= SEQUENCE { - - -- The carrier which the RS is located in. If the field is absent, it applies to the serving cell in which the TCI-State is configured - cell ServCellIndex OPTIONAL, -- Need R - - -- The DL BWP which the RS is located in. - bwp-Id BWP-Id OPTIONAL, -- Cond CSI-RS-Indicated - -- Cond NZP-CSI-RS-Indicated: mandatory if csi-rs or csi-RS-for-tracking is included, absent otherwise - referenceSignal CHOICE { - csi-rs NZP-CSI-RS-ResourceId, - ssb SSB-Index, - -- A set of CSI-RS resources for tracking - csi-RS-for-tracking NZP-CSI-RS-ResourceSetId - }, - qcl-Type ENUMERATED {typeA, typeB, typeC, typeD}, - ... -} - --- TAG-TCI-STATE-STOP --- TAG-TCI-STATEID-START - -TCI-StateId ::= INTEGER (0..maxNrofTCI-States-1) - --- TAG-TCI-STATEID-STOP --- TAG-TDD-UL-DL-CONFIG-START - -TDD-UL-DL-ConfigCommon ::= SEQUENCE { - -- Reference SCS used to determine the time domain boundaries in the UL-DL pattern which must be common across all subcarrier specific - -- virtual carriers, i.e., independent of the actual subcarrier spacing using for data transmission. - -- Only the values 15 or 30 kHz (<6GHz), 60 or 120 kHz (>6GHz) are applicable. - -- Corresponds to L1 parameter 'reference-SCS' (see 38.211, section FFS_Section) - referenceSubcarrierSpacing SubcarrierSpacing OPTIONAL, - -- Periodicity of the DL-UL pattern. Corresponds to L1 parameter 'DL-UL-transmission-periodicity' (see 38.211, section FFS_Section) - dl-UL-TransmissionPeriodicity ENUMERATED {ms0p5, ms0p625, ms1, ms1p25, ms2, ms2p5, ms5, ms10} OPTIONAL, - - -- Number of consecutive full DL slots at the beginning of each DL-UL pattern. - -- Corresponds to L1 parameter 'number-of-DL-slots' (see 38.211, Table 4.3.2-1) - nrofDownlinkSlots INTEGER (0..maxNrofSlots) OPTIONAL, - - -- Number of consecutive DL symbols in the beginning of the slot following the last full DL slot (as derived from nrofDownlinkSlots). - -- If the field is absent or released, there is no partial-downlink slot. - -- Corresponds to L1 parameter 'number-of-DL-symbols-common' (see 38.211, section FFS_Section). - nrofDownlinkSymbols INTEGER (0..maxNrofSymbols-1) OPTIONAL, -- Need R - - -- Number of consecutive full UL slots at the end of each DL-UL pattern. - -- Corresponds to L1 parameter 'number-of-UL-slots' (see 38.211, Table 4.3.2-1) - nrofUplinkSlots INTEGER (0..maxNrofSlots) OPTIONAL, - - -- Number of consecutive UL symbols in the end of the slot preceding the first full UL slot (as derived from nrofUplinkSlots). - -- If the field is absent or released, there is no partial-uplink slot. - -- Corresponds to L1 parameter 'number-of-UL-symbols-common' (see 38.211, section FFS_Section) - nrofUplinkSymbols INTEGER (0..maxNrofSymbols-1) OPTIONAL -- Need R -} - -TDD-UL-DL-ConfigDedicated ::= SEQUENCE { - -- The slotSpecificConfiguration allows overriding UL/DL allocations provided in tdd-UL-DL-configurationCommon. - -- FFS_ASN1: Consider making this an AddMod/Release list - -- FFS_ASN1: Replace absolute numbers by variables... once RAN1 confirms. - -- FFS_CHECK: This list will grow very large if used for many slots. - slotSpecificConfigurationsToAddModList SEQUENCE (SIZE (1..maxNrofSlots)) OF TDD-UL-DL-SlotConfig OPTIONAL, -- Need N - slotSpecificConfigurationsToreleaseList SEQUENCE (SIZE (1..maxNrofSlots)) OF TDD-UL-DL-SlotIndex OPTIONAL -- Need N -} - -TDD-UL-DL-SlotConfig ::= SEQUENCE { - -- Identifies a slot within a dl-UL-TransmissionPeriodicity (given in tdd-UL-DL-configurationCommon) - slotIndex TDD-UL-DL-SlotIndex, - - -- The direction (downlink or uplink) for the symbols in this slot. "allDownlink" indicates that all symbols in this slot are used - -- for downlink; "allUplink" indicates that all symbols in this slot are used for uplink; "explicit" indicates explicitly how many symbols - -- in the beginning and end of this slot are allocated to downlink and uplink, respectively. - symbols CHOICE { - allDownlink NULL, - allUplink NULL, - explicit SEQUENCE { - -- Number of consecutive DL symbols in the beginning of the slot identified by slotIndex. - -- If the field is absent the UE assumes that there are no leading DL symbols. - -- Corresponds to L1 parameter 'number-of-DL-symbols-dedicated' (see 38.211, section FFS_Section) - nrofDownlinkSymbols INTEGER (1..maxNrofSymbols-1) OPTIONAL, -- Need S - - -- Number of consecutive UL symbols in the end of the slot identified by slotIndex. - -- If the field is absent the UE assumes that there are no trailing UL symbols. - -- Corresponds to L1 parameter 'number-of-UL-symbols-dedicated' (see 38.211, section FFS_Section) - nrofUplinkSymbols INTEGER (1..maxNrofSymbols-1) OPTIONAL -- Need S - } - } -} - -TDD-UL-DL-SlotIndex ::= INTEGER (0..maxNrofSlots-1) - --- TAG-TDD-UL-DL-CONFIG-STOP - -TimeToTrigger ::= ENUMERATED { - ms0, ms40, ms64, ms80, ms100, ms128, ms160, ms256, - ms320, ms480, ms512, ms640, ms1024, ms1280, ms2560, - ms5120} - --- TAG-ZP-CSI-RS-RESOURCE-START - -ZP-CSI-RS-Resource ::= SEQUENCE { - -- ZP CSI-RS resource configuration ID - -- Corresponds to L1 parameter 'ZP-CSI-RS-ResourceConfigId' (see 38.214, section 5.1.4.2) - zp-CSI-RS-ResourceId ZP-CSI-RS-ResourceId, - -- OFDM symbol and subcarrier occupancy of the ZP-CSI-RS resource within a slot - resourceMapping CSI-RS-ResourceMapping, - -- Periodicity and slot offset for periodic/semi-persistent ZP-CSI-RS - -- Corresponds to L1 parameter 'ZP-CSI-RS-timeConfig' (see 38.214, section 5.1.4.2) - periodicityAndOffset CSI-ResourcePeriodicityAndOffset OPTIONAL, --Cond PeriodicOrSemiPersistent - - ... -} - -ZP-CSI-RS-ResourceId ::= INTEGER (0..maxNrofZP-CSI-RS-Resources-1) - --- TAG-ZP-CSI-RS-RESOURCE-STOP --- TAG-ZP-CSI-RS-RESOURCESET-START - -ZP-CSI-RS-ResourceSet ::= SEQUENCE { - zp-CSI-RS-ResourceSetId ZP-CSI-RS-ResourceSetId, - -- The list of ZP-CSI-RS-ResourceId identifying the ZP-CSI-RS-Resource elements belonging to this set. - zp-CSI-RS-ResourceIdList SEQUENCE (SIZE(1..maxNrofZP-CSI-RS-ResourcesPerSet)) OF ZP-CSI-RS-ResourceId, - -- Time domain behavior of ZP-CSI-RS resource configuration. - -- Corresponds to L1 parameter 'ZP-CSI-RS-ResourceConfigType' (see 38.214, section 5.1.4.2) - resourceType ENUMERATED {aperiodic, semiPersistent, periodic}, - ... -} - --- TAG-ZP-CSI-RS-RESOURCESET-STOP --- TAG-ZP-CSI-RS-RESOURCESETID-START - -ZP-CSI-RS-ResourceSetId ::= INTEGER (0..maxNrofZP-CSI-RS-ResourceSets-1) - --- TAG-ZP-CSI-RS-RESOURCESETID-STOP --- TAG-BANDCOMBINATIONLIST-START - -BandCombinationList ::= SEQUENCE (SIZE (1..maxBandComb)) OF BandCombination - -BandCombination ::= SEQUENCE { - bandAndDL-ParametersList BandAndDL-ParametersList, - bandCombinationsUL BIT STRING (SIZE (1.. maxBandComb)), - bandCombinationParametersList SEQUENCE (SIZE (1..maxBandComb)) OF BandCombinationParameters OPTIONAL -} - -BandAndDL-ParametersList ::= SEQUENCE (SIZE (1..maxSimultaneousBands)) OF BandAndDL-Parameters - -BandAndDL-Parameters ::= CHOICE { - bandAndDL-ParametersEUTRA BandAndDL-ParametersEUTRA, - bandAndDL-ParametersNR BandAndDL-ParametersNR -} -BandCombinationParameters ::= SEQUENCE { - ca-ParametersNR CA-ParametersNR OPTIONAL, - mrdc-Parameters MRDC-Parameters OPTIONAL -} - -CA-ParametersNR ::= SEQUENCE { - multipleTimingAdvances ENUMERATED {supported} OPTIONAL, --- R4 2-5: Simultaneous reception and transmission for inter band CA (TDD-TDD or TDD-FDD) - simultaneousRxTxInterBandCA ENUMERATED {supported} OPTIONAL, --- BCS related to R4 2-1 and Updated CA BW class in R4-1803374 - supportedBandwidthCombinationSet BIT STRING (SIZE (1..32)) OPTIONAL -} - -MRDC-Parameters ::= SEQUENCE { - singleUL-Transmission ENUMERATED {supported} OPTIONAL, --- R4 1-10: Support of EN-DC with LTE-NR coexistence in UL sharing from UE perspective - ul-SharingEUTRA-NR ENUMERATED {supported} OPTIONAL, --- R4 1-11: Switching time between LTE UL and NR UL for EN-DC with LTE-NR coexistence in UL sharing from UE perspective - ul-SwitchingTimeEUTRA-NR ENUMERATED {type1, type2} OPTIONAL, --- R4 2-4: Simultaneous reception and transmission for inter-band EN-DC (TDD-TDD or TDD-FDD) - simultaneousRxTxInterBandENDC ENUMERATED {supported} OPTIONAL, --- R4 2-6: Asynchronous FDD-FDD intra-band EN-DC - asyncIntraBandENDC ENUMERATED {supported} OPTIONAL, - basebandProcesingCombinationMRDC BasebandProcessingCombinationMRDC -} - -BandAndDL-ParametersEUTRA ::= SEQUENCE { - bandEUTRA FreqBandIndicatorEUTRA, - ca-BandwidthClassDL-EUTRA CA-BandwidthClassEUTRA OPTIONAL, - intraBandContiguousCC-InfoDL-EUTRA-List SEQUENCE (SIZE (1.. maxNrofServingCellsEUTRA)) OF IntraBandContiguousCC-InfoDL-EUTRA OPTIONAL -} - -BandAndDL-ParametersNR ::= SEQUENCE { - bandNR FreqBandIndicatorNR, - ca-BandwidthClassDL CA-BandwidthClassNR OPTIONAL, --- R4 2-3: Non-contiguous intra-band CA frequency separation class for FR2 as in the RAN4 LS R4-1803363 - intraBandFreqSeparationDL FreqSeparationClass OPTIONAL, - intraBandContiguousCC-InfoDL-List SEQUENCE (SIZE (1.. maxNrofServingCells)) OF IntraBandContiguousCC-InfoDL OPTIONAL -} - -IntraBandContiguousCC-InfoDL ::= SEQUENCE { --- Related to RAN4 LS R2-1804078 - maxNumberMIMO-LayersPDSCH MIMO-LayersDL OPTIONAL -} - -IntraBandContiguousCC-InfoDL-EUTRA ::= SEQUENCE { --- Related to RAN4 LS R2-1804078 - mimo-CapabilityDL ENUMERATED {twoLayers, fourLayers, eightLayers} OPTIONAL -} - --- TAG-BANDCOMBINATIONLIST-STOP --- TAG-BANDCOMBINATIONPARAMETERSULLIST-START - -BandCombinationParametersUL-List ::= SEQUENCE (SIZE (1..maxBandComb)) OF BandCombinationParametersUL - -BandCombinationParametersUL ::= SEQUENCE (SIZE (1.. maxSimultaneousBands)) OF BandParametersUL - -BandParametersUL ::= CHOICE { - bandParametersUL-EUTRA BandParametersUL-EUTRA, - bandParametersUL-NR BandParametersUL-NR -} - -BandParametersUL-EUTRA ::= SEQUENCE { - ca-BandwidthClassUL-EUTRA CA-BandwidthClassEUTRA OPTIONAL, - intraBandContiguousCC-InfoUL-EUTRA-List SEQUENCE (SIZE (1.. maxNrofServingCellsEUTRA)) OF IntraBandContiguousCC-InfoUL-EUTRA OPTIONAL -} - -BandParametersUL-NR ::= SEQUENCE { - ca-BandwidthClassUL CA-BandwidthClassNR OPTIONAL, --- R4 2-3: Non-contiguous intra-band CA frequency separation class for FR2 as in the RAN4 LS R4-1803363 - intraBandFreqSeparationUL FreqSeparationClass OPTIONAL, - intraBandContiguousCC-InfoUL-List SEQUENCE (SIZE (1.. maxNrofServingCells)) OF IntraBandContiguousCC-InfoUL OPTIONAL -} - -IntraBandContiguousCC-InfoUL ::= SEQUENCE { --- Related to RAN4 LS R2-1804078 - maxNumberMIMO-LayersCB-PUSCH MIMO-LayersUL OPTIONAL, - maxNumberMIMO-LayersNonCB-PUSCH MIMO-LayersUL OPTIONAL -} - -IntraBandContiguousCC-InfoUL-EUTRA ::= SEQUENCE { --- Related to RAN4 LS R2-1804078 - mimo-CapabilityUL ENUMERATED {twoLayers, fourLayers} OPTIONAL -} - --- TAG-BANDCOMBINATIONPARAMETERSULLIST-STOP --- TAG-BASEBANDCOMBINATIONPARAMETERSULLIST-START - -BasebandCombinationParametersUL-List ::= SEQUENCE (SIZE (1..maxBasebandProcComb)) OF BasebandCombinationParametersUL - -BasebandCombinationParametersUL ::= SEQUENCE (SIZE (1..maxSimultaneousBands)) OF BasebandParametersPerBandUL - -BasebandParametersPerBandUL ::= SEQUENCE { - ca-BandwidthClassUL CA-BandwidthClassNR, - freqRange ENUMERATED {fr1, fr2}, - basebandParametersPerCC-UL SEQUENCE (SIZE (1.. maxNrofServingCells)) OF BasebandParametersPerCC-UL -} - -BasebandParametersPerCC-UL ::= SEQUENCE { --- R4 2-2: Simultaneous reception or transmission with same or different numerologies in CA --- It is expressed by the combination of SCS whether simultaneous RxTx is supported or not. - supportedSubcarrierSpacingUL SubcarrierSpacing, --- Accoding to the RAN4 LS R4-1803563, maximum Bandwidth supported per CC is added in BPC --- FFS how to work together with BCS and max BW for each CC to be defined for each CA band combination in the RAN4 spec. - supportedBandwidthUL CHOICE { - fr1 ENUMERATED {mhz5, mhz10, mhz15, mhz20, mhz25, mhz30, mhz40, mhz50, mhz60, mhz80, mhz100}, - fr2 ENUMERATED {mhz50, mhz100, mhz200, mhz400} - }, - -- R2-1800012. To be confirmed by RAN1 - scalingFactor0dot75 ENUMERATED {supported} OPTIONAL, --- R1 2-14: Codebook based PUSCH MIMO transmission. Absence of this field implies that CB-based PUSCH is not supported. - maxNumberMIMO-LayersCB-PUSCH MIMO-LayersUL OPTIONAL, --- R1 2-15: Non-codebook based PUSCH MIMO transmission. Absence of this field implies that Non-CB-based PUSCH is not supported. - maxNumberMIMO-LayersNonCB-PUSCH MIMO-LayersUL OPTIONAL, --- Accoding to the RAN4 LS R4-1803563, modulation order is added per CC granularity in BPC --- FFS whether all of modulation order specified in the spec need to be signalled. --- FFS how to address the requirements agreed by RAN4, e.g. mandaotry w/o capabiltiy for 64QAM. mandaotry with capabiltiy for DL 256QAM in FR1. - supportedModulationOrderUL ModulationOrder OPTIONAL, --- R1 2-53: SRS resources - supportedSRS-Resources SRS-Resources OPTIONAL, --- R1 2-55: SRS Tx switch - srs-TxSwitch SRS-TxSwitch OPTIONAL, --- R1 2-57: Support low latency CSI feedback - lowLatencyCSI-Feedback ENUMERATED {supported} OPTIONAL, --- R1 5-12 & 5-12a: Up to 2/7 PUSCHs per slot for different TBs - pusch-DifferentTB-PerSlot SEQUENCE { - scs-15kHz ENUMERATED {upto2, upto7} OPTIONAL, - scs-30kHz ENUMERATED {upto2, upto7} OPTIONAL, - scs-60kHz ENUMERATED {upto2, upto7} OPTIONAL, - scs-120kHz ENUMERATED {upto2, upto7} OPTIONAL - } OPTIONAL, --- R1 6-7: Two PUCCH group - twoPUCCH-Group ENUMERATED {supported} OPTIONAL, --- R1 6-8: Different numerology across PUCCH groups - diffNumerologyAcrossPUCCH-Group ENUMERATED {supported} OPTIONAL, --- R1 6-9: Different numerologies across carriers within the same PUCCH group - diffNumerologyWithinPUCCH-Group ENUMERATED {supported} OPTIONAL, --- R1 6-10: Cross carrier scheduling - crossCarrierScheduling ENUMERATED {supported} OPTIONAL, --- R1 6-11: Number of supported TAGs - supportedNumberTAG ENUMERATED {n2, n3, n4} OPTIONAL, --- R1 6-18: Supplemental uplink with dynamic switch - dynamicSwitchSUL ENUMERATED {supported} OPTIONAL, --- R1 6-19: Simultaneous transmission of SRS on an SUL/non-SUL carrier and PUSCH/PUCCH/SRS/PRACH on the other UL carrier in the same cell --- Details on the channel/signal combination are to be described in TS 38.306 - simultaneousTxSUL-NonSUL ENUMERATED {supported} OPTIONAL, --- R1 6-22: UL search space sharing for CA - searchSpaceSharingCA-UL ENUMERATED {supported} OPTIONAL -} - --- TAG-BASEBANDCOMBINATIONPARAMETERSULLIST-STOP --- TAG-BASEBANDPROCESSINGCOMBINATIONMRDC-START - -BasebandProcessingCombinationMRDC ::= SEQUENCE (SIZE (1..maxBasebandProcComb)) OF BasebandProcessingCombinationLink - -BasebandProcessingCombinationLink ::= SEQUENCE { - basebandProcessingCombinationIndexMN BasebandProcessingCombinationIndex, - basebandProcessingCombinationLinkedIndexSN SEQUENCE (SIZE (1..maxBasebandProcComb)) OF BasebandProcessingCombinationIndex -} - -BasebandProcessingCombinationIndex ::= INTEGER (1..maxBasebandProcComb) - --- TAG-BASEBANDPROCESSINGCOMBINATIONMRDC-STOP --- TAG-CA-BANDWIDTHCLASSNR-START - --- Updated based on R4-1803374 -CA-BandwidthClassNR ::= ENUMERATED {a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, ...} - --- TAG-CA-BANDWIDTHCLASSNR-STOP --- TAG-CA-BANDWIDTHCLASSEUTRA-START - -CA-BandwidthClassEUTRA ::= ENUMERATED {a, b, c, d, e, f, ...} - --- TAG-CA-BANDWIDTHCLASSEUTRA-STOP --- TAG-FREQ-BAND-INDICATOR-EUTRA-START - -FreqBandIndicatorEUTRA ::= INTEGER (1..maxBandsEUTRA) - --- TAG-FREQ-BAND-INDICATOR-EUTRA-STOP --- TAG-FREQBANDLIST-START - -FreqBandList ::= SEQUENCE (SIZE (1..maxBandsMRDC)) OF FreqBandInformation - -FreqBandInformation ::= CHOICE { - bandEUTRA FreqBandIndicatorEUTRA, - bandNR FreqBandIndicatorNR -} - --- TAG-FREQBANDLIST-STOP --- TAG-FREQSEPARATIONCLASS-START - -FreqSeparationClass ::= ENUMERATED {c1, c2, c3, ...} - --- TAG-FREQSEPARATIONCLASS-STOP --- TAG-MIMO-LAYERS-START - -MIMO-LayersDL ::= ENUMERATED {twoLayers, fourLayers, eightLayers} - -MIMO-LayersUL ::= ENUMERATED {oneLayer, twoLayers, fourLayers} - --- TAG-MIMO-LAYERS-STOP --- TAG-MODULATION-ORDER-START - -ModulationOrder ::= ENUMERATED {bpsk-halfpi, bpsk, qpsk, qam16, qam64, qam256} - --- TAG-MODULATION-ORDER-STOP --- TAG-RAT-TYPE-START - -RAT-Type ::= ENUMERATED {nr, eutra-nr, spare2, spare1, ...} - --- TAG-RAT-TYPE-STOP --- TAG-SUPPORTEDBASEBANDPROCESSINGCOMBINATION-START - -SupportedBasebandProcessingCombination ::= SEQUENCE (SIZE (1..maxBasebandProcComb)) OF BasebandProcessingCombination - -BasebandProcessingCombination ::= SEQUENCE { - basebandParametersDL SEQUENCE (SIZE (1..maxSimultaneousBands)) OF BasebandParametersPerBandDL, - basebandParametersUL BIT STRING (SIZE (1..maxBasebandProcComb))} - -BasebandParametersPerBandDL ::= SEQUENCE { - ca-BandwidthClassDL CA-BandwidthClassNR, - freqRange ENUMERATED {fr1, fr2}, - basebandParametersPerCC-DL SEQUENCE (SIZE (1.. maxNrofServingCells)) OF BasebandParametersPerCC-DL -} - -BasebandParametersPerCC-DL ::= SEQUENCE { --- R4 2-2: Simultaneous reception or transmission with same or different numerologies in CA --- It is expressed by the combination of SCS whether simultaneous RxTx is supported or not. - supportedSubcarrierSpacingDL SubcarrierSpacing, --- Accoding to the RAN4 LS R4-1803563, maximum Bandwidth supported per CC is added in BPC --- FFS how to work together with BCS and max BW for each CC to be defined for each CA band combination in the RAN4 spec. - supportedBandwidthDL CHOICE { - fr1 ENUMERATED {mhz5, mhz10, mhz15, mhz20, mhz25, mhz30, mhz40, mhz50, mhz60, mhz80, mhz100}, - fr2 ENUMERATED {mhz50, mhz100, mhz200, mhz400} - }, --- R2-1800012. To be confirmed by RAN1 - scalingFactor0dot75 ENUMERATED {supported} OPTIONAL, --- R1 2-2: PDSCH beam switching - timeDurationForQCL SEQUENCE { - scs-60kHz ENUMERATED {s7, s14, s28} OPTIONAL, - sch-120kHz ENUMERATED {s14, s28} OPTIONAL - } OPTIONAL, --- R1 1-10: Support of SCell without SS/PBCH block - scellWithoutSSB ENUMERATED {supported} OPTIONAL, --- R1 1-11: Support of CSI-RS RRM measurement for SCell without SS/PBCH block - csi-RS-MeasSCellWithoutSSB ENUMERATED {supported} OPTIONAL, --- R1 2-3: PDSCH MIMO layers. Absence of this field implies support of one layer. - maxNumberMIMO-LayersPDSCH MIMO-LayersDL OPTIONAL, --- Accoding to the RAN4 LS R4-1803563, modulation order is added per CC granularity in BPC --- FFS whether all of modulation order specified in the spec need to be signalled. --- FFS how to address the requirements agreed by RAN4, e.g. mandaotry w/o capabiltiy for 64QAM. mandaotry with capabiltiy for DL 256QAM in FR1. - supportedModulationOrderDL ModulationOrder OPTIONAL, --- R1 2-15a: Association between CSI-RS and SRS - srs-AssocCSI-RS ENUMERATED {supported} OPTIONAL, --- R1 3-1a: For type 1 CSS with dedicated RRC configuration and for type 3 CSS, UE specific SS, CORESET resource allocation of 6RB bit-map and duration 3 OFDM symbols for FR2 - type1-3-CSS ENUMERATED {supported} OPTIONAL, --- R1 3-5 & 3-5a: For type 1 with dedicated RRC configuration, type 3, and UE-SS,, monitoring occasion can be any OFDM symbol(s) of a slot for Case 2 (with a DCI gap) - pdcchMonitoringAnyOccasions ENUMERATED {withoutDCI-gap, withDCI-gap} OPTIONAL, --- R1 5-1a: UE specific RRC configure UL/DL assignment - ue-SpecificUL-DL-Assignment ENUMERATED {supported} OPTIONAL, --- R1 5-11 & 5-11a: Up to 2/7 unicast PDSCHs per slot for different TBs - pdsch-DifferentTB-PerSlot SEQUENCE { - scs-15kHz ENUMERATED {upto2, upto7} OPTIONAL, - scs-30kHz ENUMERATED {upto2, upto7} OPTIONAL, - scs-60kHz ENUMERATED {upto2, upto7} OPTIONAL, - scs-120kHz ENUMERATED {upto2, upto7} OPTIONAL - } OPTIONAL, --- R1 6-10: Cross carrier scheduling - crossCarrierScheduling ENUMERATED {supported} OPTIONAL, --- R1 6-21: DL search space sharing for CA - searchSpaceSharingCA-DL ENUMERATED {supported} OPTIONAL -} - --- TAG-SUPPORTEDBASEBANDPROCESSINGCOMBINATION-STOP --- TAG-UE-CAPABILITY-RAT-CONTAINER-LIST-START - -UE-CapabilityRAT-ContainerList ::=SEQUENCE (SIZE (0.. maxRAT-CapabilityContainers)) OF UE-CapabilityRAT-Container - -UE-CapabilityRAT-Container ::= SEQUENCE { - rat-Type RAT-Type, - ue-CapabilityRAT-Container OCTET STRING -} - --- TAG-UE-CAPABILITY-RAT-CONTAINER-LIST-STOP --- TAG-UE-MRDC-CAPABILITY-START - -UE-MRDC-Capability ::= SEQUENCE { - measParametersMRDC MeasParametersMRDC OPTIONAL, - rf-ParametersMRDC RF-ParametersMRDC, - phy-ParametersMRDC Phy-ParametersMRDC OPTIONAL, - generalParametersMRDC GeneralParametersMRDC-XDD-Diff OPTIONAL, - fdd-Add-UE-MRDC-Capabilities UE-MRDC-CapabilityAddXDD-Mode OPTIONAL, - tdd-Add-UE-MRDC-Capabilities UE-MRDC-CapabilityAddXDD-Mode OPTIONAL, - fr1-Add-UE-MRDC-Capabilities UE-MRDC-CapabilityAddFRX-Mode OPTIONAL, - fr2-Add-UE-MRDC-Capabilities UE-MRDC-CapabilityAddFRX-Mode OPTIONAL, - lateNonCriticalExtension OCTET STRING OPTIONAL, - nonCriticalExtension SEQUENCE {} OPTIONAL -} - -UE-MRDC-CapabilityAddXDD-Mode ::= SEQUENCE { - phy-ParametersMRDC-XDD-Diff Phy-ParametersMRDC-XDD-Diff OPTIONAL, - measParametersMRDC-XDD-Diff MeasParametersMRDC-XDD-Diff OPTIONAL, - generalParametersMRDC-XDD-Diff GeneralParametersMRDC-XDD-Diff OPTIONAL -} - -UE-MRDC-CapabilityAddFRX-Mode ::= SEQUENCE { - phy-ParametersMRDC-FRX-Diff Phy-ParametersMRDC-FRX-Diff OPTIONAL, - measParametersMRDC-FRX-Diff MeasParametersMRDC-FRX-Diff -} - -RF-ParametersMRDC ::= SEQUENCE { - supportedBandCombination BandCombinationList, - bandCombinationParametersUL-List BandCombinationParametersUL-List -} - -Phy-ParametersMRDC ::= SEQUENCE { - phy-ParametersMRDC-XDD-Diff Phy-ParametersMRDC-XDD-Diff OPTIONAL, - phy-ParametersMRDC-FRX-Diff Phy-ParametersMRDC-FRX-Diff OPTIONAL -} - -Phy-ParametersMRDC-XDD-Diff ::= SEQUENCE { --- R1 8-1: Dynamic power sharing for LTE-NR DC - dynamicPowerSharing ENUMERATED {supported} OPTIONAL, --- R1 6-13 & 8-2: Case 1 Single Tx UL LTE-NR DC - tdm-Pattern ENUMERATED {supported} OPTIONAL -} -Phy-ParametersMRDC-FRX-Diff ::= SEQUENCE { --- R1 8-1: Dynamic power sharing for LTE-NR DC - dynamicPowerSharing ENUMERATED {supported} OPTIONAL, --- R1 6-13 & 8-2: Case 1 Single Tx UL LTE-NR DC - tdm-Pattern ENUMERATED {supported} OPTIONAL -} - -MeasParametersMRDC ::= SEQUENCE { - measParametersMRDC-Common MeasParametersMRDC-Common, - measParametersMRDC-XDD-Diff MeasParametersMRDC-XDD-Diff OPTIONAL, - measParametersMRDC-FRX-Diff MeasParametersMRDC-FRX-Diff -} - -MeasParametersMRDC-Common ::= SEQUENCE { --- R4 3-1: Independent measurement gap configurations for FR1 and FR2 - independentGapConfig ENUMERATED {supported} OPTIONAL -} - -MeasParametersMRDC-XDD-Diff ::= SEQUENCE { - sftd-MeasPSCell ENUMERATED {supported} OPTIONAL, - sftd-MeasNR-Cell ENUMERATED {supported} OPTIONAL -} - -MeasParametersMRDC-FRX-Diff ::= SEQUENCE { --- R4 3-2: Simultaneous reception of data and SS block with different numerologies when UE conducts the serving cell measurement or intra-frequency measurement - simultaneousRxDataSSB-DiffNumerology ENUMERATED {supported} OPTIONAL -} - -GeneralParametersMRDC-XDD-Diff ::= SEQUENCE { - splitSRB-WithOneUL-Path ENUMERATED {supported} OPTIONAL, - splitDRB-withUL-Both-MCG-SCG ENUMERATED {supported} OPTIONAL, - srb3 ENUMERATED {supported} OPTIONAL -} - --- TAG-UE-MRDC-CAPABILITY-STOP --- TAG-UE-NR-CAPABILITY-START - -UE-NR-Capability ::= SEQUENCE { - pdcp-Parameters PDCP-Parameters, - rlc-Parameters RLC-Parameters OPTIONAL, - mac-Parameters MAC-Parameters OPTIONAL, - phy-Parameters Phy-Parameters, - rf-Parameters RF-Parameters, - measParameters MeasParameters OPTIONAL, - fdd-Add-UE-NR-Capabilities UE-NR-CapabilityAddXDD-Mode OPTIONAL, - tdd-Add-UE-NR-Capabilities UE-NR-CapabilityAddXDD-Mode OPTIONAL, - fr1-Add-UE-NR-Capabilities UE-NR-CapabilityAddFRX-Mode OPTIONAL, - fr2-Add-UE-NR-Capabilities UE-NR-CapabilityAddFRX-Mode OPTIONAL, - lateNonCriticalExtension OCTET STRING OPTIONAL, - nonCriticalExtension SEQUENCE {} OPTIONAL -} - -UE-NR-CapabilityAddXDD-Mode ::= SEQUENCE { - phy-ParametersXDD-Diff Phy-ParametersXDD-Diff OPTIONAL, - mac-ParametersXDD-Diff MAC-ParametersXDD-Diff OPTIONAL, - measParametersXDD-Diff MeasParametersXDD-Diff OPTIONAL -} - -UE-NR-CapabilityAddFRX-Mode ::= SEQUENCE { - phy-ParametersFRX-Diff Phy-ParametersFRX-Diff OPTIONAL, - measParametersFRX-Diff MeasParametersFRX-Diff OPTIONAL -} - -Phy-Parameters ::= SEQUENCE { - phy-ParametersCommon Phy-ParametersCommon OPTIONAL, - phy-ParametersXDD-Diff Phy-ParametersXDD-Diff OPTIONAL, - phy-ParametersFRX-Diff Phy-ParametersFRX-Diff OPTIONAL, - phy-ParametersFR1 Phy-ParametersFR1 OPTIONAL, - phy-ParametersFR2 Phy-ParametersFR2 OPTIONAL, - supportedBasebandProcessingCombination SupportedBasebandProcessingCombination, - basebandCombinationParametersUL-List BasebandCombinationParametersUL-List -} - -Phy-ParametersCommon ::= SEQUENCE { --- R1 1-9: CSI-RS based CFRA for HO - csi-RS-CFRA-ForHO ENUMERATED {supported} OPTIONAL, --- R1 2-11: Downlink dynamic PRB bundling (DL) - dynamicPRB-BundlingDL ENUMERATED {supported} OPTIONAL, --- R1 2-32a: Semi-persistent CSI report on PUCCH - sp-CSI-ReportPUCCH ENUMERATED {supported} OPTIONAL, --- R1 2-32b: Semi-persistent CSI report on PUSCH - sp-CSI-ReportPUSCH ENUMERATED {supported} OPTIONAL, --- R1 2-34: NZP-CSI-RS based interference measurement - nzp-CSI-RS-IntefMgmt ENUMERATED {supported} OPTIONAL, --- R1 2-42: Support Type II SP-CSI feedback on long PUCCH - type2-SP-CSI-Feedback-LongPUCCH ENUMERATED {supported} OPTIONAL, --- R1 3-3: More than one CORESET per BWP (in addition to CORESET #0) - multipleCORESET ENUMERATED {supported} OPTIONAL, --- R1 3-6: Dynamic SFI monitoring and dynamic UL/DL determination - dynamicSFI ENUMERATED {supported} OPTIONAL, --- R1 3-7: Precoder-granularity of CORESET size - precoderGranularityCORESET ENUMERATED {supported} OPTIONAL, --- R1 4-10: Dynamic HARQ-ACK codebook - dynamicHARQ-ACK-Codebook ENUMERATED {supported} OPTIONAL, --- R1 4-11: Semi-static HARQ-ACK codebook - semiStaticHARQ-ACK-Codebook ENUMERATED {supported} OPTIONAL, --- R1 4-12: HARQ-ACK spatial bundling for PUCCH or PUSCH per PUCCH group - spatialBundlingHARQ-ACK ENUMERATED {supported} OPTIONAL, --- R1 4-21: Dynamic beta-offset configuration and indication for HARQ-ACK and/or CSI - dynamicBetaOffsetInd-HARQ-ACK-CSI ENUMERATED {supported} OPTIONAL, --- R1 4-23: Repetitions for PUCCH format 1, 3,and 4 over multiple slots with K = 1, 2, 4, 8 - pucch-Repetition-F1-3-4 ENUMERATED {supported} OPTIONAL, --- R1 5-2: RA type 0 for PUSCH - ra-Type0-PUSCH ENUMERATED {supported} OPTIONAL, --- R1 5-3: Dynamic switching between RA type 0 and RA type 1 for PDSCH - dynamicSwitchRA-Type0-1-PDSCH ENUMERATED {supported} OPTIONAL, --- R1 5-4: Dynamic switching between RA type 0 andRA type 1 for PUSCH - dynamicSwitchRA-Type0-1-PUSCH ENUMERATED {supported} OPTIONAL, --- R1 5-6: PDSCH mapping type A with less than 7 OFDM symbols - pdsch-MappingTypeA ENUMERATED {supported} OPTIONAL, --- R1 5-6a: PDSCH mapping type B - pdsch-MappingTypeB ENUMERATED {supported} OPTIONAL, --- R1 5-7: Interleaving for VRB-to-PRB mapping for PDSCH - interleavingVRB-ToPRB-PDSCH ENUMERATED {supported} OPTIONAL, --- R1 5-8: Interleaving for VRB-to-PRB mapping for PUSCH - interleavingVRB-ToPRB-PUSCH ENUMERATED {supported} OPTIONAL, --- R1 5-10: Inter-slot frequency hopping for PUSCH - interSlotFreqHopping-PUSCH ENUMERATED {supported} OPTIONAL, --- R1 5-13: Type 1 configured PUSCH repetitions within a slot - type1-PUSCH-RepetitionOneSlot ENUMERATED {supported} OPTIONAL, --- R1 5-14: Type 1 configured PUSCH repetitions over multiple slots - type1-PUSCH-RepetitionMultiSlots ENUMERATED {supported} OPTIONAL, --- R1 5-15: Type 2 configured PUSCH repetitions within a slot - type2-PUSCH-RepetitionOneSlot ENUMERATED {supported} OPTIONAL, --- R1 5-16: Type 2 configured PUSCH repetitions over multiple slots - type2-PUSCH-RepetitionMultiSlots ENUMERATED {supported} OPTIONAL, --- R1 5-17: PUSCH repetitions over multiple slots - pusch-RepetitionMultiSlots ENUMERATED {supported} OPTIONAL, --- R1 5-17a: PDSCH repetitions over multiple slots - pdsch-RepetitionMultiSlots ENUMERATED {supported} OPTIONAL, --- R1 5-18: DL SPS - downlinkSPS ENUMERATED {supported} OPTIONAL, --- R1 5-19: Type 1 Configured UL grant - configuredUL-GrantType1 ENUMERATED {supported} OPTIONAL, --- R1 5-20: Type 2 Configured UL grant - configuredUL-GrantType2 ENUMERATED {supported} OPTIONAL, --- R1 5-21: Pre-emption indication for DL - pre-EmptIndication-DL ENUMERATED {supported} OPTIONAL, --- R1 5-22 & 5-25: CBG-based re-transmission for DL/UL using CBGTI - cbg-TransIndication BIT STRING (SIZE (2)) OPTIONAL, --- R1 5-23: CBGFI for CBG-based re-transmission for DL - cbg-FlushIndication-DL ENUMERATED {supported} OPTIONAL, --- R1 5-24: Dynamic HARQ-ACK codebook using sub-codebooks for CBG-based re-transmission for DL - dynamicHARQ-ACK-CodeB-CBG-Retx-DL ENUMERATED {supported} OPTIONAL, --- R1 5-26: Semi-static rate-matching resource set configuration for DL - rateMatchingResrcSetSemi-Static ENUMERATED {supported} OPTIONAL, --- R1 5-27: Dynamic rate-matching resource set configuration for DL - rateMatchingResrcSetDynamic ENUMERATED {supported} OPTIONAL, --- R1 5-28: Rate-matching around LTE CRS - rateMatchingLTE-CRS ENUMERATED {supported} OPTIONAL, --- R4 1-8: BWP switching delay - bwp-SwitchingDelay ENUMERATED {type1, type2} OPTIONAL -} - -Phy-ParametersXDD-Diff ::= SEQUENCE { --- R1 4-2: 2 PUCCH of format 0 or 2 in consecutive symbols - twoPUCCH-F0-2-ConsecSymbols ENUMERATED {supported} OPTIONAL, --- R1 8-7: UL power control with 2 PUSCH closed loops - twoDifferentTPC-Loop-PUSCH ENUMERATED {supported} OPTIONAL, --- R1 8-8: UL power control with 2 PUCCH closed loops - twoDifferentTPC-Loop-PUCCH ENUMERATED {supported} OPTIONAL -} - -Phy-ParametersFRX-Diff ::= SEQUENCE { --- R1 2-6 & 2-16b: Support 1+2 DMRS (DL/UL) - oneFL-DMRS-TwoAdditionalDMRS BIT STRING (SIZE (2)) OPTIONAL, --- R1 2-7 & 2-18: Supported 2 symbols front-loaded DMRS(DL/UL) - twoFL-DMRS BIT STRING (SIZE (2)) OPTIONAL, --- R1 2-8 & 2-18a: Supported 2 symbols front-loaded +2 symbols additional DMRS(DL/UL) - twoFL-DMRS-TwoAdditionalDMRS BIT STRING (SIZE (2)) OPTIONAL, --- R1 2-9 & 2-19: Support 1+3 DMRS (DL/UL) - oneFL-DMRS-ThreeAdditionalDMRS BIT STRING (SIZE (2)) OPTIONAL, --- R1 2-10: Support DMRS type (DL) - supportedDMRS-TypeDL ENUMERATED {type1, type2} OPTIONAL, --- R1 2-17: Support DMRS type (UL) - supportedDMRS-TypeUL ENUMERATED {type1, type2} OPTIONAL, --- R1 2-37: Support Semi-open loop CSI - semiOpenLoopCSI ENUMERATED {supported} OPTIONAL, --- R1 2-38: CSI report without PMI - csi-ReportWithoutPMI ENUMERATED {supported} OPTIONAL, --- R1 2-39: CSI report with CRI - csi-ReportWithCRI ENUMERATED {supported} OPTIONAL, --- R1 2-39a: CSI report without CQI - csi-ReportWithoutCQI ENUMERATED {supported} OPTIONAL, --- R1 2-44 & 2-47: 1 port of DL/UL PTRS - onePortsPTRS BIT STRING (SIZE (2)) OPTIONAL, --- R1 4-2: 2 PUCCH of format 0 or 2 in consecutive symbols - twoPUCCH-F0-2-ConsecSymbols ENUMERATED {supported} OPTIONAL, --- R1 4-3: PUCCH format 2 over 1 – 2 OFDM symbols once per slot with FH - pucch-F2-WithFH ENUMERATED {supported} OPTIONAL, --- R1 4-4: PUCCH format 3 over 4 – 14 OFDM symbols once per slot with FH - pucch-F3-WithFH ENUMERATED {supported} OPTIONAL, --- R1 4-5: PUCCH format 4 over 4 – 14 OFDM symbols once per slot with FH - pucch-F4-WithFH ENUMERATED {supported} OPTIONAL, --- R1 4-6: Non-frequency hopping for PUCCH formats 0 and 2 - freqHoppingPUCCH-F0-2 ENUMERATED {notSupported} OPTIONAL, --- R1 4-7: Non-frequency hopping for PUCCH format 1, 3, and 4 - freqHoppingPUCCH-F1-3-4 ENUMERATED {notSupported} OPTIONAL, --- R1 4-19: SR/HARQ-ACK/CSI multiplexing once per slot using a PUCCH (or piggybacked on a PUSCH) - mux-SR-HARQ-ACK-CSI-PUCCH ENUMERATED {supported} OPTIONAL, --- R1 4-20: UCI code-block segmentation - uci-CodeBlockSegmentation ENUMERATED {supported} OPTIONAL, --- R1 4-22: 1 long PUCCH format and 1 short PUCCH format in the same slot - onePUCCH-LongAndShortFormat ENUMERATED {supported} OPTIONAL, --- R1 4-22a: 2 PUCCH transmissions in the same slot which are not covered by 4-22 and 4-2 - twoPUCCH-AnyOthersInSlot ENUMERATED {supported} OPTIONAL, --- R1 5-9: Intra-slot frequency-hopping for PUSCH except for PUSCH scheduled by Type 1 before RRC connection - intraSlotFreqHopping-PUSCH ENUMERATED {supported} OPTIONAL, --- R1 5-29: LBRM for PUSCH - pusch-LBRM ENUMERATED {supported} OPTIONAL, --- R1 6-5a: PDCCH blind detection capability for CA - pdcch-BlindDetectionCA ENUMERATED {supported} OPTIONAL, --- R1 8-3: TPC-PUSCH-RNTI - tpc-PUSCH-RNTI ENUMERATED {supported} OPTIONAL, --- R1 8-4: TPC-PUCCH-RNTI - tpc-PUCCH-RNTI ENUMERATED {supported} OPTIONAL, --- R1 8-5: TPC-SRS-RNTI - tpc-SRS-RNTI ENUMERATED {supported} OPTIONAL, --- R1 8-6: Absolute TPC command mode - absoluteTPC-Command ENUMERATED {supported} OPTIONAL, --- R1 8-7: UL power control with 2 PUSCH closed loops - twoDifferentTPC-Loop-PUSCH ENUMERATED {supported} OPTIONAL, --- R1 8-8: UL power control with 2 PUCCH closed loops - twoDifferentTPC-Loop-PUCCH ENUMERATED {supported} OPTIONAL, --- R4 1-6: pi/2-BPSK for PUSCH - pusch-HalfPi-BPSK ENUMERATED {supported} OPTIONAL, --- R4 1-7: pi/2-BPSK for PUCCH format 3/4 - pucch-F3-4-HalfPi-BPSK ENUMERATED {supported} OPTIONAL, --- R4 1-9: 1-symbol GP in unpaired spectrum - oneSymbolGP-TDD ENUMERATED {supported} OPTIONAL, --- R4 2-7: Almost contiguous UL CP-OFDM - almostContiguousCP-OFDM-UL ENUMERATED {supported} OPTIONAL -} - -Phy-ParametersFR1 ::= SEQUENCE { --- R1 3-2: Unicast PDCCH monitoring following Case 1-2 - pdcchMonitoringSingleOccasion ENUMERATED {supported} OPTIONAL, --- R4 1-1: 60kHz of subcarrier spacing for FR1 - scs-60kHz ENUMERATED {supported} OPTIONAL, --- R4 1-4: 256QAM for PDSCH in FR1 - pdsch-256QAM-FR1 ENUMERATED {supported} OPTIONAL -} - -Phy-ParametersFR2 ::= SEQUENCE { --- R4 2-8: PA calibration gap - calibrationGapPA ENUMERATED {supported} OPTIONAL -} - -RF-Parameters ::= SEQUENCE { - supportedBandListNR SupportedBandListNR, - supportedBandCombination BandCombinationList, - bandCombinationParametersUL-List BandCombinationParametersUL-List -} - -SupportedBandListNR ::= SEQUENCE (SIZE (1..maxBands)) OF BandNR - -BandNR ::= SEQUENCE { - bandNR FreqBandIndicatorNR, --- Modified MPR behaviour as in RAN4 LS R2-1804077, which is needed for NSA as well as SA - modifiedMPR-Behaviour BIT STRING (SIZE (8)) OPTIONAL, --- R4 2-1: Maximum channel bandwidth supported in each band for DL and UL separately and for each SCS that UE supports within a single CC --- RAN4 agreed that 400 MHz is optional for FR2. The other values defined for FR1/fR2 in TS 38.101 are mandatory w/o capability bit. - maxChannelBW-PerCC ENUMERATED {mhz400} OPTIONAL, - mimo-ParametersPerBand MIMO-ParametersPerBand OPTIONAL, --- R1 0-10: Extended CP - extendedCP ENUMERATED {supported} OPTIONAL, --- R1 0-13: Phase coherence across non-contiguous UL symbols in slot in the transmission of one channel - phaseCoherenceUL ENUMERATED {supported} OPTIONAL, --- R1 1-10: Support of SCell without SS/PBCH block - scellWithoutSSB ENUMERATED {supported} OPTIONAL, --- R1 1-11: Support of CSI-RS RRM measurement for SCell without SS/PBCH block - csi-RS-MeasSCellWithoutSSB ENUMERATED {supported} OPTIONAL, --- R1 2-15a: Association between CSI-RS and SRS - srs-AssocCSI-RS ENUMERATED {supported} OPTIONAL, --- R1 3-1a: For type 1 CSS with dedicated RRC configuration and for type 3 CSS, UE specific SS, CORESET resource allocation of 6RB bit-map and duration 3 OFDM symbols for FR2 - type1-3-CSS ENUMERATED {supported} OPTIONAL, --- R1 3-4: More than one TCI state configurations per CORESET - multipleTCI ENUMERATED {supported} OPTIONAL, --- R1 3-5 & 3-5a: For type 1 with dedicated RRC configuration, type 3, and UE-SS,, monitoring occasion can be any OFDM symbol(s) of a slot for Case 2 (with a DCI gap) - pdcchMonitoringAnyOccasions ENUMERATED {withoutDCI-gap, withDCI-gap} OPTIONAL, --- R1 5-1a: UE specific RRC configure UL/DL assignment - ue-SpecificUL-DL-Assignment ENUMERATED {supported} OPTIONAL, --- R1 5-11 & 5-11a: Up to 2/7 unicast PDSCHs per slot for different TBs - pdsch-DifferentTB-PerSlot SEQUENCE { - scs-15kHz ENUMERATED {upto2, upto7} OPTIONAL, - scs-30kHz ENUMERATED {upto2, upto7} OPTIONAL, - scs-60kHz ENUMERATED {upto2, upto7} OPTIONAL, - scs-120kHz ENUMERATED {upto2, upto7} OPTIONAL - } OPTIONAL, --- R1 5-12 & 5-12a: Up to 2/7 PUSCHs per slot for different TBs - pusch-DifferentTB-PerSlot SEQUENCE { - scs-15kHz ENUMERATED {upto2, upto7} OPTIONAL, - scs-30kHz ENUMERATED {upto2, upto7} OPTIONAL, - scs-60kHz ENUMERATED {upto2, upto7} OPTIONAL, - scs-120kHz ENUMERATED {upto2, upto7} OPTIONAL - } OPTIONAL, --- R1 6-2 & 6-3: Type A/B BWP adaptation (up to 2/4 BWPs) with same numerology - bwp-SameNumerology ENUMERATED {upto2, upto4} OPTIONAL, --- R1 6-4: BWP adaptation (up to 4 BWPs) with different numerologies - bwp-DiffNumerology ENUMERATED {upto4} OPTIONAL, --- R1 6-7: Two PUCCH group - twoPUCCH-Group ENUMERATED {supported} OPTIONAL, --- R1 6-8: Different numerology across PUCCH groups - diffNumerologyAcrossPUCCH-Group ENUMERATED {supported} OPTIONAL, --- R1 6-9: Different numerologies across carriers within the same PUCCH group - diffNumerologyWithinPUCCH-Group ENUMERATED {supported} OPTIONAL, --- R1 6-10: Cross carrier scheduling - crossCarrierScheduling ENUMERATED {supported} OPTIONAL, --- R1 6-11: Number of supported TAGs - supportedNumberTAG ENUMERATED {n2, n3, n4} OPTIONAL, --- R1 6-19: Simultaneous transmission of SRS on an SUL/non-SUL carrier and PUSCH/PUCCH/SRS/PRACH on the other UL carrier in the same cell --- Details on the channel/signal combination are to be described in TS 38.306 - simultaneousTxSUL-NonSUL ENUMERATED {supported} OPTIONAL, --- R1 6-21: DL search space sharing for CA - searchSpaceSharingCA-DL ENUMERATED {supported} OPTIONAL, --- R1 6-22: UL search space sharing for CA - searchSpaceSharingCA-UL ENUMERATED {supported} OPTIONAL, --- R4 1-4: 256QAM for PDSCH in FR2 - pdsch-256QAM-FR2 ENUMERATED {supported} OPTIONAL, --- R4 1-5: 256QAM for PUSCH - pusch-256QAM ENUMERATED {supported} OPTIONAL -} - -MIMO-ParametersPerBand ::= SEQUENCE { --- R1 2-2: PDSCH beam switching - timeDurationForQCL SEQUENCE { - scs-60kHz ENUMERATED {s7, s14, s28} OPTIONAL, - sch-120kHz ENUMERATED {s14, s28} OPTIONAL - } OPTIONAL, --- R1 2-3: PDSCH MIMO layers. Absence of this field implies support of one layer. - maxNumberMIMO-LayersPDSCH MIMO-LayersDL OPTIONAL, --- R1 2-14: Codebook based PUSCH MIMO transmission. Absence of this field implies that CB-based PUSCH is not supported. - maxNumberMIMO-LayersCB-PUSCH MIMO-LayersUL OPTIONAL, --- R1 2-15: Non-codebook based PUSCH MIMO transmission. Absence of this field implies that Non-CB-based PUSCH is not supported. - maxNumberMIMO-LayersNonCB-PUSCH MIMO-LayersUL OPTIONAL, --- R1 2-4: TCI states for PDSCH - maxNumberConfiguredTCIstates ENUMERATED {n4, n8, n16, n32, n64} OPTIONAL, - maxNumberActiveTCI-PerCC ENUMERATED {n1, n2, n4, n8} OPTIONAL, --- R1 2-13: PUSCH transmission coherence - pusch-TransCoherence ENUMERATED {nonCoherent, partialNonCoherent, fullCoherent} OPTIONAL, --- R1 2-20: Beam correspondence - beamCorrespondence ENUMERATED {supported} OPTIONAL, --- R1 2-21: Periodic beam report on PUCCH - periodicBeamReport ENUMERATED {supported} OPTIONAL, --- R1 2-22: Aperiodic beam report on PUSCH - aperiodicBeamReport ENUMERATED {supported} OPTIONAL, --- R1 2-23: Semi-persistent beam report on PUCCH - sp-BeamReportPUCCH ENUMERATED {supported} OPTIONAL, --- R1 2-23a: Semi-persistent beam report on PUSCH - sp-BeamReportPUSCH ENUMERATED {supported} OPTIONAL, --- R1 2-24: SSB/CSI-RS for beam management - beamManagementSSB-CSI-RS BeamManagementSSB-CSI-RS OPTIONAL, --- R1 2-26: Receiving beam selection using CSI-RS resource repetition "ON" - maxNumberRxBeam INTEGER (2..8) OPTIONAL, --- R1 2-27: Beam switching (including SSB and CSI-RS) - maxNumberRxTxBeamSwitchDL SEQUENCE { - scs-15kHz ENUMERATED {n4, n7, n14} OPTIONAL, - scs-30kHz ENUMERATED {n4, n7, n14} OPTIONAL, - scs-60kHz ENUMERATED {n4, n7, n14} OPTIONAL, - scs-120kHz ENUMERATED {n4, n7, n14} OPTIONAL, - scs-240kHz ENUMERATED {n4, n7, n14} OPTIONAL - } OPTIONAL, --- R1 2-29: Non-group based beam reporting - maxNumberNonGroupBeamReporting ENUMERATED {n1, n2, n4} OPTIONAL, --- R1 2-29a: Group based beam reporting - groupBeamReporting ENUMERATED {supported} OPTIONAL, --- R1 2-30: UL beam management - uplinkBeamManagement SEQUENCE { - maxNumberSRS-ResourcePerSet ENUMERATED {n8, n16, n32}, - maxNumberSRS-ResourceSet INTEGER (1..8) - } OPTIONAL, --- R1 2-31: Beam failure recovery - maxNumberCSI-RS-BFR INTEGER (1..64) OPTIONAL, - maxNumberSSB-BFR INTEGER (1..64) OPTIONAL, - maxNumberCSI-RS-SSB-BFR INTEGER (1..256) OPTIONAL, --- R1 2-45 & 2-48: 2 ports of DL/UL PTRS - twoPortsPTRS BIT STRING (SIZE (2)) OPTIONAL, --- R1 2-53: SRS resources - supportedSRS-Resources SRS-Resources OPTIONAL, --- R1 2-55: SRS Tx switch - srs-TxSwitch SRS-TxSwitch OPTIONAL, --- R1 2-54a: Simultaneous SRS Tx - maxNumberSimultaneousSRS-PerCC INTEGER (1..4) OPTIONAL, --- R1 2-57: Support low latency CSI feedback - lowLatencyCSI-Feedback ENUMERATED {supported} OPTIONAL -} - --- R1 2-24: SSB/CSI-RS for beam management -BeamManagementSSB-CSI-RS ::= SEQUENCE { - maxNumberSSB-CSI-RS-ResourceOneTx ENUMERATED {n8, n16, n32, n64}, - maxNumberSSB-CSI-RS-ResourceTwoTx ENUMERATED {n0, n4, n8, n16, n32, n64}, - supportedCSI-RS-Density ENUMERATED {one, three, oneAndThree} -} - --- R1 2-53: SRS resources -SRS-Resources ::= SEQUENCE { - maxNumberAperiodicSRS-PerBWP ENUMERATED {n1, n2, n4, n8, n16}, - maxNumberAperiodicSRS-PerBWP-PerSlot INTEGER (1..6), - maxNumberPeriodicSRS-PerBWP ENUMERATED {n1, n2, n4, n8, n16}, - maxNumberPeriodicSRS-PerBWP-PerSlot INTEGER (1..6), - maxNumberSemiPersitentSRS-PerBWP ENUMERATED {n0, n1, n2, n4, n8, n16}, - maxNumberSP-SRS-PerBWP-PerSlot INTEGER (0..6), - maxNumberSRS-Ports-PerResource ENUMERATED {n1, n2, n4} -} --- R1 2-55: SRS Tx switch -SRS-TxSwitch ::= SEQUENCE { - supportedSRS-TxPortSwitch ENUMERATED {t1r2, t1r4, t2r4, t1r4-t2r4}, - txSwitchImpactToRx ENUMERATED {true} OPTIONAL -} - -PDCP-Parameters ::= SEQUENCE { - supportedROHC-Profiles SEQUENCE { - profile0x0000 BOOLEAN, - profile0x0001 BOOLEAN, - profile0x0002 BOOLEAN, - profile0x0003 BOOLEAN, - profile0x0004 BOOLEAN, - profile0x0006 BOOLEAN, - profile0x0101 BOOLEAN, - profile0x0102 BOOLEAN, - profile0x0103 BOOLEAN, - profile0x0104 BOOLEAN - }, - maxNumberROHC-ContextSessions ENUMERATED {cs2, cs4, cs8, cs12, cs16, cs24, cs32, cs48, cs64, cs128, cs256, cs512, cs1024, cs16384, spare2, spare1}, - uplinkOnlyROHC-Profiles ENUMERATED {supported} OPTIONAL, - continueROHC-Context ENUMERATED {supported} OPTIONAL, - outOfOrderDelivery ENUMERATED {supported} OPTIONAL, - shortSN ENUMERATED {supported} OPTIONAL -} - -RLC-Parameters ::= SEQUENCE { - am-WithShortSN ENUMERATED {supported} OPTIONAL, - um-WithShortSN ENUMERATED {supported} OPTIONAL, - um-WIthLongSN ENUMERATED {supported} OPTIONAL -} - -MAC-Parameters ::= SEQUENCE { - mac-ParametersCommon MAC-ParametersCommon OPTIONAL, - mac-ParametersXDD-Diff MAC-ParametersXDD-Diff OPTIONAL -} - -MAC-ParametersCommon ::= SEQUENCE { - lcp-Restriction ENUMERATED {supported} OPTIONAL, --- R1 4-24: PUCCH-spatialrelationinfo indication by a MAC CE per PUCCH resource - pucch-SpatialRelInfoMAC-CE ENUMERATED {supported} OPTIONAL -} - -MAC-ParametersXDD-Diff ::= SEQUENCE { - skipUplinkTxDynamic ENUMERATED {supported} OPTIONAL, - logicalChannelSR-DelayTimer ENUMERATED {supported} OPTIONAL, - longDRX-Cycle ENUMERATED {supported} OPTIONAL, - shortDRX-Cycle ENUMERATED {supported} OPTIONAL, - multipleSR-Configurations ENUMERATED {supported} OPTIONAL, - -- If supported UE supports 8 SR configurations, otherwise 1 SR config is supported. - -- Confirmation is needed whether to align the number to what the configuration signalling can support. - multipleConfiguredGrantConfigurations ENUMERATED {supported} OPTIONAL - -- If supported UE supports 16 configured grant configurations, otherwise 1 ConfiguredGrant config is supported. - -- Confirmation is needed whether to align the number to what the configuration signalling can support, and to consider whether the 16 refers - -- to the configurations or the active ones only (as they are within the BWP). -} - -MeasParameters ::= SEQUENCE { - measParametersXDD-Diff MeasParametersXDD-Diff OPTIONAL, - measParametersFRX-Diff MeasParametersFRX-Diff OPTIONAL -} - -MeasParametersXDD-Diff ::= SEQUENCE { - intraAndInterF-MeasAndReport ENUMERATED {supported} OPTIONAL, - eventA-MeasAndReport ENUMERATED {supported} OPTIONAL - -- Confirmation is needed on the need of capability/IOT signaling in LTE for support of the additional measurement gap configurations. -} - -MeasParametersFRX-Diff ::= SEQUENCE { --- R1 1-3: SSB based SINR measurement - ss-SINR-Meas ENUMERATED {supported} OPTIONAL, --- R1 1-5: CSI-RS based RRM measurement with associated SS-block - csi-RSRP-AndRSRQ-MeasWithSSB ENUMERATED {supported} OPTIONAL, --- R1 1-5a: CSI-RS based RRM measurement without associated SS-block - csi-RSRP-AndRSRQ-MeasWithoutSSB ENUMERATED {supported} OPTIONAL, --- R1 1-6: CSI-RS based SINR measurement - csi-SINR-Meas ENUMERATED {supported} OPTIONAL, --- R1 1-7: CSI-RS based RLM - csi-RS-RLM ENUMERATED {supported} OPTIONAL -} - --- TAG-UE-NR-CAPABILITY-STOP --- TAG-RRC-TRANSACTIONIDENTIFIER-START - -RRC-TransactionIdentifier ::= INTEGER (0..3) - --- TAG-RRC-TRANSACTIONIDENTIFIER-STOP --- TAG-MULTIPLICITY-AND-TYPE-CONSTRAINT-DEFINITIONS-START - -maxBandComb INTEGER ::= 65536 -- Maximum number of DL band combinations -maxBasebandProcComb INTEGER ::= 65536 -- Maximum number of baseband processing combinations -maxNrofServingCells INTEGER ::= 32 -- Max number of serving cells (SpCell + SCells) per cell group -maxNrofServingCells-1 INTEGER ::= 31 -- Max number of serving cells (SpCell + SCells) per cell group minus 1 -maxNrofAggregatedCellsPerCellGroup INTEGER ::= 16 -maxNrofSCells INTEGER ::= 31 -- Max number of secondary serving cells per cell group -maxNrofCellMeas INTEGER ::= 32 -- Maximum number of entries in each of the cell lists in a measurement object -maxNrofSS-BlocksToAverage INTEGER ::= 16 -- Max number for the (max) number of SS blocks to average to determine cell - -- measurement -maxNrofCSI-RS-ResourcesToAverage INTEGER ::= 16 -- Max number for the (max) number of CSI-RS to average to determine cell - -- measurement -maxNrofDL-Allocations INTEGER ::= 16 -- Maximum number of PDSCH time domain resource allocations - -maxNrofSR-ConfigPerCellGroup INTEGER ::= 8 -- Maximum number of SR configurations per cell group - -maxLCG-ID INTEGER ::= 7 -- Maximum value of LCG ID -maxLC-ID INTEGER ::= 32 -- Maximum value of Logical Channel ID -maxNrofTAGs INTEGER ::= 4 -- Maximum number of Timing Advance Groups -maxNrofTAGs-1 INTEGER ::= 3 -- Maximum number of Timing Advance Groups minus 1 - -maxNrofBWPs INTEGER ::= 4 -- Maximum number of BWPs per serving cell -maxNrofSymbols-1 INTEGER ::= 13 -- Maximum index identifying a symbol within a slot (14 symbols, indexed from 0..13) -maxNrofSlots INTEGER ::= 320 -- Maximum number of slots in a 10 ms period -maxNrofSlots-1 INTEGER ::= 319 -- Maximum number of slots in a 10 ms period minus 1 - -maxNrofPhysicalResourceBlocks INTEGER ::= 275 -- Maximum number of PRBs -maxNrofPhysicalResourceBlocks-1 INTEGER ::= 274 -- Maximum number of PRBs -maxNrofControlResourceSets INTEGER ::= 12 -- Max number of CoReSets configurable on a serving cell -maxNrofControlResourceSets-1 INTEGER ::= 11 -- Max number of CoReSets configurable on a serving cell minus 1 -maxCoReSetDuration INTEGER ::= 3 -- Max number of OFDM symbols in a control resource set -maxNrofSearchSpaces INTEGER ::= 40 -- Max number of Search Spaces -maxNrofSearchSpaces-1 INTEGER ::= 39 -- Max number of Search Spaces minus 1 -maxSFI-DCI-PayloadSize INTEGER ::= 128 -- Max number payload of a DCI scrambled with SFI-RNTI -maxSFI-DCI-PayloadSize-1 INTEGER ::= 127 -- Max number payload of a DCI scrambled with SFI-RNTI minus 1 -maxINT-DCI-PayloadSize INTEGER ::= 126 -- Max number payload of a DCI scrambled with INT-RNTI -maxINT-DCI-PayloadSize-1 INTEGER ::= 125 -- Max number payload of a DCI scrambled with INT-RNTI minus 1 -maxNrofRateMatchPatterns INTEGER ::= 4 -- Max number of rate matching patterns that may be configured -maxNrofRateMatchPatterns-1 INTEGER ::= 3 -- Max number of rate matching patterns that may be configured minus 1 - -maxNrofCSI-ReportConfigurations INTEGER ::= 48 -- Maximum number of report configurations -maxNrofCSI-ReportConfigurations-1 INTEGER ::= 47 -- Maximum number of report configurations minus 1 - -maxNrofCSI-ResourceConfigurations INTEGER ::= 112 -- Maximum number of resource configurations -maxNrofCSI-ResourceConfigurations-1 INTEGER ::= 111 -- Maximum number of resource configurations minus 1 - -maxNrofAP-CSI-RS-ResourcesPerSet INTEGER ::= 16 -maxNrOfCSI-AperiodicTriggers INTEGER ::= 128 -- Maximum number of triggers for aperiodic CSI reporting -maxNrofReportConfigPerAperiodicTrigger INTEGER ::= 16 -- Maximum number of report configurations per trigger state for aperiodic reporting - -maxNrofNZP-CSI-RS-Resources INTEGER ::= 192 -- Maximum number of Non-Zero-Power (NZP) CSI-RS resources -maxNrofNZP-CSI-RS-Resources-1 INTEGER ::= 191 -- Maximum number of Non-Zero-Power (NZP) CSI-RS resources minus 1 -maxNrofNZP-CSI-RS-ResourcesPerSet INTEGER ::= 64 -- Maximum number of NZP CSI-RS resources per resource set -maxNrofNZP-CSI-RS-ResourceSetsPerConfig INTEGER ::= 16 -- Maximum number of resource sets per resource configuration - -maxNrofZP-CSI-RS-Resources INTEGER ::= 32 -- Maximum number of Zero-Power (NZP) CSI-RS resources -maxNrofZP-CSI-RS-Resources-1 INTEGER ::= 31 -- Maximum number of Zero-Power (NZP) CSI-RS resources minus 1 -maxNrofZP-CSI-RS-ResourceSets-1 INTEGER ::= 16 -maxNrofZP-CSI-RS-ResourcesPerSet INTEGER ::= 16 -maxNrofZP-CSI-RS-Sets INTEGER ::= 16 - -maxNrofCSI-IM-Resources INTEGER ::= 32 -- Maximum number of CSI-IM resources. See CSI-IM-ResourceMax in 38.214. -maxNrofCSI-IM-Resources-1 INTEGER ::= 31 -- Maximum number of CSI-IM resources minus 1. See CSI-IM-ResourceMax in 38.214. -maxNrofCSI-IM-ResourcesPerSet INTEGER ::= 8 -- Maximum number of CSI-IM resources per set. See CSI-IM-ResourcePerSetMax in 38.214 -maxNrofCSI-IM-ResourceSetsPerConfig INTEGER ::= 16 -- Maximum number of CSI IM resource sets per resource configuration - -maxNrofSSB-Resources-1 INTEGER ::= 63 -- Maximum number of SSB resources in a resource set minus 1 -maxNrofCSI-SSB-ResourcePerSet INTEGER ::= 64 -maxNrofCSI-SSB-ResourceSetsPerConfig INTEGER ::= 1 -- Maximum number of CSI SSB resource sets per resource configuration - -maxNrofFailureDetectionResources INTEGER ::= 10 -- Maximum number of failure detection resources - -maxNrofObjectId INTEGER ::= 64 -- Maximum number of measurement objects -maxNrofPCI-Ranges INTEGER ::= 8 -- Maximum number of PCI ranges -maxNrofCSI-RS-ResourcesRRM INTEGER ::= 96 -- Maximum number of CSI-RS resources for an RRM measurement object -maxNrofCSI-RS-ResourcesRRM-1 INTEGER ::= 95 -- Maximum number of CSI-RS resources for an RRM measurement object minus 1 -maxNrofMeasId INTEGER ::= 64 -- Maximum number of configured measurements -maxNrofQuantityConfig INTEGER ::= 2 -- Maximum number of quantity configurations -maxNrofCSI-RS-CellsRRM INTEGER ::= 96 -- Maximum number of FFS - -maxNrofSRS-ResourceSets INTEGER ::= 16 -- Maximum number of SRS resource sets in a BWP. -maxNrofSRS-ResourceSets-1 INTEGER ::= 15 -- Maximum number of SRS resource sets in a BWP minus 1. -maxNrofSRS-Resources INTEGER ::= 64 -- Maximum number of SRS resources in an SRS resource set. -maxNrofSRS-Resources-1 INTEGER ::= 63 -- Maximum number of SRS resources in an SRS resource set minus 1. -maxNrofSRS-TriggerStates-1 INTEGER ::= 3 -- Maximum number of SRS trigger states minus 1, i.e., the largest code point. -maxRAT-CapabilityContainers INTEGER ::= 8 -- Maximum number of interworking RAT containers (incl NR and MRDC) -maxSimultaneousBands INTEGER ::= 32 -- Maximum number of simultaneously aggregated bands - - -maxNrofSlotFormatCombinationsPerCell INTEGER ::= 16 -- Maximum number of -maxNrofSlotFormatCombinationsPerSet INTEGER ::= 4096 -- Maximum number of Slot Format Combinations in a SF-Set. -maxNrofSlotFormatCombinationsPerSet-1 INTEGER ::= 4095 -- Maximum number of Slot Format Combinations in a SF-Set minus 1. -maxNrofPUCCH-Resources INTEGER ::= 128 -maxNrofPUCCH-Resources-1 INTEGER ::= 127 -maxNrofPUCCH-ResourceSets INTEGER ::= 4 -- Maximum number of PUCCH Resource Sets -maxNrofPUCCH-ResourceSets-1 INTEGER ::= 3 -- Maximum number of PUCCH Resource Sets minus 1. -maxNrofPUCCH-ResourcesPerSet INTEGER ::= 32 -- Maximum number of PUCCH Resources per PUCCH-ResourceSet -maxNrofPUCCH-ResourcesPerSet-1 INTEGER ::= 31 -- Maximum number of PUCCH Resources per PUCCH-ResourceSet minus 1. -maxNrofPUCCH-P0-PerSet INTEGER ::= 8 -- Maximum number of P0-pucch present in a p0-pucch set -maxNrofPUCCH-PathlossReferenceRSs INTEGER ::= 4 -- Maximum number of RSs used as pathloss reference for PUCCH power control. -maxNrofPUCCH-PathlossReferenceRSs-1 INTEGER ::= 3 -- Maximum number of RSs used as pathloss reference for PUCCH power control minus 1. - -maxNrofP0-PUSCH-AlphaSets INTEGER ::= 30 -- Maximum number of P0-pusch-alpha-sets (see 38,213, section 7.1) -maxNrofP0-PUSCH-AlphaSets-1 INTEGER ::= 29 -- Maximum number of P0-pusch-alpha-sets minus 1 (see 38,213, section 7.1) -maxNrofPUSCH-PathlossReferenceRSs INTEGER ::= 4 -- Maximum number of RSs used as pathloss reference for PUSCH power control. -maxNrofPUSCH-PathlossReferenceRSs-1 INTEGER ::= 3 -- Maximum number of RSs used as pathloss reference for PUSCH power control minus 1. - -maxBands INTEGER ::= 1024 -- Maximum number of supported bands in UE capability. -maxBandsMRDC INTEGER ::= 1280 -maxBandsEUTRA INTEGER ::= 256 -maxCellPrep INTEGER ::= 32 -maxCellReport INTEGER ::= 8 -maxDRB INTEGER ::= 29 -- Maximum number of DRBs (that can be added in DRB-ToAddModLIst). -maxFreq INTEGER ::= 8 -- Max number of non-serving frequencies in MeasResultSCG-Failure. -maxNrofCSI-RS INTEGER ::= 64 -maxNrofCandidateBeams INTEGER ::= 16 -- Max number of PRACH-ResourceDedicatedBFR that in BFR config. -maxNrofPCIsPerSMTC INTEGER ::= 64 -- Maximun number of PCIs per SMTC. -maxNrofQFIs INTEGER ::= 64 -maxNrofSR-Resources INTEGER ::= 8 -- Maximum number of SR resources per BWP in a cell. -maxNrofSlotFormatsPerCombination INTEGER ::= 256 -maxNrofSpatialRelationInfos INTEGER ::= 8 -maxNrofSRS-ResourcesPerSet INTEGER ::= 16 -maxNrofIndexesToReport INTEGER ::= 32 -maxNrofSSBs INTEGER ::= 64 -- Maximum number of SSB resources in a resource set. -maxNrofSSBs-1 INTEGER ::= 63 -- Maximum number of SSB resources in a resource set minus 1. - -maxNrofTCI-StatesPDCCH INTEGER ::= 64 -maxNrofTCI-States INTEGER ::= 64 -- Maximum number of TCI states. -maxNrofTCI-States-1 INTEGER ::= 63 -- Maximum number of TCI states minus 1. -maxNrofUL-Allocations INTEGER ::= 16 -- Maximum number of PUSCH time domain resource allocations. -maxQFI INTEGER ::= 63 -maxRA-CSIRS-Resources INTEGER ::= 96 -maxRA-OccasionsPerCSIRS INTEGER ::= 64 -- Maximum number of RA occasions for one CSI-RS -maxRA-Occasions-1 INTEGER ::= 511 -- Maximum number of RA occasions in the system -maxRA-SSB-Resources INTEGER ::= 64 -maxSCSs INTEGER ::= 5 -maxSecondaryCellGroups INTEGER ::= 3 -maxNrofServingCellsEUTRA INTEGER ::= 32 -maxMBSFN-Allocations INTEGER ::= 8 -maxNrofMultiBands INTEGER ::= 8 -maxCellSFTD INTEGER ::= 3 -- Maximum number of cells for SFTD reporting -maxReportConfigId INTEGER ::= 64 - -maxNrofSRI-PUSCH-Mappings INTEGER ::= 16 -maxNrofSRI-PUSCH-Mappings-1 INTEGER ::= 15 - --- Editor’s Note: Targeted for completion in June 2018. Not used in EN-DC drop. -CellIdentity ::= ENUMERATED {ffsTypeAndValue} -ShortMAC-I ::= ENUMERATED {ffsTypeAndValue} - --- TAG-MULTIPLICITY-AND-TYPE-CONSTRAINT-DEFINITIONS-STOP - -END - diff --git a/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-UE-Variables.asn b/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-UE-Variables.asn deleted file mode 100755 index 3eeec31891..0000000000 --- a/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/NR-UE-Variables.asn +++ /dev/null @@ -1,46 +0,0 @@ -NR-UE-Variables DEFINITIONS AUTOMATIC TAGS ::= - -BEGIN - --- TAG-VAR-MEAS-CONFIG-START - -VarMeasConfig ::= SEQUENCE { - -- Measurement identities - measIdList MeasIdToAddModList OPTIONAL, - -- Measurement objects - measObjectList MeasObjectToAddModList OPTIONAL, - -- Reporting configurations - reportConfigList ReportConfigToAddModList OPTIONAL, - -- Other parameters - quantityConfig QuantityConfig OPTIONAL, - - s-MeasureConfig CHOICE { - ssb-RSRP RSRP-Range, - csi-RSRP RSRP-Range - } OPTIONAL - -} - --- TAG-VAR-MEAS-CONFIG-STOP --- TAG-VAR-MEAS-REPORT-START - -VarMeasReportList ::= SEQUENCE (SIZE (1..maxNrofMeasId)) OF VarMeasReport - -VarMeasReport ::= SEQUENCE { - -- List of measurement that have been triggered - measId MeasId, - cellsTriggeredList CellsTriggeredList OPTIONAL, - numberOfReportsSent INTEGER -} - -CellsTriggeredList ::= SEQUENCE (SIZE (1..maxNrofCellMeas)) OF CHOICE { - physCellId PhysCellId, --- Not needed for EN-DC. - physCellIdEUTRA ENUMERATED {ffsTypeAndValue} - } - - --- TAG-VAR-MEAS-REPORT-STOP - -END - diff --git a/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/extract_asn1_from_spce.pl b/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/extract_asn1_from_spce.pl deleted file mode 100755 index 18f6792a8c..0000000000 --- a/openair2/RRC/NR/MESSAGES/ans1c/ASN1_files/extract_asn1_from_spce.pl +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/perl -# This script extracts the ASN1 definition from and TS 38.331 and generates 3 output files that can be processed by asn2wrs -# First download the specification from 3gpp.org as a word document and open it -# Then in "view" menu, select normal or web layout (needed to removed page header and footers) -# Finally save the document as a text file -# Call the script: "perl extract_asn1_from_spec.pl 38331-xxx.txt" -# It should generate: NR-RRC-Definitions.asn, NR-UE-Variables.asn and NR-InterNodeDefinitions -use warnings; -$input_file = $ARGV[0]; -$NR_def_output_file = "NR-RRC-Definitions.asn"; -$NR_var_output_file = "NR-UE-Variables.asn"; -$NR_internode_output_file = "NR-InterNodeDefinitions.asn"; - - -sub extract_asn1; - -open(INPUT_FILE, "< $input_file") or die "Can not open file $input_file"; - -while () { - - # Process the NR-RRC-Definitions section - if( m/NR-RRC-Definitions DEFINITIONS AUTOMATIC TAGS ::=/){ - open(OUTPUT_FILE, "> $NR_def_output_file") or die "Can not open file $def_output_file"; - syswrite OUTPUT_FILE,"$_ \n"; - syswrite OUTPUT_FILE,"BEGIN\n\n"; - - # Get all the text delimited by -- ASN1START and -- ASN1STOP - extract_asn1(); - - syswrite OUTPUT_FILE,"END\n\n"; - close(OUTPUT_FILE); - } - - # Process the NR-UE-Variables section - if( m/NR-UE-Variables DEFINITIONS AUTOMATIC TAGS ::=/){ - open(OUTPUT_FILE, "> $NR_var_output_file") or die "Can not open file $def_output_file"; - syswrite OUTPUT_FILE,"$_ \n"; - syswrite OUTPUT_FILE,"BEGIN\n\n"; - - # Get all the text delimited by -- ASN1START and -- ASN1STOP - extract_asn1(); - - syswrite OUTPUT_FILE,"END\n\n"; - close(OUTPUT_FILE); - } - # Process the NR-InterNodeDefinitions section - if( m/NR-InterNodeDefinitions DEFINITIONS AUTOMATIC TAGS ::=/){ - open(OUTPUT_FILE, "> $NR_internode_output_file") or die "Can not open file $def_output_file"; - syswrite OUTPUT_FILE,"$_ \n"; - syswrite OUTPUT_FILE,"BEGIN\n\n"; - - # Get all the text delimited by -- ASN1START and -- ASN1STOP - extract_asn1(); - - syswrite OUTPUT_FILE,"END\n\n"; - close(OUTPUT_FILE); - } - -} - -close(INPUT_FILE); - -# This subroutine copies the text delimited by -- ASN1START and -- ASN1STOP in INPUT_FILE -# and copies it into OUTPUT_FILE. -# It stops when it meets the keyword "END" -sub extract_asn1 { - my $line = ; - my $is_asn1 = 0; - - while(($line ne "END\n") && ($line ne "END\r\n")){ - if ($line =~ m/-- ASN1STOP/) { - $is_asn1 = 0; - } - if ($is_asn1 == 1){ - syswrite OUTPUT_FILE,"$line"; - } - if ($line =~ m/-- ASN1START/) { - $is_asn1 = 1; - } - $line = ; - } -} diff --git a/openair2/RRC/NR/defs_NR.h b/openair2/RRC/NR/defs_NR.h index 0a2b19f65c..e96fe9c95e 100644 --- a/openair2/RRC/NR/defs_NR.h +++ b/openair2/RRC/NR/defs_NR.h @@ -94,11 +94,11 @@ typedef struct uid_linear_allocator_NR_s { } uid_allocator_NR_t; -#define PROTOCOL_RRC_CTXT_UE_FMT PROTOCOL_CTXT_FMT -#define PROTOCOL_RRC_CTXT_UE_ARGS(CTXT_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp) +#define PROTOCOL_NRRRC_CTXT_UE_FMT PROTOCOL_CTXT_FMT +#define PROTOCOL_NRRRC_CTXT_UE_ARGS(CTXT_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp) -#define PROTOCOL_RRC_CTXT_FMT PROTOCOL_CTXT_FMT -#define PROTOCOL_RRC_CTXT_ARGS(CTXT_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp) +#define PROTOCOL_NRRRC_CTXT_FMT PROTOCOL_CTXT_FMT +#define PROTOCOL_NRRRC_CTXT_ARGS(CTXT_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp) #define UE_MODULE_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!! diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 75c6c195d1..718e60f2d0 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -41,7 +41,7 @@ #include "LAYER2/MAC/proto.h" #include "UTIL/LOG/log.h" #include "COMMON/mac_rrc_primitives.h" -#include "RRC/LITE/MESSAGES/asn1_msg.h" +#include "RRC/LITE/NR/asn1_msg.h" ///ASN.1 header files //#include "RRCConnectionRequest.h" @@ -103,18 +103,21 @@ extern RAN_CONTEXT_t RC; #ifdef PHY_EMUL extern EMULATION_VARS *Emul_vars; #endif -extern eNB_MAC_INST *eNB_mac_inst; -extern UE_MAC_INST *UE_mac_inst; +//extern eNB_MAC_INST *eNB_mac_inst; +//extern UE_MAC_INST *UE_mac_inst; #ifdef BIGPHYSAREA extern void* bigphys_malloc(int); #endif extern uint16_t two_tier_hexagonal_cellIds[7]; -mui_t rrc_eNB_mui = 0; +mui_t rrc_gNB_mui = 0; + +///---------------------------------------------------------------------------------------------------------------/// +///---------------------------------------------------------------------------------------------------------------/// void -openair_rrc_on( +openair_nrrrc_on( const protocol_ctxt_t* const ctxt_pP ) //----------------------------------------------------------------------------- @@ -131,9 +134,11 @@ openair_rrc_on( } } -//----------------------------------------------------------------------------- +///---------------------------------------------------------------------------------------------------------------/// +///---------------------------------------------------------------------------------------------------------------/// + static void -init_SI( +init_NR_SI( const protocol_ctxt_t* const ctxt_pP, const int CC_id #if defined(ENABLE_ITTI) @@ -155,6938 +160,154 @@ init_SI( RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].ul_CarrierFreq = configuration->downlink_frequency[CC_id]+ configuration->uplink_frequency_offset[CC_id]; ///MIB - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_MIB_NR = 0; - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].MIB_NR = (uint8_t*) malloc16(4); - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_MIB_NR = do_MIB_NR(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],0, - #ifdef ENABLE_ITTI - configuration->ssb_SubcarrierOffset[CC_id], - configuration->pdcch_ConfigSIB1[CC_id], - configuration->subCarrierSpacingCommon[CC_id], - configuration->dmrs_TypeA_Position[CC_id] - #else - 0,0,15,2 - #endif - ); + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_MIB_NR = 0; + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].MIB_NR = (uint8_t*) malloc16(4); + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_MIB_NR = do_MIB_NR(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],0, + #ifdef ENABLE_ITTI + configuration->ssb_SubcarrierOffset[CC_id], + configuration->pdcch_ConfigSIB1[CC_id], + configuration->subCarrierSpacingCommon[CC_id], + configuration->dmrs_TypeA_Position[CC_id] + #else + 0,0,15,2 + #endif + ); ///SIB1 - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1_NR = 0; - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1_NR = (uint8_t*) malloc16(32); - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1_NR! = NULL,PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for NR SIB1 allocated\n",PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1_NR = 0; + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1_NR = (uint8_t*) malloc16(32); + AssertFatal(RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1_NR! + = NULL,PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for NR SIB1 allocated\n",PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1_NR = do_SIB1_NR(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id], - ctxt_pP->module_id, - CC_id - #if defined(ENABLE_ITTI) - , configuration - #endif - ); + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1_NR = do_SIB1_NR(&RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id], + ctxt_pP->module_id, + CC_id + #if defined(ENABLE_ITTI) + ,configuration + #endif + ); - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 != 255,"FATAL, RC.nr_rrc[enb_mod_idP].carrier[CC_id].sizeof_SIB1_NR == 255"); + AssertFatal(RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 != 255,"FATAL, RC.nr_rrc[enb_mod_idP].carrier[CC_id].sizeof_SIB1_NR == 255"); - -/* - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 = 0; - - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23 = (uint8_t*) malloc16(64); - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].SIB23!=NULL,"cannot allocate memory for SIB"); - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 = do_SIB23( - ctxt_pP->module_id, - - CC_id -#if defined(ENABLE_ITTI) - , configuration -#endif - ); - - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB23 != 255,"FATAL, RC.rrc[mod].carrier[CC_id].sizeof_SIB23 == 255"); - - - LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" SIB2/3 Contents (partial)\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); - LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.n_SB = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - pusch_ConfigBasic.n_SB); - LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.hoppingMode = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - pusch_ConfigBasic.hoppingMode); - LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.pusch_HoppingOffset = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - pusch_ConfigBasic.pusch_HoppingOffset); - LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.enable64QAM = %d\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - pusch_ConfigBasic.enable64QAM); - LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.groupHoppingEnabled = %d\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - ul_ReferenceSignalsPUSCH.groupHoppingEnabled); - LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.groupAssignmentPUSCH = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH); - LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.sequenceHoppingEnabled = %d\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - (int)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled); - LOG_T(RRC, PROTOCOL_RRC_CTXT_FMT" pusch_config_common.cyclicShift = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon.pusch_ConfigCommon. - ul_ReferenceSignalsPUSCH.cyclicShift); - -#if defined(Rel10) || defined(Rel14) - - if (RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MBMS_flag > 0) { - for (i = 0; i < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.count; i++) { - // SIB 2 - // LOG_D(RRC, "[eNB %d] mbsfn_SubframeConfigList.list.count = %ld\n", enb_mod_idP, RC.rrc[enb_mod_idP].sib2->mbsfn_SubframeConfigList->list.count); - LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" SIB13 contents for MBSFN subframe allocation %d/%d(partial)\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - i, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.count); - LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" mbsfn_Subframe_pattern is = %x\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->subframeAllocation.choice.oneFrame.buf[0] >> 0); - LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" radioframe_allocation_period = %ld (just index number, not the real value)\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationPeriod); // need to display the real value, using array of char (like in dumping SIB2) - LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" radioframe_allocation_offset = %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList->list.array[i]->radioframeAllocationOffset); - } - - // SIB13 - for (i = 0; i < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.count; i++) { - LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" SIB13 contents for MBSFN sync area %d/%d (partial)\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - i, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.count); - LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" MCCH Repetition Period: %ld (just index number, not real value)\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_RepetitionPeriod_r9); - LOG_D(RRC, PROTOCOL_RRC_CTXT_FMT" MCCH Offset: %ld\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9.list.array[i]->mcch_Config_r9.mcch_Offset_r9); - } - } - else memset((void*)&RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13,0,sizeof(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13)); -#endif - - LOG_D(RRC, - PROTOCOL_RRC_CTXT_FMT" RRC_UE --- MAC_CONFIG_REQ (SIB1.tdd & SIB2 params) ---> MAC_UE\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); - -#ifdef Rel14 - if ((RC.rrc[ctxt_pP->module_id]->carrier[CC_id].mib.message.schedulingInfoSIB1_BR_r13>0) && - (RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR!=NULL)) { - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension!=NULL, - "sib2_br->nonCriticalExtension is null (v8.9)\n"); - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension!=NULL, - "sib2_br->nonCriticalExtension is null (v9.2)\n"); - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, - "sib2_br->nonCriticalExtension is null (v11.3)\n"); - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, - "sib2_br->nonCriticalExtension is null (v12.5)\n"); - AssertFatal(RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension!=NULL, - "sib2_br->nonCriticalExtension is null (v13.10)\n"); - sib1_v13ext = RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1_BR->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension->nonCriticalExtension; - } -#endif - - LOG_D(RRC, "About to call rrc_mac_config_req_eNB\n"); -*/ rrc_mac_config_req_eNB(ctxt_pP->module_id, CC_id, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Ncp, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->freqBandIndicator, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq, -#ifdef Rel14 - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].pbch_repetition, -#endif + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId, + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].Ncp, + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->freqBandIndicator, + RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq, 0, // rnti (BCCH_BCH_Message_t *) - &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].mib, - (RadioResourceConfigCommonSIB_t *) & - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->radioResourceConfigCommon, -#if defined(Rel14) - (RadioResourceConfigCommonSIB_t *) & - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2_BR->radioResourceConfigCommon, -#endif - (struct PhysicalConfigDedicated *)NULL, -#if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, -#endif - (MeasObjectToAddMod_t **) NULL, - (MAC_MainConfig_t *) NULL, 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *) NULL, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->tdd_Config, - NULL, - &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->schedulingInfoList, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].ul_CarrierFreq, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->freqInfo.ul_Bandwidth, - &RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->freqInfo.additionalSpectrumEmission, - (MBSFN_SubframeConfigList_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib2->mbsfn_SubframeConfigList -#if defined(Rel10) || defined(Rel14) - , - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].MBMS_flag, - (MBSFN_AreaInfoList_r9_t*) & RC.rrc[ctxt_pP->module_id]->carrier[CC_id].sib13->mbsfn_AreaInfoList_r9, - (PMCH_InfoList_r9_t *) NULL -#endif -#ifdef Rel14 - , - sib1_v13ext -#endif + &RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].mib ); } -#if defined(Rel10) || defined(Rel14) -/*------------------------------------------------------------------------------*/ -static void -init_MCCH( - module_id_t enb_mod_idP, - int CC_id -) -//----------------------------------------------------------------------------- -{ - int sync_area = 0; - // initialize RRC_eNB_INST MCCH entry - RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE = - malloc(RC.rrc[enb_mod_idP]->carrier[CC_id].num_mbsfn_sync_area * sizeof(uint8_t*)); +char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigurationReq* configuration){ + protocol_ctxt_t ctxt; + int CC_id; - for (sync_area = 0; sync_area < RC.rrc[enb_mod_idP]->carrier[CC_id].num_mbsfn_sync_area; sync_area++) { + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, gnb_mod_idP, ENB_FLAG_YES, NOT_A_RNTI, 0, 0,gnb_mod_idP); + LOG_I(NR_RRC,PROTOCOL_NRRRC_CTXT_FMT" Init...\n",PROTOCOL_NRRRC_CTXT_ARGS(&ctxt)); - RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] = 0; - RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area] = (uint8_t *) malloc16(32); - - AssertFatal(RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area] != NULL, - "[eNB %d]init_MCCH: FATAL, no memory for MCCH MESSAGE allocated \n", enb_mod_idP); - RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] = do_MBSFNAreaConfig(enb_mod_idP, - sync_area, - (uint8_t *)RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area], - &RC.rrc[enb_mod_idP]->carrier[CC_id].mcch, - &RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message); - - LOG_I(RRC, "mcch message pointer %p for sync area %d \n", - RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESSAGE[sync_area], - sync_area); - LOG_D(RRC, "[eNB %d] MCCH_MESSAGE contents for Sync Area %d (partial)\n", enb_mod_idP, sync_area); - LOG_D(RRC, "[eNB %d] CommonSF_AllocPeriod_r9 %ld\n", enb_mod_idP, - RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->commonSF_AllocPeriod_r9); - LOG_D(RRC, - "[eNB %d] CommonSF_Alloc_r9.list.count (number of MBSFN Subframe Pattern) %d\n", - enb_mod_idP, RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->commonSF_Alloc_r9.list.count); - LOG_D(RRC, "[eNB %d] MBSFN Subframe Pattern: %02x (in hex)\n", - enb_mod_idP, - RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->commonSF_Alloc_r9.list.array[0]->subframeAllocation. - choice.oneFrame.buf[0]); - - AssertFatal(RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] != 255, - "RC.rrc[enb_mod_idP]->carrier[CC_id].sizeof_MCCH_MESSAGE[sync_area] == 255"); - RC.rrc[enb_mod_idP]->carrier[CC_id].MCCH_MESS[sync_area].Active = 1; - } - - - //Set the RC.rrc[enb_mod_idP]->MCCH_MESS.Active to 1 (allow to transfer MCCH message RRC->MAC in function mac_rrc_data_req) - - // ??Configure MCCH logical channel - // call mac_config_req with appropriate structure from ASN.1 description - - - // LOG_I(RRC, "DUY: serviceID is %d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->tmgi_r9.serviceId_r9.buf[2]); - // LOG_I(RRC, "DUY: session ID is %d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->sessionId_r9->buf[0]); - rrc_mac_config_req_eNB(enb_mod_idP, CC_id, - 0,0,0,0,0, -#ifdef Rel14 - 0, -#endif - 0,//rnti - (BCCH_BCH_Message_t *)NULL, - (RadioResourceConfigCommonSIB_t *) NULL, -#ifdef Rel14 - (RadioResourceConfigCommonSIB_t *) NULL, -#endif - (struct PhysicalConfigDedicated *)NULL, -#if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, -#endif - (MeasObjectToAddMod_t **) NULL, - (MAC_MainConfig_t *) NULL, - 0, - (struct LogicalChannelConfig *)NULL, - (MeasGapConfig_t *) NULL, - (TDD_Config_t *) NULL, - (MobilityControlInfo_t *)NULL, - (SchedulingInfoList_t *) NULL, - 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL -#if defined(Rel10) || defined(Rel14) - , - 0, - (MBSFN_AreaInfoList_r9_t *) NULL, - (PMCH_InfoList_r9_t *) & (RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9) -# endif -# ifdef Rel14 - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL -# endif - ); - - //LOG_I(RRC,"DUY: lcid after rrc_mac_config_req is %02d\n",RC.rrc[enb_mod_idP]->mcch_message->pmch_InfoList_r9.list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9); - -} - -//----------------------------------------------------------------------------- -static void init_MBMS( - module_id_t enb_mod_idP, - int CC_id, - frame_t frameP -) -//----------------------------------------------------------------------------- -{ - // init the configuration for MTCH - protocol_ctxt_t ctxt; - - if (RC.rrc[enb_mod_idP]->carrier[CC_id].MBMS_flag > 0) { - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, enb_mod_idP, ENB_FLAG_YES, NOT_A_RNTI, frameP, 0,enb_mod_idP); - - LOG_D(RRC, "[eNB %d] Frame %d : Radio Bearer config request for MBMS\n", enb_mod_idP, frameP); //check the lcid - // Configuring PDCP and RLC for MBMS Radio Bearer - - rrc_pdcp_config_asn1_req(&ctxt, - (SRB_ToAddModList_t *)NULL, // SRB_ToAddModList - (DRB_ToAddModList_t *)NULL, // DRB_ToAddModList - (DRB_ToReleaseList_t *)NULL, - 0, // security mode - NULL, // key rrc encryption - NULL, // key rrc integrity - NULL // key encryption -# if defined(Rel10) || defined(Rel14) - , &(RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9) -# endif - ,NULL); - - rrc_rlc_config_asn1_req(&ctxt, - NULL, // SRB_ToAddModList - NULL, // DRB_ToAddModList - NULL, // DRB_ToReleaseList - &(RC.rrc[enb_mod_idP]->carrier[CC_id].mcch_message->pmch_InfoList_r9)); - - //rrc_mac_config_req(); - } -} -#endif - -//----------------------------------------------------------------------------- -uint8_t -rrc_eNB_get_next_transaction_identifier( - module_id_t enb_mod_idP -) -//----------------------------------------------------------------------------- -{ - static uint8_t rrc_transaction_identifier[NUMBER_OF_eNB_MAX]; - rrc_transaction_identifier[enb_mod_idP] = (rrc_transaction_identifier[enb_mod_idP] + 1) % RRC_TRANSACTION_IDENTIFIER_NUMBER; - LOG_T(RRC,"generated xid is %d\n",rrc_transaction_identifier[enb_mod_idP]); - return rrc_transaction_identifier[enb_mod_idP]; -} -/*------------------------------------------------------------------------------*/ -/* Functions to handle UE index in eNB UE list */ - - -////----------------------------------------------------------------------------- -//static module_id_t -//rrc_eNB_get_UE_index( -// module_id_t enb_mod_idP, -// uint64_t UE_identity -//) -////----------------------------------------------------------------------------- -//{ -// -// boolean_t reg = FALSE; -// module_id_t i; -// -// AssertFatal(enb_mod_idP < NB_eNB_INST, "eNB index invalid (%d/%d)!", enb_mod_idP, NB_eNB_INST); -// -// for (i = 0; i < NUMBER_OF_UE_MAX; i++) { -// if (RC.rrc[enb_mod_idP]->Info.UE_list[i] == UE_identity) { -// // UE_identity already registered -// reg = TRUE; -// break; -// } -// } -// -// if (reg == FALSE) { -// return (UE_MODULE_INVALID); -// } else -// return (i); -//} - - -//----------------------------------------------------------------------------- -// return the ue context if there is already an UE with ue_identityP, NULL otherwise -static struct rrc_eNB_ue_context_s* -rrc_eNB_ue_context_random_exist( - const protocol_ctxt_t* const ctxt_pP, - const uint64_t ue_identityP -) -//----------------------------------------------------------------------------- -{ - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { - if (ue_context_p->ue_context.random_ue_identity == ue_identityP) - return ue_context_p; - } - return NULL; -} -//----------------------------------------------------------------------------- -// return the ue context if there is already an UE with the same S-TMSI(MMEC+M-TMSI), NULL otherwise -static struct rrc_eNB_ue_context_s* -rrc_eNB_ue_context_stmsi_exist( - const protocol_ctxt_t* const ctxt_pP, - const mme_code_t mme_codeP, - const m_tmsi_t m_tmsiP -) -//----------------------------------------------------------------------------- -{ - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { - LOG_I(RRC,"checking for UE S-TMSI %x, mme %x (%p): rnti %x", - m_tmsiP, mme_codeP, ue_context_p, - ue_context_p->ue_context.rnti); - if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) { - printf("=> S-TMSI %x, MME %x\n", - ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, - ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code); - if (ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi == m_tmsiP) - if (ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code == mme_codeP) - return ue_context_p; + #if OCP_FRAMEWORK + while ( RC.nr_rrc[gnb_mod_idP] == NULL ) { + LOG_E(NR_RRC, "RC.nr_rrc not yet initialized, waiting 1 second\n"); + sleep(1); } - else - printf("\n"); - - } - return NULL; -} - -//----------------------------------------------------------------------------- -// return a new ue context structure if ue_identityP, ctxt_pP->rnti not found in collection -static struct rrc_eNB_ue_context_s* -rrc_eNB_get_next_free_ue_context( - const protocol_ctxt_t* const ctxt_pP, - const uint64_t ue_identityP -) -//----------------------------------------------------------------------------- -{ - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[ctxt_pP->module_id], - ctxt_pP->rnti); - - if (ue_context_p == NULL) { -#if 0 - RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { - if (ue_context_p->ue_context.random_ue_identity == ue_identityP) { - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" Cannot create new UE context, already exist rand UE id 0x%"PRIx64", uid %u\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ue_identityP, - ue_context_p->local_uid); - return NULL; - } - } -#endif - ue_context_p = rrc_eNB_allocate_new_UE_context(RC.rrc[ctxt_pP->module_id]); - - if (ue_context_p == NULL) { - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" Cannot create new UE context, no memory\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - return NULL; - } - - ue_context_p->ue_id_rnti = ctxt_pP->rnti; // here ue_id_rnti is just a key, may be something else - ue_context_p->ue_context.rnti = ctxt_pP->rnti; // yes duplicate, 1 may be removed - ue_context_p->ue_context.random_ue_identity = ue_identityP; - RB_INSERT(rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p); - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" Created new UE context uid %u\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ue_context_p->local_uid); - return ue_context_p; - - } else { - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" Cannot create new UE context, already exist\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - return NULL; - } -} - -#if 0 //!defined(ENABLE_USE_MME) -void rrc_eNB_emulation_notify_ue_module_id( - const module_id_t ue_module_idP, - const rnti_t rntiP, - const uint8_t cell_identity_byte0P, - const uint8_t cell_identity_byte1P, - const uint8_t cell_identity_byte2P, - const uint8_t cell_identity_byte3P) -{ - module_id_t enb_module_id; - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - int CC_id; - - // find enb_module_id - for (enb_module_id = 0; enb_module_id < NUMBER_OF_eNB_MAX; enb_module_id++) { - if(enb_module_id>0){ /*FIX LATER*/ - return; - } - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - if (&RC.rrc[enb_module_id]->carrier[CC_id].sib1 != NULL) { - if ( - (&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[0] == cell_identity_byte0P) && - (&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[1] == cell_identity_byte1P) && - (&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[2] == cell_identity_byte2P) && - (&RC.rrc[enb_module_id]->carrier[CC_id].sib1->cellAccessRelatedInfo.cellIdentity.buf[3] == cell_identity_byte3P) - ) { - ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[enb_module_id], - rntiP - ); - - if (NULL != ue_context_p) { - oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[enb_module_id][ue_context_p->local_uid] = ue_module_idP; - } - - //return; - } - } - } - oai_emulation.info.eNB_ue_module_id_to_rnti[enb_module_id][ue_module_idP] = rntiP; - } - - AssertFatal(enb_module_id == NUMBER_OF_eNB_MAX, - "Cell identity not found for ue module id %u rnti %x", - ue_module_idP, rntiP); -} -#endif - -//----------------------------------------------------------------------------- -void -rrc_eNB_free_mem_UE_context( - const protocol_ctxt_t* const ctxt_pP, - struct rrc_eNB_ue_context_s* const ue_context_pP -) -//----------------------------------------------------------------------------- -{ - int i; - LOG_T(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" Clearing UE context 0x%p (free internal structs)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ue_context_pP); -#if defined(Rel10) || defined(Rel14) - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_SCellToAddMod_r10, &ue_context_pP->ue_context.sCell_config[0]); - ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_SCellToAddMod_r10, &ue_context_pP->ue_context.sCell_config[1]); -#endif - - if (ue_context_pP->ue_context.SRB_configList) { - ASN_STRUCT_FREE(asn_DEF_SRB_ToAddModList, ue_context_pP->ue_context.SRB_configList); - ue_context_pP->ue_context.SRB_configList = NULL; - } - - for(i = 0;i < RRC_TRANSACTION_IDENTIFIER_NUMBER;i++){ - if (ue_context_pP->ue_context.SRB_configList2[i]) { - free(ue_context_pP->ue_context.SRB_configList2[i]); - ue_context_pP->ue_context.SRB_configList2[i] = NULL; - } - } - - if (ue_context_pP->ue_context.DRB_configList) { - ASN_STRUCT_FREE(asn_DEF_DRB_ToAddModList, ue_context_pP->ue_context.DRB_configList); - ue_context_pP->ue_context.DRB_configList = NULL; - } - - for(i = 0;i < RRC_TRANSACTION_IDENTIFIER_NUMBER;i++){ - if (ue_context_pP->ue_context.DRB_configList2[i]) { - free(ue_context_pP->ue_context.DRB_configList2[i]); - ue_context_pP->ue_context.DRB_configList2[i] = NULL; - } - if (ue_context_pP->ue_context.DRB_Release_configList2[i]) { - free(ue_context_pP->ue_context.DRB_Release_configList2[i]); - ue_context_pP->ue_context.DRB_Release_configList2[i] = NULL; - } - } - - memset(ue_context_pP->ue_context.DRB_active, 0, sizeof(ue_context_pP->ue_context.DRB_active)); - - if (ue_context_pP->ue_context.physicalConfigDedicated) { - ASN_STRUCT_FREE(asn_DEF_PhysicalConfigDedicated, ue_context_pP->ue_context.physicalConfigDedicated); - ue_context_pP->ue_context.physicalConfigDedicated = NULL; - } - - if (ue_context_pP->ue_context.sps_Config) { - ASN_STRUCT_FREE(asn_DEF_SPS_Config, ue_context_pP->ue_context.sps_Config); - ue_context_pP->ue_context.sps_Config = NULL; - } - - for (i=0; i < MAX_MEAS_OBJ; i++) { - if (ue_context_pP->ue_context.MeasObj[i] != NULL) { - ASN_STRUCT_FREE(asn_DEF_MeasObjectToAddMod, ue_context_pP->ue_context.MeasObj[i]); - ue_context_pP->ue_context.MeasObj[i] = NULL; - } - } - - for (i=0; i < MAX_MEAS_CONFIG; i++) { - if (ue_context_pP->ue_context.ReportConfig[i] != NULL) { - ASN_STRUCT_FREE(asn_DEF_ReportConfigToAddMod, ue_context_pP->ue_context.ReportConfig[i]); - ue_context_pP->ue_context.ReportConfig[i] = NULL; - } - } - - if (ue_context_pP->ue_context.QuantityConfig) { - ASN_STRUCT_FREE(asn_DEF_QuantityConfig, ue_context_pP->ue_context.QuantityConfig); - ue_context_pP->ue_context.QuantityConfig = NULL; - } - - if (ue_context_pP->ue_context.mac_MainConfig) { - ASN_STRUCT_FREE(asn_DEF_MAC_MainConfig, ue_context_pP->ue_context.mac_MainConfig); - ue_context_pP->ue_context.mac_MainConfig = NULL; - } - -/* if (ue_context_pP->ue_context.measGapConfig) { - ASN_STRUCT_FREE(asn_DEF_MeasGapConfig, ue_context_pP->ue_context.measGapConfig); - ue_context_pP->ue_context.measGapConfig = NULL; - }*/ - if (ue_context_pP->ue_context.handover_info) { - ASN_STRUCT_FREE(asn_DEF_Handover, ue_context_pP->ue_context.handover_info); - ue_context_pP->ue_context.handover_info = NULL; - } - - //SRB_INFO SI; - //SRB_INFO Srb0; - //SRB_INFO_TABLE_ENTRY Srb1; - //SRB_INFO_TABLE_ENTRY Srb2; - if (ue_context_pP->ue_context.measConfig) { - ASN_STRUCT_FREE(asn_DEF_MeasConfig, ue_context_pP->ue_context.measConfig); - ue_context_pP->ue_context.measConfig = NULL; - } - - if (ue_context_pP->ue_context.measConfig) { - ASN_STRUCT_FREE(asn_DEF_MeasConfig, ue_context_pP->ue_context.measConfig); - ue_context_pP->ue_context.measConfig = NULL; - } - - //HANDOVER_INFO *handover_info; -#if defined(ENABLE_SECURITY) - //uint8_t kenb[32]; -#endif - //e_SecurityAlgorithmConfig__cipheringAlgorithm ciphering_algorithm; - //e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm; - //uint8_t Status; - //rnti_t rnti; - //uint64_t random_ue_identity; -#if defined(ENABLE_ITTI) - //UE_S_TMSI Initialue_identity_s_TMSI; - //EstablishmentCause_t establishment_cause; - //ReestablishmentCause_t reestablishment_cause; - //uint16_t ue_initial_id; - //uint32_t eNB_ue_s1ap_id :24; - //security_capabilities_t security_capabilities; - //uint8_t nb_of_e_rabs; - //e_rab_param_t e_rab[S1AP_MAX_E_RAB]; - //uint32_t enb_gtp_teid[S1AP_MAX_E_RAB]; - //transport_layer_addr_t enb_gtp_addrs[S1AP_MAX_E_RAB]; - //rb_id_t enb_gtp_ebi[S1AP_MAX_E_RAB]; -#endif -} - -//----------------------------------------------------------------------------- -// should be called when UE is lost by eNB -void -rrc_eNB_free_UE(const module_id_t enb_mod_idP,const struct rrc_eNB_ue_context_s* const ue_context_pP) -//----------------------------------------------------------------------------- -{ - - - protocol_ctxt_t ctxt; -#if !defined(ENABLE_USE_MME) - module_id_t ue_module_id; - /* avoid gcc warnings */ - (void)ue_module_id; -#endif - rnti_t rnti = ue_context_pP->ue_context.rnti; - int i, j , CC_id, pdu_number; - LTE_eNB_ULSCH_t *ulsch = NULL; - LTE_eNB_DLSCH_t *dlsch = NULL; - nfapi_ul_config_request_body_t *ul_req_tmp = NULL; - PHY_VARS_eNB *eNB_PHY = NULL; - eNB_MAC_INST *eNB_MAC = RC.mac[enb_mod_idP]; - - AssertFatal(enb_mod_idP < NB_eNB_INST, "eNB inst invalid (%d/%d) for UE %x!", enb_mod_idP, NB_eNB_INST, rnti); - /* ue_context_p = rrc_eNB_get_ue_context( - &RC.rrc[enb_mod_idP], - rntiP - ); - */ - if (NULL != ue_context_pP) { - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, enb_mod_idP, ENB_FLAG_YES, rnti, 0, 0,enb_mod_idP); - LOG_W(RRC, "[eNB %d] Removing UE RNTI %x\n", enb_mod_idP, rnti); - -#if defined(ENABLE_USE_MME) - if( ue_context_pP->ue_context.ul_failure_timer >= 8 ) { - LOG_I(RRC, "[eNB %d] S1AP_UE_CONTEXT_RELEASE_REQ RNTI %x\n", enb_mod_idP, rnti); - rrc_eNB_send_S1AP_UE_CONTEXT_RELEASE_REQ(enb_mod_idP, ue_context_pP, S1AP_CAUSE_RADIO_NETWORK, 21); // send cause 21: connection with ue lost - /* From 3GPP 36300v10 p129 : 19.2.2.2.2 S1 UE Context Release Request (eNB triggered) - * If the E-UTRAN internal reason is a radio link failure detected in the eNB, the eNB shall wait a sufficient time before - * triggering the S1 UE Context Release Request procedure - * in order to allow the UE to perform the NAS recovery - * procedure, see TS 23.401 [17]. - */ - return; - } -#endif - for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - eNB_PHY = RC.eNB[enb_mod_idP][CC_id]; - for (i=0; iulsch[i]; - if((ulsch != NULL) && (ulsch->rnti == rnti)){ - LOG_I(RRC, "clean_eNb_ulsch UE %x \n", rnti); - clean_eNb_ulsch(ulsch); - } - } - for (i=0; idlsch[i][0]; - if((dlsch != NULL) && (dlsch->rnti == rnti)){ - LOG_I(RRC, "clean_eNb_dlsch UE %x \n", rnti); - clean_eNb_dlsch(dlsch); - } - } - - if (rrc_agent_registered[enb_mod_idP]) { - agent_rrc_xface[enb_mod_idP]->flexran_agent_notify_ue_state_change(enb_mod_idP, - rnti, PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); - } - - for(j = 0; j < 10; j++){ - ul_req_tmp = &eNB_MAC->UL_req_tmp[CC_id][j].ul_config_request_body; - if(ul_req_tmp){ - pdu_number = ul_req_tmp->number_of_pdus; - for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--){ - if(ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == rnti){ - LOG_I(RRC, "remove UE %x from ul_config_pdu_list %d/%d\n", rnti, pdu_index, pdu_number); - if(pdu_index < pdu_number -1){ - memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t)); - } - ul_req_tmp->number_of_pdus--; - } - } - } - } - } - rrc_mac_remove_ue(enb_mod_idP,rnti); - rrc_rlc_remove_ue(&ctxt); - pdcp_remove_UE(&ctxt); - - rrc_eNB_remove_ue_context( - &ctxt, - RC.rrc[enb_mod_idP], - (struct rrc_eNB_ue_context_s*) ue_context_pP); - } -} - -//----------------------------------------------------------------------------- -void -rrc_eNB_process_RRCConnectionSetupComplete( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* ue_context_pP, - RRCConnectionSetupComplete_r8_IEs_t * rrcConnectionSetupComplete -) -//----------------------------------------------------------------------------- -{ - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, " "processing RRCConnectionSetupComplete from UE (SRB1 Active)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - - ue_context_pP->ue_context.Srb1.Active=1; - T(T_ENB_RRC_CONNECTION_SETUP_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - -#if defined(ENABLE_USE_MME) - - if (EPC_MODE_ENABLED == 1) { - // Forward message to S1AP layer - rrc_eNB_send_S1AP_NAS_FIRST_REQ( - ctxt_pP, - ue_context_pP, - rrcConnectionSetupComplete); - } else -#endif - { - // RRC loop back (no S1AP), send SecurityModeCommand to UE - rrc_eNB_generate_SecurityModeCommand( - ctxt_pP, - ue_context_pP); - // rrc_eNB_generate_UECapabilityEnquiry(enb_mod_idP,frameP,ue_mod_idP); - } -} - -//----------------------------------------------------------------------------- -void -rrc_eNB_generate_SecurityModeCommand( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP -) -//----------------------------------------------------------------------------- -{ - uint8_t buffer[100]; - uint8_t size; - - T(T_ENB_RRC_SECURITY_MODE_COMMAND, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - size = do_SecurityModeCommand( - ctxt_pP, - buffer, - rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), - ue_context_pP->ue_context.ciphering_algorithm, - ue_context_pP->ue_context.integrity_algorithm); - -#ifdef RRC_MSG_PRINT - uint16_t i=0; - LOG_F(RRC,"[MSG] RRC Security Mode Command\n"); - - for (i = 0; i < size; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); - } - - LOG_F(RRC,"\n"); -#endif - - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate SecurityModeCommand (bytes %d)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - size); - - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (securityModeCommand to UE MUI %d) --->[PDCP][RB %02d]\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - size, - rrc_eNB_mui, - DCCH); - - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" securityModeCommand UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - size); - - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); - -} - -//----------------------------------------------------------------------------- -void -rrc_eNB_generate_UECapabilityEnquiry( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP -) -//----------------------------------------------------------------------------- -{ - - uint8_t buffer[100]; - uint8_t size; - - T(T_ENB_RRC_UE_CAPABILITY_ENQUIRY, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - size = do_UECapabilityEnquiry( - ctxt_pP, - buffer, - rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id)); - - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate UECapabilityEnquiry (bytes %d)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - size); - - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (UECapabilityEnquiry MUI %d) --->[PDCP][RB %02d]\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - size, - rrc_eNB_mui, - DCCH); - - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" rrcUECapabilityEnquiry UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - size); - - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); - -} - -//----------------------------------------------------------------------------- -void -rrc_eNB_generate_RRCConnectionReject( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - const int CC_id -) -//----------------------------------------------------------------------------- -{ -#ifdef RRC_MSG_PRINT - int cnt; -#endif - - T(T_ENB_RRC_CONNECTION_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size = - do_RRCConnectionReject(ctxt_pP->module_id, - (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload); - -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRCConnectionReject\n"); - - for (cnt = 0; cnt < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) { - LOG_F(RRC,"%02x ", ((uint8_t*)RC.rrc[ctxt_pP->module_id]->Srb0.Tx_buffer.Payload)[cnt]); - } - - LOG_F(RRC,"\n"); -#endif - - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, - MSC_AS_TIME_FMT" RRCConnectionReject UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); - - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReject (bytes %d)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); -} - -//----------------------------------------------------------------------------- -void -rrc_eNB_generate_RRCConnectionReestablishment( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - const int CC_id -) -//----------------------------------------------------------------------------- -{ - LogicalChannelConfig_t *SRB1_logicalChannelConfig; - SRB_ToAddModList_t **SRB_configList; - SRB_ToAddMod_t *SRB1_config; - int cnt; - - T(T_ENB_RRC_CONNECTION_REESTABLISHMENT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - SRB_configList = &ue_context_pP->ue_context.SRB_configList; - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size = - do_RRCConnectionReestablishment(ctxt_pP, - ue_context_pP, - CC_id, - (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, - (uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2 - rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), - SRB_configList, - &ue_context_pP->ue_context.physicalConfigDedicated); - -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRCConnectionReestablishment\n"); - - for (cnt = 0; cnt < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) { - LOG_F(RRC,"%02x ", ((uint8_t*)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload)[cnt]); - } - - LOG_F(RRC,"\n"); -#endif - - // configure SRB1 for UE - - if (*SRB_configList != NULL) { - for (cnt = 0; cnt < (*SRB_configList)->list.count; cnt++) { - if ((*SRB_configList)->list.array[cnt]->srb_Identity == 1) { - SRB1_config = (*SRB_configList)->list.array[cnt]; - - if (SRB1_config->logicalChannelConfig) { - if (SRB1_config->logicalChannelConfig->present == - SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { - SRB1_logicalChannelConfig = &SRB1_config->logicalChannelConfig->choice.explicitValue; - } else { - SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; - } - } else { - SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; - } - - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrc_mac_config_req_eNB(ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, -#ifdef Rel14 - 0, -#endif - ctxt_pP->rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t *) NULL, -#ifdef Rel14 - (RadioResourceConfigCommonSIB_t *) NULL, -#endif - (struct PhysicalConfigDedicated* ) ue_context_pP->ue_context.physicalConfigDedicated, -#if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, -#endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - 1, - SRB1_logicalChannelConfig, - ue_context_pP->ue_context.measGapConfig, - (TDD_Config_t *) NULL, - NULL, - (SchedulingInfoList_t *) NULL, - 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL -#if defined(Rel10) || defined(Rel14) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL -#endif -#ifdef Rel14 - ,(SystemInformationBlockType1_v1310_IEs_t *)NULL -#endif - ); - break; - } - } - } - - MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, - MSC_RRC_UE, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, - MSC_AS_TIME_FMT" RRCConnectionReestablishment UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); - - - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReestablishment (bytes %d)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); - - // activate release timer, if RRCComplete not received after 10 frames, remove UE - //ue_context_pP->ue_context.ue_release_timer = 1; - // remove UE after 10 frames after RRCConnectionReestablishmentRelease is triggered - //ue_context_pP->ue_context.ue_release_timer_thres = 100; - // activate release timer, if RRCComplete not received after 100 frames, remove UE - int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); - RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1; - // remove UE after 100 frames after RRCConnectionReestablishmentRelease is triggered - RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres = 1000; -} - -//----------------------------------------------------------------------------- -void -rrc_eNB_process_RRCConnectionReestablishmentComplete( - const protocol_ctxt_t* const ctxt_pP, - const rnti_t reestablish_rnti, - rrc_eNB_ue_context_t* ue_context_pP, - const uint8_t xid, - RRCConnectionReestablishmentComplete_r8_IEs_t * rrcConnectionReestablishmentComplete -) -//----------------------------------------------------------------------------- -{ - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel UL-DCCH, processing RRCConnectionReestablishmentComplete from UE (SRB1 Active)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - - T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - DRB_ToAddModList_t* DRB_configList = ue_context_pP->ue_context.DRB_configList; - SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; - SRB_ToAddModList_t** SRB_configList2 = NULL; - DRB_ToAddModList_t** DRB_configList2 = NULL; - struct SRB_ToAddMod *SRB2_config = NULL; - struct DRB_ToAddMod *DRB_config = NULL; - int i = 0; -# if defined(ENABLE_USE_MME) - int j = 0; - hashtable_rc_t h_rc; -#endif - uint8_t buffer[RRC_BUF_SIZE]; - uint16_t size; - MeasObjectToAddModList_t *MeasObj_list = NULL; - MeasObjectToAddMod_t *MeasObj = NULL; - ReportConfigToAddModList_t *ReportConfig_list = NULL; - ReportConfigToAddMod_t *ReportConfig_per, *ReportConfig_A1, - *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; - MeasIdToAddModList_t *MeasId_list = NULL; - MeasIdToAddMod_t *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; - RSRP_Range_t *rsrp = NULL; - struct MeasConfig__speedStatePars *Sparams = NULL; - QuantityConfig_t *quantityConfig = NULL; - CellsToAddMod_t *CellToAdd = NULL; - CellsToAddModList_t *CellsToAddModList = NULL; - struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; - DedicatedInfoNAS_t *dedicatedInfoNas = NULL; - /* for no gcc warnings */ - (void)dedicatedInfoNas; - C_RNTI_t *cba_RNTI = NULL; - uint8_t next_xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); - - ue_context_pP->ue_context.Status = RRC_CONNECTED; - - SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[xid]; - // get old configuration of SRB2 - if (*SRB_configList2 != NULL) { - LOG_D(RRC, "SRB_configList2(%p) count is %d\n SRB_configList2->list.array[0] addr is %p", - SRB_configList2, (*SRB_configList2)->list.count, (*SRB_configList2)->list.array[0]); - for (i = 0; (i < (*SRB_configList2)->list.count) && (i < 3); i++) { - if ((*SRB_configList2)->list.array[i]->srb_Identity == 2 ){ - LOG_D(RRC, "get SRB2_config from (ue_context_pP->ue_context.SRB_configList2[%d])\n", xid); - SRB2_config = (*SRB_configList2)->list.array[i]; - break; - } - } - } - SRB_configList2 = &ue_context_pP->ue_context.SRB_configList2[next_xid]; - DRB_configList2 = &ue_context_pP->ue_context.DRB_configList2[next_xid]; - - if (*SRB_configList2) { - free(*SRB_configList2); - LOG_D(RRC, "free(ue_context_pP->ue_context.SRB_configList2[%d])\n", next_xid); - } - *SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2)); - if (SRB2_config != NULL) { - // Add SRB2 to SRB configuration list - - ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); - ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config); - - LOG_D(RRC, "Add SRB2_config (srb_Identity:%ld) to ue_context_pP->ue_context.SRB_configList\n", - SRB2_config->srb_Identity); - LOG_D(RRC, "Add SRB2_config (srb_Identity:%ld) to ue_context_pP->ue_context.SRB_configList2[%d]\n", - SRB2_config->srb_Identity, next_xid); - } else { - // SRB configuration list only contains SRB1. - LOG_W(RRC,"SRB2 configuration does not exist in SRB configuration list\n"); - } - - - - if (*DRB_configList2) { - free(*DRB_configList2); - LOG_D(RRC, "free(ue_context_pP->ue_context.DRB_configList2[%d])\n", next_xid); - } - *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); - - if (DRB_configList != NULL) { - LOG_D(RRC, "get DRB_config from (ue_context_pP->ue_context.DRB_configList)\n"); - for (i = 0; (i < DRB_configList->list.count) && (i < 3); i++) { - DRB_config = DRB_configList->list.array[i]; - - // Add DRB to DRB configuration list, for RRCConnectionReconfigurationComplete - ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config); - } - } - ue_context_pP->ue_context.Srb1.Active = 1; - //ue_context_pP->ue_context.Srb2.Srb_info.Srb_id = 2; - -# if defined(ENABLE_USE_MME) - rrc_ue_s1ap_ids_t* rrc_ue_s1ap_ids_p = NULL; - uint16_t ue_initial_id = ue_context_pP->ue_context.ue_initial_id; - uint32_t eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id; - eNB_RRC_INST *rrc_instance_p = RC.rrc[ENB_INSTANCE_TO_MODULE_ID(ctxt_pP->instance)]; - if (eNB_ue_s1ap_id > 0) { - h_rc = hashtable_get(rrc_instance_p->s1ap_id2_s1ap_ids, (hash_key_t)eNB_ue_s1ap_id, (void**)&rrc_ue_s1ap_ids_p); - if (h_rc == HASH_TABLE_OK) { - rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti; - } - } - if (ue_initial_id != 0) { - h_rc = hashtable_get(rrc_instance_p->initial_id2_s1ap_ids, (hash_key_t)ue_initial_id, (void**)&rrc_ue_s1ap_ids_p); - if (h_rc == HASH_TABLE_OK) { - rrc_ue_s1ap_ids_p->ue_rnti = ctxt_pP->rnti; - } - } - - gtpv1u_enb_create_tunnel_req_t create_tunnel_req; - - /* Save e RAB information for later */ - memset(&create_tunnel_req, 0 , sizeof(create_tunnel_req)); - - for (j = 0, i = 0; i < NB_RB_MAX; i++) { - if (ue_context_pP->ue_context.e_rab[i].status == E_RAB_STATUS_ESTABLISHED) { - create_tunnel_req.eps_bearer_id[j] = ue_context_pP->ue_context.e_rab[i].param.e_rab_id; - create_tunnel_req.sgw_S1u_teid[j] = ue_context_pP->ue_context.e_rab[i].param.gtp_teid; - - memcpy(&create_tunnel_req.sgw_addr[j], - &ue_context_pP->ue_context.e_rab[i].param.sgw_addr, - sizeof(transport_layer_addr_t)); - j++; - } - } - - create_tunnel_req.rnti = ctxt_pP->rnti; // warning put zero above - create_tunnel_req.num_tunnels = j; - - gtpv1u_update_s1u_tunnel( - ctxt_pP->instance, - &create_tunnel_req, - reestablish_rnti); -#endif - /* Update RNTI in ue_context */ - ue_context_pP->ue_id_rnti = ctxt_pP->rnti; // here ue_id_rnti is just a key, may be something else - ue_context_pP->ue_context.rnti = ctxt_pP->rnti; -# if defined(ENABLE_USE_MME) - uint8_t send_security_mode_command = FALSE; - rrc_pdcp_config_security( - ctxt_pP, - ue_context_pP, - send_security_mode_command); - LOG_D(RRC, "set security successfully \n"); -#endif - // Measurement ID list - MeasId_list = CALLOC(1, sizeof(*MeasId_list)); - memset((void *)MeasId_list, 0, sizeof(*MeasId_list)); - - MeasId0 = CALLOC(1, sizeof(*MeasId0)); - MeasId0->measId = 1; - MeasId0->measObjectId = 1; - MeasId0->reportConfigId = 1; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0); - - MeasId1 = CALLOC(1, sizeof(*MeasId1)); - MeasId1->measId = 2; - MeasId1->measObjectId = 1; - MeasId1->reportConfigId = 2; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1); - - MeasId2 = CALLOC(1, sizeof(*MeasId2)); - MeasId2->measId = 3; - MeasId2->measObjectId = 1; - MeasId2->reportConfigId = 3; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2); - - MeasId3 = CALLOC(1, sizeof(*MeasId3)); - MeasId3->measId = 4; - MeasId3->measObjectId = 1; - MeasId3->reportConfigId = 4; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3); - - MeasId4 = CALLOC(1, sizeof(*MeasId4)); - MeasId4->measId = 5; - MeasId4->measObjectId = 1; - MeasId4->reportConfigId = 5; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4); - - MeasId5 = CALLOC(1, sizeof(*MeasId5)); - MeasId5->measId = 6; - MeasId5->measObjectId = 1; - MeasId5->reportConfigId = 6; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5); - - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; - - // Add one EUTRA Measurement Object - MeasObj_list = CALLOC(1, sizeof(*MeasObj_list)); - memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list)); - - // Configure MeasObject - - MeasObj = CALLOC(1, sizeof(*MeasObj)); - memset((void *)MeasObj, 0, sizeof(*MeasObj)); - - MeasObj->measObjectId = 1; - MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA; - MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 3350; //band 7, 2.68GHz - //MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; //band 33, 1.909GHz - MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25; - MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1; - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t)); - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0; - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6; - MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB - - MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = - (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); - - CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; - - // Add adjacent cell lists (6 per eNB) - for (i = 0; i < 6; i++) { - CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd)); - CellToAdd->cellIndex = i + 1; - CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i); - CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0; - - ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd); - } - - ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj); - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; - - // Report Configurations for periodical, A1-A5 events - ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list)); - - ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); - - ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1)); - - ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2)); - - ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3)); - - ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4)); - - ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5)); - - ReportConfig_per->reportConfigId = 1; - ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_periodical; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose = - ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); - - ReportConfig_A1->reportConfigId = 2; - ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. - a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. - a1_Threshold.choice.threshold_RSRP = 10; - - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1); - - if (RC.rrc[ctxt_pP->module_id]->HO_flag == 1 /*HO_MEASURMENT */ ) { - LOG_I(RRC, "[eNB %d] frame %d: requesting A2, A3, A4, A5, and A6 event reporting\n", - ctxt_pP->module_id, ctxt_pP->frame); - ReportConfig_A2->reportConfigId = 3; - ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA2.a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA2.a2_Threshold.choice.threshold_RSRP = 10; - - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = - ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2); - - ReportConfig_A3->reportConfigId = 4; - ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; - - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = 1; //10; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA3.reportOnLeave = 1; - - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = - ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.hysteresis = 0.5; // FIXME ...hysteresis is of type long! - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger = - TimeToTrigger_ms40; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3); - - ReportConfig_A4->reportConfigId = 5; - ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA4.a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA4.a4_Threshold.choice.threshold_RSRP = 10; - - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = - ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4); - - ReportConfig_A5->reportConfigId = 6; - ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA5.a5_Threshold1.choice.threshold_RSRP = 10; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA5.a5_Threshold2.choice.threshold_RSRP = 10; - - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = - ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5); - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; - - rsrp = CALLOC(1, sizeof(RSRP_Range_t)); - *rsrp = 20; - - Sparams = CALLOC(1, sizeof(*Sparams)); - Sparams->present = MeasConfig__speedStatePars_PR_setup; - Sparams->choice.setup.timeToTrigger_SF.sf_High = SpeedStateScaleFactors__sf_Medium_oDot75; - Sparams->choice.setup.timeToTrigger_SF.sf_Medium = SpeedStateScaleFactors__sf_High_oDot5; - Sparams->choice.setup.mobilityStateParameters.n_CellChangeHigh = 10; - Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5; - Sparams->choice.setup.mobilityStateParameters.t_Evaluation = MobilityStateParameters__t_Evaluation_s60; - Sparams->choice.setup.mobilityStateParameters.t_HystNormal = MobilityStateParameters__t_HystNormal_s120; - - quantityConfig = CALLOC(1, sizeof(*quantityConfig)); - memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); - quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct QuantityConfigEUTRA)); - memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA)); - quantityConfig->quantityConfigCDMA2000 = NULL; - quantityConfig->quantityConfigGERAN = NULL; - quantityConfig->quantityConfigUTRA = NULL; - quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = - CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP))); - quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = - CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ))); - *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4; - *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4; - - LOG_I(RRC, - "[eNB %d] Frame %d: potential handover preparation: store the information in an intermediate structure in case of failure\n", - ctxt_pP->module_id, ctxt_pP->frame); - // store the information in an intermediate structure for Hanodver management - //rrc_inst->handover_info.as_config.sourceRadioResourceConfig.srb_ToAddModList = CALLOC(1,sizeof()); - ue_context_pP->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_pP->ue_context.handover_info))); - //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.srb_ToAddModList,(void *)SRB_list,sizeof(SRB_ToAddModList_t)); - ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.srb_ToAddModList = *SRB_configList2; - //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.drb_ToAddModList,(void *)DRB_list,sizeof(DRB_ToAddModList_t)); - ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList = DRB_configList; - ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL; - ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig = - CALLOC(1, sizeof(*ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig)); - memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, - (void *)ue_context_pP->ue_context.mac_MainConfig, sizeof(MAC_MainConfig_t)); - ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated = - CALLOC(1, sizeof(PhysicalConfigDedicated_t)); - memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, - (void*)ue_context_pP->ue_context.physicalConfigDedicated, sizeof(PhysicalConfigDedicated_t)); - ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.sps_Config = NULL; - //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config,(void *)rrc_inst->sps_Config[ue_mod_idP],sizeof(SPS_Config_t)); - - } - -#ifdef CBA - //struct PUSCH_CBAConfigDedicated_vlola *pusch_CBAConfigDedicated_vlola; - uint8_t *cba_RNTI_buf; - cba_RNTI = CALLOC(1, sizeof(C_RNTI_t)); - cba_RNTI_buf = CALLOC(1, 2 * sizeof(uint8_t)); - cba_RNTI->buf = cba_RNTI_buf; - cba_RNTI->size = 2; - cba_RNTI->bits_unused = 0; - - // associate UEs to the CBa groups as a function of their UE id - if (rrc_inst->num_active_cba_groups) { - cba_RNTI->buf[0] = rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups] & 0xff; - cba_RNTI->buf[1] = 0xff; - LOG_D(RRC, - "[eNB %d] Frame %d: cba_RNTI = %x in group %d is attribued to UE %d\n", - enb_mod_idP, frameP, - rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups], - ue_mod_idP % rrc_inst->num_active_cba_groups, ue_mod_idP); - } else { - cba_RNTI->buf[0] = 0x0; - cba_RNTI->buf[1] = 0x0; - LOG_D(RRC, "[eNB %d] Frame %d: no cba_RNTI is configured for UE %d\n", enb_mod_idP, frameP, ue_mod_idP); - } - -#endif - -#if defined(ENABLE_ITTI) - /* Initialize NAS list */ - dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); - - /* Add all NAS PDUs to the list */ - for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { - if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { - dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); - memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); - OCTET_STRING_fromBuf(dedicatedInfoNas, - (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, - ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length); - LOG_D(RRC, "Add dedicatedInfoNas(%d) to dedicatedInfoNASList\n", i); - ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); - } - - /* TODO parameters yet to process ... */ - { - // ue_context_pP->ue_context.e_rab[i].param.qos; - // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; - // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; - } - - /* TODO should test if e RAB are Ok before! */ - ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; - LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", - i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE"); - } - - /* If list is empty free the list and reset the address */ - if (dedicatedInfoNASList->list.count == 0) { - free(dedicatedInfoNASList); - dedicatedInfoNASList = NULL; - } - -#endif - - // send RRCConnectionReconfiguration - memset(buffer, 0, RRC_BUF_SIZE); - - size = do_RRCConnectionReconfiguration(ctxt_pP, - buffer, - next_xid, //Transaction_id, - (SRB_ToAddModList_t*)*SRB_configList2, // SRB_configList - (DRB_ToAddModList_t*)DRB_configList, - (DRB_ToReleaseList_t*)NULL, // DRB2_list, - (struct SPS_Config*)NULL, // maybe ue_context_pP->ue_context.sps_Config, - (struct PhysicalConfigDedicated*)ue_context_pP->ue_context.physicalConfigDedicated, -#ifdef EXMIMO_IOT - NULL, NULL, NULL,NULL, -#else - (MeasObjectToAddModList_t*)MeasObj_list, // MeasObj_list, - (ReportConfigToAddModList_t*)ReportConfig_list, // ReportConfig_list, - (QuantityConfig_t*)quantityConfig, //quantityConfig, - (MeasIdToAddModList_t*)NULL, -#endif - (MAC_MainConfig_t*)ue_context_pP->ue_context.mac_MainConfig, - (MeasGapConfig_t*)NULL, - (MobilityControlInfo_t*)NULL, - (struct MeasConfig__speedStatePars*)Sparams, // Sparams, - (RSRP_Range_t*)rsrp, // rsrp, - (C_RNTI_t*)cba_RNTI, // cba_RNTI - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList //dedicatedInfoNASList -#if defined(Rel10) || defined(Rel14) - , (SCellToAddMod_r10_t*)NULL -#endif - ); - -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n"); - for (i = 0; i < size; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); - } - LOG_F(RRC,"\n"); - //////////////////////////////////////// -#endif - -#if defined(ENABLE_ITTI) - - /* Free all NAS PDUs */ - for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { - if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { - /* Free the NAS PDU buffer and invalidate it */ - free(ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer); - ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL; - } - } - -#endif - - LOG_I(RRC, - "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n", - ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - - LOG_D(RRC, - "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", - ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); - - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - size); - - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); - - // delete UE data of prior RNTI. UE use current RNTI. - protocol_ctxt_t ctxt_prior = *ctxt_pP; - ctxt_prior.rnti = reestablish_rnti; - - LTE_eNB_ULSCH_t *ulsch = NULL; - nfapi_ul_config_request_body_t *ul_req_tmp = NULL; - PHY_VARS_eNB *eNB_PHY = NULL; - eNB_MAC_INST *eNB_MAC = RC.mac[ctxt_prior.module_id]; - for (int CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - eNB_PHY = RC.eNB[ctxt_prior.module_id][CC_id]; - for (int i=0; iulsch[i]; - if((ulsch != NULL) && (ulsch->rnti == ctxt_prior.rnti)){ - LOG_I(RRC, "clean_eNb_ulsch UE %x \n", ctxt_prior.rnti); - clean_eNb_ulsch(ulsch); - break; - } - } - - for(int j = 0; j < 10; j++){ - ul_req_tmp = &eNB_MAC->UL_req_tmp[CC_id][j].ul_config_request_body; - if(ul_req_tmp){ - int pdu_number = ul_req_tmp->number_of_pdus; - for(int pdu_index = pdu_number-1; pdu_index >= 0; pdu_index--){ - if(ul_req_tmp->ul_config_pdu_list[pdu_index].ulsch_pdu.ulsch_pdu_rel8.rnti == ctxt_prior.rnti){ - LOG_I(RRC, "remove UE %x from ul_config_pdu_list %d/%d\n", ctxt_prior.rnti, pdu_index, pdu_number); - if(pdu_index < pdu_number -1){ - memcpy(&ul_req_tmp->ul_config_pdu_list[pdu_index], &ul_req_tmp->ul_config_pdu_list[pdu_index+1], (pdu_number-1-pdu_index) * sizeof(nfapi_ul_config_request_pdu_t)); - } - ul_req_tmp->number_of_pdus--; - } - } - } - } - } - rrc_mac_remove_ue(ctxt_prior.module_id, ctxt_prior.rnti); - rrc_rlc_remove_ue(&ctxt_prior); - pdcp_remove_UE(&ctxt_prior); -} - -//----------------------------------------------------------------------------- -void -rrc_eNB_generate_RRCConnectionReestablishmentReject( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - const int CC_id -) -//----------------------------------------------------------------------------- -{ -#ifdef RRC_MSG_PRINT - int cnt; -#endif - int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); - RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 1; - RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer_thres = 20; - - T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REJECT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size = - do_RRCConnectionReestablishmentReject(ctxt_pP->module_id, - (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload); - -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRCConnectionReestablishmentReject\n"); - - for (cnt = 0; cnt < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) { - LOG_F(RRC,"%02x ", ((uint8_t*)RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload)[cnt]); - } - - LOG_F(RRC,"\n"); -#endif - - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, - MSC_AS_TIME_FMT" RRCConnectionReestablishmentReject UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP == NULL ? -1 : ue_context_pP->ue_context.rnti, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); - - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionReestablishmentReject (bytes %d)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); -} - -//----------------------------------------------------------------------------- -void -rrc_eNB_generate_RRCConnectionRelease( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP -) -//----------------------------------------------------------------------------- -{ - - uint8_t buffer[RRC_BUF_SIZE]; - uint16_t size; - - T(T_ENB_RRC_CONNECTION_RELEASE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - memset(buffer, 0, RRC_BUF_SIZE); - - size = do_RRCConnectionRelease(ctxt_pP->module_id, buffer,rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id)); - // set release timer - //ue_context_pP->ue_context.ue_release_timer=1; - // remove UE after 10 frames after RRCConnectionRelease is triggered - //ue_context_pP->ue_context.ue_release_timer_thres=100; - // set release timer - ue_context_pP->ue_context.ue_release_timer_rrc = 1; - // remove UE after 10 frames after RRCConnectionRelease is triggered - ue_context_pP->ue_context.ue_release_timer_thres_rrc = 100; - ue_context_pP->ue_context.ue_reestablishment_timer = 0; - ue_context_pP->ue_context.ue_release_timer = 0; - ue_context_pP->ue_context.ue_release_timer_s1 = 0; - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" Logical Channel DL-DCCH, Generate RRCConnectionRelease (bytes %d)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - size); - - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" --- PDCP_DATA_REQ/%d Bytes (rrcConnectionRelease MUI %d) --->[PDCP][RB %u]\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - size, - rrc_eNB_mui, - DCCH); - - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" rrcConnectionRelease UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - size); - - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); -} - -uint8_t qci_to_priority[9]={2,4,3,5,1,6,7,8,9}; - -// TBD: this directive can be remived if we create a similar e_rab_param_t structure in RRC context -#if defined(ENABLE_ITTI) -//----------------------------------------------------------------------------- -void -rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - const uint8_t ho_state - ) -//----------------------------------------------------------------------------- -{ - - uint8_t buffer[RRC_BUF_SIZE]; - uint16_t size; - int i; - - struct DRB_ToAddMod *DRB_config = NULL; - struct RLC_Config *DRB_rlc_config = NULL; - struct PDCP_Config *DRB_pdcp_config = NULL; - struct PDCP_Config__rlc_AM *PDCP_rlc_AM = NULL; - struct PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; - struct LogicalChannelConfig *DRB_lchan_config = NULL; - struct LogicalChannelConfig__ul_SpecificParameters - *DRB_ul_SpecificParameters = NULL; - // DRB_ToAddModList_t** DRB_configList=&ue_context_pP->ue_context.DRB_configList; - DRB_ToAddModList_t* DRB_configList=ue_context_pP->ue_context.DRB_configList; - DRB_ToAddModList_t** DRB_configList2=NULL; - //DRB_ToAddModList_t** RRC_DRB_configList=&ue_context_pP->ue_context.DRB_configList; - - struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; - DedicatedInfoNAS_t *dedicatedInfoNas = NULL; - /* for no gcc warnings */ - (void)dedicatedInfoNas; - - long *logicalchannelgroup_drb; -// int drb_identity_index=0; - - uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); //Transaction_id, - DRB_configList2=&ue_context_pP->ue_context.DRB_configList2[xid]; - if (*DRB_configList2) { - free(*DRB_configList2); - } - //*DRB_configList = CALLOC(1, sizeof(*DRB_configList)); - *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); - /* Initialize NAS list */ - dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); - - int e_rab_done=0; - - for ( i = 0 ; - i < ue_context_pP->ue_context.setup_e_rabs ; - i++){ - - if (e_rab_done >= ue_context_pP->ue_context.nb_of_e_rabs){ - break; - } - - // bypass the new and already configured erabs - if (ue_context_pP->ue_context.e_rab[i].status >= E_RAB_STATUS_DONE) { -// drb_identity_index++; - continue; - } - - DRB_config = CALLOC(1, sizeof(*DRB_config)); - - DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long)); - // allowed value 5..15, value : x+4 - *(DRB_config->eps_BearerIdentity) = ue_context_pP->ue_context.e_rab[i].param.e_rab_id;//+ 4; // especial case generation - - // DRB_config->drb_Identity = 1 + drb_identity_index + e_rab_done;// + i ;// (DRB_Identity_t) ue_context_pP->ue_context.e_rab[i].param.e_rab_id; - // 1 + drb_identiy_index; - DRB_config->drb_Identity = i+1; - - DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long)); - *(DRB_config->logicalChannelIdentity) = DRB_config->drb_Identity + 2; //(long) (ue_context_pP->ue_context.e_rab[i].param.e_rab_id + 2); // value : x+2 - - DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config)); - DRB_config->rlc_Config = DRB_rlc_config; - - DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); - DRB_config->pdcp_Config = DRB_pdcp_config; - DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long)); - *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity; - DRB_pdcp_config->rlc_AM = NULL; - DRB_pdcp_config->rlc_UM = NULL; - - - switch (ue_context_pP->ue_context.e_rab[i].param.qos.qci){ - /* - * type: realtime data with medium packer error rate - * action: swtich to RLC UM - */ - case 1: // 100ms, 10^-2, p2, GBR - case 2: // 150ms, 10^-3, p4, GBR - case 3: // 50ms, 10^-3, p3, GBR - case 4: // 300ms, 10^-6, p5 - case 7: // 100ms, 10^-3, p7, GBR - case 9: // 300ms, 10^-6, p9 - case 65: // 75ms, 10^-2, p0.7, mission critical voice, GBR - case 66: // 100ms, 10^-2, p2, non-mission critical voice , GBR - // RLC - DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; - DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; - // PDCP - PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); - DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; - PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; - break; - - /* - * type: non-realtime data with low packer error rate - * action: swtich to RLC AM - */ - case 5: // 100ms, 10^-6, p1 , IMS signaling - case 6: // 300ms, 10^-6, p6 - case 8: // 300ms, 10^-6, p8 - case 69: // 60ms, 10^-6, p0.5, mission critical delay sensitive data, Lowest Priority - case 70: // 200ms, 10^-6, p5.5, mision critical data - // RLC - DRB_rlc_config->present = RLC_Config_PR_am; - DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50; - DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16; - DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; - DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; - DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; - DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25; - - // PDCP - PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); - DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; - PDCP_rlc_AM->statusReportRequired = FALSE; - - break; - default : - LOG_E(RRC,"not supported qci %d\n", ue_context_pP->ue_context.e_rab[i].param.qos.qci); - ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_FAILED; - ue_context_pP->ue_context.e_rab[i].xid = xid; - e_rab_done++; - continue; - } - - DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; - - DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config)); - DRB_config->logicalChannelConfig = DRB_lchan_config; - DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); - DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; - - if (ue_context_pP->ue_context.e_rab[i].param.qos.qci < 9 ) - DRB_ul_SpecificParameters->priority = qci_to_priority[ue_context_pP->ue_context.e_rab[i].param.qos.qci-1] + 3; - // ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.priority_level; - else - DRB_ul_SpecificParameters->priority= 4; - - DRB_ul_SpecificParameters->prioritisedBitRate = LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8; - //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; - DRB_ul_SpecificParameters->bucketSizeDuration = - LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - - logicalchannelgroup_drb = CALLOC(1, sizeof(long)); - *logicalchannelgroup_drb = 1;//(i+1) % 3; - DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; - - ASN_SEQUENCE_ADD(&DRB_configList->list, DRB_config); - ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config); - //ue_context_pP->ue_context.DRB_configList2[drb_identity_index] = &(*DRB_configList); - - LOG_I(RRC,"EPS ID %ld, DRB ID %ld (index %d), QCI %d, priority %ld, LCID %ld LCGID %ld \n", - *DRB_config->eps_BearerIdentity, - DRB_config->drb_Identity, i, - ue_context_pP->ue_context.e_rab[i].param.qos.qci, - DRB_ul_SpecificParameters->priority, - *(DRB_config->logicalChannelIdentity), - *DRB_ul_SpecificParameters->logicalChannelGroup - ); - - e_rab_done++; - ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; - ue_context_pP->ue_context.e_rab[i].xid = xid; - - { - if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { - dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); - memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); - OCTET_STRING_fromBuf(dedicatedInfoNas, - (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, - ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length); - ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); - LOG_I(RRC,"add NAS info with size %d (rab id %d)\n",ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length, i); - } - else { - LOG_W(RRC,"Not received activate dedicated EPS bearer context request\n"); - } - /* TODO parameters yet to process ... */ - { - // ue_context_pP->ue_context.e_rab[i].param.qos; - // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; - // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; - } - } - - } - - /* If list is empty free the list and reset the address */ - if (dedicatedInfoNASList != NULL) { - if (dedicatedInfoNASList->list.count == 0) { - free(dedicatedInfoNASList); - dedicatedInfoNASList = NULL; - LOG_W(RRC,"dedlicated NAS list is empty, free the list and reset the address\n"); - } - } else { - LOG_W(RRC,"dedlicated NAS list is empty\n"); - } - - memset(buffer, 0, RRC_BUF_SIZE); - - size = do_RRCConnectionReconfiguration(ctxt_pP, - buffer, - xid, - (SRB_ToAddModList_t*)NULL, - (DRB_ToAddModList_t*)*DRB_configList2, - (DRB_ToReleaseList_t*)NULL, // DRB2_list, - (struct SPS_Config*)NULL, // *sps_Config, - NULL, NULL, NULL, NULL,NULL, - NULL, NULL, NULL, NULL, NULL, NULL, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList -#if defined(Rel10) || defined(Rel14) - , (SCellToAddMod_r10_t*)NULL -#endif - ); - - -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n"); - for (i = 0; i < size; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); - } - LOG_F(RRC,"\n"); - //////////////////////////////////////// -#endif - -#if defined(ENABLE_ITTI) - - /* Free all NAS PDUs */ - for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { - if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { - /* Free the NAS PDU buffer and invalidate it */ - free(ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer); - ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL; - } - } -#endif - - LOG_I(RRC, - "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE RNTI %x)\n", - ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - - LOG_D(RRC, - "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", - ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); - - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" dedicated rrcConnectionReconfiguration UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - size); - - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); - - -} -int -rrc_eNB_modify_dedicatedRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - const uint8_t ho_state - ) -//----------------------------------------------------------------------------- -{ - uint8_t buffer[RRC_BUF_SIZE]; - uint16_t size; - int i, j; - - struct DRB_ToAddMod *DRB_config = NULL; - struct RLC_Config *DRB_rlc_config = NULL; - struct PDCP_Config *DRB_pdcp_config = NULL; - struct PDCP_Config__rlc_AM *PDCP_rlc_AM = NULL; - struct PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; - struct LogicalChannelConfig *DRB_lchan_config = NULL; - struct LogicalChannelConfig__ul_SpecificParameters - *DRB_ul_SpecificParameters = NULL; - DRB_ToAddModList_t* DRB_configList = ue_context_pP->ue_context.DRB_configList; - DRB_ToAddModList_t* DRB_configList2 = NULL; - - struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; - DedicatedInfoNAS_t *dedicatedInfoNas = NULL; - /* for no gcc warnings */ - (void)dedicatedInfoNas; - - uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); // Transaction_id, - DRB_configList2 = CALLOC(1, sizeof(*DRB_configList2)); - /* Initialize NAS list */ - dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); - - for (i = 0; i < ue_context_pP->ue_context.nb_of_modify_e_rabs; i++) { - // bypass the new and already configured erabs - if (ue_context_pP->ue_context.modify_e_rab[i].status >= E_RAB_STATUS_DONE) { - ue_context_pP->ue_context.modify_e_rab[i].xid = xid; - continue; - } - - if (ue_context_pP->ue_context.modify_e_rab[i].cause != S1AP_CAUSE_NOTHING) { - // set xid of failure RAB - ue_context_pP->ue_context.modify_e_rab[i].xid = xid; - ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_FAILED; - continue; - } - - DRB_config = NULL; - // search exist DRB_config - for (j = 0; j < DRB_configList->list.count; j++) { - if((uint8_t)*(DRB_configList->list.array[j]->eps_BearerIdentity) == ue_context_pP->ue_context.modify_e_rab[i].param.e_rab_id) { - DRB_config = DRB_configList->list.array[j]; - break; - } - } - if (NULL == DRB_config) { - ue_context_pP->ue_context.modify_e_rab[i].xid = xid; - ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_FAILED; - // TODO use which cause - ue_context_pP->ue_context.modify_e_rab[i].cause = S1AP_CAUSE_RADIO_NETWORK; - ue_context_pP->ue_context.modify_e_rab[i].cause_value = 0;//S1ap_CauseRadioNetwork_unspecified; - ue_context_pP->ue_context.nb_of_failed_e_rabs++; - continue; - } - - DRB_rlc_config = DRB_config->rlc_Config; - - DRB_pdcp_config = DRB_config->pdcp_Config; - *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity; - switch (ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci) { - /* - * type: realtime data with medium packer error rate - * action: swtich to RLC UM - */ - case 1: // 100ms, 10^-2, p2, GBR - case 2: // 150ms, 10^-3, p4, GBR - case 3: // 50ms, 10^-3, p3, GBR - case 4: // 300ms, 10^-6, p5 - case 7: // 100ms, 10^-3, p7, GBR - case 9: // 300ms, 10^-6, p9 - case 65: // 75ms, 10^-2, p0.7, mission critical voice, GBR - case 66: // 100ms, 10^-2, p2, non-mission critical voice , GBR - // RLC - DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; - DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; - // PDCP - if (DRB_pdcp_config->rlc_AM) { - free(DRB_pdcp_config->rlc_AM); - DRB_pdcp_config->rlc_AM = NULL; - } - if (DRB_pdcp_config->rlc_UM) { - free(DRB_pdcp_config->rlc_UM); - DRB_pdcp_config->rlc_UM = NULL; - } - PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); - DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; - PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; - break; - - /* - * type: non-realtime data with low packer error rate - * action: swtich to RLC AM - */ - case 5: // 100ms, 10^-6, p1 , IMS signaling - case 6: // 300ms, 10^-6, p6 - case 8: // 300ms, 10^-6, p8 - case 69: // 60ms, 10^-6, p0.5, mission critical delay sensitive data, Lowest Priority - case 70: // 200ms, 10^-6, p5.5, mision critical data - // RLC - DRB_rlc_config->present = RLC_Config_PR_am; - DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50; - DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16; - DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; - DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; - DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; - DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25; - - // PDCP - if (DRB_pdcp_config->rlc_AM) { - free(DRB_pdcp_config->rlc_AM); - DRB_pdcp_config->rlc_AM = NULL; - } - if (DRB_pdcp_config->rlc_UM) { - free(DRB_pdcp_config->rlc_UM); - DRB_pdcp_config->rlc_UM = NULL; - } - PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); - DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; - PDCP_rlc_AM->statusReportRequired = FALSE; - - break; - default : - LOG_E(RRC, "not supported qci %d\n", ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci); - ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_FAILED; - ue_context_pP->ue_context.modify_e_rab[i].xid = xid; - ue_context_pP->ue_context.modify_e_rab[i].cause = S1AP_CAUSE_RADIO_NETWORK; - ue_context_pP->ue_context.modify_e_rab[i].cause_value = 37;//S1ap_CauseRadioNetwork_not_supported_QCI_value; - ue_context_pP->ue_context.nb_of_failed_e_rabs++; - continue; - } - - DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; - - DRB_lchan_config = DRB_config->logicalChannelConfig; - DRB_ul_SpecificParameters = DRB_lchan_config->ul_SpecificParameters; - - if (ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci < 9 ) - DRB_ul_SpecificParameters->priority = qci_to_priority[ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci-1] + 3; - else - DRB_ul_SpecificParameters->priority= 4; - - DRB_ul_SpecificParameters->prioritisedBitRate = LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8; - - DRB_ul_SpecificParameters->bucketSizeDuration = - LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - - ASN_SEQUENCE_ADD(&(DRB_configList2)->list, DRB_config); - - LOG_I(RRC, "EPS ID %ld, DRB ID %ld (index %d), QCI %d, priority %ld, LCID %ld LCGID %ld \n", - *DRB_config->eps_BearerIdentity, - DRB_config->drb_Identity, i, - ue_context_pP->ue_context.modify_e_rab[i].param.qos.qci, - DRB_ul_SpecificParameters->priority, - *(DRB_config->logicalChannelIdentity), - *DRB_ul_SpecificParameters->logicalChannelGroup - ); - - //e_rab_done++; - ue_context_pP->ue_context.modify_e_rab[i].status = E_RAB_STATUS_DONE; - ue_context_pP->ue_context.modify_e_rab[i].xid = xid; - - { - if (ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer != NULL) { - dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); - memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); - OCTET_STRING_fromBuf(dedicatedInfoNas, - (char*)ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer, - ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.length); - ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); - LOG_I(RRC, "add NAS info with size %d (rab id %d)\n",ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.length, i); - } - else { - LOG_W(RRC, "Not received activate dedicated EPS bearer context request\n"); - } - } - } - - /* If list is empty free the list and reset the address */ - if (dedicatedInfoNASList != NULL) { - if (dedicatedInfoNASList->list.count == 0) { - free(dedicatedInfoNASList); - dedicatedInfoNASList = NULL; - LOG_W(RRC,"dedlicated NAS list is empty, free the list and reset the address\n"); - } - } else { - LOG_W(RRC,"dedlicated NAS list is empty\n"); - } - - memset(buffer, 0, RRC_BUF_SIZE); - - size = do_RRCConnectionReconfiguration(ctxt_pP, - buffer, - xid, - (SRB_ToAddModList_t*)NULL, - (DRB_ToAddModList_t*)DRB_configList2, - (DRB_ToReleaseList_t*)NULL, // DRB2_list, - (struct SPS_Config*)NULL, // *sps_Config, - NULL, NULL, NULL, NULL,NULL, - NULL, NULL, NULL, NULL, NULL, NULL, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList -#if defined(Rel10) || defined(Rel14) - , (SCellToAddMod_r10_t*)NULL -#endif - ); - - -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n"); - for (i = 0; i < size; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); - } - LOG_F(RRC,"\n"); - //////////////////////////////////////// -#endif - -#if defined(ENABLE_ITTI) - - /* Free all NAS PDUs */ - for (i = 0; i < ue_context_pP->ue_context.nb_of_modify_e_rabs; i++) { - if (ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer != NULL) { - /* Free the NAS PDU buffer and invalidate it */ - free(ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer); - ue_context_pP->ue_context.modify_e_rab[i].param.nas_pdu.buffer = NULL; - } - } -#endif - - LOG_I(RRC, - "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE RNTI %x)\n", - ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - - LOG_D(RRC, - "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", - ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); - - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" dedicated rrcConnectionReconfiguration UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - size); - - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); - return 0; -} - -//----------------------------------------------------------------------------- -void -rrc_eNB_generate_dedicatedRRCConnectionReconfiguration_release( const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - uint8_t xid, - uint32_t nas_length, - uint8_t* nas_buffer) -//----------------------------------------------------------------------------- -{ - uint8_t buffer[RRC_BUF_SIZE]; - int i; - uint16_t size = 0; - DRB_ToReleaseList_t** DRB_Release_configList2=NULL; - DRB_Identity_t* DRB_release; - struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; - - DRB_Release_configList2=&ue_context_pP->ue_context.DRB_Release_configList2[xid]; - if (*DRB_Release_configList2) { - free(*DRB_Release_configList2); - } - *DRB_Release_configList2 = CALLOC(1, sizeof(**DRB_Release_configList2)); - - for(i = 0; i < NB_RB_MAX; i++){ - if((ue_context_pP->ue_context.e_rab[i].status == E_RAB_STATUS_TORELEASE) && ue_context_pP->ue_context.e_rab[i].xid == xid){ - DRB_release = CALLOC(1, sizeof(DRB_Identity_t)); - *DRB_release = i+1; - ASN_SEQUENCE_ADD(&(*DRB_Release_configList2)->list, DRB_release); - //free(DRB_release); - } - } - - /* If list is empty free the list and reset the address */ - if (nas_length > 0) { - DedicatedInfoNAS_t *dedicatedInfoNas = NULL; - dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); - dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); - memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); - OCTET_STRING_fromBuf(dedicatedInfoNas, - (char*)nas_buffer, - nas_length); - ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); - LOG_I(RRC,"add NAS info with size %d\n",nas_length); - } else { - LOG_W(RRC,"dedlicated NAS list is empty\n"); - } - - memset(buffer, 0, RRC_BUF_SIZE); - size = do_RRCConnectionReconfiguration(ctxt_pP, - buffer, - xid, - NULL, - NULL, - (DRB_ToReleaseList_t*)*DRB_Release_configList2, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - NULL, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList -#if defined(Rel10) || defined(Rel14) - , (SCellToAddMod_r10_t*)NULL -#endif - ); - ue_context_pP->ue_context.e_rab_release_command_flag = 1; - -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n"); - for (i = 0; i < size; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); - } - LOG_F(RRC,"\n"); - //////////////////////////////////////// -#endif - -#if defined(ENABLE_ITTI) - /* Free all NAS PDUs */ - if (nas_length > 0) { - /* Free the NAS PDU buffer and invalidate it */ - free(nas_buffer); - } -#endif - - LOG_I(RRC, - "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE RNTI %x)\n", - ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - - LOG_D(RRC, - "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", - ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); - - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" dedicated rrcConnectionReconfiguration UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - size); - - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); - -} -#endif -//----------------------------------------------------------------------------- -void -rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - const uint8_t ho_state - ) -//----------------------------------------------------------------------------- -{ - uint8_t buffer[RRC_BUF_SIZE]; - uint16_t size; - int i; - - // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE - eNB_RRC_INST* rrc_inst = RC.rrc[ctxt_pP->module_id]; - struct PhysicalConfigDedicated** physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; - - struct SRB_ToAddMod *SRB2_config = NULL; - struct SRB_ToAddMod__rlc_Config *SRB2_rlc_config = NULL; - struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config = NULL; - struct LogicalChannelConfig__ul_SpecificParameters - *SRB2_ul_SpecificParameters = NULL; - SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; - SRB_ToAddModList_t **SRB_configList2 = NULL; - - struct DRB_ToAddMod *DRB_config = NULL; - struct RLC_Config *DRB_rlc_config = NULL; - struct PDCP_Config *DRB_pdcp_config = NULL; - struct PDCP_Config__rlc_AM *PDCP_rlc_AM = NULL; - struct PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; - struct LogicalChannelConfig *DRB_lchan_config = NULL; - struct LogicalChannelConfig__ul_SpecificParameters - *DRB_ul_SpecificParameters = NULL; - DRB_ToAddModList_t** DRB_configList = &ue_context_pP->ue_context.DRB_configList; - DRB_ToAddModList_t** DRB_configList2 = NULL; - MAC_MainConfig_t *mac_MainConfig = NULL; - MeasObjectToAddModList_t *MeasObj_list = NULL; - MeasObjectToAddMod_t *MeasObj = NULL; - ReportConfigToAddModList_t *ReportConfig_list = NULL; - ReportConfigToAddMod_t *ReportConfig_per, *ReportConfig_A1, - *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; - MeasIdToAddModList_t *MeasId_list = NULL; - MeasIdToAddMod_t *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; -#if defined(Rel10) || defined(Rel14) - long *sr_ProhibitTimer_r9 = NULL; - // uint8_t sCellIndexToAdd = rrc_find_free_SCell_index(enb_mod_idP, ue_mod_idP, 1); - //uint8_t sCellIndexToAdd = 0; -#endif - - long *logicalchannelgroup, *logicalchannelgroup_drb; - long *maxHARQ_Tx, *periodicBSR_Timer; - - RSRP_Range_t *rsrp = NULL; - struct MeasConfig__speedStatePars *Sparams = NULL; - QuantityConfig_t *quantityConfig = NULL; - CellsToAddMod_t *CellToAdd = NULL; - CellsToAddModList_t *CellsToAddModList = NULL; - struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; - DedicatedInfoNAS_t *dedicatedInfoNas = NULL; - /* for no gcc warnings */ - (void)dedicatedInfoNas; - - C_RNTI_t *cba_RNTI = NULL; - - uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); //Transaction_id, - -#ifdef CBA - //struct PUSCH_CBAConfigDedicated_vlola *pusch_CBAConfigDedicated_vlola; - uint8_t *cba_RNTI_buf; - cba_RNTI = CALLOC(1, sizeof(C_RNTI_t)); - cba_RNTI_buf = CALLOC(1, 2 * sizeof(uint8_t)); - cba_RNTI->buf = cba_RNTI_buf; - cba_RNTI->size = 2; - cba_RNTI->bits_unused = 0; - - // associate UEs to the CBa groups as a function of their UE id - if (rrc_inst->num_active_cba_groups) { - cba_RNTI->buf[0] = rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups] & 0xff; - cba_RNTI->buf[1] = 0xff; - LOG_D(RRC, - "[eNB %d] Frame %d: cba_RNTI = %x in group %d is attribued to UE %d\n", - enb_mod_idP, frameP, - rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups], - ue_mod_idP % rrc_inst->num_active_cba_groups, ue_mod_idP); - } else { - cba_RNTI->buf[0] = 0x0; - cba_RNTI->buf[1] = 0x0; - LOG_D(RRC, "[eNB %d] Frame %d: no cba_RNTI is configured for UE %d\n", enb_mod_idP, frameP, ue_mod_idP); - } - -#endif - - T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - // Configure SRB2 - /// SRB2 - SRB_configList2=&ue_context_pP->ue_context.SRB_configList2[xid]; - if (*SRB_configList2) { - free(*SRB_configList2); - } - *SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2)); - memset(*SRB_configList2, 0, sizeof(**SRB_configList2)); - SRB2_config = CALLOC(1, sizeof(*SRB2_config)); - - SRB2_config->srb_Identity = 2; - SRB2_rlc_config = CALLOC(1, sizeof(*SRB2_rlc_config)); - SRB2_config->rlc_Config = SRB2_rlc_config; - - SRB2_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; - SRB2_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t32; - SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; - SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; - - SRB2_lchan_config = CALLOC(1, sizeof(*SRB2_lchan_config)); - SRB2_config->logicalChannelConfig = SRB2_lchan_config; - - SRB2_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; - - SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters)); - - SRB2_ul_SpecificParameters->priority = 3; // let some priority for SRB1 and dedicated DRBs - SRB2_ul_SpecificParameters->prioritisedBitRate = - LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; - SRB2_ul_SpecificParameters->bucketSizeDuration = - LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - - // LCG for CCCH and DCCH is 0 as defined in 36331 - logicalchannelgroup = CALLOC(1, sizeof(long)); - *logicalchannelgroup = 0; - - SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; - - SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters; - // this list has the configuration for SRB1 and SRB2 - ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); - // this list has only the configuration for SRB2 - ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config); - - // Configure DRB - //*DRB_configList = CALLOC(1, sizeof(*DRB_configList)); - // list for all the configured DRB - if (*DRB_configList) { - free(*DRB_configList); - } - *DRB_configList = CALLOC(1, sizeof(**DRB_configList)); - memset(*DRB_configList, 0, sizeof(**DRB_configList)); - - // list for the configured DRB for a this xid - DRB_configList2=&ue_context_pP->ue_context.DRB_configList2[xid]; - if (*DRB_configList2) { - free(*DRB_configList2); - } - *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); - memset(*DRB_configList2, 0, sizeof(**DRB_configList2)); - - - /// DRB - DRB_config = CALLOC(1, sizeof(*DRB_config)); - - DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long)); - *(DRB_config->eps_BearerIdentity) = 5L; // LW set to first value, allowed value 5..15, value : x+4 - // DRB_config->drb_Identity = (DRB_Identity_t) 1; //allowed values 1..32 - // NN: this is the 1st DRB for this ue, so set it to 1 - DRB_config->drb_Identity = (DRB_Identity_t) 1; // (ue_mod_idP+1); //allowed values 1..32, value: x - DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long)); - *(DRB_config->logicalChannelIdentity) = (long)3; // value : x+2 - DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config)); - DRB_config->rlc_Config = DRB_rlc_config; - -#ifdef RRC_DEFAULT_RAB_IS_AM - DRB_rlc_config->present = RLC_Config_PR_am; - DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50; - DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16; - DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; - DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; - DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; - DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25; -#else - DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; - DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; -#ifdef CBA - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms5;//T_Reordering_ms25; -#else - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; -#endif -#endif - - DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); - DRB_config->pdcp_Config = DRB_pdcp_config; - DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long)); - *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity; - DRB_pdcp_config->rlc_AM = NULL; - DRB_pdcp_config->rlc_UM = NULL; - - /* avoid gcc warnings */ - (void)PDCP_rlc_AM; - (void)PDCP_rlc_UM; - -#ifdef RRC_DEFAULT_RAB_IS_AM // EXMIMO_IOT - PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); - DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; - PDCP_rlc_AM->statusReportRequired = FALSE; -#else - PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); - DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; - PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; -#endif - DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; - - DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config)); - DRB_config->logicalChannelConfig = DRB_lchan_config; - DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); - DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; - - DRB_ul_SpecificParameters->priority = 12; // lower priority than srb1, srb2 and other dedicated bearer - DRB_ul_SpecificParameters->prioritisedBitRate =LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ; - //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; - DRB_ul_SpecificParameters->bucketSizeDuration = - LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - - // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM) - logicalchannelgroup_drb = CALLOC(1, sizeof(long)); - *logicalchannelgroup_drb = 1; - DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; - - ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config); - ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config); - - //ue_context_pP->ue_context.DRB_configList2[0] = &(*DRB_configList); - - mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig)); - ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig; - - mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config)); - - maxHARQ_Tx = CALLOC(1, sizeof(long)); - *maxHARQ_Tx = MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; - mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx; - periodicBSR_Timer = CALLOC(1, sizeof(long)); - *periodicBSR_Timer = PeriodicBSR_Timer_r12_sf64; - mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer; - mac_MainConfig->ul_SCH_Config->retxBSR_Timer = RetxBSR_Timer_r12_sf320; - mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE - - mac_MainConfig->timeAlignmentTimerDedicated = TimeAlignmentTimer_infinity; - - mac_MainConfig->drx_Config = NULL; - - mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config)); - - mac_MainConfig->phr_Config->present = MAC_MainConfig__phr_Config_PR_setup; - mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes - - mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes - - mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB - -#if defined(Rel10) || defined(Rel14) - sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long)); - *sr_ProhibitTimer_r9 = 0; // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR - mac_MainConfig->ext1 = CALLOC(1, sizeof(struct MAC_MainConfig__ext1)); - mac_MainConfig->ext1->sr_ProhibitTimer_r9 = sr_ProhibitTimer_r9; - //sps_RA_ConfigList_rlola = NULL; -#endif - - //change the transmission mode for the primary component carrier - //TODO: add codebook subset restriction here - //TODO: change TM for secondary CC in SCelltoaddmodlist - if (*physicalConfigDedicated) { - if ((*physicalConfigDedicated)->antennaInfo) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.transmissionMode = rrc_inst->configuration.ue_TransmissionMode[0]; - LOG_D(RRC,"Setting transmission mode to %ld+1\n",rrc_inst->configuration.ue_TransmissionMode[0]); - if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm3) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6; - } - else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2; - - } - else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4; - } - else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4; - } - } - else { - LOG_E(RRC,"antenna_info not present in physical_config_dedicated. Not reconfiguring!\n"); - } - if ((*physicalConfigDedicated)->cqi_ReportConfig) { - if ((rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) || - (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) || - (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6)) { - //feedback mode needs to be set as well - //TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable - printf("setting cqi reporting mode to rm31\n"); -#if defined(Rel10) || defined(Rel14) - *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportModeAperiodic_rm31; -#else - *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportConfig__cqi_ReportModeAperiodic_rm31; // HLC CQI, no PMI -#endif - } - } - else { - LOG_E(RRC,"cqi_ReportConfig not present in physical_config_dedicated. Not reconfiguring!\n"); - } - } - else { - LOG_E(RRC,"physical_config_dedicated not present in RRCConnectionReconfiguration. Not reconfiguring!\n"); - } - - // Measurement ID list - MeasId_list = CALLOC(1, sizeof(*MeasId_list)); - memset((void *)MeasId_list, 0, sizeof(*MeasId_list)); - - MeasId0 = CALLOC(1, sizeof(*MeasId0)); - MeasId0->measId = 1; - MeasId0->measObjectId = 1; - MeasId0->reportConfigId = 1; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0); - - MeasId1 = CALLOC(1, sizeof(*MeasId1)); - MeasId1->measId = 2; - MeasId1->measObjectId = 1; - MeasId1->reportConfigId = 2; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1); - - MeasId2 = CALLOC(1, sizeof(*MeasId2)); - MeasId2->measId = 3; - MeasId2->measObjectId = 1; - MeasId2->reportConfigId = 3; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2); - - MeasId3 = CALLOC(1, sizeof(*MeasId3)); - MeasId3->measId = 4; - MeasId3->measObjectId = 1; - MeasId3->reportConfigId = 4; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3); - - MeasId4 = CALLOC(1, sizeof(*MeasId4)); - MeasId4->measId = 5; - MeasId4->measObjectId = 1; - MeasId4->reportConfigId = 5; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4); - - MeasId5 = CALLOC(1, sizeof(*MeasId5)); - MeasId5->measId = 6; - MeasId5->measObjectId = 1; - MeasId5->reportConfigId = 6; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5); - - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; - - // Add one EUTRA Measurement Object - MeasObj_list = CALLOC(1, sizeof(*MeasObj_list)); - memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list)); - - // Configure MeasObject - - MeasObj = CALLOC(1, sizeof(*MeasObj)); - memset((void *)MeasObj, 0, sizeof(*MeasObj)); - - MeasObj->measObjectId = 1; - MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA; - MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 3350; //band 7, 2.68GHz - //MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; //band 33, 1.909GHz - MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25; - MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1; - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t)); - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0; - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6; - MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB - - MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = - (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); - - CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; - - // Add adjacent cell lists (6 per eNB) - for (i = 0; i < 6; i++) { - CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd)); - CellToAdd->cellIndex = i + 1; - CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i); - CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0; - - ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd); - } - - ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj); - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; - - // Report Configurations for periodical, A1-A5 events - ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list)); - - ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); - - ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1)); - - ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2)); - - ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3)); - - ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4)); - - ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5)); - - ReportConfig_per->reportConfigId = 1; - ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_periodical; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose = - ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); - - ReportConfig_A1->reportConfigId = 2; - ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. - a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. - a1_Threshold.choice.threshold_RSRP = 10; - - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1); - - if (ho_state == 1 /*HO_MEASURMENT */ ) { - LOG_I(RRC, "[eNB %d] frame %d: requesting A2, A3, A4, A5, and A6 event reporting\n", - ctxt_pP->module_id, ctxt_pP->frame); - ReportConfig_A2->reportConfigId = 3; - ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA2.a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA2.a2_Threshold.choice.threshold_RSRP = 10; - - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = - ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2); - - ReportConfig_A3->reportConfigId = 4; - ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; - - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = 1; //10; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA3.reportOnLeave = 1; - - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = - ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.hysteresis = 0.5; // FIXME ...hysteresis is of type long! - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger = - TimeToTrigger_ms40; - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3); - - ReportConfig_A4->reportConfigId = 5; - ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA4.a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA4.a4_Threshold.choice.threshold_RSRP = 10; - - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = - ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4); - - ReportConfig_A5->reportConfigId = 6; - ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA5.a5_Threshold1.choice.threshold_RSRP = 10; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA5.a5_Threshold2.choice.threshold_RSRP = 10; - - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = - ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5); - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; - - rsrp = CALLOC(1, sizeof(RSRP_Range_t)); - *rsrp = 20; - - Sparams = CALLOC(1, sizeof(*Sparams)); - Sparams->present = MeasConfig__speedStatePars_PR_setup; - Sparams->choice.setup.timeToTrigger_SF.sf_High = SpeedStateScaleFactors__sf_Medium_oDot75; - Sparams->choice.setup.timeToTrigger_SF.sf_Medium = SpeedStateScaleFactors__sf_High_oDot5; - Sparams->choice.setup.mobilityStateParameters.n_CellChangeHigh = 10; - Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5; - Sparams->choice.setup.mobilityStateParameters.t_Evaluation = MobilityStateParameters__t_Evaluation_s60; - Sparams->choice.setup.mobilityStateParameters.t_HystNormal = MobilityStateParameters__t_HystNormal_s120; - - quantityConfig = CALLOC(1, sizeof(*quantityConfig)); - memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); - quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct QuantityConfigEUTRA)); - memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA)); - quantityConfig->quantityConfigCDMA2000 = NULL; - quantityConfig->quantityConfigGERAN = NULL; - quantityConfig->quantityConfigUTRA = NULL; - quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = - CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP))); - quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = - CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ))); - *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4; - *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4; - - LOG_I(RRC, - "[eNB %d] Frame %d: potential handover preparation: store the information in an intermediate structure in case of failure\n", - ctxt_pP->module_id, ctxt_pP->frame); - // store the information in an intermediate structure for Hanodver management - //rrc_inst->handover_info.as_config.sourceRadioResourceConfig.srb_ToAddModList = CALLOC(1,sizeof()); - ue_context_pP->ue_context.handover_info = CALLOC(1, sizeof(*(ue_context_pP->ue_context.handover_info))); - //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.srb_ToAddModList,(void *)SRB_list,sizeof(SRB_ToAddModList_t)); - ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.srb_ToAddModList = *SRB_configList2; - //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.drb_ToAddModList,(void *)DRB_list,sizeof(DRB_ToAddModList_t)); - ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList = *DRB_configList; - ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL; - ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig = - CALLOC(1, sizeof(*ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig)); - memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, - (void *)mac_MainConfig, sizeof(MAC_MainConfig_t)); - ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated = - CALLOC(1, sizeof(PhysicalConfigDedicated_t)); - memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, - (void*)ue_context_pP->ue_context.physicalConfigDedicated, sizeof(PhysicalConfigDedicated_t)); - ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.sps_Config = NULL; - //memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config,(void *)rrc_inst->sps_Config[ue_mod_idP],sizeof(SPS_Config_t)); - - } - -#if defined(ENABLE_ITTI) - /* Initialize NAS list */ - dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); - - /* Add all NAS PDUs to the list */ - for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { - if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { - dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); - memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); - OCTET_STRING_fromBuf(dedicatedInfoNas, - (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, - ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length); - ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); - } - - /* TODO parameters yet to process ... */ - { - // ue_context_pP->ue_context.e_rab[i].param.qos; - // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; - // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; - } - - /* TODO should test if e RAB are Ok before! */ - ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; - LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", - i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE"); - } - - /* If list is empty free the list and reset the address */ - if (dedicatedInfoNASList->list.count == 0) { - free(dedicatedInfoNASList); - dedicatedInfoNASList = NULL; - } - -#endif - - memset(buffer, 0, RRC_BUF_SIZE); - - size = do_RRCConnectionReconfiguration(ctxt_pP, - buffer, - xid, //Transaction_id, - (SRB_ToAddModList_t*)*SRB_configList2, // SRB_configList - (DRB_ToAddModList_t*)*DRB_configList, - (DRB_ToReleaseList_t*)NULL, // DRB2_list, - (struct SPS_Config*)NULL, // *sps_Config, - (struct PhysicalConfigDedicated*)*physicalConfigDedicated, -#ifdef EXMIMO_IOT - NULL, NULL, NULL,NULL, -#else - (MeasObjectToAddModList_t*)MeasObj_list, - (ReportConfigToAddModList_t*)ReportConfig_list, - (QuantityConfig_t*)quantityConfig, - (MeasIdToAddModList_t*)MeasId_list, -#endif - (MAC_MainConfig_t*)mac_MainConfig, - (MeasGapConfig_t*)NULL, - (MobilityControlInfo_t*)NULL, - (struct MeasConfig__speedStatePars*)Sparams, - (RSRP_Range_t*)rsrp, - (C_RNTI_t*)cba_RNTI, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList -#if defined(Rel10) || defined(Rel14) - , (SCellToAddMod_r10_t*)NULL -#endif - ); - -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n"); - for (i = 0; i < size; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); - } - LOG_F(RRC,"\n"); - //////////////////////////////////////// -#endif - -#if defined(ENABLE_ITTI) - - /* Free all NAS PDUs */ - for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { - if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { - /* Free the NAS PDU buffer and invalidate it */ - free(ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer); - ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL; - } - } - -#endif - - LOG_I(RRC, - "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n", - ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - - LOG_D(RRC, - "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", - ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); - - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - size); - - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); -} - -//----------------------------------------------------------------------------- -void -flexran_rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - const uint8_t ho_state, - agent_reconf_rrc * trig_param - ) -//----------------------------------------------------------------------------- -{ - uint8_t buffer[RRC_BUF_SIZE]; - uint16_t size; - int i; - - // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE - eNB_RRC_INST* rrc_inst = RC.rrc[ctxt_pP->module_id]; - struct PhysicalConfigDedicated** physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; - - struct SRB_ToAddMod *SRB2_config = NULL; - struct SRB_ToAddMod__rlc_Config *SRB2_rlc_config = NULL; - struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config = NULL; - struct LogicalChannelConfig__ul_SpecificParameters - *SRB2_ul_SpecificParameters = NULL; - SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; - SRB_ToAddModList_t **SRB_configList2 = NULL; - - struct DRB_ToAddMod *DRB_config = NULL; - struct RLC_Config *DRB_rlc_config = NULL; - struct PDCP_Config *DRB_pdcp_config = NULL; - struct PDCP_Config__rlc_AM *PDCP_rlc_AM = NULL; - struct PDCP_Config__rlc_UM *PDCP_rlc_UM = NULL; - struct LogicalChannelConfig *DRB_lchan_config = NULL; - struct LogicalChannelConfig__ul_SpecificParameters - *DRB_ul_SpecificParameters = NULL; - DRB_ToAddModList_t** DRB_configList = &ue_context_pP->ue_context.DRB_configList; - DRB_ToAddModList_t** DRB_configList2 = NULL; - MAC_MainConfig_t *mac_MainConfig = NULL; - MeasObjectToAddModList_t *MeasObj_list = NULL; - MeasObjectToAddMod_t *MeasObj = NULL; - ReportConfigToAddModList_t *ReportConfig_list = NULL; - ReportConfigToAddMod_t *ReportConfig_per;//, *ReportConfig_A1, - // *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; - MeasIdToAddModList_t *MeasId_list = NULL; - MeasIdToAddMod_t *MeasId0; //, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; -#if Rel10 - long *sr_ProhibitTimer_r9 = NULL; - // uint8_t sCellIndexToAdd = rrc_find_free_SCell_index(enb_mod_idP, ue_mod_idP, 1); - //uint8_t sCellIndexToAdd = 0; -#endif - - long *logicalchannelgroup, *logicalchannelgroup_drb; - long *maxHARQ_Tx, *periodicBSR_Timer; - - RSRP_Range_t *rsrp = NULL; - struct MeasConfig__speedStatePars *Sparams = NULL; - QuantityConfig_t *quantityConfig = NULL; - CellsToAddMod_t *CellToAdd = NULL; - CellsToAddModList_t *CellsToAddModList = NULL; - struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList = NULL; - DedicatedInfoNAS_t *dedicatedInfoNas = NULL; - /* for no gcc warnings */ - (void)dedicatedInfoNas; - - C_RNTI_t *cba_RNTI = NULL; - - uint8_t xid = rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id); //Transaction_id, - -#ifdef CBA - //struct PUSCH_CBAConfigDedicated_vlola *pusch_CBAConfigDedicated_vlola; - uint8_t *cba_RNTI_buf; - cba_RNTI = CALLOC(1, sizeof(C_RNTI_t)); - cba_RNTI_buf = CALLOC(1, 2 * sizeof(uint8_t)); - cba_RNTI->buf = cba_RNTI_buf; - cba_RNTI->size = 2; - cba_RNTI->bits_unused = 0; - - // associate UEs to the CBa groups as a function of their UE id - if (rrc_inst->num_active_cba_groups) { - cba_RNTI->buf[0] = rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups] & 0xff; - cba_RNTI->buf[1] = 0xff; - LOG_D(RRC, - "[eNB %d] Frame %d: cba_RNTI = %x in group %d is attribued to UE %d\n", - enb_mod_idP, frameP, - rrc_inst->cba_rnti[ue_mod_idP % rrc_inst->num_active_cba_groups], - ue_mod_idP % rrc_inst->num_active_cba_groups, ue_mod_idP); - } else { - cba_RNTI->buf[0] = 0x0; - cba_RNTI->buf[1] = 0x0; - LOG_D(RRC, "[eNB %d] Frame %d: no cba_RNTI is configured for UE %d\n", enb_mod_idP, frameP, ue_mod_idP); - } - -#endif - - T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - // Configure SRB2 - /// SRB2 - SRB_configList2=&ue_context_pP->ue_context.SRB_configList2[xid]; - if (*SRB_configList2) { - free(*SRB_configList2); - } - *SRB_configList2 = CALLOC(1, sizeof(**SRB_configList2)); - memset(*SRB_configList2, 0, sizeof(**SRB_configList2)); - SRB2_config = CALLOC(1, sizeof(*SRB2_config)); - - SRB2_config->srb_Identity = 2; - SRB2_rlc_config = CALLOC(1, sizeof(*SRB2_rlc_config)); - SRB2_config->rlc_Config = SRB2_rlc_config; - - SRB2_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; - SRB2_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t32; - SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; - SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; - - SRB2_lchan_config = CALLOC(1, sizeof(*SRB2_lchan_config)); - SRB2_config->logicalChannelConfig = SRB2_lchan_config; - - SRB2_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; - - SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters)); - - SRB2_ul_SpecificParameters->priority = 3; // let some priority for SRB1 and dedicated DRBs - SRB2_ul_SpecificParameters->prioritisedBitRate = - LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; - SRB2_ul_SpecificParameters->bucketSizeDuration = - LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - - // LCG for CCCH and DCCH is 0 as defined in 36331 - logicalchannelgroup = CALLOC(1, sizeof(long)); - *logicalchannelgroup = 0; - - SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; - - SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters; - // this list has the configuration for SRB1 and SRB2 - ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); - // this list has only the configuration for SRB2 - ASN_SEQUENCE_ADD(&(*SRB_configList2)->list, SRB2_config); - - // Configure DRB - //*DRB_configList = CALLOC(1, sizeof(*DRB_configList)); - // list for all the configured DRB - if (*DRB_configList) { - free(*DRB_configList); - } - *DRB_configList = CALLOC(1, sizeof(**DRB_configList)); - memset(*DRB_configList, 0, sizeof(**DRB_configList)); - - // list for the configured DRB for a this xid - DRB_configList2=&ue_context_pP->ue_context.DRB_configList2[xid]; - if (*DRB_configList2) { - free(*DRB_configList2); - } - *DRB_configList2 = CALLOC(1, sizeof(**DRB_configList2)); - memset(*DRB_configList2, 0, sizeof(**DRB_configList2)); - - - /// DRB - DRB_config = CALLOC(1, sizeof(*DRB_config)); - - DRB_config->eps_BearerIdentity = CALLOC(1, sizeof(long)); - *(DRB_config->eps_BearerIdentity) = 5L; // LW set to first value, allowed value 5..15, value : x+4 - // DRB_config->drb_Identity = (DRB_Identity_t) 1; //allowed values 1..32 - // NN: this is the 1st DRB for this ue, so set it to 1 - DRB_config->drb_Identity = (DRB_Identity_t) 1; // (ue_mod_idP+1); //allowed values 1..32, value: x - DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long)); - *(DRB_config->logicalChannelIdentity) = (long)3; // value : x+2 - DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config)); - DRB_config->rlc_Config = DRB_rlc_config; - -#ifdef RRC_DEFAULT_RAB_IS_AM - DRB_rlc_config->present = RLC_Config_PR_am; - DRB_rlc_config->choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms50; - DRB_rlc_config->choice.am.ul_AM_RLC.pollPDU = PollPDU_p16; - DRB_rlc_config->choice.am.ul_AM_RLC.pollByte = PollByte_kBinfinity; - DRB_rlc_config->choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t8; - DRB_rlc_config->choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; - DRB_rlc_config->choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms25; -#else - DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; - DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; -#ifdef CBA - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms5;//T_Reordering_ms25; -#else - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; -#endif -#endif - - DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); - DRB_config->pdcp_Config = DRB_pdcp_config; - DRB_pdcp_config->discardTimer = CALLOC(1, sizeof(long)); - *DRB_pdcp_config->discardTimer = PDCP_Config__discardTimer_infinity; - DRB_pdcp_config->rlc_AM = NULL; - DRB_pdcp_config->rlc_UM = NULL; - - /* avoid gcc warnings */ - (void)PDCP_rlc_AM; - (void)PDCP_rlc_UM; - -#ifdef RRC_DEFAULT_RAB_IS_AM // EXMIMO_IOT - PDCP_rlc_AM = CALLOC(1, sizeof(*PDCP_rlc_AM)); - DRB_pdcp_config->rlc_AM = PDCP_rlc_AM; - PDCP_rlc_AM->statusReportRequired = FALSE; -#else - PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); - DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; - PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; -#endif - DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; - - DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config)); - DRB_config->logicalChannelConfig = DRB_lchan_config; - DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); - DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; - - DRB_ul_SpecificParameters->priority = 12; // lower priority than srb1, srb2 and other dedicated bearer - DRB_ul_SpecificParameters->prioritisedBitRate =LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_kBps8 ; - //LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; - DRB_ul_SpecificParameters->bucketSizeDuration = - LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - - // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM) - logicalchannelgroup_drb = CALLOC(1, sizeof(long)); - *logicalchannelgroup_drb = 1; - DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; - - ASN_SEQUENCE_ADD(&(*DRB_configList)->list, DRB_config); - ASN_SEQUENCE_ADD(&(*DRB_configList2)->list, DRB_config); - - //ue_context_pP->ue_context.DRB_configList2[0] = &(*DRB_configList); - - mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig)); - // ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig; - - mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config)); - - maxHARQ_Tx = CALLOC(1, sizeof(long)); - *maxHARQ_Tx = MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; - mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx; - periodicBSR_Timer = CALLOC(1, sizeof(long)); - *periodicBSR_Timer = PeriodicBSR_Timer_r12_sf64; - mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer; - mac_MainConfig->ul_SCH_Config->retxBSR_Timer = RetxBSR_Timer_r12_sf320; - mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE - - mac_MainConfig->timeAlignmentTimerDedicated = TimeAlignmentTimer_infinity; - - mac_MainConfig->drx_Config = NULL; - - mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config)); - - mac_MainConfig->phr_Config->present = MAC_MainConfig__phr_Config_PR_setup; - mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes - - mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes - - mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB - -#ifdef Rel10 - sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long)); - *sr_ProhibitTimer_r9 = 0; // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR - mac_MainConfig->ext1 = CALLOC(1, sizeof(struct MAC_MainConfig__ext1)); - mac_MainConfig->ext1->sr_ProhibitTimer_r9 = sr_ProhibitTimer_r9; - //sps_RA_ConfigList_rlola = NULL; -#endif - - //change the transmission mode for the primary component carrier - //TODO: add codebook subset restriction here - //TODO: change TM for secondary CC in SCelltoaddmodlist - if (*physicalConfigDedicated) { - if ((*physicalConfigDedicated)->antennaInfo) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.transmissionMode = rrc_inst->configuration.ue_TransmissionMode[0]; - LOG_D(RRC,"Setting transmission mode to %ld+1\n",rrc_inst->configuration.ue_TransmissionMode[0]); - if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm3) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm3; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.buf[0] = 0xc0; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm3.bits_unused=6; - } - else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm4; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.buf[0] = 0xfc; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm4.bits_unused=2; - - } - else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm5; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.buf[0] = 0xf0; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm5.bits_unused=4; - } - else if (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6) { - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction= - CALLOC(1,sizeof(AntennaInfoDedicated__codebookSubsetRestriction_PR)); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->present = - AntennaInfoDedicated__codebookSubsetRestriction_PR_n2TxAntenna_tm6; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf= MALLOC(1); - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.buf[0] = 0xf0; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.size=1; - (*physicalConfigDedicated)->antennaInfo->choice.explicitValue.codebookSubsetRestriction->choice.n2TxAntenna_tm6.bits_unused=4; - } - } - else { - LOG_E(RRC,"antenna_info not present in physical_config_dedicated. Not reconfiguring!\n"); - } - if ((*physicalConfigDedicated)->cqi_ReportConfig) { - if ((rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm4) || - (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm5) || - (rrc_inst->configuration.ue_TransmissionMode[0]==AntennaInfoDedicated__transmissionMode_tm6)) { - //feedback mode needs to be set as well - //TODO: I think this is taken into account in the PHY automatically based on the transmission mode variable - printf("setting cqi reporting mode to rm31\n"); -#if defined(Rel10) || defined(Rel14) - *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportModeAperiodic_rm31; -#else - *((*physicalConfigDedicated)->cqi_ReportConfig->cqi_ReportModeAperiodic)=CQI_ReportConfig__cqi_ReportModeAperiodic_rm31; // HLC CQI, no PMI -#endif - } - } - else { - LOG_E(RRC,"cqi_ReportConfig not present in physical_config_dedicated. Not reconfiguring!\n"); - } - } - else { - LOG_E(RRC,"physical_config_dedicated not present in RRCConnectionReconfiguration. Not reconfiguring!\n"); - } - - // Measurement ID list - MeasId_list = CALLOC(1, sizeof(*MeasId_list)); - memset((void *)MeasId_list, 0, sizeof(*MeasId_list)); - - MeasId0 = CALLOC(1, sizeof(*MeasId0)); - MeasId0->measId = 1; - MeasId0->measObjectId = 1; - MeasId0->reportConfigId = 1; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0); - - /* - * Add one EUTRA Measurement Object - */ - - MeasObj_list = CALLOC(1, sizeof(*MeasObj_list)); - memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list)); - - // Configure MeasObject - - MeasObj = CALLOC(1, sizeof(*MeasObj)); - memset((void *)MeasObj, 0, sizeof(*MeasObj)); - - MeasObj->measObjectId = 1; - MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA; - MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 3350; //band 7, 2.68GHz - //MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; //band 33, 1.909GHz - MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25; - MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1; - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t)); - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0; - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6; - MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB - - MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = - (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); - - CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; - - // Add adjacent cell lists (6 per eNB) - for (i = 0; i < 6; i++) { - CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd)); - CellToAdd->cellIndex = i + 1; - CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i); - CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0; - - ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd); - } - - ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj); - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; - - // Report Configurations for periodical, A1-A5 events - - /* RRC Strategy Measurement */ - - - if (strcmp("one_shot", trig_param->trigger_policy) == 0){ - - trig_param->report_interval = 0; - trig_param->report_amount = 0; - - } - - else if (strcmp("event_driven", trig_param->trigger_policy) == 0){ - - trig_param->report_interval = 6; - trig_param->report_amount = 2; - - } - - else if (strcmp("periodical", trig_param->trigger_policy) == 0){ - - trig_param->report_interval = 1; - trig_param->report_amount = 7; - - } - - else { - - LOG_E(FLEXRAN_AGENT, "There is something wrong on RRC agent!"); - } - - - - ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list)); - - ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); - - // Periodical Measurement Report - - ReportConfig_per->reportConfigId = 1; - ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_periodical; - - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose = - ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; - - // ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger = TimeToTrigger_ms40; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = trig_param->report_interval ;//ReportInterval_ms2048; // RRC counter frame- ms1024 is 1ms - - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = trig_param->report_amount; //ReportConfigEUTRA__reportAmount_r2; // put r1 to see once, r2 for 2 times and ... - - - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); - - - - quantityConfig = CALLOC(1, sizeof(*quantityConfig)); - memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); - quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(struct QuantityConfigEUTRA)); - memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA)); - quantityConfig->quantityConfigCDMA2000 = NULL; - quantityConfig->quantityConfigGERAN = NULL; - quantityConfig->quantityConfigUTRA = NULL; - quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = - CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP))); - quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = - CALLOC(1, sizeof(*(quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ))); - *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4; - *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4; - - -#if defined(ENABLE_ITTI) - /* Initialize NAS list */ - dedicatedInfoNASList = CALLOC(1, sizeof(struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList)); - - /* Add all NAS PDUs to the list */ - for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { - if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { - dedicatedInfoNas = CALLOC(1, sizeof(DedicatedInfoNAS_t)); - memset(dedicatedInfoNas, 0, sizeof(OCTET_STRING_t)); - OCTET_STRING_fromBuf(dedicatedInfoNas, - (char*)ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer, - ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length); - ASN_SEQUENCE_ADD(&dedicatedInfoNASList->list, dedicatedInfoNas); - } - - /* TODO parameters yet to process ... */ - // { - // ue_context_pP->ue_context.e_rab[i].param.qos; - // ue_context_pP->ue_context.e_rab[i].param.sgw_addr; - // ue_context_pP->ue_context.e_rab[i].param.gtp_teid; - // } - - /* TODO should test if e RAB are Ok before! */ - ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_DONE; - LOG_D(RRC, "setting the status for the default DRB (index %d) to (%d,%s)\n", - i, ue_context_pP->ue_context.e_rab[i].status, "E_RAB_STATUS_DONE"); - } - - /* If list is empty free the list and reset the address */ - if (dedicatedInfoNASList->list.count == 0) { - free(dedicatedInfoNASList); - dedicatedInfoNASList = NULL; - } - -#endif - - memset(buffer, 0, RRC_BUF_SIZE); - - size = do_RRCConnectionReconfiguration(ctxt_pP, - buffer, - xid, //Transaction_id, - (SRB_ToAddModList_t*)NULL, // SRB_configList - (DRB_ToAddModList_t*)NULL, - (DRB_ToReleaseList_t*)NULL, // DRB2_list, - (struct SPS_Config*)NULL, // *sps_Config, - (struct PhysicalConfigDedicated*)*physicalConfigDedicated, -// #ifdef EXMIMO_IOT -// NULL, NULL, NULL,NULL, -// #else - (MeasObjectToAddModList_t*)MeasObj_list, - (ReportConfigToAddModList_t*)ReportConfig_list, - (QuantityConfig_t*)quantityConfig, - (MeasIdToAddModList_t*)MeasId_list, -// #endif - (MAC_MainConfig_t*)mac_MainConfig, - (MeasGapConfig_t*)NULL, - (MobilityControlInfo_t*)NULL, - (struct MeasConfig__speedStatePars*)Sparams, - (RSRP_Range_t*)rsrp, - (C_RNTI_t*)cba_RNTI, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)dedicatedInfoNASList -#if defined(Rel10) || defined(Rel14) - , (SCellToAddMod_r10_t*)NULL -#endif - ); - -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC Connection Reconfiguration\n"); - for (i = 0; i < size; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)buffer)[i]); - } - LOG_F(RRC,"\n"); - //////////////////////////////////////// -#endif - -#if defined(ENABLE_ITTI) - - /* Free all NAS PDUs */ - for (i = 0; i < ue_context_pP->ue_context.nb_of_e_rabs; i++) { - if (ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer != NULL) { - /* Free the NAS PDU buffer and invalidate it */ - free(ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer); - ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL; - } - } - -#endif - - LOG_I(RRC, - "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n", - ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - - LOG_D(RRC, - "[FRAME %05d][RRC_eNB][MOD %u][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration to UE %x MUI %d) --->][PDCP][MOD %u][RB %u]\n", - ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); - - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - size); - - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); -} - - -//----------------------------------------------------------------------------- -int -rrc_eNB_generate_RRCConnectionReconfiguration_SCell( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - uint32_t dl_CarrierFreq_r10 -) -//----------------------------------------------------------------------------- -{ - - uint8_t size; - uint8_t buffer[100]; - -#if defined(Rel10) || defined(Rel14) - uint8_t sCellIndexToAdd = 0; //one SCell so far - - // uint8_t sCellIndexToAdd; - // sCellIndexToAdd = rrc_find_free_SCell_index(enb_mod_idP, ue_mod_idP, 1); - // if (RC.rrc[enb_mod_idP]->sCell_config[ue_mod_idP][sCellIndexToAdd] ) { - if (ue_context_pP->ue_context.sCell_config != NULL) { - ue_context_pP->ue_context.sCell_config[sCellIndexToAdd].cellIdentification_r10->dl_CarrierFreq_r10 = dl_CarrierFreq_r10; - } else { - LOG_E(RRC,"Scell not configured!\n"); - return(-1); - } - -#endif - size = do_RRCConnectionReconfiguration(ctxt_pP, - buffer, - rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id),//Transaction_id, - (SRB_ToAddModList_t*)NULL, - (DRB_ToAddModList_t*)NULL, - (DRB_ToReleaseList_t*)NULL, - (struct SPS_Config*)NULL, - (struct PhysicalConfigDedicated*)NULL, - (MeasObjectToAddModList_t*)NULL, - (ReportConfigToAddModList_t*)NULL, - (QuantityConfig_t*)NULL, - (MeasIdToAddModList_t*)NULL, - (MAC_MainConfig_t*)NULL, - (MeasGapConfig_t*)NULL, - (MobilityControlInfo_t*)NULL, - (struct MeasConfig__speedStatePars*)NULL, - (RSRP_Range_t*)NULL, - (C_RNTI_t*)NULL, - (struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList*)NULL - -#if defined(Rel10) || defined(Rel14) - , ue_context_pP->ue_context.sCell_config -#endif - ); - LOG_I(RRC,"[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration (bytes %d, UE id %x)\n", - ctxt_pP->module_id,ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - buffer, - size, - MSC_AS_TIME_FMT" rrcConnectionReconfiguration UE %x MUI %d size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - rrc_eNB_mui, - size); - - rrc_data_req( - ctxt_pP, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - size, - buffer, - PDCP_TRANSMISSION_MODE_CONTROL); - return(0); -} - - -//----------------------------------------------------------------------------- -void -rrc_eNB_process_MeasurementReport( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* ue_context_pP, - const MeasResults_t* const measResults2 -) -//----------------------------------------------------------------------------- -{ - int i=0; - int neighboring_cells=-1; - - T(T_ENB_RRC_MEASUREMENT_REPORT, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - if (measResults2 == NULL ) - return; - - if (measResults2->measId > 0 ){ - if (ue_context_pP->ue_context.measResults == NULL) { - ue_context_pP->ue_context.measResults = CALLOC(1, sizeof(MeasResults_t)); - } - ue_context_pP->ue_context.measResults->measId=measResults2->measId; - ue_context_pP->ue_context.measResults->measResultPCell.rsrpResult=measResults2->measResultPCell.rsrpResult; - ue_context_pP->ue_context.measResults->measResultPCell.rsrqResult=measResults2->measResultPCell.rsrqResult; - LOG_D(RRC, "[eNB %d]Frame %d: UE %x (Measurement Id %d): RSRP of Source %ld\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId, ue_context_pP->ue_context.measResults->measResultPCell.rsrpResult-140); - LOG_D(RRC, "[eNB %d]Frame %d: UE %x (Measurement Id %d): RSRQ of Source %ld\n", ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId, ue_context_pP->ue_context.measResults->measResultPCell.rsrqResult/2 - 20); - } - if (measResults2->measResultNeighCells == NULL) - return; - - if (measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count > 0) { - neighboring_cells = measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count; - - if (ue_context_pP->ue_context.measResults->measResultNeighCells == NULL) { - - ue_context_pP->ue_context.measResults->measResultNeighCells = CALLOC(1, sizeof(*measResults2->measResultNeighCells)*neighboring_cells); - } - ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.count = neighboring_cells; - for (i=0; i < neighboring_cells; i++){ - memcpy (ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i], - measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[i], - sizeof(MeasResultListEUTRA_t)); - - LOG_D(RRC, "Physical Cell Id %d\n", - (int)ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->physCellId); - LOG_D(RRC, "RSRP of Target %d\n", - (int)*(ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrpResult)); - LOG_D(RRC, "RSRQ of Target %d\n", - (int)*(ue_context_pP->ue_context.measResults->measResultNeighCells->choice.measResultListEUTRA.list.array[i]->measResult.rsrqResult)); - } - } - -// #if defined(Rel10) || defined(Rel14) - - -// #else - // LOG_I(RRC, "RSRP of Source %d\n", measResults2->measResultServCell.rsrpResult); - // LOG_I(RRC, "RSRQ of Source %d\n", measResults2->measResultServCell.rsrqResult); -// #endif - - // if (ue_context_pP->ue_context.handover_info->ho_prepare != 0xF0) { - // rrc_eNB_generate_HandoverPreparationInformation(ctxt_pP, - // ue_context_pP, - // measResults2->measResultNeighCells->choice. - // measResultListEUTRA.list.array[0]->physCellId); - // } else { - // LOG_D(RRC, "[eNB %d] Frame %d: Ignoring MeasReport from UE %x as Handover is in progress... \n", ctxt_pP->module_id, ctxt_pP->frame, - // ctxt_pP->rnti); - // } - - //Look for IP address of the target eNB - //Send Handover Request -> target eNB - //Wait for Handover Acknowledgement <- target eNB - //Send Handover Command - - //x2delay(); - // handover_request_x2(ue_mod_idP,enb_mod_idP,measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId); - - // uint8_t buffer[100]; - // int size=rrc_eNB_generate_Handover_Command_TeNB(0,0,buffer); - // - // send_check_message((char*)buffer,size); - //send_handover_command(); - -} - -//----------------------------------------------------------------------------- -void -rrc_eNB_generate_HandoverPreparationInformation( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - PhysCellId_t targetPhyId -) -//----------------------------------------------------------------------------- -{ - struct rrc_eNB_ue_context_s* ue_context_target_p = NULL; - //uint8_t UE_id_target = -1; - uint8_t mod_id_target = get_adjacent_cell_mod_id(targetPhyId); - HANDOVER_INFO *handoverInfo = CALLOC(1, sizeof(*handoverInfo)); - /* - uint8_t buffer[100]; - uint8_t size; - struct PhysicalConfigDedicated **physicalConfigDedicated = &RC.rrc[enb_mod_idP]->physicalConfigDedicated[ue_mod_idP]; - RadioResourceConfigDedicated_t *radioResourceConfigDedicated = CALLOC(1,sizeof(RadioResourceConfigDedicated_t)); - */ - - T(T_ENB_RRC_HANDOVER_PREPARATION_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - handoverInfo->as_config.antennaInfoCommon.antennaPortsCount = 0; //Not used 0- but check value - handoverInfo->as_config.sourceDl_CarrierFreq = 36090; //Verify! - - memcpy((void *)&handoverInfo->as_config.sourceMasterInformationBlock, - (void*)&RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.mib, sizeof(MasterInformationBlock_t)); - memcpy((void *)&handoverInfo->as_config.sourceMeasConfig, - (void*)ue_context_pP->ue_context.measConfig, sizeof(MeasConfig_t)); - - // FIXME handoverInfo not used... - free( handoverInfo ); - handoverInfo = 0; - - //to be configured - memset((void*)&ue_context_pP->ue_context.handover_info->as_config.sourceSecurityAlgorithmConfig, - 0, sizeof(SecurityAlgorithmConfig_t)); - - memcpy((void*)&ue_context_pP->ue_context.handover_info->as_config.sourceSystemInformationBlockType1, - (void*)&RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.SIB1, sizeof(SystemInformationBlockType1_t)); - memcpy((void*)&ue_context_pP->ue_context.handover_info->as_config.sourceSystemInformationBlockType2, - (void*)&RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.SIB23, sizeof(SystemInformationBlockType2_t)); - ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo = - CALLOC(1, sizeof(ReestablishmentInfo_t)); - ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->sourcePhysCellId = - RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.physCellId; - ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->targetCellShortMAC_I.buf = NULL; // Check values later - ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->targetCellShortMAC_I.size = 0; - ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->targetCellShortMAC_I.bits_unused = 0; - ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->additionalReestabInfoList = NULL; - ue_context_pP->ue_context.handover_info->ho_prepare = 0xFF; //0xF0; - ue_context_pP->ue_context.handover_info->ho_complete = 0; - - if (mod_id_target != 0xFF) { - //UE_id_target = rrc_find_free_ue_index(modid_target); - ue_context_target_p = - rrc_eNB_get_ue_context( - RC.rrc[mod_id_target], - ue_context_pP->ue_context.rnti); - - /*UE_id_target = rrc_eNB_get_next_free_UE_index( - mod_id_target, - RC.rrc[ctxt_pP->module_id]->Info.UE_list[ue_mod_idP]); //this should return a new index*/ - - if (ue_context_target_p == NULL) { // if not already in target cell - ue_context_target_p = rrc_eNB_allocate_new_UE_context(RC.rrc[ctxt_pP->module_id]); - ue_context_target_p->ue_id_rnti = ue_context_pP->ue_context.rnti; // LG: should not be the same - ue_context_target_p->ue_context.rnti = ue_context_target_p->ue_id_rnti; // idem - LOG_N(RRC, - "[eNB %d] Frame %d : Emulate sending HandoverPreparationInformation msg from eNB source %d to eNB target %ld: source UE_id %x target UE_id %x source_modId: %d target_modId: %d\n", - ctxt_pP->module_id, - ctxt_pP->frame, - RC.rrc[ctxt_pP->module_id]->carrier[0] /* CROUX TBC */.physCellId, - targetPhyId, - ue_context_pP->ue_context.rnti, - ue_context_target_p->ue_id_rnti, - ctxt_pP->module_id, - mod_id_target); - ue_context_target_p->ue_context.handover_info = - CALLOC(1, sizeof(*(ue_context_target_p->ue_context.handover_info))); - memcpy((void*)&ue_context_target_p->ue_context.handover_info->as_context, - (void*)&ue_context_pP->ue_context.handover_info->as_context, - sizeof(AS_Context_t)); - memcpy((void*)&ue_context_target_p->ue_context.handover_info->as_config, - (void*)&ue_context_pP->ue_context.handover_info->as_config, - sizeof(AS_Config_t)); - ue_context_target_p->ue_context.handover_info->ho_prepare = 0x00;// 0xFF; - ue_context_target_p->ue_context.handover_info->ho_complete = 0; - ue_context_pP->ue_context.handover_info->modid_t = mod_id_target; - ue_context_pP->ue_context.handover_info->ueid_s = ue_context_pP->ue_context.rnti; - ue_context_pP->ue_context.handover_info->modid_s = ctxt_pP->module_id; - ue_context_target_p->ue_context.handover_info->modid_t = mod_id_target; - ue_context_target_p->ue_context.handover_info->modid_s = ctxt_pP->module_id; - ue_context_target_p->ue_context.handover_info->ueid_t = ue_context_target_p->ue_context.rnti; - - } else { - LOG_E(RRC, "\nError in obtaining free UE id in target eNB %ld for handover \n", targetPhyId); - } - - } else { - LOG_E(RRC, "\nError in obtaining Module ID of target eNB for handover \n"); - } -} - -//----------------------------------------------------------------------------- -void -rrc_eNB_process_handoverPreparationInformation( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP -) -//----------------------------------------------------------------------------- -{ - T(T_ENB_RRC_HANDOVER_PREPARATION_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - - LOG_I(RRC, - "[eNB %d] Frame %d : Logical Channel UL-DCCH, processing RRCHandoverPreparationInformation, sending RRCConnectionReconfiguration to UE %d \n", - ctxt_pP->module_id, ctxt_pP->frame, ue_context_pP->ue_context.rnti); - rrc_eNB_generate_RRCConnectionReconfiguration_handover( - ctxt_pP, - ue_context_pP, - NULL, - 0); -} - - -//----------------------------------------------------------------------------- -void -check_handovers( - protocol_ctxt_t* const ctxt_pP -) -//----------------------------------------------------------------------------- -{ - int result; - struct rrc_eNB_ue_context_s* ue_context_p; - RB_FOREACH(ue_context_p, rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head) { - ctxt_pP->rnti = ue_context_p->ue_id_rnti; - - if (ue_context_p->ue_context.handover_info != NULL) { - if (ue_context_p->ue_context.handover_info->ho_prepare == 0xFF) { - LOG_D(RRC, - "[eNB %d] Frame %d: Incoming handover detected for new UE_idx %d (source eNB %d->target eNB %d) \n", - ctxt_pP->module_id, - ctxt_pP->frame, - ctxt_pP->rnti, - ctxt_pP->module_id, - ue_context_p->ue_context.handover_info->modid_t); - // source eNB generates rrcconnectionreconfiguration to prepare the HO - rrc_eNB_process_handoverPreparationInformation( - ctxt_pP, - ue_context_p); - ue_context_p->ue_context.handover_info->ho_prepare = 0xF1; - } - - if (ue_context_p->ue_context.handover_info->ho_complete == 0xF1) { - LOG_D(RRC, - "[eNB %d] Frame %d: handover Command received for new UE_id %x current eNB %d target eNB: %d \n", - ctxt_pP->module_id, - ctxt_pP->frame, - ctxt_pP->rnti, - ctxt_pP->module_id, - ue_context_p->ue_context.handover_info->modid_t); - //rrc_eNB_process_handoverPreparationInformation(enb_mod_idP,frameP,i); - result = pdcp_data_req(ctxt_pP, - SRB_FLAG_YES, - DCCH, - rrc_eNB_mui++, - SDU_CONFIRM_NO, - ue_context_p->ue_context.handover_info->size, - ue_context_p->ue_context.handover_info->buf, - PDCP_TRANSMISSION_MODE_CONTROL); - AssertFatal(result == TRUE, "PDCP data request failed!\n"); - ue_context_p->ue_context.handover_info->ho_complete = 0xF2; - } - } - } -} - -// 5.3.5.4 RRCConnectionReconfiguration including the mobilityControlInfo to prepare the UE handover -//----------------------------------------------------------------------------- -void -rrc_eNB_generate_RRCConnectionReconfiguration_handover( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - uint8_t* const nas_pdu, - const uint32_t nas_length -) -//----------------------------------------------------------------------------- -{ - T(T_ENB_RRC_CONNECTION_RECONFIGURATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - - uint8_t buffer[RRC_BUF_SIZE]; - uint16_t size; - int i; - uint8_t rv[2]; - uint16_t Idx; - // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE - eNB_RRC_INST* rrc_inst = RC.rrc[ctxt_pP->module_id]; - struct PhysicalConfigDedicated** physicalConfigDedicated = &ue_context_pP->ue_context.physicalConfigDedicated; - - struct SRB_ToAddMod *SRB2_config; - struct SRB_ToAddMod__rlc_Config *SRB2_rlc_config; - struct SRB_ToAddMod__logicalChannelConfig *SRB2_lchan_config; - struct LogicalChannelConfig__ul_SpecificParameters *SRB2_ul_SpecificParameters; - LogicalChannelConfig_t *SRB1_logicalChannelConfig = NULL; - SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList; // not used in this context: may be removed - SRB_ToAddModList_t *SRB_configList2; - - struct DRB_ToAddMod *DRB_config; - struct RLC_Config *DRB_rlc_config; - struct PDCP_Config *DRB_pdcp_config; - struct PDCP_Config__rlc_UM *PDCP_rlc_UM; - struct LogicalChannelConfig *DRB_lchan_config; - struct LogicalChannelConfig__ul_SpecificParameters *DRB_ul_SpecificParameters; - DRB_ToAddModList_t *DRB_configList2; - - MAC_MainConfig_t *mac_MainConfig; - MeasObjectToAddModList_t *MeasObj_list; - MeasObjectToAddMod_t *MeasObj; - ReportConfigToAddModList_t *ReportConfig_list; - ReportConfigToAddMod_t *ReportConfig_per, *ReportConfig_A1, - *ReportConfig_A2, *ReportConfig_A3, *ReportConfig_A4, *ReportConfig_A5; - MeasIdToAddModList_t *MeasId_list; - MeasIdToAddMod_t *MeasId0, *MeasId1, *MeasId2, *MeasId3, *MeasId4, *MeasId5; - QuantityConfig_t *quantityConfig; - MobilityControlInfo_t *mobilityInfo; - // HandoverCommand_t handoverCommand; - //uint8_t sourceModId = - // get_adjacent_cell_mod_id(ue_context_pP->ue_context.handover_info->as_context.reestablishmentInfo->sourcePhysCellId); -#if defined(Rel10) || defined(Rel14) - long *sr_ProhibitTimer_r9; -#endif - - long *logicalchannelgroup, *logicalchannelgroup_drb; - long *maxHARQ_Tx, *periodicBSR_Timer; - - // RSRP_Range_t *rsrp; - struct MeasConfig__speedStatePars *Sparams; - CellsToAddMod_t *CellToAdd; - CellsToAddModList_t *CellsToAddModList; - // srb 1: for HO - struct SRB_ToAddMod *SRB1_config; - struct SRB_ToAddMod__rlc_Config *SRB1_rlc_config; - struct SRB_ToAddMod__logicalChannelConfig *SRB1_lchan_config; - struct LogicalChannelConfig__ul_SpecificParameters *SRB1_ul_SpecificParameters; - // phy config dedicated - PhysicalConfigDedicated_t *physicalConfigDedicated2; - struct RRCConnectionReconfiguration_r8_IEs__dedicatedInfoNASList *dedicatedInfoNASList; - protocol_ctxt_t ctxt; - - LOG_D(RRC, "[eNB %d] Frame %d: handover preparation: get the newSourceUEIdentity (C-RNTI): ", - ctxt_pP->module_id, ctxt_pP->frame); - - for (i = 0; i < 2; i++) { - rv[i] = taus() & 0xff; - LOG_D(RRC, " %x.", rv[i]); - } - - LOG_D(RRC, "[eNB %d] Frame %d : handover reparation: add target eNB SRB1 and PHYConfigDedicated reconfiguration\n", - ctxt_pP->module_id, ctxt_pP->frame); - // 1st: reconfigure SRB - SRB_configList2 = CALLOC(1, sizeof(*SRB_configList)); - SRB1_config = CALLOC(1, sizeof(*SRB1_config)); - SRB1_config->srb_Identity = 1; - SRB1_rlc_config = CALLOC(1, sizeof(*SRB1_rlc_config)); - SRB1_config->rlc_Config = SRB1_rlc_config; - - SRB1_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; - SRB1_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; - SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; - SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8; - SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000; - SRB1_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t16; - SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; - SRB1_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; - - SRB1_lchan_config = CALLOC(1, sizeof(*SRB1_lchan_config)); - SRB1_config->logicalChannelConfig = SRB1_lchan_config; - - SRB1_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; - SRB1_ul_SpecificParameters = CALLOC(1, sizeof(*SRB1_ul_SpecificParameters)); - - SRB1_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB1_ul_SpecificParameters; - - SRB1_ul_SpecificParameters->priority = 1; - - //assign_enum(&SRB1_ul_SpecificParameters->prioritisedBitRate,LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity); - SRB1_ul_SpecificParameters->prioritisedBitRate = - LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; - - //assign_enum(&SRB1_ul_SpecificParameters->bucketSizeDuration,LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50); - SRB1_ul_SpecificParameters->bucketSizeDuration = - LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - - logicalchannelgroup = CALLOC(1, sizeof(long)); - *logicalchannelgroup = 0; - SRB1_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; - - ASN_SEQUENCE_ADD(&SRB_configList2->list, SRB1_config); - - //2nd: now reconfigure phy config dedicated - physicalConfigDedicated2 = CALLOC(1, sizeof(*physicalConfigDedicated2)); - *physicalConfigDedicated = physicalConfigDedicated2; - - physicalConfigDedicated2->pdsch_ConfigDedicated = - CALLOC(1, sizeof(*physicalConfigDedicated2->pdsch_ConfigDedicated)); - physicalConfigDedicated2->pucch_ConfigDedicated = - CALLOC(1, sizeof(*physicalConfigDedicated2->pucch_ConfigDedicated)); - physicalConfigDedicated2->pusch_ConfigDedicated = - CALLOC(1, sizeof(*physicalConfigDedicated2->pusch_ConfigDedicated)); - physicalConfigDedicated2->uplinkPowerControlDedicated = - CALLOC(1, sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated)); - physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH = - CALLOC(1, sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH)); - physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH = - CALLOC(1, sizeof(*physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH)); - physicalConfigDedicated2->cqi_ReportConfig = NULL; //CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig)); - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = CALLOC(1,sizeof(*physicalConfigDedicated2->soundingRS_UL_ConfigDedicated)); - physicalConfigDedicated2->antennaInfo = CALLOC(1, sizeof(*physicalConfigDedicated2->antennaInfo)); - physicalConfigDedicated2->schedulingRequestConfig = - CALLOC(1, sizeof(*physicalConfigDedicated2->schedulingRequestConfig)); - // PDSCH - //assign_enum(&physicalConfigDedicated2->pdsch_ConfigDedicated->p_a, - // PDSCH_ConfigDedicated__p_a_dB0); - physicalConfigDedicated2->pdsch_ConfigDedicated->p_a = PDSCH_ConfigDedicated__p_a_dB0; - - // PUCCH - physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.present = - PUCCH_ConfigDedicated__ackNackRepetition_PR_release; - physicalConfigDedicated2->pucch_ConfigDedicated->ackNackRepetition.choice.release = 0; - physicalConfigDedicated2->pucch_ConfigDedicated->tdd_AckNackFeedbackMode = NULL; //PUCCH_ConfigDedicated__tdd_AckNackFeedbackMode_multiplexing; - - // Pusch_config_dedicated - physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_ACK_Index = 0; // 2.00 - physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_RI_Index = 0; // 1.25 - physicalConfigDedicated2->pusch_ConfigDedicated->betaOffset_CQI_Index = 8; // 2.25 - - // UplinkPowerControlDedicated - physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUSCH = 0; // 0 dB - //assign_enum(&physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled, - // UplinkPowerControlDedicated__deltaMCS_Enabled_en1); - physicalConfigDedicated2->uplinkPowerControlDedicated->deltaMCS_Enabled = - UplinkPowerControlDedicated__deltaMCS_Enabled_en1; - physicalConfigDedicated2->uplinkPowerControlDedicated->accumulationEnabled = 1; // should be TRUE in order to have 0dB power offset - physicalConfigDedicated2->uplinkPowerControlDedicated->p0_UE_PUCCH = 0; // 0 dB - physicalConfigDedicated2->uplinkPowerControlDedicated->pSRS_Offset = 0; // 0 dB - physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient = - CALLOC(1, sizeof(*physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient)); - // assign_enum(physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient,FilterCoefficient_fc4); // fc4 dB - *physicalConfigDedicated2->uplinkPowerControlDedicated->filterCoefficient = FilterCoefficient_fc4; // fc4 dB - - // TPC-PDCCH-Config - physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->present = TPC_PDCCH_Config_PR_setup; - physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.present = TPC_Index_PR_indexOfFormat3; - physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_Index.choice.indexOfFormat3 = 1; - physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf = CALLOC(1, 2); - physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.size = 2; - physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf[0] = 0x12; - physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.buf[1] = 0x34 + ue_context_pP->local_uid; - physicalConfigDedicated2->tpc_PDCCH_ConfigPUCCH->choice.setup.tpc_RNTI.bits_unused = 0; - - physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->present = TPC_PDCCH_Config_PR_setup; - physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.present = TPC_Index_PR_indexOfFormat3; - physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_Index.choice.indexOfFormat3 = 1; - physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf = CALLOC(1, 2); - physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.size = 2; - physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[0] = 0x22; - physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.buf[1] = 0x34 + ue_context_pP->local_uid; - physicalConfigDedicated2->tpc_PDCCH_ConfigPUSCH->choice.setup.tpc_RNTI.bits_unused = 0; - - // CQI ReportConfig - /* - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic)); - assign_enum(physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportModeAperiodic, - CQI_ReportConfig__cqi_ReportModeAperiodic_rm30); // HLC CQI, no PMI - physicalConfigDedicated2->cqi_ReportConfig->nomPDSCH_RS_EPRE_Offset = 0; // 0 dB - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic=CALLOC(1,sizeof(*physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic)); - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->present = CQI_ReportPeriodic_PR_setup; - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_PUCCH_ResourceIndex = 0; // n2_pucch - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_pmi_ConfigIndex = 0; // Icqi/pmi - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.present = CQI_ReportPeriodic__setup__cqi_FormatIndicatorPeriodic_PR_subbandCQI; // subband CQI - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.cqi_FormatIndicatorPeriodic.choice.subbandCQI.k=4; - - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.ri_ConfigIndex=NULL; - physicalConfigDedicated2->cqi_ReportConfig->cqi_ReportPeriodic->choice.setup.simultaneousAckNackAndCQI=0; - */ - - //soundingRS-UL-ConfigDedicated - /* - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->present = SoundingRS_UL_ConfigDedicated_PR_setup; - assign_enum(&physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_Bandwidth, - SoundingRS_UL_ConfigDedicated__setup__srs_Bandwidth_bw0); - assign_enum(&physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_HoppingBandwidth, - SoundingRS_UL_ConfigDedicated__setup__srs_HoppingBandwidth_hbw0); - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.freqDomainPosition=0; - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.duration=1; - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.srs_ConfigIndex=1; - physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.transmissionComb=0; - assign_enum(&physicalConfigDedicated2->soundingRS_UL_ConfigDedicated->choice.setup.cyclicShift, - SoundingRS_UL_ConfigDedicated__setup__cyclicShift_cs0); - */ - - //AntennaInfoDedicated - physicalConfigDedicated2->antennaInfo = CALLOC(1, sizeof(*physicalConfigDedicated2->antennaInfo)); - physicalConfigDedicated2->antennaInfo->present = PhysicalConfigDedicated__antennaInfo_PR_explicitValue; - //assign_enum(&physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode, - // AntennaInfoDedicated__transmissionMode_tm2); - /* - switch (transmission_mode){ - case 1: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm1; - break; - case 2: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm2; - break; - case 4: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm4; - break; - case 5: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm5; - break; - case 6: - physicalConfigDedicated2->antennaInfo->choice.explicitValue.transmissionMode= AntennaInfoDedicated__transmissionMode_tm6; - break; - } - */ - physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.present = - AntennaInfoDedicated__ue_TransmitAntennaSelection_PR_release; - physicalConfigDedicated2->antennaInfo->choice.explicitValue.ue_TransmitAntennaSelection.choice.release = 0; - - // SchedulingRequestConfig - physicalConfigDedicated2->schedulingRequestConfig->present = SchedulingRequestConfig_PR_setup; - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = ue_context_pP->local_uid; - - if (rrc_inst->carrier[0].sib1->tdd_Config==NULL) { // FD - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 5 + (ue_context_pP->local_uid % - 10); // Isr = 5 (every 10 subframes, offset=2+UE_id mod3) - } else { - switch (rrc_inst->carrier[0].sib1->tdd_Config->subframeAssignment) { - case 1: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid & 1) + (( - ue_context_pP->local_uid & 3) >> 1) * 5; // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 7 for UE2, 8 for UE3 , 2 for UE4 etc..) - break; - - case 3: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid % - 3); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) - break; - - case 4: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7 + (ue_context_pP->local_uid & - 1); // Isr = 5 (every 10 subframes, offset=2 for UE0, 3 for UE1, 3 for UE2, 2 for UE3 , etc..) - break; - - default: - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7; // Isr = 5 (every 10 subframes, offset=2 for all UE0 etc..) - break; - } - } - - // assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax, - //SchedulingRequestConfig__setup__dsr_TransMax_n4); - // assign_enum(&physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = SchedulingRequestConfig__setup__dsr_TransMax_n4; - physicalConfigDedicated2->schedulingRequestConfig->choice.setup.dsr_TransMax = - SchedulingRequestConfig__setup__dsr_TransMax_n4; - - LOG_D(RRC, - "handover_config [FRAME %05d][RRC_eNB][MOD %02d][][--- MAC_CONFIG_REQ (SRB1 UE %x) --->][MAC_eNB][MOD %02d][]\n", - ctxt_pP->frame, ctxt_pP->module_id, ue_context_pP->ue_context.rnti, ctxt_pP->module_id); - rrc_mac_config_req_eNB( - ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, -#ifdef Rel14 -0, -#endif - ue_context_pP->ue_context.rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t*) NULL, -#ifdef Rel14 - (RadioResourceConfigCommonSIB_t*) NULL, -#endif - ue_context_pP->ue_context.physicalConfigDedicated, -#if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, -#endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - 1, - SRB1_logicalChannelConfig, - ue_context_pP->ue_context.measGapConfig, - (TDD_Config_t*) NULL, - (MobilityControlInfo_t*) NULL, - (SchedulingInfoList_t*) NULL, - 0, - NULL, - NULL, - (MBSFN_SubframeConfigList_t *) NULL -#if defined(Rel10) || defined(Rel14) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL -#endif -# ifdef Rel14 - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL -# endif - ); - - // Configure target eNB SRB2 - /// SRB2 - SRB2_config = CALLOC(1, sizeof(*SRB2_config)); - SRB_configList2 = CALLOC(1, sizeof(*SRB_configList2)); - memset(SRB_configList2, 0, sizeof(*SRB_configList2)); - - SRB2_config->srb_Identity = 2; - SRB2_rlc_config = CALLOC(1, sizeof(*SRB2_rlc_config)); - SRB2_config->rlc_Config = SRB2_rlc_config; - - SRB2_rlc_config->present = SRB_ToAddMod__rlc_Config_PR_explicitValue; - SRB2_rlc_config->choice.explicitValue.present = RLC_Config_PR_am; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.t_PollRetransmit = T_PollRetransmit_ms15; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollPDU = PollPDU_p8; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.pollByte = PollByte_kB1000; - SRB2_rlc_config->choice.explicitValue.choice.am.ul_AM_RLC.maxRetxThreshold = UL_AM_RLC__maxRetxThreshold_t32; - SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_Reordering = T_Reordering_ms35; - SRB2_rlc_config->choice.explicitValue.choice.am.dl_AM_RLC.t_StatusProhibit = T_StatusProhibit_ms10; - - SRB2_lchan_config = CALLOC(1, sizeof(*SRB2_lchan_config)); - SRB2_config->logicalChannelConfig = SRB2_lchan_config; - - SRB2_lchan_config->present = SRB_ToAddMod__logicalChannelConfig_PR_explicitValue; - - SRB2_ul_SpecificParameters = CALLOC(1, sizeof(*SRB2_ul_SpecificParameters)); - - SRB2_ul_SpecificParameters->priority = 1; - SRB2_ul_SpecificParameters->prioritisedBitRate = - LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; - SRB2_ul_SpecificParameters->bucketSizeDuration = - LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - - // LCG for CCCH and DCCH is 0 as defined in 36331 - logicalchannelgroup = CALLOC(1, sizeof(long)); - *logicalchannelgroup = 0; - - SRB2_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup; - SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters = SRB2_ul_SpecificParameters; - ASN_SEQUENCE_ADD(&SRB_configList->list, SRB2_config); - ASN_SEQUENCE_ADD(&SRB_configList2->list, SRB2_config); - - // Configure target eNB DRB - DRB_configList2 = CALLOC(1, sizeof(*DRB_configList2)); - /// DRB - DRB_config = CALLOC(1, sizeof(*DRB_config)); - - //DRB_config->drb_Identity = (DRB_Identity_t) 1; //allowed values 1..32 - // NN: this is the 1st DRB for this ue, so set it to 1 - DRB_config->drb_Identity = (DRB_Identity_t) 1; // (ue_mod_idP+1); //allowed values 1..32 - DRB_config->logicalChannelIdentity = CALLOC(1, sizeof(long)); - *(DRB_config->logicalChannelIdentity) = (long)3; - DRB_rlc_config = CALLOC(1, sizeof(*DRB_rlc_config)); - DRB_config->rlc_Config = DRB_rlc_config; - DRB_rlc_config->present = RLC_Config_PR_um_Bi_Directional; - DRB_rlc_config->choice.um_Bi_Directional.ul_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.sn_FieldLength = SN_FieldLength_size10; - DRB_rlc_config->choice.um_Bi_Directional.dl_UM_RLC.t_Reordering = T_Reordering_ms35; - - DRB_pdcp_config = CALLOC(1, sizeof(*DRB_pdcp_config)); - DRB_config->pdcp_Config = DRB_pdcp_config; - DRB_pdcp_config->discardTimer = NULL; - DRB_pdcp_config->rlc_AM = NULL; - PDCP_rlc_UM = CALLOC(1, sizeof(*PDCP_rlc_UM)); - DRB_pdcp_config->rlc_UM = PDCP_rlc_UM; - PDCP_rlc_UM->pdcp_SN_Size = PDCP_Config__rlc_UM__pdcp_SN_Size_len12bits; - DRB_pdcp_config->headerCompression.present = PDCP_Config__headerCompression_PR_notUsed; - - DRB_lchan_config = CALLOC(1, sizeof(*DRB_lchan_config)); - DRB_config->logicalChannelConfig = DRB_lchan_config; - DRB_ul_SpecificParameters = CALLOC(1, sizeof(*DRB_ul_SpecificParameters)); - DRB_lchan_config->ul_SpecificParameters = DRB_ul_SpecificParameters; - - DRB_ul_SpecificParameters->priority = 2; // lower priority than srb1, srb2 - DRB_ul_SpecificParameters->prioritisedBitRate = - LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity; - DRB_ul_SpecificParameters->bucketSizeDuration = - LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration_ms50; - - // LCG for DTCH can take the value from 1 to 3 as defined in 36331: normally controlled by upper layers (like RRM) - logicalchannelgroup_drb = CALLOC(1, sizeof(long)); - *logicalchannelgroup_drb = 1; - DRB_ul_SpecificParameters->logicalChannelGroup = logicalchannelgroup_drb; - - ASN_SEQUENCE_ADD(&DRB_configList2->list, DRB_config); - - mac_MainConfig = CALLOC(1, sizeof(*mac_MainConfig)); - ue_context_pP->ue_context.mac_MainConfig = mac_MainConfig; - - mac_MainConfig->ul_SCH_Config = CALLOC(1, sizeof(*mac_MainConfig->ul_SCH_Config)); - - maxHARQ_Tx = CALLOC(1, sizeof(long)); - *maxHARQ_Tx = MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; - mac_MainConfig->ul_SCH_Config->maxHARQ_Tx = maxHARQ_Tx; - - periodicBSR_Timer = CALLOC(1, sizeof(long)); - *periodicBSR_Timer = PeriodicBSR_Timer_r12_sf64; - mac_MainConfig->ul_SCH_Config->periodicBSR_Timer = periodicBSR_Timer; - - mac_MainConfig->ul_SCH_Config->retxBSR_Timer = RetxBSR_Timer_r12_sf320; - - mac_MainConfig->ul_SCH_Config->ttiBundling = 0; // FALSE - - mac_MainConfig->drx_Config = NULL; - - mac_MainConfig->phr_Config = CALLOC(1, sizeof(*mac_MainConfig->phr_Config)); - - mac_MainConfig->phr_Config->present = MAC_MainConfig__phr_Config_PR_setup; - mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; // sf20 = 20 subframes - - mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; // sf20 = 20 subframes - - mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; // Value dB1 =1 dB, dB3 = 3 dB - -#if defined(Rel10) || defined(Rel14) - sr_ProhibitTimer_r9 = CALLOC(1, sizeof(long)); - *sr_ProhibitTimer_r9 = 0; // SR tx on PUCCH, Value in number of SR period(s). Value 0 = no timer for SR, Value 2= 2*SR - mac_MainConfig->ext1 = CALLOC(1, sizeof(struct MAC_MainConfig__ext1)); - mac_MainConfig->ext1->sr_ProhibitTimer_r9 = sr_ProhibitTimer_r9; - //sps_RA_ConfigList_rlola = NULL; -#endif - // Measurement ID list - MeasId_list = CALLOC(1, sizeof(*MeasId_list)); - memset((void *)MeasId_list, 0, sizeof(*MeasId_list)); - - MeasId0 = CALLOC(1, sizeof(*MeasId0)); - MeasId0->measId = 1; - MeasId0->measObjectId = 1; - MeasId0->reportConfigId = 1; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId0); - - MeasId1 = CALLOC(1, sizeof(*MeasId1)); - MeasId1->measId = 2; - MeasId1->measObjectId = 1; - MeasId1->reportConfigId = 2; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId1); - - MeasId2 = CALLOC(1, sizeof(*MeasId2)); - MeasId2->measId = 3; - MeasId2->measObjectId = 1; - MeasId2->reportConfigId = 3; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId2); - - MeasId3 = CALLOC(1, sizeof(*MeasId3)); - MeasId3->measId = 4; - MeasId3->measObjectId = 1; - MeasId3->reportConfigId = 4; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId3); - - MeasId4 = CALLOC(1, sizeof(*MeasId4)); - MeasId4->measId = 5; - MeasId4->measObjectId = 1; - MeasId4->reportConfigId = 5; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId4); - - MeasId5 = CALLOC(1, sizeof(*MeasId5)); - MeasId5->measId = 6; - MeasId5->measObjectId = 1; - MeasId5->reportConfigId = 6; - ASN_SEQUENCE_ADD(&MeasId_list->list, MeasId5); - - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measIdToAddModList = MeasId_list; - - // Add one EUTRA Measurement Object - MeasObj_list = CALLOC(1, sizeof(*MeasObj_list)); - memset((void *)MeasObj_list, 0, sizeof(*MeasObj_list)); - - // Configure MeasObject - - MeasObj = CALLOC(1, sizeof(*MeasObj)); - memset((void *)MeasObj, 0, sizeof(*MeasObj)); - - MeasObj->measObjectId = 1; - MeasObj->measObject.present = MeasObjectToAddMod__measObject_PR_measObjectEUTRA; - MeasObj->measObject.choice.measObjectEUTRA.carrierFreq = 36090; - MeasObj->measObject.choice.measObjectEUTRA.allowedMeasBandwidth = AllowedMeasBandwidth_mbw25; - MeasObj->measObject.choice.measObjectEUTRA.presenceAntennaPort1 = 1; - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf = CALLOC(1, sizeof(uint8_t)); - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.buf[0] = 0; - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.size = 1; - MeasObj->measObject.choice.measObjectEUTRA.neighCellConfig.bits_unused = 6; - MeasObj->measObject.choice.measObjectEUTRA.offsetFreq = NULL; // Default is 15 or 0dB - - MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList = - (CellsToAddModList_t *) CALLOC(1, sizeof(*CellsToAddModList)); - CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList; - - // Add adjacent cell lists (6 per eNB) - for (i = 0; i < 6; i++) { - CellToAdd = (CellsToAddMod_t *) CALLOC(1, sizeof(*CellToAdd)); - CellToAdd->cellIndex = i + 1; - CellToAdd->physCellId = get_adjacent_cell_id(ctxt_pP->module_id, i); - CellToAdd->cellIndividualOffset = Q_OffsetRange_dB0; - - ASN_SEQUENCE_ADD(&CellsToAddModList->list, CellToAdd); - } - - ASN_SEQUENCE_ADD(&MeasObj_list->list, MeasObj); - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->measObjectToAddModList = MeasObj_list; - - // Report Configurations for periodical, A1-A5 events - ReportConfig_list = CALLOC(1, sizeof(*ReportConfig_list)); - - ReportConfig_per = CALLOC(1, sizeof(*ReportConfig_per)); - - ReportConfig_A1 = CALLOC(1, sizeof(*ReportConfig_A1)); - - ReportConfig_A2 = CALLOC(1, sizeof(*ReportConfig_A2)); - - ReportConfig_A3 = CALLOC(1, sizeof(*ReportConfig_A3)); - - ReportConfig_A4 = CALLOC(1, sizeof(*ReportConfig_A4)); - - ReportConfig_A5 = CALLOC(1, sizeof(*ReportConfig_A5)); - - ReportConfig_per->reportConfigId = 1; - ReportConfig_per->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_periodical; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerType.choice.periodical.purpose = - ReportConfigEUTRA__triggerType__periodical__purpose_reportStrongestCells; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_per->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_per); - - ReportConfig_A1->reportConfigId = 2; - ReportConfig_A1->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA1; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. - a1_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA1. - a1_Threshold.choice.threshold_RSRP = 10; - - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A1->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1); - - ReportConfig_A2->reportConfigId = 3; - ReportConfig_A2->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA2; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA2. - a2_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA2. - a2_Threshold.choice.threshold_RSRP = 10; - - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A2->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A2); - - ReportConfig_A3->reportConfigId = 4; - ReportConfig_A3->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA3; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset = - 10; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA3.reportOnLeave = 1; - - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A3); - - ReportConfig_A4->reportConfigId = 5; - ReportConfig_A4->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA4; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA4. - a4_Threshold.present = ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA4. - a4_Threshold.choice.threshold_RSRP = 10; - - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A4->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A4); - - ReportConfig_A5->reportConfigId = 6; - ReportConfig_A5->reportConfig.present = ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.present = - ReportConfigEUTRA__triggerType_PR_event; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.present = - ReportConfigEUTRA__triggerType__event__eventId_PR_eventA5; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA5.a5_Threshold1.present = ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA5.a5_Threshold2.present = ThresholdEUTRA_PR_threshold_RSRP; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA5.a5_Threshold1.choice.threshold_RSRP = 10; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice. - eventA5.a5_Threshold2.choice.threshold_RSRP = 10; - - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.triggerQuantity = ReportConfigEUTRA__triggerQuantity_rsrp; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportQuantity = ReportConfigEUTRA__reportQuantity_both; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.maxReportCells = 2; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportInterval = ReportInterval_ms120; - ReportConfig_A5->reportConfig.choice.reportConfigEUTRA.reportAmount = ReportConfigEUTRA__reportAmount_infinity; - - ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A5); - - Sparams = CALLOC(1, sizeof(*Sparams)); - Sparams->present = MeasConfig__speedStatePars_PR_setup; - Sparams->choice.setup.timeToTrigger_SF.sf_High = SpeedStateScaleFactors__sf_Medium_oDot75; - Sparams->choice.setup.timeToTrigger_SF.sf_Medium = SpeedStateScaleFactors__sf_High_oDot5; - Sparams->choice.setup.mobilityStateParameters.n_CellChangeHigh = 10; - Sparams->choice.setup.mobilityStateParameters.n_CellChangeMedium = 5; - Sparams->choice.setup.mobilityStateParameters.t_Evaluation = MobilityStateParameters__t_Evaluation_s60; - Sparams->choice.setup.mobilityStateParameters.t_HystNormal = MobilityStateParameters__t_HystNormal_s120; - - quantityConfig = CALLOC(1, sizeof(*quantityConfig)); - memset((void *)quantityConfig, 0, sizeof(*quantityConfig)); - quantityConfig->quantityConfigEUTRA = CALLOC(1, sizeof(*quantityConfig->quantityConfigEUTRA)); - memset((void *)quantityConfig->quantityConfigEUTRA, 0, sizeof(*quantityConfig->quantityConfigEUTRA)); - quantityConfig->quantityConfigCDMA2000 = NULL; - quantityConfig->quantityConfigGERAN = NULL; - quantityConfig->quantityConfigUTRA = NULL; - quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = - CALLOC(1, sizeof(*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP)); - quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = - CALLOC(1, sizeof(*quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ)); - *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRP = FilterCoefficient_fc4; - *quantityConfig->quantityConfigEUTRA->filterCoefficientRSRQ = FilterCoefficient_fc4; - - /* mobilityinfo */ - - mobilityInfo = CALLOC(1, sizeof(*mobilityInfo)); - memset((void *)mobilityInfo, 0, sizeof(*mobilityInfo)); - mobilityInfo->targetPhysCellId = - (PhysCellId_t) two_tier_hexagonal_cellIds[ue_context_pP->ue_context.handover_info->modid_t]; - LOG_D(RRC, "[eNB %d] Frame %d: handover preparation: targetPhysCellId: %ld mod_id: %d ue: %x \n", - ctxt_pP->module_id, - ctxt_pP->frame, - mobilityInfo->targetPhysCellId, - ctxt_pP->module_id, - ue_context_pP->ue_context.rnti); - - mobilityInfo->additionalSpectrumEmission = CALLOC(1, sizeof(*mobilityInfo->additionalSpectrumEmission)); - *mobilityInfo->additionalSpectrumEmission = 1; //Check this value! - - mobilityInfo->t304 = MobilityControlInfo__t304_ms50; // need to configure an appropriate value here - - // New UE Identity (C-RNTI) to identify an UE uniquely in a cell - mobilityInfo->newUE_Identity.size = 2; - mobilityInfo->newUE_Identity.bits_unused = 0; - mobilityInfo->newUE_Identity.buf = rv; - mobilityInfo->newUE_Identity.buf[0] = rv[0]; - mobilityInfo->newUE_Identity.buf[1] = rv[1]; - - //memset((void *)&mobilityInfo->radioResourceConfigCommon,(void *)&rrc_inst->sib2->radioResourceConfigCommon,sizeof(RadioResourceConfigCommon_t)); - //memset((void *)&mobilityInfo->radioResourceConfigCommon,0,sizeof(RadioResourceConfigCommon_t)); - - // Configuring radioResourceConfigCommon - mobilityInfo->radioResourceConfigCommon.rach_ConfigCommon = - CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.rach_ConfigCommon)); - memcpy((void *)mobilityInfo->radioResourceConfigCommon.rach_ConfigCommon, - (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.rach_ConfigCommon, sizeof(RACH_ConfigCommon_t)); - mobilityInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo = - CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo)); - memcpy((void *)mobilityInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo, - (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.prach_Config.prach_ConfigInfo, - sizeof(PRACH_ConfigInfo_t)); - - mobilityInfo->radioResourceConfigCommon.prach_Config.rootSequenceIndex = - rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.prach_Config.rootSequenceIndex; - mobilityInfo->radioResourceConfigCommon.pdsch_ConfigCommon = - CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.pdsch_ConfigCommon)); - memcpy((void *)mobilityInfo->radioResourceConfigCommon.pdsch_ConfigCommon, - (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.pdsch_ConfigCommon, sizeof(PDSCH_ConfigCommon_t)); - memcpy((void *)&mobilityInfo->radioResourceConfigCommon.pusch_ConfigCommon, - (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.pusch_ConfigCommon, sizeof(PUSCH_ConfigCommon_t)); - mobilityInfo->radioResourceConfigCommon.phich_Config = NULL; - mobilityInfo->radioResourceConfigCommon.pucch_ConfigCommon = - CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.pucch_ConfigCommon)); - memcpy((void *)mobilityInfo->radioResourceConfigCommon.pucch_ConfigCommon, - (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.pucch_ConfigCommon, sizeof(PUCCH_ConfigCommon_t)); - mobilityInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon = - CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon)); - memcpy((void *)mobilityInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon, - (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.soundingRS_UL_ConfigCommon, - sizeof(SoundingRS_UL_ConfigCommon_t)); - mobilityInfo->radioResourceConfigCommon.uplinkPowerControlCommon = - CALLOC(1, sizeof(*mobilityInfo->radioResourceConfigCommon.uplinkPowerControlCommon)); - memcpy((void *)mobilityInfo->radioResourceConfigCommon.uplinkPowerControlCommon, - (void *)&rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.uplinkPowerControlCommon, - sizeof(UplinkPowerControlCommon_t)); - mobilityInfo->radioResourceConfigCommon.antennaInfoCommon = NULL; - mobilityInfo->radioResourceConfigCommon.p_Max = NULL; // CALLOC(1,sizeof(*mobilityInfo->radioResourceConfigCommon.p_Max)); - //memcpy((void *)mobilityInfo->radioResourceConfigCommon.p_Max,(void *)rrc_inst->sib1->p_Max,sizeof(P_Max_t)); - mobilityInfo->radioResourceConfigCommon.tdd_Config = NULL; //CALLOC(1,sizeof(TDD_Config_t)); - //memcpy((void *)mobilityInfo->radioResourceConfigCommon.tdd_Config,(void *)rrc_inst->sib1->tdd_Config,sizeof(TDD_Config_t)); - mobilityInfo->radioResourceConfigCommon.ul_CyclicPrefixLength = - rrc_inst->carrier[0] /* CROUX TBC */.sib2->radioResourceConfigCommon.ul_CyclicPrefixLength; - //End of configuration of radioResourceConfigCommon - - mobilityInfo->carrierFreq = CALLOC(1, sizeof(*mobilityInfo->carrierFreq)); //CALLOC(1,sizeof(CarrierFreqEUTRA_t)); 36090 - mobilityInfo->carrierFreq->dl_CarrierFreq = 36090; - mobilityInfo->carrierFreq->ul_CarrierFreq = NULL; - - mobilityInfo->carrierBandwidth = CALLOC(1, sizeof( - *mobilityInfo->carrierBandwidth)); //CALLOC(1,sizeof(struct CarrierBandwidthEUTRA)); AllowedMeasBandwidth_mbw25 - mobilityInfo->carrierBandwidth->dl_Bandwidth = CarrierBandwidthEUTRA__dl_Bandwidth_n25; - mobilityInfo->carrierBandwidth->ul_Bandwidth = NULL; - mobilityInfo->rach_ConfigDedicated = NULL; - - // store the srb and drb list for ho management, mainly in case of failure - - memcpy(ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.srb_ToAddModList, - (void*)SRB_configList2, - sizeof(SRB_ToAddModList_t)); - memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToAddModList, - (void*)DRB_configList2, - sizeof(DRB_ToAddModList_t)); - ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.drb_ToReleaseList = NULL; - memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.mac_MainConfig, - (void*)mac_MainConfig, - sizeof(MAC_MainConfig_t)); - memcpy((void*)ue_context_pP->ue_context.handover_info->as_config.sourceRadioResourceConfig.physicalConfigDedicated, - (void*)ue_context_pP->ue_context.physicalConfigDedicated, - sizeof(PhysicalConfigDedicated_t)); - /* memcpy((void *)rrc_inst->handover_info[ue_mod_idP]->as_config.sourceRadioResourceConfig.sps_Config, - (void *)rrc_inst->sps_Config[ue_mod_idP], - sizeof(SPS_Config_t)); - */ - LOG_I(RRC, "[eNB %d] Frame %d: adding new UE\n", - ctxt_pP->module_id, ctxt_pP->frame); - //Idx = (ue_mod_idP * NB_RB_MAX) + DCCH; - Idx = DCCH; - // SRB1 - ue_context_pP->ue_context.Srb1.Active = 1; - ue_context_pP->ue_context.Srb1.Srb_info.Srb_id = Idx; - memcpy(&ue_context_pP->ue_context.Srb1.Srb_info.Lchan_desc[0], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); - memcpy(&ue_context_pP->ue_context.Srb1.Srb_info.Lchan_desc[1], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); - - // SRB2 - ue_context_pP->ue_context.Srb2.Active = 1; - ue_context_pP->ue_context.Srb2.Srb_info.Srb_id = Idx; - memcpy(&ue_context_pP->ue_context.Srb2.Srb_info.Lchan_desc[0], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); - memcpy(&ue_context_pP->ue_context.Srb2.Srb_info.Lchan_desc[1], &DCCH_LCHAN_DESC, LCHAN_DESC_SIZE); - - LOG_I(RRC, "[eNB %d] CALLING RLC CONFIG SRB1 (rbid %d) for UE %x\n", - ctxt_pP->module_id, Idx, ue_context_pP->ue_context.rnti); - - // rrc_pdcp_config_req (enb_mod_idP, frameP, 1, CONFIG_ACTION_ADD, idx, UNDEF_SECURITY_MODE); - // rrc_rlc_config_req(enb_mod_idP,frameP,1,CONFIG_ACTION_ADD,Idx,SIGNALLING_RADIO_BEARER,Rlc_info_am_config); - - rrc_pdcp_config_asn1_req(&ctxt, - ue_context_pP->ue_context.SRB_configList, - (DRB_ToAddModList_t *) NULL, (DRB_ToReleaseList_t *) NULL, 0xff, NULL, NULL, NULL -#if defined(Rel10) || defined(Rel14) - , (PMCH_InfoList_r9_t *) NULL -#endif - ,NULL); - - rrc_rlc_config_asn1_req(&ctxt, - ue_context_pP->ue_context.SRB_configList, - (DRB_ToAddModList_t *) NULL, (DRB_ToReleaseList_t *) NULL -#if defined(Rel10) || defined(Rel14) - , (PMCH_InfoList_r9_t *) NULL -#endif - ); - - /* Initialize NAS list */ - dedicatedInfoNASList = NULL; - - // rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->reportConfigToAddModList = ReportConfig_list; - memset(buffer, 0, RRC_BUF_SIZE); - - size = do_RRCConnectionReconfiguration( - ctxt_pP, - buffer, - rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), //Transaction_id, - SRB_configList2, - DRB_configList2, - NULL, // DRB2_list, - NULL, //*sps_Config, - ue_context_pP->ue_context.physicalConfigDedicated, - MeasObj_list, - ReportConfig_list, - NULL, //quantityConfig, - MeasId_list, - mac_MainConfig, - NULL, - mobilityInfo, - Sparams, - NULL, - NULL, - dedicatedInfoNASList -#if defined(Rel10) || defined(Rel14) - , NULL // SCellToAddMod_r10_t -#endif - ); - - LOG_I(RRC, - "[eNB %d] Frame %d, Logical Channel DL-DCCH, Generate RRCConnectionReconfiguration for handover (bytes %d, UE rnti %x)\n", - ctxt_pP->module_id, ctxt_pP->frame, size, ue_context_pP->ue_context.rnti); - // to be updated if needed - /*if (RC.rrc[ctxt_pP->module_id]->SRB1_config[ue_mod_idP]->logicalChannelConfig) { - if (RC.rrc[ctxt_pP->module_id]->SRB1_config[ue_mod_idP]->logicalChannelConfig->present == SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { - SRB1_logicalChannelConfig = &RC.rrc[ctxt_pP->module_id]->SRB1_config[ue_mod_idP]->logicalChannelConfig->choice.explicitValue; - } - else { - SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; - } - } - else { - SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; - } - */ - - LOG_D(RRC, - "[FRAME %05d][RRC_eNB][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (rrcConnectionReconfiguration_handover to UE %x MUI %d) --->][PDCP][MOD %02d][RB %02d]\n", - ctxt_pP->frame, ctxt_pP->module_id, size, ue_context_pP->ue_context.rnti, rrc_eNB_mui, ctxt_pP->module_id, DCCH); - //rrc_rlc_data_req(ctxt_pP->module_id,frameP, 1,(ue_mod_idP*NB_RB_MAX)+DCCH,rrc_eNB_mui++,0,size,(char*)buffer); - //pdcp_data_req (ctxt_pP->module_id, frameP, 1, (ue_mod_idP * NB_RB_MAX) + DCCH,rrc_eNB_mui++, 0, size, (char *) buffer, 1); - - rrc_mac_config_req_eNB( - ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, -#ifdef Rel14 - 0, -#endif - ue_context_pP->ue_context.rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t *) NULL, -#ifdef Rel14 - (RadioResourceConfigCommonSIB_t *) NULL, -#endif - ue_context_pP->ue_context.physicalConfigDedicated, -#if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, -#endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - 1, - SRB1_logicalChannelConfig, - ue_context_pP->ue_context.measGapConfig, - (TDD_Config_t *) NULL, - (MobilityControlInfo_t *) mobilityInfo, - (SchedulingInfoList_t *) NULL, 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL -#if defined(Rel10) || defined(Rel14) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL -#endif -# ifdef Rel14 - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL -# endif - ); - - /* - handoverCommand.criticalExtensions.present = HandoverCommand__criticalExtensions_PR_c1; - handoverCommand.criticalExtensions.choice.c1.present = HandoverCommand__criticalExtensions__c1_PR_handoverCommand_r8; - handoverCommand.criticalExtensions.choice.c1.choice.handoverCommand_r8.handoverCommandMessage.buf = buffer; - handoverCommand.criticalExtensions.choice.c1.choice.handoverCommand_r8.handoverCommandMessage.size = size; - */ -//#warning "COMPILATION PROBLEM" -#ifdef PROBLEM_COMPILATION_RESOLVED - - if (sourceModId != 0xFF) { - memcpy(RC.rrc[sourceModId].handover_info[RC.rrc[ctxt_pP->module_id]->handover_info[ue_mod_idP]->ueid_s]->buf, - (void *)buffer, size); - RC.rrc[sourceModId].handover_info[RC.rrc[ctxt_pP->module_id]->handover_info[ue_mod_idP]->ueid_s]->size = size; - RC.rrc[sourceModId].handover_info[RC.rrc[ctxt_pP->module_id]->handover_info[ue_mod_idP]->ueid_s]->ho_complete = - 0xF1; - //RC.rrc[ctxt_pP->module_id]->handover_info[ue_mod_idP]->ho_complete = 0xFF; - LOG_D(RRC, "[eNB %d] Frame %d: setting handover complete to 0xF1 for (%d,%d) and to 0xFF for (%d,%d)\n", - ctxt_pP->module_id, - ctxt_pP->frame, - sourceModId, - RC.rrc[ctxt_pP->module_id]->handover_info[ue_mod_idP]->ueid_s, - ctxt_pP->module_id, - ue_mod_idP); - } else - LOG_W(RRC, - "[eNB %d] Frame %d: rrc_eNB_generate_RRCConnectionReconfiguration_handover: Could not find source eNB mod_id.\n", - ctxt_pP->module_id, ctxt_pP->frame); - -#endif -} - -/* - void ue_rrc_process_rrcConnectionReconfiguration(uint8_t enb_mod_idP,frame_t frameP, - RRCConnectionReconfiguration_t *rrcConnectionReconfiguration, - uint8_t CH_index) { - - if (rrcConnectionReconfiguration->criticalExtensions.present == RRCConnectionReconfiguration__criticalExtensions_PR_c1) - if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.present == RRCConnectionReconfiguration__criticalExtensions__c1_PR_rrcConnectionReconfiguration_r8) { - - if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated) { - rrc_ue_process_radioResourceConfigDedicated(enb_mod_idP,frameP,CH_index, - rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated); - - } - - // check other fields for - } - } -*/ - -//----------------------------------------------------------------------------- -void -rrc_eNB_process_RRCConnectionReconfigurationComplete( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* ue_context_pP, - const uint8_t xid -) -//----------------------------------------------------------------------------- -{ - int i, drb_id; -#ifdef PDCP_USE_NETLINK - int oip_ifup = 0; - int dest_ip_offset = 0; - module_id_t ue_module_id = -1; - /* avoid gcc warnings */ - (void)oip_ifup; - (void)dest_ip_offset; - (void)ue_module_id; -#endif - - uint8_t *kRRCenc = NULL; - uint8_t *kRRCint = NULL; - uint8_t *kUPenc = NULL; - ue_context_pP->ue_context.ue_reestablishment_timer = 0; - - DRB_ToAddModList_t* DRB_configList = ue_context_pP->ue_context.DRB_configList2[xid]; - SRB_ToAddModList_t* SRB_configList = ue_context_pP->ue_context.SRB_configList2[xid]; - DRB_ToReleaseList_t* DRB_Release_configList2 = ue_context_pP->ue_context.DRB_Release_configList2[xid]; - DRB_Identity_t* drb_id_p = NULL; - - T(T_ENB_RRC_CONNECTION_RECONFIGURATION_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - -#if defined(ENABLE_SECURITY) - - /* Derive the keys from kenb */ - if (DRB_configList != NULL) { - derive_key_up_enc(ue_context_pP->ue_context.ciphering_algorithm, - ue_context_pP->ue_context.kenb, &kUPenc); - } - - derive_key_rrc_enc(ue_context_pP->ue_context.ciphering_algorithm, - ue_context_pP->ue_context.kenb, &kRRCenc); - derive_key_rrc_int(ue_context_pP->ue_context.integrity_algorithm, - ue_context_pP->ue_context.kenb, &kRRCint); - -#endif - - // Refresh SRBs/DRBs - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_PDCP_ENB, - NULL, - 0, - MSC_AS_TIME_FMT" CONFIG_REQ UE %x DRB (security unchanged)", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti); - - rrc_pdcp_config_asn1_req( - ctxt_pP, - SRB_configList, //NULL, //LG-RK 14/05/2014 SRB_configList, - DRB_configList, -// (DRB_ToReleaseList_t *) NULL, - DRB_Release_configList2, - /*RC.rrc[ctxt_pP->module_id]->ciphering_algorithm[ue_mod_idP] | - (RC.rrc[ctxt_pP->module_id]->integrity_algorithm[ue_mod_idP] << 4), - */ - 0xff, // already configured during the securitymodecommand - kRRCenc, - kRRCint, - kUPenc -#if defined(Rel10) || defined(Rel14) - , (PMCH_InfoList_r9_t *) NULL -#endif - ,NULL); - // Refresh SRBs/DRBs - rrc_rlc_config_asn1_req( - ctxt_pP, - SRB_configList, // NULL, //LG-RK 14/05/2014 SRB_configList, - DRB_configList, -// (DRB_ToReleaseList_t *) NULL - DRB_Release_configList2 -#if defined(Rel10) || defined(Rel14) - , (PMCH_InfoList_r9_t *) NULL -#endif - ); - - // set the SRB active in Ue context - if (SRB_configList != NULL) { - for (i = 0; (i < SRB_configList->list.count) && (i < 3); i++) { - if (SRB_configList->list.array[i]->srb_Identity == 1 ){ - ue_context_pP->ue_context.Srb1.Active=1; - } - else if (SRB_configList->list.array[i]->srb_Identity == 2 ) { - ue_context_pP->ue_context.Srb2.Active=1; - ue_context_pP->ue_context.Srb2.Srb_info.Srb_id=2; - LOG_I(RRC,"[eNB %d] Frame %d CC %d : SRB2 is now active\n", - ctxt_pP->module_id, - ctxt_pP->frame, - ue_context_pP->ue_context.primaryCC_id); - } else { - LOG_W(RRC,"[eNB %d] Frame %d CC %d : invalide SRB identity %ld\n", - ctxt_pP->module_id, - ctxt_pP->frame, - ue_context_pP->ue_context.primaryCC_id, - SRB_configList->list.array[i]->srb_Identity); - } - } - free(SRB_configList); - ue_context_pP->ue_context.SRB_configList2[xid] = NULL; - } - - // Loop through DRBs and establish if necessary - - if (DRB_configList != NULL) { - for (i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8) - if (DRB_configList->list.array[i]) { - drb_id = (int)DRB_configList->list.array[i]->drb_Identity; - LOG_I(RRC, - "[eNB %d] Frame %d : Logical Channel UL-DCCH, Received RRCConnectionReconfigurationComplete from UE rnti %x, reconfiguring DRB %d/LCID %d\n", - ctxt_pP->module_id, - ctxt_pP->frame, - ctxt_pP->rnti, - (int)DRB_configList->list.array[i]->drb_Identity, - (int)*DRB_configList->list.array[i]->logicalChannelIdentity); - // for pre-ci tests - LOG_I(RRC, - "[eNB %d] Frame %d : Logical Channel UL-DCCH, Received RRCConnectionReconfigurationComplete from UE %u, reconfiguring DRB %d/LCID %d\n", - ctxt_pP->module_id, - ctxt_pP->frame, - oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid], - (int)DRB_configList->list.array[i]->drb_Identity, - (int)*DRB_configList->list.array[i]->logicalChannelIdentity); - - if (ue_context_pP->ue_context.DRB_active[drb_id] == 0) { - /* - rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_ADD, - (ue_mod_idP * NB_RB_MAX) + *DRB_configList->list.array[i]->logicalChannelIdentity,UNDEF_SECURITY_MODE); - rrc_rlc_config_req(ctxt_pP->module_id,frameP,1,CONFIG_ACTION_ADD, - (ue_mod_idP * NB_RB_MAX) + (int)*RC.rrc[ctxt_pP->module_id]->DRB_config[ue_mod_idP][i]->logicalChannelIdentity, - RADIO_ACCESS_BEARER,Rlc_info_um); - */ - ue_context_pP->ue_context.DRB_active[drb_id] = 1; - - LOG_D(RRC, - "[eNB %d] Frame %d: Establish RLC UM Bidirectional, DRB %d Active\n", - ctxt_pP->module_id, ctxt_pP->frame, (int)DRB_configList->list.array[i]->drb_Identity); -#if defined(PDCP_USE_NETLINK) && !defined(LINK_ENB_PDCP_TO_GTPV1U) - // can mean also IPV6 since ether -> ipv6 autoconf -# if !defined(OAI_NW_DRIVER_TYPE_ETHERNET) && !defined(EXMIMO) && !defined(OAI_USRP) && !defined(OAI_BLADERF) && !defined(ETHERNET) && !defined(OAI_ADRV9371_ZC706) - LOG_I(OIP, "[eNB %d] trying to bring up the OAI interface oai%d\n", - ctxt_pP->module_id, - ctxt_pP->module_id); - oip_ifup = nas_config( - ctxt_pP->module_id, // interface index - ctxt_pP->module_id + 1, // thrid octet - ctxt_pP->module_id + 1); // fourth octet - - if (oip_ifup == 0) { // interface is up --> send a config the DRB - dest_ip_offset = 8; - LOG_I(OIP, - "[eNB %d] Config the oai%d to send/receive pkt on DRB %ld to/from the protocol stack\n", - ctxt_pP->module_id, ctxt_pP->module_id, - (long int)((ue_context_pP->local_uid * maxDRB) + DRB_configList->list.array[i]->drb_Identity)); - ue_module_id = oai_emulation.info.eNB_ue_local_uid_to_ue_module_id[ctxt_pP->module_id][ue_context_pP->local_uid]; - rb_conf_ipv4(0, //add - ue_module_id, //cx - ctxt_pP->module_id, //inst - (ue_module_id * maxDRB) + DRB_configList->list.array[i]->drb_Identity, // RB - 0, //dscp - ipv4_address(ctxt_pP->module_id + 1, ctxt_pP->module_id + 1), //saddr - ipv4_address(ctxt_pP->module_id + 1, dest_ip_offset + ue_module_id + 1)); //daddr - LOG_D(RRC, "[eNB %d] State = Attached (UE rnti %x module id %u)\n", - ctxt_pP->module_id, ue_context_pP->ue_context.rnti, ue_module_id); - } - -# endif -#endif - - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (DRB) ---> MAC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - - if (DRB_configList->list.array[i]->logicalChannelIdentity) { - DRB2LCHAN[i] = (uint8_t) * DRB_configList->list.array[i]->logicalChannelIdentity; - } - - rrc_mac_config_req_eNB( - ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, -#ifdef Rel14 - 0, -#endif - ue_context_pP->ue_context.rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t *) NULL, -#ifdef Rel14 - (RadioResourceConfigCommonSIB_t *) NULL, -#endif - ue_context_pP->ue_context.physicalConfigDedicated, -#if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, -#endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - DRB2LCHAN[i], - DRB_configList->list.array[i]->logicalChannelConfig, - ue_context_pP->ue_context.measGapConfig, - (TDD_Config_t *) NULL, - NULL, - (SchedulingInfoList_t *) NULL, - 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL -#if defined(Rel10) || defined(Rel14) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL -#endif -# ifdef Rel14 - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL -# endif - ); - - } else { // remove LCHAN from MAC/PHY - - if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) { - // DRB has just been removed so remove RLC + PDCP for DRB - /* rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_REMOVE, - (ue_mod_idP * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE); - */ - rrc_rlc_config_req( - ctxt_pP, - SRB_FLAG_NO, - MBMS_FLAG_NO, - CONFIG_ACTION_REMOVE, - DRB2LCHAN[i], - Rlc_info_um); - } - - ue_context_pP->ue_context.DRB_active[drb_id] = 0; - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (DRB) ---> MAC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrc_mac_config_req_eNB(ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, -#ifdef Rel14 - 0, -#endif - ue_context_pP->ue_context.rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t *) NULL, -#ifdef Rel14 - (RadioResourceConfigCommonSIB_t *) NULL, -#endif - ue_context_pP->ue_context.physicalConfigDedicated, -#if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, -#endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - DRB2LCHAN[i], - (LogicalChannelConfig_t *) NULL, - (MeasGapConfig_t *) NULL, - (TDD_Config_t *) NULL, - NULL, - (SchedulingInfoList_t *) NULL, - 0, NULL, NULL, NULL -#if defined(Rel10) || defined(Rel14) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL -#endif -# ifdef Rel14 - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL -# endif - ); - } - } - } - free(DRB_configList); - ue_context_pP->ue_context.DRB_configList2[xid] = NULL; - } - - if(DRB_Release_configList2 != NULL){ - for (i = 0; i < DRB_Release_configList2->list.count; i++) { - if (DRB_Release_configList2->list.array[i]) { - drb_id_p = DRB_Release_configList2->list.array[i]; - drb_id = *drb_id_p; - if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) { - ue_context_pP->ue_context.DRB_active[drb_id] = 0; - } - } - } - free(DRB_Release_configList2); - ue_context_pP->ue_context.DRB_Release_configList2[xid] = NULL; - } -} - -//----------------------------------------------------------------------------- -void -rrc_eNB_generate_RRCConnectionSetup( - const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* const ue_context_pP, - const int CC_id -) -//----------------------------------------------------------------------------- -{ - - LogicalChannelConfig_t *SRB1_logicalChannelConfig; //,*SRB2_logicalChannelConfig; - SRB_ToAddModList_t **SRB_configList; - SRB_ToAddMod_t *SRB1_config; - int cnt; - - T(T_ENB_RRC_CONNECTION_SETUP, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - SRB_configList = &ue_context_pP->ue_context.SRB_configList; - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size = - do_RRCConnectionSetup(ctxt_pP, - ue_context_pP, - CC_id, - (uint8_t*) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Payload, - (uint8_t) RC.rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, //at this point we do not have the UE capability information, so it can only be TM1 or TM2 - rrc_eNB_get_next_transaction_identifier(ctxt_pP->module_id), - SRB_configList, - &ue_context_pP->ue_context.physicalConfigDedicated); - -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC Connection Setup\n"); - - for (cnt = 0; cnt < RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size; cnt++) { - LOG_F(RRC,"%02x ", ((uint8_t*)RC.rrc[ctxt_pP->module_id]->Srb0.Tx_buffer.Payload)[cnt]); - } - - LOG_F(RRC,"\n"); - ////////////////////////////////// -#endif - - // configure SRB1/SRB2, PhysicalConfigDedicated, MAC_MainConfig for UE - - if (*SRB_configList != NULL) { - for (cnt = 0; cnt < (*SRB_configList)->list.count; cnt++) { - if ((*SRB_configList)->list.array[cnt]->srb_Identity == 1) { - SRB1_config = (*SRB_configList)->list.array[cnt]; - - if (SRB1_config->logicalChannelConfig) { - if (SRB1_config->logicalChannelConfig->present == - SRB_ToAddMod__logicalChannelConfig_PR_explicitValue) { - SRB1_logicalChannelConfig = &SRB1_config->logicalChannelConfig->choice.explicitValue; - } else { - SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; - } - } else { - SRB1_logicalChannelConfig = &SRB1_logicalChannelConfig_defaultValue; - } - - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRC_eNB --- MAC_CONFIG_REQ (SRB1) ---> MAC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrc_mac_config_req_eNB( - ctxt_pP->module_id, - ue_context_pP->ue_context.primaryCC_id, - 0,0,0,0,0, -#ifdef Rel14 - 0, -#endif - ue_context_pP->ue_context.rnti, - (BCCH_BCH_Message_t *) NULL, - (RadioResourceConfigCommonSIB_t *) NULL, -#ifdef Rel14 - (RadioResourceConfigCommonSIB_t *) NULL, -#endif - ue_context_pP->ue_context.physicalConfigDedicated, -#if defined(Rel10) || defined(Rel14) - (SCellToAddMod_r10_t *)NULL, - //(struct PhysicalConfigDedicatedSCell_r10 *)NULL, -#endif - (MeasObjectToAddMod_t **) NULL, - ue_context_pP->ue_context.mac_MainConfig, - 1, - SRB1_logicalChannelConfig, - ue_context_pP->ue_context.measGapConfig, - (TDD_Config_t *) NULL, - NULL, - (SchedulingInfoList_t *) NULL, - 0, NULL, NULL, (MBSFN_SubframeConfigList_t *) NULL -#if defined(Rel10) || defined(Rel14) - , 0, (MBSFN_AreaInfoList_r9_t *) NULL, (PMCH_InfoList_r9_t *) NULL -#endif -# ifdef Rel14 - , - (SystemInformationBlockType1_v1310_IEs_t *)NULL -# endif - ); - break; - } - } - } - - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.Header, // LG WARNING - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size, - MSC_AS_TIME_FMT" RRCConnectionSetup UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_pP->ue_context.rnti, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); - - - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" [RAPROC] Logical Channel DL-CCCH, Generating RRCConnectionSetup (bytes %d)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Tx_buffer.payload_size); - - // activate release timer, if RRCSetupComplete not received after 10 frames, remove UE - //ue_context_pP->ue_context.ue_release_timer=1; - // remove UE after 10 frames after RRCConnectionRelease is triggered - //ue_context_pP->ue_context.ue_release_timer_thres=100; - // activate release timer, if RRCSetupComplete not received after 100 frames, remove UE - ue_context_pP->ue_context.ue_release_timer=1; - // remove UE after 10 frames after RRCConnectionRelease is triggered - ue_context_pP->ue_context.ue_release_timer_thres=1000; -} - - -#if defined(ENABLE_ITTI) -//----------------------------------------------------------------------------- -char -openair_rrc_eNB_configuration( - const module_id_t enb_mod_idP, - RrcConfigurationReq* configuration -) -#else -char -openair_rrc_eNB_init( - const module_id_t enb_mod_idP -) -#endif -//----------------------------------------------------------------------------- -{ - protocol_ctxt_t ctxt; - int CC_id; - - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, enb_mod_idP, ENB_FLAG_YES, NOT_A_RNTI, 0, 0,enb_mod_idP); - LOG_I(RRC, - PROTOCOL_RRC_CTXT_FMT" Init...\n", - PROTOCOL_RRC_CTXT_ARGS(&ctxt)); - -#if OCP_FRAMEWORK - while ( RC.rrc[enb_mod_idP] == NULL ) { - LOG_E(RRC, "RC.rrc not yet initialized, waiting 1 second\n"); - sleep(1); - } -#endif - AssertFatal(RC.rrc[enb_mod_idP] != NULL, "RC.rrc not initialized!"); - AssertFatal(NUMBER_OF_UE_MAX < (module_id_t)0xFFFFFFFFFFFFFFFF, " variable overflow"); -#ifdef ENABLE_ITTI - AssertFatal(configuration!=NULL,"configuration input is null\n"); -#endif - // for (j = 0; j < NUMBER_OF_UE_MAX; j++) - // RC.rrc[ctxt.module_id].Info.UE[j].Status = RRC_IDLE; //CH_READY; - // - //#if defined(ENABLE_USE_MME) - // // Connect eNB to MME - // if (EPC_MODE_ENABLED <= 0) - //#endif - // { - // /* Init security parameters */ - // for (j = 0; j < NUMBER_OF_UE_MAX; j++) { - // RC.rrc[ctxt.module_id].ciphering_algorithm[j] = SecurityAlgorithmConfig__cipheringAlgorithm_eea0; - // RC.rrc[ctxt.module_id].integrity_algorithm[j] = SecurityAlgorithmConfig__integrityProtAlgorithm_eia2; - // rrc_eNB_init_security(enb_mod_idP, j); - // } - // } - RC.rrc[ctxt.module_id]->Nb_ue = 0; + #endif + AssertFatal(RC.nr_rrc[gnb_mod_idP] != NULL, "RC.nr_rrc not initialized!"); + AssertFatal(NUMBER_OF_UE_MAX < (module_id_t)0xFFFFFFFFFFFFFFFF, " variable overflow"); + #ifdef ENABLE_ITTI + AssertFatal(configuration!=NULL,"configuration input is null\n"); + #endif + + RC.nr_rrc[ctxt.module_id]->Nb_ue = 0; for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - RC.rrc[ctxt.module_id]->carrier[CC_id].Srb0.Active = 0; + RC.nr_rrc[ctxt.module_id]->carrier[CC_id].Srb0.Active = 0; } - uid_linear_allocator_init(&RC.rrc[ctxt.module_id]->uid_allocator); - RB_INIT(&RC.rrc[ctxt.module_id]->rrc_ue_head); - // for (j = 0; j < (NUMBER_OF_UE_MAX + 1); j++) { - // RC.rrc[enb_mod_idP]->Srb2[j].Active = 0; - // } + uid_linear_allocator_init(&nr_rrc.nr_rrc[ctxt.module_id]->uid_allocator); + RB_INIT(&RC.nr_rrc[ctxt.module_id]->rrc_ue_head); + RC.nr_rrc[ctxt.module_id]->initial_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); + RC.nr_rrc[ctxt.module_id]->s1ap_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); - RC.rrc[ctxt.module_id]->initial_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); - RC.rrc[ctxt.module_id]->s1ap_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); - - memcpy(&RC.rrc[ctxt.module_id]->configuration,configuration,sizeof(RrcConfigurationReq)); + memcpy(&RC.nr_rrc[ctxt.module_id]->configuration,configuration,sizeof(gNB_RrcConfigurationReq)); /// System Information INIT - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Checking release \n", - PROTOCOL_RRC_CTXT_ARGS(&ctxt)); -#if defined(Rel10) || defined(Rel14) + LOG_I(NR_RRC, PROTOCOL_NRRRC_CTXT_FMT" Checking release \n",PROTOCOL_NRRRC_CTXT_ARGS(&ctxt)); - // can clear it at runtime - RC.rrc[ctxt.module_id]->carrier[0].MBMS_flag = 0; - - // This has to come from some top-level configuration - // only CC_id 0 is logged -#if defined(Rel10) - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Rel10 RRC detected, MBMS flag %d\n", -#else - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Rel14 RRC detected, MBMS flag %d\n", -#endif - PROTOCOL_RRC_CTXT_ARGS(&ctxt), - RC.rrc[ctxt.module_id]->carrier[0].MBMS_flag); - -#else - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Rel8 RRC\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); -#endif -#ifdef CBA + #ifdef CBA for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { for (j = 0; j < NUM_MAX_CBA_GROUP; j++) { - RC.rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[j] = CBA_OFFSET + j; + RC.nr_rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[j] = CBA_OFFSET + j; } - if (RC.rrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups > NUM_MAX_CBA_GROUP) { - RC.rrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups = NUM_MAX_CBA_GROUP; + if (RC.nr_rrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups > NUM_MAX_CBA_GROUP) { + RC.nr_rrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups = NUM_MAX_CBA_GROUP; } - LOG_D(RRC, - PROTOCOL_RRC_CTXT_FMT" Initialization of 4 cba_RNTI values (%x %x %x %x) num active groups %d\n", - PROTOCOL_RRC_CTXT_ARGS(&ctxt), - enb_mod_idP, RC.rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[0], - RC.rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[1], - RC.rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[2], - RC.rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[3], - RC.rrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups); + LOG_D(NR_RRC, + PROTOCOL_NRRRC_CTXT_FMT" Initialization of 4 cba_RNTI values (%x %x %x %x) num active groups %d\n", + PROTOCOL_NRRRC_CTXT_ARGS(&ctxt), + gnb_mod_idP, RC.nr_rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[0], + RC.nr_rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[1], + RC.nr_rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[2], + RC.nr_rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[3], + RC.nr_rrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups); } -#endif + #endif for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - init_SI(&ctxt, - CC_id -#if defined(ENABLE_ITTI) - , configuration -#endif - ); - for (int ue_id = 0; ue_id < NUMBER_OF_UE_MAX; ue_id++) { - RC.rrc[ctxt.module_id]->carrier[CC_id].sizeof_paging[ue_id] = 0; - RC.rrc[ctxt.module_id]->carrier[CC_id].paging[ue_id] = (uint8_t*) malloc16(256); + init_NR_SI(&ctxt, + CC_id + #if defined(ENABLE_ITTI) + ,configuration + #endif + ); + for (int ue_id = 0; ue_id < NUMBER_OF_UE_MAX; ue_id++){ + RC.nr_rrc[ctxt.module_id]->carrier[CC_id].sizeof_paging[ue_id] = 0; + RC.nr_rrc[ctxt.module_id]->carrier[CC_id].paging[ue_id] = (uint8_t*) malloc16(256); } - } - rrc_init_global_param(); + }//END for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) + + //rrc_init_NR_global_param(); + for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - -#if defined(Rel10) || defined(Rel14) - switch (RC.rrc[ctxt.module_id]->carrier[CC_id].MBMS_flag) { - case 1: - case 2: - case 3: - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Configuring 1 MBSFN sync area\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); - RC.rrc[ctxt.module_id]->carrier[CC_id].num_mbsfn_sync_area = 1; - break; - - case 4: - LOG_I(RRC, PROTOCOL_RRC_CTXT_FMT" Configuring 2 MBSFN sync area\n", PROTOCOL_RRC_CTXT_ARGS(&ctxt)); - RC.rrc[ctxt.module_id]->carrier[CC_id].num_mbsfn_sync_area = 2; - break; - - default: - RC.rrc[ctxt.module_id]->carrier[CC_id].num_mbsfn_sync_area = 0; - break; - } - - // if we are here the RC.rrc[enb_mod_idP]->MBMS_flag > 0, - /// MCCH INIT - if (RC.rrc[ctxt.module_id]->carrier[CC_id].MBMS_flag > 0) { - init_MCCH(ctxt.module_id, CC_id); - /// MTCH data bearer init - init_MBMS(ctxt.module_id, CC_id, 0); - } -#endif - - openair_rrc_top_init_eNB(RC.rrc[ctxt.module_id]->carrier[CC_id].MBMS_flag,0); + openair_rrc_top_init_gNB(RC.nr_rrc[ctxt.module_id]->carrier[CC_id].MBMS_flag,0); } - openair_rrc_on(&ctxt); - return 0; + openair_nrrrc_on(&ctxt); -} + return 0; -/*------------------------------------------------------------------------------*/ -int -rrc_eNB_decode_ccch( - protocol_ctxt_t* const ctxt_pP, - const SRB_INFO* const Srb_info, - const int CC_id -) -//----------------------------------------------------------------------------- -{ - module_id_t Idx; - asn_dec_rval_t dec_rval; - UL_CCCH_Message_t *ul_ccch_msg = NULL; - RRCConnectionRequest_r8_IEs_t* rrcConnectionRequest = NULL; - RRCConnectionReestablishmentRequest_r8_IEs_t* rrcConnectionReestablishmentRequest = NULL; - int i, rval; - struct rrc_eNB_ue_context_s* ue_context_p = NULL; - uint64_t random_value = 0; - int stmsi_received = 0; +}//END openair_rrc_eNB_configuration - T(T_ENB_RRC_UL_CCCH_DATA_IN, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - //memset(ul_ccch_msg,0,sizeof(UL_CCCH_Message_t)); - - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Decoding UL CCCH %x.%x.%x.%x.%x.%x (%p)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ((uint8_t*) Srb_info->Rx_buffer.Payload)[0], - ((uint8_t *) Srb_info->Rx_buffer.Payload)[1], - ((uint8_t *) Srb_info->Rx_buffer.Payload)[2], - ((uint8_t *) Srb_info->Rx_buffer.Payload)[3], - ((uint8_t *) Srb_info->Rx_buffer.Payload)[4], - ((uint8_t *) Srb_info->Rx_buffer.Payload)[5], (uint8_t *) Srb_info->Rx_buffer.Payload); - dec_rval = uper_decode( - NULL, - &asn_DEF_UL_CCCH_Message, - (void**)&ul_ccch_msg, - (uint8_t*) Srb_info->Rx_buffer.Payload, - 100, - 0, - 0); - - /* +///---------------------------------------------------------------------------------------------------------------/// +///---------------------------------------------------------------------------------------------------------------/// #if defined(ENABLE_ITTI) -# if defined(DISABLE_ITTI_XER_PRINT) - { - MessageDef *message_p; - message_p = itti_alloc_new_message(TASK_RRC_ENB, RRC_UL_CCCH_MESSAGE); - memcpy(&message_p->ittiMsg, (void *)ul_ccch_msg, sizeof(RrcUlCcchMessage)); - - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, message_p); - } -# else - { - char message_string[10000]; - size_t message_string_size; - - if ((message_string_size = - xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_CCCH_Message, (void *)ul_ccch_msg)) > 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized(TASK_RRC_ENB, RRC_UL_CCCH, message_string_size + sizeof(IttiMsgText)); - msg_p->ittiMsg.rrc_ul_ccch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_ul_ccch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); - } - } -# endif -#endif - */ - - for (i = 0; i < 8; i++) { - LOG_T(RRC, "%x.", ((uint8_t *) & ul_ccch_msg)[i]); - } - - if (dec_rval.consumed == 0) { - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" FATAL Error in receiving CCCH\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - return -1; - } - - if (ul_ccch_msg->message.present == UL_CCCH_MessageType_PR_c1) { - - switch (ul_ccch_msg->message.choice.c1.present) { - - case UL_CCCH_MessageType__c1_PR_NOTHING: - LOG_I(RRC, - PROTOCOL_RRC_CTXT_FMT" Received PR_NOTHING on UL-CCCH-Message\n", - PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); - break; - - case UL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentRequest: - T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC Connection Reestablishment Request\n"); - - for (i = 0; i < Srb_info->Rx_buffer.payload_size; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)Srb_info->Rx_buffer.Payload)[i]); - } - - LOG_F(RRC,"\n"); -#endif - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT"MAC_eNB--- MAC_DATA_IND (rrcConnectionReestablishmentRequest on SRB0) --> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrcConnectionReestablishmentRequest = - &ul_ccch_msg->message.choice.c1.choice.rrcConnectionReestablishmentRequest.criticalExtensions.choice.rrcConnectionReestablishmentRequest_r8; - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest cause %s\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ((rrcConnectionReestablishmentRequest->reestablishmentCause == ReestablishmentCause_otherFailure) ? "Other Failure" : - (rrcConnectionReestablishmentRequest->reestablishmentCause == ReestablishmentCause_handoverFailure) ? "Handover Failure" : - "reconfigurationFailure")); - /*{ - uint64_t c_rnti = 0; - - memcpy(((uint8_t *) & c_rnti) + 3, rrcConnectionReestablishmentRequest.UE_identity.c_RNTI.buf, - rrcConnectionReestablishmentRequest.UE_identity.c_RNTI.size); - ue_mod_id = rrc_eNB_get_UE_index(enb_mod_idP, c_rnti); - } - - if ((RC.rrc[enb_mod_idP]->phyCellId == rrcConnectionReestablishmentRequest.UE_identity.physCellId) && - (ue_mod_id != UE_INDEX_INVALID)){ - rrc_eNB_generate_RRCConnectionReestablishment(enb_mod_idP, frameP, ue_mod_id); - }else { - rrc_eNB_generate_RRCConnectionReestablishmentReject(enb_mod_idP, frameP, ue_mod_id); - } - */ - /* reject all reestablishment attempts for the moment */ -// rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, -// rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti), -// CC_id); -{ - uint16_t c_rnti = 0; - - if (rrcConnectionReestablishmentRequest->ue_Identity.physCellId != RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId) { - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest ue_Identity.physCellId(%ld) is not equal to current physCellId(%d), let's reject the UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - rrcConnectionReestablishmentRequest->ue_Identity.physCellId, - RC.rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId); - rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); - break; - } - LOG_D(RRC, "physCellId is %ld\n", rrcConnectionReestablishmentRequest->ue_Identity.physCellId); - - for (i = 0; i < rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.size; i++) { - LOG_D(RRC, "rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.buf[%d] = %x\n", - i, rrcConnectionReestablishmentRequest->ue_Identity.shortMAC_I.buf[i]); - } - - if (rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI.size == 0 || - rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI.size > 2) { - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest c_RNTI range error, let's reject the UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); - break; - - } - - c_rnti = BIT_STRING_to_uint16(&rrcConnectionReestablishmentRequest->ue_Identity.c_RNTI); - LOG_D(RRC, "c_rnti is %x\n", c_rnti); - - ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], c_rnti); - if (ue_context_p == NULL) { - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentRequest without UE context, let's reject the UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); - break; - } - int UE_id = find_UE_id(ctxt_pP->module_id, c_rnti); - if(ue_context_p->ue_context.ue_reestablishment_timer > 0 || RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer > 0){ - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishment(Previous) don't complete, let's reject the UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrc_eNB_generate_RRCConnectionReestablishmentReject(ctxt_pP, ue_context_p, CC_id); - break; - } - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" UE context: %p\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ue_context_p); - ue_context_p->ue_context.ul_failure_timer = 0; - ue_context_p->ue_context.ue_release_timer = 0; - ue_context_p->ue_context.ue_reestablishment_timer = 0; - ue_context_p->ue_context.ue_release_timer_s1 = 0; - ue_context_p->ue_context.ue_release_timer_rrc = 0; - - /* reset timers */ - ue_context_p->ue_context.ul_failure_timer = 0; - ue_context_p->ue_context.ue_release_timer = 0; - - // insert C-RNTI to map - for (i = 0; i < NUMBER_OF_UE_MAX; i++) { - if (reestablish_rnti_map[i][0] == 0) { - reestablish_rnti_map[i][0] = ctxt_pP->rnti; - reestablish_rnti_map[i][1] = c_rnti; - break; - } - } - LOG_D(RRC, "reestablish_rnti_map[%d] [0] %x, [1] %x\n", - i, reestablish_rnti_map[i][0], reestablish_rnti_map[i][1]); - -#if defined(ENABLE_ITTI) - ue_context_p->ue_context.reestablishment_cause = rrcConnectionReestablishmentRequest->reestablishmentCause; - LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept connection reestablishment request from UE physCellId %ld cause %ld\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - rrcConnectionReestablishmentRequest->ue_Identity.physCellId, - ue_context_p->ue_context.reestablishment_cause); -#else - LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept connection restablishment request for UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); -#endif - -#ifndef NO_RRM - send_msg(&S_rrc, msg_rrc_MR_attach_ind(ctxt_pP->module_id, Mac_id)); -#else - - ue_context_p->ue_context.primaryCC_id = CC_id; - - //LG COMMENT Idx = (ue_mod_idP * NB_RB_MAX) + DCCH; - Idx = DCCH; - // SRB1 - ue_context_p->ue_context.Srb1.Active = 1; - ue_context_p->ue_context.Srb1.Srb_info.Srb_id = Idx; - memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[0], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[1], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - - // SRB2: set it to go through SRB1 with id 1 (DCCH) - ue_context_p->ue_context.Srb2.Active = 1; - ue_context_p->ue_context.Srb2.Srb_info.Srb_id = Idx; - memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[0], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[1], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - - rrc_eNB_generate_RRCConnectionReestablishment(ctxt_pP, ue_context_p, CC_id); - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1 (rbid %d)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - Idx); - - MSC_LOG_TX_MESSAGE(MSC_RRC_ENB, - MSC_PDCP_ENB, - NULL, - 0, - MSC_AS_TIME_FMT" CONFIG_REQ UE %x SRB", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti); - - rrc_pdcp_config_asn1_req(ctxt_pP, - ue_context_p->ue_context.SRB_configList, - (DRB_ToAddModList_t *) NULL, - (DRB_ToReleaseList_t*) NULL, - 0xff, - NULL, - NULL, - NULL -# if defined(Rel10) || defined(Rel14) - , (PMCH_InfoList_r9_t *) NULL -# endif - ,NULL); - - rrc_rlc_config_asn1_req(ctxt_pP, - ue_context_p->ue_context.SRB_configList, - (DRB_ToAddModList_t*) NULL, - (DRB_ToReleaseList_t*) NULL -# if defined(Rel10) || defined(Rel14) - , (PMCH_InfoList_r9_t *) NULL -# endif - ); -#endif //NO_RRM - } - break; - - case UL_CCCH_MessageType__c1_PR_rrcConnectionRequest: - T(T_ENB_RRC_CONNECTION_REQUEST, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC Connection Request\n"); - - for (i = 0; i < Srb_info->Rx_buffer.payload_size; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)Srb_info->Rx_buffer.Payload)[i]); - } - - LOG_F(RRC,"\n"); -#endif - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT"MAC_eNB --- MAC_DATA_IND (rrcConnectionRequest on SRB0) --> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[ctxt_pP->module_id], - ctxt_pP->rnti); - - if (ue_context_p != NULL) { - // erase content - rrc_eNB_free_mem_UE_context(ctxt_pP, ue_context_p); - - MSC_LOG_RX_DISCARDED_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Srb_info->Rx_buffer.Payload, - dec_rval.consumed, - MSC_AS_TIME_FMT" RRCConnectionRequest UE %x size %u (UE already in context)", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - dec_rval.consumed); - } else { - rrcConnectionRequest = &ul_ccch_msg->message.choice.c1.choice.rrcConnectionRequest.criticalExtensions.choice.rrcConnectionRequest_r8; - { - if (InitialUE_Identity_PR_randomValue == rrcConnectionRequest->ue_Identity.present) { - AssertFatal(rrcConnectionRequest->ue_Identity.choice.randomValue.size == 5, - "wrong InitialUE-Identity randomValue size, expected 5, provided %d", - rrcConnectionRequest->ue_Identity.choice.randomValue.size); - memcpy(((uint8_t*) & random_value) + 3, - rrcConnectionRequest->ue_Identity.choice.randomValue.buf, - rrcConnectionRequest->ue_Identity.choice.randomValue.size); - /* if there is already a registered UE (with another RNTI) with this random_value, - * the current one must be removed from MAC/PHY (zombie UE) - */ -#if 0 - if ((ue_context_p = rrc_eNB_ue_context_random_exist(ctxt_pP, random_value))) { - LOG_W(RRC, "new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n", - ctxt_pP->rnti, ue_context_p->ue_context.rnti, ctxt_pP->rnti); - rrc_mac_remove_ue(ctxt_pP->module_id, ctxt_pP->rnti); - ue_context_p = NULL; - return 0; - } else { - ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value); - } -#endif - if ((ue_context_p = rrc_eNB_ue_context_random_exist(ctxt_pP, random_value))) { - LOG_W(RRC, "new UE rnti %x (coming with random value) is already there as UE %x, removing %x from MAC/PHY\n", - ctxt_pP->rnti, ue_context_p->ue_context.rnti, ue_context_p->ue_context.rnti); - ue_context_p->ue_context.ul_failure_timer = 20000; - } - ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value); - } else if (InitialUE_Identity_PR_s_TMSI == rrcConnectionRequest->ue_Identity.present) { - /* Save s-TMSI */ - S_TMSI_t s_TMSI = rrcConnectionRequest->ue_Identity.choice.s_TMSI; - mme_code_t mme_code = BIT_STRING_to_uint8(&s_TMSI.mmec); - m_tmsi_t m_tmsi = BIT_STRING_to_uint32(&s_TMSI.m_TMSI); - random_value = (((uint64_t)mme_code) << 32) | m_tmsi; - if ((ue_context_p = rrc_eNB_ue_context_stmsi_exist(ctxt_pP, mme_code, m_tmsi))) { - LOG_I(RRC," S-TMSI exists, ue_context_p %p, old rnti %x => %x\n",ue_context_p,ue_context_p->ue_context.rnti,ctxt_pP->rnti); - rrc_mac_remove_ue(ctxt_pP->module_id, ue_context_p->ue_context.rnti); - stmsi_received=1; - /* replace rnti in the context */ - /* for that, remove the context from the RB tree */ - RB_REMOVE(rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p); - /* and insert again, after changing rnti everywhere it has to be changed */ - ue_context_p->ue_id_rnti = ctxt_pP->rnti; - ue_context_p->ue_context.rnti = ctxt_pP->rnti; - RB_INSERT(rrc_ue_tree_s, &RC.rrc[ctxt_pP->module_id]->rrc_ue_head, ue_context_p); - /* reset timers */ - ue_context_p->ue_context.ul_failure_timer = 0; - ue_context_p->ue_context.ue_release_timer = 0; - ue_context_p->ue_context.ue_reestablishment_timer = 0; - ue_context_p->ue_context.ue_release_timer_s1 = 0; - ue_context_p->ue_context.ue_release_timer_rrc = 0; - } else { - LOG_I(RRC," S-TMSI doesn't exist, setting Initialue_identity_s_TMSI.m_tmsi to %p => %x\n",ue_context_p,m_tmsi); -// ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, NOT_A_RANDOM_UE_IDENTITY); - ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP,random_value); - if (ue_context_p == NULL) - LOG_E(RRC, "%s:%d:%s: rrc_eNB_get_next_free_ue_context returned NULL\n", __FILE__, __LINE__, __FUNCTION__); - if (ue_context_p != NULL) { - ue_context_p->ue_context.Initialue_identity_s_TMSI.presence = TRUE; - ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code = mme_code; - ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi = m_tmsi; - } else { - /* TODO: do we have to break here? */ - //break; - } - } - - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Srb_info->Rx_buffer.Payload, - dec_rval.consumed, - MSC_AS_TIME_FMT" RRCConnectionRequest UE %x size %u (s-TMSI mmec %u m_TMSI %u random UE id (0x%" PRIx64 ")", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - dec_rval.consumed, - ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, - ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, - ue_context_p->ue_context.random_ue_identity); - } else { - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionRequest without random UE identity or S-TMSI not supported, let's reject the UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rrc_eNB_generate_RRCConnectionReject(ctxt_pP, - rrc_eNB_get_ue_context(RC.rrc[ctxt_pP->module_id], ctxt_pP->rnti), - CC_id); - break; - } - - } - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" UE context: %p\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ue_context_p); - - if (ue_context_p != NULL) { - - -#if defined(ENABLE_ITTI) - ue_context_p->ue_context.establishment_cause = rrcConnectionRequest->establishmentCause; - ue_context_p->ue_context.reestablishment_cause = ReestablishmentCause_spare1; - if (stmsi_received==0) - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection from UE random UE identity (0x%" PRIx64 ") MME code %u TMSI %u cause %ld\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ue_context_p->ue_context.random_ue_identity, - ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, - ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, - ue_context_p->ue_context.establishment_cause); - else - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection from UE MME code %u TMSI %u cause %ld\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ue_context_p->ue_context.Initialue_identity_s_TMSI.mme_code, - ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, - ue_context_p->ue_context.establishment_cause); -#else - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Accept new connection for UE random UE identity (0x%" PRIx64 ")\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - ue_context_p->ue_context.random_ue_identity); -#endif - if (stmsi_received == 0) - RC.rrc[ctxt_pP->module_id]->Nb_ue++; - - } else { - // no context available - if (rrc_agent_registered[ctxt_pP->module_id]) { - agent_rrc_xface[ctxt_pP->module_id]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, - ctxt_pP->rnti, - PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_DEACTIVATED); - } - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Can't create new context for UE random UE identity (0x%" PRIx64 ")\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - random_value); - rrc_mac_remove_ue(ctxt_pP->module_id,ctxt_pP->rnti); - return -1; - } - } - -#ifndef NO_RRM - send_msg(&S_rrc, msg_rrc_MR_attach_ind(ctxt_pP->module_id, Mac_id)); -#else - - ue_context_p->ue_context.primaryCC_id = CC_id; - - //LG COMMENT Idx = (ue_mod_idP * NB_RB_MAX) + DCCH; - Idx = DCCH; - // SRB1 - ue_context_p->ue_context.Srb1.Active = 1; - ue_context_p->ue_context.Srb1.Srb_info.Srb_id = Idx; - memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[0], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - memcpy(&ue_context_p->ue_context.Srb1.Srb_info.Lchan_desc[1], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - - // SRB2: set it to go through SRB1 with id 1 (DCCH) - ue_context_p->ue_context.Srb2.Active = 1; - ue_context_p->ue_context.Srb2.Srb_info.Srb_id = Idx; - memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[0], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - memcpy(&ue_context_p->ue_context.Srb2.Srb_info.Lchan_desc[1], - &DCCH_LCHAN_DESC, - LCHAN_DESC_SIZE); - - rrc_eNB_generate_RRCConnectionSetup(ctxt_pP, ue_context_p, CC_id); - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT"CALLING RLC CONFIG SRB1 (rbid %d)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - Idx); - - MSC_LOG_TX_MESSAGE( - MSC_RRC_ENB, - MSC_PDCP_ENB, - NULL, - 0, - MSC_AS_TIME_FMT" CONFIG_REQ UE %x SRB", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti); - - rrc_pdcp_config_asn1_req(ctxt_pP, - ue_context_p->ue_context.SRB_configList, - (DRB_ToAddModList_t *) NULL, - (DRB_ToReleaseList_t*) NULL, - 0xff, - NULL, - NULL, - NULL -# if defined(Rel10) || defined(Rel14) - , (PMCH_InfoList_r9_t *) NULL -# endif - ,NULL); - - rrc_rlc_config_asn1_req(ctxt_pP, - ue_context_p->ue_context.SRB_configList, - (DRB_ToAddModList_t*) NULL, - (DRB_ToReleaseList_t*) NULL -# if defined(Rel10) || defined(Rel14) - , (PMCH_InfoList_r9_t *) NULL -# endif - ); -#endif //NO_RRM - - break; - - default: - LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown message\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rval = -1; - break; - } - - rval = 0; - } else { - LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown error \n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - rval = -1; - } - - return rval; -} - -//----------------------------------------------------------------------------- -int -rrc_eNB_decode_dcch( - const protocol_ctxt_t* const ctxt_pP, - const rb_id_t Srb_id, - const uint8_t* const Rx_sdu, - const sdu_size_t sdu_sizeP -) -//----------------------------------------------------------------------------- -{ - - asn_dec_rval_t dec_rval; - //UL_DCCH_Message_t uldcchmsg; - UL_DCCH_Message_t *ul_dcch_msg = NULL; //&uldcchmsg; - int i; - struct rrc_eNB_ue_context_s* ue_context_p = NULL; -#if defined(ENABLE_ITTI) -# if defined(ENABLE_USE_MME) - MessageDef * msg_delete_tunnels_p = NULL; - uint8_t xid; -#endif -#endif - - int dedicated_DRB=0; - - T(T_ENB_RRC_UL_DCCH_DATA_IN, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - if ((Srb_id != 1) && (Srb_id != 2)) { - LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received message on SRB%d, should not have ...\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - Srb_id); - } else { - LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received message on SRB%d\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - Srb_id); - } - //memset(ul_dcch_msg,0,sizeof(UL_DCCH_Message_t)); - - LOG_D(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Decoding UL-DCCH Message\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - dec_rval = uper_decode( - NULL, - &asn_DEF_UL_DCCH_Message, - (void**)&ul_dcch_msg, - Rx_sdu, - sdu_sizeP, - 0, - 0); - /* -#if defined(ENABLE_ITTI) -# if defined(DISABLE_ITTI_XER_PRINT) - { - MessageDef *message_p; - - message_p = itti_alloc_new_message(TASK_RRC_ENB, RRC_UL_DCCH_MESSAGE); - memcpy(&message_p->ittiMsg, (void *)ul_dcch_msg, sizeof(RrcUlDcchMessage)); - - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, message_p); - } -# else - { - char message_string[10000]; - size_t message_string_size; - - if ((message_string_size = - xer_sprint(message_string, sizeof(message_string), &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg)) >= 0) { - MessageDef *msg_p; - - msg_p = itti_alloc_new_message_sized(TASK_RRC_ENB, RRC_UL_DCCH, message_string_size + sizeof(IttiMsgText)); - msg_p->ittiMsg.rrc_ul_dcch.size = message_string_size; - memcpy(&msg_p->ittiMsg.rrc_ul_dcch.text, message_string, message_string_size); - - itti_send_msg_to_task(TASK_UNKNOWN, ctxt_pP->instance, msg_p); - } - } -# endif -#endif - */ - { - for (i = 0; i < sdu_sizeP; i++) { - LOG_T(RRC, "%x.", Rx_sdu[i]); - } - - LOG_T(RRC, "\n"); - } - - if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { - LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Failed to decode UL-DCCH (%zu bytes)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - dec_rval.consumed); - return -1; - } - - ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[ctxt_pP->module_id], - ctxt_pP->rnti); - - if (ul_dcch_msg->message.present == UL_DCCH_MessageType_PR_c1) { - - switch (ul_dcch_msg->message.choice.c1.present) { - case UL_DCCH_MessageType__c1_PR_NOTHING: /* No components present */ - break; - - case UL_DCCH_MessageType__c1_PR_csfbParametersRequestCDMA2000: - break; - - case UL_DCCH_MessageType__c1_PR_measurementReport: - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND " - "%d bytes (measurementReport) ---> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH, - sdu_sizeP); - rrc_eNB_process_MeasurementReport( - ctxt_pP, - ue_context_p, - &ul_dcch_msg->message.choice.c1.choice.measurementReport. - criticalExtensions.choice.c1.choice.measurementReport_r8.measResults); - break; - - case UL_DCCH_MessageType__c1_PR_rrcConnectionReconfigurationComplete: -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC Connection Reconfiguration Complete\n"); - - for (i = 0; i < sdu_sizeP; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); - } - - LOG_F(RRC,"\n"); -#endif - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" RRCConnectionReconfigurationComplete UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); - - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " - "(RRCConnectionReconfigurationComplete) ---> RRC_eNB]\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH, - sdu_sizeP); - - if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.criticalExtensions. - present == - RRCConnectionReconfigurationComplete__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r8) { - /*NN: revise the condition */ - if (ue_context_p->ue_context.Status == RRC_RECONFIGURED){ - dedicated_DRB = 1; - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); - }else { - dedicated_DRB = 0; - ue_context_p->ue_context.Status = RRC_RECONFIGURED; - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (default DRB, xid %ld)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); - } - rrc_eNB_process_RRCConnectionReconfigurationComplete( - ctxt_pP, - ue_context_p, - ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); - - //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future - if (rrc_agent_registered[ctxt_pP->module_id]) { - agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, - ue_context_p->ue_id_rnti, - PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED); - } - } -#if defined(ENABLE_ITTI) -# if defined(ENABLE_USE_MME) - if (EPC_MODE_ENABLED == 1) { - if (dedicated_DRB == 1){ -// rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(ctxt_pP, -// ue_context_p, -// ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); -if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) { - rrc_eNB_send_S1AP_E_RAB_MODIFY_RESP(ctxt_pP, - ue_context_p, - ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); - - ue_context_p->ue_context.nb_of_modify_e_rabs = 0; - ue_context_p->ue_context.nb_of_failed_e_rabs = 0; - memset(ue_context_p->ue_context.modify_e_rab, 0, sizeof(ue_context_p->ue_context.modify_e_rab)); - for(int i = 0; i < NB_RB_MAX; i++) { - ue_context_p->ue_context.modify_e_rab[i].xid = -1; - } - - } else if(ue_context_p->ue_context.e_rab_release_command_flag == 1){ - xid = ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier; - ue_context_p->ue_context.e_rab_release_command_flag = 0; - //gtp tunnel delete - msg_delete_tunnels_p = itti_alloc_new_message(TASK_RRC_ENB, GTPV1U_ENB_DELETE_TUNNEL_REQ); - memset(>PV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p), 0, sizeof(GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p))); - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).rnti = ue_context_p->ue_context.rnti; - for(i = 0; i < NB_RB_MAX; i++){ - if(xid == ue_context_p->ue_context.e_rab[i].xid){ - GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).eps_bearer_id[GTPV1U_ENB_DELETE_TUNNEL_REQ(msg_delete_tunnels_p).num_erab++] = ue_context_p->ue_context.enb_gtp_ebi[i]; - ue_context_p->ue_context.enb_gtp_teid[i] = 0; - memset(&ue_context_p->ue_context.enb_gtp_addrs[i], 0, sizeof(ue_context_p->ue_context.enb_gtp_addrs[i])); - ue_context_p->ue_context.enb_gtp_ebi[i] = 0; - } - } - itti_send_msg_to_task(TASK_GTPV1_U, ctxt_pP->instance, msg_delete_tunnels_p); - //S1AP_E_RAB_RELEASE_RESPONSE - rrc_eNB_send_S1AP_E_RAB_RELEASE_RESPONSE(ctxt_pP, - ue_context_p, - xid); - } else { - rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(ctxt_pP, - ue_context_p, - ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier); - } - }else { - if(ue_context_p->ue_context.reestablishment_cause == ReestablishmentCause_spare1){ - rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP, - ue_context_p); - } else { - ue_context_p->ue_context.reestablishment_cause = ReestablishmentCause_spare1; - for (uint8_t e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) { - if (ue_context_p->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE) { - ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED; - } else { - ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_FAILED; - } - } - } - } - } -#else // establish a dedicated bearer - if (dedicated_DRB == 0 ) { - // ue_context_p->ue_context.e_rab[0].status = E_RAB_STATUS_ESTABLISHED; - rrc_eNB_reconfigure_DRBs(ctxt_pP,ue_context_p); - } - -#endif -#endif - break; - - case UL_DCCH_MessageType__c1_PR_rrcConnectionReestablishmentComplete: - T(T_ENB_RRC_CONNECTION_REESTABLISHMENT_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC Connection Reestablishment Complete\n"); - - for (i = 0; i < sdu_sizeP; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); - } - - LOG_F(RRC,"\n"); -#endif - - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" rrcConnectionReestablishmentComplete UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); - - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " - "(rrcConnectionReestablishmentComplete) ---> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH, - sdu_sizeP); - { - int UE_id = find_UE_id(ctxt_pP->module_id, ctxt_pP->rnti); - RC.mac[ctxt_pP->module_id]->UE_list.UE_sched_ctrl[UE_id].ue_reestablishment_reject_timer = 0; - rnti_t reestablish_rnti = 0; - // select C-RNTI from map - for (i = 0; i < NUMBER_OF_UE_MAX; i++) { - if (reestablish_rnti_map[i][0] == ctxt_pP->rnti) { - reestablish_rnti = reestablish_rnti_map[i][1]; - ue_context_p = rrc_eNB_get_ue_context( - RC.rrc[ctxt_pP->module_id], - reestablish_rnti); - // clear currentC-RNTI from map - reestablish_rnti_map[i][0] = 0; - reestablish_rnti_map[i][1] = 0; - break; - } - } - LOG_D(RRC, "reestablish_rnti_map[%d] [0] %x, [1] %x\n", - i, reestablish_rnti_map[i][0], reestablish_rnti_map[i][1]); - - if (!ue_context_p) { - LOG_E(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RRCConnectionReestablishmentComplete without UE context, falt\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - break; - } - - if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.present == - RRCConnectionReestablishmentComplete__criticalExtensions_PR_rrcConnectionReestablishmentComplete_r8) { - rrc_eNB_process_RRCConnectionReestablishmentComplete(ctxt_pP, reestablish_rnti, ue_context_p, - ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.rrc_TransactionIdentifier, - &ul_dcch_msg->message.choice.c1.choice.rrcConnectionReestablishmentComplete.criticalExtensions.choice.rrcConnectionReestablishmentComplete_r8); - - //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future - if (mac_agent_registered[ctxt_pP->module_id]) { - agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, - ue_context_p->ue_id_rnti, - PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); - } - } - //ue_context_p->ue_context.ue_release_timer = 0; - ue_context_p->ue_context.ue_reestablishment_timer = 1; - // remove UE after 100 frames after RRCConnectionReestablishmentRelease is triggered - ue_context_p->ue_context.ue_reestablishment_timer_thres = 1000; - } - break; - - case UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete: -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC Connection SetupComplete\n"); - - for (i = 0; i < sdu_sizeP; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); - } - - LOG_F(RRC,"\n"); -#endif - - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" RRCConnectionSetupComplete UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); - - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " - "(RRCConnectionSetupComplete) ---> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH, - sdu_sizeP); - - if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.present == - RRCConnectionSetupComplete__criticalExtensions_PR_c1) { - if (ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1. - present == - RRCConnectionSetupComplete__criticalExtensions__c1_PR_rrcConnectionSetupComplete_r8) { - rrc_eNB_process_RRCConnectionSetupComplete( - ctxt_pP, - ue_context_p, - &ul_dcch_msg->message.choice.c1.choice.rrcConnectionSetupComplete.criticalExtensions.choice.c1.choice.rrcConnectionSetupComplete_r8); - ue_context_p->ue_context.Status = RRC_CONNECTED; - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_CONNECTED \n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP)); - - //WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future - if (rrc_agent_registered[ctxt_pP->module_id]) { - agent_rrc_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id, - ue_context_p->ue_id_rnti, - PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_ACTIVATED); - } - } - } - - ue_context_p->ue_context.ue_release_timer=0; - break; - - case UL_DCCH_MessageType__c1_PR_securityModeComplete: - T(T_ENB_RRC_SECURITY_MODE_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC Security Mode Complete\n"); - - for (i = 0; i < sdu_sizeP; i++) eNB->pusch_vars[UE_id]{ - LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); - } - - LOG_F(RRC,"\n"); -#endif - - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" securityModeComplete UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); - - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" received securityModeComplete on UL-DCCH %d from UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH); - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " - "(securityModeComplete) ---> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH, - sdu_sizeP); -#ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg); -#endif - // confirm with PDCP about the security mode for DCCH - //rrc_pdcp_config_req (enb_mod_idP, frameP, 1,CONFIG_ACTION_SET_SECURITY_MODE, (ue_mod_idP * NB_RB_MAX) + DCCH, 0x77); - // continue the procedure - rrc_eNB_generate_UECapabilityEnquiry( - ctxt_pP, - ue_context_p); - break; - - case UL_DCCH_MessageType__c1_PR_securityModeFailure: - T(T_ENB_RRC_SECURITY_MODE_FAILURE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC Security Mode Failure\n"); - - for (i = 0; i < sdu_sizeP; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); - } - - LOG_F(RRC,"\n"); -#endif - - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" securityModeFailure UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); - - LOG_W(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " - "(securityModeFailure) ---> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH, - sdu_sizeP); -#ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg); -#endif - // cancel the security mode in PDCP - - // followup with the remaining procedure -//#warning "LG Removed rrc_eNB_generate_UECapabilityEnquiry after receiving securityModeFailure" - rrc_eNB_generate_UECapabilityEnquiry(ctxt_pP, ue_context_p); - break; - - case UL_DCCH_MessageType__c1_PR_ueCapabilityInformation: - T(T_ENB_RRC_UE_CAPABILITY_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC UECapablility Information \n"); - - for (i = 0; i < sdu_sizeP; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); - } - - LOG_F(RRC,"\n"); -#endif - - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" ueCapabilityInformation UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); - - LOG_I(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" received ueCapabilityInformation on UL-DCCH %d from UE\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH); - LOG_D(RRC, - PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes " - "(UECapabilityInformation) ---> RRC_eNB\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - DCCH, - sdu_sizeP); -#ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg); -#endif - LOG_I(RRC, "got UE capabilities for UE %x\n", ctxt_pP->rnti); - if (ue_context_p->ue_context.UE_Capability) { - LOG_I(RRC, "freeing old UE capabilities for UE %x\n", ctxt_pP->rnti); - asn_DEF_UE_EUTRA_Capability.free_struct(&asn_DEF_UE_EUTRA_Capability, - ue_context_p->ue_context.UE_Capability, 0); - ue_context_p->ue_context.UE_Capability = 0; - } - dec_rval = uper_decode(NULL, - &asn_DEF_UE_EUTRA_Capability, - (void **)&ue_context_p->ue_context.UE_Capability, - ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions. - choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list. - array[0]->ueCapabilityRAT_Container.buf, - ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions. - choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list. - array[0]->ueCapabilityRAT_Container.size, 0, 0); -#ifdef XER_PRINT - xer_fprint(stdout, &asn_DEF_UE_EUTRA_Capability, ue_context_p->ue_context.UE_Capability); -#endif - - if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) { - LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Failed to decode UE capabilities (%zu bytes)\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - dec_rval.consumed); - asn_DEF_UE_EUTRA_Capability.free_struct(&asn_DEF_UE_EUTRA_Capability, - ue_context_p->ue_context.UE_Capability, 0); - ue_context_p->ue_context.UE_Capability = 0; - } - -#if defined(ENABLE_USE_MME) - - if (EPC_MODE_ENABLED == 1) { - rrc_eNB_send_S1AP_UE_CAPABILITIES_IND(ctxt_pP, - ue_context_p, - ul_dcch_msg); - } -#else - ue_context_p->ue_context.nb_of_e_rabs = 1; - for (i = 0; i < ue_context_p->ue_context.nb_of_e_rabs; i++){ - ue_context_p->ue_context.e_rab[i].status = E_RAB_STATUS_NEW; - ue_context_p->ue_context.e_rab[i].param.e_rab_id = 1+i; - ue_context_p->ue_context.e_rab[i].param.qos.qci=9; - } - ue_context_p->ue_context.setup_e_rabs =ue_context_p->ue_context.nb_of_e_rabs; -#endif - - rrc_eNB_generate_defaultRRCConnectionReconfiguration(ctxt_pP, - ue_context_p, - RC.rrc[ctxt_pP->module_id]->HO_flag); - break; - - case UL_DCCH_MessageType__c1_PR_ulHandoverPreparationTransfer: - T(T_ENB_RRC_UL_HANDOVER_PREPARATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - break; - - case UL_DCCH_MessageType__c1_PR_ulInformationTransfer: - T(T_ENB_RRC_UL_INFORMATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - LOG_D(RRC,"[MSG] RRC UL Information Transfer \n"); -#ifdef RRC_MSG_PRINT - LOG_F(RRC,"[MSG] RRC UL Information Transfer \n"); - - for (i = 0; i < sdu_sizeP; i++) { - LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]); - } - - LOG_F(RRC,"\n"); -#endif - - - MSC_LOG_RX_MESSAGE( - MSC_RRC_ENB, - MSC_RRC_UE, - Rx_sdu, - sdu_sizeP, - MSC_AS_TIME_FMT" ulInformationTransfer UE %x size %u", - MSC_AS_TIME_ARGS(ctxt_pP), - ue_context_p->ue_context.rnti, - sdu_sizeP); - -#if defined(ENABLE_USE_MME) - - if (EPC_MODE_ENABLED == 1) { - rrc_eNB_send_S1AP_UPLINK_NAS(ctxt_pP, - ue_context_p, - ul_dcch_msg); - } - -#endif - break; - - case UL_DCCH_MessageType__c1_PR_counterCheckResponse: - T(T_ENB_RRC_COUNTER_CHECK_RESPONSE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - break; - -#if defined(Rel10) || defined(Rel14) - - case UL_DCCH_MessageType__c1_PR_ueInformationResponse_r9: - T(T_ENB_RRC_UE_INFORMATION_RESPONSE_R9, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - break; - - case UL_DCCH_MessageType__c1_PR_proximityIndication_r9: - T(T_ENB_RRC_PROXIMITY_INDICATION_R9, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - break; - - case UL_DCCH_MessageType__c1_PR_rnReconfigurationComplete_r10: - T(T_ENB_RRC_RECONFIGURATION_COMPLETE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - break; - - case UL_DCCH_MessageType__c1_PR_mbmsCountingResponse_r10: - T(T_ENB_RRC_MBMS_COUNTING_RESPONSE_R10, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - break; - - case UL_DCCH_MessageType__c1_PR_interFreqRSTDMeasurementIndication_r10: - T(T_ENB_RRC_INTER_FREQ_RSTD_MEASUREMENT_INDICATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - break; -#endif - - default: - T(T_ENB_RRC_UNKNOW_MESSAGE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame), - T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti)); - - LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown message %s:%u\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - __FILE__, __LINE__); - return -1; - } - - return 0; - } else { - LOG_E(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Unknown error %s:%u\n", - PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP), - __FILE__, __LINE__); - return -1; - } - -} - -#if defined(ENABLE_ITTI) -void rrc_eNB_reconfigure_DRBs (const protocol_ctxt_t* const ctxt_pP, - rrc_eNB_ue_context_t* ue_context_pP){ - - int i; - int e_rab_done=0; - for (i = 0; - i < 3;//NB_RB_MAX - 3; // S1AP_MAX_E_RAB - i++) { - - if ( ue_context_pP->ue_context.e_rab[i].status < E_RAB_STATUS_DONE){ - ue_context_pP->ue_context.e_rab[i].status = E_RAB_STATUS_NEW; - ue_context_pP->ue_context.e_rab[i].param.e_rab_id = i + 1; - ue_context_pP->ue_context.e_rab[i].param.qos.qci = i % 9; - ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.priority_level= i % PRIORITY_LEVEL_LOWEST; - ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.pre_emp_capability= PRE_EMPTION_CAPABILITY_DISABLED; - ue_context_pP->ue_context.e_rab[i].param.qos.allocation_retention_priority.pre_emp_vulnerability= PRE_EMPTION_VULNERABILITY_DISABLED; - ue_context_pP->ue_context.e_rab[i].param.nas_pdu.buffer = NULL; - ue_context_pP->ue_context.e_rab[i].param.nas_pdu.length = 0; - // memset (ue_context_pP->ue_context.e_rab[i].param.sgw_addr.buffer,0,20); - ue_context_pP->ue_context.e_rab[i].param.sgw_addr.length = 0; - ue_context_pP->ue_context.e_rab[i].param.gtp_teid=0; - - ue_context_pP->ue_context.nb_of_e_rabs++; - e_rab_done++; - LOG_I(RRC,"setting up the dedicated DRBs %d (index %d) status %d \n", - ue_context_pP->ue_context.e_rab[i].param.e_rab_id, i, ue_context_pP->ue_context.e_rab[i].status); - } - } - ue_context_pP->ue_context.setup_e_rabs+=e_rab_done; - - rrc_eNB_generate_dedicatedRRCConnectionReconfiguration(ctxt_pP, ue_context_pP, 0); -} - - -//----------------------------------------------------------------------------- -void* -rrc_enb_task( - void* args_p -) -//----------------------------------------------------------------------------- -{ +void* rrc_gnb_task(void* args_p){ MessageDef *msg_p; const char *msg_name_p; - instance_t instance; - int result; + instance_t instance; + int result; SRB_INFO *srb_info_p; - int CC_id; + int CC_id; + protocol_ctxt_t ctxt; + + itti_mark_task_ready(TASK_RRC_GNB); + LOG_I(NR_RRC,"Entering main loop of NR_RRC message task\n"); - protocol_ctxt_t ctxt; - itti_mark_task_ready(TASK_RRC_ENB); - LOG_I(RRC,"Entering main loop of RRC message task\n"); while (1) { - // Wait for a message - itti_receive_msg(TASK_RRC_ENB, &msg_p); + // Wait for a message + itti_receive_msg(TASK_RRC_GNB, &msg_p); msg_name_p = ITTI_MSG_NAME(msg_p); instance = ITTI_MSG_INSTANCE(msg_p); @@ -7094,7 +315,7 @@ rrc_enb_task( switch (ITTI_MSG_ID(msg_p)) { case TERMINATE_MESSAGE: - LOG_W(RRC, " *** Exiting RRC thread\n"); + LOG_W(RRC, " *** Exiting NR_RRC thread\n"); itti_exit_task(); break; @@ -7103,56 +324,12 @@ rrc_enb_task( break; /* Messages from MAC */ - case RRC_MAC_CCCH_DATA_IND: - PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, - instance, - ENB_FLAG_YES, - RRC_MAC_CCCH_DATA_IND(msg_p).rnti, - msg_p->ittiMsgHeader.lte_time.frame, - msg_p->ittiMsgHeader.lte_time.slot); - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received %s\n", - PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt), - msg_name_p); - CC_id = RRC_MAC_CCCH_DATA_IND(msg_p).CC_id; - srb_info_p = &RC.rrc[instance]->carrier[CC_id].Srb0; - - LOG_I(RRC,"Decoding CCCH : inst %d, CC_id %d, ctxt %p, sib_info_p->Rx_buffer.payload_size %d\n", - instance,CC_id,&ctxt, RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); - AssertFatal(RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size < RRC_BUFFER_SIZE_MAX, - "CCCH message has size %d > %d\n", - RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,RRC_BUFFER_SIZE_MAX); - memcpy(srb_info_p->Rx_buffer.Payload, - RRC_MAC_CCCH_DATA_IND(msg_p).sdu, - RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size); - srb_info_p->Rx_buffer.payload_size = RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size; - - rrc_eNB_decode_ccch(&ctxt, srb_info_p, CC_id); - break; /* Messages from PDCP */ - case RRC_DCCH_DATA_IND: - PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, - instance, - ENB_FLAG_YES, - RRC_DCCH_DATA_IND(msg_p).rnti, - msg_p->ittiMsgHeader.lte_time.frame, - msg_p->ittiMsgHeader.lte_time.slot); - LOG_I(RRC, PROTOCOL_RRC_CTXT_UE_FMT" Received on DCCH %d %s\n", - PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt), - RRC_DCCH_DATA_IND(msg_p).dcch_index, - msg_name_p); - rrc_eNB_decode_dcch(&ctxt, - RRC_DCCH_DATA_IND(msg_p).dcch_index, - RRC_DCCH_DATA_IND(msg_p).sdu_p, - RRC_DCCH_DATA_IND(msg_p).sdu_size); - // Message buffer has been processed, free it now. - result = itti_free(ITTI_MSG_ORIGIN_ID(msg_p), RRC_DCCH_DATA_IND(msg_p).sdu_p); - AssertFatal(result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result); - break; -# if defined(ENABLE_USE_MME) +#if defined(ENABLE_USE_MME) /* Messages from S1AP */ case S1AP_DOWNLINK_NAS: @@ -7197,23 +374,23 @@ rrc_enb_task( /* Nothing to do. Apparently everything is done in S1AP processing */ //LOG_I(RRC, "[eNB %d] Received message %s, not processed because procedure not synched\n", //instance, msg_name_p); - if (rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti) - && rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc > 0) { - rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc = - rrc_eNB_get_ue_context(RC.rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_thres_rrc; + if (rrc_eNB_get_ue_context(RC.nr_rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti) + && rrc_eNB_get_ue_context(RC.nr_rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc > 0) { + rrc_eNB_get_ue_context(RC.nr_rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc = + rrc_eNB_get_ue_context(RC.nr_rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_thres_rrc; } break; -# endif +#endif - /* Messages from eNB app */ - case RRC_CONFIGURATION_REQ: - LOG_I(RRC, "[eNB %d] Received %s : %p\n", instance, msg_name_p,&RRC_CONFIGURATION_REQ(msg_p)); - openair_rrc_eNB_configuration(ENB_INSTANCE_TO_MODULE_ID(instance), &RRC_CONFIGURATION_REQ(msg_p)); + /* Messages from eNB app */ + case NRRRC_CONFIGURATION_REQ: + LOG_I(NR_RRC, "[gNB %d] Received %s : %p\n", instance, msg_name_p,&NRRRC_CONFIGURATION_REQ(msg_p)); + openair_rrc_gNB_configuration(GNB_INSTANCE_TO_MODULE_ID(instance), &NRRRC_CONFIGURATION_REQ(msg_p)); break; default: - LOG_E(RRC, "[eNB %d] Received unexpected message %s\n", instance, msg_name_p); + LOG_E(NR_RRC, "[gNB %d] Received unexpected message %s\n", instance, msg_name_p); break; } @@ -7222,11 +399,12 @@ rrc_enb_task( msg_p = NULL; } } -#endif + +#endif //END #if defined(ENABLE_ITTI) /*------------------------------------------------------------------------------*/ void -openair_rrc_top_init_eNB(int eMBMS_active,uint8_t HO_active) +openair_rrc_top_init_gNB(int eMBMS_active,uint8_t HO_active) //----------------------------------------------------------------------------- { @@ -7242,182 +420,29 @@ openair_rrc_top_init_eNB(int eMBMS_active,uint8_t HO_active) LOG_I(RRC,"[eNB] handover active state is %d \n", HO_active); for (module_id=0; module_idHO_flag = (uint8_t)HO_active; + RC.nr_rrc[module_id]->HO_flag = (uint8_t)HO_active; } -#if defined(Rel10) || defined(Rel14) + #if defined(Rel10) || defined(Rel14) LOG_I(RRC,"[eNB] eMBMS active state is %d \n", eMBMS_active); for (module_id=0; module_idcarrier[CC_id].MBMS_flag = (uint8_t)eMBMS_active; + RC.nr_rrc[module_id]->carrier[CC_id].MBMS_flag = (uint8_t)eMBMS_active; } } -#endif -#ifdef CBA + #endif + #ifdef CBA for (module_id=0; module_idcarrier[CC_id].num_active_cba_groups = cba_group_active; + RC.nr_rrc[module_id]->carrier[CC_id].num_active_cba_groups = cba_group_active; } } -#endif - } + #endif + }//END if (RC.nb_inst > 0) -} - -//----------------------------------------------------------------------------- -void -rrc_top_cleanup_eNB( - void -) -//----------------------------------------------------------------------------- -{ - - for (int i=0;imodule_id]->rrc_ue_head)) { - if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe==0)) { - if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) { - LOG_I(RRC,"UE rnti %x:S-TMSI %x failure timer %d/8\n", - ue_context_p->ue_context.rnti, - ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, - ue_context_p->ue_context.ul_failure_timer); - } - else { - LOG_I(RRC,"UE rnti %x failure timer %d/8\n", - ue_context_p->ue_context.rnti, - ue_context_p->ue_context.ul_failure_timer); - } - } - if (ue_context_p->ue_context.ul_failure_timer>0) { - ue_context_p->ue_context.ul_failure_timer++; - if (ue_context_p->ue_context.ul_failure_timer >= 8) { - // remove UE after 20 seconds after MAC has indicated UL failure - LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti); - ue_to_be_removed = ue_context_p; - break; - } - } - if (ue_context_p->ue_context.ue_release_timer_s1>0) { - ue_context_p->ue_context.ue_release_timer_s1++; - if (ue_context_p->ue_context.ue_release_timer_s1 >= - ue_context_p->ue_context.ue_release_timer_thres_s1) { - LOG_I(RRC,"Removing UE %x instance Because of UE_CONTEXT_RELEASE_COMMAND not received after %d ms from sending request\n", - ue_context_p->ue_context.rnti, ue_context_p->ue_context.ue_release_timer_thres_s1); - ue_to_be_removed = ue_context_p; - break; - } - } - - if (ue_context_p->ue_context.ue_release_timer_rrc>0) { - ue_context_p->ue_context.ue_release_timer_rrc++; - if (ue_context_p->ue_context.ue_release_timer_rrc >= - ue_context_p->ue_context.ue_release_timer_thres_rrc) { - LOG_I(RRC,"Removing UE %x instance After UE_CONTEXT_RELEASE_Complete\n", ue_context_p->ue_context.rnti); - ue_to_be_removed = ue_context_p; - break; - } - } - - if (ue_context_p->ue_context.ue_reestablishment_timer>0) { - ue_context_p->ue_context.ue_reestablishment_timer++; - if (ue_context_p->ue_context.ue_reestablishment_timer >= - ue_context_p->ue_context.ue_reestablishment_timer_thres) { - LOG_I(RRC,"UE %d reestablishment_timer max\n",ue_context_p->ue_context.rnti); - ue_context_p->ue_context.ul_failure_timer = 20000; - ue_to_be_removed = ue_context_p; - ue_context_p->ue_context.ue_reestablishment_timer = 0; - break; - } - } - if (ue_context_p->ue_context.ue_release_timer>0) { - ue_context_p->ue_context.ue_release_timer++; - if (ue_context_p->ue_context.ue_release_timer >= - ue_context_p->ue_context.ue_release_timer_thres) { - LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti); - ue_to_be_removed = ue_context_p; - break; - } - } - } - if (ue_to_be_removed) { - if(ue_to_be_removed->ue_context.ul_failure_timer >= 8) { - ue_to_be_removed->ue_context.ue_release_timer_s1 = 1; - ue_to_be_removed->ue_context.ue_release_timer_thres_s1 = 100; - ue_to_be_removed->ue_context.ue_release_timer = 0; - ue_to_be_removed->ue_context.ue_reestablishment_timer = 0; - } - rrc_eNB_free_UE(ctxt_pP->module_id,ue_to_be_removed); - if(ue_to_be_removed->ue_context.ul_failure_timer >= 8){ - ue_to_be_removed->ue_context.ul_failure_timer = 0; - } - } - -#ifdef RRC_LOCALIZATION - - /* for the localization, only primary CC_id might be relevant*/ - gettimeofday(&ts, NULL); - current_timestamp_ms = ts.tv_sec * 1000 + ts.tv_usec / 1000; - ref_timestamp_ms = RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms; - RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { - ctxt = *ctxt_pP; - ctxt.rnti = ue_context_p->ue_context.rnti; - estimated_distance = rrc_get_estimated_ue_distance( - &ctxt, - CC_id, - RC.rrc[ctxt_pP->module_id]->loc_type); - - if ((current_timestamp_ms - ref_timestamp_ms > RC.rrc[ctxt_pP->module_id]->aggregation_period_ms) && - estimated_distance != -1) { - LOG_D(LOCALIZE, " RRC [UE/id %d -> eNB/id %d] timestamp %d frame %d estimated r = %f\n", - ctxt.rnti, - ctxt_pP->module_id, - current_timestamp_ms, - ctxt_pP->frame, - estimated_distance); - LOG_D(LOCALIZE, " RRC status %d\n", ue_context_p->ue_context.Status); - push_front(&RC.rrc[ctxt_pP->module_id]->loc_list, - estimated_distance); - RC.rrc[ctxt_pP->module_id]->reference_timestamp_ms = current_timestamp_ms; - } - } - -#endif - (void)ts; /* remove gcc warning "unused variable" */ - (void)ref_timestamp_ms; /* remove gcc warning "unused variable" */ - (void)current_timestamp_ms; /* remove gcc warning "unused variable" */ - - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_RX_TX,VCD_FUNCTION_OUT); - return (RRC_OK); -} - +} \ No newline at end of file diff --git a/openair2/RRC/NR/rrc_types_NR.h b/openair2/RRC/NR/rrc_types_NR.h index f621d9b2dd..7b6c895ecd 100644 --- a/openair2/RRC/NR/rrc_types_NR.h +++ b/openair2/RRC/NR/rrc_types_NR.h @@ -51,14 +51,14 @@ typedef enum Rrc_Sub_State_NR_e { RRC_SUB_STATE_CONNECTED_NR, - RRC_SUB_STATE_INACTIVE_FIRST_NB_IoT = RRC_SUB_STATE_INACTIVE_NR, - RRC_SUB_STATE_INACTIVE_LAST_NB_IoT = RRC_SUB_STATE_INACTIVE_NR, + RRC_SUB_STATE_INACTIVE_FIRST_NR = RRC_SUB_STATE_INACTIVE_NR, + RRC_SUB_STATE_INACTIVE_LAST_NR = RRC_SUB_STATE_INACTIVE_NR, - RRC_SUB_STATE_IDLE_FIRST_NB_IoT = RRC_SUB_STATE_IDLE_SEARCHING_NR, - RRC_SUB_STATE_IDLE_LAST_NB_IoT = RRC_SUB_STATE_IDLE_NR, + RRC_SUB_STATE_IDLE_FIRST_NR = RRC_SUB_STATE_IDLE_SEARCHING_NR, + RRC_SUB_STATE_IDLE_LAST_NR = RRC_SUB_STATE_IDLE_NR, - RRC_SUB_STATE_CONNECTED_FIRST_NB_IoT = RRC_SUB_STATE_CONNECTED_NR, - RRC_SUB_STATE_CONNECTED_LAST_NB_IoT = RRC_SUB_STATE_CONNECTED_NR, + RRC_SUB_STATE_CONNECTED_FIRST_NR = RRC_SUB_STATE_CONNECTED_NR, + RRC_SUB_STATE_CONNECTED_LAST_NR = RRC_SUB_STATE_CONNECTED_NR, } Rrc_Sub_State_NR_t; #endif /* RRC_TYPES_H_ */ diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf index c4307f8ff2..5b86538586 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf @@ -2,15 +2,15 @@ Active_eNBs = ( "eNB-Eurecom-LTEBox"); # Asn1_verbosity, choice in: none, info, annoying Asn1_verbosity = "none"; -eNBs = +gNBs = ( { ////////// Identification parameters: - eNB_ID = 0xe00; + gNB_ID = 0xe00; cell_type = "CELL_MACRO_ENB"; - eNB_name = "eNB-Eurecom-LTEBox"; + gNB_name = "eNB-Eurecom-LTEBox"; // Tracking area code, 0x0000 and 0xfffe are reserved values tracking_area_code = "1"; @@ -25,43 +25,43 @@ eNBs = component_carriers = ( { - node_function = "3GPP_eNODEB"; - node_timing = "synch_to_ext_device"; - node_synch_ref = 0; - frame_type = "FDD"; - tdd_config = 3; - tdd_config_s = 0; - prefix_type = "NORMAL"; - eutra_band = 7; - downlink_frequency = 2685000000L; - uplink_frequency_offset = -120000000; - Nid_cell = 0; - N_RB_DL = 50; - Nid_cell_mbsfn = 0; - nb_antenna_ports = 1; - nb_antennas_tx = 1; - nb_antennas_rx = 1; + node_function = "3GPP_eNODEB"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "FDD"; + tdd_config = 3; + tdd_config_s = 0; + prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2685000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 50; + Nid_cell_mbsfn = 0; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; tx_gain = 90; rx_gain = 125; - pbch_repetition = "FALSE"; - prach_root = 0; - prach_config_index = 0; - prach_high_speed = "DISABLE"; - prach_zero_correlation = 1; - prach_freq_offset = 2; - pucch_delta_shift = 1; - pucch_nRB_CQI = 0; - pucch_nCS_AN = 0; - pucch_n1_AN = 32; - pdsch_referenceSignalPower = -27; - pdsch_p_b = 0; - pusch_n_SB = 1; - pusch_enable64QAM = "DISABLE"; + pbch_repetition = "FALSE"; + prach_root = 0; + prach_config_index = 0; + prach_high_speed = "DISABLE"; + prach_zero_correlation = 1; + prach_freq_offset = 2; + pucch_delta_shift = 1; + pucch_nRB_CQI = 0; + pucch_nCS_AN = 0; + pucch_n1_AN = 32; + pdsch_referenceSignalPower = -27; + pdsch_p_b = 0; + pusch_n_SB = 1; + pusch_enable64QAM = "DISABLE"; pusch_hoppingMode = "interSubFrame"; pusch_hoppingOffset = 0; - pusch_groupHoppingEnabled = "ENABLE"; - pusch_groupAssignment = 0; - pusch_sequenceHoppingEnabled = "DISABLE"; + pusch_groupHoppingEnabled = "ENABLE"; + pusch_groupAssignment = 0; + pusch_sequenceHoppingEnabled = "DISABLE"; pusch_nDMRS1 = 1; phich_duration = "NORMAL"; phich_resource = "ONESIXTH"; @@ -79,7 +79,7 @@ eNBs = pucch_deltaF_Format1b = "deltaF3"; pucch_deltaF_Format2 = "deltaF0"; pucch_deltaF_Format2a = "deltaF0"; - pucch_deltaF_Format2b = "deltaF0"; + pucch_deltaF_Format2b = "deltaF0"; rach_numberOfRA_Preambles = 64; rach_preamblesGroupAConfig = "DISABLE"; @@ -97,14 +97,14 @@ eNBs = pcch_default_PagingCycle = 128; pcch_nB = "oneT"; - bcch_modificationPeriodCoeff = 2; - ue_TimersAndConstants_t300 = 1000; - ue_TimersAndConstants_t301 = 1000; - ue_TimersAndConstants_t310 = 1000; - ue_TimersAndConstants_t311 = 10000; - ue_TimersAndConstants_n310 = 20; - ue_TimersAndConstants_n311 = 1; - ue_TransmissionMode = 1; + bcch_modificationPeriodCoeff = 2; + ue_TimersAndConstants_t300 = 1000; + ue_TimersAndConstants_t301 = 1000; + ue_TimersAndConstants_t310 = 1000; + ue_TimersAndConstants_t311 = 10000; + ue_TimersAndConstants_n310 = 20; + ue_TimersAndConstants_n311 = 1; + ue_TransmissionMode = 1; } ); @@ -217,3 +217,222 @@ NETWORK_CONTROLLER : rrc_log_verbosity ="medium"; }; + + + + +Active_gNBs = ( "gNB_Eurecom_5GNRBox"); +# Asn1_verbosity, choice in: none, info, annoying +Asn1_verbosity = "none"; + +gNBs = +( + { + ////////// Identification parameters: + gNB_ID = 0xe00; + + cell_type = "CELL_MACRO_GNB"; + + gNB_name = "gNB_Eurecom_LTEBox"; + + // Tracking area code, 0x0000 and 0xfffe are reserved values + tracking_area_code = "1"; + + mobile_country_code = "208"; + + mobile_network_code = "93"; + + tr_s_preference = "local_mac" + + ////////// Physical parameters: + + component_carriers = ( + { + node_function = "3GPP_gNODEB"; + node_timing = "synch_to_ext_device"; + node_synch_ref = 0; + frame_type = "FDD"; + DL_prefix_type = "NORMAL"; + UL_prefix_type = "NORMAL"; + eutra_band = 7; + downlink_frequency = 2685000000L; + uplink_frequency_offset = -120000000; + Nid_cell = 0; + N_RB_DL = 50; + nb_antenna_ports = 1; + nb_antennas_tx = 1; + nb_antennas_rx = 1; + tx_gain = 90; + rx_gain = 125; + MIB_subCarrierSpacingCommon = 0; + MIB_dmrs_TypeA_Position = 0; + pdcch_ConfigSIB1 = 0; + SIB1_frequencyOffsetSSB = 0; + SIB1_ssb_PeriodicityServingCell = 0; + SIB1_ss_PBCH_BlockPower = 0; + absoluteFrequencySSB = 0; + ssb_SubcarrierOffset = 0; + DL_FreqBandIndicatorNR = 0; + DL_absoluteFrequencyPointA = 0; + DL_offsetToCarrier = 0; + DL_SubcarrierSpacing = 0; + DL_SCS_SpecificCarrier_k0 = 0; + DL_carrierBandwidth = 0; + DL_locationAndBandwidth = 0; + UL_FreqBandIndicatorNR = 0; + UL_absoluteFrequencyPointA = 0; + FrequencyInfoUL_p_Max = 0; + frequencyShift7p5khz = 0; + UL_offsetToCarrier = 0; + UL_SubcarrierSpacing = 0; + UL_SCS_SpecificCarrier_k0 = 0; + UL_carrierBandwidth = 0; + UL_locationAndBandwidth = 0; + ServingCellConfigCommon_ssb_periodicityServingCell = 0; + ServingCellConfigCommon_dmrs_TypeA_Position = 0; + NIA_SubcarrierSpacing = 0; + ServingCellConfigCommon_ss_PBCH_BlockPower = 0; + referenceSubcarrierSpacing = 0; + dl_UL_TransmissionPeriodicity = 0; + nrofDownlinkSlots = 0; + nrofDownlinkSymbols = 0; + nrofUplinkSlots = 0; + nrofUplinkSymbols = 0; + rach_totalNumberOfRA_Preambles = 0; + rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice = 0; + rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth = 0; + rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth = 0; + rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf = 0; + rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one = 0; + rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two = 0; + rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_four = 0; + rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_eight = 0; + rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_sixteen = 0; + rach_groupBconfigured = NULL; + rach_ra_Msg3SizeGroupA = 0; + rach_messagePowerOffsetGroupB = 0; + rach_numberOfRA_PreamblesGroupA = 0; + rach_ra_ContentionResolutionTimer = 0; + rsrp_ThresholdSSB = 0; + rsrp_ThresholdSSB_SUL = 0; + prach_RootSequenceIndex_choice = 0; + prach_RootSequenceIndex_l839 = 0; + prach_RootSequenceIndex_l139 = 0; + prach_msg1_SubcarrierSpacing = 0; + restrictedSetConfig = 0; + msg3_transformPrecoding = 0; + prach_ConfigurationIndex = 0; + prach_msg1_FDM = 0; + prach_msg1_FrequencyStart = 0; + zeroCorrelationZoneConfig = 0; + preambleReceivedTargetPower = 0; + preambleTransMax = 0; + powerRampingStep = 0; + ra_ResponseWindow = 0; + groupHoppingEnabledTransformPrecoding = NULL; + msg3_DeltaPreamble = 0; + p0_NominalWithGrant = 0; + PUSCH_TimeDomainResourceAllocation_k2 = 0; + PUSCH_TimeDomainResourceAllocation_mappingType = 0; + pucch_GroupHopping = 0; + p0_nominal = 0; + PDSCH_TimeDomainResourceAllocation_k0 = 0; + PDSCH_TimeDomainResourceAllocation_mappingType = 0; + rateMatchPatternId = 0; + RateMatchPattern_patternType = 0; + symbolsInResourceBlock = 0; + periodicityAndPattern = 0; + RateMatchPattern_controlResourceSet = 0; + RateMatchPattern_subcarrierSpacing = 0; + RateMatchPattern_mode = 0; + searchSpaceSIB1 = 0; + searchSpaceOtherSystemInformation = 0; + pagingSearchSpace = 0; + ra_SearchSpace = 0; + rach_ra_ControlResourceSet = 0; + PDCCH_common_controlResourceSetId = 0; + PDCCH_common_ControlResourceSet_duration = 0; + PDCCH_cce_REG_MappingType = 0; + PDCCH_reg_BundleSize = 0; + PDCCH_interleaverSize = 0; + PDCCH_shiftIndex = 0; + PDCCH_precoderGranularity = 0; + tci_PresentInDCI = NULL; + SearchSpaceId = 0; + commonSearchSpaces_controlResourceSetId = 0; + SearchSpace_monitoringSlotPeriodicityAndOffset_choice = 0; + SearchSpace_monitoringSlotPeriodicityAndOffset_sl1 = 0; + SearchSpace_monitoringSlotPeriodicityAndOffset_sl2 = 0; + SearchSpace_monitoringSlotPeriodicityAndOffset_sl4 = 0; + SearchSpace_monitoringSlotPeriodicityAndOffset_sl5 = 0; + SearchSpace_monitoringSlotPeriodicityAndOffset_sl8 = 0; + SearchSpace_monitoringSlotPeriodicityAndOffset_sl10 = 0; + SearchSpace_monitoringSlotPeriodicityAndOffset_sl16 = 0; + SearchSpace_monitoringSlotPeriodicityAndOffset_sl20 = 0; + SearchSpace_nrofCandidates_aggregationLevel1 = 0; + SearchSpace_nrofCandidates_aggregationLevel2 = 0; + SearchSpace_nrofCandidates_aggregationLevel4 = 0; + SearchSpace_nrofCandidates_aggregationLevel8 = 0; + SearchSpace_nrofCandidates_aggregationLevel16 = 0; + SearchSpace_searchSpaceType = 0; + Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel1 = 0; + Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel2 = 0; + Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel4 = 0; + Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel8 = 0; + Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel16 = 0; + Common_dci_Format2_3_monitoringPeriodicity = 0; + Common_dci_Format2_3_nrofPDCCH_Candidates = 0; + ue_Specific__dci_Formats = 0; + } + ); + + + srb1_parameters : + { + # timer_poll_retransmit = (ms) [5, 10, 15, 20,... 250, 300, 350, ... 500] + timer_poll_retransmit = 80; + + # timer_reordering = (ms) [0,5, ... 100, 110, 120, ... ,200] + timer_reordering = 35; + + # timer_reordering = (ms) [0,5, ... 250, 300, 350, ... ,500] + timer_status_prohibit = 0; + + # poll_pdu = [4, 8, 16, 32 , 64, 128, 256, infinity(>10000)] + poll_pdu = 4; + + # poll_byte = (kB) [25,50,75,100,125,250,375,500,750,1000,1250,1500,2000,3000,infinity(>10000)] + poll_byte = 99999; + + # max_retx_threshold = [1, 2, 3, 4 , 6, 8, 16, 32] + max_retx_threshold = 4; + } + + # ------- SCTP definitions + SCTP : + { + # Number of streams to use in input/output + SCTP_INSTREAMS = 2; + SCTP_OUTSTREAMS = 2; + }; + + + ////////// MME parameters: + mme_ip_address = ( { ipv4 = "192.168.12.26"; + ipv6 = "192:168:30::17"; + active = "yes"; + preference = "ipv4"; + } + ); + + NETWORK_INTERFACES : + { + + ENB_INTERFACE_NAME_FOR_S1_MME = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.19/24"; + ENB_INTERFACE_NAME_FOR_S1U = "eth0"; + ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.19/24"; + ENB_PORT_FOR_S1U = 2152; # Spec 2152 + }; + } +); From afeb57549c5644ec423c9a0c8df180f1f9816107 Mon Sep 17 00:00:00 2001 From: Calvin Date: Wed, 16 May 2018 16:56:44 +0200 Subject: [PATCH 07/13] push EN-DC RRC configuration initizalization --- openair2/RRC/LITE/rrc_UE.c | 56 ++++++++++++++++++++++++++++++++++++++ targets/RT/USER/lte-ue.c | 7 ++++- 2 files changed, 62 insertions(+), 1 deletion(-) diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c index 2a12def752..72d6dd9895 100644 --- a/openair2/RRC/LITE/rrc_UE.c +++ b/openair2/RRC/LITE/rrc_UE.c @@ -1939,6 +1939,62 @@ rrc_ue_process_rrcConnectionReconfiguration( LOG_I(RRC,"Radio Resource Configuration is present\n"); rrc_ue_process_radioResourceConfigDedicated(ctxt_pP,eNB_index, rrcConnectionReconfiguration_r8->radioResourceConfigDedicated); } + + + void *non_criticical_ext_iterator = rrcConnectionReconfiguration_r8; + RCCConnectionReconfiguration_v1510_IEs_t *rrc_connection_reconfiguration_v1510_IEs = (RRCConnectionReconfiguration_v1510_IEs_t *)0; + // fetch EN-DC for NR_RRC here + // r8 + if( ((RRCConnectionReconfiguration_r8_IEs_t *)non_criticical_ext_iterator)->nonCriticalExtension != (RRCConnectionReconfiguration_v890_IEs_t *)0){ + non_criticical_ext_iterator = ((RRCConnectionReconfiguration_r8_IEs_t *)non_criticical_ext_iterator)->nonCriticalExtension; + } + // v89 + if( ((RRCConnectionReconfiguration_v890_IEs_t *)non_criticical_ext_iterator)->nonCriticalExtension != (RRCConnectionReconfiguration_v920_IEs_t *)0){ + non_criticical_ext_iterator = ((RRCConnectionReconfiguration_v890_IEs_t *)non_criticical_ext_iterator)->nonCriticalExtension; + } + // v92 + if( ((RRCConnectionReconfiguration_v920_IEs_t *)non_criticical_ext_iterator)->nonCriticalExtension != (RRCConnectionReconfiguration_v1020_IEs_t *)0){ + non_criticical_ext_iterator = ((RRCConnectionReconfiguration_v920_IEs_t *)non_criticical_ext_iterator)->nonCriticalExtension; + } + // v1020 + if( ((RRCConnectionReconfiguration_v1020_IEs_t *)non_criticical_ext_iterator)->nonCriticalExtension != (RRCConnectionReconfiguration_v1130_IEs_t *)0){ + non_criticical_ext_iterator = ((RRCConnectionReconfiguration_v1020_IEs_t *)non_criticical_ext_iterator)->nonCriticalExtension; + } + // v1130 + if( ((RRCConnectionReconfiguration_v1130_IEs_t *)non_criticical_ext_iterator)->nonCriticalExtension != (RRCConnectionReconfiguration_v1250_IEs_t *)0){ + non_criticical_ext_iterator = ((RRCConnectionReconfiguration_v1130_IEs_t *)non_criticical_ext_iterator)->nonCriticalExtension; + } + // v1250 + if( ((RRCConnectionReconfiguration_v1250_IEs_t *)non_criticical_ext_iterator)->nonCriticalExtension != (RRCConnectionReconfiguration_v1310_IEs_t *)0){ + non_criticical_ext_iterator = ((RRCConnectionReconfiguration_v1250_IEs_t *)non_criticical_ext_iterator)->nonCriticalExtension; + } + // v1310 + if( ((RRCConnectionReconfiguration_v1310_IEs_t *)non_criticical_ext_iterator)->nonCriticalExtension != (RRCConnectionReconfiguration_v1430_IEs_t *)0){ + non_criticical_ext_iterator = ((RRCConnectionReconfiguration_v1310_IEs_t *)non_criticical_ext_iterator)->nonCriticalExtension; + } + // v1430 + if( ((RRCConnectionReconfiguration_v1430_IEs_t *)non_criticical_ext_iterator)->nonCriticalExtension != (RRCConnectionReconfiguration_v1510_IEs_t *)0){ + rrc_connection_reconfiguration_v1510_IEs = ((RRCConnectionReconfiguration_v1430_IEs_t *)non_criticical_ext_iterator)->nonCriticalExtension; + } + + if( rrc_connection_reconfiguration_v1510_IEs != (RRCConnectionReconfiguration_v1510_IEs_t *)0){ // make sure v1510 is presented. + if(rrc_connection_reconfiguration_v1510_IEs->nr_Config_r15 != (struct nr_Config_r15 *)0){ + switch(rrc_connection_reconfiguration_v1510_IEs->nr_Config_r15.present){ + case nr_Config_r15_PR_setup: + // process NR sCell config + if(rrc_connection_reconfiguration_v1510_IEs->nr_Config_r15.choice.setup->nr_SecondaryCellGroupConfig_r15 != (OCTET_STRING_t *)0){ + nr_rrc_ue_decode_rrcReconfiguration( rrc_connection_reconfiguration_v1510_IEs->nr_Config_r15.choice.setup->nr_SecondaryCellGroupConfig_r15->buffer, + rrc_connection_reconfiguration_v1510_IEs->nr_Config_r15.choice.setup->nr_SecondaryCellGroupConfig_r15.size); + } + + break; + case nr_Config_r15_PR_release: + case nr_Config_r15_PR_NOTHING: + default: + break; + } + } + } #if defined(ENABLE_ITTI) diff --git a/targets/RT/USER/lte-ue.c b/targets/RT/USER/lte-ue.c index 2c83ea9a04..30fce49379 100644 --- a/targets/RT/USER/lte-ue.c +++ b/targets/RT/USER/lte-ue.c @@ -213,7 +213,12 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correcti l2_init_ue(eMBMS_active,(uecap_xer_in==1)?uecap_xer:NULL, 0,// cba_group_active 0); // HO flag - + +#ifdef NR +// nr_l2_init_ue(); +// nr_l3_init_ue(); +#endif + for (inst=0;inst Date: Wed, 16 May 2018 16:58:43 +0200 Subject: [PATCH 08/13] push EN-DC RRC configuration initizalization --- openair2/LAYER2/NR_MAC_UE/config_ue.c | 485 +++++++++ openair2/LAYER2/NR_MAC_UE/defs.h | 1360 ++++++++++++++++++++++++ openair2/LAYER2/NR_MAC_UE/extern.h | 100 ++ openair2/LAYER2/NR_MAC_UE/main_ue_nr.c | 49 + openair2/LAYER2/NR_MAC_UE/proto.h | 1193 +++++++++++++++++++++ openair2/RRC/NR_UE/defs.h | 522 +++++++++ openair2/RRC/NR_UE/main_ue.c | 19 + openair2/RRC/NR_UE/proto.h | 79 ++ openair2/RRC/NR_UE/rrc_UE.c | 294 +++++ openair2/RRC/NR_UE/rrc_types.h | 71 ++ openair2/RRC/NR_UE/vars.h | 248 +++++ 11 files changed, 4420 insertions(+) create mode 100644 openair2/LAYER2/NR_MAC_UE/config_ue.c create mode 100644 openair2/LAYER2/NR_MAC_UE/defs.h create mode 100644 openair2/LAYER2/NR_MAC_UE/extern.h create mode 100644 openair2/LAYER2/NR_MAC_UE/main_ue_nr.c create mode 100644 openair2/LAYER2/NR_MAC_UE/proto.h create mode 100644 openair2/RRC/NR_UE/defs.h create mode 100644 openair2/RRC/NR_UE/main_ue.c create mode 100644 openair2/RRC/NR_UE/proto.h create mode 100644 openair2/RRC/NR_UE/rrc_UE.c create mode 100644 openair2/RRC/NR_UE/rrc_types.h create mode 100644 openair2/RRC/NR_UE/vars.h diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c new file mode 100644 index 0000000000..a9564f908f --- /dev/null +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -0,0 +1,485 @@ + +/* + * 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 + */ + +/*! \file config.c + * \brief UE and eNB configuration performed by RRC or as a consequence of RRC procedures + * \author Navid Nikaein and Raymond Knopp + * \date 2010 - 2014 + * \version 0.1 + * \email: navid.nikaein@eurecom.fr + * @ingroup _mac + + */ + +int +nr_rrc_mac_config_req_ue( + module_id_t Mod_idP, + int CC_idP, + uint8_t eNB_index, + ){ + +// TODO do something FAPI-like P5 L1/L2 config interface in config_si, config_mib, etc. + + int i; + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME + (VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_IN); + + LOG_I(MAC, "[CONFIG][UE %d] Configuring MAC/PHY from eNB %d\n", + Mod_idP, eNB_index); + + if (tdd_Config != NULL) { + UE_mac_inst[Mod_idP].tdd_Config = tdd_Config; + } + + + if (tdd_Config && SIwindowsize && SIperiod) { + phy_config_sib1_ue(Mod_idP, 0, eNB_index, tdd_Config, + *SIwindowsize, *SIperiod); + } + + if (radioResourceConfigCommon != NULL) { + UE_mac_inst[Mod_idP].radioResourceConfigCommon = + radioResourceConfigCommon; + phy_config_sib2_ue(Mod_idP, 0, eNB_index, + radioResourceConfigCommon, ul_CarrierFreq, + ul_Bandwidth, additionalSpectrumEmission, + mbsfn_SubframeConfigList); + } + // SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters->logicalChannelGroup + if (logicalChannelConfig != NULL) { + LOG_I(MAC, + "[CONFIG][UE %d] Applying RRC logicalChannelConfig from eNB%d\n", + Mod_idP, eNB_index); + UE_mac_inst[Mod_idP].logicalChannelConfig[logicalChannelIdentity] = + logicalChannelConfig; + UE_mac_inst[Mod_idP].scheduling_info.Bj[logicalChannelIdentity] = 0; // initilize the bucket for this lcid + + AssertFatal(logicalChannelConfig->ul_SpecificParameters != NULL, + "[UE %d] LCID %ld NULL ul_SpecificParameters\n", + Mod_idP, logicalChannelIdentity); + UE_mac_inst[Mod_idP].scheduling_info.bucket_size[logicalChannelIdentity] = logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate * logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration; // set the max bucket size + if (logicalChannelConfig->ul_SpecificParameters-> + logicalChannelGroup != NULL) { + UE_mac_inst[Mod_idP].scheduling_info. + LCGID[logicalChannelIdentity] = + *logicalChannelConfig->ul_SpecificParameters-> + logicalChannelGroup; + LOG_D(MAC, + "[CONFIG][UE %d] LCID %ld is attached to the LCGID %ld\n", + Mod_idP, logicalChannelIdentity, + *logicalChannelConfig-> + ul_SpecificParameters->logicalChannelGroup); + } else { + UE_mac_inst[Mod_idP].scheduling_info. + LCGID[logicalChannelIdentity] = MAX_NUM_LCGID; + } + UE_mac_inst[Mod_idP]. + scheduling_info.LCID_buffer_remain[logicalChannelIdentity] = 0; + } + + if (mac_MainConfig != NULL) { + LOG_I(MAC, + "[CONFIG][UE%d] Applying RRC macMainConfig from eNB%d\n", + Mod_idP, eNB_index); + UE_mac_inst[Mod_idP].macConfig = mac_MainConfig; + UE_mac_inst[Mod_idP].measGapConfig = measGapConfig; + + if (mac_MainConfig->ul_SCH_Config) { + + if (mac_MainConfig->ul_SCH_Config->periodicBSR_Timer) { + UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer = + (uint16_t) * + mac_MainConfig->ul_SCH_Config->periodicBSR_Timer; + } else { + UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer = +#ifndef Rel14 + (uint16_t) + MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity +#else + (uint16_t) PeriodicBSR_Timer_r12_infinity; +#endif + ; + } + + if (mac_MainConfig->ul_SCH_Config->maxHARQ_Tx) { + UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx = + (uint16_t) * mac_MainConfig->ul_SCH_Config->maxHARQ_Tx; + } else { + UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx = + (uint16_t) + MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; + } + phy_config_harq_ue(Mod_idP, 0, eNB_index, + UE_mac_inst[Mod_idP]. + scheduling_info.maxHARQ_Tx); + + if (mac_MainConfig->ul_SCH_Config->retxBSR_Timer) { + UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer = + (uint16_t) mac_MainConfig->ul_SCH_Config-> + retxBSR_Timer; + } else { +#ifndef Rel14 + UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer = + (uint16_t) + MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560; +#else + UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer = + (uint16_t) RetxBSR_Timer_r12_sf2560; +#endif + } + } +#if defined(Rel10) || defined(Rel14) + + if (mac_MainConfig->ext1 + && mac_MainConfig->ext1->sr_ProhibitTimer_r9) { + UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = + (uint16_t) * mac_MainConfig->ext1->sr_ProhibitTimer_r9; + } else { + UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = 0; + } + + if (mac_MainConfig->ext2 + && mac_MainConfig->ext2->mac_MainConfig_v1020) { + if (mac_MainConfig->ext2-> + mac_MainConfig_v1020->extendedBSR_Sizes_r10) { + UE_mac_inst[Mod_idP].scheduling_info. + extendedBSR_Sizes_r10 = + (uint16_t) * + mac_MainConfig->ext2-> + mac_MainConfig_v1020->extendedBSR_Sizes_r10; + } else { + UE_mac_inst[Mod_idP].scheduling_info. + extendedBSR_Sizes_r10 = (uint16_t) 0; + } + if (mac_MainConfig->ext2->mac_MainConfig_v1020-> + extendedPHR_r10) { + UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = + (uint16_t) * + mac_MainConfig->ext2->mac_MainConfig_v1020-> + extendedPHR_r10; + } else { + UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = + (uint16_t) 0; + } + } else { + UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 = + (uint16_t) 0; + UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = + (uint16_t) 0; + } +#endif + UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF = + MAC_UE_BSR_TIMER_NOT_RUNNING; + UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF = + MAC_UE_BSR_TIMER_NOT_RUNNING; + + UE_mac_inst[Mod_idP].BSR_reporting_active = BSR_TRIGGER_NONE; + + LOG_D(MAC, "[UE %d]: periodic BSR %d (SF), retx BSR %d (SF)\n", + Mod_idP, + UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF, + UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF); + + UE_mac_inst[Mod_idP].scheduling_info.drx_config = + mac_MainConfig->drx_Config; + UE_mac_inst[Mod_idP].scheduling_info.phr_config = + mac_MainConfig->phr_Config; + + if (mac_MainConfig->phr_Config) { + UE_mac_inst[Mod_idP].PHR_state = + mac_MainConfig->phr_Config->present; + UE_mac_inst[Mod_idP].PHR_reconfigured = 1; + UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer = + mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer; + UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer = + mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer; + UE_mac_inst[Mod_idP].scheduling_info.PathlossChange = + mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange; + } else { + UE_mac_inst[Mod_idP].PHR_reconfigured = 0; + UE_mac_inst[Mod_idP].PHR_state = + MAC_MainConfig__phr_Config_PR_setup; + UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer = + MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; + UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer = + MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; + UE_mac_inst[Mod_idP].scheduling_info.PathlossChange = + MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; + } + + UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF = + get_sf_perioidicPHR_Timer(UE_mac_inst[Mod_idP]. + scheduling_info.periodicPHR_Timer); + UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF = + get_sf_prohibitPHR_Timer(UE_mac_inst[Mod_idP]. + scheduling_info.prohibitPHR_Timer); + UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db = + get_db_dl_PathlossChange(UE_mac_inst[Mod_idP]. + scheduling_info.PathlossChange); + UE_mac_inst[Mod_idP].PHR_reporting_active = 0; + LOG_D(MAC, + "[UE %d] config PHR (%d): periodic %d (SF) prohibit %d (SF) pathlosschange %d (db) \n", + Mod_idP, + (mac_MainConfig->phr_Config) ? mac_MainConfig-> + phr_Config->present : -1, + UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF, + UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF, + UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db); + } + + + if (physicalConfigDedicated != NULL) { + phy_config_dedicated_ue(Mod_idP, 0, eNB_index, + physicalConfigDedicated); + UE_mac_inst[Mod_idP].physicalConfigDedicated = physicalConfigDedicated; // for SR proc + } +#if defined(Rel10) || defined(Rel14) + + if (sCellToAddMod_r10 != NULL) { + + + phy_config_dedicated_scell_ue(Mod_idP, eNB_index, + sCellToAddMod_r10, 1); + UE_mac_inst[Mod_idP].physicalConfigDedicatedSCell_r10 = sCellToAddMod_r10->radioResourceConfigDedicatedSCell_r10->physicalConfigDedicatedSCell_r10; // using SCell index 0 + } +#endif + + if (measObj != NULL) { + if (measObj[0] != NULL) { + UE_mac_inst[Mod_idP].n_adj_cells = + measObj[0]->measObject.choice. + measObjectEUTRA.cellsToAddModList->list.count; + LOG_I(MAC, "Number of adjacent cells %d\n", + UE_mac_inst[Mod_idP].n_adj_cells); + + for (i = 0; i < UE_mac_inst[Mod_idP].n_adj_cells; i++) { + UE_mac_inst[Mod_idP].adj_cell_id[i] = + measObj[0]->measObject.choice. + measObjectEUTRA.cellsToAddModList->list.array[i]-> + physCellId; + LOG_I(MAC, "Cell %d : Nid_cell %d\n", i, + UE_mac_inst[Mod_idP].adj_cell_id[i]); + } + + phy_config_meas_ue(Mod_idP, 0, eNB_index, + UE_mac_inst[Mod_idP].n_adj_cells, + UE_mac_inst[Mod_idP].adj_cell_id); + } + } + + + if (mobilityControlInfo != NULL) { + + LOG_D(MAC, "[UE%d] MAC Reset procedure triggered by RRC eNB %d \n", + Mod_idP, eNB_index); + ue_mac_reset(Mod_idP, eNB_index); + + if (mobilityControlInfo->radioResourceConfigCommon. + rach_ConfigCommon) { + memcpy((void *) + &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> + rach_ConfigCommon, + (void *) mobilityControlInfo-> + radioResourceConfigCommon.rach_ConfigCommon, + sizeof(RACH_ConfigCommon_t)); + } + + memcpy((void *) &UE_mac_inst[Mod_idP]. + radioResourceConfigCommon->prach_Config.prach_ConfigInfo, + (void *) mobilityControlInfo-> + radioResourceConfigCommon.prach_Config.prach_ConfigInfo, + sizeof(PRACH_ConfigInfo_t)); + UE_mac_inst[Mod_idP].radioResourceConfigCommon-> + prach_Config.rootSequenceIndex = + mobilityControlInfo->radioResourceConfigCommon. + prach_Config.rootSequenceIndex; + + if (mobilityControlInfo->radioResourceConfigCommon. + pdsch_ConfigCommon) { + memcpy((void *) + &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> + pdsch_ConfigCommon, + (void *) mobilityControlInfo-> + radioResourceConfigCommon.pdsch_ConfigCommon, + sizeof(PDSCH_ConfigCommon_t)); + } + // not a pointer: mobilityControlInfo->radioResourceConfigCommon.pusch_ConfigCommon + memcpy((void *) &UE_mac_inst[Mod_idP]. + radioResourceConfigCommon->pusch_ConfigCommon, + (void *) &mobilityControlInfo-> + radioResourceConfigCommon.pusch_ConfigCommon, + sizeof(PUSCH_ConfigCommon_t)); + + if (mobilityControlInfo->radioResourceConfigCommon.phich_Config) { + /* memcpy((void *)&UE_mac_inst[Mod_idP].radioResourceConfigCommon->phich_Config, + (void *)mobilityControlInfo->radioResourceConfigCommon.phich_Config, + sizeof(PHICH_Config_t)); */ + } + + if (mobilityControlInfo->radioResourceConfigCommon. + pucch_ConfigCommon) { + memcpy((void *) + &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> + pucch_ConfigCommon, + (void *) mobilityControlInfo-> + radioResourceConfigCommon.pucch_ConfigCommon, + sizeof(PUCCH_ConfigCommon_t)); + } + + if (mobilityControlInfo-> + radioResourceConfigCommon.soundingRS_UL_ConfigCommon) { + memcpy((void *) + &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> + soundingRS_UL_ConfigCommon, + (void *) mobilityControlInfo-> + radioResourceConfigCommon.soundingRS_UL_ConfigCommon, + sizeof(SoundingRS_UL_ConfigCommon_t)); + } + + if (mobilityControlInfo-> + radioResourceConfigCommon.uplinkPowerControlCommon) { + memcpy((void *) + &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> + uplinkPowerControlCommon, + (void *) mobilityControlInfo-> + radioResourceConfigCommon.uplinkPowerControlCommon, + sizeof(UplinkPowerControlCommon_t)); + } + //configure antennaInfoCommon somewhere here.. + if (mobilityControlInfo->radioResourceConfigCommon.p_Max) { + //to be configured + } + + if (mobilityControlInfo->radioResourceConfigCommon.tdd_Config) { + UE_mac_inst[Mod_idP].tdd_Config = + mobilityControlInfo->radioResourceConfigCommon.tdd_Config; + } + + if (mobilityControlInfo-> + radioResourceConfigCommon.ul_CyclicPrefixLength) { + memcpy((void *) + &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> + ul_CyclicPrefixLength, + (void *) mobilityControlInfo-> + radioResourceConfigCommon.ul_CyclicPrefixLength, + sizeof(UL_CyclicPrefixLength_t)); + } + // store the previous rnti in case of failure, and set thenew rnti + UE_mac_inst[Mod_idP].crnti_before_ho = UE_mac_inst[Mod_idP].crnti; + UE_mac_inst[Mod_idP].crnti = + ((mobilityControlInfo-> + newUE_Identity.buf[0]) | (mobilityControlInfo-> + newUE_Identity.buf[1] << 8)); + LOG_I(MAC, "[UE %d] Received new identity %x from %d\n", Mod_idP, + UE_mac_inst[Mod_idP].crnti, eNB_index); + UE_mac_inst[Mod_idP].rach_ConfigDedicated = + malloc(sizeof(*mobilityControlInfo->rach_ConfigDedicated)); + + if (mobilityControlInfo->rach_ConfigDedicated) { + memcpy((void *) UE_mac_inst[Mod_idP].rach_ConfigDedicated, + (void *) mobilityControlInfo->rach_ConfigDedicated, + sizeof(*mobilityControlInfo->rach_ConfigDedicated)); + } + + phy_config_afterHO_ue(Mod_idP, 0, eNB_index, mobilityControlInfo, + 0); + } + + + if (mbsfn_SubframeConfigList != NULL) { + LOG_I(MAC, + "[UE %d][CONFIG] Received %d subframe allocation pattern for MBSFN\n", + Mod_idP, mbsfn_SubframeConfigList->list.count); + UE_mac_inst[Mod_idP].num_sf_allocation_pattern = + mbsfn_SubframeConfigList->list.count; + + for (i = 0; i < mbsfn_SubframeConfigList->list.count; i++) { + LOG_I(MAC, + "[UE %d] Configuring MBSFN_SubframeConfig %d from received SIB2 \n", + Mod_idP, i); + UE_mac_inst[Mod_idP].mbsfn_SubframeConfig[i] = + mbsfn_SubframeConfigList->list.array[i]; + // LOG_I("[UE %d] MBSFN_SubframeConfig[%d] pattern is %ld\n", Mod_idP, + // UE_mac_inst[Mod_idP].mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[0]); + } + } +#if defined(Rel10) || defined(Rel14) + + if (mbsfn_AreaInfoList != NULL) { + LOG_I(MAC, "[UE %d][CONFIG] Received %d MBSFN Area Info\n", + Mod_idP, mbsfn_AreaInfoList->list.count); + UE_mac_inst[Mod_idP].num_active_mbsfn_area = + mbsfn_AreaInfoList->list.count; + + for (i = 0; i < mbsfn_AreaInfoList->list.count; i++) { + UE_mac_inst[Mod_idP].mbsfn_AreaInfo[i] = + mbsfn_AreaInfoList->list.array[i]; + LOG_I(MAC, + "[UE %d] MBSFN_AreaInfo[%d]: MCCH Repetition Period = %ld\n", + Mod_idP, i, + UE_mac_inst[Mod_idP].mbsfn_AreaInfo[i]-> + mcch_Config_r9.mcch_RepetitionPeriod_r9); + phy_config_sib13_ue(Mod_idP, 0, eNB_index, i, + UE_mac_inst[Mod_idP]. + mbsfn_AreaInfo[i]->mbsfn_AreaId_r9); + } + } + + if (pmch_InfoList != NULL) { + + // LOG_I(MAC,"DUY: lcid when entering rrc_mac config_req is %02d\n",(pmch_InfoList->list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9)); + + LOG_I(MAC, "[UE %d] Configuring PMCH_config from MCCH MESSAGE \n", + Mod_idP); + + for (i = 0; i < pmch_InfoList->list.count; i++) { + UE_mac_inst[Mod_idP].pmch_Config[i] = + &pmch_InfoList->list.array[i]->pmch_Config_r9; + LOG_I(MAC, "[UE %d] PMCH[%d]: MCH_Scheduling_Period = %ld\n", + Mod_idP, i, + UE_mac_inst[Mod_idP]. + pmch_Config[i]->mch_SchedulingPeriod_r9); + } + + UE_mac_inst[Mod_idP].mcch_status = 1; + } +#endif +#ifdef CBA + + if (cba_rnti) { + UE_mac_inst[Mod_idP].cba_rnti[num_active_cba_groups - 1] = + cba_rnti; + LOG_D(MAC, + "[UE %d] configure CBA group %d RNTI %x for eNB %d (total active cba group %d)\n", + Mod_idP, Mod_idP % num_active_cba_groups, cba_rnti, + eNB_index, num_active_cba_groups); + phy_config_cba_rnti(Mod_idP, CC_idP, eNB_flagP, eNB_index, + cba_rnti, num_active_cba_groups - 1, + num_active_cba_groups); + } +#endif + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME + (VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT); + + return (0); +} diff --git a/openair2/LAYER2/NR_MAC_UE/defs.h b/openair2/LAYER2/NR_MAC_UE/defs.h new file mode 100644 index 0000000000..e3f5d954f1 --- /dev/null +++ b/openair2/LAYER2/NR_MAC_UE/defs.h @@ -0,0 +1,1360 @@ +/* + * 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 + */ + +/*! \file LAYER2/MAC/defs.h +* \brief MAC data structures, constant, and function prototype +* \author Navid Nikaein and Raymond Knopp +* \date 2011 +* \version 0.5 +* \email navid.nikaein@eurecom.fr + +*/ +/** @defgroup _oai2 openair2 Reference Implementation + * @ingroup _ref_implementation_ + * @{ + */ + +/*@}*/ + +#ifndef __LAYER2_MAC_DEFS_H__ +#define __LAYER2_MAC_DEFS_H__ + + + +#include +#include +#include + +#include "PHY/defs.h" +#include "PHY/LTE_TRANSPORT/defs.h" +#include "COMMON/platform_constants.h" +#include "BCCH-BCH-Message.h" +#include "RadioResourceConfigCommon.h" +#include "RadioResourceConfigDedicated.h" +#include "MeasGapConfig.h" +#include "SchedulingInfoList.h" +#include "TDD-Config.h" +#include "RACH-ConfigCommon.h" +#include "MeasObjectToAddModList.h" +#include "MobilityControlInfo.h" +#if defined(Rel10) || defined(Rel14) +#include "MBSFN-AreaInfoList-r9.h" +#include "MBSFN-SubframeConfigList.h" +#include "PMCH-InfoList-r9.h" +#include "SCellToAddMod-r10.h" +#endif +#ifdef Rel14 +#include "SystemInformationBlockType1-v1310-IEs.h" +#endif + +#include "nfapi_interface.h" +#include "PHY_INTERFACE/IF_Module.h" + +/** @defgroup _mac MAC + * @ingroup _oai2 + * @{ + */ + +#define BCCH_PAYLOAD_SIZE_MAX 128 +#define CCCH_PAYLOAD_SIZE_MAX 128 +#define PCCH_PAYLOAD_SIZE_MAX 128 +#define RAR_PAYLOAD_SIZE_MAX 128 + +#define SCH_PAYLOAD_SIZE_MAX 4096 +/// Logical channel ids from 36-311 (Note BCCH is not specified in 36-311, uses the same as first DRB) + +#if defined(Rel10) || defined(Rel14) + +// Mask for identifying subframe for MBMS +#define MBSFN_TDD_SF3 0x80 // for TDD +#define MBSFN_TDD_SF4 0x40 +#define MBSFN_TDD_SF7 0x20 +#define MBSFN_TDD_SF8 0x10 +#define MBSFN_TDD_SF9 0x08 +#define MBSFN_FDD_SF1 0x80 // for FDD +#define MBSFN_FDD_SF2 0x40 +#define MBSFN_FDD_SF3 0x20 +#define MBSFN_FDD_SF6 0x10 +#define MBSFN_FDD_SF7 0x08 +#define MBSFN_FDD_SF8 0x04 + +#define MAX_MBSFN_AREA 8 +#define MAX_PMCH_perMBSFN 15 +/*!\brief MAX MCCH payload size */ +#define MCCH_PAYLOAD_SIZE_MAX 128 +//#define MCH_PAYLOAD_SIZE_MAX 16384// this value is using in case mcs and TBS index are high +#endif + +#define printk printf + +/*!\brief Maximum number of logical channl group IDs */ +#define MAX_NUM_LCGID 4 +/*!\brief logical channl group ID 0 */ +#define LCGID0 0 +/*!\brief logical channl group ID 1 */ +#define LCGID1 1 +/*!\brief logical channl group ID 2 */ +#define LCGID2 2 +/*!\brief logical channl group ID 3 */ +#define LCGID3 3 +/*!\brief Maximum number of logical chanels */ +#define MAX_NUM_LCID 11 +/*!\brief Maximum number od control elemenets */ +#define MAX_NUM_CE 5 +/*!\brief Maximum number of random access process */ +#if defined(USRP_REC_PLAY) +#define NB_RA_PROC_MAX 1 +#else +#define NB_RA_PROC_MAX 4 +#endif +/*!\brief size of buffer status report table */ +#define BSR_TABLE_SIZE 64 +/*!\brief The power headroom reporting range is from -23 ...+40 dB and beyond, with step 1 */ +#define PHR_MAPPING_OFFSET 23 // if ( x>= -23 ) val = floor (x + 23) +/*!\brief maximum number of resource block groups */ +#define N_RBG_MAX 25 // for 20MHz channel BW +/*!\brief minimum value for channel quality indicator */ +#define MIN_CQI_VALUE 0 +/*!\brief maximum value for channel quality indicator */ +#define MAX_CQI_VALUE 15 +/*!\briefmaximum number of supported bandwidth (1.4, 5, 10, 20 MHz) */ +#define MAX_SUPPORTED_BW 4 +/*!\brief CQI values range from 1 to 15 (4 bits) */ +#define CQI_VALUE_RANGE 16 + +/*!\brief value for indicating BSR Timer is not running */ +#define MAC_UE_BSR_TIMER_NOT_RUNNING (0xFFFF) + +#define LCID_EMPTY 0 +#define LCID_NOT_EMPTY 1 + +/*!\brief minimum RLC PDU size to be transmitted = min RLC Status PDU or RLC UM PDU SN 5 bits */ +#define MIN_RLC_PDU_SIZE (2) + +/*!\brief minimum MAC data needed for transmitting 1 min RLC PDU size + 1 byte MAC subHeader */ +#define MIN_MAC_HDR_RLC_SIZE (1 + MIN_RLC_PDU_SIZE) + +/*!\brief maximum number of slices / groups */ +#define MAX_NUM_SLICES 4 + +#define U_PLANE_INACTIVITY_VALUE 6000 + +/* + * eNB part + */ + + +/* + * UE/ENB common part + */ +/*!\brief MAC header of Random Access Response for Random access preamble identifier (RAPID) */ +typedef struct { + uint8_t RAPID:6; + uint8_t T:1; + uint8_t E:1; +} __attribute__ ((__packed__)) RA_HEADER_RAPID; + +/*!\brief MAC header of Random Access Response for backoff indicator (BI)*/ +typedef struct { + uint8_t BI:4; + uint8_t R:2; + uint8_t T:1; + uint8_t E:1; +} __attribute__ ((__packed__)) RA_HEADER_BI; +/* +typedef struct { + uint64_t padding:16; + uint64_t t_crnti:16; + uint64_t hopping_flag:1; + uint64_t rb_alloc:10; + uint64_t mcs:4; + uint64_t TPC:3; + uint64_t UL_delay:1; + uint64_t cqi_req:1; + uint64_t Timing_Advance_Command:11; // first/2nd octet LSB + uint64_t R:1; // octet MSB + } __attribute__((__packed__))RAR_PDU; + +typedef struct { + uint64_t padding:16; + uint64_t R:1; // octet MSB + uint64_t Timing_Advance_Command:11; // first/2nd octet LSB + uint64_t cqi_req:1; + uint64_t UL_delay:1; + uint64_t TPC:3; + uint64_t mcs:4; + uint64_t rb_alloc:10; + uint64_t hopping_flag:1; + uint64_t t_crnti:16; + } __attribute__((__packed__))RAR_PDU; + +#define sizeof_RAR_PDU 6 +*/ +/*!\brief MAC subheader short with 7bit Length field */ +typedef struct { + uint8_t LCID:5; // octet 1 LSB + uint8_t E:1; + uint8_t R:2; // octet 1 MSB + uint8_t L:7; // octet 2 LSB + uint8_t F:1; // octet 2 MSB +} __attribute__ ((__packed__)) SCH_SUBHEADER_SHORT; +/*!\brief MAC subheader long with 15bit Length field */ +typedef struct { + uint8_t LCID:5; // octet 1 LSB + uint8_t E:1; + uint8_t R:2; // octet 1 MSB + uint8_t L_MSB:7; + uint8_t F:1; // octet 2 MSB + uint8_t L_LSB:8; + uint8_t padding; +} __attribute__ ((__packed__)) SCH_SUBHEADER_LONG; +/*!\brief MAC subheader short without length field */ +typedef struct { + uint8_t LCID:5; + uint8_t E:1; + uint8_t R:2; +} __attribute__ ((__packed__)) SCH_SUBHEADER_FIXED; + +/*!\brief mac control element: short buffer status report for a specific logical channel group ID*/ +typedef struct { + uint8_t Buffer_size:6; // octet 1 LSB + uint8_t LCGID:2; // octet 1 MSB +} __attribute__ ((__packed__)) BSR_SHORT; + +typedef BSR_SHORT BSR_TRUNCATED; +/*!\brief mac control element: long buffer status report for all logical channel group ID*/ +typedef struct { + uint8_t Buffer_size3:6; + uint8_t Buffer_size2:6; + uint8_t Buffer_size1:6; + uint8_t Buffer_size0:6; +} __attribute__ ((__packed__)) BSR_LONG; + +#define BSR_LONG_SIZE (sizeof(BSR_LONG)) +/*!\brief mac control element: timing advance */ +typedef struct { + uint8_t TA:6; + uint8_t R:2; +} __attribute__ ((__packed__)) TIMING_ADVANCE_CMD; +/*!\brief mac control element: power headroom report */ +typedef struct { + uint8_t PH:6; + uint8_t R:2; +} __attribute__ ((__packed__)) POWER_HEADROOM_CMD; + +/*! \brief MIB payload */ +typedef struct { + uint8_t payload[3]; +} __attribute__ ((__packed__)) MIB_PDU; +/*! \brief CCCH payload */ +typedef struct { + uint8_t payload[CCCH_PAYLOAD_SIZE_MAX]; +} __attribute__ ((__packed__)) CCCH_PDU; +/*! \brief BCCH payload */ +typedef struct { + uint8_t payload[BCCH_PAYLOAD_SIZE_MAX]; +} __attribute__ ((__packed__)) BCCH_PDU; +/*! \brief RAR payload */ +typedef struct { + uint8_t payload[RAR_PAYLOAD_SIZE_MAX]; +} __attribute__ ((__packed__)) RAR_PDU; +/*! \brief BCCH payload */ +typedef struct { + uint8_t payload[PCCH_PAYLOAD_SIZE_MAX]; +} __attribute__ ((__packed__)) PCCH_PDU; + +#if defined(Rel10) || defined(Rel14) +/*! \brief MCCH payload */ +typedef struct { + uint8_t payload[MCCH_PAYLOAD_SIZE_MAX]; +} __attribute__ ((__packed__)) MCCH_PDU; +/*!< \brief MAC control element for activation and deactivation of component carriers */ +typedef struct { + uint8_t C7:1; /*!< \brief Component carrier 7 */ + uint8_t C6:1; /*!< \brief Component carrier 6 */ + uint8_t C5:1; /*!< \brief Component carrier 5 */ + uint8_t C4:1; /*!< \brief Component carrier 4 */ + uint8_t C3:1; /*!< \brief Component carrier 3 */ + uint8_t C2:1; /*!< \brief Component carrier 2 */ + uint8_t C1:1; /*!< \brief Component carrier 1 */ + uint8_t R:1; /*!< \brief Reserved */ +} __attribute__ ((__packed__)) CC_ELEMENT; +/*! \brief MAC control element: MCH Scheduling Information */ +typedef struct { + uint8_t stop_sf_MSB:3; // octet 1 LSB + uint8_t lcid:5; // octet 2 MSB + uint8_t stop_sf_LSB:8; +} __attribute__ ((__packed__)) MSI_ELEMENT; +#endif +/*! \brief Values of CCCH LCID for DLSCH */ +#define CCCH_LCHANID 0 +/*!\brief Values of BCCH logical channel (fake)*/ +#define BCCH 3 // SI +/*!\brief Values of PCCH logical channel (fake)*/ +#define PCCH 4 // Paging +/*!\brief Values of PCCH logical channel (fake) */ +#define MIBCH 5 // MIB +/*!\brief Values of BCCH SIB1_BR logical channel (fake) */ +#define BCCH_SIB1_BR 6 // SIB1_BR +/*!\brief Values of BCCH SIB_BR logical channel (fake) */ +#define BCCH_SI_BR 7 // SI-BR +/*!\brief Value of CCCH / SRB0 logical channel */ +#define CCCH 0 // srb0 +/*!\brief DCCH / SRB1 logical channel */ +#define DCCH 1 // srb1 +/*!\brief DCCH1 / SRB2 logical channel */ +#define DCCH1 2 // srb2 +/*!\brief DTCH DRB1 logical channel */ +#define DTCH 3 // LCID +/*!\brief MCCH logical channel */ +#define MCCH 4 +/*!\brief MTCH logical channel */ +#define MTCH 1 +// DLSCH LCHAN ID +/*!\brief LCID of UE contention resolution identity for DLSCH*/ +#define UE_CONT_RES 28 +/*!\brief LCID of timing advance for DLSCH */ +#define TIMING_ADV_CMD 29 +/*!\brief LCID of discontinous reception mode for DLSCH */ +#define DRX_CMD 30 +/*!\brief LCID of padding LCID for DLSCH */ +#define SHORT_PADDING 31 + +#if defined(Rel10) || defined(Rel14) +// MCH LCHAN IDs (table6.2.1-4 TS36.321) +/*!\brief LCID of MCCH for DL */ +#define MCCH_LCHANID 0 +/*!\brief LCID of MCH scheduling info for DL */ +#define MCH_SCHDL_INFO 3 +/*!\brief LCID of Carrier component activation/deactivation */ +#define CC_ACT_DEACT 27 +#endif + +// ULSCH LCHAN IDs +/*!\brief LCID of extended power headroom for ULSCH */ +#define EXTENDED_POWER_HEADROOM 25 +/*!\brief LCID of power headroom for ULSCH */ +#define POWER_HEADROOM 26 +/*!\brief LCID of CRNTI for ULSCH */ +#define CRNTI 27 +/*!\brief LCID of truncated BSR for ULSCH */ +#define TRUNCATED_BSR 28 +/*!\brief LCID of short BSR for ULSCH */ +#define SHORT_BSR 29 +/*!\brief LCID of long BSR for ULSCH */ +#define LONG_BSR 30 +/*!\bitmaps for BSR Triggers */ +#define BSR_TRIGGER_NONE (0) /* No BSR Trigger */ +#define BSR_TRIGGER_REGULAR (1) /* For Regular and ReTxBSR Expiry Triggers */ +#define BSR_TRIGGER_PERIODIC (2) /* For BSR Periodic Timer Expiry Trigger */ +#define BSR_TRIGGER_PADDING (4) /* For Padding BSR Trigger */ + + +/*! \brief Downlink SCH PDU Structure */ +typedef struct { + uint8_t payload[8][SCH_PAYLOAD_SIZE_MAX]; + uint16_t Pdu_size[8]; +} __attribute__ ((__packed__)) DLSCH_PDU; + + +/*! \brief MCH PDU Structure */ +typedef struct { + int8_t payload[SCH_PAYLOAD_SIZE_MAX]; + uint16_t Pdu_size; + uint8_t mcs; + uint8_t sync_area; + uint8_t msi_active; + uint8_t mcch_active; + uint8_t mtch_active; +} __attribute__ ((__packed__)) MCH_PDU; + +/*! \brief Uplink SCH PDU Structure */ +typedef struct { + int8_t payload[SCH_PAYLOAD_SIZE_MAX]; /*!< \brief SACH payload */ + uint16_t Pdu_size; +} __attribute__ ((__packed__)) ULSCH_PDU; + +#include "PHY/impl_defs_top.h" + +/*!\brief RA process state*/ +typedef enum { + IDLE = 0, + MSG2, + WAITMSG3, + MSG4, + WAITMSG4ACK +} RA_state; + +/*!\brief UE ULSCH scheduling states*/ +typedef enum { + S_UL_NONE = 0, + S_UL_WAITING, + S_UL_SCHEDULED, + S_UL_BUFFERED, + S_UL_NUM_STATUS +} UE_ULSCH_STATUS; + +/*!\brief UE DLSCH scheduling states*/ +typedef enum { + S_DL_NONE = 0, + S_DL_WAITING, + S_DL_SCHEDULED, + S_DL_BUFFERED, + S_DL_NUM_STATUS +} UE_DLSCH_STATUS; + +/*!\brief scheduling policy for the contention-based access */ +typedef enum { + CBA_ES = 0, /// equal share of RB among groups w + CBA_ES_S, /// equal share of RB among groups with small allocation + CBA_PF, /// proportional fair (kind of) + CBA_PF_S, /// proportional fair (kind of) with small RB allocation + CBA_RS /// random allocation +} CBA_POLICY; + + +/*! \brief temporary struct for ULSCH sched */ +typedef struct { + rnti_t rnti; + uint16_t subframe; + uint16_t serving_num; + UE_ULSCH_STATUS status; +} eNB_ULSCH_INFO; +/*! \brief temp struct for DLSCH sched */ +typedef struct { + rnti_t rnti; + uint16_t weight; + uint16_t subframe; + uint16_t serving_num; + UE_DLSCH_STATUS status; +} eNB_DLSCH_INFO; +/*! \brief eNB overall statistics */ +typedef struct { + /// num BCCH PDU per CC + uint32_t total_num_bcch_pdu; + /// BCCH buffer size + uint32_t bcch_buffer; + /// total BCCH buffer size + uint32_t total_bcch_buffer; + /// BCCH MCS + uint32_t bcch_mcs; + + /// num CCCH PDU per CC + uint32_t total_num_ccch_pdu; + /// BCCH buffer size + uint32_t ccch_buffer; + /// total BCCH buffer size + uint32_t total_ccch_buffer; + /// BCCH MCS + uint32_t ccch_mcs; + + /// num PCCH PDU per CC + uint32_t total_num_pcch_pdu; + /// PCCH buffer size + uint32_t pcch_buffer; + /// total PCCH buffer size + uint32_t total_pcch_buffer; + /// BCCH MCS + uint32_t pcch_mcs; + +/// num active users + uint16_t num_dlactive_UEs; + /// available number of PRBs for a give SF + uint16_t available_prbs; + /// total number of PRB available for the user plane + uint32_t total_available_prbs; + /// aggregation + /// total avilable nccc : num control channel element + uint16_t available_ncces; + // only for a new transmission, should be extended for retransmission + // current dlsch bit rate for all transport channels + uint32_t dlsch_bitrate; + // + uint32_t dlsch_bytes_tx; + // + uint32_t dlsch_pdus_tx; + // + uint32_t total_dlsch_bitrate; + // + uint32_t total_dlsch_bytes_tx; + // + uint32_t total_dlsch_pdus_tx; + + // here for RX + // + uint32_t ulsch_bitrate; + // + uint32_t ulsch_bytes_rx; + // + uint64_t ulsch_pdus_rx; + + uint32_t total_ulsch_bitrate; + // + uint32_t total_ulsch_bytes_rx; + // + uint32_t total_ulsch_pdus_rx; + + + /// MAC agent-related stats + /// total number of scheduling decisions + int sched_decisions; + /// missed deadlines + int missed_deadlines; + +} eNB_STATS; +/*! \brief eNB statistics for the connected UEs*/ +typedef struct { + + /// CRNTI of UE + rnti_t crnti; ///user id (rnti) of connected UEs + // rrc status + uint8_t rrc_status; + /// harq pid + uint8_t harq_pid; + /// harq rounf + uint8_t harq_round; + /// total available number of PRBs for a new transmission + uint16_t rbs_used; + /// total available number of PRBs for a retransmission + uint16_t rbs_used_retx; + /// total nccc used for a new transmission: num control channel element + uint16_t ncce_used; + /// total avilable nccc for a retransmission: num control channel element + uint16_t ncce_used_retx; + + // mcs1 before the rate adaptaion + uint8_t dlsch_mcs1; + /// Target mcs2 after rate-adaptation + uint8_t dlsch_mcs2; + // current TBS with mcs2 + uint32_t TBS; + // total TBS with mcs2 + // uint32_t total_TBS; + // total rb used for a new transmission + uint32_t total_rbs_used; + // total rb used for retransmission + uint32_t total_rbs_used_retx; + + /// TX + /// Num pkt + uint32_t num_pdu_tx[NB_RB_MAX]; + /// num bytes + uint32_t num_bytes_tx[NB_RB_MAX]; + /// num retransmission / harq + uint32_t num_retransmission; + /// instantaneous tx throughput for each TTI + // uint32_t tti_throughput[NB_RB_MAX]; + // Number of received MAC SDU + uint32_t num_mac_sdu_tx; + // LCID related to SDU + unsigned char lcid_sdu[NB_RB_MAX]; + // Length of SDU Got from LC DL + uint32_t sdu_length_tx[NB_RB_MAX]; + + + /// overall + // + uint32_t dlsch_bitrate; + //total + uint32_t total_dlsch_bitrate; + /// headers+ CE + padding bytes for a MAC PDU + uint64_t overhead_bytes; + /// headers+ CE + padding bytes for a MAC PDU + uint64_t total_overhead_bytes; + /// headers+ CE + padding bytes for a MAC PDU + uint64_t avg_overhead_bytes; + // MAC multiplexed payload + uint64_t total_sdu_bytes; + // total MAC pdu bytes + uint64_t total_pdu_bytes; + + // total num pdu + uint32_t total_num_pdus; + // + // uint32_t avg_pdu_size; + + /// RX + + /// PUCCH1a/b power (dBm) + int32_t Po_PUCCH_dBm; + /// Indicator that Po_PUCCH has been updated by PHY + int32_t Po_PUCCH_update; + /// Uplink measured RSSI + int32_t UL_rssi; + /// preassigned mcs after rate adaptation + uint8_t ulsch_mcs1; + /// adjusted mcs + uint8_t ulsch_mcs2; + + /// estimated average pdu inter-departure time + uint32_t avg_pdu_idt; + /// estimated average pdu size + uint32_t avg_pdu_ps; + /// + uint32_t aggregated_pdu_size; + uint32_t aggregated_pdu_arrival; + + /// uplink transport block size + uint32_t ulsch_TBS; + + uint32_t total_ulsch_TBS; + + /// total rb used for a new uplink transmission + uint32_t num_retransmission_rx; + /// total rb used for a new uplink transmission + uint32_t rbs_used_rx; + /// total rb used for a new uplink retransmission + uint32_t rbs_used_retx_rx; + /// total rb used for a new uplink transmission + uint32_t total_rbs_used_rx; + /// normalized rx power + int32_t normalized_rx_power; + /// target rx power + int32_t target_rx_power; + + /// num rx pdu + uint32_t num_pdu_rx[NB_RB_MAX]; + /// num bytes rx + uint32_t num_bytes_rx[NB_RB_MAX]; + /// instantaneous rx throughput for each TTI + // uint32_t tti_goodput[NB_RB_MAX]; + /// errors + uint32_t num_errors_rx; + + uint64_t overhead_bytes_rx; + /// headers+ CE + padding bytes for a MAC PDU + uint64_t total_overhead_bytes_rx; + /// headers+ CE + padding bytes for a MAC PDU + uint64_t avg_overhead_bytes_rx; + // + uint32_t ulsch_bitrate; + //total + uint32_t total_ulsch_bitrate; + /// overall + /// MAC pdu bytes + uint64_t pdu_bytes_rx; + /// total MAC pdu bytes + uint64_t total_pdu_bytes_rx; + /// total num pdu + uint32_t total_num_pdus_rx; + /// num of error pdus + uint32_t total_num_errors_rx; + // Number of error PDUS + uint32_t num_mac_sdu_rx; + // Length of SDU Got from LC UL - Size array can be refined + uint32_t sdu_length_rx[NB_RB_MAX]; + +} eNB_UE_STATS; +/*! \brief eNB template for UE context information */ +typedef struct { + /// C-RNTI of UE + rnti_t rnti; + /// NDI from last scheduling + uint8_t oldNDI[8]; + /// mcs1 from last scheduling + uint8_t oldmcs1[8]; + /// mcs2 from last scheduling + uint8_t oldmcs2[8]; + /// NDI from last UL scheduling + uint8_t oldNDI_UL[8]; + /// mcs from last UL scheduling + uint8_t mcs_UL[8]; + /// TBS from last UL scheduling + int TBS_UL[8]; + /// Flag to indicate UL has been scheduled at least once + boolean_t ul_active; + /// Flag to indicate UE has been configured (ACK from RRCConnectionSetup received) + boolean_t configured; + + /// MCS from last scheduling + uint8_t mcs[8]; + + /// TPC from last scheduling + uint8_t oldTPC[8]; + + // PHY interface info + + /// Number of Allocated RBs for DL after scheduling (prior to frequency allocation) + uint16_t nb_rb[8]; // num_max_harq + + /// Number of Allocated RBs for UL after scheduling + uint16_t nb_rb_ul[8]; // num_max_harq + + /// Number of Allocated RBs for UL after scheduling + uint16_t first_rb_ul[8]; // num_max_harq + + /// Cyclic shift for DMRS after scheduling + uint16_t cshift[8]; // num_max_harq + + /// Number of Allocated RBs by the ulsch preprocessor + uint8_t pre_allocated_nb_rb_ul[MAX_NUM_SLICES]; + + /// index of Allocated RBs by the ulsch preprocessor + int8_t pre_allocated_rb_table_index_ul; + + /// total allocated RBs + int8_t total_allocated_rbs; + + /// pre-assigned MCS by the ulsch preprocessor + uint8_t pre_assigned_mcs_ul; + + /// assigned MCS by the ulsch scheduler + uint8_t assigned_mcs_ul; + + /// DL DAI + uint8_t DAI; + + /// UL DAI + uint8_t DAI_ul[10]; + + /// UL Scheduling Request Received + uint8_t ul_SR; + + ///Resource Block indication for each sub-band in MU-MIMO + uint8_t rballoc_subband[8][50]; + + // Logical channel info for link with RLC + + /// LCGID mapping + long lcgidmap[11]; + + /// phr information + int8_t phr_info; + + /// phr information + int8_t phr_info_configured; + + ///dl buffer info + uint32_t dl_buffer_info[MAX_NUM_LCID]; + /// total downlink buffer info + uint32_t dl_buffer_total; + /// total downlink pdus + uint32_t dl_pdus_total; + /// downlink pdus for each LCID + uint32_t dl_pdus_in_buffer[MAX_NUM_LCID]; + /// creation time of the downlink buffer head for each LCID + uint32_t dl_buffer_head_sdu_creation_time[MAX_NUM_LCID]; + /// maximum creation time of the downlink buffer head across all LCID + uint32_t dl_buffer_head_sdu_creation_time_max; + /// a flag indicating that the downlink head SDU is segmented + uint8_t dl_buffer_head_sdu_is_segmented[MAX_NUM_LCID]; + /// size of remaining size to send for the downlink head SDU + uint32_t dl_buffer_head_sdu_remaining_size_to_send[MAX_NUM_LCID]; + + /// uplink buffer creation time for each LCID + uint32_t ul_buffer_creation_time[MAX_NUM_LCGID]; + /// maximum uplink buffer creation time across all the LCIDs + uint32_t ul_buffer_creation_time_max; + /// uplink buffer size per LCID + uint32_t ul_buffer_info[MAX_NUM_LCGID]; + + /// uplink bytes that are currently scheduled + int scheduled_ul_bytes; + /// estimation of the UL buffer size + int estimated_ul_buffer; + + /// UE tx power + int32_t ue_tx_power; + + /// stores the frame where the last TPC was transmitted + uint32_t pusch_tpc_tx_frame; + uint32_t pusch_tpc_tx_subframe; + uint32_t pucch_tpc_tx_frame; + uint32_t pucch_tpc_tx_subframe; + +#ifdef LOCALIZATION + eNB_UE_estimated_distances distance; +#endif + +#ifdef Rel14 + uint8_t rach_resource_type; + uint16_t mpdcch_repetition_cnt; + frame_t Msg2_frame; +#endif + sub_frame_t Msg2_subframe; + + PhysicalConfigDedicated_t *physicalConfigDedicated; + +} UE_TEMPLATE; + +/*! \brief scheduling control information set through an API (not used)*/ +typedef struct { + ///UL transmission bandwidth in RBs + uint8_t ul_bandwidth[MAX_NUM_LCID]; + ///DL transmission bandwidth in RBs + uint8_t dl_bandwidth[MAX_NUM_LCID]; + + //To do GBR bearer + uint8_t min_ul_bandwidth[MAX_NUM_LCID]; + + uint8_t min_dl_bandwidth[MAX_NUM_LCID]; + + ///aggregated bit rate of non-gbr bearer per UE + uint64_t ue_AggregatedMaximumBitrateDL; + ///aggregated bit rate of non-gbr bearer per UE + uint64_t ue_AggregatedMaximumBitrateUL; + ///CQI scheduling interval in subframes. + uint16_t cqiSchedInterval; + ///Contention resolution timer used during random access + uint8_t mac_ContentionResolutionTimer; + + uint16_t max_rbs_allowed_slice[MAX_NUM_CCs][MAX_NUM_SLICES]; + uint16_t max_rbs_allowed_slice_uplink[MAX_NUM_CCs][MAX_NUM_SLICES]; + + uint8_t max_mcs[MAX_NUM_LCID]; + + uint16_t priority[MAX_NUM_LCID]; + + // resource scheduling information + + /// Current DL harq round per harq_pid on each CC + uint8_t round[MAX_NUM_CCs][10]; + /// Current Active TBs per harq_pid on each CC + uint8_t tbcnt[MAX_NUM_CCs][10]; + /// Current UL harq round per harq_pid on each CC + uint8_t round_UL[MAX_NUM_CCs][8]; + uint8_t dl_pow_off[MAX_NUM_CCs]; + uint16_t pre_nb_available_rbs[MAX_NUM_CCs]; + unsigned char rballoc_sub_UE[MAX_NUM_CCs][N_RBG_MAX]; + uint16_t ta_timer; + int16_t ta_update; + uint16_t ul_consecutive_errors; + int32_t context_active_timer; + int32_t cqi_req_timer; + int32_t ul_inactivity_timer; + int32_t ul_failure_timer; + uint32_t ue_reestablishment_reject_timer; + uint32_t ue_reestablishment_reject_timer_thres; + int32_t ul_scheduled; + int32_t ra_pdcch_order_sent; + int32_t ul_out_of_sync; + int32_t phr_received; + uint8_t periodic_ri_received[NFAPI_CC_MAX]; + uint8_t aperiodic_ri_received[NFAPI_CC_MAX]; + uint8_t pucch1_cqi_update[NFAPI_CC_MAX]; + uint8_t pucch1_snr[NFAPI_CC_MAX]; + uint8_t pucch2_cqi_update[NFAPI_CC_MAX]; + uint8_t pucch2_snr[NFAPI_CC_MAX]; + uint8_t pucch3_cqi_update[NFAPI_CC_MAX]; + uint8_t pucch3_snr[NFAPI_CC_MAX]; + uint8_t pusch_snr[NFAPI_CC_MAX]; + uint16_t feedback_cnt[NFAPI_CC_MAX]; + uint16_t timing_advance; + uint16_t timing_advance_r9; + uint8_t periodic_wideband_cqi[NFAPI_CC_MAX]; + uint8_t periodic_wideband_spatial_diffcqi[NFAPI_CC_MAX]; + uint8_t periodic_wideband_pmi[NFAPI_CC_MAX]; + uint8_t periodic_subband_cqi[NFAPI_CC_MAX][16]; + uint8_t periodic_subband_spatial_diffcqi[NFAPI_CC_MAX][16]; + uint8_t aperiodic_subband_cqi0[NFAPI_CC_MAX][25]; + uint8_t aperiodic_subband_pmi[NFAPI_CC_MAX][25]; + uint8_t aperiodic_subband_diffcqi0[NFAPI_CC_MAX][25]; + uint8_t aperiodic_subband_cqi1[NFAPI_CC_MAX][25]; + uint8_t aperiodic_subband_diffcqi1[NFAPI_CC_MAX][25]; + uint8_t aperiodic_wideband_cqi0[NFAPI_CC_MAX]; + uint8_t aperiodic_wideband_pmi[NFAPI_CC_MAX]; + uint8_t aperiodic_wideband_cqi1[NFAPI_CC_MAX]; + uint8_t aperiodic_wideband_pmi1[NFAPI_CC_MAX]; + uint8_t dl_cqi[NFAPI_CC_MAX]; + int32_t uplane_inactivity_timer; +} UE_sched_ctrl; +/*! \brief eNB template for the Random access information */ +typedef struct { + /// Flag to indicate this process is active + RA_state state; + /// Subframe where preamble was received + uint8_t preamble_subframe; + /// Subframe where Msg2 is to be sent + uint8_t Msg2_subframe; + /// Frame where Msg2 is to be sent + frame_t Msg2_frame; + /// Subframe where Msg3 is to be sent + sub_frame_t Msg3_subframe; + /// Frame where Msg3 is to be sent + frame_t Msg3_frame; + /// Subframe where Msg4 is to be sent + sub_frame_t Msg4_subframe; + /// Frame where Msg4 is to be sent + frame_t Msg4_frame; + /// harq_pid used for Msg4 transmission + uint8_t harq_pid; + /// UE RNTI allocated during RAR + rnti_t rnti; + /// RA RNTI allocated from received PRACH + uint16_t RA_rnti; + /// Received preamble_index + uint8_t preamble_index; + /// Received UE Contention Resolution Identifier + uint8_t cont_res_id[6]; + /// Timing offset indicated by PHY + int16_t timing_offset; + /// Timeout for RRC connection + int16_t RRC_timer; + /// Msg3 first RB + uint8_t msg3_first_rb; + /// Msg3 number of RB + uint8_t msg3_nb_rb; + /// Msg3 MCS + uint8_t msg3_mcs; + /// Msg3 TPC command + uint8_t msg3_TPC; + /// Msg3 ULdelay command + uint8_t msg3_ULdelay; + /// Msg3 cqireq command + uint8_t msg3_cqireq; + /// Round of Msg3 HARQ + uint8_t msg3_round; + /// TBS used for Msg4 + int msg4_TBsize; + /// MCS used for Msg4 + int msg4_mcs; +#ifdef Rel14 + uint8_t rach_resource_type; + uint8_t msg2_mpdcch_repetition_cnt; + uint8_t msg4_mpdcch_repetition_cnt; + uint8_t msg2_narrowband; + uint8_t msg34_narrowband; +#endif +} RA_t; + + +/*! \brief subband bitmap confguration (for ALU icic algo purpose), in test phase */ +typedef struct { + uint8_t sbmap[NUMBER_OF_SUBBANDS_MAX]; //13 = number of SB MAX for 100 PRB + uint8_t periodicity; + uint8_t first_subframe; + uint8_t sb_size; + uint8_t nb_active_sb; +} SBMAP_CONF; +/*! \brief UE list used by eNB to order UEs/CC for scheduling*/ +typedef struct { + /// Dedicated information for UEs + struct PhysicalConfigDedicated + *physicalConfigDedicated[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + /// DLSCH pdu + DLSCH_PDU DLSCH_pdu[MAX_NUM_CCs][2][NUMBER_OF_UE_MAX]; + /// DCI template and MAC connection parameters for UEs + UE_TEMPLATE UE_template[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + /// DCI template and MAC connection for RA processes + int pCC_id[NUMBER_OF_UE_MAX]; + /// sorted downlink component carrier for the scheduler + int ordered_CCids[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + /// number of downlink active component carrier + int numactiveCCs[NUMBER_OF_UE_MAX]; + /// sorted uplink component carrier for the scheduler + int ordered_ULCCids[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + /// number of uplink active component carrier + int numactiveULCCs[NUMBER_OF_UE_MAX]; + /// number of downlink active component carrier + uint8_t dl_CC_bitmap[NUMBER_OF_UE_MAX]; + /// eNB to UE statistics + eNB_UE_STATS eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; + /// scheduling control info + UE_sched_ctrl UE_sched_ctrl[NUMBER_OF_UE_MAX]; + int next[NUMBER_OF_UE_MAX]; + int head; + int next_ul[NUMBER_OF_UE_MAX]; + int head_ul; + int avail; + int num_UEs; + boolean_t active[NUMBER_OF_UE_MAX]; + + /// Sorting criteria for the UE list in the MAC preprocessor + uint16_t sorting_criteria[MAX_NUM_SLICES][CR_NUM]; + +} UE_list_t; + +/*! \brief eNB common channels */ +typedef struct { + int physCellId; + int p_eNB; + int Ncp; + int eutra_band; + uint32_t dl_CarrierFreq; + BCCH_BCH_Message_t *mib; + RadioResourceConfigCommonSIB_t *radioResourceConfigCommon; +#ifdef Rel14 + RadioResourceConfigCommonSIB_t *radioResourceConfigCommon_BR; +#endif + TDD_Config_t *tdd_Config; + SchedulingInfoList_t *schedulingInfoList; + ARFCN_ValueEUTRA_t ul_CarrierFreq; + long ul_Bandwidth; + /// Outgoing MIB PDU for PHY + MIB_PDU MIB_pdu; + /// Outgoing BCCH pdu for PHY + BCCH_PDU BCCH_pdu; + /// Outgoing BCCH DCI allocation + uint32_t BCCH_alloc_pdu; + /// Outgoing CCCH pdu for PHY + CCCH_PDU CCCH_pdu; + /// Outgoing PCCH DCI allocation + uint32_t PCCH_alloc_pdu; + /// Outgoing PCCH pdu for PHY + PCCH_PDU PCCH_pdu; + /// Outgoing RAR pdu for PHY + RAR_PDU RAR_pdu; + /// Template for RA computations + RA_t ra[NB_RA_PROC_MAX]; + /// VRB map for common channels + uint8_t vrb_map[100]; + /// VRB map for common channels and retransmissions by PHICH + uint8_t vrb_map_UL[100]; + /// MBSFN SubframeConfig + struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; + /// number of subframe allocation pattern available for MBSFN sync area + uint8_t num_sf_allocation_pattern; +#if defined(Rel10) || defined(Rel14) + /// MBMS Flag + uint8_t MBMS_flag; + /// Outgoing MCCH pdu for PHY + MCCH_PDU MCCH_pdu; + /// MCCH active flag + uint8_t msi_active; + /// MCCH active flag + uint8_t mcch_active; + /// MTCH active flag + uint8_t mtch_active; + /// number of active MBSFN area + uint8_t num_active_mbsfn_area; + /// MBSFN Area Info + struct MBSFN_AreaInfo_r9 *mbsfn_AreaInfo[MAX_MBSFN_AREA]; + /// PMCH Config + struct PMCH_Config_r9 *pmch_Config[MAX_PMCH_perMBSFN]; + /// MBMS session info list + struct MBMS_SessionInfoList_r9 *mbms_SessionList[MAX_PMCH_perMBSFN]; + /// Outgoing MCH pdu for PHY + MCH_PDU MCH_pdu; +#endif +#ifdef Rel14 + /// Rel13 parameters from SIB1 + SystemInformationBlockType1_v1310_IEs_t *sib1_v13ext; + /// Counter for SIB1-BR scheduling + int SIB1_BR_cnt; + /// Outgoing BCCH-BR pdu for PHY + BCCH_PDU BCCH_BR_pdu[20]; +#endif +} COMMON_channels_t; +/*! \brief top level eNB MAC structure */ +typedef struct eNB_MAC_INST_s { + /// Ethernet parameters for northbound midhaul interface + eth_params_t eth_params_n; + /// Ethernet parameters for fronthaul interface + eth_params_t eth_params_s; + /// + module_id_t Mod_id; + /// frame counter + frame_t frame; + /// subframe counter + sub_frame_t subframe; + /// Pointer to IF module instance for PHY + IF_Module_t *if_inst; + /// Common cell resources + COMMON_channels_t common_channels[MAX_NUM_CCs]; + /// current PDU index (BCH,MCH,DLSCH) + uint16_t pdu_index[MAX_NUM_CCs]; + + /// NFAPI Config Request Structure + nfapi_config_request_t config[MAX_NUM_CCs]; + /// Preallocated DL pdu list + nfapi_dl_config_request_pdu_t + dl_config_pdu_list[MAX_NUM_CCs][MAX_NUM_DL_PDU]; + /// NFAPI DL Config Request Structure + nfapi_dl_config_request_t DL_req[MAX_NUM_CCs]; + /// Preallocated UL pdu list + nfapi_ul_config_request_pdu_t + ul_config_pdu_list[MAX_NUM_CCs][MAX_NUM_UL_PDU]; + /// Preallocated UL pdu list for ULSCH (n+k delay) + nfapi_ul_config_request_pdu_t + ul_config_pdu_list_tmp[MAX_NUM_CCs][10][MAX_NUM_UL_PDU]; + /// NFAPI UL Config Request Structure, send to L1 4 subframes before processing takes place + nfapi_ul_config_request_t UL_req[MAX_NUM_CCs]; + /// NFAPI "Temporary" UL Config Request Structure, holds future UL_config requests + nfapi_ul_config_request_t UL_req_tmp[MAX_NUM_CCs][10]; + /// Preallocated HI_DCI0 pdu list + nfapi_hi_dci0_request_pdu_t + hi_dci0_pdu_list[MAX_NUM_CCs][MAX_NUM_HI_DCI0_PDU]; + /// NFAPI HI/DCI0 Config Request Structure + nfapi_hi_dci0_request_t HI_DCI0_req[MAX_NUM_CCs]; + /// Prealocated TX pdu list + nfapi_tx_request_pdu_t + tx_request_pdu[MAX_NUM_CCs][MAX_NUM_TX_REQUEST_PDU]; + /// NFAPI DL PDU structure + nfapi_tx_request_t TX_req[MAX_NUM_CCs]; + /// UL handle + uint32_t ul_handle; + UE_list_t UE_list; + + ///subband bitmap configuration + SBMAP_CONF sbmap_conf; + /// CCE table used to build DCI scheduling information + int CCE_table[MAX_NUM_CCs][800]; + /// active flag for Other lcid + uint8_t lcid_active[NB_RB_MAX]; + /// eNB stats + eNB_STATS eNB_stats[MAX_NUM_CCs]; + // MAC function execution peformance profiler + /// processing time of eNB scheduler + time_stats_t eNB_scheduler; + /// processing time of eNB scheduler for SI + time_stats_t schedule_si; + /// processing time of eNB scheduler for Random access + time_stats_t schedule_ra; + /// processing time of eNB ULSCH scheduler + time_stats_t schedule_ulsch; + /// processing time of eNB DCI generation + time_stats_t fill_DLSCH_dci; + /// processing time of eNB MAC preprocessor + time_stats_t schedule_dlsch_preprocessor; + /// processing time of eNB DLSCH scheduler + time_stats_t schedule_dlsch; // include rlc_data_req + MAC header + preprocessor + /// processing time of eNB MCH scheduler + time_stats_t schedule_mch; + /// processing time of eNB ULSCH reception + time_stats_t rx_ulsch_sdu; // include rlc_data_ind + /// processing time of eNB PCH scheduler + time_stats_t schedule_pch; +} eNB_MAC_INST; + +/* + * UE part + */ + +typedef enum { + TYPE0, + TYPE1, + TYPE1A, + TYPE2, + TYPE2A, + TYPEUESPEC +} MPDCCH_TYPES_t; + +/*!\brief UE layer 2 status */ +typedef enum { + CONNECTION_OK = 0, + CONNECTION_LOST, + PHY_RESYNCH, + PHY_HO_PRACH +} UE_L2_STATE_t; + +/*!\brief UE scheduling info */ +typedef struct { + /// buffer status for each lcgid + uint8_t BSR[MAX_NUM_LCGID]; // should be more for mesh topology + /// keep the number of bytes in rlc buffer for each lcgid + int32_t BSR_bytes[MAX_NUM_LCGID]; + /// after multiplexing buffer remain for each lcid + int32_t LCID_buffer_remain[MAX_NUM_LCID]; + /// sum of all lcid buffer size + uint16_t All_lcid_buffer_size_lastTTI; + /// buffer status for each lcid + uint8_t LCID_status[MAX_NUM_LCID]; + /// SR pending as defined in 36.321 + uint8_t SR_pending; + /// SR_COUNTER as defined in 36.321 + uint16_t SR_COUNTER; + /// logical channel group ide for each LCID + uint8_t LCGID[MAX_NUM_LCID]; + /// retxBSR-Timer, default value is sf2560 + uint16_t retxBSR_Timer; + /// retxBSR_SF, number of subframe before triggering a regular BSR + uint16_t retxBSR_SF; + /// periodicBSR-Timer, default to infinity + uint16_t periodicBSR_Timer; + /// periodicBSR_SF, number of subframe before triggering a periodic BSR + uint16_t periodicBSR_SF; + /// default value is 0: not configured + uint16_t sr_ProhibitTimer; + /// sr ProhibitTime running + uint8_t sr_ProhibitTimer_Running; + /// default value to n5 + uint16_t maxHARQ_Tx; + /// default value is false + uint16_t ttiBundling; + /// default value is release + struct DRX_Config *drx_config; + /// default value is release + struct MAC_MainConfig__phr_Config *phr_config; + ///timer before triggering a periodic PHR + uint16_t periodicPHR_Timer; + ///timer before triggering a prohibit PHR + uint16_t prohibitPHR_Timer; + ///DL Pathloss change value + uint16_t PathlossChange; + ///number of subframe before triggering a periodic PHR + int16_t periodicPHR_SF; + ///number of subframe before triggering a prohibit PHR + int16_t prohibitPHR_SF; + ///DL Pathloss Change in db + uint16_t PathlossChange_db; + + /// default value is false + uint16_t extendedBSR_Sizes_r10; + /// default value is false + uint16_t extendedPHR_r10; + + //Bj bucket usage per lcid + int16_t Bj[MAX_NUM_LCID]; + // Bucket size per lcid + int16_t bucket_size[MAX_NUM_LCID]; +} UE_SCHEDULING_INFO; +/*!\brief Top level UE MAC structure */ +typedef struct { + uint16_t Node_id; + /// RX frame counter + frame_t rxFrame; + /// RX subframe counter + sub_frame_t rxSubframe; + /// TX frame counter + frame_t txFrame; + /// TX subframe counter + sub_frame_t txSubframe; + /// C-RNTI of UE + uint16_t crnti; + /// C-RNTI of UE before HO + rnti_t crnti_before_ho; ///user id (rnti) of connected UEs + /// uplink active flag + uint8_t ul_active; + /// pointer to RRC PHY configuration + RadioResourceConfigCommonSIB_t *radioResourceConfigCommon; + /// pointer to RACH_ConfigDedicated (NULL when not active, i.e. upon HO completion or T304 expiry) + struct RACH_ConfigDedicated *rach_ConfigDedicated; + /// pointer to RRC PHY configuration + struct PhysicalConfigDedicated *physicalConfigDedicated; +#if defined(Rel10) || defined(Rel14) + /// pointer to RRC PHY configuration SCEll + struct PhysicalConfigDedicatedSCell_r10 + *physicalConfigDedicatedSCell_r10; +#endif + /// pointer to TDD Configuration (NULL for FDD) + TDD_Config_t *tdd_Config; + /// Number of adjacent cells to measure + uint8_t n_adj_cells; + /// Array of adjacent physical cell ids + uint32_t adj_cell_id[6]; + /// Pointer to RRC MAC configuration + MAC_MainConfig_t *macConfig; + /// Pointer to RRC Measurement gap configuration + MeasGapConfig_t *measGapConfig; + /// Pointers to LogicalChannelConfig indexed by LogicalChannelIdentity. Note NULL means LCHAN is inactive. + LogicalChannelConfig_t *logicalChannelConfig[MAX_NUM_LCID]; + /// Scheduling Information + UE_SCHEDULING_INFO scheduling_info; + /// Outgoing CCCH pdu for PHY + CCCH_PDU CCCH_pdu; + /// Outgoing RAR pdu for PHY + RAR_PDU RAR_pdu; + /// Incoming DLSCH pdu for PHY + DLSCH_PDU DLSCH_pdu[NUMBER_OF_UE_MAX][2]; + /// number of attempt for rach + uint8_t RA_attempt_number; + /// Random-access procedure flag + uint8_t RA_active; + /// Random-access window counter + int8_t RA_window_cnt; + /// Random-access Msg3 size in bytes + uint8_t RA_Msg3_size; + /// Random-access prachMaskIndex + uint8_t RA_prachMaskIndex; + /// Flag indicating Preamble set (A,B) used for first Msg3 transmission + uint8_t RA_usedGroupA; + /// Random-access Resources + PRACH_RESOURCES_t RA_prach_resources; + /// Random-access PREAMBLE_TRANSMISSION_COUNTER + uint8_t RA_PREAMBLE_TRANSMISSION_COUNTER; + /// Random-access backoff counter + int16_t RA_backoff_cnt; + /// Random-access variable for window calculation (frame of last change in window counter) + uint32_t RA_tx_frame; + /// Random-access variable for window calculation (subframe of last change in window counter) + uint8_t RA_tx_subframe; + /// Random-access Group B maximum path-loss + /// Random-access variable for backoff (frame of last change in backoff counter) + uint32_t RA_backoff_frame; + /// Random-access variable for backoff (subframe of last change in backoff counter) + uint8_t RA_backoff_subframe; + /// Random-access Group B maximum path-loss + uint16_t RA_maxPL; + /// Random-access Contention Resolution Timer active flag + uint8_t RA_contention_resolution_timer_active; + /// Random-access Contention Resolution Timer count value + uint8_t RA_contention_resolution_cnt; + /// power headroom reporitng reconfigured + uint8_t PHR_reconfigured; + /// power headroom state as configured by the higher layers + uint8_t PHR_state; + /// power backoff due to power management (as allowed by P-MPRc) for this cell + uint8_t PHR_reporting_active; + /// power backoff due to power management (as allowed by P-MPRc) for this cell + uint8_t power_backoff_db[NUMBER_OF_eNB_MAX]; + /// BSR report falg management + uint8_t BSR_reporting_active; + /// retxBSR-Timer expires flag + uint8_t retxBSRTimer_expires_flag; + /// periodBSR-Timer expires flag + uint8_t periodBSRTimer_expires_flag; + + /// MBSFN_Subframe Configuration + struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; // FIXME replace 8 by MAX_MBSFN_AREA? + /// number of subframe allocation pattern available for MBSFN sync area + uint8_t num_sf_allocation_pattern; +#if defined(Rel10) || defined(Rel14) + /// number of active MBSFN area + uint8_t num_active_mbsfn_area; + /// MBSFN Area Info + struct MBSFN_AreaInfo_r9 *mbsfn_AreaInfo[MAX_MBSFN_AREA]; + /// PMCH Config + struct PMCH_Config_r9 *pmch_Config[MAX_PMCH_perMBSFN]; + /// MCCH status + uint8_t mcch_status; + /// MSI status + uint8_t msi_status; // could be an array if there are >1 MCH in one MBSFN area +#endif + //#ifdef CBA + /// CBA RNTI for each group + uint16_t cba_rnti[NUM_MAX_CBA_GROUP]; + /// last SFN for CBA channel access + uint8_t cba_last_access[NUM_MAX_CBA_GROUP]; + //#endif + /// total UE scheduler processing time + time_stats_t ue_scheduler; // total + /// UE ULSCH tx processing time inlcuding RLC interface (rlc_data_req) and mac header generation + time_stats_t tx_ulsch_sdu; + /// UE DLSCH rx processing time inlcuding RLC interface (mac_rrc_data_ind or mac_rlc_status_ind+mac_rlc_data_ind) and mac header parser + time_stats_t rx_dlsch_sdu; + /// UE query for MCH subframe processing time + time_stats_t ue_query_mch; + /// UE MCH rx processing time + time_stats_t rx_mch_sdu; + /// UE BCCH rx processing time including RLC interface (mac_rrc_data_ind) + time_stats_t rx_si; + /// UE PCCH rx processing time including RLC interface (mac_rrc_data_ind) + time_stats_t rx_p; +} UE_MAC_INST; +/*! \brief ID of the neighboring cells used for HO*/ +typedef struct { + uint16_t cell_ids[6]; + uint8_t n_adj_cells; +} neigh_cell_id_t; + +#include "proto.h" +/*@}*/ +#endif /*__LAYER2_MAC_DEFS_H__ */ diff --git a/openair2/LAYER2/NR_MAC_UE/extern.h b/openair2/LAYER2/NR_MAC_UE/extern.h new file mode 100644 index 0000000000..e7489ca8e6 --- /dev/null +++ b/openair2/LAYER2/NR_MAC_UE/extern.h @@ -0,0 +1,100 @@ +/* + * 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 + */ + +/*! \file extern.h +* \brief mac externs +* \author Navid Nikaein and Raymond Knopp +* \date 2010 - 2014 +* \version 1.0 +* \email navid.nikaein@eurecom.fr +* @ingroup _mac + +*/ + +#ifndef __MAC_EXTERN_H__ +#define __MAC_EXTERN_H__ + +#include "PHY/defs.h" +#include "defs.h" + +#include "RRC/LITE/defs.h" + +extern const uint32_t BSR_TABLE[BSR_TABLE_SIZE]; +//extern uint32_t EBSR_Level[63]; +extern const uint32_t Extended_BSR_TABLE[BSR_TABLE_SIZE]; +//extern uint32_t Extended_BSR_TABLE[63]; ----currently not used + +extern const uint8_t cqi2fmt0_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE]; + +extern const uint8_t cqi2fmt1x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE]; + +extern const uint8_t cqi2fmt2x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE]; + +extern UE_RRC_INST *UE_rrc_inst; +extern UE_MAC_INST *UE_mac_inst; + + +extern eNB_ULSCH_INFO eNB_ulsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][NUMBER_OF_UE_MAX]; // eNBxUE = 8x8 +extern eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][NUMBER_OF_UE_MAX]; // eNBxUE = 8x8 + + + + +#ifndef PHYSIM +#define NB_INST 1 +#else +extern unsigned char NB_INST; +#endif +extern unsigned char NB_eNB_INST; +extern unsigned char NB_UE_INST; +extern unsigned char NB_RN_INST; +extern unsigned short NODE_ID[1]; + + +extern int cqi_to_mcs[16]; + +extern uint32_t RRC_CONNECTION_FLAG; + +extern uint8_t rb_table[34]; + +extern DCI0_5MHz_TDD_1_6_t UL_alloc_pdu; + +extern DCI1A_5MHz_TDD_1_6_t RA_alloc_pdu; +extern DCI1A_5MHz_TDD_1_6_t DLSCH_alloc_pdu1A; +extern DCI1A_5MHz_TDD_1_6_t BCCH_alloc_pdu; + +extern DCI1A_5MHz_TDD_1_6_t CCCH_alloc_pdu; +extern DCI1_5MHz_TDD_t DLSCH_alloc_pdu; + +extern DCI0_5MHz_FDD_t UL_alloc_pdu_fdd; + +extern DCI1A_5MHz_FDD_t DLSCH_alloc_pdu1A_fdd; +extern DCI1A_5MHz_FDD_t RA_alloc_pdu_fdd; +extern DCI1A_5MHz_FDD_t BCCH_alloc_pdu_fdd; + +extern DCI1A_5MHz_FDD_t CCCH_alloc_pdu_fdd; +extern DCI1_5MHz_FDD_t DLSCH_alloc_pdu_fdd; + +extern DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu1; +extern DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu2; +extern DCI1E_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu1E; + +#endif //DEF_H diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c new file mode 100644 index 0000000000..d682cf5870 --- /dev/null +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -0,0 +1,49 @@ +/* + * 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 + */ + +/*! \file main.c + * \brief top init of Layer 2 + * \author Navid Nikaein and Raymond Knopp + * \date 2010 - 2014 + * \version 1.0 + * \email: navid.nikaein@eurecom.fr + * @ingroup _mac + + */ + +#include "defs.h" +#include "proto.h" +#include "extern.h" +#include "assertions.h" + + +int +nr_l2_init_ue(void) +{ + LOG_I(MAC, "[MAIN] MAC_INIT_GLOBAL_PARAM IN...\n"); + + LOG_I(MAC, "[MAIN] init UE MAC functions \n"); + + //init mac here + + return (1); +} + diff --git a/openair2/LAYER2/NR_MAC_UE/proto.h b/openair2/LAYER2/NR_MAC_UE/proto.h new file mode 100644 index 0000000000..2586c94f43 --- /dev/null +++ b/openair2/LAYER2/NR_MAC_UE/proto.h @@ -0,0 +1,1193 @@ +/* + * 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 + */ + +/*! \file LAYER2/MAC/proto.h + * \brief MAC functions prototypes for eNB and UE + * \author Navid Nikaein and Raymond Knopp + * \date 2010 - 2014 + * \email navid.nikaein@eurecom.fr + * \version 1.0 + */ +#ifndef __LAYER2_MAC_PROTO_H__ +#define __LAYER2_MAC_PROTO_H__ + +#include "LAYER2/MAC/defs.h" + +/** \addtogroup _mac + * @{ + */ + +/** + * slice specific scheduler + */ +typedef void (*slice_scheduler_dl)(module_id_t mod_id, + slice_id_t slice_id, + frame_t frame, + sub_frame_t subframe, + int *mbsfn_flag); + +typedef void (*slice_scheduler_ul)(module_id_t mod_id, + slice_id_t slice_id, + frame_t frame, + sub_frame_t subframe, + unsigned char sched_subframe, + uint16_t *first_rb); + +/** \fn void schedule_mib(module_id_t module_idP,frame_t frameP,sub_frame_t subframe); +\brief MIB scheduling for PBCH. This function requests the MIB from RRC and provides it to L1. +@param Mod_id Instance ID of eNB +@param frame Frame index +@param subframe Subframe number on which to act + +*/ + +void schedule_mib(module_id_t module_idP, + frame_t frameP, sub_frame_t subframeP); + +/** \fn void schedule_RA(module_id_t module_idP,frame_t frameP,sub_frame_t subframe); +\brief First stage of Random-Access Scheduling. Loops over the ras and checks if RAR, Msg3 or its retransmission are to be scheduled in the subframe. It returns the total number of PRB used for RA SDUs. For Msg3 it retrieves the L3msg from RRC and fills the appropriate buffers. For the others it just computes the number of PRBs. Each DCI uses 3 PRBs (format 1A) +for the message. +@param Mod_id Instance ID of eNB +@param frame Frame index +@param subframe Subframe number on which to act +*/ + + +void schedule_RA(module_id_t module_idP, frame_t frameP, + sub_frame_t subframe); + +/** \brief First stage of SI Scheduling. Gets a SI SDU from RRC if available and computes the MCS required to transport it as a function of the SDU length. It assumes a length less than or equal to 64 bytes (MCS 6, 3 PRBs). +@param Mod_id Instance ID of eNB +@param frame Frame index +@param subframe Subframe number on which to act +*/ +void schedule_SI(module_id_t module_idP, frame_t frameP, + sub_frame_t subframeP); + +/** \brief MBMS scheduling: Checking the position for MBSFN subframes. Create MSI, transfer MCCH from RRC to MAC, transfer MTCHs from RLC to MAC. Multiplexing MSI,MCCH&MTCHs. Return 1 if there are MBSFN data being allocated, otherwise return 0; +@param Mod_id Instance ID of eNB +@param frame Frame index +@param subframe Subframe number on which to act +*/ +int schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP, + sub_frame_t subframe); + +/** \brief check the mapping between sf allocation and sync area, Currently only supports 1:1 mapping +@param Mod_id Instance ID of eNB +@param mbsfn_sync_area index of mbsfn sync area +@param[out] index of sf pattern +*/ +int8_t get_mbsfn_sf_alloction(module_id_t module_idP, uint8_t CC_id, + uint8_t mbsfn_sync_area); + +/** \brief check the mapping between sf allocation and sync area, Currently only supports 1:1 mapping +@param Mod_id Instance ID of eNB +@param mbsfn_sync_area index of mbsfn sync area +@param eNB_index index of eNB +@param[out] index of sf pattern +*/ +int8_t ue_get_mbsfn_sf_alloction(module_id_t module_idP, + uint8_t mbsfn_sync_area, + unsigned char eNB_index); + +/** \brief top ULSCH Scheduling for TDD (config 1-6). +@param Mod_id Instance ID of eNB +@param frame Frame index +@param subframe Subframe number on which to act +*/ +void schedule_ulsch(module_id_t module_idP, frame_t frameP, + sub_frame_t subframe); + +/** \brief ULSCH Scheduling per RNTI +@param Mod_id Instance ID of eNB +@param slice_id Instance slice for this eNB +@param frame Frame index +@param subframe Subframe number on which to act +@param sched_subframe Subframe number where PUSCH is transmitted (for DAI lookup) +*/ +void schedule_ulsch_rnti(module_id_t module_idP, slice_id_t slice_idP, frame_t frameP, + sub_frame_t subframe, + unsigned char sched_subframe, + uint16_t * first_rb); + +/** \brief Second stage of DLSCH scheduling, after schedule_SI, schedule_RA and schedule_dlsch have been called. This routine first allocates random frequency assignments for SI and RA SDUs using distributed VRB allocations and adds the corresponding DCI SDU to the DCI buffer for PHY. It then loops over the UE specific DCIs previously allocated and fills in the remaining DCI fields related to frequency allocation. It assumes localized allocation of type 0 (DCI.rah=0). The allocation is done for tranmission modes 1,2,4. +@param Mod_id Instance of eNB +@param frame Frame index +@param subframe Index of subframe +@param mbsfn_flag Indicates that this subframe is for MCH/MCCH +*/ +void fill_DLSCH_dci(module_id_t module_idP, frame_t frameP, + sub_frame_t subframe, int *mbsfn_flag); + +/** \brief UE specific DLSCH scheduling. Retrieves next ue to be schduled from round-robin scheduler and gets the appropriate harq_pid for the subframe from PHY. If the process is active and requires a retransmission, it schedules the retransmission with the same PRB count and MCS as the first transmission. Otherwise it consults RLC for DCCH/DTCH SDUs (status with maximum number of available PRBS), builds the MAC header (timing advance sent by default) and copies +@param Mod_id Instance ID of eNB +@param frame Frame index +@param subframe Subframe on which to act + +@param mbsfn_flag Indicates that MCH/MCCH is in this subframe +*/ +void schedule_dlsch(module_id_t module_idP, frame_t frameP, + sub_frame_t subframe, int *mbsfn_flag); + +void schedule_ue_spec(module_id_t module_idP, slice_id_t slice_idP, + frame_t frameP,sub_frame_t subframe, int *mbsfn_flag); + + +/** \brief Function for UE/PHY to compute PUSCH transmit power in power-control procedure. + @param Mod_id Module id of UE + @returns Po_NOMINAL_PUSCH (PREAMBLE_RECEIVED_TARGET_POWER+DELTA_PREAMBLE +*/ +int8_t get_Po_NOMINAL_PUSCH(module_id_t module_idP, uint8_t CC_id); + +/** \brief Function to compute DELTA_PREAMBLE from 36.321 (for RA power ramping procedure and Msg3 PUSCH power control policy) + @param Mod_id Module id of UE + @returns DELTA_PREAMBLE +*/ +int8_t get_DELTA_PREAMBLE(module_id_t module_idP, int CC_id); + +/** \brief Function for compute deltaP_rampup from 36.321 (for RA power ramping procedure and Msg3 PUSCH power control policy) + @param Mod_id Module id of UE + @param CC_id carrier component id of UE + @returns deltaP_rampup +*/ +int8_t get_deltaP_rampup(module_id_t module_idP, uint8_t CC_id); + +uint16_t mac_computeRIV(uint16_t N_RB_DL, uint16_t RBstart, + uint16_t Lcrbs); + +void add_msg3(module_id_t module_idP, int CC_id, RA_t * ra, frame_t frameP, + sub_frame_t subframeP); + +//main.c + +int mac_top_init(int eMBMS_active, char *uecap_xer, + uint8_t cba_group_active, uint8_t HO_active); + +void mac_top_init_eNB(void); + +void mac_init_cell_params(int Mod_idP, int CC_idP); + +char layer2_init_UE(module_id_t module_idP); + +char layer2_init_eNB(module_id_t module_idP, uint8_t Free_ch_index); + +void mac_switch_node_function(module_id_t module_idP); + +int mac_init_global_param(void); + +void mac_top_cleanup(void); + +void mac_UE_out_of_sync_ind(module_id_t module_idP, frame_t frameP, + uint16_t eNB_index); + +void clear_nfapi_information(eNB_MAC_INST * eNB, int CC_idP, + frame_t frameP, sub_frame_t subframeP); + +void dlsch_scheduler_pre_processor_reset(int module_idP, int UE_id, + uint8_t CC_id, + int frameP, + int subframeP, + int N_RBG, + uint16_t + nb_rbs_required[MAX_NUM_CCs] + [NUMBER_OF_UE_MAX], + unsigned char + rballoc_sub[MAX_NUM_CCs] + [N_RBG_MAX], + unsigned char + MIMO_mode_indicator[MAX_NUM_CCs] + [N_RBG_MAX]); + +// eNB functions +/* \brief This function assigns pre-available RBS to each UE in specified sub-bands before scheduling is done +@param Mod_id Instance ID of eNB +@param frame Index of frame +@param subframe Index of current subframe +@param N_RBS Number of resource block groups + */ + + +void dlsch_scheduler_pre_processor(module_id_t module_idP, + slice_id_t slice_idP, + frame_t frameP, + sub_frame_t subframe, + int N_RBG[MAX_NUM_CCs], + int *mbsfn_flag); + + +void dlsch_scheduler_pre_processor_allocate(module_id_t Mod_id, + int UE_id, + uint8_t CC_id, + int N_RBG, + int transmission_mode, + int min_rb_unit, + uint8_t N_RB_DL, + uint16_t + nb_rbs_required[MAX_NUM_CCs] + [NUMBER_OF_UE_MAX], + uint16_t + nb_rbs_required_remaining + [MAX_NUM_CCs] + [NUMBER_OF_UE_MAX], + unsigned char + rballoc_sub[MAX_NUM_CCs] + [N_RBG_MAX], + unsigned char + MIMO_mode_indicator + [MAX_NUM_CCs][N_RBG_MAX]); + +/* \brief Function to trigger the eNB scheduling procedure. It is called by PHY at the beginning of each subframe, \f$n$\f + and generates all DLSCH allocations for subframe \f$n\f$ and ULSCH allocations for subframe \f$n+k$\f. +@param Mod_id Instance ID of eNB +@param subframe Index of current subframe +@param calibration_flag Flag to indicate that eNB scheduler should schedule TDD auto-calibration PUSCH. +*/ +void eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP); //, int calibration_flag); + +/* \brief Function to indicate a received preamble on PRACH. It initiates the RA procedure. +@param Mod_id Instance ID of eNB +@param preamble_index index of the received RA request +@param timing_offset Offset in samples of the received PRACH w.r.t. eNB timing. This is used to +@param rnti RA rnti corresponding to this PRACH preamble +@param rach_resource type (0=non BL/CE,1 CE level 0,2 CE level 1, 3 CE level 2,4 CE level 3) +*/ +void initiate_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, + sub_frame_t subframeP, uint16_t preamble_index, + int16_t timing_offset, uint16_t rnti +#ifdef Rel14 + , uint8_t rach_resource_type +#endif + ); + +/* \brief Function in eNB to fill RAR pdu when requested by PHY. This provides a single RAR SDU for the moment and returns the t-CRNTI. +@param Mod_id Instance ID of eNB +@param dlsch_buffer Pointer to DLSCH input buffer +@param N_RB_UL Number of UL resource blocks +@returns t_CRNTI +*/ +unsigned short fill_rar(const module_id_t module_idP, + const int CC_id, + RA_t *ra, + const frame_t frameP, + uint8_t * const dlsch_buffer, + const uint16_t N_RB_UL, + const uint8_t input_buffer_length); + +#ifdef Rel14 +unsigned short fill_rar_br(eNB_MAC_INST * eNB, + int CC_id, + RA_t * ra, + const frame_t frameP, + const sub_frame_t subframeP, + uint8_t * const dlsch_buffer, + const uint8_t ce_level); +#endif + +/* \brief Function to indicate a failed RA response. It removes all temporary variables related to the initial connection of a UE +@param Mod_id Instance ID of eNB +@param preamble_index index of the received RA request. +*/ +void cancel_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, + uint16_t preamble_index); + +/* \brief Function used by PHY to inform MAC that an uplink is scheduled + for Msg3 in given subframe. This is used so that the MAC + scheduler marks as busy the RBs used by the Msg3. +@param Mod_id Instance ID of eNB +@param CC_id CC ID of eNB +@param frame current frame +@param subframe current subframe +@param rnti UE rnti concerned +@param Msg3_frame frame where scheduling takes place +@param Msg3_subframe subframe where scheduling takes place +*/ +void set_msg3_subframe(module_id_t Mod_id, + int CC_id, + int frame, + int subframe, + int rnti, int Msg3_frame, int Msg3_subframe); + +/* \brief Function to indicate a received SDU on ULSCH. +@param Mod_id Instance ID of eNB +@param CC_id Component carrier index +@param rnti RNTI of UE transmitting the SDU +@param sdu Pointer to received SDU +@param sdu_len Length of SDU +@param timing_advance timing advance adjustment after this pdu +@param ul_cqi Uplink CQI estimate after this pdu (SNR quantized to 8 bits, -64 ... 63.5 dB in .5dB steps) +*/ +void rx_sdu(const module_id_t enb_mod_idP, + const int CC_idP, + const frame_t frameP, + const sub_frame_t subframeP, + const rnti_t rntiP, + uint8_t * sduP, + const uint16_t sdu_lenP, + const uint16_t timing_advance, const uint8_t ul_cqi); + + +/* \brief Function to indicate a scheduled schduling request (SR) was received by eNB. +@param Mod_idP Instance ID of eNB +@param CC_idP CC_id of received SR +@param frameP of received SR +@param subframeP Index of subframe where SR was received +@param rnti RNTI of UE transmitting the SR +@param ul_cqi SNR measurement of PUCCH (SNR quantized to 8 bits, -64 ... 63.5 dB in .5dB steps) +*/ +void SR_indication(module_id_t module_idP, int CC_id, frame_t frameP, + sub_frame_t subframe, rnti_t rnti, uint8_t ul_cqi); + +/* \brief Function to indicate a UL failure was detected by eNB PHY. +@param Mod_id Instance ID of eNB +@param CC_id Component carrier +@param frameP Frame index +@param rnti RNTI of UE transmitting the SR +@param subframe Index of subframe where SR was received +*/ +void UL_failure_indication(module_id_t Mod_id, int CC_id, frame_t frameP, + rnti_t rnti, sub_frame_t subframe); + +/* \brief Function to indicate an HARQ ACK/NAK. +@param Mod_id Instance ID of eNB +@param CC_id Component carrier +@param frameP Frame index +@param subframeP subframe index +@param harq_pdu NFAPI HARQ PDU descriptor +*/ +void harq_indication(module_id_t mod_idP, int CC_idP, frame_t frameP, + sub_frame_t subframeP, + nfapi_harq_indication_pdu_t * harq_pdu); + +/* \brief Function to indicate a received CQI pdu +@param Mod_id Instance ID of eNB +@param CC_id Component carrier +@param frameP Frame index +@param subframeP subframe index +@param rntiP RNTI of incoming CQI information +@param ul_cqi_information NFAPI UL CQI measurement +*/ +void cqi_indication(module_id_t mod_idP, int CC_idP, frame_t frameP, + sub_frame_t subframeP, rnti_t rntiP, + nfapi_cqi_indication_rel9_t * rel9, uint8_t * pdu, + nfapi_ul_cqi_information_t * ul_cqi_information); + +uint8_t *get_dlsch_sdu(module_id_t module_idP, int CC_id, frame_t frameP, + rnti_t rnti, uint8_t TBindex); + +/* \brief Function to retrieve MCH transport block and MCS used for MCH in this MBSFN subframe. Returns null if no MCH is to be transmitted +@param Mod_id Instance ID of eNB +@param frame Index of frame +@param subframe Index of current subframe +@param mcs Pointer to mcs used by PHY (to be filled by MAC) +@returns Pointer to MCH transport block and mcs for subframe +*/ +MCH_PDU *get_mch_sdu(module_id_t Mod_id, int CC_id, frame_t frame, + sub_frame_t subframe); + + + + + +void ue_mac_reset(module_id_t module_idP, uint8_t eNB_index); +void ue_init_mac(module_id_t module_idP); +void init_ue_sched_info(void); +void add_ue_ulsch_info(module_id_t module_idP, int CC_id, int UE_id, + sub_frame_t subframe, UE_ULSCH_STATUS status); +void add_ue_dlsch_info(module_id_t module_idP, int CC_id, int UE_id, + sub_frame_t subframe, UE_DLSCH_STATUS status); +int find_UE_id(module_id_t module_idP, rnti_t rnti); +int find_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP); +rnti_t UE_RNTI(module_id_t module_idP, int UE_id); +int UE_PCCID(module_id_t module_idP, int UE_id); +uint8_t find_active_UEs(module_id_t module_idP); +boolean_t is_UE_active(module_id_t module_idP, int UE_id); +uint8_t get_aggregation(uint8_t bw_index, uint8_t cqi, uint8_t dci_fmt); + +int8_t find_active_UEs_with_traffic(module_id_t module_idP); + +void init_CCE_table(int module_idP, int CC_idP); + +int get_nCCE_offset(int *CCE_table, + const unsigned char L, + const int nCCE, + const int common_dci, + const unsigned short rnti, + const unsigned char subframe); + +int allocate_CCEs(int module_idP, int CC_idP, int subframe, int test_only); + +boolean_t CCE_allocation_infeasible(int module_idP, + int CC_idP, + int common_flag, + int subframe, + int aggregation, int rnti); + +void set_ue_dai(sub_frame_t subframeP, + int UE_id, + uint8_t CC_id, uint8_t tdd_config, UE_list_t * UE_list); + +/** \brief First stage of PCH Scheduling. Gets a PCH SDU from RRC if available and computes the MCS required to transport it as a function of the SDU length. It assumes a length less than or equal to 64 bytes (MCS 6, 3 PRBs). +@param Mod_id Instance ID of eNB +@param frame Frame index +@param subframe Subframe number on which to act +@param paging_ue_index +*/ +void schedule_PCH(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP); + +uint8_t find_num_active_UEs_in_cbagroup(module_id_t module_idP, + unsigned char group_id); +uint8_t UE_is_to_be_scheduled(module_id_t module_idP, int CC_id, + uint8_t UE_id); +/** \brief Round-robin scheduler for ULSCH traffic. +@param Mod_id Instance ID for eNB +@param subframe Subframe number on which to act +@returns UE index that is to be scheduled if needed/room +*/ +module_id_t schedule_next_ulue(module_id_t module_idP, int UE_id, + sub_frame_t subframe); + +/** \brief Round-robin scheduler for DLSCH traffic. +@param Mod_id Instance ID for eNB +@param subframe Subframe number on which to act +@returns UE index that is to be scheduled if needed/room +*/ +int schedule_next_dlue(module_id_t module_idP, int CC_id, + sub_frame_t subframe); + +/* \brief Allocates a set of PRBS for a particular UE. This is a simple function for the moment, later it should process frequency-domain CQI information and/or PMI information. Currently it just returns the first PRBS that are available in the subframe based on the number requested. +@param UE_id Index of UE on which to act +@param nb_rb Number of PRBs allocated to UE by scheduler +@param N_RB_DL Number of PRBs on DL +@param rballoc Pointer to bit-map of current PRB allocation given to previous users/control channels. This is updated for subsequent calls to the routine. +@returns an rballoc bitmap for resource type 0 allocation (DCI). +*/ +uint32_t allocate_prbs(int UE_id, uint8_t nb_rb, int N_RB_DL, + uint32_t * rballoc); + +/* \fn uint32_t req_new_ulsch(module_id_t module_idP) +\brief check for a new transmission in any drb +@param Mod_id Instance id of UE in machine +@returns 1 for new transmission, 0 for none +*/ +uint32_t req_new_ulsch(module_id_t module_idP); + +/* \brief Get SR payload (0,1) from UE MAC +@param Mod_id Instance id of UE in machine +@param CC_id Component Carrier index +@param eNB_id Index of eNB that UE is attached to +@param rnti C_RNTI of UE +@param subframe subframe number +@returns 0 for no SR, 1 for SR +*/ +uint32_t ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, + uint8_t eNB_id, rnti_t rnti, sub_frame_t subframe); + +uint8_t get_ue_weight(module_id_t module_idP, int CC_id, int UE_id); + +// UE functions +void mac_out_of_sync_ind(module_id_t module_idP, frame_t frameP, + uint16_t CH_index); + +void ue_decode_si(module_id_t module_idP, int CC_id, frame_t frame, + uint8_t CH_index, void *pdu, uint16_t len); + +void ue_decode_p(module_id_t module_idP, int CC_id, frame_t frame, + uint8_t CH_index, void *pdu, uint16_t len); + + +void ue_send_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frame, + sub_frame_t subframe, uint8_t * sdu, uint16_t sdu_len, + uint8_t CH_index); + + +#if defined(Rel10) || defined(Rel14) +/* \brief Called by PHY to transfer MCH transport block to ue MAC. +@param Mod_id Index of module instance +@param frame Frame index +@param sdu Pointer to transport block +@param sdu_len Length of transport block +@param eNB_index Index of attached eNB +@param sync_area the index of MBSFN sync area +*/ +void ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP, + uint8_t * sdu, uint16_t sdu_len, uint8_t eNB_index, + uint8_t sync_area); + +/*\brief Function to check if UE PHY needs to decode MCH for MAC. +@param Mod_id Index of protocol instance +@param frame Index of frame +@param subframe Index of subframe +@param eNB_index index of eNB for this MCH +@param[out] sync_area return the sync area +@param[out] mcch_active flag indicating whether this MCCH is active in this SF +*/ +int ue_query_mch(uint8_t Mod_id, uint8_t CC_id, uint32_t frame, + sub_frame_t subframe, uint8_t eNB_index, + uint8_t * sync_area, uint8_t * mcch_active); + +#endif + +/* \brief Called by PHY to get sdu for PUSCH transmission. It performs the following operations: Checks BSR for DCCH, DCCH1 and DTCH corresponding to previous values computed either in SR or BSR procedures. It gets rlc status indications on DCCH,DCCH1 and DTCH and forms BSR elements and PHR in MAC header. CRNTI element is not supported yet. It computes transport block for up to 3 SDUs and generates header and forms the complete MAC SDU. +@param Mod_id Instance id of UE in machine +@param eNB_id Index of eNB that UE is attached to +@param rnti C_RNTI of UE +@param subframe subframe number +@returns 0 for no SR, 1 for SR +*/ +void ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, + sub_frame_t subframe, uint8_t eNB_index, + uint8_t * ulsch_buffer, uint16_t buflen, + uint8_t * access_mode); + +/* \brief Function called by PHY to retrieve information to be transmitted using the RA procedure. If the UE is not in PUSCH mode for a particular eNB index, this is assumed to be an Msg3 and MAC attempts to retrieves the CCCH message from RRC. If the UE is in PUSCH mode for a particular eNB index and PUCCH format 0 (Scheduling Request) is not activated, the MAC may use this resource for random-access to transmit a BSR along with the C-RNTI control element (see 5.1.4 from 36.321) +@param Mod_id Index of UE instance +@param Mod_id Component Carrier Index +@param New_Msg3 Flag to indicate this call is for a new Msg3 +@param subframe Index of subframe for PRACH transmission (0 ... 9) +@returns A pointer to a PRACH_RESOURCES_t */ +PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id, + frame_t frameP, uint8_t new_Msg3, + sub_frame_t subframe); + +/* \brief Function called by PHY to process the received RAR. It checks that the preamble matches what was sent by the eNB and provides the timing advance and t-CRNTI. +@param Mod_id Index of UE instance +@param CC_id Index to a component carrier +@param frame Frame index +@param ra_rnti RA_RNTI value +@param dlsch_buffer Pointer to dlsch_buffer containing RAR PDU +@param t_crnti Pointer to PHY variable containing the T_CRNTI +@param preamble_index Preamble Index used by PHY to transmit the PRACH. This should match the received RAR to trigger the rest of +random-access procedure +@param selected_rar_buffer the output buffer for storing the selected RAR header and RAR payload +@returns timing advance or 0xffff if preamble doesn't match +*/ +uint16_t +ue_process_rar(const module_id_t module_idP, + const int CC_id, + const frame_t frameP, + const rnti_t ra_rnti, + uint8_t * const dlsch_buffer, + rnti_t * const t_crnti, + const uint8_t preamble_index, + uint8_t * selected_rar_buffer); + + +/* \brief Generate header for UL-SCH. This function parses the desired control elements and sdus and generates the header as described +in 36-321 MAC layer specifications. It returns the number of bytes used for the header to be used as an offset for the payload +in the ULSCH buffer. +@param mac_header Pointer to the first byte of the MAC header (UL-SCH buffer) +@param num_sdus Number of SDUs in the payload +@param short_padding Number of bytes for short padding (0,1,2) +@param sdu_lengths Pointer to array of SDU lengths +@param sdu_lcids Pointer to array of LCIDs (the order must be the same as the SDU length array) +@param power_headroom Pointer to power headroom command (NULL means not present in payload) +@param crnti Pointer to CRNTI command (NULL means not present in payload) +@param truncated_bsr Pointer to Truncated BSR command (NULL means not present in payload) +@param short_bsr Pointer to Short BSR command (NULL means not present in payload) +@param long_bsr Pointer to Long BSR command (NULL means not present in payload) +@param post_padding Number of bytes for padding at the end of MAC PDU +@returns Number of bytes used for header +*/ +unsigned char generate_ulsch_header(uint8_t * mac_header, + uint8_t num_sdus, + uint8_t short_padding, + uint16_t * sdu_lengths, + uint8_t * sdu_lcids, + POWER_HEADROOM_CMD * power_headroom, + uint16_t * crnti, + BSR_SHORT * truncated_bsr, + BSR_SHORT * short_bsr, + BSR_LONG * long_bsr, + unsigned short post_padding); + +/* \brief Parse header for UL-SCH. This function parses the received UL-SCH header as described +in 36-321 MAC layer specifications. It returns the number of bytes used for the header to be used as an offset for the payload +in the ULSCH buffer. +@param mac_header Pointer to the first byte of the MAC header (UL-SCH buffer) +@param num_ces Number of SDUs in the payload +@param num_sdu Number of SDUs in the payload +@param rx_ces Pointer to received CEs in the header +@param rx_lcids Pointer to array of LCIDs (the order must be the same as the SDU length array) +@param rx_lengths Pointer to array of SDU lengths +@returns Pointer to payload following header +*/ +uint8_t *parse_ulsch_header(uint8_t * mac_header, + uint8_t * num_ce, + uint8_t * num_sdu, + uint8_t * rx_ces, + uint8_t * rx_lcids, + uint16_t * rx_lengths, uint16_t tx_lenght); + +int to_prb(int); +int to_rbg(int); +int l2_init(LTE_DL_FRAME_PARMS * frame_parms, int eMBMS_active, + char *uecap_xer, uint8_t cba_group_active, uint8_t HO_active); +int mac_init(void); +int add_new_ue(module_id_t Mod_id, int CC_id, rnti_t rnti, int harq_pid +#ifdef Rel14 + , uint8_t rach_resource_type +#endif + ); +int rrc_mac_remove_ue(module_id_t Mod_id, rnti_t rntiP); + + +int maxround(module_id_t Mod_id, uint16_t rnti, int frame, + sub_frame_t subframe, uint8_t ul_flag); +void swap_UEs(UE_list_t * listP, int nodeiP, int nodejP, int ul_flag); +int prev(UE_list_t * listP, int nodeP, int ul_flag); +void dump_ue_list(UE_list_t * listP, int ul_flag); +int UE_num_active_CC(UE_list_t * listP, int ue_idP); +int UE_PCCID(module_id_t mod_idP, int ue_idP); +rnti_t UE_RNTI(module_id_t mod_idP, int ue_idP); + + +void ulsch_scheduler_pre_processor(module_id_t module_idP, slice_id_t slice_id, int frameP, + sub_frame_t subframeP, + uint16_t * first_rb); +void store_ulsch_buffer(module_id_t module_idP, int frameP, + sub_frame_t subframeP); +void sort_ue_ul(module_id_t module_idP, int frameP, sub_frame_t subframeP); +void assign_max_mcs_min_rb(module_id_t module_idP, int slice_id, int frameP, + sub_frame_t subframeP, uint16_t * first_rb); +void adjust_bsr_info(int buffer_occupancy, uint16_t TBS, + UE_TEMPLATE * UE_template); +int phy_stats_exist(module_id_t Mod_id, int rnti); +void sort_UEs(module_id_t Mod_idP, slice_id_t slice_id, int frameP, sub_frame_t subframeP); + +/*! \fn UE_L2_state_t ue_scheduler(const module_id_t module_idP,const frame_t frameP, const sub_frame_t subframe, const lte_subframe_t direction,const uint8_t eNB_index) + \brief UE scheduler where all the ue background tasks are done. This function performs the following: 1) Trigger PDCP every 5ms 2) Call RRC for link status return to PHY3) Perform SR/BSR procedures for scheduling feedback 4) Perform PHR procedures. +\param[in] module_idP instance of the UE +\param[in] rxFrame the RX frame number +\param[in] rxSubframe the RX subframe number +\param[in] txFrame the TX frame number +\param[in] txSubframe the TX subframe number +\param[in] direction subframe direction +\param[in] eNB_index instance of eNB +@returns L2 state (CONNETION_OK or CONNECTION_LOST or PHY_RESYNCH) +*/ +UE_L2_STATE_t ue_scheduler(const module_id_t module_idP, + const frame_t rxFrameP, + const sub_frame_t rxSubframe, + const frame_t txFrameP, + const sub_frame_t txSubframe, + const lte_subframe_t direction, + const uint8_t eNB_index, const int CC_id); + +/*! \fn int cba_access(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint8_t eNB_index,uint16_t buflen); +\brief determine whether to use cba resource to transmit or not +\param[in] Mod_id instance of the UE +\param[in] frame the frame number +\param[in] subframe the subframe number +\param[in] eNB_index instance of eNB +\param[out] access(1) or postpone (0) +*/ +int cba_access(module_id_t module_idP, frame_t frameP, + sub_frame_t subframe, uint8_t eNB_index, uint16_t buflen); + +/*! \fn BSR_SHORT * get_bsr_short(module_id_t module_idP, uint8_t bsr_len) +\brief get short bsr level +\param[in] Mod_id instance of the UE +\param[in] bsr_len indicator for no, short, or long bsr +\param[out] bsr_s pointer to short bsr +*/ +BSR_SHORT *get_bsr_short(module_id_t module_idP, uint8_t bsr_len); + +/*! \fn BSR_LONG * get_bsr_long(module_id_t module_idP, uint8_t bsr_len) +\brief get long bsr level +\param[in] Mod_id instance of the UE +\param[in] bsr_len indicator for no, short, or long bsr +\param[out] bsr_l pointer to long bsr +*/ +BSR_LONG *get_bsr_long(module_id_t module_idP, uint8_t bsr_len); + +/*! \fn boolean_t update_bsr(module_id_t module_idP, frame_t frameP,sub_frame_t subframeP) + \brief get the rlc stats and update the bsr level for each lcid +\param[in] Mod_id instance of the UE +\param[in] frame Frame index +*/ +boolean_t update_bsr(module_id_t module_idP, frame_t frameP, + sub_frame_t subframeP, eNB_index_t eNB_index); + +/*! \fn locate_BsrIndexByBufferSize (int *table, int size, int value) + \brief locate the BSR level in the table as defined in 36.321. This function requires that he values in table to be monotonic, either increasing or decreasing. The returned value is not less than 0, nor greater than n-1, where n is the size of table. +\param[in] *table Pointer to BSR table +\param[in] size Size of the table +\param[in] value Value of the buffer +\return the index in the BSR_LEVEL table +*/ +uint8_t locate_BsrIndexByBufferSize(const uint32_t * table, int size, + int value); + + +/*! \fn int get_sf_periodicBSRTimer(uint8_t periodicBSR_Timer) + \brief get the number of subframe from the periodic BSR timer configured by the higher layers +\param[in] periodicBSR_Timer timer for periodic BSR +\return the number of subframe +*/ +int get_sf_periodicBSRTimer(uint8_t bucketSize); + +/*! \fn int get_ms_bucketsizeduration(uint8_t bucketSize) + \brief get the time in ms form the bucket size duration configured by the higher layer +\param[in] bucketSize the bucket size duration +\return the time in ms +*/ +int get_ms_bucketsizeduration(uint8_t bucketsizeduration); + +/*! \fn int get_sf_retxBSRTimer(uint8_t retxBSR_Timer) + \brief get the number of subframe form the bucket size duration configured by the higher layer +\param[in] retxBSR_Timer timer for regular BSR +\return the time in sf +*/ +int get_sf_retxBSRTimer(uint8_t retxBSR_Timer); + +/*! \fn int get_sf_perioidicPHR_Timer(uint8_t perioidicPHR_Timer){ + \brief get the number of subframe form the periodic PHR timer configured by the higher layer +\param[in] perioidicPHR_Timer timer for reguluar PHR +\return the time in sf +*/ +int get_sf_perioidicPHR_Timer(uint8_t perioidicPHR_Timer); + +/*! \fn int get_sf_prohibitPHR_Timer(uint8_t prohibitPHR_Timer) + \brief get the number of subframe form the prohibit PHR duration configured by the higher layer +\param[in] prohibitPHR_Timer timer for PHR +\return the time in sf +*/ +int get_sf_prohibitPHR_Timer(uint8_t prohibitPHR_Timer); + +/*! \fn int get_db_dl_PathlossChange(uint8_t dl_PathlossChange) + \brief get the db form the path loss change configured by the higher layer +\param[in] dl_PathlossChange path loss for PHR +\return the pathloss in db +*/ +int get_db_dl_PathlossChange(uint8_t dl_PathlossChange); + +/*! \fn uint8_t get_phr_mapping (module_id_t module_idP, int CC_id,uint8_t eNB_index) + \brief get phr mapping as described in 36.313 +\param[in] Mod_id index of eNB +\param[in] CC_id Component Carrier Index +\return phr mapping +*/ +uint8_t get_phr_mapping(module_id_t module_idP, int CC_id, + uint8_t eNB_index); + +/*! \fn void update_phr (module_id_t module_idP) + \brief update/reset the phr timers +\param[in] Mod_id index of eNB +\param[in] CC_id Component carrier index +\return void +*/ +void update_phr(module_id_t module_idP, int CC_id); + +/*! \brief Function to indicate Msg3 transmission/retransmission which initiates/reset Contention Resolution Timer +\param[in] Mod_id Instance index of UE +\param[in] eNB_id Index of eNB +*/ +void Msg3_tx(module_id_t module_idP, uint8_t CC_id, frame_t frameP, + uint8_t eNB_id); + + +/*! \brief Function to indicate the transmission of msg1/rach +\param[in] Mod_id Instance index of UE +\param[in] eNB_id Index of eNB +*/ + +void Msg1_tx(module_id_t module_idP, uint8_t CC_id, frame_t frameP, + uint8_t eNB_id); + +void dl_phy_sync_success(module_id_t module_idP, + frame_t frameP, + unsigned char eNB_index, uint8_t first_sync); + +int dump_eNB_l2_stats(char *buffer, int length); + +double uniform_rngen(int min, int max); + +/* +void add_common_dci(DCI_PDU *DCI_pdu, + void *pdu, + rnti_t rnti, + unsigned char dci_size_bytes, + unsigned char aggregation, + unsigned char dci_size_bits, + unsigned char dci_fmt, + uint8_t ra_flag); +*/ + +uint32_t allocate_prbs_sub(int nb_rb, int N_RB_DL, int N_RBG, + uint8_t * rballoc); + +void update_ul_dci(module_id_t module_idP, uint8_t CC_id, rnti_t rnti, + uint8_t dai); + +int get_bw_index(module_id_t module_id, uint8_t CC_id); + +int get_min_rb_unit(module_id_t module_idP, uint8_t CC_id); + +/* \brief Generate header for DL-SCH. This function parses the desired control elements and sdus and generates the header as described +in 36-321 MAC layer specifications. It returns the number of bytes used for the header to be used as an offset for the payload +in the DLSCH buffer. +@param mac_header Pointer to the first byte of the MAC header (DL-SCH buffer) +@param num_sdus Number of SDUs in the payload +@param sdu_lengths Pointer to array of SDU lengths +@param sdu_lcids Pointer to array of LCIDs (the order must be the same as the SDU length array) +@param drx_cmd dicontinous reception command +@param timing_advancd_cmd timing advanced command +@param ue_cont_res_id Pointer to contention resolution identifier (NULL means not present in payload) +@param short_padding Number of bytes for short padding (0,1,2) +@param post_padding number of bytes for padding at the end of MAC PDU +@returns Number of bytes used for header +*/ +int generate_dlsch_header(unsigned char *mac_header, + unsigned char num_sdus, + unsigned short *sdu_lengths, + unsigned char *sdu_lcids, + unsigned char drx_cmd, + unsigned short timing_advance_cmd, + unsigned char *ue_cont_res_id, + unsigned char short_padding, + unsigned short post_padding); + +/** \brief RRC eNB Configuration primitive for PHY/MAC. Allows configuration of PHY/MAC resources based on System Information (SI), RRCConnectionSetup and RRCConnectionReconfiguration messages. +@param Mod_id Instance ID of eNB +@param CC_id Component Carrier of the eNB +@param mib Pointer to MIB + +@param radioResourceConfigCommon Structure from SIB2 for common radio parameters (if NULL keep existing configuration) +@param physicalConfigDedicated Structure from RRCConnectionSetup or RRCConnectionReconfiguration for dedicated PHY parameters (if NULL keep existing configuration) +@param measObj Structure from RRCConnectionReconfiguration for UE measurement procedures +@param mac_MainConfig Structure from RRCConnectionSetup or RRCConnectionReconfiguration for dedicated MAC parameters (if NULL keep existing configuration) +@param logicalChannelIdentity Logical channel identity index of corresponding logical channel config +@param logicalChannelConfig Pointer to logical channel configuration +@param measGapConfig Measurement Gap configuration for MAC (if NULL keep existing configuration) +@param tdd_Config TDD Configuration from SIB1 (if NULL keep existing configuration) +@param mobilityControlInfo mobility control info received for Handover +@param SchedInfoList SI Scheduling information +@param MBMS_Flag indicates MBMS transmission +@param mbsfn_SubframeConfigList pointer to mbsfn subframe configuration list from SIB2 +@param mbsfn_AreaInfoList pointer to MBSFN Area Info list from SIB13 +@param pmch_InfoList pointer to PMCH_InfoList from MBSFNAreaConfiguration Message (MCCH Message) +@param sib1_ext_r13 SI Scheduling information for SI-BR UEs +*/ + +int rrc_mac_config_req_eNB(module_id_t module_idP, + int CC_id, + int physCellId, + int p_eNB, + int Ncp, + int eutra_band, uint32_t dl_CarrierFreq, +#ifdef Rel14 + int pbch_repetition, +#endif + rnti_t rntiP, + BCCH_BCH_Message_t * mib, + RadioResourceConfigCommonSIB_t * + radioResourceConfigCommon, +#ifdef Rel14 + RadioResourceConfigCommonSIB_t * + radioResourceConfigCommon_BR, +#endif + struct PhysicalConfigDedicated + *physicalConfigDedicated, +#if defined(Rel10) || defined(Rel14) + SCellToAddMod_r10_t * sCellToAddMod_r10, + //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, +#endif + MeasObjectToAddMod_t ** measObj, + MAC_MainConfig_t * mac_MainConfig, + long logicalChannelIdentity, + LogicalChannelConfig_t * logicalChannelConfig, + MeasGapConfig_t * measGapConfig, + TDD_Config_t * tdd_Config, + MobilityControlInfo_t * mobilityControlInfo, + SchedulingInfoList_t * schedulingInfoList, + uint32_t ul_CarrierFreq, + long *ul_Bandwidth, + AdditionalSpectrumEmission_t * + additionalSpectrumEmission, + struct MBSFN_SubframeConfigList + *mbsfn_SubframeConfigList +#if defined(Rel10) || defined(Rel14) + , + uint8_t MBMS_Flag, + MBSFN_AreaInfoList_r9_t * mbsfn_AreaInfoList, + PMCH_InfoList_r9_t * pmch_InfoList +#endif +#ifdef Rel14 + , + SystemInformationBlockType1_v1310_IEs_t * + sib1_ext_r13 +#endif + ); + +/** \brief RRC eNB Configuration primitive for PHY/MAC. Allows configuration of PHY/MAC resources based on System Information (SI), RRCConnectionSetup and RRCConnectionReconfiguration messages. +@param Mod_id Instance ID of ue +@param CC_id Component Carrier of the ue +@param eNB_id Index of eNB +@param radioResourceConfigCommon Structure from SIB2 for common radio parameters (if NULL keep existing configuration) +@param physcialConfigDedicated Structure from RRCConnectionSetup or RRCConnectionReconfiguration for dedicated PHY parameters (if NULL keep existing configuration) +@param measObj Structure from RRCConnectionReconfiguration for UE measurement procedures +@param mac_MainConfig Structure from RRCConnectionSetup or RRCConnectionReconfiguration for dedicated MAC parameters (if NULL keep existing configuration) +@param logicalChannelIdentity Logical channel identity index of corresponding logical channel config +@param logicalChannelConfig Pointer to logical channel configuration +@param measGapConfig Measurement Gap configuration for MAC (if NULL keep existing configuration) +@param tdd_Config TDD Configuration from SIB1 (if NULL keep existing configuration) +@param mobilityControlInfo mobility control info received for Handover +@param SIwindowsize SI Windowsize from SIB1 (if NULL keep existing configuration) +@param SIperiod SI Period from SIB1 (if NULL keep existing configuration) +@param MBMS_Flag indicates MBMS transmission +@param mbsfn_SubframeConfigList pointer to mbsfn subframe configuration list from SIB2 +@param mbsfn_AreaInfoList pointer to MBSFN Area Info list from SIB13 +@param pmch_InfoList pointer to PMCH_InfoList from MBSFNAreaConfiguration Message (MCCH Message) +*/ +int rrc_mac_config_req_ue(module_id_t module_idP, + int CC_id, + uint8_t eNB_index, + RadioResourceConfigCommonSIB_t * + radioResourceConfigCommon, + struct PhysicalConfigDedicated + *physicalConfigDedicated, +#if defined(Rel10) || defined(Rel14) + SCellToAddMod_r10_t * sCellToAddMod_r10, + //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, +#endif + MeasObjectToAddMod_t ** measObj, + MAC_MainConfig_t * mac_MainConfig, + long logicalChannelIdentity, + LogicalChannelConfig_t * logicalChannelConfig, + MeasGapConfig_t * measGapConfig, + TDD_Config_t * tdd_Config, + MobilityControlInfo_t * mobilityControlInfo, + uint8_t * SIwindowsize, + uint16_t * SIperiod, + ARFCN_ValueEUTRA_t * ul_CarrierFreq, + long *ul_Bandwidth, + AdditionalSpectrumEmission_t * + additionalSpectrumEmission, + struct MBSFN_SubframeConfigList + *mbsfn_SubframeConfigList +#if defined(Rel10) || defined(Rel14) + , + uint8_t MBMS_Flag, + MBSFN_AreaInfoList_r9_t * mbsfn_AreaInfoList, + PMCH_InfoList_r9_t * pmch_InfoList +#endif +#ifdef CBA + , + uint8_t num_active_cba_groups, uint16_t cba_rnti +#endif + ); + +uint16_t getRIV(uint16_t N_RB_DL, uint16_t RBstart, uint16_t Lcrbs); + +int get_subbandsize(uint8_t dl_bandwidth); + + +void get_Msg3allocret(COMMON_channels_t * cc, + sub_frame_t current_subframe, + frame_t current_frame, + frame_t * frame, sub_frame_t * subframe); + +void get_Msg3alloc(COMMON_channels_t * cc, + sub_frame_t current_subframe, + frame_t current_frame, + frame_t * frame, sub_frame_t * subframe); + +uint16_t mac_computeRIV(uint16_t N_RB_DL, uint16_t RBstart, + uint16_t Lcrbs); + +int get_phich_resource_times6(COMMON_channels_t * cc); + +int to_rbg(int dl_Bandwidth); + +int to_prb(int dl_Bandwidth); + +uint8_t get_Msg3harqpid(COMMON_channels_t * cc, + frame_t frame, sub_frame_t current_subframe); + +uint32_t pdcchalloc2ulframe(COMMON_channels_t * ccP, uint32_t frame, + uint8_t n); + +uint8_t pdcchalloc2ulsubframe(COMMON_channels_t * ccP, uint8_t n); + +int is_UL_sf(COMMON_channels_t * ccP, sub_frame_t subframeP); + +uint8_t getQm(uint8_t mcs); + +uint8_t subframe2harqpid(COMMON_channels_t * cc, frame_t frame, + sub_frame_t subframe); + +void get_srs_pos(COMMON_channels_t * cc, uint16_t isrs, + uint16_t * psrsPeriodicity, uint16_t * psrsOffset); + +void get_csi_params(COMMON_channels_t * cc, + struct CQI_ReportPeriodic *cqi_PMI_ConfigIndex, + uint16_t * Npd, uint16_t * N_OFFSET_CQI, int *H); + +uint8_t get_rel8_dl_cqi_pmi_size(UE_sched_ctrl * sched_ctl, int CC_idP, + COMMON_channels_t * cc, uint8_t tmode, + struct CQI_ReportPeriodic + *cqi_ReportPeriodic); + +uint8_t get_dl_cqi_pmi_size_pusch(COMMON_channels_t * cc, uint8_t tmode, + uint8_t ri, + CQI_ReportModeAperiodic_t * + cqi_ReportModeAperiodic); +void extract_pucch_csi(module_id_t mod_idP, int CC_idP, int UE_id, + frame_t frameP, sub_frame_t subframeP, + uint8_t * pdu, uint8_t length); + +void extract_pusch_csi(module_id_t mod_idP, int CC_idP, int UE_id, + frame_t frameP, sub_frame_t subframeP, + uint8_t * pdu, uint8_t length); + +uint16_t fill_nfapi_tx_req(nfapi_tx_request_body_t * tx_req_body, + uint16_t absSF, uint16_t pdu_length, + uint16_t pdu_index, uint8_t * pdu); + +void fill_nfapi_ulsch_config_request_rel8(nfapi_ul_config_request_pdu_t * + ul_config_pdu, uint8_t cqi_req, + COMMON_channels_t * cc, + struct PhysicalConfigDedicated + *physicalConfigDedicated, + uint8_t tmode, uint32_t handle, + uint16_t rnti, + uint8_t resource_block_start, + uint8_t + number_of_resource_blocks, + uint8_t mcs, + uint8_t cyclic_shift_2_for_drms, + uint8_t + frequency_hopping_enabled_flag, + uint8_t frequency_hopping_bits, + uint8_t new_data_indication, + uint8_t redundancy_version, + uint8_t harq_process_number, + uint8_t ul_tx_mode, + uint8_t current_tx_nb, + uint8_t n_srs, uint16_t size); + +#ifdef Rel14 +void fill_nfapi_ulsch_config_request_emtc(nfapi_ul_config_request_pdu_t * + ul_config_pdu, uint8_t ue_type, + uint16_t + total_number_of_repetitions, + uint16_t repetition_number, + uint16_t + initial_transmission_sf_io); +#endif + +void program_dlsch_acknak(module_id_t module_idP, int CC_idP, int UE_idP, + frame_t frameP, sub_frame_t subframeP, + uint8_t cce_idx); + +void fill_nfapi_dlsch_config(eNB_MAC_INST * eNB, + nfapi_dl_config_request_body_t * dl_req, + uint16_t length, uint16_t pdu_index, + uint16_t rnti, + uint8_t resource_allocation_type, + uint8_t + virtual_resource_block_assignment_flag, + uint16_t resource_block_coding, + uint8_t modulation, + uint8_t redundancy_version, + uint8_t transport_blocks, + uint8_t transport_block_to_codeword_swap_flag, + uint8_t transmission_scheme, + uint8_t number_of_layers, + uint8_t number_of_subbands, + // uint8_t codebook_index, + uint8_t ue_category_capacity, + uint8_t pa, + uint8_t delta_power_offset_index, + uint8_t ngap, + uint8_t nprb, + uint8_t transmission_mode, + uint8_t num_bf_prb_per_subband, + uint8_t num_bf_vector); + +void fill_nfapi_harq_information(module_id_t module_idP, + int CC_idP, + uint16_t rntiP, + uint16_t absSFP, + nfapi_ul_config_harq_information * + harq_information, uint8_t cce_idxP); + +void fill_nfapi_ulsch_harq_information(module_id_t module_idP, + int CC_idP, + uint16_t rntiP, + nfapi_ul_config_ulsch_harq_information + * harq_information); + +uint16_t fill_nfapi_uci_acknak(module_id_t module_idP, + int CC_idP, + uint16_t rntiP, + uint16_t absSFP, uint8_t cce_idxP); + +void fill_nfapi_dl_dci_1A(nfapi_dl_config_request_pdu_t * dl_config_pdu, + uint8_t aggregation_level, + uint16_t rnti, + uint8_t rnti_type, + uint8_t harq_process, + uint8_t tpc, + uint16_t resource_block_coding, + uint8_t mcs, + uint8_t ndi, uint8_t rv, uint8_t vrb_flag); + +nfapi_ul_config_request_pdu_t *has_ul_grant(module_id_t module_idP, + int CC_idP, uint16_t subframeP, + uint16_t rnti); + +uint8_t get_tmode(module_id_t module_idP, int CC_idP, int UE_idP); + +uint8_t get_ul_req_index(module_id_t module_idP, int CC_idP, + sub_frame_t subframeP); + +#ifdef Rel14 +int get_numnarrowbandbits(long dl_Bandwidth); + +int mpdcch_sf_condition(eNB_MAC_INST * eNB, int CC_id, frame_t frameP, + sub_frame_t subframeP, int rmax, + MPDCCH_TYPES_t mpdcch_type, int UE_id); + +int get_numnarrowbands(long dl_Bandwidth); + +int narrowband_to_first_rb(COMMON_channels_t * cc, int nb_index); + +#endif + +int l2_init_eNB(void); + +void Msg1_transmitted(module_id_t module_idP, uint8_t CC_id, + frame_t frameP, uint8_t eNB_id); +void Msg3_transmitted(module_id_t module_idP, uint8_t CC_id, + frame_t frameP, uint8_t eNB_id); +uint32_t from_earfcn(int eutra_bandP, uint32_t dl_earfcn); +int32_t get_uldl_offset(int eutra_bandP); +int l2_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active, + uint8_t HO_active); + +/*Slice related functions */ +uint16_t flexran_nb_rbs_allowed_slice(float rb_percentage, int total_rbs); + +int ue_slice_membership(int UE_id, int slice_id); + +#endif +/** @}*/ diff --git a/openair2/RRC/NR_UE/defs.h b/openair2/RRC/NR_UE/defs.h new file mode 100644 index 0000000000..7fee548aa2 --- /dev/null +++ b/openair2/RRC/NR_UE/defs.h @@ -0,0 +1,522 @@ +/* + * 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 + */ + +/*! \file RRC/LITE/defs.h +* \brief RRC struct definitions and function prototypes +* \author Navid Nikaein and Raymond Knopp +* \date 2010 - 2014 +* \version 1.0 +* \company Eurecom +* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr +*/ + +#ifndef __OPENAIR_NR_RRC_DEFS_H__ +#define __OPENAIR_NR_RRC_DEFS_H__ + +#include +#include +#include + +#include "collection/tree.h" +#include "rrc_types.h" +#include "PHY/defs.h" +#include "LAYER2/RLC/rlc.h" + +#include "COMMON/platform_constants.h" +#include "COMMON/platform_types.h" + +#include "LAYER2/MAC/defs.h" + +#include "SystemInformationBlockType1.h" +#include "SystemInformation.h" +#include "RRCConnectionReconfiguration.h" +#include "RRCConnectionReconfigurationComplete.h" +#include "RRCConnectionSetup.h" +#include "RRCConnectionSetupComplete.h" +#include "RRCConnectionRequest.h" +#include "RRCConnectionReestablishmentRequest.h" +#include "BCCH-DL-SCH-Message.h" +#include "BCCH-BCH-Message.h" +#if defined(Rel10) || defined(Rel14) +#include "MCCH-Message.h" +#include "MBSFNAreaConfiguration-r9.h" +#include "SCellToAddMod-r10.h" +#endif +#include "AS-Config.h" +#include "AS-Context.h" +#include "UE-EUTRA-Capability.h" +#include "MeasResults.h" + +/* for ImsiMobileIdentity_t */ +#include "MobileIdentity.h" + +/* correct Rel(8|10)/Rel14 differences + * the code is in favor of Rel14, those defines do the translation + */ +#if !defined(Rel14) +# define CipheringAlgorithm_r12_t e_SecurityAlgorithmConfig__cipheringAlgorithm +# define CipheringAlgorithm_r12_eea0 SecurityAlgorithmConfig__cipheringAlgorithm_eea0 +# define CipheringAlgorithm_r12_eea1 SecurityAlgorithmConfig__cipheringAlgorithm_eea1 +# define CipheringAlgorithm_r12_eea2 SecurityAlgorithmConfig__cipheringAlgorithm_eea2 +# define CipheringAlgorithm_r12_spare1 SecurityAlgorithmConfig__cipheringAlgorithm_spare1 +# define Alpha_r12_al0 UplinkPowerControlCommon__alpha_al0 +# define Alpha_r12_al04 UplinkPowerControlCommon__alpha_al04 +# define Alpha_r12_al05 UplinkPowerControlCommon__alpha_al05 +# define Alpha_r12_al06 UplinkPowerControlCommon__alpha_al06 +# define Alpha_r12_al07 UplinkPowerControlCommon__alpha_al07 +# define Alpha_r12_al08 UplinkPowerControlCommon__alpha_al08 +# define Alpha_r12_al09 UplinkPowerControlCommon__alpha_al09 +# define Alpha_r12_al1 UplinkPowerControlCommon__alpha_al1 +# define PreambleTransMax_n3 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n3 +# define PreambleTransMax_n4 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n4 +# define PreambleTransMax_n5 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n5 +# define PreambleTransMax_n6 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n6 +# define PreambleTransMax_n7 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n7 +# define PreambleTransMax_n8 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n8 +# define PreambleTransMax_n10 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n10 +# define PreambleTransMax_n20 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n20 +# define PreambleTransMax_n50 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n50 +# define PreambleTransMax_n100 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n100 +# define PreambleTransMax_n200 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n200 +# define PeriodicBSR_Timer_r12_sf5 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf5 +# define PeriodicBSR_Timer_r12_sf10 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf10 +# define PeriodicBSR_Timer_r12_sf16 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf16 +# define PeriodicBSR_Timer_r12_sf20 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf20 +# define PeriodicBSR_Timer_r12_sf32 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf32 +# define PeriodicBSR_Timer_r12_sf40 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf40 +# define PeriodicBSR_Timer_r12_sf64 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf64 +# define PeriodicBSR_Timer_r12_sf80 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf80 +# define PeriodicBSR_Timer_r12_sf128 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf128 +# define PeriodicBSR_Timer_r12_sf160 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf160 +# define PeriodicBSR_Timer_r12_sf320 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf320 +# define PeriodicBSR_Timer_r12_sf640 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf640 +# define PeriodicBSR_Timer_r12_sf1280 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf1280 +# define PeriodicBSR_Timer_r12_sf2560 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf2560 +# define PeriodicBSR_Timer_r12_infinity MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity +# define RetxBSR_Timer_r12_sf320 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf320 +# define RetxBSR_Timer_r12_sf640 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf640 +# define RetxBSR_Timer_r12_sf1280 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf1280 +# define RetxBSR_Timer_r12_sf2560 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560 +# define RetxBSR_Timer_r12_sf5120 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf5120 +# define RetxBSR_Timer_r12_sf10240 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf10240 +#endif + +// This corrects something generated by asn1c which is different between Rel8 and Rel10 +#if !defined(Rel10) && !defined(Rel14) +#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member SystemInformation_r8_IEs_sib_TypeAndInfo_Member +#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib2 +#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib3 +#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib4 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib4 +#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib5 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib5 +#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib6 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib6 +#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib7 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib7 +#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib8 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib8 +#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib9 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib9 +#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib10 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib10 +#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib11 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib11 +#endif + + +#define NB_SIG_CNX_CH 1 +#define NB_CNX_CH MAX_MOBILES_PER_ENB +#define NB_SIG_CNX_UE 2 //MAX_MANAGED_RG_PER_MOBILE +#define NB_CNX_UE 2//MAX_MANAGED_RG_PER_MOBILE + +/* +#if defined(Rel10) || defined(Rel14) +#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib12_v920 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib12_v920 +#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib13_v920 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib13_v920 +#endif +*/ +//#include "L3_rrc_defs.h" +#ifndef NO_RRM +#include "L3_rrc_interface.h" +#include "rrc_rrm_msg.h" +#include "rrc_rrm_interface.h" +#endif + +#if defined(ENABLE_ITTI) +# include "intertask_interface.h" +#endif + +/* TODO: be sure this include is correct. + * It solves a problem of compilation of the RRH GW, + * issue #186. + */ +#if !defined(ENABLE_ITTI) +# include "as_message.h" +#endif + +#if defined(ENABLE_USE_MME) +# include "commonDef.h" +#endif + +//-------- +typedef unsigned int uid_t; +#define UID_LINEAR_ALLOCATOR_BITMAP_SIZE (((NUMBER_OF_UE_MAX/8)/sizeof(unsigned int)) + 1) +typedef struct uid_linear_allocator_s { + unsigned int bitmap[UID_LINEAR_ALLOCATOR_BITMAP_SIZE]; +} uid_allocator_t; + +//-------- + + + +#define PROTOCOL_RRC_CTXT_UE_FMT PROTOCOL_CTXT_FMT +#define PROTOCOL_RRC_CTXT_UE_ARGS(CTXT_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp) + +#define PROTOCOL_RRC_CTXT_FMT PROTOCOL_CTXT_FMT +#define PROTOCOL_RRC_CTXT_ARGS(CTXT_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp) +/** @defgroup _rrc RRC + * @ingroup _oai2 + * @{ + */ + + +#define UE_MODULE_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!! +#define UE_INDEX_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!! used to be -1 + +typedef enum { + RRC_OK=0, + RRC_ConnSetup_failed, + RRC_PHY_RESYNCH, + RRC_Handover_failed, + RRC_HO_STARTED +} RRC_status_t; + +typedef enum UE_STATE_e { + RRC_INACTIVE=0, + RRC_IDLE, + RRC_SI_RECEIVED, + RRC_CONNECTED, + RRC_RECONFIGURED, + RRC_HO_EXECUTION +} UE_STATE_t; + +typedef enum HO_STATE_e { + HO_IDLE=0, + HO_MEASURMENT, + HO_PREPARE, + HO_CMD, // initiated by the src eNB + HO_COMPLETE // initiated by the target eNB +} HO_STATE_t; + +//#define NUMBER_OF_UE_MAX MAX_MOBILES_PER_RG +#define RRM_FREE(p) if ( (p) != NULL) { free(p) ; p=NULL ; } +#define RRM_MALLOC(t,n) (t *) malloc16( sizeof(t) * n ) +#define RRM_CALLOC(t,n) (t *) malloc16( sizeof(t) * n) +#define RRM_CALLOC2(t,s) (t *) malloc16( s ) + +#define MAX_MEAS_OBJ 6 +#define MAX_MEAS_CONFIG 6 +#define MAX_MEAS_ID 6 + +#define PAYLOAD_SIZE_MAX 1024 +#define RRC_BUF_SIZE 255 +#define UNDEF_SECURITY_MODE 0xff +#define NO_SECURITY_MODE 0x20 + +#define CBA_OFFSET 0xfff4 +// #define NUM_MAX_CBA_GROUP 4 // in the platform_constants + +/* TS 36.331: RRC-TransactionIdentifier ::= INTEGER (0..3) */ +#if defined(USRP_REC_PLAY) +#define RRC_TRANSACTION_IDENTIFIER_NUMBER 1 +#else +#define RRC_TRANSACTION_IDENTIFIER_NUMBER 3 +#endif + +typedef struct { + unsigned short transport_block_size; /*!< \brief Minimum PDU size in bytes provided by RLC to MAC layer interface */ + unsigned short max_transport_blocks; /*!< \brief Maximum PDU size in bytes provided by RLC to MAC layer interface */ + unsigned long Guaranteed_bit_rate; /*!< \brief Guaranteed Bit Rate (average) to be offered by MAC layer scheduling*/ + unsigned long Max_bit_rate; /*!< \brief Maximum Bit Rate that can be offered by MAC layer scheduling*/ + uint8_t Delay_class; /*!< \brief Delay class offered by MAC layer scheduling*/ + uint8_t Target_bler; /*!< \brief Target Average Transport Block Error rate*/ + uint8_t Lchan_t; /*!< \brief Logical Channel Type (BCCH,CCCH,DCCH,DTCH_B,DTCH,MRBCH)*/ +} __attribute__ ((__packed__)) LCHAN_DESC; + +#define LCHAN_DESC_SIZE sizeof(LCHAN_DESC) + +typedef struct UE_RRC_INFO_s { + UE_STATE_t State; + uint8_t SIB1systemInfoValueTag; + uint32_t SIStatus; + uint32_t SIcnt; +#if defined(Rel10) || defined(Rel14) + uint8_t MCCHStatus[8]; // MAX_MBSFN_AREA +#endif + uint8_t SIwindowsize; //!< Corresponds to the SIB1 si-WindowLength parameter. The unit is ms. Possible values are (final): 1,2,5,10,15,20,40 + uint8_t handoverTarget; + HO_STATE_t ho_state; + uint16_t SIperiod; //!< Corresponds to the SIB1 si-Periodicity parameter (multiplied by 10). Possible values are (final): 80,160,320,640,1280,2560,5120 + unsigned short UE_index; + uint32_t T300_active; + uint32_t T300_cnt; + uint32_t T304_active; + uint32_t T304_cnt; + uint32_t T310_active; + uint32_t T310_cnt; + uint32_t N310_cnt; + uint32_t N311_cnt; + rnti_t rnti; +} __attribute__ ((__packed__)) UE_RRC_INFO; + +typedef struct UE_S_TMSI_s { + boolean_t presence; + mme_code_t mme_code; + m_tmsi_t m_tmsi; +} __attribute__ ((__packed__)) UE_S_TMSI; + +#if defined(ENABLE_ITTI) +typedef enum e_rab_satus_e { + E_RAB_STATUS_NEW, + E_RAB_STATUS_DONE, // from the eNB perspective + E_RAB_STATUS_ESTABLISHED, // get the reconfigurationcomplete form UE + E_RAB_STATUS_FAILED, + E_RAB_STATUS_TORELEASE // to release DRB between eNB and UE +} e_rab_status_t; + +typedef struct e_rab_param_s { + e_rab_t param; + uint8_t status; + uint8_t xid; // transaction_id + s1ap_Cause_t cause; + uint8_t cause_value; +} __attribute__ ((__packed__)) e_rab_param_t; +#endif + + + +/* Intermediate structure for Handover management. Associated per-UE in eNB_RRC_INST */ +typedef struct HANDOVER_INFO_s { + uint8_t ho_prepare; + uint8_t ho_complete; + uint8_t modid_s; //module_idP of serving cell + uint8_t modid_t; //module_idP of target cell + uint8_t ueid_s; //UE index in serving cell + uint8_t ueid_t; //UE index in target cell + AS_Config_t as_config; /* these two parameters are taken from 36.331 section 10.2.2: HandoverPreparationInformation-r8-IEs */ + AS_Context_t as_context; /* They are mandatory for HO */ + uint8_t buf[RRC_BUF_SIZE]; /* ASN.1 encoded handoverCommandMessage */ + int size; /* size of above message in bytes */ +} HANDOVER_INFO; + +#define RRC_HEADER_SIZE_MAX 64 +#define RRC_BUFFER_SIZE_MAX 1024 +typedef struct { + char Payload[RRC_BUFFER_SIZE_MAX]; + char Header[RRC_HEADER_SIZE_MAX]; + char payload_size; +} RRC_BUFFER; +#define RRC_BUFFER_SIZE sizeof(RRC_BUFFER) + +typedef struct RB_INFO_s { + uint16_t Rb_id; //=Lchan_id + LCHAN_DESC Lchan_desc[2]; + // MAC_MEAS_REQ_ENTRY *Meas_entry; +} RB_INFO; + +typedef struct SRB_INFO_s { + uint16_t Srb_id; //=Lchan_id + RRC_BUFFER Rx_buffer; + RRC_BUFFER Tx_buffer; + LCHAN_DESC Lchan_desc[2]; + unsigned int Trans_id; + uint8_t Active; +} SRB_INFO; + +typedef struct RB_INFO_TABLE_ENTRY_s { + RB_INFO Rb_info; + uint8_t Active; + uint32_t Next_check_frame; + uint8_t Status; +} RB_INFO_TABLE_ENTRY; + +typedef struct SRB_INFO_TABLE_ENTRY_s { + SRB_INFO Srb_info; + uint8_t Active; + uint8_t Status; + uint32_t Next_check_frame; +} SRB_INFO_TABLE_ENTRY; + +typedef struct MEAS_REPORT_LIST_s { + MeasId_t measId; + uint32_t numberOfReportsSent; +} MEAS_REPORT_LIST; + +typedef struct HANDOVER_INFO_UE_s { + PhysCellId_t targetCellId; + uint8_t measFlag; +} HANDOVER_INFO_UE; +typedef uid_t ue_uid_t; + +typedef struct { + uint8_t *MIB; + uint8_t sizeof_MIB; + uint8_t *SIB1; + uint8_t sizeof_SIB1; + uint8_t *SIB23; + uint8_t sizeof_SIB23; +#ifdef Rel14 + uint8_t *SIB1_BR; + uint8_t sizeof_SIB1_BR; + uint8_t *SIB23_BR; + uint8_t sizeof_SIB23_BR; +#endif + int physCellId; + int Ncp; + int p_eNB; + uint32_t dl_CarrierFreq; + uint32_t ul_CarrierFreq; + uint32_t pbch_repetition; + BCCH_BCH_Message_t mib; + BCCH_DL_SCH_Message_t siblock1; + BCCH_DL_SCH_Message_t systemInformation; + // SystemInformation_t systemInformation; + SystemInformationBlockType1_t *sib1; + SystemInformationBlockType2_t *sib2; + SystemInformationBlockType3_t *sib3; +#ifdef Rel14 + SystemInformationBlockType1_t *sib1_BR; + SystemInformationBlockType2_t *sib2_BR; + SystemInformationBlockType2_t *sib3_BR; +#endif +#if defined(Rel10) || defined(Rel14) + SystemInformationBlockType13_r9_t *sib13; + uint8_t MBMS_flag; + uint8_t num_mbsfn_sync_area; + uint8_t **MCCH_MESSAGE; // MAX_MBSFN_AREA + uint8_t sizeof_MCCH_MESSAGE[8];// MAX_MBSFN_AREA + MCCH_Message_t mcch; + MBSFNAreaConfiguration_r9_t *mcch_message; + SRB_INFO MCCH_MESS[8];// MAX_MBSFN_AREA +#endif + SRB_INFO SI; + SRB_INFO Srb0; + uint8_t *paging[NUMBER_OF_UE_MAX]; + uint32_t sizeof_paging[NUMBER_OF_UE_MAX]; +} rrc_eNB_carrier_data_t; + +#define MAX_UE_CAPABILITY_SIZE 255 +typedef struct OAI_UECapability_s { + uint8_t sdu[MAX_UE_CAPABILITY_SIZE]; + uint8_t sdu_size; + UE_EUTRA_Capability_t *UE_EUTRA_Capability; +} OAI_UECapability_t; + +typedef struct NR_UE_RRC_INST_s { + nr_rrc_state_t rrc_state; + nr_rrc_sub_state_t rrc_sub_state; +#if 0 + OAI_UECapability_t *UECap; + uint8_t *UECapability; + uint8_t UECapability_size; + UE_RRC_INFO Info[NB_SIG_CNX_UE]; + SRB_INFO Srb0[NB_SIG_CNX_UE]; + SRB_INFO_TABLE_ENTRY Srb1[NB_CNX_UE]; + SRB_INFO_TABLE_ENTRY Srb2[NB_CNX_UE]; + HANDOVER_INFO_UE HandoverInfoUe; + uint8_t *SIB1[NB_CNX_UE]; + uint8_t sizeof_SIB1[NB_CNX_UE]; + uint8_t *SI[NB_CNX_UE]; + uint8_t sizeof_SI[NB_CNX_UE]; + uint8_t SIB1Status[NB_CNX_UE]; + uint8_t SIStatus[NB_CNX_UE]; + SystemInformationBlockType1_t *sib1[NB_CNX_UE]; + SystemInformation_t *si[NB_CNX_UE]; //!< Temporary storage for an SI message. Decoding happens in decode_SI(). + SystemInformationBlockType2_t *sib2[NB_CNX_UE]; + SystemInformationBlockType3_t *sib3[NB_CNX_UE]; + SystemInformationBlockType4_t *sib4[NB_CNX_UE]; + SystemInformationBlockType5_t *sib5[NB_CNX_UE]; + SystemInformationBlockType6_t *sib6[NB_CNX_UE]; + SystemInformationBlockType7_t *sib7[NB_CNX_UE]; + SystemInformationBlockType8_t *sib8[NB_CNX_UE]; + SystemInformationBlockType9_t *sib9[NB_CNX_UE]; + SystemInformationBlockType10_t *sib10[NB_CNX_UE]; + SystemInformationBlockType11_t *sib11[NB_CNX_UE]; + +#if defined(Rel10) || defined(Rel14) + uint8_t MBMS_flag; + uint8_t *MCCH_MESSAGE[NB_CNX_UE]; + uint8_t sizeof_MCCH_MESSAGE[NB_CNX_UE]; + uint8_t MCCH_MESSAGEStatus[NB_CNX_UE]; + MBSFNAreaConfiguration_r9_t *mcch_message[NB_CNX_UE]; + SystemInformationBlockType12_r9_t *sib12[NB_CNX_UE]; + SystemInformationBlockType13_r9_t *sib13[NB_CNX_UE]; +#endif +#ifdef CBA + uint8_t num_active_cba_groups; + uint16_t cba_rnti[NUM_MAX_CBA_GROUP]; +#endif + uint8_t num_srb; + struct SRB_ToAddMod *SRB1_config[NB_CNX_UE]; + struct SRB_ToAddMod *SRB2_config[NB_CNX_UE]; + struct DRB_ToAddMod *DRB_config[NB_CNX_UE][8]; + rb_id_t *defaultDRB; // remember the ID of the default DRB + MeasObjectToAddMod_t *MeasObj[NB_CNX_UE][MAX_MEAS_OBJ]; + struct ReportConfigToAddMod *ReportConfig[NB_CNX_UE][MAX_MEAS_CONFIG]; + struct QuantityConfig *QuantityConfig[NB_CNX_UE]; + struct MeasIdToAddMod *MeasId[NB_CNX_UE][MAX_MEAS_ID]; + MEAS_REPORT_LIST *measReportList[NB_CNX_UE][MAX_MEAS_ID]; + uint32_t measTimer[NB_CNX_UE][MAX_MEAS_ID][6]; // 6 neighboring cells + RSRP_Range_t s_measure; + struct MeasConfig__speedStatePars *speedStatePars; + struct PhysicalConfigDedicated *physicalConfigDedicated[NB_CNX_UE]; + struct SPS_Config *sps_Config[NB_CNX_UE]; + MAC_MainConfig_t *mac_MainConfig[NB_CNX_UE]; + MeasGapConfig_t *measGapConfig[NB_CNX_UE]; + double filter_coeff_rsrp; // [7] ??? + double filter_coeff_rsrq; // [7] ??? + float rsrp_db[7]; + float rsrq_db[7]; + float rsrp_db_filtered[7]; + float rsrq_db_filtered[7]; +#if defined(ENABLE_SECURITY) + /* KeNB as computed from parameters within USIM card */ + uint8_t kenb[32]; + uint8_t nh[32]; + int8_t nh_ncc; +#endif + + /* Used integrity/ciphering algorithms */ + CipheringAlgorithm_r12_t ciphering_algorithm; + e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm; +#endif + + MeasConfig_t meas_config; + CellGroupConfig_t cell_group_config; + RadioBearerConfig_t radio_bearer_config; + +} NR_UE_RRC_INST_t; + +typedef struct UE_PF_PO_s { + boolean_t enable_flag; /* flag indicate whether current object is used */ + uint16_t ue_index_value; /* UE index value */ + uint8_t PF_min; /* minimal value of Paging Frame (PF) */ + uint8_t PO; /* Paging Occasion (PO) */ + uint32_t T; /* DRX cycle */ +} UE_PF_PO_t; + +#include "proto.h" + +#endif +/** @} */ diff --git a/openair2/RRC/NR_UE/main_ue.c b/openair2/RRC/NR_UE/main_ue.c new file mode 100644 index 0000000000..814e68717e --- /dev/null +++ b/openair2/RRC/NR_UE/main_ue.c @@ -0,0 +1,19 @@ + + +#include "defs.h" +#include "proto.h" +#include "extern.h" +#include "assertions.h" + + + + + +int nr_l3_init_ue(void){ + LOG_I(RRC, "[MAIN] NR UE MAC initialization...\n"); + + openair_rrc_top_init_ue_nr(); + + return 1; + +} diff --git a/openair2/RRC/NR_UE/proto.h b/openair2/RRC/NR_UE/proto.h new file mode 100644 index 0000000000..6e876297f6 --- /dev/null +++ b/openair2/RRC/NR_UE/proto.h @@ -0,0 +1,79 @@ +/* + * 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 + */ + +/*! \file proto.h + * \brief RRC functions prototypes for eNB and UE + * \author Navid Nikaein and Raymond Knopp + * \date 2010 - 2014 + * \email navid.nikaein@eurecom.fr + * \version 1.0 + + */ +/** \addtogroup _rrc + * @{ + */ + +#include "defs.h" + +// +// main_rrc.c +// +/**\brief Layer 3 initialization*/ +int nr_l3_init_ue(void); + +// +// UE_rrc.c +// + +/**\brief Initial the top level RRC structure instance*/ +uint8_t openair_rrc_top_init_ue_nr(void); + +/**\brief Decode DCCH from gNB, sent from lower layer through SRB3 + \param buffer encoded DCCH bytes stream message + \param size length of buffer*/ +int8_t nr_rrc_ue_decode_dcch(const uint8_t *buffer, const uint32_t size); + +/**\brief Decode RRC Connection Reconfiguration, sent from E-UTRA RRC Connection Reconfiguration v1510 carring EN-DC config + \param buffer encoded NR-RRC-Connection-Reconfiguration/Secondary-Cell-Group-Config message. + \param size length of buffer*/ +//TODO check to use which one +int8_t nr_rrc_ue_decode_rrcReconfiguration(const uint8_t *buffer, const uint32_t size); +int8_t nr_rrc_ue_decode_secondary_cellgroup_config(const uint8_t *buffer, const uint32_t size); + + +/**\brief Process NR RRC connection reconfiguration via SRB3 + \param rrcReconfiguration decoded rrc connection reconfiguration*/ +int8_t nr_rrc_ue_process_rrcReconfiguration(RRCReconfiguration_t *rrcReconfiguration); + +/**\prief Process measurement config from NR RRC connection reconfiguration message + \param meas_config measurement configuration*/ +int8_t nr_rrc_ue_process_meas_config(MeasConfig_t *meas_config); + +/**\prief Process secondary cell group config from NR RRC connection reconfiguration message or EN-DC primitives + \param cell_group_config secondary cell group configuration*/ +//TODO check EN-DC function call flow. +int8_t nr_rrc_ue_process_scg_config(CellGroupConfig_t *cell_group_config); + +/**\prief Process radio bearer config from NR RRC connection reconfiguration message + \param radio_bearer_config radio bearer configuration*/ +int8_t nr_rrc_ue_process_radio_bearer_config(RadioBearerConfig_t *radio_bearer_config); + +/** @}*/ diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c new file mode 100644 index 0000000000..e17e7a2838 --- /dev/null +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -0,0 +1,294 @@ +/* + * 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 + */ + +/*! \file rrc_UE.c + * \brief rrc procedures for UE + * \author Navid Nikaein and Raymond Knopp + * \date 2011 - 2014 + * \version 1.0 + * \company Eurecom + * \email: navid.nikaein@eurecom.fr and raymond.knopp@eurecom.fr + */ + +#define RRC_UE +#define RRC_UE_C + + +// header files for RRC message for NR might be change to add prefix in from of the file name. +#include "assertions.h" +#include "hashtable.h" +#include "asn1_conversions.h" +#include "defs.h" +#include "PHY/TOOLS/dB_routines.h" +#include "extern.h" +#include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h" +#include "LAYER2/RLC/rlc.h" +#include "COMMON/mac_rrc_primitives.h" +#include "UTIL/LOG/log.h" +#include "UTIL/LOG/vcd_signal_dumper.h" +#ifndef CELLULAR +#include "RRC/LITE/MESSAGES/asn1_msg.h" +#endif +#include "RRCConnectionRequest.h" +#include "RRCConnectionReconfiguration.h" +#include "UL-CCCH-Message.h" +#include "DL-CCCH-Message.h" +#include "UL-DCCH-Message.h" +#include "DL-DCCH-Message.h" +#include "BCCH-DL-SCH-Message.h" +#include "PCCH-Message.h" +#if defined(Rel10) || defined(Rel14) +#include "MCCH-Message.h" +#endif +#include "MeasConfig.h" +#include "MeasGapConfig.h" +#include "MeasObjectEUTRA.h" +#include "TDD-Config.h" +#include "UECapabilityEnquiry.h" +#include "UE-CapabilityRequest.h" +#include "RRC/NAS/nas_config.h" +#include "RRC/NAS/rb_config.h" +#if ENABLE_RAL +#include "rrc_UE_ral.h" +#endif + +#if defined(ENABLE_SECURITY) +# include "UTIL/OSA/osa_defs.h" +#endif + + +#if defined(ENABLE_ITTI) +#include "intertask_interface.h" +#endif + + + +// from NR SRB3 +uint8_t nr_rrc_ue_decode_dcch( + const uint8_t *buffer, + const uint32_t size +){ + // uper_decode by nr R15 rrc_connection_reconfiguration + + NR_RRC_DL_DCCH_Message_t *nr_dl_dcch_msg = (NR_RRC_DL_DCCH_Message_t *)0; + + uper_decode(NULL, + &asn_DEF_NR_RRC_DL_DCCH_Message, //might be added prefix later + (void**)&nr_dl_dcch_msg, + (uint8_t *)buffer, + size, 0, 0); + + if(nr_dl_dcch_msg != NULL){ + switch(nr_dl_dcch_msg->message.present){ + case DL_DCCH_MessageType_PR_c1: + + switch(nr_dl_dcch_msg->message.choice.c1.present){ + case DL_DCCH_MessageType__c1_PR_rrcReconfiguration: + nr_rrc_ue_process_rrcReconfiguration(&nr_dl_dcch_msg->message.choice.c1.choice.rrcReconfiguration); + break; + + case DL_DCCH_MessageType__c1_PR_NOTHING: + case DL_DCCH_MessageType__c1_PR_spare15: + case DL_DCCH_MessageType__c1_PR_spare14: + case DL_DCCH_MessageType__c1_PR_spare13: + case DL_DCCH_MessageType__c1_PR_spare12: + case DL_DCCH_MessageType__c1_PR_spare11: + case DL_DCCH_MessageType__c1_PR_spare10: + case DL_DCCH_MessageType__c1_PR_spare9: + case DL_DCCH_MessageType__c1_PR_spare8: + case DL_DCCH_MessageType__c1_PR_spare7: + case DL_DCCH_MessageType__c1_PR_spare6: + case DL_DCCH_MessageType__c1_PR_spare5: + case DL_DCCH_MessageType__c1_PR_spare4: + case DL_DCCH_MessageType__c1_PR_spare3: + case DL_DCCH_MessageType__c1_PR_spare2: + case DL_DCCH_MessageType__c1_PR_spare1: + default: + // not support or unuse + break; + } + break; + case DL_DCCH_MessageType_PR_NOTHING: + case DL_DCCH_MessageType_PR_messageClassExtension: + default: + // not support or unuse + break; + } + + // release memory allocation + free(nr_dl_dcch_msg); + }else{ + // log.. + } + + return 0; + +} + + +// from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (encoded) +// TODO check to use this or downer one +uint8_t nr_rrc_ue_decode_rrcReconfiguration( + const uint8_t *buffer, + const uint32_t size +){ + RRCReconfiguration_t *rrcReconfiguration; + + // decoding + uper_decode(NULL, + &asn_DEF_RRCReconfiguration, + (void **)&rrcReconfiguration, + (uint8_t *)buffer, + size); + + nr_rrc_ue_process_rrcReconfiguration(rrcReconfiguration); // after decoder + + free(rrcReconfiguration); + +} +// from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (encoded) +// TODO check to use this or upper one +uint8_t nr_rrc_ue_decode_secondary_cellgroup_config( + const uint8_t *buffer, + const uint32_t size +){ + CellGroupConfig_t *cellGroupConfig = (CellGroupConfig_t *)0; + + uper_decode(NULL, + &asn_DEF_CellGroupConfig, //might be added prefix later + (void **)&cellGroupConfig, + (uint8_t *)buffer, + size, 0, 0); + + nr_rrc_ue_process_scg_config(cellGroupConfig); + + free(cellGroupConfig); +} + + +// from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (decoded) +// RRCReconfiguration +uint8_t nr_rrc_ue_process_rrcReconfiguration(RRCReconfiguration_t *rrcReconfiguration){ + + switch(rrcReconfiguration.criticalExtensions.present){ + case RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration: + if(rrcReconfiguration.criticalExtensions.rrcReconfiguration->radioBearerConfig != (RadioBearerConfig_t *)0){ + nr_rrc_ue_process_radio_bearer_config(rrcReconfiguration->radioBearerConfig); + } + + if(rrcReconfiguration.criticalExtensions.rrcReconfiguration->secondaryCellGroup != (OCTET_STRING_t *)0){ + CellGroupConfig_t *cellGroupConfig = (CellGroupConfig_t *)0; + // TODO check if this deocder is need for decode "SecondaryCellGroup" of use type "CellGroupConfig" directly + uper_decode(NULL, + &asn_DEF_CellGroupConfig, //might be added prefix later + (void **)&cellGroupConfig, + (uint8_t *)rrcReconfiguration->secondaryCellGroup->buffer, + rrcReconfiguration->secondaryCellGroup.size, 0, 0); + + nr_rrc_ue_process_scg_config(cellGroupConfig); + + free(cellGroupConfig); + } + + if(rrcReconfiguration.criticalExtensions.rrcReconfiguration->measConfig != (MeasConfig *)0){ + nr_rrc_ue_process_meas_config(rrcReconfiguration.criticalExtensions.rrcReconfiguration->measConfig); + } + + if(rrcReconfiguration.criticalExtensions.rrcReconfiguration->lateNonCriticalExtension != (OCTET_STRING_t *)0){ + // unuse now + } + + if(rrcReconfiguration.criticalExtensions.rrcReconfiguration->nonCriticalExtension != (RRCReconfiguration_IEs__nonCriticalExtension *)0){ + // unuse now + } + break; + case RRCReconfiguration__criticalExtensions_PR_NOTHING: + case RRCReconfiguration__criticalExtensions_PR_criticalExtensionsFuture: + default: + break; + } + + + + // process +} + +uint8_t nr_rrc_ue_process_meas_config(MeasConfig_t *meas_config){ + // copy into nr_rrc inst + memcpy( (void *)NR_UE_rrc_inst->measConfig, + (void *)meas_config, + sizeof(MeasConfig_t)); + // process it +} +uint8_t nr_rrc_ue_process_scg_config(CellGroupConfig_t *cell_group_config){ + // copy into nr_rrc inst + + nr_ue_process_rlc_bearer_list(); + nr_ue_process_mac_cell_group_config(); + nr_ue_process_physical_cell_group_config(); + nr_ue_process_spcell_config(); + nr_ue_process_spcell_list(); + + memcpy( (void *)NR_UE_rrc_inst->cellGroupConfig, + (void *)cellGroupConfig, + sizeof(cellGroupConfig_t)); + // process it +} +uint8_t nr_rrc_ue_process_radio_bearer_config(RadioBearerConfig_t *radio_bearer_config){ + // copy into nr_rrc inst + memcpy( (void *)NR_UE_rrc_inst->radioBearerConfig, + (void *)radio_bearer_config, + sizeof(RadioBearerConfig_t)); + // process it +} + + +uint8_t openair_rrc_top_init_ue_nr(void){ + + if(NB_NR_UE_INST > 0){ + NR_UE_rrc_inst = (NR_UE_RRC_INST_t *)malloc(NB_NR_UE_INST * sizeof(NR_UE_RRC_INST_t)); + memset(NR_UE_rrc_inst, 0, NB_NR_UE_INST * sizeof(NR_UE_RRC_INST_t)); + + // fill UE-NR-Capability @ UE-CapabilityRAT-Container here. + + + }else{ + NR_UE_rrc_inst = (NR_UE_RRC_INST_t *)0; + } +} + + +uint8_t nr_ue_process_rlc_bearer_list(){ +}; + +uint8_t nr_ue_process_mac_cell_group_config(){ +}; + +uint8_t nr_ue_process_physical_cell_group_config(){ +}; + +uint8_t nr_ue_process_spcell_config(){ +}; + +uint8_t nr_ue_process_spcell_list(){ +}; + + diff --git a/openair2/RRC/NR_UE/rrc_types.h b/openair2/RRC/NR_UE/rrc_types.h new file mode 100644 index 0000000000..b5540145b0 --- /dev/null +++ b/openair2/RRC/NR_UE/rrc_types.h @@ -0,0 +1,71 @@ +/* + * 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 + */ + +/*! \file rrc_types.h +* \brief rrc types and subtypes +* \author Navid Nikaein and Raymond Knopp +* \date 2011 - 2014 +* \version 1.0 +* \company Eurecom +* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr +*/ + +#ifndef NR_RRC_TYPES_H_ +#define NR_RRC_TYPES_H_ + +typedef enum nr_rrc_state_e { + //RRC_STATE_INACTIVE=0, + //RRC_STATE_IDLE, + //RRC_STATE_CONNECTED, + + //RRC_STATE_FIRST = RRC_STATE_INACTIVE, + //RRC_STATE_LAST = RRC_STATE_CONNECTED, + RRC_STATE_IDLE = 0, + RRC_STATE_INACTIVE, + RRC_STATE_CONNECTED, + + RRC_STATE_FIRST = RRC_STATE_IDLE, + RRC_STATE_LAST = RRC_STATE_CONNECTED + +} nr_rrc_state_t; + +typedef enum nr_rrc_sub_state_e { + //RRC_SUB_STATE_INACTIVE=0, + + //RRC_SUB_STATE_IDLE_SEARCHING, + //RRC_SUB_STATE_IDLE_RECEIVING_SIB, + //RRC_SUB_STATE_IDLE_SIB_COMPLETE, + //RRC_SUB_STATE_IDLE_CONNECTING, + //RRC_SUB_STATE_IDLE, + + //RRC_SUB_STATE_CONNECTED, + + //RRC_SUB_STATE_INACTIVE_FIRST = RRC_SUB_STATE_INACTIVE, + //RRC_SUB_STATE_INACTIVE_LAST = RRC_SUB_STATE_INACTIVE, + + //RRC_SUB_STATE_IDLE_FIRST = RRC_SUB_STATE_IDLE_SEARCHING, + //RRC_SUB_STATE_IDLE_LAST = RRC_SUB_STATE_IDLE, + + //RRC_SUB_STATE_CONNECTED_FIRST = RRC_SUB_STATE_CONNECTED, + //RRC_SUB_STATE_CONNECTED_LAST = RRC_SUB_STATE_CONNECTED, +} nr_rrc_sub_state_t; + +#endif /* RRC_TYPES_H_ */ diff --git a/openair2/RRC/NR_UE/vars.h b/openair2/RRC/NR_UE/vars.h new file mode 100644 index 0000000000..83bfdebc92 --- /dev/null +++ b/openair2/RRC/NR_UE/vars.h @@ -0,0 +1,248 @@ +/* + * Licensed to the OpenAirInterface (OAI) Software Alliance under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The OpenAirInterface Software Alliance licenses this file to You under + * the OAI Public License, Version 1.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 + */ + +/*! \file vars.hles +* \brief rrc variables +* \author Raymond Knopp and Navid Nikaein +* \date 2013 +* \version 1.0 +* \company Eurecom +* \email: navid.nikaein@eurecom.fr +*/ + + +#ifndef __OPENAIR_NR_RRC_VARS_H__ +#define __OPENAIR_NR_RRC_VARS_H__ + +#include "defs.h" +#include "LAYER2/RLC/rlc.h" +#include "COMMON/mac_rrc_primitives.h" +#include "LAYER2/MAC/defs.h" + +UE_PF_PO_t UE_PF_PO[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; +pthread_mutex_t ue_pf_po_mutex; +NR_UE_RRC_INST_t *NR_UE_rrc_inst; +#include "LAYER2/MAC/extern.h" +#define MAX_U32 0xFFFFFFFF + +uint8_t DRB2LCHAN[8]; + +long logicalChannelGroup0 = 0; +long logicalChannelSR_Mask_r9=0; + +struct LogicalChannelConfig__ul_SpecificParameters LCSRB1 = {1, + LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity, + 0, + &logicalChannelGroup0 +}; +struct LogicalChannelConfig__ul_SpecificParameters LCSRB2 = {3, + LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity, + 0, + &logicalChannelGroup0 +}; + + +#if defined(Rel10) || defined(Rel14) +struct LogicalChannelConfig__ext1 logicalChannelSR_Mask_r9_ext1 = { + logicalChannelSR_Mask_r9: &logicalChannelSR_Mask_r9 +}; +#endif + +// These are the default SRB configurations from 36.331 (Chapter 9, p. 176-179 in v8.6) +LogicalChannelConfig_t SRB1_logicalChannelConfig_defaultValue = {ul_SpecificParameters: &LCSRB1 +#if defined(Rel10) || defined(Rel14) + , + ext1: &logicalChannelSR_Mask_r9_ext1 +#endif + }; + +LogicalChannelConfig_t SRB2_logicalChannelConfig_defaultValue = {ul_SpecificParameters: &LCSRB2 +#if defined(Rel10) || defined(Rel14) + , + ext1: &logicalChannelSR_Mask_r9_ext1 +#endif + }; + +//CONSTANTS +rlc_info_t Rlc_info_um,Rlc_info_am_config; +uint16_t RACH_FREQ_ALLOC; +//uint8_t NB_RACH; +LCHAN_DESC BCCH_LCHAN_DESC,CCCH_LCHAN_DESC,DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC; +MAC_MEAS_T BCCH_MEAS_TRIGGER,CCCH_MEAS_TRIGGER,DCCH_MEAS_TRIGGER,DTCH_MEAS_TRIGGER; +MAC_AVG_T BCCH_MEAS_AVG, CCCH_MEAS_AVG,DCCH_MEAS_AVG, DTCH_MEAS_AVG; + +// timers +uint16_t T300[8] = {100,200,300,400,600,1000,1500,2000}; +uint16_t T310[8] = {0,50,100,200,500,1000,2000}; +uint16_t N310[8] = {1,2,3,4,6,8,10,20}; +uint16_t N311[8] = {1,2,3,4,6,8,10,20}; +uint32_t T304[8] = {50,100,150,200,500,1000,2000,MAX_U32}; + +// TimeToTrigger enum mapping table (36.331 TimeToTrigger IE) +uint32_t timeToTrigger_ms[16] = {0,40,64,80,100,128,160,256,320,480,512,640,1024,1280,2560,5120}; + +/* 36.133 Section 9.1.4 RSRP Measurement Report Mapping, Table: 9.1.4-1 */ +float RSRP_meas_mapping[98] = { + -140, + -139, + -138, + -137, + -136, + -135, + -134, + -133, + -132, + -131, + -130, + -129, + -128, + -127, + -126, + -125, + -124, + -123, + -122, + -121, + -120, + -119, + -118, + -117, + -116, + -115, + -114, + -113, + -112, + -111, + -110, + -109, + -108, + -107, + -106, + -105, + -104, + -103, + -102, + -101, + -100, + -99, + -98, + -97, + -96, + -95, + -94, + -93, + -92, + -91, + -90, + -89, + -88, + -87, + -86, + -85, + -84, + -83, + -82, + -81, + -80, + -79, + -78, + -77, + -76, + -75, + -74, + -73, + -72, + -71, + -70, + -69, + -68, + -67, + -66, + -65, + -64, + -63, + -62, + -61, + -60, + -59, + -58, + -57, + -56, + -55, + -54, + -53, + -52, + -51, + -50, + -49, + -48, + -47, + -46, + -45, + -44, + -43 +}; + +float RSRQ_meas_mapping[35] = { + -19, + -18.5, + -18, + -17.5, + -17, + -16.5, + -16, + -15.5, + -15, + -14.5, + -14, + -13.5, + -13, + -12.5, + -12, + -11.5, + -11, + -10.5, + -10, + -9.5, + -9, + -8.5, + -8, + -7.5, + -7, + -6.5, + -6, + -5.5, + -5, + -4.5, + -4, + -3.5, + -3, + -2.5, + -2 +}; + +// only used for RRC connection re-establishment procedure TS36.331 5.3.7 +// [0]: current C-RNTI, [1]: prior C-RNTI +// insert one when eNB received RRCConnectionReestablishmentRequest message +// delete one when eNB received RRCConnectionReestablishmentComplete message +uint16_t reestablish_rnti_map[NUMBER_OF_UE_MAX][2] = {{0}}; + +#endif From 5e1c6029e0e2e206ddc0b8d8bfbbc2a37d952d56 Mon Sep 17 00:00:00 2001 From: Calvin Date: Fri, 18 May 2018 13:34:40 +0200 Subject: [PATCH 09/13] Add nr_rrc_mac_config_req_ue function --- openair2/LAYER2/NR_MAC_UE/config_ue.c | 464 +-------- openair2/LAYER2/NR_MAC_UE/defs.h | 1289 +------------------------ openair2/LAYER2/NR_MAC_UE/extern.h | 100 -- openair2/LAYER2/NR_MAC_UE/proto.h | 1193 ----------------------- openair2/RRC/NR_UE/defs.h | 370 +------ openair2/RRC/NR_UE/rrc_UE.c | 110 +-- openair2/RRC/NR_UE/vars.h | 207 ---- 7 files changed, 87 insertions(+), 3646 deletions(-) delete mode 100644 openair2/LAYER2/NR_MAC_UE/extern.h delete mode 100644 openair2/LAYER2/NR_MAC_UE/proto.h diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index a9564f908f..6e75276264 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -35,451 +35,47 @@ nr_rrc_mac_config_req_ue( module_id_t Mod_idP, int CC_idP, uint8_t eNB_index, - ){ + MAC_CellGroupConfig_t *mac_cell_group_config, + PhysicalCellGroupConfig_t *phy_cell_group_config, + SpCellConfig_t *spcell_config){ // TODO do something FAPI-like P5 L1/L2 config interface in config_si, config_mib, etc. - int i; + if(mac_cell_group_config != (MAC_CellGroupConfig_t *)0){ + if(mac_cell_group_config->drx_Config != (drx_Config_t *)0 ){ + NR_UE_mac_inst->drx_Config = mac_cell_group_config->drx_Config; + } - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME - (VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_IN); + if(mac_cell_group_config->SchedulingRequestConfig != (SchedulingRequestConfig_t *)0 ){ + NR_UE_mac_inst->SchedulingRequestConfig = mac_cell_group_config->SchedulingRequestConfig; + } - LOG_I(MAC, "[CONFIG][UE %d] Configuring MAC/PHY from eNB %d\n", - Mod_idP, eNB_index); + if(mac_cell_group_config->BSR_Config != (BSR_Config_t *)0 ){ + NR_UE_mac_inst->BSR_Config = mac_cell_group_config->BSR_Config; + } - if (tdd_Config != NULL) { - UE_mac_inst[Mod_idP].tdd_Config = tdd_Config; - } + if(mac_cell_group_config->TAG_Config != (TAG_Config_t *)0 ){ + NR_UE_mac_inst->TAG_Config = mac_cell_group_config->TAG_Config; + } + + if(mac_cell_group_config->phr_Config != (phr_Config_t *)0 ){ + NR_UE_mac_inst->phr_Config = mac_cell_group_config->phr_Config; + } + + if(mac_cell_group_config->cs_RNTI != (cs_RNTI_t *)0 ){ + NR_UE_mac_inst->cs_RNTI = mac_cell_group_config->cs_RNTI; + } - if (tdd_Config && SIwindowsize && SIperiod) { - phy_config_sib1_ue(Mod_idP, 0, eNB_index, tdd_Config, - *SIwindowsize, *SIperiod); - } - - if (radioResourceConfigCommon != NULL) { - UE_mac_inst[Mod_idP].radioResourceConfigCommon = - radioResourceConfigCommon; - phy_config_sib2_ue(Mod_idP, 0, eNB_index, - radioResourceConfigCommon, ul_CarrierFreq, - ul_Bandwidth, additionalSpectrumEmission, - mbsfn_SubframeConfigList); - } - // SRB2_lchan_config->choice.explicitValue.ul_SpecificParameters->logicalChannelGroup - if (logicalChannelConfig != NULL) { - LOG_I(MAC, - "[CONFIG][UE %d] Applying RRC logicalChannelConfig from eNB%d\n", - Mod_idP, eNB_index); - UE_mac_inst[Mod_idP].logicalChannelConfig[logicalChannelIdentity] = - logicalChannelConfig; - UE_mac_inst[Mod_idP].scheduling_info.Bj[logicalChannelIdentity] = 0; // initilize the bucket for this lcid - - AssertFatal(logicalChannelConfig->ul_SpecificParameters != NULL, - "[UE %d] LCID %ld NULL ul_SpecificParameters\n", - Mod_idP, logicalChannelIdentity); - UE_mac_inst[Mod_idP].scheduling_info.bucket_size[logicalChannelIdentity] = logicalChannelConfig->ul_SpecificParameters->prioritisedBitRate * logicalChannelConfig->ul_SpecificParameters->bucketSizeDuration; // set the max bucket size - if (logicalChannelConfig->ul_SpecificParameters-> - logicalChannelGroup != NULL) { - UE_mac_inst[Mod_idP].scheduling_info. - LCGID[logicalChannelIdentity] = - *logicalChannelConfig->ul_SpecificParameters-> - logicalChannelGroup; - LOG_D(MAC, - "[CONFIG][UE %d] LCID %ld is attached to the LCGID %ld\n", - Mod_idP, logicalChannelIdentity, - *logicalChannelConfig-> - ul_SpecificParameters->logicalChannelGroup); - } else { - UE_mac_inst[Mod_idP].scheduling_info. - LCGID[logicalChannelIdentity] = MAX_NUM_LCGID; } - UE_mac_inst[Mod_idP]. - scheduling_info.LCID_buffer_remain[logicalChannelIdentity] = 0; - } - - if (mac_MainConfig != NULL) { - LOG_I(MAC, - "[CONFIG][UE%d] Applying RRC macMainConfig from eNB%d\n", - Mod_idP, eNB_index); - UE_mac_inst[Mod_idP].macConfig = mac_MainConfig; - UE_mac_inst[Mod_idP].measGapConfig = measGapConfig; - - if (mac_MainConfig->ul_SCH_Config) { - - if (mac_MainConfig->ul_SCH_Config->periodicBSR_Timer) { - UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer = - (uint16_t) * - mac_MainConfig->ul_SCH_Config->periodicBSR_Timer; - } else { - UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_Timer = -#ifndef Rel14 - (uint16_t) - MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity -#else - (uint16_t) PeriodicBSR_Timer_r12_infinity; -#endif - ; - } - - if (mac_MainConfig->ul_SCH_Config->maxHARQ_Tx) { - UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx = - (uint16_t) * mac_MainConfig->ul_SCH_Config->maxHARQ_Tx; - } else { - UE_mac_inst[Mod_idP].scheduling_info.maxHARQ_Tx = - (uint16_t) - MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5; - } - phy_config_harq_ue(Mod_idP, 0, eNB_index, - UE_mac_inst[Mod_idP]. - scheduling_info.maxHARQ_Tx); - - if (mac_MainConfig->ul_SCH_Config->retxBSR_Timer) { - UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer = - (uint16_t) mac_MainConfig->ul_SCH_Config-> - retxBSR_Timer; - } else { -#ifndef Rel14 - UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer = - (uint16_t) - MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560; -#else - UE_mac_inst[Mod_idP].scheduling_info.retxBSR_Timer = - (uint16_t) RetxBSR_Timer_r12_sf2560; -#endif - } - } -#if defined(Rel10) || defined(Rel14) - - if (mac_MainConfig->ext1 - && mac_MainConfig->ext1->sr_ProhibitTimer_r9) { - UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = - (uint16_t) * mac_MainConfig->ext1->sr_ProhibitTimer_r9; - } else { - UE_mac_inst[Mod_idP].scheduling_info.sr_ProhibitTimer = 0; + + if(phy_cell_group_config != (PhysicalCellGroupConfig_t *)0){ + } - if (mac_MainConfig->ext2 - && mac_MainConfig->ext2->mac_MainConfig_v1020) { - if (mac_MainConfig->ext2-> - mac_MainConfig_v1020->extendedBSR_Sizes_r10) { - UE_mac_inst[Mod_idP].scheduling_info. - extendedBSR_Sizes_r10 = - (uint16_t) * - mac_MainConfig->ext2-> - mac_MainConfig_v1020->extendedBSR_Sizes_r10; - } else { - UE_mac_inst[Mod_idP].scheduling_info. - extendedBSR_Sizes_r10 = (uint16_t) 0; - } - if (mac_MainConfig->ext2->mac_MainConfig_v1020-> - extendedPHR_r10) { - UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = - (uint16_t) * - mac_MainConfig->ext2->mac_MainConfig_v1020-> - extendedPHR_r10; - } else { - UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = - (uint16_t) 0; - } - } else { - UE_mac_inst[Mod_idP].scheduling_info.extendedBSR_Sizes_r10 = - (uint16_t) 0; - UE_mac_inst[Mod_idP].scheduling_info.extendedPHR_r10 = - (uint16_t) 0; - } -#endif - UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF = - MAC_UE_BSR_TIMER_NOT_RUNNING; - UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF = - MAC_UE_BSR_TIMER_NOT_RUNNING; - - UE_mac_inst[Mod_idP].BSR_reporting_active = BSR_TRIGGER_NONE; - - LOG_D(MAC, "[UE %d]: periodic BSR %d (SF), retx BSR %d (SF)\n", - Mod_idP, - UE_mac_inst[Mod_idP].scheduling_info.periodicBSR_SF, - UE_mac_inst[Mod_idP].scheduling_info.retxBSR_SF); - - UE_mac_inst[Mod_idP].scheduling_info.drx_config = - mac_MainConfig->drx_Config; - UE_mac_inst[Mod_idP].scheduling_info.phr_config = - mac_MainConfig->phr_Config; - - if (mac_MainConfig->phr_Config) { - UE_mac_inst[Mod_idP].PHR_state = - mac_MainConfig->phr_Config->present; - UE_mac_inst[Mod_idP].PHR_reconfigured = 1; - UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer = - mac_MainConfig->phr_Config->choice.setup.periodicPHR_Timer; - UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer = - mac_MainConfig->phr_Config->choice.setup.prohibitPHR_Timer; - UE_mac_inst[Mod_idP].scheduling_info.PathlossChange = - mac_MainConfig->phr_Config->choice.setup.dl_PathlossChange; - } else { - UE_mac_inst[Mod_idP].PHR_reconfigured = 0; - UE_mac_inst[Mod_idP].PHR_state = - MAC_MainConfig__phr_Config_PR_setup; - UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_Timer = - MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20; - UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_Timer = - MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20; - UE_mac_inst[Mod_idP].scheduling_info.PathlossChange = - MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1; + if(spcell_config != (SpCellConfig_t *)0){ + } - UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF = - get_sf_perioidicPHR_Timer(UE_mac_inst[Mod_idP]. - scheduling_info.periodicPHR_Timer); - UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF = - get_sf_prohibitPHR_Timer(UE_mac_inst[Mod_idP]. - scheduling_info.prohibitPHR_Timer); - UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db = - get_db_dl_PathlossChange(UE_mac_inst[Mod_idP]. - scheduling_info.PathlossChange); - UE_mac_inst[Mod_idP].PHR_reporting_active = 0; - LOG_D(MAC, - "[UE %d] config PHR (%d): periodic %d (SF) prohibit %d (SF) pathlosschange %d (db) \n", - Mod_idP, - (mac_MainConfig->phr_Config) ? mac_MainConfig-> - phr_Config->present : -1, - UE_mac_inst[Mod_idP].scheduling_info.periodicPHR_SF, - UE_mac_inst[Mod_idP].scheduling_info.prohibitPHR_SF, - UE_mac_inst[Mod_idP].scheduling_info.PathlossChange_db); - } - - - if (physicalConfigDedicated != NULL) { - phy_config_dedicated_ue(Mod_idP, 0, eNB_index, - physicalConfigDedicated); - UE_mac_inst[Mod_idP].physicalConfigDedicated = physicalConfigDedicated; // for SR proc - } -#if defined(Rel10) || defined(Rel14) - - if (sCellToAddMod_r10 != NULL) { - - - phy_config_dedicated_scell_ue(Mod_idP, eNB_index, - sCellToAddMod_r10, 1); - UE_mac_inst[Mod_idP].physicalConfigDedicatedSCell_r10 = sCellToAddMod_r10->radioResourceConfigDedicatedSCell_r10->physicalConfigDedicatedSCell_r10; // using SCell index 0 - } -#endif - - if (measObj != NULL) { - if (measObj[0] != NULL) { - UE_mac_inst[Mod_idP].n_adj_cells = - measObj[0]->measObject.choice. - measObjectEUTRA.cellsToAddModList->list.count; - LOG_I(MAC, "Number of adjacent cells %d\n", - UE_mac_inst[Mod_idP].n_adj_cells); - - for (i = 0; i < UE_mac_inst[Mod_idP].n_adj_cells; i++) { - UE_mac_inst[Mod_idP].adj_cell_id[i] = - measObj[0]->measObject.choice. - measObjectEUTRA.cellsToAddModList->list.array[i]-> - physCellId; - LOG_I(MAC, "Cell %d : Nid_cell %d\n", i, - UE_mac_inst[Mod_idP].adj_cell_id[i]); - } - - phy_config_meas_ue(Mod_idP, 0, eNB_index, - UE_mac_inst[Mod_idP].n_adj_cells, - UE_mac_inst[Mod_idP].adj_cell_id); - } - } - - - if (mobilityControlInfo != NULL) { - - LOG_D(MAC, "[UE%d] MAC Reset procedure triggered by RRC eNB %d \n", - Mod_idP, eNB_index); - ue_mac_reset(Mod_idP, eNB_index); - - if (mobilityControlInfo->radioResourceConfigCommon. - rach_ConfigCommon) { - memcpy((void *) - &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> - rach_ConfigCommon, - (void *) mobilityControlInfo-> - radioResourceConfigCommon.rach_ConfigCommon, - sizeof(RACH_ConfigCommon_t)); - } - - memcpy((void *) &UE_mac_inst[Mod_idP]. - radioResourceConfigCommon->prach_Config.prach_ConfigInfo, - (void *) mobilityControlInfo-> - radioResourceConfigCommon.prach_Config.prach_ConfigInfo, - sizeof(PRACH_ConfigInfo_t)); - UE_mac_inst[Mod_idP].radioResourceConfigCommon-> - prach_Config.rootSequenceIndex = - mobilityControlInfo->radioResourceConfigCommon. - prach_Config.rootSequenceIndex; - - if (mobilityControlInfo->radioResourceConfigCommon. - pdsch_ConfigCommon) { - memcpy((void *) - &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> - pdsch_ConfigCommon, - (void *) mobilityControlInfo-> - radioResourceConfigCommon.pdsch_ConfigCommon, - sizeof(PDSCH_ConfigCommon_t)); - } - // not a pointer: mobilityControlInfo->radioResourceConfigCommon.pusch_ConfigCommon - memcpy((void *) &UE_mac_inst[Mod_idP]. - radioResourceConfigCommon->pusch_ConfigCommon, - (void *) &mobilityControlInfo-> - radioResourceConfigCommon.pusch_ConfigCommon, - sizeof(PUSCH_ConfigCommon_t)); - - if (mobilityControlInfo->radioResourceConfigCommon.phich_Config) { - /* memcpy((void *)&UE_mac_inst[Mod_idP].radioResourceConfigCommon->phich_Config, - (void *)mobilityControlInfo->radioResourceConfigCommon.phich_Config, - sizeof(PHICH_Config_t)); */ - } - - if (mobilityControlInfo->radioResourceConfigCommon. - pucch_ConfigCommon) { - memcpy((void *) - &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> - pucch_ConfigCommon, - (void *) mobilityControlInfo-> - radioResourceConfigCommon.pucch_ConfigCommon, - sizeof(PUCCH_ConfigCommon_t)); - } - - if (mobilityControlInfo-> - radioResourceConfigCommon.soundingRS_UL_ConfigCommon) { - memcpy((void *) - &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> - soundingRS_UL_ConfigCommon, - (void *) mobilityControlInfo-> - radioResourceConfigCommon.soundingRS_UL_ConfigCommon, - sizeof(SoundingRS_UL_ConfigCommon_t)); - } - - if (mobilityControlInfo-> - radioResourceConfigCommon.uplinkPowerControlCommon) { - memcpy((void *) - &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> - uplinkPowerControlCommon, - (void *) mobilityControlInfo-> - radioResourceConfigCommon.uplinkPowerControlCommon, - sizeof(UplinkPowerControlCommon_t)); - } - //configure antennaInfoCommon somewhere here.. - if (mobilityControlInfo->radioResourceConfigCommon.p_Max) { - //to be configured - } - - if (mobilityControlInfo->radioResourceConfigCommon.tdd_Config) { - UE_mac_inst[Mod_idP].tdd_Config = - mobilityControlInfo->radioResourceConfigCommon.tdd_Config; - } - - if (mobilityControlInfo-> - radioResourceConfigCommon.ul_CyclicPrefixLength) { - memcpy((void *) - &UE_mac_inst[Mod_idP].radioResourceConfigCommon-> - ul_CyclicPrefixLength, - (void *) mobilityControlInfo-> - radioResourceConfigCommon.ul_CyclicPrefixLength, - sizeof(UL_CyclicPrefixLength_t)); - } - // store the previous rnti in case of failure, and set thenew rnti - UE_mac_inst[Mod_idP].crnti_before_ho = UE_mac_inst[Mod_idP].crnti; - UE_mac_inst[Mod_idP].crnti = - ((mobilityControlInfo-> - newUE_Identity.buf[0]) | (mobilityControlInfo-> - newUE_Identity.buf[1] << 8)); - LOG_I(MAC, "[UE %d] Received new identity %x from %d\n", Mod_idP, - UE_mac_inst[Mod_idP].crnti, eNB_index); - UE_mac_inst[Mod_idP].rach_ConfigDedicated = - malloc(sizeof(*mobilityControlInfo->rach_ConfigDedicated)); - - if (mobilityControlInfo->rach_ConfigDedicated) { - memcpy((void *) UE_mac_inst[Mod_idP].rach_ConfigDedicated, - (void *) mobilityControlInfo->rach_ConfigDedicated, - sizeof(*mobilityControlInfo->rach_ConfigDedicated)); - } - - phy_config_afterHO_ue(Mod_idP, 0, eNB_index, mobilityControlInfo, - 0); - } - - - if (mbsfn_SubframeConfigList != NULL) { - LOG_I(MAC, - "[UE %d][CONFIG] Received %d subframe allocation pattern for MBSFN\n", - Mod_idP, mbsfn_SubframeConfigList->list.count); - UE_mac_inst[Mod_idP].num_sf_allocation_pattern = - mbsfn_SubframeConfigList->list.count; - - for (i = 0; i < mbsfn_SubframeConfigList->list.count; i++) { - LOG_I(MAC, - "[UE %d] Configuring MBSFN_SubframeConfig %d from received SIB2 \n", - Mod_idP, i); - UE_mac_inst[Mod_idP].mbsfn_SubframeConfig[i] = - mbsfn_SubframeConfigList->list.array[i]; - // LOG_I("[UE %d] MBSFN_SubframeConfig[%d] pattern is %ld\n", Mod_idP, - // UE_mac_inst[Mod_idP].mbsfn_SubframeConfig[i]->subframeAllocation.choice.oneFrame.buf[0]); - } - } -#if defined(Rel10) || defined(Rel14) - - if (mbsfn_AreaInfoList != NULL) { - LOG_I(MAC, "[UE %d][CONFIG] Received %d MBSFN Area Info\n", - Mod_idP, mbsfn_AreaInfoList->list.count); - UE_mac_inst[Mod_idP].num_active_mbsfn_area = - mbsfn_AreaInfoList->list.count; - - for (i = 0; i < mbsfn_AreaInfoList->list.count; i++) { - UE_mac_inst[Mod_idP].mbsfn_AreaInfo[i] = - mbsfn_AreaInfoList->list.array[i]; - LOG_I(MAC, - "[UE %d] MBSFN_AreaInfo[%d]: MCCH Repetition Period = %ld\n", - Mod_idP, i, - UE_mac_inst[Mod_idP].mbsfn_AreaInfo[i]-> - mcch_Config_r9.mcch_RepetitionPeriod_r9); - phy_config_sib13_ue(Mod_idP, 0, eNB_index, i, - UE_mac_inst[Mod_idP]. - mbsfn_AreaInfo[i]->mbsfn_AreaId_r9); - } - } - - if (pmch_InfoList != NULL) { - - // LOG_I(MAC,"DUY: lcid when entering rrc_mac config_req is %02d\n",(pmch_InfoList->list.array[0]->mbms_SessionInfoList_r9.list.array[0]->logicalChannelIdentity_r9)); - - LOG_I(MAC, "[UE %d] Configuring PMCH_config from MCCH MESSAGE \n", - Mod_idP); - - for (i = 0; i < pmch_InfoList->list.count; i++) { - UE_mac_inst[Mod_idP].pmch_Config[i] = - &pmch_InfoList->list.array[i]->pmch_Config_r9; - LOG_I(MAC, "[UE %d] PMCH[%d]: MCH_Scheduling_Period = %ld\n", - Mod_idP, i, - UE_mac_inst[Mod_idP]. - pmch_Config[i]->mch_SchedulingPeriod_r9); - } - - UE_mac_inst[Mod_idP].mcch_status = 1; - } -#endif -#ifdef CBA - - if (cba_rnti) { - UE_mac_inst[Mod_idP].cba_rnti[num_active_cba_groups - 1] = - cba_rnti; - LOG_D(MAC, - "[UE %d] configure CBA group %d RNTI %x for eNB %d (total active cba group %d)\n", - Mod_idP, Mod_idP % num_active_cba_groups, cba_rnti, - eNB_index, num_active_cba_groups); - phy_config_cba_rnti(Mod_idP, CC_idP, eNB_flagP, eNB_index, - cba_rnti, num_active_cba_groups - 1, - num_active_cba_groups); - } -#endif - VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME - (VCD_SIGNAL_DUMPER_FUNCTIONS_RRC_MAC_CONFIG, VCD_FUNCTION_OUT); - - return (0); + return (0); } diff --git a/openair2/LAYER2/NR_MAC_UE/defs.h b/openair2/LAYER2/NR_MAC_UE/defs.h index e3f5d954f1..b2a3ec259f 100644 --- a/openair2/LAYER2/NR_MAC_UE/defs.h +++ b/openair2/LAYER2/NR_MAC_UE/defs.h @@ -68,1293 +68,18 @@ #include "nfapi_interface.h" #include "PHY_INTERFACE/IF_Module.h" -/** @defgroup _mac MAC - * @ingroup _oai2 - * @{ - */ -#define BCCH_PAYLOAD_SIZE_MAX 128 -#define CCCH_PAYLOAD_SIZE_MAX 128 -#define PCCH_PAYLOAD_SIZE_MAX 128 -#define RAR_PAYLOAD_SIZE_MAX 128 - -#define SCH_PAYLOAD_SIZE_MAX 4096 -/// Logical channel ids from 36-311 (Note BCCH is not specified in 36-311, uses the same as first DRB) - -#if defined(Rel10) || defined(Rel14) - -// Mask for identifying subframe for MBMS -#define MBSFN_TDD_SF3 0x80 // for TDD -#define MBSFN_TDD_SF4 0x40 -#define MBSFN_TDD_SF7 0x20 -#define MBSFN_TDD_SF8 0x10 -#define MBSFN_TDD_SF9 0x08 -#define MBSFN_FDD_SF1 0x80 // for FDD -#define MBSFN_FDD_SF2 0x40 -#define MBSFN_FDD_SF3 0x20 -#define MBSFN_FDD_SF6 0x10 -#define MBSFN_FDD_SF7 0x08 -#define MBSFN_FDD_SF8 0x04 - -#define MAX_MBSFN_AREA 8 -#define MAX_PMCH_perMBSFN 15 -/*!\brief MAX MCCH payload size */ -#define MCCH_PAYLOAD_SIZE_MAX 128 -//#define MCH_PAYLOAD_SIZE_MAX 16384// this value is using in case mcs and TBS index are high -#endif - -#define printk printf - -/*!\brief Maximum number of logical channl group IDs */ -#define MAX_NUM_LCGID 4 -/*!\brief logical channl group ID 0 */ -#define LCGID0 0 -/*!\brief logical channl group ID 1 */ -#define LCGID1 1 -/*!\brief logical channl group ID 2 */ -#define LCGID2 2 -/*!\brief logical channl group ID 3 */ -#define LCGID3 3 -/*!\brief Maximum number of logical chanels */ -#define MAX_NUM_LCID 11 -/*!\brief Maximum number od control elemenets */ -#define MAX_NUM_CE 5 -/*!\brief Maximum number of random access process */ -#if defined(USRP_REC_PLAY) -#define NB_RA_PROC_MAX 1 -#else -#define NB_RA_PROC_MAX 4 -#endif -/*!\brief size of buffer status report table */ -#define BSR_TABLE_SIZE 64 -/*!\brief The power headroom reporting range is from -23 ...+40 dB and beyond, with step 1 */ -#define PHR_MAPPING_OFFSET 23 // if ( x>= -23 ) val = floor (x + 23) -/*!\brief maximum number of resource block groups */ -#define N_RBG_MAX 25 // for 20MHz channel BW -/*!\brief minimum value for channel quality indicator */ -#define MIN_CQI_VALUE 0 -/*!\brief maximum value for channel quality indicator */ -#define MAX_CQI_VALUE 15 -/*!\briefmaximum number of supported bandwidth (1.4, 5, 10, 20 MHz) */ -#define MAX_SUPPORTED_BW 4 -/*!\brief CQI values range from 1 to 15 (4 bits) */ -#define CQI_VALUE_RANGE 16 - -/*!\brief value for indicating BSR Timer is not running */ -#define MAC_UE_BSR_TIMER_NOT_RUNNING (0xFFFF) - -#define LCID_EMPTY 0 -#define LCID_NOT_EMPTY 1 - -/*!\brief minimum RLC PDU size to be transmitted = min RLC Status PDU or RLC UM PDU SN 5 bits */ -#define MIN_RLC_PDU_SIZE (2) - -/*!\brief minimum MAC data needed for transmitting 1 min RLC PDU size + 1 byte MAC subHeader */ -#define MIN_MAC_HDR_RLC_SIZE (1 + MIN_RLC_PDU_SIZE) - -/*!\brief maximum number of slices / groups */ -#define MAX_NUM_SLICES 4 - -#define U_PLANE_INACTIVITY_VALUE 6000 - -/* - * eNB part - */ - - -/* - * UE/ENB common part - */ -/*!\brief MAC header of Random Access Response for Random access preamble identifier (RAPID) */ -typedef struct { - uint8_t RAPID:6; - uint8_t T:1; - uint8_t E:1; -} __attribute__ ((__packed__)) RA_HEADER_RAPID; - -/*!\brief MAC header of Random Access Response for backoff indicator (BI)*/ -typedef struct { - uint8_t BI:4; - uint8_t R:2; - uint8_t T:1; - uint8_t E:1; -} __attribute__ ((__packed__)) RA_HEADER_BI; -/* -typedef struct { - uint64_t padding:16; - uint64_t t_crnti:16; - uint64_t hopping_flag:1; - uint64_t rb_alloc:10; - uint64_t mcs:4; - uint64_t TPC:3; - uint64_t UL_delay:1; - uint64_t cqi_req:1; - uint64_t Timing_Advance_Command:11; // first/2nd octet LSB - uint64_t R:1; // octet MSB - } __attribute__((__packed__))RAR_PDU; - -typedef struct { - uint64_t padding:16; - uint64_t R:1; // octet MSB - uint64_t Timing_Advance_Command:11; // first/2nd octet LSB - uint64_t cqi_req:1; - uint64_t UL_delay:1; - uint64_t TPC:3; - uint64_t mcs:4; - uint64_t rb_alloc:10; - uint64_t hopping_flag:1; - uint64_t t_crnti:16; - } __attribute__((__packed__))RAR_PDU; - -#define sizeof_RAR_PDU 6 -*/ -/*!\brief MAC subheader short with 7bit Length field */ -typedef struct { - uint8_t LCID:5; // octet 1 LSB - uint8_t E:1; - uint8_t R:2; // octet 1 MSB - uint8_t L:7; // octet 2 LSB - uint8_t F:1; // octet 2 MSB -} __attribute__ ((__packed__)) SCH_SUBHEADER_SHORT; -/*!\brief MAC subheader long with 15bit Length field */ -typedef struct { - uint8_t LCID:5; // octet 1 LSB - uint8_t E:1; - uint8_t R:2; // octet 1 MSB - uint8_t L_MSB:7; - uint8_t F:1; // octet 2 MSB - uint8_t L_LSB:8; - uint8_t padding; -} __attribute__ ((__packed__)) SCH_SUBHEADER_LONG; -/*!\brief MAC subheader short without length field */ -typedef struct { - uint8_t LCID:5; - uint8_t E:1; - uint8_t R:2; -} __attribute__ ((__packed__)) SCH_SUBHEADER_FIXED; - -/*!\brief mac control element: short buffer status report for a specific logical channel group ID*/ -typedef struct { - uint8_t Buffer_size:6; // octet 1 LSB - uint8_t LCGID:2; // octet 1 MSB -} __attribute__ ((__packed__)) BSR_SHORT; - -typedef BSR_SHORT BSR_TRUNCATED; -/*!\brief mac control element: long buffer status report for all logical channel group ID*/ -typedef struct { - uint8_t Buffer_size3:6; - uint8_t Buffer_size2:6; - uint8_t Buffer_size1:6; - uint8_t Buffer_size0:6; -} __attribute__ ((__packed__)) BSR_LONG; - -#define BSR_LONG_SIZE (sizeof(BSR_LONG)) -/*!\brief mac control element: timing advance */ -typedef struct { - uint8_t TA:6; - uint8_t R:2; -} __attribute__ ((__packed__)) TIMING_ADVANCE_CMD; -/*!\brief mac control element: power headroom report */ -typedef struct { - uint8_t PH:6; - uint8_t R:2; -} __attribute__ ((__packed__)) POWER_HEADROOM_CMD; - -/*! \brief MIB payload */ -typedef struct { - uint8_t payload[3]; -} __attribute__ ((__packed__)) MIB_PDU; -/*! \brief CCCH payload */ -typedef struct { - uint8_t payload[CCCH_PAYLOAD_SIZE_MAX]; -} __attribute__ ((__packed__)) CCCH_PDU; -/*! \brief BCCH payload */ -typedef struct { - uint8_t payload[BCCH_PAYLOAD_SIZE_MAX]; -} __attribute__ ((__packed__)) BCCH_PDU; -/*! \brief RAR payload */ -typedef struct { - uint8_t payload[RAR_PAYLOAD_SIZE_MAX]; -} __attribute__ ((__packed__)) RAR_PDU; -/*! \brief BCCH payload */ -typedef struct { - uint8_t payload[PCCH_PAYLOAD_SIZE_MAX]; -} __attribute__ ((__packed__)) PCCH_PDU; - -#if defined(Rel10) || defined(Rel14) -/*! \brief MCCH payload */ -typedef struct { - uint8_t payload[MCCH_PAYLOAD_SIZE_MAX]; -} __attribute__ ((__packed__)) MCCH_PDU; -/*!< \brief MAC control element for activation and deactivation of component carriers */ -typedef struct { - uint8_t C7:1; /*!< \brief Component carrier 7 */ - uint8_t C6:1; /*!< \brief Component carrier 6 */ - uint8_t C5:1; /*!< \brief Component carrier 5 */ - uint8_t C4:1; /*!< \brief Component carrier 4 */ - uint8_t C3:1; /*!< \brief Component carrier 3 */ - uint8_t C2:1; /*!< \brief Component carrier 2 */ - uint8_t C1:1; /*!< \brief Component carrier 1 */ - uint8_t R:1; /*!< \brief Reserved */ -} __attribute__ ((__packed__)) CC_ELEMENT; -/*! \brief MAC control element: MCH Scheduling Information */ -typedef struct { - uint8_t stop_sf_MSB:3; // octet 1 LSB - uint8_t lcid:5; // octet 2 MSB - uint8_t stop_sf_LSB:8; -} __attribute__ ((__packed__)) MSI_ELEMENT; -#endif -/*! \brief Values of CCCH LCID for DLSCH */ -#define CCCH_LCHANID 0 -/*!\brief Values of BCCH logical channel (fake)*/ -#define BCCH 3 // SI -/*!\brief Values of PCCH logical channel (fake)*/ -#define PCCH 4 // Paging -/*!\brief Values of PCCH logical channel (fake) */ -#define MIBCH 5 // MIB -/*!\brief Values of BCCH SIB1_BR logical channel (fake) */ -#define BCCH_SIB1_BR 6 // SIB1_BR -/*!\brief Values of BCCH SIB_BR logical channel (fake) */ -#define BCCH_SI_BR 7 // SI-BR -/*!\brief Value of CCCH / SRB0 logical channel */ -#define CCCH 0 // srb0 -/*!\brief DCCH / SRB1 logical channel */ -#define DCCH 1 // srb1 -/*!\brief DCCH1 / SRB2 logical channel */ -#define DCCH1 2 // srb2 -/*!\brief DTCH DRB1 logical channel */ -#define DTCH 3 // LCID -/*!\brief MCCH logical channel */ -#define MCCH 4 -/*!\brief MTCH logical channel */ -#define MTCH 1 -// DLSCH LCHAN ID -/*!\brief LCID of UE contention resolution identity for DLSCH*/ -#define UE_CONT_RES 28 -/*!\brief LCID of timing advance for DLSCH */ -#define TIMING_ADV_CMD 29 -/*!\brief LCID of discontinous reception mode for DLSCH */ -#define DRX_CMD 30 -/*!\brief LCID of padding LCID for DLSCH */ -#define SHORT_PADDING 31 - -#if defined(Rel10) || defined(Rel14) -// MCH LCHAN IDs (table6.2.1-4 TS36.321) -/*!\brief LCID of MCCH for DL */ -#define MCCH_LCHANID 0 -/*!\brief LCID of MCH scheduling info for DL */ -#define MCH_SCHDL_INFO 3 -/*!\brief LCID of Carrier component activation/deactivation */ -#define CC_ACT_DEACT 27 -#endif - -// ULSCH LCHAN IDs -/*!\brief LCID of extended power headroom for ULSCH */ -#define EXTENDED_POWER_HEADROOM 25 -/*!\brief LCID of power headroom for ULSCH */ -#define POWER_HEADROOM 26 -/*!\brief LCID of CRNTI for ULSCH */ -#define CRNTI 27 -/*!\brief LCID of truncated BSR for ULSCH */ -#define TRUNCATED_BSR 28 -/*!\brief LCID of short BSR for ULSCH */ -#define SHORT_BSR 29 -/*!\brief LCID of long BSR for ULSCH */ -#define LONG_BSR 30 -/*!\bitmaps for BSR Triggers */ -#define BSR_TRIGGER_NONE (0) /* No BSR Trigger */ -#define BSR_TRIGGER_REGULAR (1) /* For Regular and ReTxBSR Expiry Triggers */ -#define BSR_TRIGGER_PERIODIC (2) /* For BSR Periodic Timer Expiry Trigger */ -#define BSR_TRIGGER_PADDING (4) /* For Padding BSR Trigger */ - - -/*! \brief Downlink SCH PDU Structure */ -typedef struct { - uint8_t payload[8][SCH_PAYLOAD_SIZE_MAX]; - uint16_t Pdu_size[8]; -} __attribute__ ((__packed__)) DLSCH_PDU; - - -/*! \brief MCH PDU Structure */ -typedef struct { - int8_t payload[SCH_PAYLOAD_SIZE_MAX]; - uint16_t Pdu_size; - uint8_t mcs; - uint8_t sync_area; - uint8_t msi_active; - uint8_t mcch_active; - uint8_t mtch_active; -} __attribute__ ((__packed__)) MCH_PDU; - -/*! \brief Uplink SCH PDU Structure */ -typedef struct { - int8_t payload[SCH_PAYLOAD_SIZE_MAX]; /*!< \brief SACH payload */ - uint16_t Pdu_size; -} __attribute__ ((__packed__)) ULSCH_PDU; - -#include "PHY/impl_defs_top.h" - -/*!\brief RA process state*/ -typedef enum { - IDLE = 0, - MSG2, - WAITMSG3, - MSG4, - WAITMSG4ACK -} RA_state; - -/*!\brief UE ULSCH scheduling states*/ -typedef enum { - S_UL_NONE = 0, - S_UL_WAITING, - S_UL_SCHEDULED, - S_UL_BUFFERED, - S_UL_NUM_STATUS -} UE_ULSCH_STATUS; - -/*!\brief UE DLSCH scheduling states*/ -typedef enum { - S_DL_NONE = 0, - S_DL_WAITING, - S_DL_SCHEDULED, - S_DL_BUFFERED, - S_DL_NUM_STATUS -} UE_DLSCH_STATUS; - -/*!\brief scheduling policy for the contention-based access */ -typedef enum { - CBA_ES = 0, /// equal share of RB among groups w - CBA_ES_S, /// equal share of RB among groups with small allocation - CBA_PF, /// proportional fair (kind of) - CBA_PF_S, /// proportional fair (kind of) with small RB allocation - CBA_RS /// random allocation -} CBA_POLICY; - - -/*! \brief temporary struct for ULSCH sched */ -typedef struct { - rnti_t rnti; - uint16_t subframe; - uint16_t serving_num; - UE_ULSCH_STATUS status; -} eNB_ULSCH_INFO; -/*! \brief temp struct for DLSCH sched */ -typedef struct { - rnti_t rnti; - uint16_t weight; - uint16_t subframe; - uint16_t serving_num; - UE_DLSCH_STATUS status; -} eNB_DLSCH_INFO; -/*! \brief eNB overall statistics */ -typedef struct { - /// num BCCH PDU per CC - uint32_t total_num_bcch_pdu; - /// BCCH buffer size - uint32_t bcch_buffer; - /// total BCCH buffer size - uint32_t total_bcch_buffer; - /// BCCH MCS - uint32_t bcch_mcs; - - /// num CCCH PDU per CC - uint32_t total_num_ccch_pdu; - /// BCCH buffer size - uint32_t ccch_buffer; - /// total BCCH buffer size - uint32_t total_ccch_buffer; - /// BCCH MCS - uint32_t ccch_mcs; - - /// num PCCH PDU per CC - uint32_t total_num_pcch_pdu; - /// PCCH buffer size - uint32_t pcch_buffer; - /// total PCCH buffer size - uint32_t total_pcch_buffer; - /// BCCH MCS - uint32_t pcch_mcs; - -/// num active users - uint16_t num_dlactive_UEs; - /// available number of PRBs for a give SF - uint16_t available_prbs; - /// total number of PRB available for the user plane - uint32_t total_available_prbs; - /// aggregation - /// total avilable nccc : num control channel element - uint16_t available_ncces; - // only for a new transmission, should be extended for retransmission - // current dlsch bit rate for all transport channels - uint32_t dlsch_bitrate; - // - uint32_t dlsch_bytes_tx; - // - uint32_t dlsch_pdus_tx; - // - uint32_t total_dlsch_bitrate; - // - uint32_t total_dlsch_bytes_tx; - // - uint32_t total_dlsch_pdus_tx; - - // here for RX - // - uint32_t ulsch_bitrate; - // - uint32_t ulsch_bytes_rx; - // - uint64_t ulsch_pdus_rx; - - uint32_t total_ulsch_bitrate; - // - uint32_t total_ulsch_bytes_rx; - // - uint32_t total_ulsch_pdus_rx; - - - /// MAC agent-related stats - /// total number of scheduling decisions - int sched_decisions; - /// missed deadlines - int missed_deadlines; - -} eNB_STATS; -/*! \brief eNB statistics for the connected UEs*/ -typedef struct { - - /// CRNTI of UE - rnti_t crnti; ///user id (rnti) of connected UEs - // rrc status - uint8_t rrc_status; - /// harq pid - uint8_t harq_pid; - /// harq rounf - uint8_t harq_round; - /// total available number of PRBs for a new transmission - uint16_t rbs_used; - /// total available number of PRBs for a retransmission - uint16_t rbs_used_retx; - /// total nccc used for a new transmission: num control channel element - uint16_t ncce_used; - /// total avilable nccc for a retransmission: num control channel element - uint16_t ncce_used_retx; - - // mcs1 before the rate adaptaion - uint8_t dlsch_mcs1; - /// Target mcs2 after rate-adaptation - uint8_t dlsch_mcs2; - // current TBS with mcs2 - uint32_t TBS; - // total TBS with mcs2 - // uint32_t total_TBS; - // total rb used for a new transmission - uint32_t total_rbs_used; - // total rb used for retransmission - uint32_t total_rbs_used_retx; - - /// TX - /// Num pkt - uint32_t num_pdu_tx[NB_RB_MAX]; - /// num bytes - uint32_t num_bytes_tx[NB_RB_MAX]; - /// num retransmission / harq - uint32_t num_retransmission; - /// instantaneous tx throughput for each TTI - // uint32_t tti_throughput[NB_RB_MAX]; - // Number of received MAC SDU - uint32_t num_mac_sdu_tx; - // LCID related to SDU - unsigned char lcid_sdu[NB_RB_MAX]; - // Length of SDU Got from LC DL - uint32_t sdu_length_tx[NB_RB_MAX]; - - - /// overall - // - uint32_t dlsch_bitrate; - //total - uint32_t total_dlsch_bitrate; - /// headers+ CE + padding bytes for a MAC PDU - uint64_t overhead_bytes; - /// headers+ CE + padding bytes for a MAC PDU - uint64_t total_overhead_bytes; - /// headers+ CE + padding bytes for a MAC PDU - uint64_t avg_overhead_bytes; - // MAC multiplexed payload - uint64_t total_sdu_bytes; - // total MAC pdu bytes - uint64_t total_pdu_bytes; - - // total num pdu - uint32_t total_num_pdus; - // - // uint32_t avg_pdu_size; - - /// RX - - /// PUCCH1a/b power (dBm) - int32_t Po_PUCCH_dBm; - /// Indicator that Po_PUCCH has been updated by PHY - int32_t Po_PUCCH_update; - /// Uplink measured RSSI - int32_t UL_rssi; - /// preassigned mcs after rate adaptation - uint8_t ulsch_mcs1; - /// adjusted mcs - uint8_t ulsch_mcs2; - - /// estimated average pdu inter-departure time - uint32_t avg_pdu_idt; - /// estimated average pdu size - uint32_t avg_pdu_ps; - /// - uint32_t aggregated_pdu_size; - uint32_t aggregated_pdu_arrival; - - /// uplink transport block size - uint32_t ulsch_TBS; - - uint32_t total_ulsch_TBS; - - /// total rb used for a new uplink transmission - uint32_t num_retransmission_rx; - /// total rb used for a new uplink transmission - uint32_t rbs_used_rx; - /// total rb used for a new uplink retransmission - uint32_t rbs_used_retx_rx; - /// total rb used for a new uplink transmission - uint32_t total_rbs_used_rx; - /// normalized rx power - int32_t normalized_rx_power; - /// target rx power - int32_t target_rx_power; - - /// num rx pdu - uint32_t num_pdu_rx[NB_RB_MAX]; - /// num bytes rx - uint32_t num_bytes_rx[NB_RB_MAX]; - /// instantaneous rx throughput for each TTI - // uint32_t tti_goodput[NB_RB_MAX]; - /// errors - uint32_t num_errors_rx; - - uint64_t overhead_bytes_rx; - /// headers+ CE + padding bytes for a MAC PDU - uint64_t total_overhead_bytes_rx; - /// headers+ CE + padding bytes for a MAC PDU - uint64_t avg_overhead_bytes_rx; - // - uint32_t ulsch_bitrate; - //total - uint32_t total_ulsch_bitrate; - /// overall - /// MAC pdu bytes - uint64_t pdu_bytes_rx; - /// total MAC pdu bytes - uint64_t total_pdu_bytes_rx; - /// total num pdu - uint32_t total_num_pdus_rx; - /// num of error pdus - uint32_t total_num_errors_rx; - // Number of error PDUS - uint32_t num_mac_sdu_rx; - // Length of SDU Got from LC UL - Size array can be refined - uint32_t sdu_length_rx[NB_RB_MAX]; - -} eNB_UE_STATS; -/*! \brief eNB template for UE context information */ -typedef struct { - /// C-RNTI of UE - rnti_t rnti; - /// NDI from last scheduling - uint8_t oldNDI[8]; - /// mcs1 from last scheduling - uint8_t oldmcs1[8]; - /// mcs2 from last scheduling - uint8_t oldmcs2[8]; - /// NDI from last UL scheduling - uint8_t oldNDI_UL[8]; - /// mcs from last UL scheduling - uint8_t mcs_UL[8]; - /// TBS from last UL scheduling - int TBS_UL[8]; - /// Flag to indicate UL has been scheduled at least once - boolean_t ul_active; - /// Flag to indicate UE has been configured (ACK from RRCConnectionSetup received) - boolean_t configured; - - /// MCS from last scheduling - uint8_t mcs[8]; - - /// TPC from last scheduling - uint8_t oldTPC[8]; - - // PHY interface info - - /// Number of Allocated RBs for DL after scheduling (prior to frequency allocation) - uint16_t nb_rb[8]; // num_max_harq - - /// Number of Allocated RBs for UL after scheduling - uint16_t nb_rb_ul[8]; // num_max_harq - - /// Number of Allocated RBs for UL after scheduling - uint16_t first_rb_ul[8]; // num_max_harq - - /// Cyclic shift for DMRS after scheduling - uint16_t cshift[8]; // num_max_harq - - /// Number of Allocated RBs by the ulsch preprocessor - uint8_t pre_allocated_nb_rb_ul[MAX_NUM_SLICES]; - - /// index of Allocated RBs by the ulsch preprocessor - int8_t pre_allocated_rb_table_index_ul; - - /// total allocated RBs - int8_t total_allocated_rbs; - - /// pre-assigned MCS by the ulsch preprocessor - uint8_t pre_assigned_mcs_ul; - - /// assigned MCS by the ulsch scheduler - uint8_t assigned_mcs_ul; - - /// DL DAI - uint8_t DAI; - - /// UL DAI - uint8_t DAI_ul[10]; - - /// UL Scheduling Request Received - uint8_t ul_SR; - - ///Resource Block indication for each sub-band in MU-MIMO - uint8_t rballoc_subband[8][50]; - - // Logical channel info for link with RLC - - /// LCGID mapping - long lcgidmap[11]; - - /// phr information - int8_t phr_info; - - /// phr information - int8_t phr_info_configured; - - ///dl buffer info - uint32_t dl_buffer_info[MAX_NUM_LCID]; - /// total downlink buffer info - uint32_t dl_buffer_total; - /// total downlink pdus - uint32_t dl_pdus_total; - /// downlink pdus for each LCID - uint32_t dl_pdus_in_buffer[MAX_NUM_LCID]; - /// creation time of the downlink buffer head for each LCID - uint32_t dl_buffer_head_sdu_creation_time[MAX_NUM_LCID]; - /// maximum creation time of the downlink buffer head across all LCID - uint32_t dl_buffer_head_sdu_creation_time_max; - /// a flag indicating that the downlink head SDU is segmented - uint8_t dl_buffer_head_sdu_is_segmented[MAX_NUM_LCID]; - /// size of remaining size to send for the downlink head SDU - uint32_t dl_buffer_head_sdu_remaining_size_to_send[MAX_NUM_LCID]; - - /// uplink buffer creation time for each LCID - uint32_t ul_buffer_creation_time[MAX_NUM_LCGID]; - /// maximum uplink buffer creation time across all the LCIDs - uint32_t ul_buffer_creation_time_max; - /// uplink buffer size per LCID - uint32_t ul_buffer_info[MAX_NUM_LCGID]; - - /// uplink bytes that are currently scheduled - int scheduled_ul_bytes; - /// estimation of the UL buffer size - int estimated_ul_buffer; - - /// UE tx power - int32_t ue_tx_power; - - /// stores the frame where the last TPC was transmitted - uint32_t pusch_tpc_tx_frame; - uint32_t pusch_tpc_tx_subframe; - uint32_t pucch_tpc_tx_frame; - uint32_t pucch_tpc_tx_subframe; - -#ifdef LOCALIZATION - eNB_UE_estimated_distances distance; -#endif - -#ifdef Rel14 - uint8_t rach_resource_type; - uint16_t mpdcch_repetition_cnt; - frame_t Msg2_frame; -#endif - sub_frame_t Msg2_subframe; - - PhysicalConfigDedicated_t *physicalConfigDedicated; - -} UE_TEMPLATE; - -/*! \brief scheduling control information set through an API (not used)*/ -typedef struct { - ///UL transmission bandwidth in RBs - uint8_t ul_bandwidth[MAX_NUM_LCID]; - ///DL transmission bandwidth in RBs - uint8_t dl_bandwidth[MAX_NUM_LCID]; - - //To do GBR bearer - uint8_t min_ul_bandwidth[MAX_NUM_LCID]; - - uint8_t min_dl_bandwidth[MAX_NUM_LCID]; - - ///aggregated bit rate of non-gbr bearer per UE - uint64_t ue_AggregatedMaximumBitrateDL; - ///aggregated bit rate of non-gbr bearer per UE - uint64_t ue_AggregatedMaximumBitrateUL; - ///CQI scheduling interval in subframes. - uint16_t cqiSchedInterval; - ///Contention resolution timer used during random access - uint8_t mac_ContentionResolutionTimer; - - uint16_t max_rbs_allowed_slice[MAX_NUM_CCs][MAX_NUM_SLICES]; - uint16_t max_rbs_allowed_slice_uplink[MAX_NUM_CCs][MAX_NUM_SLICES]; - - uint8_t max_mcs[MAX_NUM_LCID]; - - uint16_t priority[MAX_NUM_LCID]; - - // resource scheduling information - - /// Current DL harq round per harq_pid on each CC - uint8_t round[MAX_NUM_CCs][10]; - /// Current Active TBs per harq_pid on each CC - uint8_t tbcnt[MAX_NUM_CCs][10]; - /// Current UL harq round per harq_pid on each CC - uint8_t round_UL[MAX_NUM_CCs][8]; - uint8_t dl_pow_off[MAX_NUM_CCs]; - uint16_t pre_nb_available_rbs[MAX_NUM_CCs]; - unsigned char rballoc_sub_UE[MAX_NUM_CCs][N_RBG_MAX]; - uint16_t ta_timer; - int16_t ta_update; - uint16_t ul_consecutive_errors; - int32_t context_active_timer; - int32_t cqi_req_timer; - int32_t ul_inactivity_timer; - int32_t ul_failure_timer; - uint32_t ue_reestablishment_reject_timer; - uint32_t ue_reestablishment_reject_timer_thres; - int32_t ul_scheduled; - int32_t ra_pdcch_order_sent; - int32_t ul_out_of_sync; - int32_t phr_received; - uint8_t periodic_ri_received[NFAPI_CC_MAX]; - uint8_t aperiodic_ri_received[NFAPI_CC_MAX]; - uint8_t pucch1_cqi_update[NFAPI_CC_MAX]; - uint8_t pucch1_snr[NFAPI_CC_MAX]; - uint8_t pucch2_cqi_update[NFAPI_CC_MAX]; - uint8_t pucch2_snr[NFAPI_CC_MAX]; - uint8_t pucch3_cqi_update[NFAPI_CC_MAX]; - uint8_t pucch3_snr[NFAPI_CC_MAX]; - uint8_t pusch_snr[NFAPI_CC_MAX]; - uint16_t feedback_cnt[NFAPI_CC_MAX]; - uint16_t timing_advance; - uint16_t timing_advance_r9; - uint8_t periodic_wideband_cqi[NFAPI_CC_MAX]; - uint8_t periodic_wideband_spatial_diffcqi[NFAPI_CC_MAX]; - uint8_t periodic_wideband_pmi[NFAPI_CC_MAX]; - uint8_t periodic_subband_cqi[NFAPI_CC_MAX][16]; - uint8_t periodic_subband_spatial_diffcqi[NFAPI_CC_MAX][16]; - uint8_t aperiodic_subband_cqi0[NFAPI_CC_MAX][25]; - uint8_t aperiodic_subband_pmi[NFAPI_CC_MAX][25]; - uint8_t aperiodic_subband_diffcqi0[NFAPI_CC_MAX][25]; - uint8_t aperiodic_subband_cqi1[NFAPI_CC_MAX][25]; - uint8_t aperiodic_subband_diffcqi1[NFAPI_CC_MAX][25]; - uint8_t aperiodic_wideband_cqi0[NFAPI_CC_MAX]; - uint8_t aperiodic_wideband_pmi[NFAPI_CC_MAX]; - uint8_t aperiodic_wideband_cqi1[NFAPI_CC_MAX]; - uint8_t aperiodic_wideband_pmi1[NFAPI_CC_MAX]; - uint8_t dl_cqi[NFAPI_CC_MAX]; - int32_t uplane_inactivity_timer; -} UE_sched_ctrl; -/*! \brief eNB template for the Random access information */ -typedef struct { - /// Flag to indicate this process is active - RA_state state; - /// Subframe where preamble was received - uint8_t preamble_subframe; - /// Subframe where Msg2 is to be sent - uint8_t Msg2_subframe; - /// Frame where Msg2 is to be sent - frame_t Msg2_frame; - /// Subframe where Msg3 is to be sent - sub_frame_t Msg3_subframe; - /// Frame where Msg3 is to be sent - frame_t Msg3_frame; - /// Subframe where Msg4 is to be sent - sub_frame_t Msg4_subframe; - /// Frame where Msg4 is to be sent - frame_t Msg4_frame; - /// harq_pid used for Msg4 transmission - uint8_t harq_pid; - /// UE RNTI allocated during RAR - rnti_t rnti; - /// RA RNTI allocated from received PRACH - uint16_t RA_rnti; - /// Received preamble_index - uint8_t preamble_index; - /// Received UE Contention Resolution Identifier - uint8_t cont_res_id[6]; - /// Timing offset indicated by PHY - int16_t timing_offset; - /// Timeout for RRC connection - int16_t RRC_timer; - /// Msg3 first RB - uint8_t msg3_first_rb; - /// Msg3 number of RB - uint8_t msg3_nb_rb; - /// Msg3 MCS - uint8_t msg3_mcs; - /// Msg3 TPC command - uint8_t msg3_TPC; - /// Msg3 ULdelay command - uint8_t msg3_ULdelay; - /// Msg3 cqireq command - uint8_t msg3_cqireq; - /// Round of Msg3 HARQ - uint8_t msg3_round; - /// TBS used for Msg4 - int msg4_TBsize; - /// MCS used for Msg4 - int msg4_mcs; -#ifdef Rel14 - uint8_t rach_resource_type; - uint8_t msg2_mpdcch_repetition_cnt; - uint8_t msg4_mpdcch_repetition_cnt; - uint8_t msg2_narrowband; - uint8_t msg34_narrowband; -#endif -} RA_t; - - -/*! \brief subband bitmap confguration (for ALU icic algo purpose), in test phase */ -typedef struct { - uint8_t sbmap[NUMBER_OF_SUBBANDS_MAX]; //13 = number of SB MAX for 100 PRB - uint8_t periodicity; - uint8_t first_subframe; - uint8_t sb_size; - uint8_t nb_active_sb; -} SBMAP_CONF; -/*! \brief UE list used by eNB to order UEs/CC for scheduling*/ -typedef struct { - /// Dedicated information for UEs - struct PhysicalConfigDedicated - *physicalConfigDedicated[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; - /// DLSCH pdu - DLSCH_PDU DLSCH_pdu[MAX_NUM_CCs][2][NUMBER_OF_UE_MAX]; - /// DCI template and MAC connection parameters for UEs - UE_TEMPLATE UE_template[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; - /// DCI template and MAC connection for RA processes - int pCC_id[NUMBER_OF_UE_MAX]; - /// sorted downlink component carrier for the scheduler - int ordered_CCids[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; - /// number of downlink active component carrier - int numactiveCCs[NUMBER_OF_UE_MAX]; - /// sorted uplink component carrier for the scheduler - int ordered_ULCCids[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; - /// number of uplink active component carrier - int numactiveULCCs[NUMBER_OF_UE_MAX]; - /// number of downlink active component carrier - uint8_t dl_CC_bitmap[NUMBER_OF_UE_MAX]; - /// eNB to UE statistics - eNB_UE_STATS eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; - /// scheduling control info - UE_sched_ctrl UE_sched_ctrl[NUMBER_OF_UE_MAX]; - int next[NUMBER_OF_UE_MAX]; - int head; - int next_ul[NUMBER_OF_UE_MAX]; - int head_ul; - int avail; - int num_UEs; - boolean_t active[NUMBER_OF_UE_MAX]; - - /// Sorting criteria for the UE list in the MAC preprocessor - uint16_t sorting_criteria[MAX_NUM_SLICES][CR_NUM]; - -} UE_list_t; - -/*! \brief eNB common channels */ -typedef struct { - int physCellId; - int p_eNB; - int Ncp; - int eutra_band; - uint32_t dl_CarrierFreq; - BCCH_BCH_Message_t *mib; - RadioResourceConfigCommonSIB_t *radioResourceConfigCommon; -#ifdef Rel14 - RadioResourceConfigCommonSIB_t *radioResourceConfigCommon_BR; -#endif - TDD_Config_t *tdd_Config; - SchedulingInfoList_t *schedulingInfoList; - ARFCN_ValueEUTRA_t ul_CarrierFreq; - long ul_Bandwidth; - /// Outgoing MIB PDU for PHY - MIB_PDU MIB_pdu; - /// Outgoing BCCH pdu for PHY - BCCH_PDU BCCH_pdu; - /// Outgoing BCCH DCI allocation - uint32_t BCCH_alloc_pdu; - /// Outgoing CCCH pdu for PHY - CCCH_PDU CCCH_pdu; - /// Outgoing PCCH DCI allocation - uint32_t PCCH_alloc_pdu; - /// Outgoing PCCH pdu for PHY - PCCH_PDU PCCH_pdu; - /// Outgoing RAR pdu for PHY - RAR_PDU RAR_pdu; - /// Template for RA computations - RA_t ra[NB_RA_PROC_MAX]; - /// VRB map for common channels - uint8_t vrb_map[100]; - /// VRB map for common channels and retransmissions by PHICH - uint8_t vrb_map_UL[100]; - /// MBSFN SubframeConfig - struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; - /// number of subframe allocation pattern available for MBSFN sync area - uint8_t num_sf_allocation_pattern; -#if defined(Rel10) || defined(Rel14) - /// MBMS Flag - uint8_t MBMS_flag; - /// Outgoing MCCH pdu for PHY - MCCH_PDU MCCH_pdu; - /// MCCH active flag - uint8_t msi_active; - /// MCCH active flag - uint8_t mcch_active; - /// MTCH active flag - uint8_t mtch_active; - /// number of active MBSFN area - uint8_t num_active_mbsfn_area; - /// MBSFN Area Info - struct MBSFN_AreaInfo_r9 *mbsfn_AreaInfo[MAX_MBSFN_AREA]; - /// PMCH Config - struct PMCH_Config_r9 *pmch_Config[MAX_PMCH_perMBSFN]; - /// MBMS session info list - struct MBMS_SessionInfoList_r9 *mbms_SessionList[MAX_PMCH_perMBSFN]; - /// Outgoing MCH pdu for PHY - MCH_PDU MCH_pdu; -#endif -#ifdef Rel14 - /// Rel13 parameters from SIB1 - SystemInformationBlockType1_v1310_IEs_t *sib1_v13ext; - /// Counter for SIB1-BR scheduling - int SIB1_BR_cnt; - /// Outgoing BCCH-BR pdu for PHY - BCCH_PDU BCCH_BR_pdu[20]; -#endif -} COMMON_channels_t; -/*! \brief top level eNB MAC structure */ -typedef struct eNB_MAC_INST_s { - /// Ethernet parameters for northbound midhaul interface - eth_params_t eth_params_n; - /// Ethernet parameters for fronthaul interface - eth_params_t eth_params_s; - /// - module_id_t Mod_id; - /// frame counter - frame_t frame; - /// subframe counter - sub_frame_t subframe; - /// Pointer to IF module instance for PHY - IF_Module_t *if_inst; - /// Common cell resources - COMMON_channels_t common_channels[MAX_NUM_CCs]; - /// current PDU index (BCH,MCH,DLSCH) - uint16_t pdu_index[MAX_NUM_CCs]; - - /// NFAPI Config Request Structure - nfapi_config_request_t config[MAX_NUM_CCs]; - /// Preallocated DL pdu list - nfapi_dl_config_request_pdu_t - dl_config_pdu_list[MAX_NUM_CCs][MAX_NUM_DL_PDU]; - /// NFAPI DL Config Request Structure - nfapi_dl_config_request_t DL_req[MAX_NUM_CCs]; - /// Preallocated UL pdu list - nfapi_ul_config_request_pdu_t - ul_config_pdu_list[MAX_NUM_CCs][MAX_NUM_UL_PDU]; - /// Preallocated UL pdu list for ULSCH (n+k delay) - nfapi_ul_config_request_pdu_t - ul_config_pdu_list_tmp[MAX_NUM_CCs][10][MAX_NUM_UL_PDU]; - /// NFAPI UL Config Request Structure, send to L1 4 subframes before processing takes place - nfapi_ul_config_request_t UL_req[MAX_NUM_CCs]; - /// NFAPI "Temporary" UL Config Request Structure, holds future UL_config requests - nfapi_ul_config_request_t UL_req_tmp[MAX_NUM_CCs][10]; - /// Preallocated HI_DCI0 pdu list - nfapi_hi_dci0_request_pdu_t - hi_dci0_pdu_list[MAX_NUM_CCs][MAX_NUM_HI_DCI0_PDU]; - /// NFAPI HI/DCI0 Config Request Structure - nfapi_hi_dci0_request_t HI_DCI0_req[MAX_NUM_CCs]; - /// Prealocated TX pdu list - nfapi_tx_request_pdu_t - tx_request_pdu[MAX_NUM_CCs][MAX_NUM_TX_REQUEST_PDU]; - /// NFAPI DL PDU structure - nfapi_tx_request_t TX_req[MAX_NUM_CCs]; - /// UL handle - uint32_t ul_handle; - UE_list_t UE_list; - - ///subband bitmap configuration - SBMAP_CONF sbmap_conf; - /// CCE table used to build DCI scheduling information - int CCE_table[MAX_NUM_CCs][800]; - /// active flag for Other lcid - uint8_t lcid_active[NB_RB_MAX]; - /// eNB stats - eNB_STATS eNB_stats[MAX_NUM_CCs]; - // MAC function execution peformance profiler - /// processing time of eNB scheduler - time_stats_t eNB_scheduler; - /// processing time of eNB scheduler for SI - time_stats_t schedule_si; - /// processing time of eNB scheduler for Random access - time_stats_t schedule_ra; - /// processing time of eNB ULSCH scheduler - time_stats_t schedule_ulsch; - /// processing time of eNB DCI generation - time_stats_t fill_DLSCH_dci; - /// processing time of eNB MAC preprocessor - time_stats_t schedule_dlsch_preprocessor; - /// processing time of eNB DLSCH scheduler - time_stats_t schedule_dlsch; // include rlc_data_req + MAC header + preprocessor - /// processing time of eNB MCH scheduler - time_stats_t schedule_mch; - /// processing time of eNB ULSCH reception - time_stats_t rx_ulsch_sdu; // include rlc_data_ind - /// processing time of eNB PCH scheduler - time_stats_t schedule_pch; -} eNB_MAC_INST; - -/* - * UE part - */ - -typedef enum { - TYPE0, - TYPE1, - TYPE1A, - TYPE2, - TYPE2A, - TYPEUESPEC -} MPDCCH_TYPES_t; - -/*!\brief UE layer 2 status */ -typedef enum { - CONNECTION_OK = 0, - CONNECTION_LOST, - PHY_RESYNCH, - PHY_HO_PRACH -} UE_L2_STATE_t; - -/*!\brief UE scheduling info */ -typedef struct { - /// buffer status for each lcgid - uint8_t BSR[MAX_NUM_LCGID]; // should be more for mesh topology - /// keep the number of bytes in rlc buffer for each lcgid - int32_t BSR_bytes[MAX_NUM_LCGID]; - /// after multiplexing buffer remain for each lcid - int32_t LCID_buffer_remain[MAX_NUM_LCID]; - /// sum of all lcid buffer size - uint16_t All_lcid_buffer_size_lastTTI; - /// buffer status for each lcid - uint8_t LCID_status[MAX_NUM_LCID]; - /// SR pending as defined in 36.321 - uint8_t SR_pending; - /// SR_COUNTER as defined in 36.321 - uint16_t SR_COUNTER; - /// logical channel group ide for each LCID - uint8_t LCGID[MAX_NUM_LCID]; - /// retxBSR-Timer, default value is sf2560 - uint16_t retxBSR_Timer; - /// retxBSR_SF, number of subframe before triggering a regular BSR - uint16_t retxBSR_SF; - /// periodicBSR-Timer, default to infinity - uint16_t periodicBSR_Timer; - /// periodicBSR_SF, number of subframe before triggering a periodic BSR - uint16_t periodicBSR_SF; - /// default value is 0: not configured - uint16_t sr_ProhibitTimer; - /// sr ProhibitTime running - uint8_t sr_ProhibitTimer_Running; - /// default value to n5 - uint16_t maxHARQ_Tx; - /// default value is false - uint16_t ttiBundling; - /// default value is release - struct DRX_Config *drx_config; - /// default value is release - struct MAC_MainConfig__phr_Config *phr_config; - ///timer before triggering a periodic PHR - uint16_t periodicPHR_Timer; - ///timer before triggering a prohibit PHR - uint16_t prohibitPHR_Timer; - ///DL Pathloss change value - uint16_t PathlossChange; - ///number of subframe before triggering a periodic PHR - int16_t periodicPHR_SF; - ///number of subframe before triggering a prohibit PHR - int16_t prohibitPHR_SF; - ///DL Pathloss Change in db - uint16_t PathlossChange_db; - - /// default value is false - uint16_t extendedBSR_Sizes_r10; - /// default value is false - uint16_t extendedPHR_r10; - - //Bj bucket usage per lcid - int16_t Bj[MAX_NUM_LCID]; - // Bucket size per lcid - int16_t bucket_size[MAX_NUM_LCID]; -} UE_SCHEDULING_INFO; /*!\brief Top level UE MAC structure */ typedef struct { - uint16_t Node_id; - /// RX frame counter - frame_t rxFrame; - /// RX subframe counter - sub_frame_t rxSubframe; - /// TX frame counter - frame_t txFrame; - /// TX subframe counter - sub_frame_t txSubframe; - /// C-RNTI of UE - uint16_t crnti; - /// C-RNTI of UE before HO - rnti_t crnti_before_ho; ///user id (rnti) of connected UEs - /// uplink active flag - uint8_t ul_active; - /// pointer to RRC PHY configuration - RadioResourceConfigCommonSIB_t *radioResourceConfigCommon; - /// pointer to RACH_ConfigDedicated (NULL when not active, i.e. upon HO completion or T304 expiry) - struct RACH_ConfigDedicated *rach_ConfigDedicated; - /// pointer to RRC PHY configuration - struct PhysicalConfigDedicated *physicalConfigDedicated; -#if defined(Rel10) || defined(Rel14) - /// pointer to RRC PHY configuration SCEll - struct PhysicalConfigDedicatedSCell_r10 - *physicalConfigDedicatedSCell_r10; -#endif - /// pointer to TDD Configuration (NULL for FDD) - TDD_Config_t *tdd_Config; - /// Number of adjacent cells to measure - uint8_t n_adj_cells; - /// Array of adjacent physical cell ids - uint32_t adj_cell_id[6]; - /// Pointer to RRC MAC configuration - MAC_MainConfig_t *macConfig; - /// Pointer to RRC Measurement gap configuration - MeasGapConfig_t *measGapConfig; - /// Pointers to LogicalChannelConfig indexed by LogicalChannelIdentity. Note NULL means LCHAN is inactive. - LogicalChannelConfig_t *logicalChannelConfig[MAX_NUM_LCID]; - /// Scheduling Information - UE_SCHEDULING_INFO scheduling_info; - /// Outgoing CCCH pdu for PHY - CCCH_PDU CCCH_pdu; - /// Outgoing RAR pdu for PHY - RAR_PDU RAR_pdu; - /// Incoming DLSCH pdu for PHY - DLSCH_PDU DLSCH_pdu[NUMBER_OF_UE_MAX][2]; - /// number of attempt for rach - uint8_t RA_attempt_number; - /// Random-access procedure flag - uint8_t RA_active; - /// Random-access window counter - int8_t RA_window_cnt; - /// Random-access Msg3 size in bytes - uint8_t RA_Msg3_size; - /// Random-access prachMaskIndex - uint8_t RA_prachMaskIndex; - /// Flag indicating Preamble set (A,B) used for first Msg3 transmission - uint8_t RA_usedGroupA; - /// Random-access Resources - PRACH_RESOURCES_t RA_prach_resources; - /// Random-access PREAMBLE_TRANSMISSION_COUNTER - uint8_t RA_PREAMBLE_TRANSMISSION_COUNTER; - /// Random-access backoff counter - int16_t RA_backoff_cnt; - /// Random-access variable for window calculation (frame of last change in window counter) - uint32_t RA_tx_frame; - /// Random-access variable for window calculation (subframe of last change in window counter) - uint8_t RA_tx_subframe; - /// Random-access Group B maximum path-loss - /// Random-access variable for backoff (frame of last change in backoff counter) - uint32_t RA_backoff_frame; - /// Random-access variable for backoff (subframe of last change in backoff counter) - uint8_t RA_backoff_subframe; - /// Random-access Group B maximum path-loss - uint16_t RA_maxPL; - /// Random-access Contention Resolution Timer active flag - uint8_t RA_contention_resolution_timer_active; - /// Random-access Contention Resolution Timer count value - uint8_t RA_contention_resolution_cnt; - /// power headroom reporitng reconfigured - uint8_t PHR_reconfigured; - /// power headroom state as configured by the higher layers - uint8_t PHR_state; - /// power backoff due to power management (as allowed by P-MPRc) for this cell - uint8_t PHR_reporting_active; - /// power backoff due to power management (as allowed by P-MPRc) for this cell - uint8_t power_backoff_db[NUMBER_OF_eNB_MAX]; - /// BSR report falg management - uint8_t BSR_reporting_active; - /// retxBSR-Timer expires flag - uint8_t retxBSRTimer_expires_flag; - /// periodBSR-Timer expires flag - uint8_t periodBSRTimer_expires_flag; + + drx_Config_t *drx_config; + SchedulingRequestConfig_t *SchedulingRequestConfig; + BSR_Config_t *BSR_Config; + TAG_Config_t *TAG_Config; + phr_Config_t *phr_Config; + cs_RNTI_t *cs_RNTI; - /// MBSFN_Subframe Configuration - struct MBSFN_SubframeConfig *mbsfn_SubframeConfig[8]; // FIXME replace 8 by MAX_MBSFN_AREA? - /// number of subframe allocation pattern available for MBSFN sync area - uint8_t num_sf_allocation_pattern; -#if defined(Rel10) || defined(Rel14) - /// number of active MBSFN area - uint8_t num_active_mbsfn_area; - /// MBSFN Area Info - struct MBSFN_AreaInfo_r9 *mbsfn_AreaInfo[MAX_MBSFN_AREA]; - /// PMCH Config - struct PMCH_Config_r9 *pmch_Config[MAX_PMCH_perMBSFN]; - /// MCCH status - uint8_t mcch_status; - /// MSI status - uint8_t msi_status; // could be an array if there are >1 MCH in one MBSFN area -#endif - //#ifdef CBA - /// CBA RNTI for each group - uint16_t cba_rnti[NUM_MAX_CBA_GROUP]; - /// last SFN for CBA channel access - uint8_t cba_last_access[NUM_MAX_CBA_GROUP]; - //#endif - /// total UE scheduler processing time - time_stats_t ue_scheduler; // total - /// UE ULSCH tx processing time inlcuding RLC interface (rlc_data_req) and mac header generation - time_stats_t tx_ulsch_sdu; - /// UE DLSCH rx processing time inlcuding RLC interface (mac_rrc_data_ind or mac_rlc_status_ind+mac_rlc_data_ind) and mac header parser - time_stats_t rx_dlsch_sdu; - /// UE query for MCH subframe processing time - time_stats_t ue_query_mch; - /// UE MCH rx processing time - time_stats_t rx_mch_sdu; - /// UE BCCH rx processing time including RLC interface (mac_rrc_data_ind) - time_stats_t rx_si; - /// UE PCCH rx processing time including RLC interface (mac_rrc_data_ind) - time_stats_t rx_p; } UE_MAC_INST; -/*! \brief ID of the neighboring cells used for HO*/ -typedef struct { - uint16_t cell_ids[6]; - uint8_t n_adj_cells; -} neigh_cell_id_t; - #include "proto.h" /*@}*/ #endif /*__LAYER2_MAC_DEFS_H__ */ diff --git a/openair2/LAYER2/NR_MAC_UE/extern.h b/openair2/LAYER2/NR_MAC_UE/extern.h deleted file mode 100644 index e7489ca8e6..0000000000 --- a/openair2/LAYER2/NR_MAC_UE/extern.h +++ /dev/null @@ -1,100 +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 - */ - -/*! \file extern.h -* \brief mac externs -* \author Navid Nikaein and Raymond Knopp -* \date 2010 - 2014 -* \version 1.0 -* \email navid.nikaein@eurecom.fr -* @ingroup _mac - -*/ - -#ifndef __MAC_EXTERN_H__ -#define __MAC_EXTERN_H__ - -#include "PHY/defs.h" -#include "defs.h" - -#include "RRC/LITE/defs.h" - -extern const uint32_t BSR_TABLE[BSR_TABLE_SIZE]; -//extern uint32_t EBSR_Level[63]; -extern const uint32_t Extended_BSR_TABLE[BSR_TABLE_SIZE]; -//extern uint32_t Extended_BSR_TABLE[63]; ----currently not used - -extern const uint8_t cqi2fmt0_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE]; - -extern const uint8_t cqi2fmt1x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE]; - -extern const uint8_t cqi2fmt2x_agg[MAX_SUPPORTED_BW][CQI_VALUE_RANGE]; - -extern UE_RRC_INST *UE_rrc_inst; -extern UE_MAC_INST *UE_mac_inst; - - -extern eNB_ULSCH_INFO eNB_ulsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][NUMBER_OF_UE_MAX]; // eNBxUE = 8x8 -extern eNB_DLSCH_INFO eNB_dlsch_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs][NUMBER_OF_UE_MAX]; // eNBxUE = 8x8 - - - - -#ifndef PHYSIM -#define NB_INST 1 -#else -extern unsigned char NB_INST; -#endif -extern unsigned char NB_eNB_INST; -extern unsigned char NB_UE_INST; -extern unsigned char NB_RN_INST; -extern unsigned short NODE_ID[1]; - - -extern int cqi_to_mcs[16]; - -extern uint32_t RRC_CONNECTION_FLAG; - -extern uint8_t rb_table[34]; - -extern DCI0_5MHz_TDD_1_6_t UL_alloc_pdu; - -extern DCI1A_5MHz_TDD_1_6_t RA_alloc_pdu; -extern DCI1A_5MHz_TDD_1_6_t DLSCH_alloc_pdu1A; -extern DCI1A_5MHz_TDD_1_6_t BCCH_alloc_pdu; - -extern DCI1A_5MHz_TDD_1_6_t CCCH_alloc_pdu; -extern DCI1_5MHz_TDD_t DLSCH_alloc_pdu; - -extern DCI0_5MHz_FDD_t UL_alloc_pdu_fdd; - -extern DCI1A_5MHz_FDD_t DLSCH_alloc_pdu1A_fdd; -extern DCI1A_5MHz_FDD_t RA_alloc_pdu_fdd; -extern DCI1A_5MHz_FDD_t BCCH_alloc_pdu_fdd; - -extern DCI1A_5MHz_FDD_t CCCH_alloc_pdu_fdd; -extern DCI1_5MHz_FDD_t DLSCH_alloc_pdu_fdd; - -extern DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu1; -extern DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu2; -extern DCI1E_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu1E; - -#endif //DEF_H diff --git a/openair2/LAYER2/NR_MAC_UE/proto.h b/openair2/LAYER2/NR_MAC_UE/proto.h deleted file mode 100644 index 2586c94f43..0000000000 --- a/openair2/LAYER2/NR_MAC_UE/proto.h +++ /dev/null @@ -1,1193 +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 - */ - -/*! \file LAYER2/MAC/proto.h - * \brief MAC functions prototypes for eNB and UE - * \author Navid Nikaein and Raymond Knopp - * \date 2010 - 2014 - * \email navid.nikaein@eurecom.fr - * \version 1.0 - */ -#ifndef __LAYER2_MAC_PROTO_H__ -#define __LAYER2_MAC_PROTO_H__ - -#include "LAYER2/MAC/defs.h" - -/** \addtogroup _mac - * @{ - */ - -/** - * slice specific scheduler - */ -typedef void (*slice_scheduler_dl)(module_id_t mod_id, - slice_id_t slice_id, - frame_t frame, - sub_frame_t subframe, - int *mbsfn_flag); - -typedef void (*slice_scheduler_ul)(module_id_t mod_id, - slice_id_t slice_id, - frame_t frame, - sub_frame_t subframe, - unsigned char sched_subframe, - uint16_t *first_rb); - -/** \fn void schedule_mib(module_id_t module_idP,frame_t frameP,sub_frame_t subframe); -\brief MIB scheduling for PBCH. This function requests the MIB from RRC and provides it to L1. -@param Mod_id Instance ID of eNB -@param frame Frame index -@param subframe Subframe number on which to act - -*/ - -void schedule_mib(module_id_t module_idP, - frame_t frameP, sub_frame_t subframeP); - -/** \fn void schedule_RA(module_id_t module_idP,frame_t frameP,sub_frame_t subframe); -\brief First stage of Random-Access Scheduling. Loops over the ras and checks if RAR, Msg3 or its retransmission are to be scheduled in the subframe. It returns the total number of PRB used for RA SDUs. For Msg3 it retrieves the L3msg from RRC and fills the appropriate buffers. For the others it just computes the number of PRBs. Each DCI uses 3 PRBs (format 1A) -for the message. -@param Mod_id Instance ID of eNB -@param frame Frame index -@param subframe Subframe number on which to act -*/ - - -void schedule_RA(module_id_t module_idP, frame_t frameP, - sub_frame_t subframe); - -/** \brief First stage of SI Scheduling. Gets a SI SDU from RRC if available and computes the MCS required to transport it as a function of the SDU length. It assumes a length less than or equal to 64 bytes (MCS 6, 3 PRBs). -@param Mod_id Instance ID of eNB -@param frame Frame index -@param subframe Subframe number on which to act -*/ -void schedule_SI(module_id_t module_idP, frame_t frameP, - sub_frame_t subframeP); - -/** \brief MBMS scheduling: Checking the position for MBSFN subframes. Create MSI, transfer MCCH from RRC to MAC, transfer MTCHs from RLC to MAC. Multiplexing MSI,MCCH&MTCHs. Return 1 if there are MBSFN data being allocated, otherwise return 0; -@param Mod_id Instance ID of eNB -@param frame Frame index -@param subframe Subframe number on which to act -*/ -int schedule_MBMS(module_id_t module_idP, uint8_t CC_id, frame_t frameP, - sub_frame_t subframe); - -/** \brief check the mapping between sf allocation and sync area, Currently only supports 1:1 mapping -@param Mod_id Instance ID of eNB -@param mbsfn_sync_area index of mbsfn sync area -@param[out] index of sf pattern -*/ -int8_t get_mbsfn_sf_alloction(module_id_t module_idP, uint8_t CC_id, - uint8_t mbsfn_sync_area); - -/** \brief check the mapping between sf allocation and sync area, Currently only supports 1:1 mapping -@param Mod_id Instance ID of eNB -@param mbsfn_sync_area index of mbsfn sync area -@param eNB_index index of eNB -@param[out] index of sf pattern -*/ -int8_t ue_get_mbsfn_sf_alloction(module_id_t module_idP, - uint8_t mbsfn_sync_area, - unsigned char eNB_index); - -/** \brief top ULSCH Scheduling for TDD (config 1-6). -@param Mod_id Instance ID of eNB -@param frame Frame index -@param subframe Subframe number on which to act -*/ -void schedule_ulsch(module_id_t module_idP, frame_t frameP, - sub_frame_t subframe); - -/** \brief ULSCH Scheduling per RNTI -@param Mod_id Instance ID of eNB -@param slice_id Instance slice for this eNB -@param frame Frame index -@param subframe Subframe number on which to act -@param sched_subframe Subframe number where PUSCH is transmitted (for DAI lookup) -*/ -void schedule_ulsch_rnti(module_id_t module_idP, slice_id_t slice_idP, frame_t frameP, - sub_frame_t subframe, - unsigned char sched_subframe, - uint16_t * first_rb); - -/** \brief Second stage of DLSCH scheduling, after schedule_SI, schedule_RA and schedule_dlsch have been called. This routine first allocates random frequency assignments for SI and RA SDUs using distributed VRB allocations and adds the corresponding DCI SDU to the DCI buffer for PHY. It then loops over the UE specific DCIs previously allocated and fills in the remaining DCI fields related to frequency allocation. It assumes localized allocation of type 0 (DCI.rah=0). The allocation is done for tranmission modes 1,2,4. -@param Mod_id Instance of eNB -@param frame Frame index -@param subframe Index of subframe -@param mbsfn_flag Indicates that this subframe is for MCH/MCCH -*/ -void fill_DLSCH_dci(module_id_t module_idP, frame_t frameP, - sub_frame_t subframe, int *mbsfn_flag); - -/** \brief UE specific DLSCH scheduling. Retrieves next ue to be schduled from round-robin scheduler and gets the appropriate harq_pid for the subframe from PHY. If the process is active and requires a retransmission, it schedules the retransmission with the same PRB count and MCS as the first transmission. Otherwise it consults RLC for DCCH/DTCH SDUs (status with maximum number of available PRBS), builds the MAC header (timing advance sent by default) and copies -@param Mod_id Instance ID of eNB -@param frame Frame index -@param subframe Subframe on which to act - -@param mbsfn_flag Indicates that MCH/MCCH is in this subframe -*/ -void schedule_dlsch(module_id_t module_idP, frame_t frameP, - sub_frame_t subframe, int *mbsfn_flag); - -void schedule_ue_spec(module_id_t module_idP, slice_id_t slice_idP, - frame_t frameP,sub_frame_t subframe, int *mbsfn_flag); - - -/** \brief Function for UE/PHY to compute PUSCH transmit power in power-control procedure. - @param Mod_id Module id of UE - @returns Po_NOMINAL_PUSCH (PREAMBLE_RECEIVED_TARGET_POWER+DELTA_PREAMBLE -*/ -int8_t get_Po_NOMINAL_PUSCH(module_id_t module_idP, uint8_t CC_id); - -/** \brief Function to compute DELTA_PREAMBLE from 36.321 (for RA power ramping procedure and Msg3 PUSCH power control policy) - @param Mod_id Module id of UE - @returns DELTA_PREAMBLE -*/ -int8_t get_DELTA_PREAMBLE(module_id_t module_idP, int CC_id); - -/** \brief Function for compute deltaP_rampup from 36.321 (for RA power ramping procedure and Msg3 PUSCH power control policy) - @param Mod_id Module id of UE - @param CC_id carrier component id of UE - @returns deltaP_rampup -*/ -int8_t get_deltaP_rampup(module_id_t module_idP, uint8_t CC_id); - -uint16_t mac_computeRIV(uint16_t N_RB_DL, uint16_t RBstart, - uint16_t Lcrbs); - -void add_msg3(module_id_t module_idP, int CC_id, RA_t * ra, frame_t frameP, - sub_frame_t subframeP); - -//main.c - -int mac_top_init(int eMBMS_active, char *uecap_xer, - uint8_t cba_group_active, uint8_t HO_active); - -void mac_top_init_eNB(void); - -void mac_init_cell_params(int Mod_idP, int CC_idP); - -char layer2_init_UE(module_id_t module_idP); - -char layer2_init_eNB(module_id_t module_idP, uint8_t Free_ch_index); - -void mac_switch_node_function(module_id_t module_idP); - -int mac_init_global_param(void); - -void mac_top_cleanup(void); - -void mac_UE_out_of_sync_ind(module_id_t module_idP, frame_t frameP, - uint16_t eNB_index); - -void clear_nfapi_information(eNB_MAC_INST * eNB, int CC_idP, - frame_t frameP, sub_frame_t subframeP); - -void dlsch_scheduler_pre_processor_reset(int module_idP, int UE_id, - uint8_t CC_id, - int frameP, - int subframeP, - int N_RBG, - uint16_t - nb_rbs_required[MAX_NUM_CCs] - [NUMBER_OF_UE_MAX], - unsigned char - rballoc_sub[MAX_NUM_CCs] - [N_RBG_MAX], - unsigned char - MIMO_mode_indicator[MAX_NUM_CCs] - [N_RBG_MAX]); - -// eNB functions -/* \brief This function assigns pre-available RBS to each UE in specified sub-bands before scheduling is done -@param Mod_id Instance ID of eNB -@param frame Index of frame -@param subframe Index of current subframe -@param N_RBS Number of resource block groups - */ - - -void dlsch_scheduler_pre_processor(module_id_t module_idP, - slice_id_t slice_idP, - frame_t frameP, - sub_frame_t subframe, - int N_RBG[MAX_NUM_CCs], - int *mbsfn_flag); - - -void dlsch_scheduler_pre_processor_allocate(module_id_t Mod_id, - int UE_id, - uint8_t CC_id, - int N_RBG, - int transmission_mode, - int min_rb_unit, - uint8_t N_RB_DL, - uint16_t - nb_rbs_required[MAX_NUM_CCs] - [NUMBER_OF_UE_MAX], - uint16_t - nb_rbs_required_remaining - [MAX_NUM_CCs] - [NUMBER_OF_UE_MAX], - unsigned char - rballoc_sub[MAX_NUM_CCs] - [N_RBG_MAX], - unsigned char - MIMO_mode_indicator - [MAX_NUM_CCs][N_RBG_MAX]); - -/* \brief Function to trigger the eNB scheduling procedure. It is called by PHY at the beginning of each subframe, \f$n$\f - and generates all DLSCH allocations for subframe \f$n\f$ and ULSCH allocations for subframe \f$n+k$\f. -@param Mod_id Instance ID of eNB -@param subframe Index of current subframe -@param calibration_flag Flag to indicate that eNB scheduler should schedule TDD auto-calibration PUSCH. -*/ -void eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP); //, int calibration_flag); - -/* \brief Function to indicate a received preamble on PRACH. It initiates the RA procedure. -@param Mod_id Instance ID of eNB -@param preamble_index index of the received RA request -@param timing_offset Offset in samples of the received PRACH w.r.t. eNB timing. This is used to -@param rnti RA rnti corresponding to this PRACH preamble -@param rach_resource type (0=non BL/CE,1 CE level 0,2 CE level 1, 3 CE level 2,4 CE level 3) -*/ -void initiate_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, - sub_frame_t subframeP, uint16_t preamble_index, - int16_t timing_offset, uint16_t rnti -#ifdef Rel14 - , uint8_t rach_resource_type -#endif - ); - -/* \brief Function in eNB to fill RAR pdu when requested by PHY. This provides a single RAR SDU for the moment and returns the t-CRNTI. -@param Mod_id Instance ID of eNB -@param dlsch_buffer Pointer to DLSCH input buffer -@param N_RB_UL Number of UL resource blocks -@returns t_CRNTI -*/ -unsigned short fill_rar(const module_id_t module_idP, - const int CC_id, - RA_t *ra, - const frame_t frameP, - uint8_t * const dlsch_buffer, - const uint16_t N_RB_UL, - const uint8_t input_buffer_length); - -#ifdef Rel14 -unsigned short fill_rar_br(eNB_MAC_INST * eNB, - int CC_id, - RA_t * ra, - const frame_t frameP, - const sub_frame_t subframeP, - uint8_t * const dlsch_buffer, - const uint8_t ce_level); -#endif - -/* \brief Function to indicate a failed RA response. It removes all temporary variables related to the initial connection of a UE -@param Mod_id Instance ID of eNB -@param preamble_index index of the received RA request. -*/ -void cancel_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP, - uint16_t preamble_index); - -/* \brief Function used by PHY to inform MAC that an uplink is scheduled - for Msg3 in given subframe. This is used so that the MAC - scheduler marks as busy the RBs used by the Msg3. -@param Mod_id Instance ID of eNB -@param CC_id CC ID of eNB -@param frame current frame -@param subframe current subframe -@param rnti UE rnti concerned -@param Msg3_frame frame where scheduling takes place -@param Msg3_subframe subframe where scheduling takes place -*/ -void set_msg3_subframe(module_id_t Mod_id, - int CC_id, - int frame, - int subframe, - int rnti, int Msg3_frame, int Msg3_subframe); - -/* \brief Function to indicate a received SDU on ULSCH. -@param Mod_id Instance ID of eNB -@param CC_id Component carrier index -@param rnti RNTI of UE transmitting the SDU -@param sdu Pointer to received SDU -@param sdu_len Length of SDU -@param timing_advance timing advance adjustment after this pdu -@param ul_cqi Uplink CQI estimate after this pdu (SNR quantized to 8 bits, -64 ... 63.5 dB in .5dB steps) -*/ -void rx_sdu(const module_id_t enb_mod_idP, - const int CC_idP, - const frame_t frameP, - const sub_frame_t subframeP, - const rnti_t rntiP, - uint8_t * sduP, - const uint16_t sdu_lenP, - const uint16_t timing_advance, const uint8_t ul_cqi); - - -/* \brief Function to indicate a scheduled schduling request (SR) was received by eNB. -@param Mod_idP Instance ID of eNB -@param CC_idP CC_id of received SR -@param frameP of received SR -@param subframeP Index of subframe where SR was received -@param rnti RNTI of UE transmitting the SR -@param ul_cqi SNR measurement of PUCCH (SNR quantized to 8 bits, -64 ... 63.5 dB in .5dB steps) -*/ -void SR_indication(module_id_t module_idP, int CC_id, frame_t frameP, - sub_frame_t subframe, rnti_t rnti, uint8_t ul_cqi); - -/* \brief Function to indicate a UL failure was detected by eNB PHY. -@param Mod_id Instance ID of eNB -@param CC_id Component carrier -@param frameP Frame index -@param rnti RNTI of UE transmitting the SR -@param subframe Index of subframe where SR was received -*/ -void UL_failure_indication(module_id_t Mod_id, int CC_id, frame_t frameP, - rnti_t rnti, sub_frame_t subframe); - -/* \brief Function to indicate an HARQ ACK/NAK. -@param Mod_id Instance ID of eNB -@param CC_id Component carrier -@param frameP Frame index -@param subframeP subframe index -@param harq_pdu NFAPI HARQ PDU descriptor -*/ -void harq_indication(module_id_t mod_idP, int CC_idP, frame_t frameP, - sub_frame_t subframeP, - nfapi_harq_indication_pdu_t * harq_pdu); - -/* \brief Function to indicate a received CQI pdu -@param Mod_id Instance ID of eNB -@param CC_id Component carrier -@param frameP Frame index -@param subframeP subframe index -@param rntiP RNTI of incoming CQI information -@param ul_cqi_information NFAPI UL CQI measurement -*/ -void cqi_indication(module_id_t mod_idP, int CC_idP, frame_t frameP, - sub_frame_t subframeP, rnti_t rntiP, - nfapi_cqi_indication_rel9_t * rel9, uint8_t * pdu, - nfapi_ul_cqi_information_t * ul_cqi_information); - -uint8_t *get_dlsch_sdu(module_id_t module_idP, int CC_id, frame_t frameP, - rnti_t rnti, uint8_t TBindex); - -/* \brief Function to retrieve MCH transport block and MCS used for MCH in this MBSFN subframe. Returns null if no MCH is to be transmitted -@param Mod_id Instance ID of eNB -@param frame Index of frame -@param subframe Index of current subframe -@param mcs Pointer to mcs used by PHY (to be filled by MAC) -@returns Pointer to MCH transport block and mcs for subframe -*/ -MCH_PDU *get_mch_sdu(module_id_t Mod_id, int CC_id, frame_t frame, - sub_frame_t subframe); - - - - - -void ue_mac_reset(module_id_t module_idP, uint8_t eNB_index); -void ue_init_mac(module_id_t module_idP); -void init_ue_sched_info(void); -void add_ue_ulsch_info(module_id_t module_idP, int CC_id, int UE_id, - sub_frame_t subframe, UE_ULSCH_STATUS status); -void add_ue_dlsch_info(module_id_t module_idP, int CC_id, int UE_id, - sub_frame_t subframe, UE_DLSCH_STATUS status); -int find_UE_id(module_id_t module_idP, rnti_t rnti); -int find_RA_id(module_id_t mod_idP, int CC_idP, rnti_t rntiP); -rnti_t UE_RNTI(module_id_t module_idP, int UE_id); -int UE_PCCID(module_id_t module_idP, int UE_id); -uint8_t find_active_UEs(module_id_t module_idP); -boolean_t is_UE_active(module_id_t module_idP, int UE_id); -uint8_t get_aggregation(uint8_t bw_index, uint8_t cqi, uint8_t dci_fmt); - -int8_t find_active_UEs_with_traffic(module_id_t module_idP); - -void init_CCE_table(int module_idP, int CC_idP); - -int get_nCCE_offset(int *CCE_table, - const unsigned char L, - const int nCCE, - const int common_dci, - const unsigned short rnti, - const unsigned char subframe); - -int allocate_CCEs(int module_idP, int CC_idP, int subframe, int test_only); - -boolean_t CCE_allocation_infeasible(int module_idP, - int CC_idP, - int common_flag, - int subframe, - int aggregation, int rnti); - -void set_ue_dai(sub_frame_t subframeP, - int UE_id, - uint8_t CC_id, uint8_t tdd_config, UE_list_t * UE_list); - -/** \brief First stage of PCH Scheduling. Gets a PCH SDU from RRC if available and computes the MCS required to transport it as a function of the SDU length. It assumes a length less than or equal to 64 bytes (MCS 6, 3 PRBs). -@param Mod_id Instance ID of eNB -@param frame Frame index -@param subframe Subframe number on which to act -@param paging_ue_index -*/ -void schedule_PCH(module_id_t module_idP,frame_t frameP,sub_frame_t subframeP); - -uint8_t find_num_active_UEs_in_cbagroup(module_id_t module_idP, - unsigned char group_id); -uint8_t UE_is_to_be_scheduled(module_id_t module_idP, int CC_id, - uint8_t UE_id); -/** \brief Round-robin scheduler for ULSCH traffic. -@param Mod_id Instance ID for eNB -@param subframe Subframe number on which to act -@returns UE index that is to be scheduled if needed/room -*/ -module_id_t schedule_next_ulue(module_id_t module_idP, int UE_id, - sub_frame_t subframe); - -/** \brief Round-robin scheduler for DLSCH traffic. -@param Mod_id Instance ID for eNB -@param subframe Subframe number on which to act -@returns UE index that is to be scheduled if needed/room -*/ -int schedule_next_dlue(module_id_t module_idP, int CC_id, - sub_frame_t subframe); - -/* \brief Allocates a set of PRBS for a particular UE. This is a simple function for the moment, later it should process frequency-domain CQI information and/or PMI information. Currently it just returns the first PRBS that are available in the subframe based on the number requested. -@param UE_id Index of UE on which to act -@param nb_rb Number of PRBs allocated to UE by scheduler -@param N_RB_DL Number of PRBs on DL -@param rballoc Pointer to bit-map of current PRB allocation given to previous users/control channels. This is updated for subsequent calls to the routine. -@returns an rballoc bitmap for resource type 0 allocation (DCI). -*/ -uint32_t allocate_prbs(int UE_id, uint8_t nb_rb, int N_RB_DL, - uint32_t * rballoc); - -/* \fn uint32_t req_new_ulsch(module_id_t module_idP) -\brief check for a new transmission in any drb -@param Mod_id Instance id of UE in machine -@returns 1 for new transmission, 0 for none -*/ -uint32_t req_new_ulsch(module_id_t module_idP); - -/* \brief Get SR payload (0,1) from UE MAC -@param Mod_id Instance id of UE in machine -@param CC_id Component Carrier index -@param eNB_id Index of eNB that UE is attached to -@param rnti C_RNTI of UE -@param subframe subframe number -@returns 0 for no SR, 1 for SR -*/ -uint32_t ue_get_SR(module_id_t module_idP, int CC_id, frame_t frameP, - uint8_t eNB_id, rnti_t rnti, sub_frame_t subframe); - -uint8_t get_ue_weight(module_id_t module_idP, int CC_id, int UE_id); - -// UE functions -void mac_out_of_sync_ind(module_id_t module_idP, frame_t frameP, - uint16_t CH_index); - -void ue_decode_si(module_id_t module_idP, int CC_id, frame_t frame, - uint8_t CH_index, void *pdu, uint16_t len); - -void ue_decode_p(module_id_t module_idP, int CC_id, frame_t frame, - uint8_t CH_index, void *pdu, uint16_t len); - - -void ue_send_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frame, - sub_frame_t subframe, uint8_t * sdu, uint16_t sdu_len, - uint8_t CH_index); - - -#if defined(Rel10) || defined(Rel14) -/* \brief Called by PHY to transfer MCH transport block to ue MAC. -@param Mod_id Index of module instance -@param frame Frame index -@param sdu Pointer to transport block -@param sdu_len Length of transport block -@param eNB_index Index of attached eNB -@param sync_area the index of MBSFN sync area -*/ -void ue_send_mch_sdu(module_id_t module_idP, uint8_t CC_id, frame_t frameP, - uint8_t * sdu, uint16_t sdu_len, uint8_t eNB_index, - uint8_t sync_area); - -/*\brief Function to check if UE PHY needs to decode MCH for MAC. -@param Mod_id Index of protocol instance -@param frame Index of frame -@param subframe Index of subframe -@param eNB_index index of eNB for this MCH -@param[out] sync_area return the sync area -@param[out] mcch_active flag indicating whether this MCCH is active in this SF -*/ -int ue_query_mch(uint8_t Mod_id, uint8_t CC_id, uint32_t frame, - sub_frame_t subframe, uint8_t eNB_index, - uint8_t * sync_area, uint8_t * mcch_active); - -#endif - -/* \brief Called by PHY to get sdu for PUSCH transmission. It performs the following operations: Checks BSR for DCCH, DCCH1 and DTCH corresponding to previous values computed either in SR or BSR procedures. It gets rlc status indications on DCCH,DCCH1 and DTCH and forms BSR elements and PHR in MAC header. CRNTI element is not supported yet. It computes transport block for up to 3 SDUs and generates header and forms the complete MAC SDU. -@param Mod_id Instance id of UE in machine -@param eNB_id Index of eNB that UE is attached to -@param rnti C_RNTI of UE -@param subframe subframe number -@returns 0 for no SR, 1 for SR -*/ -void ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP, - sub_frame_t subframe, uint8_t eNB_index, - uint8_t * ulsch_buffer, uint16_t buflen, - uint8_t * access_mode); - -/* \brief Function called by PHY to retrieve information to be transmitted using the RA procedure. If the UE is not in PUSCH mode for a particular eNB index, this is assumed to be an Msg3 and MAC attempts to retrieves the CCCH message from RRC. If the UE is in PUSCH mode for a particular eNB index and PUCCH format 0 (Scheduling Request) is not activated, the MAC may use this resource for random-access to transmit a BSR along with the C-RNTI control element (see 5.1.4 from 36.321) -@param Mod_id Index of UE instance -@param Mod_id Component Carrier Index -@param New_Msg3 Flag to indicate this call is for a new Msg3 -@param subframe Index of subframe for PRACH transmission (0 ... 9) -@returns A pointer to a PRACH_RESOURCES_t */ -PRACH_RESOURCES_t *ue_get_rach(module_id_t module_idP, int CC_id, - frame_t frameP, uint8_t new_Msg3, - sub_frame_t subframe); - -/* \brief Function called by PHY to process the received RAR. It checks that the preamble matches what was sent by the eNB and provides the timing advance and t-CRNTI. -@param Mod_id Index of UE instance -@param CC_id Index to a component carrier -@param frame Frame index -@param ra_rnti RA_RNTI value -@param dlsch_buffer Pointer to dlsch_buffer containing RAR PDU -@param t_crnti Pointer to PHY variable containing the T_CRNTI -@param preamble_index Preamble Index used by PHY to transmit the PRACH. This should match the received RAR to trigger the rest of -random-access procedure -@param selected_rar_buffer the output buffer for storing the selected RAR header and RAR payload -@returns timing advance or 0xffff if preamble doesn't match -*/ -uint16_t -ue_process_rar(const module_id_t module_idP, - const int CC_id, - const frame_t frameP, - const rnti_t ra_rnti, - uint8_t * const dlsch_buffer, - rnti_t * const t_crnti, - const uint8_t preamble_index, - uint8_t * selected_rar_buffer); - - -/* \brief Generate header for UL-SCH. This function parses the desired control elements and sdus and generates the header as described -in 36-321 MAC layer specifications. It returns the number of bytes used for the header to be used as an offset for the payload -in the ULSCH buffer. -@param mac_header Pointer to the first byte of the MAC header (UL-SCH buffer) -@param num_sdus Number of SDUs in the payload -@param short_padding Number of bytes for short padding (0,1,2) -@param sdu_lengths Pointer to array of SDU lengths -@param sdu_lcids Pointer to array of LCIDs (the order must be the same as the SDU length array) -@param power_headroom Pointer to power headroom command (NULL means not present in payload) -@param crnti Pointer to CRNTI command (NULL means not present in payload) -@param truncated_bsr Pointer to Truncated BSR command (NULL means not present in payload) -@param short_bsr Pointer to Short BSR command (NULL means not present in payload) -@param long_bsr Pointer to Long BSR command (NULL means not present in payload) -@param post_padding Number of bytes for padding at the end of MAC PDU -@returns Number of bytes used for header -*/ -unsigned char generate_ulsch_header(uint8_t * mac_header, - uint8_t num_sdus, - uint8_t short_padding, - uint16_t * sdu_lengths, - uint8_t * sdu_lcids, - POWER_HEADROOM_CMD * power_headroom, - uint16_t * crnti, - BSR_SHORT * truncated_bsr, - BSR_SHORT * short_bsr, - BSR_LONG * long_bsr, - unsigned short post_padding); - -/* \brief Parse header for UL-SCH. This function parses the received UL-SCH header as described -in 36-321 MAC layer specifications. It returns the number of bytes used for the header to be used as an offset for the payload -in the ULSCH buffer. -@param mac_header Pointer to the first byte of the MAC header (UL-SCH buffer) -@param num_ces Number of SDUs in the payload -@param num_sdu Number of SDUs in the payload -@param rx_ces Pointer to received CEs in the header -@param rx_lcids Pointer to array of LCIDs (the order must be the same as the SDU length array) -@param rx_lengths Pointer to array of SDU lengths -@returns Pointer to payload following header -*/ -uint8_t *parse_ulsch_header(uint8_t * mac_header, - uint8_t * num_ce, - uint8_t * num_sdu, - uint8_t * rx_ces, - uint8_t * rx_lcids, - uint16_t * rx_lengths, uint16_t tx_lenght); - -int to_prb(int); -int to_rbg(int); -int l2_init(LTE_DL_FRAME_PARMS * frame_parms, int eMBMS_active, - char *uecap_xer, uint8_t cba_group_active, uint8_t HO_active); -int mac_init(void); -int add_new_ue(module_id_t Mod_id, int CC_id, rnti_t rnti, int harq_pid -#ifdef Rel14 - , uint8_t rach_resource_type -#endif - ); -int rrc_mac_remove_ue(module_id_t Mod_id, rnti_t rntiP); - - -int maxround(module_id_t Mod_id, uint16_t rnti, int frame, - sub_frame_t subframe, uint8_t ul_flag); -void swap_UEs(UE_list_t * listP, int nodeiP, int nodejP, int ul_flag); -int prev(UE_list_t * listP, int nodeP, int ul_flag); -void dump_ue_list(UE_list_t * listP, int ul_flag); -int UE_num_active_CC(UE_list_t * listP, int ue_idP); -int UE_PCCID(module_id_t mod_idP, int ue_idP); -rnti_t UE_RNTI(module_id_t mod_idP, int ue_idP); - - -void ulsch_scheduler_pre_processor(module_id_t module_idP, slice_id_t slice_id, int frameP, - sub_frame_t subframeP, - uint16_t * first_rb); -void store_ulsch_buffer(module_id_t module_idP, int frameP, - sub_frame_t subframeP); -void sort_ue_ul(module_id_t module_idP, int frameP, sub_frame_t subframeP); -void assign_max_mcs_min_rb(module_id_t module_idP, int slice_id, int frameP, - sub_frame_t subframeP, uint16_t * first_rb); -void adjust_bsr_info(int buffer_occupancy, uint16_t TBS, - UE_TEMPLATE * UE_template); -int phy_stats_exist(module_id_t Mod_id, int rnti); -void sort_UEs(module_id_t Mod_idP, slice_id_t slice_id, int frameP, sub_frame_t subframeP); - -/*! \fn UE_L2_state_t ue_scheduler(const module_id_t module_idP,const frame_t frameP, const sub_frame_t subframe, const lte_subframe_t direction,const uint8_t eNB_index) - \brief UE scheduler where all the ue background tasks are done. This function performs the following: 1) Trigger PDCP every 5ms 2) Call RRC for link status return to PHY3) Perform SR/BSR procedures for scheduling feedback 4) Perform PHR procedures. -\param[in] module_idP instance of the UE -\param[in] rxFrame the RX frame number -\param[in] rxSubframe the RX subframe number -\param[in] txFrame the TX frame number -\param[in] txSubframe the TX subframe number -\param[in] direction subframe direction -\param[in] eNB_index instance of eNB -@returns L2 state (CONNETION_OK or CONNECTION_LOST or PHY_RESYNCH) -*/ -UE_L2_STATE_t ue_scheduler(const module_id_t module_idP, - const frame_t rxFrameP, - const sub_frame_t rxSubframe, - const frame_t txFrameP, - const sub_frame_t txSubframe, - const lte_subframe_t direction, - const uint8_t eNB_index, const int CC_id); - -/*! \fn int cba_access(module_id_t module_idP,frame_t frameP,sub_frame_t subframe, uint8_t eNB_index,uint16_t buflen); -\brief determine whether to use cba resource to transmit or not -\param[in] Mod_id instance of the UE -\param[in] frame the frame number -\param[in] subframe the subframe number -\param[in] eNB_index instance of eNB -\param[out] access(1) or postpone (0) -*/ -int cba_access(module_id_t module_idP, frame_t frameP, - sub_frame_t subframe, uint8_t eNB_index, uint16_t buflen); - -/*! \fn BSR_SHORT * get_bsr_short(module_id_t module_idP, uint8_t bsr_len) -\brief get short bsr level -\param[in] Mod_id instance of the UE -\param[in] bsr_len indicator for no, short, or long bsr -\param[out] bsr_s pointer to short bsr -*/ -BSR_SHORT *get_bsr_short(module_id_t module_idP, uint8_t bsr_len); - -/*! \fn BSR_LONG * get_bsr_long(module_id_t module_idP, uint8_t bsr_len) -\brief get long bsr level -\param[in] Mod_id instance of the UE -\param[in] bsr_len indicator for no, short, or long bsr -\param[out] bsr_l pointer to long bsr -*/ -BSR_LONG *get_bsr_long(module_id_t module_idP, uint8_t bsr_len); - -/*! \fn boolean_t update_bsr(module_id_t module_idP, frame_t frameP,sub_frame_t subframeP) - \brief get the rlc stats and update the bsr level for each lcid -\param[in] Mod_id instance of the UE -\param[in] frame Frame index -*/ -boolean_t update_bsr(module_id_t module_idP, frame_t frameP, - sub_frame_t subframeP, eNB_index_t eNB_index); - -/*! \fn locate_BsrIndexByBufferSize (int *table, int size, int value) - \brief locate the BSR level in the table as defined in 36.321. This function requires that he values in table to be monotonic, either increasing or decreasing. The returned value is not less than 0, nor greater than n-1, where n is the size of table. -\param[in] *table Pointer to BSR table -\param[in] size Size of the table -\param[in] value Value of the buffer -\return the index in the BSR_LEVEL table -*/ -uint8_t locate_BsrIndexByBufferSize(const uint32_t * table, int size, - int value); - - -/*! \fn int get_sf_periodicBSRTimer(uint8_t periodicBSR_Timer) - \brief get the number of subframe from the periodic BSR timer configured by the higher layers -\param[in] periodicBSR_Timer timer for periodic BSR -\return the number of subframe -*/ -int get_sf_periodicBSRTimer(uint8_t bucketSize); - -/*! \fn int get_ms_bucketsizeduration(uint8_t bucketSize) - \brief get the time in ms form the bucket size duration configured by the higher layer -\param[in] bucketSize the bucket size duration -\return the time in ms -*/ -int get_ms_bucketsizeduration(uint8_t bucketsizeduration); - -/*! \fn int get_sf_retxBSRTimer(uint8_t retxBSR_Timer) - \brief get the number of subframe form the bucket size duration configured by the higher layer -\param[in] retxBSR_Timer timer for regular BSR -\return the time in sf -*/ -int get_sf_retxBSRTimer(uint8_t retxBSR_Timer); - -/*! \fn int get_sf_perioidicPHR_Timer(uint8_t perioidicPHR_Timer){ - \brief get the number of subframe form the periodic PHR timer configured by the higher layer -\param[in] perioidicPHR_Timer timer for reguluar PHR -\return the time in sf -*/ -int get_sf_perioidicPHR_Timer(uint8_t perioidicPHR_Timer); - -/*! \fn int get_sf_prohibitPHR_Timer(uint8_t prohibitPHR_Timer) - \brief get the number of subframe form the prohibit PHR duration configured by the higher layer -\param[in] prohibitPHR_Timer timer for PHR -\return the time in sf -*/ -int get_sf_prohibitPHR_Timer(uint8_t prohibitPHR_Timer); - -/*! \fn int get_db_dl_PathlossChange(uint8_t dl_PathlossChange) - \brief get the db form the path loss change configured by the higher layer -\param[in] dl_PathlossChange path loss for PHR -\return the pathloss in db -*/ -int get_db_dl_PathlossChange(uint8_t dl_PathlossChange); - -/*! \fn uint8_t get_phr_mapping (module_id_t module_idP, int CC_id,uint8_t eNB_index) - \brief get phr mapping as described in 36.313 -\param[in] Mod_id index of eNB -\param[in] CC_id Component Carrier Index -\return phr mapping -*/ -uint8_t get_phr_mapping(module_id_t module_idP, int CC_id, - uint8_t eNB_index); - -/*! \fn void update_phr (module_id_t module_idP) - \brief update/reset the phr timers -\param[in] Mod_id index of eNB -\param[in] CC_id Component carrier index -\return void -*/ -void update_phr(module_id_t module_idP, int CC_id); - -/*! \brief Function to indicate Msg3 transmission/retransmission which initiates/reset Contention Resolution Timer -\param[in] Mod_id Instance index of UE -\param[in] eNB_id Index of eNB -*/ -void Msg3_tx(module_id_t module_idP, uint8_t CC_id, frame_t frameP, - uint8_t eNB_id); - - -/*! \brief Function to indicate the transmission of msg1/rach -\param[in] Mod_id Instance index of UE -\param[in] eNB_id Index of eNB -*/ - -void Msg1_tx(module_id_t module_idP, uint8_t CC_id, frame_t frameP, - uint8_t eNB_id); - -void dl_phy_sync_success(module_id_t module_idP, - frame_t frameP, - unsigned char eNB_index, uint8_t first_sync); - -int dump_eNB_l2_stats(char *buffer, int length); - -double uniform_rngen(int min, int max); - -/* -void add_common_dci(DCI_PDU *DCI_pdu, - void *pdu, - rnti_t rnti, - unsigned char dci_size_bytes, - unsigned char aggregation, - unsigned char dci_size_bits, - unsigned char dci_fmt, - uint8_t ra_flag); -*/ - -uint32_t allocate_prbs_sub(int nb_rb, int N_RB_DL, int N_RBG, - uint8_t * rballoc); - -void update_ul_dci(module_id_t module_idP, uint8_t CC_id, rnti_t rnti, - uint8_t dai); - -int get_bw_index(module_id_t module_id, uint8_t CC_id); - -int get_min_rb_unit(module_id_t module_idP, uint8_t CC_id); - -/* \brief Generate header for DL-SCH. This function parses the desired control elements and sdus and generates the header as described -in 36-321 MAC layer specifications. It returns the number of bytes used for the header to be used as an offset for the payload -in the DLSCH buffer. -@param mac_header Pointer to the first byte of the MAC header (DL-SCH buffer) -@param num_sdus Number of SDUs in the payload -@param sdu_lengths Pointer to array of SDU lengths -@param sdu_lcids Pointer to array of LCIDs (the order must be the same as the SDU length array) -@param drx_cmd dicontinous reception command -@param timing_advancd_cmd timing advanced command -@param ue_cont_res_id Pointer to contention resolution identifier (NULL means not present in payload) -@param short_padding Number of bytes for short padding (0,1,2) -@param post_padding number of bytes for padding at the end of MAC PDU -@returns Number of bytes used for header -*/ -int generate_dlsch_header(unsigned char *mac_header, - unsigned char num_sdus, - unsigned short *sdu_lengths, - unsigned char *sdu_lcids, - unsigned char drx_cmd, - unsigned short timing_advance_cmd, - unsigned char *ue_cont_res_id, - unsigned char short_padding, - unsigned short post_padding); - -/** \brief RRC eNB Configuration primitive for PHY/MAC. Allows configuration of PHY/MAC resources based on System Information (SI), RRCConnectionSetup and RRCConnectionReconfiguration messages. -@param Mod_id Instance ID of eNB -@param CC_id Component Carrier of the eNB -@param mib Pointer to MIB - -@param radioResourceConfigCommon Structure from SIB2 for common radio parameters (if NULL keep existing configuration) -@param physicalConfigDedicated Structure from RRCConnectionSetup or RRCConnectionReconfiguration for dedicated PHY parameters (if NULL keep existing configuration) -@param measObj Structure from RRCConnectionReconfiguration for UE measurement procedures -@param mac_MainConfig Structure from RRCConnectionSetup or RRCConnectionReconfiguration for dedicated MAC parameters (if NULL keep existing configuration) -@param logicalChannelIdentity Logical channel identity index of corresponding logical channel config -@param logicalChannelConfig Pointer to logical channel configuration -@param measGapConfig Measurement Gap configuration for MAC (if NULL keep existing configuration) -@param tdd_Config TDD Configuration from SIB1 (if NULL keep existing configuration) -@param mobilityControlInfo mobility control info received for Handover -@param SchedInfoList SI Scheduling information -@param MBMS_Flag indicates MBMS transmission -@param mbsfn_SubframeConfigList pointer to mbsfn subframe configuration list from SIB2 -@param mbsfn_AreaInfoList pointer to MBSFN Area Info list from SIB13 -@param pmch_InfoList pointer to PMCH_InfoList from MBSFNAreaConfiguration Message (MCCH Message) -@param sib1_ext_r13 SI Scheduling information for SI-BR UEs -*/ - -int rrc_mac_config_req_eNB(module_id_t module_idP, - int CC_id, - int physCellId, - int p_eNB, - int Ncp, - int eutra_band, uint32_t dl_CarrierFreq, -#ifdef Rel14 - int pbch_repetition, -#endif - rnti_t rntiP, - BCCH_BCH_Message_t * mib, - RadioResourceConfigCommonSIB_t * - radioResourceConfigCommon, -#ifdef Rel14 - RadioResourceConfigCommonSIB_t * - radioResourceConfigCommon_BR, -#endif - struct PhysicalConfigDedicated - *physicalConfigDedicated, -#if defined(Rel10) || defined(Rel14) - SCellToAddMod_r10_t * sCellToAddMod_r10, - //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, -#endif - MeasObjectToAddMod_t ** measObj, - MAC_MainConfig_t * mac_MainConfig, - long logicalChannelIdentity, - LogicalChannelConfig_t * logicalChannelConfig, - MeasGapConfig_t * measGapConfig, - TDD_Config_t * tdd_Config, - MobilityControlInfo_t * mobilityControlInfo, - SchedulingInfoList_t * schedulingInfoList, - uint32_t ul_CarrierFreq, - long *ul_Bandwidth, - AdditionalSpectrumEmission_t * - additionalSpectrumEmission, - struct MBSFN_SubframeConfigList - *mbsfn_SubframeConfigList -#if defined(Rel10) || defined(Rel14) - , - uint8_t MBMS_Flag, - MBSFN_AreaInfoList_r9_t * mbsfn_AreaInfoList, - PMCH_InfoList_r9_t * pmch_InfoList -#endif -#ifdef Rel14 - , - SystemInformationBlockType1_v1310_IEs_t * - sib1_ext_r13 -#endif - ); - -/** \brief RRC eNB Configuration primitive for PHY/MAC. Allows configuration of PHY/MAC resources based on System Information (SI), RRCConnectionSetup and RRCConnectionReconfiguration messages. -@param Mod_id Instance ID of ue -@param CC_id Component Carrier of the ue -@param eNB_id Index of eNB -@param radioResourceConfigCommon Structure from SIB2 for common radio parameters (if NULL keep existing configuration) -@param physcialConfigDedicated Structure from RRCConnectionSetup or RRCConnectionReconfiguration for dedicated PHY parameters (if NULL keep existing configuration) -@param measObj Structure from RRCConnectionReconfiguration for UE measurement procedures -@param mac_MainConfig Structure from RRCConnectionSetup or RRCConnectionReconfiguration for dedicated MAC parameters (if NULL keep existing configuration) -@param logicalChannelIdentity Logical channel identity index of corresponding logical channel config -@param logicalChannelConfig Pointer to logical channel configuration -@param measGapConfig Measurement Gap configuration for MAC (if NULL keep existing configuration) -@param tdd_Config TDD Configuration from SIB1 (if NULL keep existing configuration) -@param mobilityControlInfo mobility control info received for Handover -@param SIwindowsize SI Windowsize from SIB1 (if NULL keep existing configuration) -@param SIperiod SI Period from SIB1 (if NULL keep existing configuration) -@param MBMS_Flag indicates MBMS transmission -@param mbsfn_SubframeConfigList pointer to mbsfn subframe configuration list from SIB2 -@param mbsfn_AreaInfoList pointer to MBSFN Area Info list from SIB13 -@param pmch_InfoList pointer to PMCH_InfoList from MBSFNAreaConfiguration Message (MCCH Message) -*/ -int rrc_mac_config_req_ue(module_id_t module_idP, - int CC_id, - uint8_t eNB_index, - RadioResourceConfigCommonSIB_t * - radioResourceConfigCommon, - struct PhysicalConfigDedicated - *physicalConfigDedicated, -#if defined(Rel10) || defined(Rel14) - SCellToAddMod_r10_t * sCellToAddMod_r10, - //struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10, -#endif - MeasObjectToAddMod_t ** measObj, - MAC_MainConfig_t * mac_MainConfig, - long logicalChannelIdentity, - LogicalChannelConfig_t * logicalChannelConfig, - MeasGapConfig_t * measGapConfig, - TDD_Config_t * tdd_Config, - MobilityControlInfo_t * mobilityControlInfo, - uint8_t * SIwindowsize, - uint16_t * SIperiod, - ARFCN_ValueEUTRA_t * ul_CarrierFreq, - long *ul_Bandwidth, - AdditionalSpectrumEmission_t * - additionalSpectrumEmission, - struct MBSFN_SubframeConfigList - *mbsfn_SubframeConfigList -#if defined(Rel10) || defined(Rel14) - , - uint8_t MBMS_Flag, - MBSFN_AreaInfoList_r9_t * mbsfn_AreaInfoList, - PMCH_InfoList_r9_t * pmch_InfoList -#endif -#ifdef CBA - , - uint8_t num_active_cba_groups, uint16_t cba_rnti -#endif - ); - -uint16_t getRIV(uint16_t N_RB_DL, uint16_t RBstart, uint16_t Lcrbs); - -int get_subbandsize(uint8_t dl_bandwidth); - - -void get_Msg3allocret(COMMON_channels_t * cc, - sub_frame_t current_subframe, - frame_t current_frame, - frame_t * frame, sub_frame_t * subframe); - -void get_Msg3alloc(COMMON_channels_t * cc, - sub_frame_t current_subframe, - frame_t current_frame, - frame_t * frame, sub_frame_t * subframe); - -uint16_t mac_computeRIV(uint16_t N_RB_DL, uint16_t RBstart, - uint16_t Lcrbs); - -int get_phich_resource_times6(COMMON_channels_t * cc); - -int to_rbg(int dl_Bandwidth); - -int to_prb(int dl_Bandwidth); - -uint8_t get_Msg3harqpid(COMMON_channels_t * cc, - frame_t frame, sub_frame_t current_subframe); - -uint32_t pdcchalloc2ulframe(COMMON_channels_t * ccP, uint32_t frame, - uint8_t n); - -uint8_t pdcchalloc2ulsubframe(COMMON_channels_t * ccP, uint8_t n); - -int is_UL_sf(COMMON_channels_t * ccP, sub_frame_t subframeP); - -uint8_t getQm(uint8_t mcs); - -uint8_t subframe2harqpid(COMMON_channels_t * cc, frame_t frame, - sub_frame_t subframe); - -void get_srs_pos(COMMON_channels_t * cc, uint16_t isrs, - uint16_t * psrsPeriodicity, uint16_t * psrsOffset); - -void get_csi_params(COMMON_channels_t * cc, - struct CQI_ReportPeriodic *cqi_PMI_ConfigIndex, - uint16_t * Npd, uint16_t * N_OFFSET_CQI, int *H); - -uint8_t get_rel8_dl_cqi_pmi_size(UE_sched_ctrl * sched_ctl, int CC_idP, - COMMON_channels_t * cc, uint8_t tmode, - struct CQI_ReportPeriodic - *cqi_ReportPeriodic); - -uint8_t get_dl_cqi_pmi_size_pusch(COMMON_channels_t * cc, uint8_t tmode, - uint8_t ri, - CQI_ReportModeAperiodic_t * - cqi_ReportModeAperiodic); -void extract_pucch_csi(module_id_t mod_idP, int CC_idP, int UE_id, - frame_t frameP, sub_frame_t subframeP, - uint8_t * pdu, uint8_t length); - -void extract_pusch_csi(module_id_t mod_idP, int CC_idP, int UE_id, - frame_t frameP, sub_frame_t subframeP, - uint8_t * pdu, uint8_t length); - -uint16_t fill_nfapi_tx_req(nfapi_tx_request_body_t * tx_req_body, - uint16_t absSF, uint16_t pdu_length, - uint16_t pdu_index, uint8_t * pdu); - -void fill_nfapi_ulsch_config_request_rel8(nfapi_ul_config_request_pdu_t * - ul_config_pdu, uint8_t cqi_req, - COMMON_channels_t * cc, - struct PhysicalConfigDedicated - *physicalConfigDedicated, - uint8_t tmode, uint32_t handle, - uint16_t rnti, - uint8_t resource_block_start, - uint8_t - number_of_resource_blocks, - uint8_t mcs, - uint8_t cyclic_shift_2_for_drms, - uint8_t - frequency_hopping_enabled_flag, - uint8_t frequency_hopping_bits, - uint8_t new_data_indication, - uint8_t redundancy_version, - uint8_t harq_process_number, - uint8_t ul_tx_mode, - uint8_t current_tx_nb, - uint8_t n_srs, uint16_t size); - -#ifdef Rel14 -void fill_nfapi_ulsch_config_request_emtc(nfapi_ul_config_request_pdu_t * - ul_config_pdu, uint8_t ue_type, - uint16_t - total_number_of_repetitions, - uint16_t repetition_number, - uint16_t - initial_transmission_sf_io); -#endif - -void program_dlsch_acknak(module_id_t module_idP, int CC_idP, int UE_idP, - frame_t frameP, sub_frame_t subframeP, - uint8_t cce_idx); - -void fill_nfapi_dlsch_config(eNB_MAC_INST * eNB, - nfapi_dl_config_request_body_t * dl_req, - uint16_t length, uint16_t pdu_index, - uint16_t rnti, - uint8_t resource_allocation_type, - uint8_t - virtual_resource_block_assignment_flag, - uint16_t resource_block_coding, - uint8_t modulation, - uint8_t redundancy_version, - uint8_t transport_blocks, - uint8_t transport_block_to_codeword_swap_flag, - uint8_t transmission_scheme, - uint8_t number_of_layers, - uint8_t number_of_subbands, - // uint8_t codebook_index, - uint8_t ue_category_capacity, - uint8_t pa, - uint8_t delta_power_offset_index, - uint8_t ngap, - uint8_t nprb, - uint8_t transmission_mode, - uint8_t num_bf_prb_per_subband, - uint8_t num_bf_vector); - -void fill_nfapi_harq_information(module_id_t module_idP, - int CC_idP, - uint16_t rntiP, - uint16_t absSFP, - nfapi_ul_config_harq_information * - harq_information, uint8_t cce_idxP); - -void fill_nfapi_ulsch_harq_information(module_id_t module_idP, - int CC_idP, - uint16_t rntiP, - nfapi_ul_config_ulsch_harq_information - * harq_information); - -uint16_t fill_nfapi_uci_acknak(module_id_t module_idP, - int CC_idP, - uint16_t rntiP, - uint16_t absSFP, uint8_t cce_idxP); - -void fill_nfapi_dl_dci_1A(nfapi_dl_config_request_pdu_t * dl_config_pdu, - uint8_t aggregation_level, - uint16_t rnti, - uint8_t rnti_type, - uint8_t harq_process, - uint8_t tpc, - uint16_t resource_block_coding, - uint8_t mcs, - uint8_t ndi, uint8_t rv, uint8_t vrb_flag); - -nfapi_ul_config_request_pdu_t *has_ul_grant(module_id_t module_idP, - int CC_idP, uint16_t subframeP, - uint16_t rnti); - -uint8_t get_tmode(module_id_t module_idP, int CC_idP, int UE_idP); - -uint8_t get_ul_req_index(module_id_t module_idP, int CC_idP, - sub_frame_t subframeP); - -#ifdef Rel14 -int get_numnarrowbandbits(long dl_Bandwidth); - -int mpdcch_sf_condition(eNB_MAC_INST * eNB, int CC_id, frame_t frameP, - sub_frame_t subframeP, int rmax, - MPDCCH_TYPES_t mpdcch_type, int UE_id); - -int get_numnarrowbands(long dl_Bandwidth); - -int narrowband_to_first_rb(COMMON_channels_t * cc, int nb_index); - -#endif - -int l2_init_eNB(void); - -void Msg1_transmitted(module_id_t module_idP, uint8_t CC_id, - frame_t frameP, uint8_t eNB_id); -void Msg3_transmitted(module_id_t module_idP, uint8_t CC_id, - frame_t frameP, uint8_t eNB_id); -uint32_t from_earfcn(int eutra_bandP, uint32_t dl_earfcn); -int32_t get_uldl_offset(int eutra_bandP); -int l2_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active, - uint8_t HO_active); - -/*Slice related functions */ -uint16_t flexran_nb_rbs_allowed_slice(float rb_percentage, int total_rbs); - -int ue_slice_membership(int UE_id, int slice_id); - -#endif -/** @}*/ diff --git a/openair2/RRC/NR_UE/defs.h b/openair2/RRC/NR_UE/defs.h index 7fee548aa2..37db3a9f02 100644 --- a/openair2/RRC/NR_UE/defs.h +++ b/openair2/RRC/NR_UE/defs.h @@ -68,360 +68,6 @@ /* for ImsiMobileIdentity_t */ #include "MobileIdentity.h" -/* correct Rel(8|10)/Rel14 differences - * the code is in favor of Rel14, those defines do the translation - */ -#if !defined(Rel14) -# define CipheringAlgorithm_r12_t e_SecurityAlgorithmConfig__cipheringAlgorithm -# define CipheringAlgorithm_r12_eea0 SecurityAlgorithmConfig__cipheringAlgorithm_eea0 -# define CipheringAlgorithm_r12_eea1 SecurityAlgorithmConfig__cipheringAlgorithm_eea1 -# define CipheringAlgorithm_r12_eea2 SecurityAlgorithmConfig__cipheringAlgorithm_eea2 -# define CipheringAlgorithm_r12_spare1 SecurityAlgorithmConfig__cipheringAlgorithm_spare1 -# define Alpha_r12_al0 UplinkPowerControlCommon__alpha_al0 -# define Alpha_r12_al04 UplinkPowerControlCommon__alpha_al04 -# define Alpha_r12_al05 UplinkPowerControlCommon__alpha_al05 -# define Alpha_r12_al06 UplinkPowerControlCommon__alpha_al06 -# define Alpha_r12_al07 UplinkPowerControlCommon__alpha_al07 -# define Alpha_r12_al08 UplinkPowerControlCommon__alpha_al08 -# define Alpha_r12_al09 UplinkPowerControlCommon__alpha_al09 -# define Alpha_r12_al1 UplinkPowerControlCommon__alpha_al1 -# define PreambleTransMax_n3 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n3 -# define PreambleTransMax_n4 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n4 -# define PreambleTransMax_n5 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n5 -# define PreambleTransMax_n6 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n6 -# define PreambleTransMax_n7 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n7 -# define PreambleTransMax_n8 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n8 -# define PreambleTransMax_n10 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n10 -# define PreambleTransMax_n20 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n20 -# define PreambleTransMax_n50 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n50 -# define PreambleTransMax_n100 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n100 -# define PreambleTransMax_n200 RACH_ConfigCommon__ra_SupervisionInfo__preambleTransMax_n200 -# define PeriodicBSR_Timer_r12_sf5 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf5 -# define PeriodicBSR_Timer_r12_sf10 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf10 -# define PeriodicBSR_Timer_r12_sf16 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf16 -# define PeriodicBSR_Timer_r12_sf20 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf20 -# define PeriodicBSR_Timer_r12_sf32 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf32 -# define PeriodicBSR_Timer_r12_sf40 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf40 -# define PeriodicBSR_Timer_r12_sf64 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf64 -# define PeriodicBSR_Timer_r12_sf80 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf80 -# define PeriodicBSR_Timer_r12_sf128 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf128 -# define PeriodicBSR_Timer_r12_sf160 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf160 -# define PeriodicBSR_Timer_r12_sf320 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf320 -# define PeriodicBSR_Timer_r12_sf640 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf640 -# define PeriodicBSR_Timer_r12_sf1280 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf1280 -# define PeriodicBSR_Timer_r12_sf2560 MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_sf2560 -# define PeriodicBSR_Timer_r12_infinity MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity -# define RetxBSR_Timer_r12_sf320 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf320 -# define RetxBSR_Timer_r12_sf640 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf640 -# define RetxBSR_Timer_r12_sf1280 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf1280 -# define RetxBSR_Timer_r12_sf2560 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560 -# define RetxBSR_Timer_r12_sf5120 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf5120 -# define RetxBSR_Timer_r12_sf10240 MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf10240 -#endif - -// This corrects something generated by asn1c which is different between Rel8 and Rel10 -#if !defined(Rel10) && !defined(Rel14) -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member SystemInformation_r8_IEs_sib_TypeAndInfo_Member -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib2 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib2 -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib3 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib3 -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib4 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib4 -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib5 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib5 -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib6 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib6 -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib7 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib7 -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib8 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib8 -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib9 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib9 -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib10 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib10 -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib11 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib11 -#endif - - -#define NB_SIG_CNX_CH 1 -#define NB_CNX_CH MAX_MOBILES_PER_ENB -#define NB_SIG_CNX_UE 2 //MAX_MANAGED_RG_PER_MOBILE -#define NB_CNX_UE 2//MAX_MANAGED_RG_PER_MOBILE - -/* -#if defined(Rel10) || defined(Rel14) -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib12_v920 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib12_v920 -#define SystemInformation_r8_IEs__sib_TypeAndInfo__Member_PR_sib13_v920 SystemInformation_r8_IEs_sib_TypeAndInfo_Member_PR_sib13_v920 -#endif -*/ -//#include "L3_rrc_defs.h" -#ifndef NO_RRM -#include "L3_rrc_interface.h" -#include "rrc_rrm_msg.h" -#include "rrc_rrm_interface.h" -#endif - -#if defined(ENABLE_ITTI) -# include "intertask_interface.h" -#endif - -/* TODO: be sure this include is correct. - * It solves a problem of compilation of the RRH GW, - * issue #186. - */ -#if !defined(ENABLE_ITTI) -# include "as_message.h" -#endif - -#if defined(ENABLE_USE_MME) -# include "commonDef.h" -#endif - -//-------- -typedef unsigned int uid_t; -#define UID_LINEAR_ALLOCATOR_BITMAP_SIZE (((NUMBER_OF_UE_MAX/8)/sizeof(unsigned int)) + 1) -typedef struct uid_linear_allocator_s { - unsigned int bitmap[UID_LINEAR_ALLOCATOR_BITMAP_SIZE]; -} uid_allocator_t; - -//-------- - - - -#define PROTOCOL_RRC_CTXT_UE_FMT PROTOCOL_CTXT_FMT -#define PROTOCOL_RRC_CTXT_UE_ARGS(CTXT_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp) - -#define PROTOCOL_RRC_CTXT_FMT PROTOCOL_CTXT_FMT -#define PROTOCOL_RRC_CTXT_ARGS(CTXT_Pp) PROTOCOL_CTXT_ARGS(CTXT_Pp) -/** @defgroup _rrc RRC - * @ingroup _oai2 - * @{ - */ - - -#define UE_MODULE_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!! -#define UE_INDEX_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!! used to be -1 - -typedef enum { - RRC_OK=0, - RRC_ConnSetup_failed, - RRC_PHY_RESYNCH, - RRC_Handover_failed, - RRC_HO_STARTED -} RRC_status_t; - -typedef enum UE_STATE_e { - RRC_INACTIVE=0, - RRC_IDLE, - RRC_SI_RECEIVED, - RRC_CONNECTED, - RRC_RECONFIGURED, - RRC_HO_EXECUTION -} UE_STATE_t; - -typedef enum HO_STATE_e { - HO_IDLE=0, - HO_MEASURMENT, - HO_PREPARE, - HO_CMD, // initiated by the src eNB - HO_COMPLETE // initiated by the target eNB -} HO_STATE_t; - -//#define NUMBER_OF_UE_MAX MAX_MOBILES_PER_RG -#define RRM_FREE(p) if ( (p) != NULL) { free(p) ; p=NULL ; } -#define RRM_MALLOC(t,n) (t *) malloc16( sizeof(t) * n ) -#define RRM_CALLOC(t,n) (t *) malloc16( sizeof(t) * n) -#define RRM_CALLOC2(t,s) (t *) malloc16( s ) - -#define MAX_MEAS_OBJ 6 -#define MAX_MEAS_CONFIG 6 -#define MAX_MEAS_ID 6 - -#define PAYLOAD_SIZE_MAX 1024 -#define RRC_BUF_SIZE 255 -#define UNDEF_SECURITY_MODE 0xff -#define NO_SECURITY_MODE 0x20 - -#define CBA_OFFSET 0xfff4 -// #define NUM_MAX_CBA_GROUP 4 // in the platform_constants - -/* TS 36.331: RRC-TransactionIdentifier ::= INTEGER (0..3) */ -#if defined(USRP_REC_PLAY) -#define RRC_TRANSACTION_IDENTIFIER_NUMBER 1 -#else -#define RRC_TRANSACTION_IDENTIFIER_NUMBER 3 -#endif - -typedef struct { - unsigned short transport_block_size; /*!< \brief Minimum PDU size in bytes provided by RLC to MAC layer interface */ - unsigned short max_transport_blocks; /*!< \brief Maximum PDU size in bytes provided by RLC to MAC layer interface */ - unsigned long Guaranteed_bit_rate; /*!< \brief Guaranteed Bit Rate (average) to be offered by MAC layer scheduling*/ - unsigned long Max_bit_rate; /*!< \brief Maximum Bit Rate that can be offered by MAC layer scheduling*/ - uint8_t Delay_class; /*!< \brief Delay class offered by MAC layer scheduling*/ - uint8_t Target_bler; /*!< \brief Target Average Transport Block Error rate*/ - uint8_t Lchan_t; /*!< \brief Logical Channel Type (BCCH,CCCH,DCCH,DTCH_B,DTCH,MRBCH)*/ -} __attribute__ ((__packed__)) LCHAN_DESC; - -#define LCHAN_DESC_SIZE sizeof(LCHAN_DESC) - -typedef struct UE_RRC_INFO_s { - UE_STATE_t State; - uint8_t SIB1systemInfoValueTag; - uint32_t SIStatus; - uint32_t SIcnt; -#if defined(Rel10) || defined(Rel14) - uint8_t MCCHStatus[8]; // MAX_MBSFN_AREA -#endif - uint8_t SIwindowsize; //!< Corresponds to the SIB1 si-WindowLength parameter. The unit is ms. Possible values are (final): 1,2,5,10,15,20,40 - uint8_t handoverTarget; - HO_STATE_t ho_state; - uint16_t SIperiod; //!< Corresponds to the SIB1 si-Periodicity parameter (multiplied by 10). Possible values are (final): 80,160,320,640,1280,2560,5120 - unsigned short UE_index; - uint32_t T300_active; - uint32_t T300_cnt; - uint32_t T304_active; - uint32_t T304_cnt; - uint32_t T310_active; - uint32_t T310_cnt; - uint32_t N310_cnt; - uint32_t N311_cnt; - rnti_t rnti; -} __attribute__ ((__packed__)) UE_RRC_INFO; - -typedef struct UE_S_TMSI_s { - boolean_t presence; - mme_code_t mme_code; - m_tmsi_t m_tmsi; -} __attribute__ ((__packed__)) UE_S_TMSI; - -#if defined(ENABLE_ITTI) -typedef enum e_rab_satus_e { - E_RAB_STATUS_NEW, - E_RAB_STATUS_DONE, // from the eNB perspective - E_RAB_STATUS_ESTABLISHED, // get the reconfigurationcomplete form UE - E_RAB_STATUS_FAILED, - E_RAB_STATUS_TORELEASE // to release DRB between eNB and UE -} e_rab_status_t; - -typedef struct e_rab_param_s { - e_rab_t param; - uint8_t status; - uint8_t xid; // transaction_id - s1ap_Cause_t cause; - uint8_t cause_value; -} __attribute__ ((__packed__)) e_rab_param_t; -#endif - - - -/* Intermediate structure for Handover management. Associated per-UE in eNB_RRC_INST */ -typedef struct HANDOVER_INFO_s { - uint8_t ho_prepare; - uint8_t ho_complete; - uint8_t modid_s; //module_idP of serving cell - uint8_t modid_t; //module_idP of target cell - uint8_t ueid_s; //UE index in serving cell - uint8_t ueid_t; //UE index in target cell - AS_Config_t as_config; /* these two parameters are taken from 36.331 section 10.2.2: HandoverPreparationInformation-r8-IEs */ - AS_Context_t as_context; /* They are mandatory for HO */ - uint8_t buf[RRC_BUF_SIZE]; /* ASN.1 encoded handoverCommandMessage */ - int size; /* size of above message in bytes */ -} HANDOVER_INFO; - -#define RRC_HEADER_SIZE_MAX 64 -#define RRC_BUFFER_SIZE_MAX 1024 -typedef struct { - char Payload[RRC_BUFFER_SIZE_MAX]; - char Header[RRC_HEADER_SIZE_MAX]; - char payload_size; -} RRC_BUFFER; -#define RRC_BUFFER_SIZE sizeof(RRC_BUFFER) - -typedef struct RB_INFO_s { - uint16_t Rb_id; //=Lchan_id - LCHAN_DESC Lchan_desc[2]; - // MAC_MEAS_REQ_ENTRY *Meas_entry; -} RB_INFO; - -typedef struct SRB_INFO_s { - uint16_t Srb_id; //=Lchan_id - RRC_BUFFER Rx_buffer; - RRC_BUFFER Tx_buffer; - LCHAN_DESC Lchan_desc[2]; - unsigned int Trans_id; - uint8_t Active; -} SRB_INFO; - -typedef struct RB_INFO_TABLE_ENTRY_s { - RB_INFO Rb_info; - uint8_t Active; - uint32_t Next_check_frame; - uint8_t Status; -} RB_INFO_TABLE_ENTRY; - -typedef struct SRB_INFO_TABLE_ENTRY_s { - SRB_INFO Srb_info; - uint8_t Active; - uint8_t Status; - uint32_t Next_check_frame; -} SRB_INFO_TABLE_ENTRY; - -typedef struct MEAS_REPORT_LIST_s { - MeasId_t measId; - uint32_t numberOfReportsSent; -} MEAS_REPORT_LIST; - -typedef struct HANDOVER_INFO_UE_s { - PhysCellId_t targetCellId; - uint8_t measFlag; -} HANDOVER_INFO_UE; -typedef uid_t ue_uid_t; - -typedef struct { - uint8_t *MIB; - uint8_t sizeof_MIB; - uint8_t *SIB1; - uint8_t sizeof_SIB1; - uint8_t *SIB23; - uint8_t sizeof_SIB23; -#ifdef Rel14 - uint8_t *SIB1_BR; - uint8_t sizeof_SIB1_BR; - uint8_t *SIB23_BR; - uint8_t sizeof_SIB23_BR; -#endif - int physCellId; - int Ncp; - int p_eNB; - uint32_t dl_CarrierFreq; - uint32_t ul_CarrierFreq; - uint32_t pbch_repetition; - BCCH_BCH_Message_t mib; - BCCH_DL_SCH_Message_t siblock1; - BCCH_DL_SCH_Message_t systemInformation; - // SystemInformation_t systemInformation; - SystemInformationBlockType1_t *sib1; - SystemInformationBlockType2_t *sib2; - SystemInformationBlockType3_t *sib3; -#ifdef Rel14 - SystemInformationBlockType1_t *sib1_BR; - SystemInformationBlockType2_t *sib2_BR; - SystemInformationBlockType2_t *sib3_BR; -#endif -#if defined(Rel10) || defined(Rel14) - SystemInformationBlockType13_r9_t *sib13; - uint8_t MBMS_flag; - uint8_t num_mbsfn_sync_area; - uint8_t **MCCH_MESSAGE; // MAX_MBSFN_AREA - uint8_t sizeof_MCCH_MESSAGE[8];// MAX_MBSFN_AREA - MCCH_Message_t mcch; - MBSFNAreaConfiguration_r9_t *mcch_message; - SRB_INFO MCCH_MESS[8];// MAX_MBSFN_AREA -#endif - SRB_INFO SI; - SRB_INFO Srb0; - uint8_t *paging[NUMBER_OF_UE_MAX]; - uint32_t sizeof_paging[NUMBER_OF_UE_MAX]; -} rrc_eNB_carrier_data_t; - -#define MAX_UE_CAPABILITY_SIZE 255 -typedef struct OAI_UECapability_s { - uint8_t sdu[MAX_UE_CAPABILITY_SIZE]; - uint8_t sdu_size; - UE_EUTRA_Capability_t *UE_EUTRA_Capability; -} OAI_UECapability_t; typedef struct NR_UE_RRC_INST_s { nr_rrc_state_t rrc_state; @@ -502,20 +148,12 @@ typedef struct NR_UE_RRC_INST_s { e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm; #endif - MeasConfig_t meas_config; - CellGroupConfig_t cell_group_config; - RadioBearerConfig_t radio_bearer_config; - + MeasConfig_t *meas_config; + CellGroupConfig_t *cell_group_config; + RadioBearerConfig_t *radio_bearer_config; + } NR_UE_RRC_INST_t; -typedef struct UE_PF_PO_s { - boolean_t enable_flag; /* flag indicate whether current object is used */ - uint16_t ue_index_value; /* UE index value */ - uint8_t PF_min; /* minimal value of Paging Frame (PF) */ - uint8_t PO; /* Paging Occasion (PO) */ - uint32_t T; /* DRX cycle */ -} UE_PF_PO_t; - #include "proto.h" #endif diff --git a/openair2/RRC/NR_UE/rrc_UE.c b/openair2/RRC/NR_UE/rrc_UE.c index e17e7a2838..6e5bb3227c 100644 --- a/openair2/RRC/NR_UE/rrc_UE.c +++ b/openair2/RRC/NR_UE/rrc_UE.c @@ -143,29 +143,7 @@ uint8_t nr_rrc_ue_decode_dcch( } - // from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (encoded) -// TODO check to use this or downer one -uint8_t nr_rrc_ue_decode_rrcReconfiguration( - const uint8_t *buffer, - const uint32_t size -){ - RRCReconfiguration_t *rrcReconfiguration; - - // decoding - uper_decode(NULL, - &asn_DEF_RRCReconfiguration, - (void **)&rrcReconfiguration, - (uint8_t *)buffer, - size); - - nr_rrc_ue_process_rrcReconfiguration(rrcReconfiguration); // after decoder - - free(rrcReconfiguration); - -} -// from LTE-RRC DL-DCCH RRCConnectionReconfiguration nr-secondary-cell-group-config (encoded) -// TODO check to use this or upper one uint8_t nr_rrc_ue_decode_secondary_cellgroup_config( const uint8_t *buffer, const uint32_t size @@ -178,9 +156,15 @@ uint8_t nr_rrc_ue_decode_secondary_cellgroup_config( (uint8_t *)buffer, size, 0, 0); - nr_rrc_ue_process_scg_config(cellGroupConfig); + if(NR_UE_rrc_inst->cell_group_config == (CellGroupConfig_t *)0){ + NR_UE_rrc_inst->cell_group_config = cellGroupConfig; + nr_rrc_ue_process_scg_config(cellGroupConfig); + }else{ + nr_rrc_ue_process_scg_config(cellGroupConfig); + asn_DEF_CellGroupConfig.free_struct(asn_DEF_CellGroupConfig, cellGroupConfig, 0); + } - free(cellGroupConfig); + nr_rrc_mac_config_req_ue(); } @@ -191,25 +175,41 @@ uint8_t nr_rrc_ue_process_rrcReconfiguration(RRCReconfiguration_t *rrcReconfigur switch(rrcReconfiguration.criticalExtensions.present){ case RRCReconfiguration__criticalExtensions_PR_rrcReconfiguration: if(rrcReconfiguration.criticalExtensions.rrcReconfiguration->radioBearerConfig != (RadioBearerConfig_t *)0){ - nr_rrc_ue_process_radio_bearer_config(rrcReconfiguration->radioBearerConfig); + if(NR_UE_rrc_inst->radio_bearer_config == (RadioBearerConfig_t *)0){ + NR_UE_rrc_inst->radio_bearer_config = rrcReconfiguration->radioBearerConfig; + }else{ + nr_rrc_ue_process_radio_bearer_config(rrcReconfiguration->radioBearerConfig); + } } if(rrcReconfiguration.criticalExtensions.rrcReconfiguration->secondaryCellGroup != (OCTET_STRING_t *)0){ CellGroupConfig_t *cellGroupConfig = (CellGroupConfig_t *)0; - // TODO check if this deocder is need for decode "SecondaryCellGroup" of use type "CellGroupConfig" directly uper_decode(NULL, &asn_DEF_CellGroupConfig, //might be added prefix later (void **)&cellGroupConfig, (uint8_t *)rrcReconfiguration->secondaryCellGroup->buffer, rrcReconfiguration->secondaryCellGroup.size, 0, 0); - nr_rrc_ue_process_scg_config(cellGroupConfig); - - free(cellGroupConfig); + if(NR_UE_rrc_inst->cell_group_config == (CellGroupConfig_t *)0){ + // first time receive the configuration, just use the memory allocated from uper_decoder. TODO this is not good implementation, need to maintain RRC_INST own structure every time. + NR_UE_rrc_inst->cell_group_config = cellGroupConfig; + nr_rrc_ue_process_scg_config(cellGroupConfig); + }else{ + // after first time, update it and free the memory after. + nr_rrc_ue_process_scg_config(cellGroupConfig); + asn_DEF_CellGroupConfig.free_struct(asn_DEF_CellGroupConfig, cellGroupConfig, 0); + } + } if(rrcReconfiguration.criticalExtensions.rrcReconfiguration->measConfig != (MeasConfig *)0){ - nr_rrc_ue_process_meas_config(rrcReconfiguration.criticalExtensions.rrcReconfiguration->measConfig); + if(NR_UE_rrc_inst->meas_config == (MeasConfig_t *)0){ + NR_UE_rrc_inst->meas_config = rrcReconfiguration->measConfig; + }else{ + // if some element need to be updated + nr_rrc_ue_process_meas_config(rrcReconfiguration->measConfig); + } + } if(rrcReconfiguration.criticalExtensions.rrcReconfiguration->lateNonCriticalExtension != (OCTET_STRING_t *)0){ @@ -225,39 +225,18 @@ uint8_t nr_rrc_ue_process_rrcReconfiguration(RRCReconfiguration_t *rrcReconfigur default: break; } - - - - // process + nr_rrc_mac_config_req_ue(); } uint8_t nr_rrc_ue_process_meas_config(MeasConfig_t *meas_config){ - // copy into nr_rrc inst - memcpy( (void *)NR_UE_rrc_inst->measConfig, - (void *)meas_config, - sizeof(MeasConfig_t)); - // process it -} -uint8_t nr_rrc_ue_process_scg_config(CellGroupConfig_t *cell_group_config){ - // copy into nr_rrc inst - nr_ue_process_rlc_bearer_list(); - nr_ue_process_mac_cell_group_config(); - nr_ue_process_physical_cell_group_config(); - nr_ue_process_spcell_config(); - nr_ue_process_spcell_list(); - - memcpy( (void *)NR_UE_rrc_inst->cellGroupConfig, - (void *)cellGroupConfig, - sizeof(cellGroupConfig_t)); - // process it +} + +uint8_t nr_rrc_ue_process_scg_config(CellGroupConfig_t *cell_group_config){ + } uint8_t nr_rrc_ue_process_radio_bearer_config(RadioBearerConfig_t *radio_bearer_config){ - // copy into nr_rrc inst - memcpy( (void *)NR_UE_rrc_inst->radioBearerConfig, - (void *)radio_bearer_config, - sizeof(RadioBearerConfig_t)); - // process it + } @@ -276,19 +255,22 @@ uint8_t openair_rrc_top_init_ue_nr(void){ } -uint8_t nr_ue_process_rlc_bearer_list(){ +uint8_t nr_ue_process_rlc_bearer_list(CellGroupConfig_t *cell_group_config){ + }; -uint8_t nr_ue_process_mac_cell_group_config(){ +uint8_t nr_ue_process_secondary_cell_list(CellGroupConfig_t *cell_group_config){ + }; -uint8_t nr_ue_process_physical_cell_group_config(){ +uint8_t nr_ue_process_mac_cell_group_config(MAC_CellGroupConfig_t *mac_cell_group_config){ + }; -uint8_t nr_ue_process_spcell_config(){ +uint8_t nr_ue_process_physical_cell_group_config(PhysicalCellGroupConfig_t *phy_cell_group_config){ + }; -uint8_t nr_ue_process_spcell_list(){ +uint8_t nr_ue_process_spcell_config(SpCellConfig_t *spcell_config){ + }; - - diff --git a/openair2/RRC/NR_UE/vars.h b/openair2/RRC/NR_UE/vars.h index 83bfdebc92..f21b49e916 100644 --- a/openair2/RRC/NR_UE/vars.h +++ b/openair2/RRC/NR_UE/vars.h @@ -37,212 +37,5 @@ #include "COMMON/mac_rrc_primitives.h" #include "LAYER2/MAC/defs.h" -UE_PF_PO_t UE_PF_PO[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; -pthread_mutex_t ue_pf_po_mutex; NR_UE_RRC_INST_t *NR_UE_rrc_inst; -#include "LAYER2/MAC/extern.h" -#define MAX_U32 0xFFFFFFFF - -uint8_t DRB2LCHAN[8]; - -long logicalChannelGroup0 = 0; -long logicalChannelSR_Mask_r9=0; - -struct LogicalChannelConfig__ul_SpecificParameters LCSRB1 = {1, - LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity, - 0, - &logicalChannelGroup0 -}; -struct LogicalChannelConfig__ul_SpecificParameters LCSRB2 = {3, - LogicalChannelConfig__ul_SpecificParameters__prioritisedBitRate_infinity, - 0, - &logicalChannelGroup0 -}; - - -#if defined(Rel10) || defined(Rel14) -struct LogicalChannelConfig__ext1 logicalChannelSR_Mask_r9_ext1 = { - logicalChannelSR_Mask_r9: &logicalChannelSR_Mask_r9 -}; -#endif - -// These are the default SRB configurations from 36.331 (Chapter 9, p. 176-179 in v8.6) -LogicalChannelConfig_t SRB1_logicalChannelConfig_defaultValue = {ul_SpecificParameters: &LCSRB1 -#if defined(Rel10) || defined(Rel14) - , - ext1: &logicalChannelSR_Mask_r9_ext1 -#endif - }; - -LogicalChannelConfig_t SRB2_logicalChannelConfig_defaultValue = {ul_SpecificParameters: &LCSRB2 -#if defined(Rel10) || defined(Rel14) - , - ext1: &logicalChannelSR_Mask_r9_ext1 -#endif - }; - -//CONSTANTS -rlc_info_t Rlc_info_um,Rlc_info_am_config; -uint16_t RACH_FREQ_ALLOC; -//uint8_t NB_RACH; -LCHAN_DESC BCCH_LCHAN_DESC,CCCH_LCHAN_DESC,DCCH_LCHAN_DESC,DTCH_DL_LCHAN_DESC,DTCH_UL_LCHAN_DESC; -MAC_MEAS_T BCCH_MEAS_TRIGGER,CCCH_MEAS_TRIGGER,DCCH_MEAS_TRIGGER,DTCH_MEAS_TRIGGER; -MAC_AVG_T BCCH_MEAS_AVG, CCCH_MEAS_AVG,DCCH_MEAS_AVG, DTCH_MEAS_AVG; - -// timers -uint16_t T300[8] = {100,200,300,400,600,1000,1500,2000}; -uint16_t T310[8] = {0,50,100,200,500,1000,2000}; -uint16_t N310[8] = {1,2,3,4,6,8,10,20}; -uint16_t N311[8] = {1,2,3,4,6,8,10,20}; -uint32_t T304[8] = {50,100,150,200,500,1000,2000,MAX_U32}; - -// TimeToTrigger enum mapping table (36.331 TimeToTrigger IE) -uint32_t timeToTrigger_ms[16] = {0,40,64,80,100,128,160,256,320,480,512,640,1024,1280,2560,5120}; - -/* 36.133 Section 9.1.4 RSRP Measurement Report Mapping, Table: 9.1.4-1 */ -float RSRP_meas_mapping[98] = { - -140, - -139, - -138, - -137, - -136, - -135, - -134, - -133, - -132, - -131, - -130, - -129, - -128, - -127, - -126, - -125, - -124, - -123, - -122, - -121, - -120, - -119, - -118, - -117, - -116, - -115, - -114, - -113, - -112, - -111, - -110, - -109, - -108, - -107, - -106, - -105, - -104, - -103, - -102, - -101, - -100, - -99, - -98, - -97, - -96, - -95, - -94, - -93, - -92, - -91, - -90, - -89, - -88, - -87, - -86, - -85, - -84, - -83, - -82, - -81, - -80, - -79, - -78, - -77, - -76, - -75, - -74, - -73, - -72, - -71, - -70, - -69, - -68, - -67, - -66, - -65, - -64, - -63, - -62, - -61, - -60, - -59, - -58, - -57, - -56, - -55, - -54, - -53, - -52, - -51, - -50, - -49, - -48, - -47, - -46, - -45, - -44, - -43 -}; - -float RSRQ_meas_mapping[35] = { - -19, - -18.5, - -18, - -17.5, - -17, - -16.5, - -16, - -15.5, - -15, - -14.5, - -14, - -13.5, - -13, - -12.5, - -12, - -11.5, - -11, - -10.5, - -10, - -9.5, - -9, - -8.5, - -8, - -7.5, - -7, - -6.5, - -6, - -5.5, - -5, - -4.5, - -4, - -3.5, - -3, - -2.5, - -2 -}; - -// only used for RRC connection re-establishment procedure TS36.331 5.3.7 -// [0]: current C-RNTI, [1]: prior C-RNTI -// insert one when eNB received RRCConnectionReestablishmentRequest message -// delete one when eNB received RRCConnectionReestablishmentComplete message -uint16_t reestablish_rnti_map[NUMBER_OF_UE_MAX][2] = {{0}}; - #endif From 6c1c711e08f3b8a850cdf7bd238338259608639b Mon Sep 17 00:00:00 2001 From: WEI-TAI CHEN Date: Fri, 18 May 2018 08:00:30 -0700 Subject: [PATCH 10/13] 1. NR gNB Application use ITTI transmit config. to RRC 2.NR RRC do_SERVINGCELLCONFIGCOMMON for all of common config. will be transmit to lower layer by rrc_mac_config_req_gNB" --- cmake_targets/CMakeLists.txt | 6 +- common/ran_context.h | 2 +- openair2/COMMON/platform_types.h | 7 + openair2/COMMON/rrc_messages_types.h | 17 +- openair2/ENB_APP/gnb_app.c | 2 +- openair2/ENB_APP/gnb_config.c | 220 +++++--- openair2/ENB_APP/gnb_paramdef.h | 55 +- openair2/RRC/NR/MESSAGES/asn1_msg.c | 521 +++++++++++++++++- openair2/RRC/NR/defs_NR.h | 77 +-- openair2/RRC/NR/rrc_gNB.c | 141 ++--- .../CONF/enb.band7.tm1.50PRB.usrpb210.conf | 17 +- 11 files changed, 839 insertions(+), 226 deletions(-) diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index 6450e7d7db..d109a58876 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -364,9 +364,9 @@ file(GLOB nr_rrc_source ${NR_RRC_FULL_DIR}/*.c) file(GLOB nr_rrc_h ${NR_RRC_FULL_DIR}/*.h) set(nr_rrc_h ${nr_rrc_h} ${NR_RRC_FULL_DIR}/asn1_constants.h) set_source_files_properties(${nr_rrc_source} PROPERTIES COMPILE_FLAGS -w) # suppress warnings from generated code -add_library(NR_RRC_LIB ${nr_rrc_h} ${nr_rrc_source} - ${OPENAIR2_DIR}/RRC/NR/MESSAGES/asn1_msg.c) -include_directories ("${NR_RRC_FULL_DIR}") +#add_library(NR_RRC_LIB ${nr_rrc_h} ${nr_rrc_source} +# ${OPENAIR2_DIR}/RRC/NR/MESSAGES/asn1_msg.c) +#include_directories ("${NR_RRC_FULL_DIR}") # add the command to generate the source code # Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make diff --git a/common/ran_context.h b/common/ran_context.h index 76f1b63e3d..10b0fe1fc3 100644 --- a/common/ran_context.h +++ b/common/ran_context.h @@ -91,7 +91,7 @@ typedef struct { /// NB_IoT RRC context variables //struct eNB_RRC_INST_NB_IoT_s **nb_iot_rrc; /// NR RRC context variables - struct gNB_RRC_INST_s **nr_rrc; + struct gNB_RRC_INST_s **nrrrc; /// MAC context variables struct eNB_MAC_INST_s **mac; /// NB_IoT MAC context variables diff --git a/openair2/COMMON/platform_types.h b/openair2/COMMON/platform_types.h index 0ab8d96701..71c8dad4a6 100644 --- a/openair2/COMMON/platform_types.h +++ b/openair2/COMMON/platform_types.h @@ -84,6 +84,10 @@ typedef boolean_t eNB_flag_t; #define ENB_FLAG_NO FALSE #define ENB_FLAG_YES TRUE +typedef boolean_t gNB_flag_t; +#define GNB_FLAG_NO FALSE +#define GNB_FLAG_YES TRUE + typedef boolean_t srb_flag_t; #define SRB_FLAG_NO FALSE #define SRB_FLAG_YES TRUE @@ -236,6 +240,9 @@ typedef struct protocol_ctxt_s { #define UE_INSTANCE_TO_MODULE_ID( iNSTANCE ) iNSTANCE - NB_eNB_INST #define ENB_INSTANCE_TO_MODULE_ID( iNSTANCE )iNSTANCE +//NR +#define GNB_MODULE_ID_TO_INSTANCE( mODULE_iD ) mODULE_iD +#define GNB_INSTANCE_TO_MODULE_ID( iNSTANCE )iNSTANCE #define MODULE_ID_TO_INSTANCE(mODULE_iD, iNSTANCE, eNB_fLAG) \ if(eNB_fLAG == ENB_FLAG_YES) \ diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 8398b135b1..6d650b7261 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -280,28 +280,34 @@ typedef struct NRRrcConfigurationReq_s { //NR DL SCS-SpecificCarrier uint32_t DL_offsetToCarrier[MAX_NUM_CCs]; - long DL_SubcarrierSpacing[MAX_NUM_CCs]; + long DL_SCS_SubcarrierSpacing[MAX_NUM_CCs]; long DL_SCS_SpecificCarrier_k0[MAX_NUM_CCs]; uint32_t DL_carrierBandwidth[MAX_NUM_CCs]; //NR BWP-DownlinkCommon - uint32_t DL_locationAndBandwidth[MAX_NUM_CCs]; + uint32_t DL_locationAndBandwidth[MAX_NUM_CCs]; + long DL_BWP_SubcarrierSpacing[MAX_NUM_CCs]; + lte_prefix_type_t DL_BWP_prefix_type[MAX_NUM_CCs]; //NR FrequencyInfoUL long UL_FreqBandIndicatorNR[MAX_NUM_CCs]; long UL_absoluteFrequencyPointA[MAX_NUM_CCs]; - long FrequencyInfoUL_p_Max[MAX_NUM_CCs]; - long frequencyShift7p5khz[MAX_NUM_CCs]; + lte_prefix_type_t UL_additionalSpectrumEmission[MAX_NUM_CCs] + long UL_p_Max[MAX_NUM_CCs]; + long ULfrequencyShift7p5khz[MAX_NUM_CCs]; //NR UL SCS-SpecificCarrier uint32_t UL_offsetToCarrier[MAX_NUM_CCs]; - long UL_SubcarrierSpacing[MAX_NUM_CCs]; + long UL_SCS_SubcarrierSpacing[MAX_NUM_CCs]; long UL_SCS_SpecificCarrier_k0[MAX_NUM_CCs]; uint32_t UL_carrierBandwidth[MAX_NUM_CCs]; // NR BWP-UplinkCommon uint32_t UL_locationAndBandwidth[MAX_NUM_CCs]; + long UL_BWP_SubcarrierSpacing[MAX_NUM_CCs]; + lte_prefix_type_t UL_BWP_prefix_type[MAX_NUM_CCs]; + long ServingCellConfigCommon_ssb_PositionsInBurst_PR[MAX_NUM_CCs]; long ServingCellConfigCommon_ssb_periodicityServingCell[MAX_NUM_CCs]; //ServingCellConfigCommon long ServingCellConfigCommon_dmrs_TypeA_Position[MAX_NUM_CCs]; //ServingCellConfigCommon long NIA_SubcarrierSpacing[MAX_NUM_CCs]; //ServingCellConfigCommon Used only for non-initial access @@ -394,6 +400,7 @@ typedef struct NRRrcConfigurationReq_s { long PDCCH_interleaverSize[MAX_NUM_CCs]; long PDCCH_shiftIndex[MAX_NUM_CCs]; long PDCCH_precoderGranularity[MAX_NUM_CCs]; //Corresponds to L1 parameter 'CORESET-precoder-granuality' + long PDCCH_TCI_StateId[MAX_NUM_CCs]; BOOLEAN_t tci_PresentInDCI[MAX_NUM_CCs]; //NR PDCCH-ConfigCommon commonSearchSpaces diff --git a/openair2/ENB_APP/gnb_app.c b/openair2/ENB_APP/gnb_app.c index 12222a2515..15d5ef6fea 100644 --- a/openair2/ENB_APP/gnb_app.c +++ b/openair2/ENB_APP/gnb_app.c @@ -92,7 +92,7 @@ static void configure_nrrrc(uint32_t gnb_id) msg_p = itti_alloc_new_message (TASK_GNB_APP, NRRRC_CONFIGURATION_REQ); if (RC.nr_rrc[gnb_id]) { - RCconfig_NRRRC(msg_p,gnb_id, RC.nr_rrc[gnb_id]); + RCconfig_NRRRC(msg_p,gnb_id, RC.nrrrc[gnb_id]); LOG_I(GNB_APP,"Sending configuration message to NR_RRC task\n"); diff --git a/openair2/ENB_APP/gnb_config.c b/openair2/ENB_APP/gnb_config.c index 08273aca8d..a0000f79bd 100644 --- a/openair2/ENB_APP/gnb_config.c +++ b/openair2/ENB_APP/gnb_config.c @@ -67,31 +67,34 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { //NR DL SCS-SpecificCarrier uint32_t DL_offsetToCarrier = 0; - int32_t DL_SubcarrierSpacing = 0; + int32_t DL_SCS_SubcarrierSpacing = 0; int32_t DL_SCS_SpecificCarrier_k0 = 0; uint32_t DL_carrierBandwidth = 0; // NR BWP-DownlinkCommon - uint32_t DL_locationAndBandwidth = 0; + uint32_t DL_locationAndBandwidth = 0; + long DL_BWP_SubcarrierSpacing = 0; + char* DL_BWP_prefix_type = NULL; //NR FrequencyInfoUL int32_t UL_FreqBandIndicatorNR = 0; int32_t UL_absoluteFrequencyPointA = 0; - int32_t FrequencyInfoUL_p_Max = 0; - int32_t frequencyShift7p5khz = 0; + uint32_t UL_additionalSpectrumEmission = 0; + int32_t UL_p_Max = 0; + int32_t UL_frequencyShift7p5khz = 0; //NR UL SCS-SpecificCarrier uint32_t UL_offsetToCarrier = 0; - int32_t UL_SubcarrierSpacing = 0; + int32_t UL_SCS_SubcarrierSpacing = 0; int32_t UL_SCS_SpecificCarrier_k0 = 0; uint32_t UL_carrierBandwidth = 0; // NR BWP-UplinkCommon uint32_t UL_locationAndBandwidth = 0; - - int32_t subCarrierSpacingCommon = 0; - uint32_t pdcch_ConfigSIB1 = 0; - int32_t frequencyOffsetSSB = 0; + long UL_BWP_SubcarrierSpacing = 0; + char* UL_BWP_prefix_type = NULL; + + int32_t ServingCellConfigCommon_ssb_PositionsInBurst_PR = 0; int32_t ServingCellConfigCommon_ssb_periodicityServingCell = 0; int32_t ServingCellConfigCommon_dmrs_TypeA_Position = 0; int32_t NIA_SubcarrierSpacing = 0; @@ -489,19 +492,19 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { RC.config_file_name, i, DL_offsetToCarrier); } - if (strcmp(DL_SubcarrierSpacing,"kHz15")==0) { - NRRRC_CONFIGURATION_REQ (msg_p).DL_SubcarrierSpacing[j] = SubcarrierSpacing_kHz15; - }else if (strcmp(pusch_alpha,"kHz30")==0) { - NRRRC_CONFIGURATION_REQ (msg_p).DL_SubcarrierSpacing[j] = SubcarrierSpacing_kHz30; - }else if (strcmp(pusch_alpha,"kHz60")==0) { - NRRRC_CONFIGURATION_REQ (msg_p).DL_SubcarrierSpacing[j] = SubcarrierSpacing_kHz60; - }else if (strcmp(pusch_alpha,"kHz120")==0) { - NRRRC_CONFIGURATION_REQ (msg_p).DL_SubcarrierSpacing[j] = SubcarrierSpacing_kHz120; - }else if (strcmp(pusch_alpha,"kHz240")==0) { - NRRRC_CONFIGURATION_REQ (msg_p).DL_SubcarrierSpacing[j] = SubcarrierSpacing_kHz240; + if (strcmp(DL_SCS_SubcarrierSpacing,"kHz15")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).DL_SCS_SubcarrierSpacing[j] = SubcarrierSpacing_kHz15; + }else if (strcmp(DL_SCS_SubcarrierSpacing,"kHz30")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).DL_SCS_SubcarrierSpacing[j] = SubcarrierSpacing_kHz30; + }else if (strcmp(DL_SCS_SubcarrierSpacing,"kHz60")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).DL_SCS_SubcarrierSpacing[j] = SubcarrierSpacing_kHz60; + }else if (strcmp(DL_SCS_SubcarrierSpacing,"kHz120")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).DL_SCS_SubcarrierSpacing[j] = SubcarrierSpacing_kHz120; + }else if (strcmp(DL_SCS_SubcarrierSpacing,"kHz240")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).DL_SCS_SubcarrierSpacing[j] = SubcarrierSpacing_kHz240; }else { - AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for DL_SubcarrierSpacing choice: minusinfinity,kHz15,kHz30,kHz60,kHz120,kHz240!\n", - RC.config_file_name, i, DL_SubcarrierSpacing); + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for DL_SCS_SubcarrierSpacing choice: minusinfinity,kHz15,kHz30,kHz60,kHz120,kHz240!\n", + RC.config_file_name, i, DL_SCS_SubcarrierSpacing); } switch (DL_SCS_SpecificCarrier_k0) { @@ -536,6 +539,33 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { RC.config_file_name, i, DL_locationAndBandwidth); } + if (strcmp(DL_BWP_SubcarrierSpacing,"kHz15")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).DL_BWP_SubcarrierSpacing[j] = SubcarrierSpacing_kHz15; + }else if (strcmp(DL_BWP_SubcarrierSpacing,"kHz30")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).DL_BWP_SubcarrierSpacing[j] = SubcarrierSpacing_kHz30; + }else if (strcmp(DL_BWP_SubcarrierSpacing,"kHz60")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).DL_BWP_SubcarrierSpacing[j] = SubcarrierSpacing_kHz60; + }else if (strcmp(DL_BWP_SubcarrierSpacing,"kHz120")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).DL_BWP_SubcarrierSpacing[j] = SubcarrierSpacing_kHz120; + }else if (strcmp(DL_BWP_SubcarrierSpacing,"kHz240")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).DL_BWP_SubcarrierSpacing[j] = SubcarrierSpacing_kHz240; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for DL_BWP_SubcarrierSpacing choice: minusinfinity,kHz15,kHz30,kHz60,kHz120,kHz240!\n", + RC.config_file_name, i, DL_BWP_SubcarrierSpacing); + } + + if (!DL_BWP_prefix_type){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d define %s: NORMAL,EXTENDED!\n", + RC.config_file_name, i, GNB_CONFIG_STRING_DL_PREFIX_TYPE); + }else if (strcmp(DL_BWP_prefix_type, "NORMAL") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).DL_BWP_prefix_type[j] = NORMAL; + }else if (strcmp(DL_BWP_prefix_type, "EXTENDED") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).DL_BWP_prefix_type[j] = EXTENDED; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for DL_BWP_prefix_type choice: NORMAL or EXTENDED !\n", + RC.config_file_name, i, DL_BWP_prefix_type); + } + /////////////////////////////////NR FrequencyInfoUL////////////////////////////// NRRRC_CONFIGURATION_REQ (msg_p).UL_FreqBandIndicatorNR[j] = UL_FreqBandIndicatorNR; if ((UL_FreqBandIndicatorNR <1) || (UL_FreqBandIndicatorNR > 1024)){ @@ -549,14 +579,22 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { RC.config_file_name, i, UL_absoluteFrequencyPointA); } - NRRRC_CONFIGURATION_REQ (msg_p).FrequencyInfoUL_p_Max[j] = FrequencyInfoUL_p_Max; - if ((FrequencyInfoUL_p_Max <-30) || (FrequencyInfoUL_p_Max > 33)){ - AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for FrequencyInfoUL_p_Max choice: -30..33 !\n", - RC.config_file_name, i, FrequencyInfoUL_p_Max); + NRRRC_CONFIGURATION_REQ (msg_p).UL_additionalSpectrumEmission[j] = UL_additionalSpectrumEmission; + if ((UL_additionalSpectrumEmission <0) || (UL_additionalSpectrumEmission > 7)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for UL_additionalSpectrumEmission choice: 0..7 !\n", + RC.config_file_name, i, UL_additionalSpectrumEmission); + } + + NRRRC_CONFIGURATION_REQ (msg_p).UL_p_Max[j] = UL_p_Max; + if ((UL_p_Max <-30) || (UL_p_Max > 33)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for UL_p_Max choice: -30..33 !\n", + RC.config_file_name, i, UL_p_Max); } - if (strcmp(frequencyShift7p5khz, "TRUE") == 0) { - RRC_CONFIGURATION_REQ (msg_p).frequencyShift7p5khz[j] = FrequencyInfoUL__frequencyShift7p5khz_true; + if (strcmp(UL_frequencyShift7p5khz, "TRUE") == 0) { + RRC_CONFIGURATION_REQ (msg_p).UL_frequencyShift7p5khz[j] = FrequencyInfoUL__frequencyShift7p5khz_true; //enum true = 0 + }else if{ + RRC_CONFIGURATION_REQ (msg_p).UL_frequencyShift7p5khz[j] = 1;//false } /////////////////////////////////NR UL SCS-SpecificCarrier/////////////////////////// @@ -566,18 +604,18 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { RC.config_file_name, i, UL_offsetToCarrier); } - if (strcmp(UL_SubcarrierSpacing,"kHz15")==0) { - NRRRC_CONFIGURATION_REQ (msg_p).UL_SubcarrierSpacing[j] = SubcarrierSpacing_kHz15; - }else if (strcmp(pusch_alpha,"kHz30")==0) { - NRRRC_CONFIGURATION_REQ (msg_p).UL_SubcarrierSpacing[j] = SubcarrierSpacing_kHz30; - }else if (strcmp(pusch_alpha,"kHz60")==0) { - NRRRC_CONFIGURATION_REQ (msg_p).UL_SubcarrierSpacing[j] = SubcarrierSpacing_kHz60; - }else if (strcmp(pusch_alpha,"kHz120")==0) { - NRRRC_CONFIGURATION_REQ (msg_p).UL_SubcarrierSpacing[j] = SubcarrierSpacing_kHz120; - }else if (strcmp(pusch_alpha,"kHz240")==0) { - NRRRC_CONFIGURATION_REQ (msg_p).UL_SubcarrierSpacing[j] = SubcarrierSpacing_kHz240; - }else { AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for UL_SubcarrierSpacing choice: minusinfinity,kHz15,kHz30,kHz60,kHz120,kHz240!\n", - RC.config_file_name, i, UL_SubcarrierSpacing); + if (strcmp(UL_SCS_SubcarrierSpacing,"kHz15")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).UL_SCS_SubcarrierSpacing[j] = SubcarrierSpacing_kHz15; + }else if (strcmp(UL_SCS_SubcarrierSpacing,"kHz30")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).UL_SCS_SubcarrierSpacing[j] = SubcarrierSpacing_kHz30; + }else if (strcmp(UL_SCS_SubcarrierSpacing,"kHz60")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).UL_SCS_SubcarrierSpacing[j] = SubcarrierSpacing_kHz60; + }else if (strcmp(UL_SCS_SubcarrierSpacing,"kHz120")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).UL_SCS_SubcarrierSpacing[j] = SubcarrierSpacing_kHz120; + }else if (strcmp(UL_SCS_SubcarrierSpacing,"kHz240")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).UL_SCS_SubcarrierSpacing[j] = SubcarrierSpacing_kHz240; + }else { AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for UL_SCS_SubcarrierSpacing choice: minusinfinity,kHz15,kHz30,kHz60,kHz120,kHz240!\n", + RC.config_file_name, i, UL_SCS_SubcarrierSpacing); } switch (UL_SCS_SpecificCarrier_k0) { @@ -623,6 +661,47 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { RC.config_file_name, i, UL_locationAndBandwidth); } + if (strcmp(UL_BWP_SubcarrierSpacing,"kHz15")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).UL_BWP_SubcarrierSpacing[j] = SubcarrierSpacing_kHz15; + }else if (strcmp(UL_BWP_SubcarrierSpacing,"kHz30")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).UL_BWP_SubcarrierSpacing[j] = SubcarrierSpacing_kHz30; + }else if (strcmp(UL_BWP_SubcarrierSpacing,"kHz60")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).UL_BWP_SubcarrierSpacing[j] = SubcarrierSpacing_kHz60; + }else if (strcmp(UL_BWP_SubcarrierSpacing,"kHz120")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).UL_BWP_SubcarrierSpacing[j] = SubcarrierSpacing_kHz120; + }else if (strcmp(UL_BWP_SubcarrierSpacing,"kHz240")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).UL_BWP_SubcarrierSpacing[j] = SubcarrierSpacing_kHz240; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for UL_BWP_SubcarrierSpacing choice: minusinfinity,kHz15,kHz30,kHz60,kHz120,kHz240!\n", + RC.config_file_name, i, UL_BWP_SubcarrierSpacing); + } + + if (!UL_BWP_prefix_type){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d define %s: NORMAL,EXTENDED!\n", + RC.config_file_name, i, GNB_CONFIG_STRING_DL_PREFIX_TYPE); + }else if (strcmp(UL_BWP_prefix_type, "NORMAL") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).UL_BWP_prefix_type[j] = NORMAL; + }else if (strcmp(UL_BWP_prefix_type, "EXTENDED") == 0) { + NRRRC_CONFIGURATION_REQ (msg_p).UL_BWP_prefix_type[j] = EXTENDED; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for UL_BWP_prefix_type choice: NORMAL or EXTENDED !\n", + RC.config_file_name, i, UL_BWP_prefix_type); + } + + if (strcmp(ServingCellConfigCommon_ssb_PositionsInBurst_PR,"shortBitmap")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).ServingCellConfigCommon_ssb_PositionsInBurst_PR[j] = ServingCellConfigCommon__ssb_PositionsInBurst_PR_shortBitmap; + }else if (strcmp(ServingCellConfigCommon_ssb_PositionsInBurst_PR,"mediumBitmap")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).ServingCellConfigCommon_ssb_PositionsInBurst_PR[j] = ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap; + }else if (strcmp(ServingCellConfigCommon_ssb_PositionsInBurst_PR,"longBitmap")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).ServingCellConfigCommon_ssb_PositionsInBurst_PR[j] = ServingCellConfigCommon__ssb_PositionsInBurst_PR_longBitmap; + }else if (strcmp(ServingCellConfigCommon_ssb_PositionsInBurst_PR,"NOTHING")==0) { + NRRRC_CONFIGURATION_REQ (msg_p).ServingCellConfigCommon_ssb_PositionsInBurst_PR[j] = ServingCellConfigCommon__ssb_PositionsInBurst_PR_NOTHING; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for ServingCellConfigCommon_ssb_PositionsInBurst_PR choice !\n", + RC.config_file_name, i, ServingCellConfigCommon_ssb_PositionsInBurst_PR); + } + + switch (ServingCellConfigCommon_ssb_periodicityServingCell) { case 5: NRRRC_CONFIGURATION_REQ (msg_p).ServingCellConfigCommon_ssb_periodicityServingCell[j] = ServingCellConfigCommon__ssb_periodicityServingCell_ms5; @@ -654,7 +733,6 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { break; } - switch (ServingCellConfigCommon_dmrs_TypeA_Position) { case 2: NRRRC_CONFIGURATION_REQ (msg_p).ServingCellConfigCommon_dmrs_TypeA_Position[j] = ServingCellConfigCommon__dmrs_TypeA_Position_pos2; @@ -672,13 +750,13 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { if (strcmp(NIA_SubcarrierSpacing,"kHz15")==0) { NRRRC_CONFIGURATION_REQ (msg_p).NIA_SubcarrierSpacing[j] = SubcarrierSpacing_kHz15; - }else if (strcmp(pusch_alpha,"kHz30")==0) { + }else if (strcmp(NIA_SubcarrierSpacing,"kHz30")==0) { NRRRC_CONFIGURATION_REQ (msg_p).NIA_SubcarrierSpacing[j] = SubcarrierSpacing_kHz30; - }else if (strcmp(pusch_alpha,"kHz60")==0) { + }else if (strcmp(NIA_SubcarrierSpacing,"kHz60")==0) { NRRRC_CONFIGURATION_REQ (msg_p).NIA_SubcarrierSpacing[j] = SubcarrierSpacing_kHz60; - }else if (strcmp(pusch_alpha,"kHz120")==0) { + }else if (strcmp(NIA_SubcarrierSpacing,"kHz120")==0) { NRRRC_CONFIGURATION_REQ (msg_p).NIA_SubcarrierSpacing[j] = SubcarrierSpacing_kHz120; - }else if (strcmp(pusch_alpha,"kHz240")==0) { + }else if (strcmp(NIA_SubcarrierSpacing,"kHz240")==0) { NRRRC_CONFIGURATION_REQ (msg_p).NIA_SubcarrierSpacing[j] = SubcarrierSpacing_kHz240; }else { AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for NIA_SubcarrierSpacing choice: minusinfinity,kHz15,kHz30,kHz60,kHz120,kHz240!\n", RC.config_file_name, i, NIA_SubcarrierSpacing); @@ -693,13 +771,13 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { /////////////////////////////////NR TDD-UL-DL-ConfigCommon/////////////////////////// if (strcmp(referenceSubcarrierSpacing,"kHz15")==0) { NRRRC_CONFIGURATION_REQ (msg_p).referenceSubcarrierSpacing[j] = SubcarrierSpacing_kHz15; - }else if (strcmp(pusch_alpha,"kHz30")==0) { + }else if (strcmp(referenceSubcarrierSpacing,"kHz30")==0) { NRRRC_CONFIGURATION_REQ (msg_p).referenceSubcarrierSpacing[j] = SubcarrierSpacing_kHz30; - }else if (strcmp(pusch_alpha,"kHz60")==0) { + }else if (strcmp(referenceSubcarrierSpacing,"kHz60")==0) { NRRRC_CONFIGURATION_REQ (msg_p).referenceSubcarrierSpacing[j] = SubcarrierSpacing_kHz60; - }else if (strcmp(pusch_alpha,"kHz120")==0) { + }else if (strcmp(referenceSubcarrierSpacing,"kHz120")==0) { NRRRC_CONFIGURATION_REQ (msg_p).referenceSubcarrierSpacing[j] = SubcarrierSpacing_kHz120; - }else if (strcmp(pusch_alpha,"kHz240")==0) { + }else if (strcmp(referenceSubcarrierSpacing,"kHz240")==0) { NRRRC_CONFIGURATION_REQ (msg_p).referenceSubcarrierSpacing[j] = SubcarrierSpacing_kHz240; }else { AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for referenceSubcarrierSpacing choice: minusinfinity,kHz15,kHz30,kHz60,kHz120,kHz240!\n", @@ -708,19 +786,19 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { if (strcmp(dl_UL_TransmissionPeriodicity,"ms0p5")==0) { NRRRC_CONFIGURATION_REQ (msg_p).dl_UL_TransmissionPeriodicity[j] = TDD_UL_DL_ConfigCommon__dl_UL_TransmissionPeriodicity_ms0p5; - }else if (strcmp(pusch_alpha,"ms0p625")==0) { + }else if (strcmp(dl_UL_TransmissionPeriodicity,"ms0p625")==0) { NRRRC_CONFIGURATION_REQ (msg_p).dl_UL_TransmissionPeriodicity[j] = TDD_UL_DL_ConfigCommon__dl_UL_TransmissionPeriodicity_ms0p625; - }else if (strcmp(pusch_alpha,"ms1")==0) { + }else if (strcmp(dl_UL_TransmissionPeriodicity,"ms1")==0) { NRRRC_CONFIGURATION_REQ (msg_p).dl_UL_TransmissionPeriodicity[j] = TDD_UL_DL_ConfigCommon__dl_UL_TransmissionPeriodicity_ms1; - }else if (strcmp(pusch_alpha,"ms1p25")==0) { + }else if (strcmp(dl_UL_TransmissionPeriodicity,"ms1p25")==0) { NRRRC_CONFIGURATION_REQ (msg_p).dl_UL_TransmissionPeriodicity[j] = TDD_UL_DL_ConfigCommon__dl_UL_TransmissionPeriodicity_ms1p25; - }else if (strcmp(pusch_alpha,"ms2")==0) { + }else if (strcmp(dl_UL_TransmissionPeriodicity,"ms2")==0) { NRRRC_CONFIGURATION_REQ (msg_p).dl_UL_TransmissionPeriodicity[j] = TDD_UL_DL_ConfigCommon__dl_UL_TransmissionPeriodicity_ms2; - }else if (strcmp(pusch_alpha,"ms2p5")==0) { + }else if (strcmp(dl_UL_TransmissionPeriodicity,"ms2p5")==0) { NRRRC_CONFIGURATION_REQ (msg_p).dl_UL_TransmissionPeriodicity[j] = TDD_UL_DL_ConfigCommon__dl_UL_TransmissionPeriodicity_ms2p5; - }else if (strcmp(pusch_alpha,"ms5")==0) { + }else if (strcmp(dl_UL_TransmissionPeriodicity,"ms5")==0) { NRRRC_CONFIGURATION_REQ (msg_p).dl_UL_TransmissionPeriodicity[j] = TDD_UL_DL_ConfigCommon__dl_UL_TransmissionPeriodicity_ms5; - }else if (strcmp(pusch_alpha,"ms10")==0) { + }else if (strcmp(dl_UL_TransmissionPeriodicity,"ms10")==0) { NRRRC_CONFIGURATION_REQ (msg_p).dl_UL_TransmissionPeriodicity[j] = TDD_UL_DL_ConfigCommon__dl_UL_TransmissionPeriodicity_ms10; }else { AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for dl_UL_TransmissionPeriodicity choice: minusinfinity,ms0p5,ms0p625,ms1,ms1p25,ms2,ms2p5,ms5,ms10 !\n", @@ -1182,13 +1260,13 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { if (strcmp(prach_msg1_SubcarrierSpacing,"kHz15")==0) { NRRRC_CONFIGURATION_REQ (msg_p).prach_msg1_SubcarrierSpacing[j] = SubcarrierSpacing_kHz15; - }else if (strcmp(pusch_alpha,"kHz30")==0) { + }else if (strcmp(prach_msg1_SubcarrierSpacing,"kHz30")==0) { NRRRC_CONFIGURATION_REQ (msg_p).prach_msg1_SubcarrierSpacing[j] = SubcarrierSpacing_kHz30; - }else if (strcmp(pusch_alpha,"kHz60")==0) { + }else if (strcmp(prach_msg1_SubcarrierSpacing,"kHz60")==0) { NRRRC_CONFIGURATION_REQ (msg_p).prach_msg1_SubcarrierSpacing[j] = SubcarrierSpacing_kHz60; - }else if (strcmp(pusch_alpha,"kHz120")==0) { + }else if (strcmp(prach_msg1_SubcarrierSpacing,"kHz120")==0) { NRRRC_CONFIGURATION_REQ (msg_p).prach_msg1_SubcarrierSpacing[j] = SubcarrierSpacing_kHz120; - }else if (strcmp(pusch_alpha,"kHz240")==0) { + }else if (strcmp(prach_msg1_SubcarrierSpacing,"kHz240")==0) { NRRRC_CONFIGURATION_REQ (msg_p).prach_msg1_SubcarrierSpacing[j] = SubcarrierSpacing_kHz240; }else { AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for prach_msg1_SubcarrierSpacing choice: minusinfinity,kHz15,kHz30,kHz60,kHz120,kHz240!\n", @@ -1207,7 +1285,7 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { } if (strcmp(msg3_transformPrecoding , "ENABLE") == 0){ - NRRRC_CONFIGURATION_REQ (msg_p).msg3_transformPrecoding[j] = RACH_ConfigCommon__msg3_transformPrecoding_enabled; + NRRRC_CONFIGURATION_REQ (msg_p).msg3_transformPrecoding[j] = TRUE; } ////////////////////////////////NR RACH-ConfigGeneric////////////////////////////// @@ -1334,7 +1412,7 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { /////////////////////////////////NR PUSCH-ConfigCommon/////////////////////////// if (strcmp(groupHoppingEnabledTransformPrecoding , "ENABLE") == 0){ - NRRRC_CONFIGURATION_REQ (msg_p).groupHoppingEnabledTransformPrecoding[j] = PUSCH_ConfigCommon__groupHoppingEnabledTransformPrecoding_enabled; + NRRRC_CONFIGURATION_REQ (msg_p).groupHoppingEnabledTransformPrecoding[j] = TRUE; } NRRRC_CONFIGURATION_REQ (msg_p).msg3_DeltaPreamble[j] = msg3_DeltaPreamble; @@ -1464,13 +1542,13 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { if (strcmp(RateMatchPattern_subcarrierSpacing,"kHz15")==0) { NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPattern_subcarrierSpacing[j] = SubcarrierSpacing_kHz15; - }else if (strcmp(pusch_alpha,"kHz30")==0) { + }else if (strcmp(RateMatchPattern_subcarrierSpacing,"kHz30")==0) { NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPattern_subcarrierSpacing[j] = SubcarrierSpacing_kHz30; - }else if (strcmp(pusch_alpha,"kHz60")==0) { + }else if (strcmp(RateMatchPattern_subcarrierSpacing,"kHz60")==0) { NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPattern_subcarrierSpacing[j] = SubcarrierSpacing_kHz60; - }else if (strcmp(pusch_alpha,"kHz120")==0) { + }else if (strcmp(RateMatchPattern_subcarrierSpacing,"kHz120")==0) { NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPattern_subcarrierSpacing[j] = SubcarrierSpacing_kHz120; - }else if (strcmp(pusch_alpha,"kHz240")==0) { + }else if (strcmp(RateMatchPattern_subcarrierSpacing,"kHz240")==0) { NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPattern_subcarrierSpacing[j] = SubcarrierSpacing_kHz240; }else { AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%s\" for RateMatchPattern_subcarrierSpacing choice: minusinfinity,kHz15,kHz30,kHz60,kHz120,kHz240!\n", @@ -1588,11 +1666,17 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { RC.config_file_name, i, PDCCH_precoderGranularity); } - if (strcmp(tci_PresentInDCI , "ENABLE") == 0){ - NRRRC_CONFIGURATION_REQ (msg_p).tci_PresentInDCI[j] = ControlResourceSet__tci_PresentInDCI_enabled; + NRRRC_CONFIGURATION_REQ (msg_p).PDCCH_TCI_StateId[j] = PDCCH_TCI_StateId; + if ((PDCCH_TCI_StateId <0) || (PDCCH_TCI_StateId>63)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for PDCCH_TCI_StateId choice: 0..63 !\n", + RC.config_file_name, i, PDCCH_TCI_StateId); } - //////////////////////////////////NR PDCCH commonControlResourcesSets/////////////////////////// + if (strcmp(tci_PresentInDCI , "ENABLE") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).tci_PresentInDCI[j] = TRUE; + } + + //////////////////////////////////NR PDCCH commonSearchSpaces/////////////////////////// NRRRC_CONFIGURATION_REQ (msg_p).SearchSpaceId[j] = SearchSpaceId; if ((SearchSpaceId <0) || (SearchSpaceId>39)){ AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for SearchSpaceId choice: 0..39 !\n", diff --git a/openair2/ENB_APP/gnb_paramdef.h b/openair2/ENB_APP/gnb_paramdef.h index 419190cb8e..3145b2aa17 100644 --- a/openair2/ENB_APP/gnb_paramdef.h +++ b/openair2/ENB_APP/gnb_paramdef.h @@ -244,28 +244,34 @@ typedef enum { //NR DL SCS-SPECIFICCARRIER #define GNB_CONFIG_STRING_DL_OFFSETTOCARRIER "DL_offsetToCarrier" -#define GNB_CONFIG_STRING_DL_SUBCARRIERSPACING "DL_SubcarrierSpacing" +#define GNB_CONFIG_STRING_DL_SCS_SUBCARRIERSPACING "DL_SCS_SubcarrierSpacing" #define GNB_CONFIG_STRING_DL_SCS_SPECIFICCARRIER_K0 "DL_SCS_SpecificCarrier_k0" #define GNB_CONFIG_STRING_DL_CARRIERBANDWIDTH "DL_carrierBandwidth" // NR BWP-DOWNLINKCOMMON #define GNB_CONFIG_STRING_DL_LOCATIONANDBANDWIDTH "DL_locationAndBandwidth" - +#define GNB_CONFIG_STRING_DL_BWP_SUBCARRIERSPACING "DL_BWP_SubcarrierSpacing" +#define GNB_CONFIG_STRING_DL_BWP_PREFIX_TYPE "DL_BWP_prefix_type" + //NR FREQUENCYINFOUL #define GNB_CONFIG_STRING_UL_FREQBANDINDICATORNR "UL_FreqBandIndicatorNR" #define GNB_CONFIG_STRING_UL_ABSOLUTEFREQUENCYPOINTA "UL_absoluteFrequencyPointA" -#define GNB_CONFIG_STRING_FREQUENCYINFOUL_P_MAX "FrequencyInfoUL_p_Max" -#define GNB_CONFIG_STRING_FREQUENCYSHIFT7P5KHZ "frequencyShift7p5khz" +#define GNB_CONFIG_STRING_UL_ADDITIONALSPECTRUMEMISSION "UL_additionalSpectrumEmission" +#define GNB_CONFIG_STRING_UL_P_MAX "UL_p_Max" +#define GNB_CONFIG_STRING_UL_FREQUENCYSHIFT7P5KHZ "UL_frequencyShift7p5khz" //NR UL SCS-SPECIFICCARRIER #define GNB_CONFIG_STRING_UL_OFFSETTOCARRIER "UL_offsetToCarrier" -#define GNB_CONFIG_STRING_UL_SUBCARRIERSPACING "UL_SubcarrierSpacing" +#define GNB_CONFIG_STRING_UL_SCS_SUBCARRIERSPACING "UL_SCS_SubcarrierSpacing" #define GNB_CONFIG_STRING_UL_SCS_SPECIFICCARRIER_K0 "UL_SCS_SpecificCarrier_k0" #define GNB_CONFIG_STRING_UL_CARRIERBANDWIDTH "UL_carrierBandwidth" // NR BWP-UPLINKCOMMON #define GNB_CONFIG_STRING_UL_LOCATIONANDBANDWIDTH "UL_locationAndBandwidth" - +#define GNB_CONFIG_STRING_UL_BWP_SUBCARRIERSPACING "UL_BWP_SubcarrierSpacing" +#define GNB_CONFIG_STRING_UL_BWP_PREFIX_TYPE "UL_BWP_prefix_type" + +#define GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON_SSB_POSITIONSINBURST_PR "ServingCellConfigCommon_ssb_PositionsInBurst_PR" #define GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON_SSB_PERIODICITYSERVINGCELL "ServingCellConfigCommon_ssb_periodicityServingCell" #define GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON_DMRS_TYPEA_POSITION "ServingCellConfigCommon_dmrs_TypeA_Position" #define GNB_CONFIG_STRING_NIA_SUBCARRIERSPACING "NIA_SubcarrierSpacing" @@ -357,6 +363,7 @@ typedef enum { #define GNB_CONFIG_STRING_PDCCH_INTERLEAVERSIZE "PDCCH_interleaverSize" #define GNB_CONFIG_STRING_PDCCH_SHIFTINDEX "PDCCH_shiftIndex" #define GNB_CONFIG_STRING_PDCCH_PRECODERGRANULARITY "PDCCH_precoderGranularity" +#define GNB_CONFIG_STRING_PDCCH_TCI_STATEID "PDCCH_TCI_StateId" #define GNB_CONFIG_STRING_TCI_PRESENTINDCI "tci_PresentInDCI" //NR PDCCH-ConfigCommon commonSearchSpaces @@ -412,19 +419,25 @@ typedef enum { {GNB_CONFIG_STRING_DL_FREQBANDINDICATORNR, NULL, 0, iptr:&DL_FreqBandIndicatorNR, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_DL_ABSOLUTEFREQUENCYPOINTA, NULL, 0, iptr:&DL_absoluteFrequencyPointA, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_DL_OFFSETTOCARRIER, NULL, 0, iptr:&DL_offsetToCarrier, defintval:0, TYPE_UINT, 0}, \ -{GNB_CONFIG_STRING_DL_SUBCARRIERSPACING, NULL, 0, iptr:&DL_SubcarrierSpacing, defintval:0, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_DL_SCS_SUBCARRIERSPACING, NULL, 0, iptr:&DL_SCS_SubcarrierSpacing, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_DL_SCS_SPECIFICCARRIER_K0, NULL, 0, iptr:&DL_SCS_SpecificCarrier_k0, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_DL_CARRIERBANDWIDTH, NULL, 0, iptr:&DL_carrierBandwidth, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_DL_LOCATIONANDBANDWIDTH, NULL, 0, iptr:&DL_locationAndBandwidth, defintval:0, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_DL_BWP_SUBCARRIERSPACING, NULL, 0, iptr:&DL_BWP_SubcarrierSpacing, defintval:0, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_DL_BWP_PREFIX_TYPE, NULL, 0, iptr:&DL_BWP_prefix_type, defintval:0, TYPE_STRING, 0}, \ {GNB_CONFIG_STRING_UL_FREQBANDINDICATORNR, NULL, 0, iptr:&UL_FreqBandIndicatorNR, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_UL_ABSOLUTEFREQUENCYPOINTA, NULL, 0, iptr:&UL_absoluteFrequencyPointA, defintval:0, TYPE_UINT, 0}, \ -{GNB_CONFIG_STRING_FREQUENCYINFOUL_P_MAX, NULL, 0, iptr:&FrequencyInfoUL_p_Max, defintval:0, TYPE_UINT, 0}, \ -{GNB_CONFIG_STRING_FREQUENCYSHIFT7P5KHZ, NULL, 0, iptr:&frequencyShift7p5khz, defintval:0, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_UL_ADDITIONALSPECTRUMEMISSION, NULL, 0, iptr:&UL_additionalSpectrumEmission, defintval:0, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_UL_P_MAX, NULL, 0, iptr:&UL_p_Max, defintval:0, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_UL_FREQUENCYSHIFT7P5KHZ, NULL, 0, iptr:&UL_frequencyShift7p5khz, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_UL_OFFSETTOCARRIER, NULL, 0, iptr:&UL_offsetToCarrier, defintval:0, TYPE_UINT, 0}, \ -{GNB_CONFIG_STRING_UL_SUBCARRIERSPACING, NULL, 0, iptr:&UL_SubcarrierSpacing, defintval:0, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_UL_SCS_SUBCARRIERSPACING, NULL, 0, iptr:&UL_SCS_SubcarrierSpacing, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_UL_SCS_SPECIFICCARRIER_K0, NULL, 0, iptr:&UL_SCS_SpecificCarrier_k0, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_UL_CARRIERBANDWIDTH, NULL, 0, iptr:&UL_carrierBandwidth, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_UL_LOCATIONANDBANDWIDTH, NULL, 0, iptr:&UL_locationAndBandwidth, defintval:0, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_UL_BWP_SUBCARRIERSPACING, NULL, 0, iptr:&UL_BWP_SubcarrierSpacing, defintval:0, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_UL_BWP_PREFIX_TYPE, NULL, 0, iptr:&UL_BWP_prefix_type, defintval:0, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON_SSB_POSITIONSINBURST_PR, NULL, 0, iptr:&ServingCellConfigCommon_ssb_PositionsInBurst_PR, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON_SSB_PERIODICITYSERVINGCELL, NULL, 0, iptr:&ServingCellConfigCommon_ssb_periodicityServingCell, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_SERVINGCELLCONFIGCOMMON_DMRS_TYPEA_POSITION, NULL, 0, iptr:&ServingCellConfigCommon_dmrs_TypeA_Position, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_NIA_SUBCARRIERSPACING, NULL, 0, iptr:&NIA_SubcarrierSpacing, defintval:0, TYPE_UINT, 0}, \ @@ -494,6 +507,7 @@ typedef enum { {GNB_CONFIG_STRING_PDCCH_INTERLEAVERSIZE, NULL, 0, iptr:&PDCCH_interleaverSize, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_PDCCH_SHIFTINDEX, NULL, 0, iptr:&PDCCH_shiftIndex, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_PDCCH_PRECODERGRANULARITY, NULL, 0, iptr:&PDCCH_precoderGranularity, defintval:0, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_PDCCH_TCI_STATEID, NULL, 0, iptr:&PDCCH_TCI_StateId, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_TCI_PRESENTINDCI, NULL, 0, iptr:&tci_PresentInDCI, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_SEARCHSPACEID, NULL, 0, iptr:&SearchSpaceId, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_COMMONSEARCHSPACES_CONTROLRESOURCESETID, NULL, 0, iptr:&commonSearchSpaces_controlResourceSetId, defintval:0, TYPE_UINT, 0}, \ @@ -551,19 +565,25 @@ typedef enum { #define GNB_CONFIG_DL_SUBCARRIERSPACING_IDX #define GNB_CONFIG_DL_SCS_SPECIFICCARRIER_K0_IDX #define GNB_CONFIG_DL_CARRIERBANDWIDTH_IDX -#define GNB_CONFIG_DL_LOCATIONANDBANDWIDTH_IDX +#define GNB_CONFIG_DL_LOCATIONANDBANDWIDTH_IDX +#define GNB_CONFIG_DL_BWP_SUBCARRIERSPACING_IDX +#define GNB_CONFIG_DL_BWP_PREFIX_TYPE_IDX #define GNB_CONFIG_UL_FREQBANDINDICATORNR_IDX -#define GNB_CONFIG_UL_ABSOLUTEFREQUENCYPOINTA_IDX -#define GNB_CONFIG_FREQUENCYINFOUL_P_MAX_IDX -#define GNB_CONFIG_FREQUENCYSHIFT7P5KHZ_IDX +#define GNB_CONFIG_UL_ABSOLUTEFREQUENCYPOINTA_IDX +#define GNB_CONFIG_UL_ADDITIONALSPECTRUMEMISSION_IDX; +#define GNB_CONFIG_UL_P_MAX_IDX +#define GNB_CONFIG_UL_FREQUENCYSHIFT7P5KHZ_IDX #define GNB_CONFIG_UL_OFFSETTOCARRIER_IDX -#define GNB_CONFIG_UL_SUBCARRIERSPACING_IDX +#define GNB_CONFIG_UL_SCS_SUBCARRIERSPACING_IDX #define GNB_CONFIG_UL_SCS_SPECIFICCARRIER_K0_IDX #define GNB_CONFIG_UL_CARRIERBANDWIDTH_IDX #define GNB_CONFIG_UL_LOCATIONANDBANDWIDTH_IDX +#define GNB_CONFIG_UL_BWP_SUBCARRIERSPACING_IDX +#define GNB_CONFIG_UL_BWP_PREFIX_TYPE_IDX #define GNB_CONFIG_SUBCARRIERSPACINGCOMMON_IDX #define GNB_CONFIG_PDCCH_CONFIGSIB1_IDX -#define GNB_CONFIG_FREQUENCYOFFSETSSB_IDX +#define GNB_CONFIG_FREQUENCYOFFSETSSB_IDX +#define GNB_CONFIG_SERVINGCELLCONFIGCOMMON_SSB_POSITIONSINBURST_PR_IDX #define GNB_CONFIG_SERVINGCELLCONFIGCOMMON_SSB_PERIODICITYSERVINGCELL_IDX #define GNB_CONFIG_SERVINGCELLCONFIGCOMMON_DMRS_TYPEA_POSITION_IDX #define GNB_CONFIG_NIA_SUBCARRIERSPACING_IDX @@ -632,7 +652,8 @@ typedef enum { #define GNB_CONFIG_PDCCH_REG_BUNDLESIZE_IDX #define GNB_CONFIG_PDCCH_INTERLEAVERSIZE_IDX #define GNB_CONFIG_PDCCH_SHIFTINDEX_IDX -#define GNB_CONFIG_PDCCH_PRECODERGRANULARITY_IDX +#define GNB_CONFIG_PDCCH_PRECODERGRANULARITY_IDX +#define GNB_CONFIG_PDCCH_TCI_STATEID_IDX #define GNB_CONFIG_TCI_PRESENTINDCI_IDX #define GNB_CONFIG_SEARCHSPACEID_IDX #define GNB_CONFIG_COMMONSEARCHSPACES_CONTROLRESOURCESETID_IDX diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index ab5d69fba3..9510a29b48 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -72,7 +72,7 @@ //#include "SystemInformation.h" #include "SIB1.h" - +#include "ServingCellConfigCommon.h" //#include "SIB-Type.h" //#include "BCCH-DL-SCH-Message.h" @@ -82,7 +82,7 @@ #include "MeasObjectToAddModList.h" #include "ReportConfigToAddModList.h" #include "MeasIdToAddModList.h" -#include "enb_config.h" +#include "gnb_config.h" #endif #if defined(ENABLE_ITTI) @@ -495,6 +495,523 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, return((enc_rval.encoded+7)/8); } +uint8_t do_SERVINGCELLCONFIGCOMMON(uint8_t Mod_id, + int CC_id + #if defined(ENABLE_ITTI) + ,gNB_RrcConfigurationReq *configuration + #endif + ) +{ + // ServingCellConfigCommon // + struct FrequencyInfoDL **frequencyinfordl = &RC.nrrrc[Mod_id]->carrier[CC_id].servingcellconfigcommon->frequencyInfoDL; + BWP_DownlinkCommon_t **bwp_downlinkcommon = &RC.nrrrc[Mod_id]->carrier[CC_id].servingcellconfigcommon->initialDownlinkBWP; + UplinkConfigCommon_t **uplinkconfigcommon = &RC.nrrrc[Mod_id]->carrier[CC_id].servingcellconfigcommon->uplinkConfigCommon; + UplinkConfigCommon_t **supplementaryuplinkconfig = &RC.nrrrc[Mod_id]->carrier[CC_id].servingcellconfigcommon->supplementaryUplinkConfig; + + /////RateMatchPatternLTE_CRS_t **lte_crs_tomatcharound = &RC.nrrrc[Mod_id]->carrier[CC_id].servingcellconfigcommon->lte_CRS_ToMatchAround; + + struct ServingCellConfigCommon__rateMatchPatternToAddModList **ratematchpatterntoaddmodlist = &RC.nrrrc[Mod_id]->carrier[CC_id].servingcellconfigcommon->rateMatchPatternToAddModList; + struct RateMatchPattern *ratematchpattern; + struct ServingCellConfigCommon__rateMatchPatternToReleaseList **ratematchpatterntoreleaselist = &RC.nrrrc[Mod_id]->carrier[CC_id].servingcellconfigcommon->rateMatchPatternToReleaseList; + RateMatchPatternId_t *ratematchpatternid; + + struct TDD_UL_DL_ConfigCommon **tdd_ul_dl_configurationcommon; + struct TDD_UL_DL_ConfigCommon **tdd_ul_dl_configurationcommon2; + + // FrequencyInfoDL // + FreqBandIndicatorNR_t *dl_frequencyBandList; + struct SCS_SpecificCarrier *dl_scs_SpecificCarrierList; + // BWP_DownlinkCommon // + ControlResourceSet_t *bwp_dl_controlresourceset; + TCI_StateId_t *TCI_StateId; + SearchSpace_t *bwp_dl_searchspace; + struct PDSCH_TimeDomainResourceAllocation *bwp_dl_timedomainresourceallocation; + // UplinkConfigCommon // + FreqBandIndicatorNR_t *ul_frequencyBandList; + struct SCS_SpecificCarrier *ul_scs_SpecificCarrierList; + // PUSCH_ConfigCommon // + struct PUSCH_TimeDomainResourceAllocation *pusch_configcommontimedomainresourceallocation; + + //------------------------------------Start Fill ServingCellConfigCommon------------------------------------// + RC.nrrrc[Mod_id]->carrier[CC_id].servingcellconfigcommon->physCellId = configuration->Nid_cell[CC_id]; + + (*ssb_positionsinburst)->present = configuration->ServingCellConfigCommon_ssb_PositionsInBurst_PR[CC_id]; + if((*ssb_positionsinburst)->present == ServingCellConfigCommon__ssb_PositionsInBurst_PR_shortBitmap){ + (*ssb_positionsinburst)->choice.shortBitmap.buf = MALLOC(1); + (*ssb_positionsinburst)->choice.shortBitmap.size = 1; + (*ssb_positionsinburst)->choice.shortBitmap.bits_unused = 4; + (*ssb_positionsinburst)->choice.shortBitmap.buf[0] = 0x0f; + }else if((*ssb_positionsinburst)->present == ServingCellConfigCommon__ssb_PositionsInBurst_PR_mediumBitmap){ + (*ssb_positionsinburst)->choice.mediumBitmap.buf = MALLOC(1); + (*ssb_positionsinburst)->choice.mediumBitmap.size = 1; + (*ssb_positionsinburst)->choice.mediumBitmap.bits_unused = 0; + (*ssb_positionsinburst)->choice.mediumBitmap.buf[0] = 0xff; + }else if((*ssb_positionsinburst)->present == ServingCellConfigCommon__ssb_PositionsInBurst_PR_longBitmap){ + (*ssb_positionsinburst)->choice.longBitmap.buf = MALLOC(8); + (*ssb_positionsinburst)->choice.longBitmap.size = 8; + (*ssb_positionsinburst)->choice.longBitmap.bits_unused = 0; + (*ssb_positionsinburst)->choice.longBitmap.buf[0] = 0xff; + (*ssb_positionsinburst)->choice.longBitmap.buf[1] = 0xff; + (*ssb_positionsinburst)->choice.longBitmap.buf[2] = 0xff; + (*ssb_positionsinburst)->choice.longBitmap.buf[3] = 0xff; + (*ssb_positionsinburst)->choice.longBitmap.buf[4] = 0xff; + (*ssb_positionsinburst)->choice.longBitmap.buf[5] = 0xff; + (*ssb_positionsinburst)->choice.longBitmap.buf[6] = 0xff; + (*ssb_positionsinburst)->choice.longBitmap.buf[7] = 0xff; + } + + RC.nrrrc[Mod_id]->carrier[CC_id].servingcellconfigcommon->ssb_periodicityServingCell = configuration->ServingCellConfigCommon_ssb_periodicityServingCell[CC_id]; + RC.nrrrc[Mod_id]->carrier[CC_id].servingcellconfigcommon->dmrs_TypeA_Position = configuration->ServingCellConfigCommon_dmrs_TypeA_Position[CC_id]; + + ratematchpattern = CALLOC(1,sizeof(struct RateMatchPattern)); + memset(&ratematchpattern,0,sizeof(struct RateMatchPattern)); + ratematchpattern->rateMatchPatternId = configuration->rateMatchPatternId[CC_id]; + ratematchpattern->patternType.present = configuration->RateMatchPattern_patternType[CC_id]; + if(ratematchpattern->patternType.present == RateMatchPattern__patternType_PR_bitmaps){ + + ratematchpattern->patternType.choice.bitmaps.resourceBlocks.buf = MALLOC(35); + ratematchpattern->patternType.choice.bitmaps.resourceBlocks.size = 35; + ratematchpattern->patternType.choice.bitmaps.resourceBlocks.bits_unused = 5; + ratematchpattern->patternType.choice.bitmaps.resourceBlocks.buf[0] = 0x07; + for (int i =1;i<=34;i++ ){ + ratematchpattern->patternType.choice.bitmaps.resourceBlocks.buf[i] =0xff; + } + + ratematchpattern->patternType.choice.bitmaps.symbolsInResourceBlock.present = configuration->symbolsInResourceBlock[CC_id]; + if(ratematchpattern->patternType.choice.bitmaps.symbolsInResourceBlock.present == RateMatchPattern__patternType__bitmaps__symbolsInResourceBlock_PR_oneSlot){ + ratematchpattern->patternType.choice.bitmaps.symbolsInResourceBlock.choice.oneSlot.buf=MALLOC(2); + ratematchpattern->patternType.choice.bitmaps.symbolsInResourceBlock.choice.oneSlot.size=2; + ratematchpattern->patternType.choice.bitmaps.symbolsInResourceBlock.choice.oneSlot.bits_unused=2; + ratematchpattern->patternType.choice.bitmaps.symbolsInResourceBlock.choice.oneSlot.buf[0]=0x3f; + ratematchpattern->patternType.choice.bitmaps.symbolsInResourceBlock.choice.oneSlot.buf[1]=0xff; + }else if(ratematchpattern->patternType.choice.bitmaps.symbolsInResourceBlock.present == RateMatchPattern__patternType__bitmaps__symbolsInResourceBlock_PR_twoSlots){ + ratematchpattern->patternType.choice.bitmaps.symbolsInResourceBlock.choice.twoSlots.buf=MALLOC(4); + ratematchpattern->patternType.choice.bitmaps.symbolsInResourceBlock.choice.twoSlots.size=4; + ratematchpattern->patternType.choice.bitmaps.symbolsInResourceBlock.choice.twoSlots.bits_unused=4; + ratematchpattern->patternType.choice.bitmaps.symbolsInResourceBlock.choice.twoSlots.buf[0]=0x0f; + ratematchpattern->patternType.choice.bitmaps.symbolsInResourceBlock.choice.twoSlots.buf[1]=0xff; + ratematchpattern->patternType.choice.bitmaps.symbolsInResourceBlock.choice.twoSlots.buf[2]=0xff; + ratematchpattern->patternType.choice.bitmaps.symbolsInResourceBlock.choice.twoSlots.buf[3]=0xff; + } + + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern = CALLOC(1,sizeof(struct RateMatchPattern__patternType__bitmaps__periodicityAndPattern)); + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->present = configuration->periodicityAndPattern[CC_id]; + if(ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->present == RateMatchPattern__patternType__bitmaps__periodicityAndPattern_PR_n2){ + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n2.buf = MALLOC(1); + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n2.size = 1; + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n2.bits_unused = 6; + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n2.buf[0] =0x03; + }else if(ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->present == RateMatchPattern__patternType__bitmaps__periodicityAndPattern_PR_n4){ + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n4.buf = MALLOC(1); + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n4.size = 1; + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n4.bits_unused = 4; + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n4.buf[0] = 0x0f; + }else if(ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->present == RateMatchPattern__patternType__bitmaps__periodicityAndPattern_PR_n5){ + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n5.buf = MALLOC(1); + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n5.size = 1; + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n5.bits_unused = 3; + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n5.buf[0] = 0x1f; + }else if(ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->present == RateMatchPattern__patternType__bitmaps__periodicityAndPattern_PR_n8){ + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n8.buf = MALLOC(1); + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n8.size = 1; + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n8.bits_unused = 0; + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n8.buf[0] = 0xff; + }else if(ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->present == RateMatchPattern__patternType__bitmaps__periodicityAndPattern_PR_n10){ + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n10.buf = MALLOC(2); + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n10.size = 2; + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n10.bits_unused = 6; + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n10.buf[0] = 0x03; + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n10.buf[1] = 0xff; + }else if(ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->present == RateMatchPattern__patternType__bitmaps__periodicityAndPattern_PR_n20){ + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n20.buf = MALLOC(3); + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n20.size = 3; + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n20.bits_unused = 4; + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n20.buf[0] = 0x0f; + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n20.buf[1] = 0xff; + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n20.buf[2] = 0xff; + }else if(ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->present == RateMatchPattern__patternType__bitmaps__periodicityAndPattern_PR_n40){ + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n40.buf = MALLOC(5) + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n40.size = 5; + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n40.bits_unused = 0; + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n40.buf[0] = 0xff; + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n40.buf[1] = 0xff; + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n40.buf[2] = 0xff; + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n40.buf[3] = 0xff; + ratematchpattern->patternType.choice.bitmaps.periodicityAndPattern->choice.n40.buf[4] = 0xff; + } + + }else if(ratematchpattern->patternType.present == RateMatchPattern__patternType_PR_controlResourceSet){ + ratematchpattern->patternType.choice.controlResourceSet = RateMatchPattern_controlResourceSet[CC_id]; + } + + ratematchpattern->subcarrierSpacing = CALLOC(1,sizeof(SubcarrierSpacing_t)); + ratematchpattern->subcarrierSpacing = configuration->RateMatchPattern_subcarrierSpacing[CC_id]; + ratematchpattern->mode = configuration->RateMatchPattern_mode[CC_id]; + + ASN_SEQUENCE_ADD(&(*ratematchpatterntoaddmodlist)->list,&ratematchpattern); + + ratematchpatternid = CALLOC(1,sizeof(RateMatchPatternId_t)); + memset(&ratematchpatternid,0,sizeof(RateMatchPatternId_t)); + ratematchpatternid = configuration->rateMatchPatternId[CC_id]; + ASN_SEQUENCE_ADD(&(*ratematchpatterntoreleaselist)->list,&ratematchpatternid); + + RC.nrrrc[Mod_id]->carrier[CC_id].servingcellconfigcommon->subcarrierSpacing = configuration->NIA_SubcarrierSpacing[CC_id]; + RC.nrrrc[Mod_id]->carrier[CC_id].servingcellconfigcommon->ss_PBCH_BlockPower = configuration->ServingCellConfigCommon_ss_PBCH_BlockPower[CC_id]; + + //Fill FrequencyInfoDL // + (*frequencyinfordl)->absoluteFrequencySSB = configuration->absoluteFrequencySSB[CC_id]; + (*frequencyinfordl)->ssb_SubcarrierOffset = CALLOC(1,sizeof(long)); + (*frequencyinfordl)->ssb_SubcarrierOffset = configuration->ssb_SubcarrierOffset[CC_id]; + + dl_frequencyBandList = CALLOC(1,sizeof(FreqBandIndicatorNR_t)); + memset(&dl_frequencyBandList,0,sizeof(FreqBandIndicatorNR_t)); + dl_frequencyBandList = configuration->DL_FreqBandIndicatorNR[CC_id]; + ASN_SEQUENCE_ADD(&(*frequencyinfordl)->frequencyBandList.list,&dl_frequencyBandList); + + (*frequencyinfordl)->absoluteFrequencyPointA = configuration->DL_absoluteFrequencyPointA[CC_id]; + + dl_scs_SpecificCarrierList = CALLOC(1,sizeof(struct SCS_SpecificCarrier)); + memset(&dl_scs_SpecificCarrierList,0,sizeof(struct SCS_SpecificCarrier)); + dl_scs_SpecificCarrierList->offsetToCarrier = configuration->DL_offsetToCarrier[CC_id]; + dl_scs_SpecificCarrierList->subcarrierSpacing = configuration->DL_SCS_SubcarrierSpacing[CC_id]; + dl_scs_SpecificCarrierList->k0 = configuration->DL_SCS_SpecificCarrier_k0[CC_id]; + dl_scs_SpecificCarrierList->carrierBandwidth = configuration->DL_carrierBandwidth[CC_id]; + ASN_SEQUENCE_ADD(&(*frequencyinfordl)->scs_SpecificCarrierList.list,&dl_scs_SpecificCarrierList); + + //Fill BWP_DownlinkCommon -> genericParameters // + (*bwp_downlinkcommon)->genericParameters.locationAndBandwidth = configuration->DL_locationAndBandwidth[CC_id]; + (*bwp_downlinkcommon)->genericParameters.subcarrierSpacing = configuration->DL_BWP_SubcarrierSpacing[CC_id]; + + if(configuration->DL_BWP_prefix_type[CC_id]){ + (*bwp_downlinkcommon)->genericParameters.cyclicPrefix = CALLOC(1,sizeof(long)); + (*bwp_downlinkcommon)->genericParameters.cyclicPrefix = BWP__cyclicPrefix_extended; + } + //Fill BWP_DownlinkCommon -> pdcch_ConfigCommon // + (*bwp_downlinkcommon)->pdcch_ConfigCommon = CALLOC(1,sizeof(struct PDCCH_ConfigCommon)); + (*bwp_downlinkcommon)->pdcch_ConfigCommon->searchSpaceSIB1 = CALLOC(1,sizeof(SearchSpaceId_t)); + (*bwp_downlinkcommon)->pdcch_ConfigCommon->searchSpaceOtherSystemInformation = CALLOC(1,sizeof(SearchSpaceId_t)); + (*bwp_downlinkcommon)->pdcch_ConfigCommon->pagingSearchSpace = CALLOC(1,sizeof(SearchSpaceId_t)); + (*bwp_downlinkcommon)->pdcch_ConfigCommon->ra_SearchSpace = CALLOC(1,sizeof(SearchSpaceId_t)); + (*bwp_downlinkcommon)->pdcch_ConfigCommon->ra_ControlResourceSet = CALLOC(1,sizeof(ControlResourceSetId_t)); + + (*bwp_downlinkcommon)->pdcch_ConfigCommon->searchSpaceSIB1 = configuration->searchSpaceSIB1[CC_id]; + (*bwp_downlinkcommon)->pdcch_ConfigCommon->searchSpaceOtherSystemInformation = configuration->searchSpaceOtherSystemInformation[CC_id]; + (*bwp_downlinkcommon)->pdcch_ConfigCommon->pagingSearchSpace = configuration->pagingSearchSpace[CC_id]; + (*bwp_downlinkcommon)->pdcch_ConfigCommon->ra_SearchSpace = configuration->ra_SearchSpace[CC_id]; + (*bwp_downlinkcommon)->pdcch_ConfigCommon->ra_ControlResourceSet = configuration->rach_ra_ControlResourceSet[CC_id]; + + //Fill BWP_DownlinkCommon -> pdcch_ConfigCommon -> ControlResourceSet list // + (*bwp_downlinkcommon)->pdcch_ConfigCommon->commonControlResourcesSets = CALLOC(1,sizeof(struct PDCCH_ConfigCommon__commonControlResourcesSets)); + bwp_dl_controlresourceset = CALLOC(1,sizeof(ControlResourceSet_t)); + memset(&bwp_dl_controlresourceset,0,sizeof(ControlResourceSet_t)); + bwp_dl_controlresourceset->controlResourceSetId = configuration->PDCCH_common_controlResourceSetId[CC_id]; + //BIT STRING (SIZE (45)) + bwp_dl_controlresourceset->frequencyDomainResources.buf =MALLOC(6); + bwp_dl_controlresourceset->frequencyDomainResources.size = 6; + bwp_dl_controlresourceset->frequencyDomainResources.bits_unused = 3; + bwp_dl_controlresourceset->frequencyDomainResources.buf[0] = 0x1f; + bwp_dl_controlresourceset->frequencyDomainResources.buf[1] = 0xff; + bwp_dl_controlresourceset->frequencyDomainResources.buf[2] = 0xff; + bwp_dl_controlresourceset->frequencyDomainResources.buf[3] = 0xff; + bwp_dl_controlresourceset->frequencyDomainResources.buf[4] = 0xff; + bwp_dl_controlresourceset->frequencyDomainResources.buf[5] = 0xff; + bwp_dl_controlresourceset->frequencyDomainResources.buf[6] = 0xff; + + bwp_dl_controlresourceset->duration = configuration->PDCCH_common_ControlResourceSet_duration[CC_id]; + + bwp_dl_controlresourceset->cce_REG_MappingType.present = configuration->PDCCH_cce_REG_MappingType[CC_id]; + + if(bwp_dl_controlresourceset->cce_REG_MappingType == ControlResourceSet__cce_REG_MappingType_PR_interleaved ){ + bwp_dl_controlresourceset->cce_REG_MappingType.choice.interleaved.reg_BundleSize = configuration->PDCCH_reg_BundleSize[CC_id]; + bwp_dl_controlresourceset->cce_REG_MappingType.choice.interleaved.interleaverSize = configuration->PDCCH_interleaverSize[CC_id]; + bwp_dl_controlresourceset->cce_REG_MappingType.choice.interleaved.shiftIndex = configuration->PDCCH_shiftIndex[CC_id]; + }else if(bwp_dl_controlresourceset->cce_REG_MappingType == ControlResourceSet__cce_REG_MappingType_PR_nonInterleaved){ + bwp_dl_controlresourceset->cce_REG_MappingType.choice.nonInterleaved = NULL; + } + + bwp_dl_controlresourceset->precoderGranularity = configuration->PDCCH_precoderGranularity[CC_id]; + + bwp_dl_controlresourceset->tci_StatesPDCCH = CALLOC(1,sizeof(struct ControlResourceSet__tci_StatesPDCCH)); + TCI_StateId = CALLOC(1,sizeof(TCI_StateId_t)); + memset(&TCI_StateId,0,sizeof(TCI_StateId_t)); + TCI_StateId = configuration->PDCCH_TCI_StateId[CC_id]; + ASN_SEQUENCE_ADD(&bwp_dl_controlresourceset->tci_StatesPDCCH->list,&TCI_StateId); + + if(configuration->tci_PresentInDCI[CC_id]){ + bwp_dl_controlresourceset->tci_PresentInDCI = CALLOC(1,sizeof(long)); + bwp_dl_controlresourceset->tci_PresentInDCI = ControlResourceSet__tci_PresentInDCI_enabled; + } + + bwp_dl_controlresourceset->pdcch_DMRS_ScramblingID = CALLOC(1,sizeof(pdcch_DMRS_ScramblingID)); + bwp_dl_controlresourceset->pdcch_DMRS_ScramblingID->buf = MALLOC(2); + bwp_dl_controlresourceset->pdcch_DMRS_ScramblingID->size = 2; + bwp_dl_controlresourceset->pdcch_DMRS_ScramblingID->bits_unused = 0; + bwp_dl_controlresourceset->pdcch_DMRS_ScramblingID->buf[0] = 0xff; + bwp_dl_controlresourceset->pdcch_DMRS_ScramblingID->buf[1] = 0xff; + + ASN_SEQUENCE_ADD(&(*bwp_downlinkcommon)->pdcch_ConfigCommon->commonControlResourcesSets->list,&bwp_dl_controlresourceset); + + //Fill BWP_DownlinkCommon -> pdcch_ConfigCommon -> SearchSpace list // + (*bwp_downlinkcommon)->pdcch_ConfigCommon->commonSearchSpaces = CALLOC(1,sizeof(struct PDCCH_ConfigCommon__commonSearchSpaces)); + + bwp_dl_searchspace = CALLOC(1,sizeof(SearchSpace_t)); + memset(&bwp_dl_searchspace,0,sizeof(SearchSpace_t)); + bwp_dl_searchspace->searchSpaceId = configuration->SearchSpaceId[CC_id]; + bwp_dl_searchspace->controlResourceSetId = CALLOC(1,sizeof(ControlResourceSetId_t)); + bwp_dl_searchspace->controlResourceSetId = configuration->commonSearchSpaces_controlResourceSetId[CC_id]; + + bwp_dl_searchspace->monitoringSlotPeriodicityAndOffset = CALLOC(1,sizeof(struct SearchSpace__monitoringSlotPeriodicityAndOffset)); + bwp_dl_searchspace->monitoringSlotPeriodicityAndOffset->present = configuration->SearchSpace_monitoringSlotPeriodicityAndOffset_choice[CC_id]; + + if(bwp_dl_searchspace->monitoringSlotPeriodicityAndOffset->present == SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl1){ + bwp_dl_searchspace->monitoringSlotPeriodicityAndOffset->choice.sl1 = configuration->SearchSpace_monitoringSlotPeriodicityAndOffset_sl1[CC_id]; + }else if(bwp_dl_searchspace->monitoringSlotPeriodicityAndOffset->present == SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl2){ + bwp_dl_searchspace->monitoringSlotPeriodicityAndOffset->choice.sl2 = configuration->SearchSpace_monitoringSlotPeriodicityAndOffset_sl2[CC_id]; + }else if(bwp_dl_searchspace->monitoringSlotPeriodicityAndOffset->present == SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl4){ + bwp_dl_searchspace->monitoringSlotPeriodicityAndOffset->choice.sl4 = configuration->SearchSpace_monitoringSlotPeriodicityAndOffset_sl4[CC_id]; + }else if(bwp_dl_searchspace->monitoringSlotPeriodicityAndOffset->present == SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl5){ + bwp_dl_searchspace->monitoringSlotPeriodicityAndOffset->choice.sl5 = configuration->SearchSpace_monitoringSlotPeriodicityAndOffset_sl5[CC_id]; + }else if(bwp_dl_searchspace->monitoringSlotPeriodicityAndOffset->present == SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl8){ + bwp_dl_searchspace->monitoringSlotPeriodicityAndOffset->choice.sl8 = configuration->SearchSpace_monitoringSlotPeriodicityAndOffset_sl8[CC_id]; + }else if(bwp_dl_searchspace->monitoringSlotPeriodicityAndOffset->present == SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl10){ + bwp_dl_searchspace->monitoringSlotPeriodicityAndOffset->choice.sl10 = configuration->SearchSpace_monitoringSlotPeriodicityAndOffset_sl10[CC_id]; + }else if(bwp_dl_searchspace->monitoringSlotPeriodicityAndOffset->present == SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl16){ + bwp_dl_searchspace->monitoringSlotPeriodicityAndOffset->choice.sl16 = configuration->SearchSpace_monitoringSlotPeriodicityAndOffset_sl16[CC_id]; + }else if(bwp_dl_searchspace->monitoringSlotPeriodicityAndOffset->present == SearchSpace__monitoringSlotPeriodicityAndOffset_PR_sl20){ + bwp_dl_searchspace->monitoringSlotPeriodicityAndOffset->choice.sl20 = configuration->SearchSpace_monitoringSlotPeriodicityAndOffset_sl20[CC_id]; + } + bwp_dl_searchspace->monitoringSymbolsWithinSlot = CALLOC(1,sizeof(BIT_STRING_t)); + bwp_dl_searchspace->monitoringSymbolsWithinSlot->buf=MALLOC(2); + bwp_dl_searchspace->monitoringSymbolsWithinSlot->size=2; + bwp_dl_searchspace->monitoringSymbolsWithinSlot->bits_unused=2; + bwp_dl_searchspace->monitoringSymbolsWithinSlot->buf[0]=0x3f; + bwp_dl_searchspace->monitoringSymbolsWithinSlot->buf[1]=0xff; + + bwp_dl_searchspace->nrofCandidates = CALLOC(1,sizeof(struct SearchSpace__nrofCandidates)); + bwp_dl_searchspace->nrofCandidates->aggregationLevel1 = configuration->SearchSpace_nrofCandidates_aggregationLevel1[CC_id]; + bwp_dl_searchspace->nrofCandidates->aggregationLevel2 = configuration->SearchSpace_nrofCandidates_aggregationLevel2[CC_id]; + bwp_dl_searchspace->nrofCandidates->aggregationLevel4 = configuration->SearchSpace_nrofCandidates_aggregationLevel4[CC_id]; + bwp_dl_searchspace->nrofCandidates->aggregationLevel8 = configuration->SearchSpace_nrofCandidates_aggregationLevel8[CC_id]; + bwp_dl_searchspace->nrofCandidates->aggregationLevel16 = configuration->SearchSpace_nrofCandidates_aggregationLevel16[CC_id]; + + bwp_dl_searchspace->searchSpaceType = CALLOC(1,sizeof(struct SearchSpace__searchSpaceType)); + bwp_dl_searchspace->searchSpaceType->present = configuration->SearchSpace_searchSpaceType[CC_id]; + if(bwp_dl_searchspace->searchSpaceType->present == SearchSpace__searchSpaceType_PR_common){ + bwp_dl_searchspace->searchSpaceType->choice.common.dci_Format2_0 = CALLOC(1,sizeof(struct SearchSpace__searchSpaceType__common__dci_Format2_0)); + bwp_dl_searchspace->searchSpaceType->choice.common.dci_Format2_0->nrofCandidates_SFI.aggregationLevel1 = CALLOC(1,sizeof(long)); + bwp_dl_searchspace->searchSpaceType->choice.common.dci_Format2_0->nrofCandidates_SFI.aggregationLevel2 = CALLOC(1,sizeof(long)); + bwp_dl_searchspace->searchSpaceType->choice.common.dci_Format2_0->nrofCandidates_SFI.aggregationLevel4 = CALLOC(1,sizeof(long)); + bwp_dl_searchspace->searchSpaceType->choice.common.dci_Format2_0->nrofCandidates_SFI.aggregationLevel8 = CALLOC(1,sizeof(long)); + bwp_dl_searchspace->searchSpaceType->choice.common.dci_Format2_0->nrofCandidates_SFI.aggregationLevel16 = CALLOC(1,sizeof(long)); + + bwp_dl_searchspace->searchSpaceType->choice.common.dci_Format2_0->nrofCandidates_SFI.aggregationLevel1 = configuration->Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel1[CC_id]; + bwp_dl_searchspace->searchSpaceType->choice.common.dci_Format2_0->nrofCandidates_SFI.aggregationLevel2 = configuration->Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel2[CC_id]; + bwp_dl_searchspace->searchSpaceType->choice.common.dci_Format2_0->nrofCandidates_SFI.aggregationLevel4 = configuration->Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel4[CC_id]; + bwp_dl_searchspace->searchSpaceType->choice.common.dci_Format2_0->nrofCandidates_SFI.aggregationLevel8 = configuration->Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel8[CC_id]; + bwp_dl_searchspace->searchSpaceType->choice.common.dci_Format2_0->nrofCandidates_SFI.aggregationLevel16 = configuration->Common_dci_Format2_0_nrofCandidates_SFI_aggregationLevel16[CC_id]; + + bwp_dl_searchspace->searchSpaceType->choice.common.dci_Format2_3 = CALLOC(1,sizeof(struct struct SearchSpace__searchSpaceType__common__dci_Format2_3)); + bwp_dl_searchspace->searchSpaceType->choice.common.dci_Format2_3->monitoringPeriodicity = CALLOC(1,sizeof(long)); + bwp_dl_searchspace->searchSpaceType->choice.common.dci_Format2_3->monitoringPeriodicity = configuration->Common_dci_Format2_3_monitoringPeriodicity[CC_id]; + bwp_dl_searchspace->searchSpaceType->choice.common.dci_Format2_3->nrofPDCCH_Candidates = configuration->Common_dci_Format2_3_nrofPDCCH_Candidates[CC_id]; + + }else if (bwp_dl_searchspace->searchSpaceType->present == SearchSpace__searchSpaceType_PR_ue_Specific){ + bwp_dl_searchspace->searchSpaceType->choice.ue_Specific.dci_Formats = configuration->dci_Formats[CC_id]; + } + + ASN_SEQUENCE_ADD(&(*bwp_downlinkcommon)->pdcch_ConfigCommon->commonSearchSpaces->list,&bwp_dl_searchspace); + + //Fill BWP_DownlinkCommon -> pdsch_ConfigCommon // + (*bwp_downlinkcommon)->pdsch_ConfigCommon = CALLOC(1,sizeof(struct PDSCH_ConfigCommon)); + (*bwp_downlinkcommon)->pdsch_ConfigCommon->pdsch_AllocationList = CALLOC(1,sizeof(struct PDSCH_ConfigCommon__pdsch_AllocationList)); + bwp_dl_timedomainresourceallocation->k0 = CALLOC(1,sizeof(long)); + + bwp_dl_timedomainresourceallocation->k0 = configuration->PDSCH_TimeDomainResourceAllocation_k0[CC_id]; + bwp_dl_timedomainresourceallocation->mappingType = configuration->PDSCH_TimeDomainResourceAllocation_mappingType[CC_id]; + bwp_dl_timedomainresourceallocation->startSymbolAndLength.buf=MALLOC(1); + bwp_dl_timedomainresourceallocation->startSymbolAndLength.size=1; + bwp_dl_timedomainresourceallocation->startSymbolAndLength.bits_unused=1; + bwp_dl_timedomainresourceallocation->startSymbolAndLength.buf[0]=0x7f; + + ASN_SEQUENCE_ADD(&(*bwp_downlinkcommon)->pdsch_ConfigCommon->pdsch_AllocationList->list,&bwp_dl_timedomainresourceallocation); + + //Fill UplinkConfigCommon // + //Fill UplinkConfigCommon -> FrequencyInfoUL // + (*uplinkconfigcommon)->frequencyInfoUL = CALLOC(1,sizeof(struct FrequencyInfoUL)); + (*uplinkconfigcommon)->frequencyInfoUL->frequencyBandList = CALLOC(1,sizeof(struct MultiFrequencyBandListNR)); + + ul_frequencyBandList = CALLOC(1,sizeof(FreqBandIndicatorNR_t)); + memset(&ul_frequencyBandList,0,sizeof(FreqBandIndicatorNR_t)); + ul_frequencyBandList = configuration->UL_FreqBandIndicatorNR[CC_id]; + ASN_SEQUENCE_ADD(&(*uplinkconfigcommon)->frequencyInfoUL->frequencyBandList->list,&ul_frequencyBandList); + + (*uplinkconfigcommon)->frequencyInfoUL->absoluteFrequencyPointA = CALLOC(1,sizeof(ARFCN_ValueNR_t)); + (*uplinkconfigcommon)->frequencyInfoUL->absoluteFrequencyPointA = configuration->UL_absoluteFrequencyPointA[CC_id]; + + ul_scs_SpecificCarrierList = CALLOC(1,sizeof(struct SCS_SpecificCarrier)); + memset(&dl_scs_SpecificCarrierList,0,sizeof(struct SCS_SpecificCarrier)); + ul_scs_SpecificCarrierList->offsetToCarrier = configuration->UL_offsetToCarrier[CC_id]; + ul_scs_SpecificCarrierList->subcarrierSpacing = configuration->UL_SCS_SubcarrierSpacing[CC_id]; + ul_scs_SpecificCarrierList->k0 = configuration->UL_SCS_SpecificCarrier_k0[CC_id]; + ul_scs_SpecificCarrierList->carrierBandwidth = configuration->UL_carrierBandwidth[CC_id]; + ASN_SEQUENCE_ADD(&(*uplinkconfigcommon)->frequencyInfoUL->scs_SpecificCarriers.list,&ul_scs_SpecificCarrierList); + + (*uplinkconfigcommon)->frequencyInfoUL->additionalSpectrumEmission = CALLOC(1,sizeof(AdditionalSpectrumEmission_t)); + (*uplinkconfigcommon)->frequencyInfoUL->p_Max = CALLOC(1,sizeof(P_Max_t)); + (*uplinkconfigcommon)->frequencyInfoUL->frequencyShift7p5khz = CALLOC(1,sizeof(long)); + + (*uplinkconfigcommon)->frequencyInfoUL->additionalSpectrumEmission = configuration->UL_additionalSpectrumEmission[CC_id]; + (*uplinkconfigcommon)->frequencyInfoUL->p_Max = configuration->UL_p_Max[CC_id]; + (*uplinkconfigcommon)->frequencyInfoUL->frequencyShift7p5khz = configuration->UL_frequencyShift7p5khz[CC_id]; + + //Fill UplinkConfigCommon -> BWP-UplinkCommon // + //Fill UplinkConfigCommon -> BWP-UplinkCommon -> genericParameters// + (*uplinkconfigcommon)->initialUplinkBWP->genericParameters.locationAndBandwidth = configuration->UL_locationAndBandwidth[CC_id]; + (*uplinkconfigcommon)->initialUplinkBWP->genericParameters.subcarrierSpacing = configuration->UL_BWP_SubcarrierSpacing[CC_id]; + + if(configuration->UL_BWP_prefix_type[CC_id]){ + (*uplinkconfigcommon)->initialUplinkBWP->genericParameters.cyclicPrefix = CALLOC(1,sizeof(long)); + (*uplinkconfigcommon)->initialUplinkBWP->genericParameters.cyclicPrefix = BWP__cyclicPrefix_extended; + } + + //Fill UplinkConfigCommon -> BWP-UplinkCommon -> RACH_ConfigCommon// + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon = CALLOC(1,sizeof(RACH_ConfigCommon_t)); + + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->totalNumberOfRA_Preambles = CALLOC(1,sizeof(long)); + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->totalNumberOfRA_Preambles = configuration->rach_totalNumberOfRA_Preambles[CC_id]; + + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB = CALLOC(1,sizeof(struct RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB)); + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present = configuration->rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_choice[CC_id]; + + if((*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present == RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneEighth){ + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneEighth = configuration->rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneEighth[CC_id]; + }else if((*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present == RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneFourth){ + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneFourth = configuration->rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneFourth[CC_id]; + }else if((*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present == RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_oneHalf){ + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.oneHalf = configuration->rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_oneHalf[CC_id]; + }else if((*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present == RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_one){ + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.one = configuration->rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_one[CC_id]; + }else if((*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present == RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_two){ + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.two = configuration->rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_two[CC_id]; + }else if((*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present == RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_four){ + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.four = configuration->rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_four[CC_id]; + }else if((*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present == RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_eight){ + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.eight = configuration->rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_eight[CC_id]; + }else if((*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present == RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB_PR_sixteen){ + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->choice.sixteen = configuration->rach_ssb_perRACH_OccasionAndCB_PreamblesPerSSB_sixteen[CC_id]; + } + + if(configuration->rach_groupBconfigured[CC_id]){ + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->groupBconfigured = CALLOC(1,sizeof(struct RACH_ConfigCommon__groupBconfigured)); + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->groupBconfigured->ra_Msg3SizeGroupA = configuration->numberOfRA_PreamblesGroupA[CC_id]; + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->groupBconfigured->messagePowerOffsetGroupB = configuration->rach_messagePowerOffsetGroupB[CC_id]; + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->groupBconfigured->numberOfRA_PreamblesGroupA = configuration->rach_numberOfRA_PreamblesGroupA[CC_id]; + } + + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->ra_ContentionResolutionTimer = configuration->rach_ra_ContentionResolutionTimer[CC_id]; + + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->rsrp_ThresholdSSB = CALLOC(1,sizeof(RSRP_Range_t)); + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->rsrp_ThresholdSSB_SUL = CALLOC(1,sizeof(RSRP_Range_t)); + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->rsrp_ThresholdSSB = configuration->rsrp_ThresholdSSB[CC_id]; + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->rsrp_ThresholdSSB_SUL = configuration->rsrp_ThresholdSSB_SUL[CC_id]; + + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->prach_RootSequenceIndex.present = configuration->prach_RootSequenceIndex_choice[CC_id]; + if((*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->prach_RootSequenceIndex.present == RACH_ConfigCommon__prach_RootSequenceIndex_PR_l839){ + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->prach_RootSequenceIndex.choice.l839 = configuration->prach_RootSequenceIndex_l839[CC_id]; + }else if ((*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->prach_RootSequenceIndex.present == RACH_ConfigCommon__prach_RootSequenceIndex_PR_l139){ + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->prach_RootSequenceIndex.choice.l139 = configuration->prach_RootSequenceIndex_l139[CC_id]; + } + + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->msg1_SubcarrierSpacing = configuration->prach_msg1_SubcarrierSpacing[CC_id]; + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->restrictedSetConfig = configuration->restrictedSetConfig[CC_id]; + + if(configuration->msg3_transformPrecoding[CC_id]){ + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->msg3_transformPrecoding = CALLOC(1,sizeof(long)); + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->msg3_transformPrecoding = RACH_ConfigCommon__msg3_transformPrecoding_enabled; + } + + //Fill UplinkConfigCommon -> BWP-UplinkCommon -> RACH_ConfigCommon -> RACH_ConfigGeneric_t// + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->rach_ConfigGeneric.prach_ConfigurationIndex = configuration->prach_ConfigurationIndex[CC_id]; + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->rach_ConfigGeneric.msg1_FDM = configuration->prach_msg1_FDM[CC_id]; + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->rach_ConfigGeneric.msg1_FrequencyStart = configuration->prach_msg1_FrequencyStart[CC_id]; + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->rach_ConfigGeneric.zeroCorrelationZoneConfig = configuration->zeroCorrelationZoneConfig[CC_id]; + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->rach_ConfigGeneric.preambleReceivedTargetPower = configuration->preambleReceivedTargetPower[CC_id]; + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->rach_ConfigGeneric.preambleTransMax = configuration->preambleTransMax[CC_id]; + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->rach_ConfigGeneric.powerRampingStep = configuration->powerRampingStep[CC_id]; + (*uplinkconfigcommon)->initialUplinkBWP->rach_ConfigCommon->rach_ConfigGeneric.ra_ResponseWindow = configuration->ra_ResponseWindow[CC_id]; + + //Fill UplinkConfigCommon -> BWP-UplinkCommon -> PUSCH_ConfigCommon// + (*uplinkconfigcommon)->initialUplinkBWP->pusch_ConfigCommon = CALLOC(1,sizeof(PUSCH_ConfigCommon_t)); + + if(configuration->groupHoppingEnabledTransformPrecoding[CC_id]){ + (*uplinkconfigcommon)->initialUplinkBWP->pusch_ConfigCommon->groupHoppingEnabledTransformPrecoding = CALLOC(1,sizeof(long)); + (*uplinkconfigcommon)->initialUplinkBWP->pusch_ConfigCommon->groupHoppingEnabledTransformPrecoding = PUSCH_ConfigCommon__groupHoppingEnabledTransformPrecoding_enabled; + } + + (*uplinkconfigcommon)->initialUplinkBWP->pusch_ConfigCommon->pusch_AllocationList = CALLOC(1,sizeof(struct PUSCH_ConfigCommon__pusch_AllocationList)); + pusch_configcommontimedomainresourceallocation = CALLOC(1,sizeof(struct PUSCH_TimeDomainResourceAllocation)); + memset(&pusch_configcommontimedomainresourceallocation,0,sizeof(struct PUSCH_TimeDomainResourceAllocation)); + pusch_configcommontimedomainresourceallocation->k2 = CALLOC(1,sizeof(long)); + + pusch_configcommontimedomainresourceallocation->k2 = configuration->PUSCH_TimeDomainResourceAllocation_k2[CC_id]; + pusch_configcommontimedomainresourceallocation->mappingType = configuration->PUSCH_TimeDomainResourceAllocation_mappingType[CC_id]; + pusch_configcommontimedomainresourceallocation->startSymbolAndLength.buf = MALLOC(1); + pusch_configcommontimedomainresourceallocation->startSymbolAndLength.size = 1; + pusch_configcommontimedomainresourceallocation->startSymbolAndLength.bits_unused = 1; + pusch_configcommontimedomainresourceallocation->startSymbolAndLength.buf[0] = 0x7f; + ASN_SEQUENCE_ADD(&(*uplinkconfigcommon)->initialUplinkBWP->pusch_ConfigCommon->pusch_AllocationList->list,&pusch_configcommontimedomainresourceallocation); + + (*uplinkconfigcommon)->initialUplinkBWP->pusch_ConfigCommon->msg3_DeltaPreamble = CALLOC(1,sizeof(long)); + (*uplinkconfigcommon)->initialUplinkBWP->pusch_ConfigCommon->msg3_DeltaPreamble = configuration->msg3_DeltaPreamble[CC_id]; + (*uplinkconfigcommon)->initialUplinkBWP->pusch_ConfigCommon->p0_NominalWithGrant = CALLOC(1,sizeof(long)); + (*uplinkconfigcommon)->initialUplinkBWP->pusch_ConfigCommon->p0_NominalWithGrant = configuration->p0_NominalWithGrant[CC_id]; + + //Fill UplinkConfigCommon -> BWP-UplinkCommon -> PUCCH_ConfigCommon// + (*uplinkconfigcommon)->initialUplinkBWP->pucch_ConfigCommon = CALLOC(1,sizeof(PUCCH_ConfigCommon_t)); + (*uplinkconfigcommon)->initialUplinkBWP->pucch_ConfigCommon->pucch_ResourceCommon = CALLOC(1,sizeof(BIT_STRING_t)); + (*uplinkconfigcommon)->initialUplinkBWP->pucch_ConfigCommon->hoppingId = CALLOC(1,sizeof(BIT_STRING_t)); + (*uplinkconfigcommon)->initialUplinkBWP->pucch_ConfigCommon->p0_nominal = CALLOC(1,sizeof(long)); + + (*uplinkconfigcommon)->initialUplinkBWP->pucch_ConfigCommon->pucch_GroupHopping = configuration->pucch_GroupHopping[CC_id]; + (*uplinkconfigcommon)->initialUplinkBWP->pucch_ConfigCommon->p0_nominal = configuration->p0_nominal[CC_id]; + + (*uplinkconfigcommon)->initialUplinkBWP->pucch_ConfigCommon->pucch_ResourceCommon->buf = MALLOC(1); + (*uplinkconfigcommon)->initialUplinkBWP->pucch_ConfigCommon->pucch_ResourceCommon->size = 1; + (*uplinkconfigcommon)->initialUplinkBWP->pucch_ConfigCommon->pucch_ResourceCommon->bits_unused = 4; + (*uplinkconfigcommon)->initialUplinkBWP->pucch_ConfigCommon->pucch_ResourceCommon->buf[0] = 0x0f; + + (*uplinkconfigcommon)->initialUplinkBWP->pucch_ConfigCommon->hoppingId->buf = MALLOC(2); + (*uplinkconfigcommon)->initialUplinkBWP->pucch_ConfigCommon->hoppingId->size = 2 + (*uplinkconfigcommon)->initialUplinkBWP->pucch_ConfigCommon->hoppingId->bits_unused = 6; + (*uplinkconfigcommon)->initialUplinkBWP->pucch_ConfigCommon->hoppingId->buf[0] = 0x03; + (*uplinkconfigcommon)->initialUplinkBWP->pucch_ConfigCommon->hoppingId->buf[1] = 0xff; + + + //Fill supplementaryUplinkConfig // + memcpy(&(*uplinkconfigcommon), &(*supplementaryuplinkconfig), sizeof(UplinkConfigCommon_t));//The Same structre + + //Fill TDD_UL_DL_ConfigCommon // + (*tdd_ul_dl_configurationcommon)->referenceSubcarrierSpacing = CALLOC(1,sizeof(SubcarrierSpacing_t)); + (*tdd_ul_dl_configurationcommon)->dl_UL_TransmissionPeriodicity = CALLOC(1,sizeof(long)); + (*tdd_ul_dl_configurationcommon)->nrofDownlinkSlots = CALLOC(1,sizeof(long)); + (*tdd_ul_dl_configurationcommon)->nrofDownlinkSymbols = CALLOC(1,sizeof(long)); + (*tdd_ul_dl_configurationcommon)->nrofUplinkSlots = CALLOC(1,sizeof(long)); + (*tdd_ul_dl_configurationcommon)->nrofUplinkSymbols = CALLOC(1,sizeof(long)); + + (*tdd_ul_dl_configurationcommon)->referenceSubcarrierSpacing = configuration->referenceSubcarrierSpacing[CC_id]; + (*tdd_ul_dl_configurationcommon)->dl_UL_TransmissionPeriodicity = configuration->dl_UL_TransmissionPeriodicity[CC_id]; + (*tdd_ul_dl_configurationcommon)->nrofDownlinkSlots = configuration->nrofDownlinkSlots[CC_id]; + (*tdd_ul_dl_configurationcommon)->nrofDownlinkSymbols = configuration->nrofDownlinkSymbols[CC_id]; + (*tdd_ul_dl_configurationcommon)->nrofUplinkSlots = configuration->nrofUplinkSlots[CC_id]; + (*tdd_ul_dl_configurationcommon)->nrofUplinkSymbols = configuration->nrofUplinkSymbols[CC_id]; + + memcpy(&(*tdd_ul_dl_configurationcommon), &(*tdd_ul_dl_configurationcommon2), sizeof(struct TDD_UL_DL_ConfigCommon));//The Same structre + + +} + + + //------------------------------------------------------------------------------ /* uint8_t do_SIB23(uint8_t Mod_id, diff --git a/openair2/RRC/NR/defs_NR.h b/openair2/RRC/NR/defs_NR.h index e96fe9c95e..cdb667076e 100644 --- a/openair2/RRC/NR/defs_NR.h +++ b/openair2/RRC/NR/defs_NR.h @@ -20,11 +20,11 @@ /*! \file RRC/LITE/defs_NR.h * \brief NR RRC struct definitions and function prototypes -* \author Navid Nikaein, Raymond Knopp and WEI-TAI CHEN +* \author Navid Nikaein, Raymond Knopp * \date 2010 - 2014, 2018 * \version 1.0 * \company Eurecom -* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr, kroempa@gmail.com.tw +* \email: navid.nikaein@eurecom.fr, raymond.knopp@eurecom.fr */ #ifndef __OPENAIR_RRC_DEFS_NR_H__ @@ -45,6 +45,8 @@ #include "SIB1.h" //#include "SystemInformation.h" //#include "RRCConnectionReconfiguration.h" +#include "RRCReconfigurationComplete.h" +#include "RRCReconfiguration" //#include "RRCConnectionReconfigurationComplete.h" //#include "RRCConnectionSetup.h" //#include "RRCConnectionSetupComplete.h" @@ -59,6 +61,7 @@ //#include "AS-Context.h" #include "UE-NR-Capability.h" #include "MeasResults.h" +#include "ServingCellConfigCommon.h" #endif //------------------- @@ -389,78 +392,35 @@ typedef struct rrc_gNB_ue_context_s { typedef struct { // buffer that contains the encoded messages - uint8_t *MIB_NR; - uint8_t sizeof_MIB_NR; + uint8_t *MIB; + uint8_t sizeof_MIB; - uint8_t *SIB1_NR; - uint8_t sizeof_SIB1_NR; -/* - uint8_t *SIB23_NB_IoT; - uint8_t sizeof_SIB23_NB_IoT; -*/ + uint8_t *SIB1; + uint8_t sizeof_SIB1; + + uint8_t *SERVINGCELLCONFIGCOMMON; + uint8_t sizeof_SERVINGCELLCONFIGCOMMON; -/* - //not actually implemented in OAI - uint8_t *SIB4_NB_IoT; - uint8_t sizeof_SIB4_NB_IoT; - uint8_t *SIB5_NB_IoT; - uint8_t sizeof_SIB5_NB_IoT; - uint8_t *SIB14_NB_IoT; - uint8_t sizeof_SIB14_NB_IoT; - uint8_t *SIB16_NB_IoT; - uint8_t sizeof_SIB16_NB_IoT; -*/ - //TS 36.331 V14.2.1 -// uint8_t *SIB15_NB; -// uint8_t sizeof_SIB15_NB; -// uint8_t *SIB20_NB; -// uint8_t sizeof_SIB20_NB; -// uint8_t *SIB22_NB; -// uint8_t sizeof_SIB22_NB; //implicit parameters needed int Ncp; //cyclic prefix for DL int Ncp_UL; //cyclic prefix for UL - int p_eNB; //number of tx antenna port - int p_rx_eNB; //number of receiving antenna ports + int p_gNB; //number of tx antenna port + int p_rx_gNB; //number of receiving antenna ports uint32_t dl_CarrierFreq; //detected by the UE uint32_t ul_CarrierFreq; //detected by the UE - uint16_t physCellId; //not stored in the MIB-NB but is getting through NPSS/NSSS + uint16_t physCellId; //are the only static one (memory has been already allocated) - BCCH_BCH_Message_t mib_NR; + BCCH_BCH_Message_t mib; - /* - BCCH_DL_SCH_Message_NR_t siblock1_NB_IoT; //SIB1-NB - BCCH_DL_SCH_Message_NR_t systemInformation_NB_IoT; //SI - */ - SIB1_t *sib1_NR; - /* - SIB2_t *sib2_NR; - SIB3_t *sib3_NR; - //not implemented yet - SIB4_t *sib4_NR; - SIB5_t *sib5_NR; - */ + SIB1_t *sib1; + ServingCellConfigCommon_t *servingcellconfigcommon; SRB_INFO_NR SI; SRB_INFO_NR Srb0; - uint8_t **MCCH_MESSAGE; // probably not needed , but added to remove errors - uint8_t sizeof_MCCH_MESSAGE[8];// but added to remove errors - SRB_INFO_NR MCCH_MESS[8];// MAX_MBSFN_AREA - - /*future implementation TS 36.331 V14.2.1 - SystemInformationBlockType15_NB_r14_t *sib15; - SystemInformationBlockType20_NB_r14_t *sib20; - SystemInformationBlockType22_NB_r14_t *sib22; - - uint8_t SCPTM_flag; - uint8_t sizeof_SC_MCHH_MESS[]; - SC_MCCH_Message_NR_t scptm;*/ - - } rrc_gNB_carrier_data_t; //--------------------------------------------------- @@ -484,6 +444,7 @@ typedef struct gNB_RRC_INST_s { #if defined(ENABLE_ITTI) gNB_RrcConfigurationReq configuration;//rrc_messages_types.h #endif + // other PLMN parameters /// Mobile country code int mcc; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 718e60f2d0..3a3827b593 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -41,7 +41,7 @@ #include "LAYER2/MAC/proto.h" #include "UTIL/LOG/log.h" #include "COMMON/mac_rrc_primitives.h" -#include "RRC/LITE/NR/asn1_msg.h" +#include "RRC/NR/asn1_msg.h" ///ASN.1 header files //#include "RRCConnectionRequest.h" @@ -127,10 +127,10 @@ openair_nrrrc_on( LOG_I(NR_RRC, PROTOCOL_RRC_CTXT_FMT" gNB:OPENAIR NR RRC IN....\n", PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - rrc_config_buffer (&RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].SI, BCCH, 1); - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].SI.Active = 1; - rrc_config_buffer (&RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0, CCCH, 1); - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Active = 1; + rrc_config_buffer (&RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].SI, BCCH, 1); + RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].SI.Active = 1; + rrc_config_buffer (&RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].Srb0, CCCH, 1); + RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].Srb0.Active = 1; } } @@ -153,16 +153,16 @@ init_NR_SI( LOG_D(RRC,"%s()\n\n\n\n",__FUNCTION__); // copy basic parameters - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId = configuration->Nid_cell[CC_id]; - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB = configuration->nb_antenna_ports[CC_id]; - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].Ncp = configuration->prefix_type[CC_id]; - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq = configuration->downlink_frequency[CC_id]; - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].ul_CarrierFreq = configuration->downlink_frequency[CC_id]+ configuration->uplink_frequency_offset[CC_id]; + RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].physCellId = configuration->Nid_cell[CC_id]; + RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB = configuration->nb_antenna_ports[CC_id]; + RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].Ncp = configuration->prefix_type[CC_id]; + RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq = configuration->downlink_frequency[CC_id]; + RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].ul_CarrierFreq = configuration->downlink_frequency[CC_id]+ configuration->uplink_frequency_offset[CC_id]; ///MIB - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_MIB_NR = 0; - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].MIB_NR = (uint8_t*) malloc16(4); - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_MIB_NR = do_MIB_NR(&RC.rrc[ctxt_pP->module_id]->carrier[CC_id],0, + RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_MIB = 0; + RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].MIB = (uint8_t*) malloc16(4); + RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_MIB = do_MIB_NR(&RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id],0, #ifdef ENABLE_ITTI configuration->ssb_SubcarrierOffset[CC_id], configuration->pdcch_ConfigSIB1[CC_id], @@ -174,12 +174,12 @@ init_NR_SI( ); ///SIB1 - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1_NR = 0; - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1_NR = (uint8_t*) malloc16(32); - AssertFatal(RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].SIB1_NR! + RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 = 0; + RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].SIB1 = (uint8_t*) malloc16(32); + AssertFatal(RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].SIB1! = NULL,PROTOCOL_RRC_CTXT_FMT" init_SI: FATAL, no memory for NR SIB1 allocated\n",PROTOCOL_RRC_CTXT_ARGS(ctxt_pP)); - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1_NR = do_SIB1_NR(&RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id], + RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 = do_SIB1_NR(&RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id], ctxt_pP->module_id, CC_id #if defined(ENABLE_ITTI) @@ -187,17 +187,26 @@ init_NR_SI( #endif ); - AssertFatal(RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 != 255,"FATAL, RC.nr_rrc[enb_mod_idP].carrier[CC_id].sizeof_SIB1_NR == 255"); + AssertFatal(RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 != 255,"FATAL, RC.nrrrc[enb_mod_idP].carrier[CC_id].sizeof_SIB1 == 255"); - rrc_mac_config_req_eNB(ctxt_pP->module_id, CC_id, - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].physCellId, - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].p_eNB, - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].Ncp, - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].sib1->freqBandIndicator, - RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq, + RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SERVINGCELLCONFIGCOMMON = do_SERVINGCELLCONFIGCOMMON(ctxt_pP->module_id, + CC_id + #if defined(ENABLE_ITTI) + ,configuration + #endif + ); + + + + rrc_mac_config_req_gNB(ctxt_pP->module_id, CC_id, + RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].physCellId, + RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].p_gNB, + RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].Ncp, + RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].sib1->freqBandIndicator, + RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].dl_CarrierFreq, 0, // rnti - (BCCH_BCH_Message_t *) - &RC.nr_rrc[ctxt_pP->module_id]->carrier[CC_id].mib + (BCCH_BCH_Message_t *)&RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].mib, + (ServingCellConfigCommon_t *)&RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id]servingcellconfigcommon ); } @@ -206,34 +215,34 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu protocol_ctxt_t ctxt; int CC_id; - PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, gnb_mod_idP, ENB_FLAG_YES, NOT_A_RNTI, 0, 0,gnb_mod_idP); + PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, gnb_mod_idP, GNB_FLAG_YES, NOT_A_RNTI, 0, 0,gnb_mod_idP); LOG_I(NR_RRC,PROTOCOL_NRRRC_CTXT_FMT" Init...\n",PROTOCOL_NRRRC_CTXT_ARGS(&ctxt)); #if OCP_FRAMEWORK - while ( RC.nr_rrc[gnb_mod_idP] == NULL ) { - LOG_E(NR_RRC, "RC.nr_rrc not yet initialized, waiting 1 second\n"); + while ( RC.nrrrc[gnb_mod_idP] == NULL ) { + LOG_E(NR_RRC, "RC.nrrrc not yet initialized, waiting 1 second\n"); sleep(1); } #endif - AssertFatal(RC.nr_rrc[gnb_mod_idP] != NULL, "RC.nr_rrc not initialized!"); + AssertFatal(RC.nrrrc[gnb_mod_idP] != NULL, "RC.nrrrc not initialized!"); AssertFatal(NUMBER_OF_UE_MAX < (module_id_t)0xFFFFFFFFFFFFFFFF, " variable overflow"); #ifdef ENABLE_ITTI AssertFatal(configuration!=NULL,"configuration input is null\n"); #endif - RC.nr_rrc[ctxt.module_id]->Nb_ue = 0; + RC.nrrrc[ctxt.module_id]->Nb_ue = 0; for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - RC.nr_rrc[ctxt.module_id]->carrier[CC_id].Srb0.Active = 0; + RC.nrrrc[ctxt.module_id]->carrier[CC_id].Srb0.Active = 0; } - uid_linear_allocator_init(&nr_rrc.nr_rrc[ctxt.module_id]->uid_allocator); - RB_INIT(&RC.nr_rrc[ctxt.module_id]->rrc_ue_head); + uid_linear_allocator_init(&nrrrc.nrrrc[ctxt.module_id]->uid_allocator); + RB_INIT(&RC.nrrrc[ctxt.module_id]->rrc_ue_head); - RC.nr_rrc[ctxt.module_id]->initial_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); - RC.nr_rrc[ctxt.module_id]->s1ap_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); + RC.nrrrc[ctxt.module_id]->initial_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); + RC.nrrrc[ctxt.module_id]->s1ap_id2_s1ap_ids = hashtable_create (NUMBER_OF_UE_MAX * 2, NULL, NULL); - memcpy(&RC.nr_rrc[ctxt.module_id]->configuration,configuration,sizeof(gNB_RrcConfigurationReq)); + memcpy(&RC.nrrrc[ctxt.module_id]->configuration,configuration,sizeof(gNB_RrcConfigurationReq)); /// System Information INIT @@ -243,21 +252,21 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { for (j = 0; j < NUM_MAX_CBA_GROUP; j++) { - RC.nr_rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[j] = CBA_OFFSET + j; + RC.nrrrc[ctxt.module_id]->carrier[CC_id].cba_rnti[j] = CBA_OFFSET + j; } - if (RC.nr_rrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups > NUM_MAX_CBA_GROUP) { - RC.nr_rrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups = NUM_MAX_CBA_GROUP; + if (RC.nrrrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups > NUM_MAX_CBA_GROUP) { + RC.nrrrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups = NUM_MAX_CBA_GROUP; } LOG_D(NR_RRC, PROTOCOL_NRRRC_CTXT_FMT" Initialization of 4 cba_RNTI values (%x %x %x %x) num active groups %d\n", PROTOCOL_NRRRC_CTXT_ARGS(&ctxt), - gnb_mod_idP, RC.nr_rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[0], - RC.nr_rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[1], - RC.nr_rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[2], - RC.nr_rrc[ctxt.module_id]->carrier[CC_id].cba_rnti[3], - RC.nr_rrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups); + gnb_mod_idP, RC.nrrrc[ctxt.module_id]->carrier[CC_id].cba_rnti[0], + RC.nrrrc[ctxt.module_id]->carrier[CC_id].cba_rnti[1], + RC.nrrrc[ctxt.module_id]->carrier[CC_id].cba_rnti[2], + RC.nrrrc[ctxt.module_id]->carrier[CC_id].cba_rnti[3], + RC.nrrrc[ctxt.module_id]->carrier[CC_id].num_active_cba_groups); } #endif @@ -270,8 +279,8 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu #endif ); for (int ue_id = 0; ue_id < NUMBER_OF_UE_MAX; ue_id++){ - RC.nr_rrc[ctxt.module_id]->carrier[CC_id].sizeof_paging[ue_id] = 0; - RC.nr_rrc[ctxt.module_id]->carrier[CC_id].paging[ue_id] = (uint8_t*) malloc16(256); + RC.nrrrc[ctxt.module_id]->carrier[CC_id].sizeof_paging[ue_id] = 0; + RC.nrrrc[ctxt.module_id]->carrier[CC_id].paging[ue_id] = (uint8_t*) malloc16(256); } }//END for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) @@ -279,14 +288,14 @@ char openair_rrc_gNB_configuration(const module_id_t gnb_mod_idP, gNB_RrcConfigu //rrc_init_NR_global_param(); for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { - openair_rrc_top_init_gNB(RC.nr_rrc[ctxt.module_id]->carrier[CC_id].MBMS_flag,0); + openair_rrc_top_init_gNB(RC.nrrrc[ctxt.module_id]->carrier[CC_id].MBMS_flag,0); } openair_nrrrc_on(&ctxt); return 0; -}//END openair_rrc_eNB_configuration +}//END openair_rrc_gNB_configuration ///---------------------------------------------------------------------------------------------------------------/// @@ -320,7 +329,7 @@ void* rrc_gnb_task(void* args_p){ break; case MESSAGE_TEST: - LOG_I(RRC, "[eNB %d] Received %s\n", instance, msg_name_p); + LOG_I(RRC, "[gNB %d] Received %s\n", instance, msg_name_p); break; /* Messages from MAC */ @@ -374,16 +383,16 @@ void* rrc_gnb_task(void* args_p){ /* Nothing to do. Apparently everything is done in S1AP processing */ //LOG_I(RRC, "[eNB %d] Received message %s, not processed because procedure not synched\n", //instance, msg_name_p); - if (rrc_eNB_get_ue_context(RC.nr_rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti) - && rrc_eNB_get_ue_context(RC.nr_rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc > 0) { - rrc_eNB_get_ue_context(RC.nr_rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc = - rrc_eNB_get_ue_context(RC.nr_rrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_thres_rrc; + if (rrc_eNB_get_ue_context(RC.nrrrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti) + && rrc_eNB_get_ue_context(RC.nrrrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc > 0) { + rrc_eNB_get_ue_context(RC.nrrrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_rrc = + rrc_eNB_get_ue_context(RC.nrrrc[instance], GTPV1U_ENB_DELETE_TUNNEL_RESP(msg_p).rnti)->ue_context.ue_release_timer_thres_rrc; } break; #endif - /* Messages from eNB app */ + /* Messages from gNB app */ case NRRRC_CONFIGURATION_REQ: LOG_I(NR_RRC, "[gNB %d] Received %s : %p\n", instance, msg_name_p,&NRRRC_CONFIGURATION_REQ(msg_p)); openair_rrc_gNB_configuration(GNB_INSTANCE_TO_MODULE_ID(instance), &NRRRC_CONFIGURATION_REQ(msg_p)); @@ -414,35 +423,35 @@ openair_rrc_top_init_gNB(int eMBMS_active,uint8_t HO_active) /* for no gcc warnings */ (void)CC_id; - LOG_D(RRC, "[OPENAIR][INIT] Init function start: NB_eNB_INST=%d\n", RC.nb_inst); + LOG_D(RRC, "[OPENAIR][INIT] Init function start: NB_gNB_INST=%d\n", RC.nb_nr_inst); - if (RC.nb_inst > 0) { - LOG_I(RRC,"[eNB] handover active state is %d \n", HO_active); + if (RC.nb_nr_inst > 0) { + LOG_I(RRC,"[gNB] handover active state is %d \n", HO_active); - for (module_id=0; module_idHO_flag = (uint8_t)HO_active; + for (module_id=0; module_idHO_flag = (uint8_t)HO_active; } #if defined(Rel10) || defined(Rel14) - LOG_I(RRC,"[eNB] eMBMS active state is %d \n", eMBMS_active); + LOG_I(RRC,"[gNB] eMBMS active state is %d \n", eMBMS_active); - for (module_id=0; module_idcarrier[CC_id].MBMS_flag = (uint8_t)eMBMS_active; + RC.nrrrc[module_id]->carrier[CC_id].MBMS_flag = (uint8_t)eMBMS_active; } } #endif #ifdef CBA - for (module_id=0; module_idcarrier[CC_id].num_active_cba_groups = cba_group_active; + RC.nrrrc[module_id]->carrier[CC_id].num_active_cba_groups = cba_group_active; } } #endif - }//END if (RC.nb_inst > 0) + }//END if (RC.nb_nr_inst > 0) } \ No newline at end of file diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf index 5b86538586..bc84e24a37 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf @@ -275,19 +275,25 @@ gNBs = DL_FreqBandIndicatorNR = 0; DL_absoluteFrequencyPointA = 0; DL_offsetToCarrier = 0; - DL_SubcarrierSpacing = 0; + DL_SCS_SubcarrierSpacing = 0; DL_SCS_SpecificCarrier_k0 = 0; DL_carrierBandwidth = 0; - DL_locationAndBandwidth = 0; + DL_locationAndBandwidth = 0; + DL_BWP_SubcarrierSpacing = 0; + DL_BWP_prefix_type = "NORMAL"; UL_FreqBandIndicatorNR = 0; UL_absoluteFrequencyPointA = 0; - FrequencyInfoUL_p_Max = 0; - frequencyShift7p5khz = 0; + UL_additionalSpectrumEmission = 0; + UL_p_Max = 0; + UL_frequencyShift7p5khz = 0; UL_offsetToCarrier = 0; - UL_SubcarrierSpacing = 0; + UL_SCS_SubcarrierSpacing = 0; UL_SCS_SpecificCarrier_k0 = 0; UL_carrierBandwidth = 0; UL_locationAndBandwidth = 0; + UL_BWP_SubcarrierSpacing = 0; + UL_BWP_prefix_type = 0; + ServingCellConfigCommon__ssb_PositionsInBurst_PR = 0; ServingCellConfigCommon_ssb_periodicityServingCell = 0; ServingCellConfigCommon_dmrs_TypeA_Position = 0; NIA_SubcarrierSpacing = 0; @@ -357,6 +363,7 @@ gNBs = PDCCH_interleaverSize = 0; PDCCH_shiftIndex = 0; PDCCH_precoderGranularity = 0; + PDCCH_TCI_StateId = 0; tci_PresentInDCI = NULL; SearchSpaceId = 0; commonSearchSpaces_controlResourceSetId = 0; From 3b7960d8516395b2a481028565d2370440f6bcf9 Mon Sep 17 00:00:00 2001 From: Calvin Date: Fri, 25 May 2018 16:16:22 +0200 Subject: [PATCH 11/13] 1. nr_rrc_mac_config_req_ue 2. copy IF module from eNB to new folder --- openair2/LAYER2/NR_MAC_UE/config_ue.c | 67 +- openair2/LAYER2/NR_MAC_UE/defs.h | 23 + openair2/LAYER2/NR_MAC_UE/main_ue_nr.c | 6 + openair2/LAYER2/NR_MAC_UE/vars.c | 34 + openair2/NR_UE_PHY_INTERFACE/IF_Module.c | 647 ++++++++++++++++++ openair2/NR_UE_PHY_INTERFACE/IF_Module.h | 142 ++++ openair2/NR_UE_PHY_INTERFACE/defs.h | 373 ++++++++++ openair2/NR_UE_PHY_INTERFACE/extern.h | 27 + .../NR_UE_PHY_INTERFACE/mac_phy_primitives.c | 283 ++++++++ .../NR_UE_PHY_INTERFACE/mac_phy_primitives.h | 232 +++++++ openair2/NR_UE_PHY_INTERFACE/vars.h | 44 ++ 11 files changed, 1867 insertions(+), 11 deletions(-) create mode 100644 openair2/LAYER2/NR_MAC_UE/vars.c create mode 100644 openair2/NR_UE_PHY_INTERFACE/IF_Module.c create mode 100644 openair2/NR_UE_PHY_INTERFACE/IF_Module.h create mode 100644 openair2/NR_UE_PHY_INTERFACE/defs.h create mode 100644 openair2/NR_UE_PHY_INTERFACE/extern.h create mode 100644 openair2/NR_UE_PHY_INTERFACE/mac_phy_primitives.c create mode 100644 openair2/NR_UE_PHY_INTERFACE/mac_phy_primitives.h create mode 100644 openair2/NR_UE_PHY_INTERFACE/vars.h diff --git a/openair2/LAYER2/NR_MAC_UE/config_ue.c b/openair2/LAYER2/NR_MAC_UE/config_ue.c index 6e75276264..c699ad5232 100644 --- a/openair2/LAYER2/NR_MAC_UE/config_ue.c +++ b/openair2/LAYER2/NR_MAC_UE/config_ue.c @@ -39,43 +39,88 @@ nr_rrc_mac_config_req_ue( PhysicalCellGroupConfig_t *phy_cell_group_config, SpCellConfig_t *spcell_config){ + NR_UE_MAC_INST *mac = get_mac_inst(Mod_idP); + + ServingCellConfig_t *serving_cell_config = spcell_config->spCellConfigDedicated; // TODO do something FAPI-like P5 L1/L2 config interface in config_si, config_mib, etc. if(mac_cell_group_config != (MAC_CellGroupConfig_t *)0){ if(mac_cell_group_config->drx_Config != (drx_Config_t *)0 ){ - NR_UE_mac_inst->drx_Config = mac_cell_group_config->drx_Config; + mac->drx_Config = mac_cell_group_config->drx_Config; } if(mac_cell_group_config->SchedulingRequestConfig != (SchedulingRequestConfig_t *)0 ){ - NR_UE_mac_inst->SchedulingRequestConfig = mac_cell_group_config->SchedulingRequestConfig; + mac->SchedulingRequestConfig = mac_cell_group_config->SchedulingRequestConfig; } if(mac_cell_group_config->BSR_Config != (BSR_Config_t *)0 ){ - NR_UE_mac_inst->BSR_Config = mac_cell_group_config->BSR_Config; + mac->BSR_Config = mac_cell_group_config->BSR_Config; } if(mac_cell_group_config->TAG_Config != (TAG_Config_t *)0 ){ - NR_UE_mac_inst->TAG_Config = mac_cell_group_config->TAG_Config; + mac->TAG_Config = mac_cell_group_config->TAG_Config; } if(mac_cell_group_config->phr_Config != (phr_Config_t *)0 ){ - NR_UE_mac_inst->phr_Config = mac_cell_group_config->phr_Config; + mac->phr_Config = mac_cell_group_config->phr_Config; } if(mac_cell_group_config->cs_RNTI != (cs_RNTI_t *)0 ){ - NR_UE_mac_inst->cs_RNTI = mac_cell_group_config->cs_RNTI; + mac->cs_RNTI = mac_cell_group_config->cs_RNTI; } - - } if(phy_cell_group_config != (PhysicalCellGroupConfig_t *)0){ - + config_phy(phy_cell_group_config, NULL); } - if(spcell_config != (SpCellConfig_t *)0){ - + if(serving_cell_config_config != (SpCellConfig_t *)0){ + config_phy(NULL, spcell_config); + mac->servCellIndex = spcell_config->servCellIndex; } + + if(serving_cell_config != (spCellConfigDedicated_t *)0){ + if(serving_cell_config->tdd_UL_DL_ConfigurationDedicated != (TDD_UL_DL_ConfigDedicated_t *)0){ + mac->tdd_UL_DL_ConfigurationDedicated = serving_cell_config->tdd_UL_DL_ConfigurationDedicated; + } + + if(spcell_config->initialDownlinkBWP != (BWP_DownlinkDedicated_t *)0){ + mac->init_DL_BWP = spcell_config->initialDownlinkBWP; + } + + // storage list of DL BWP config. TODO should be modify to maintain(add/release) a list inside MAC instance, this implementation just use for one-shot RRC configuration setting. + if(spcell_config->downlinkBWP_ToAddModList != (struct ServingCellConfig__downlinkBWP_ToAddModList *)0){ + mac->BWP_Downlink_list = spcell_config->downlinkBWP_ToAddModList->list; + mac->BWP_Downlink_count = spcell_config->downlinkBWP_ToAddModList->count; + } + + if(spcell_config->bwp_InactivityTimer != (long *)0){ + mac->bwp_InactivityTimer = spcell_config->bwp_InactivityTimer; + } + + if(spcell_config->defaultDownlinkBWP_Id != (BWP_Id_t *)0){ + mac->defaultDownlinkBWP_Id = spcell_config->defaultDownlinkBWP_Id; + } + + if(spcell_config->pdsch_ServingCellConfig != (PDSCH_ServingCellConfig_t *)0){ + mac->pdsch_ServingCellConfig = spcell_config->pdsch_ServingCellConfig; + } + + if(spcell_config->csi_MeasConfig != (CSI_MeasConfig_t *)0){ + mac->csi_MeasConfig = spcell_config->csi_MeasConfig; + } + + spcell_config->tag_Id = spcell_config.tag_Id; + } + + //scell config not yet + + + + + + + return (0); } diff --git a/openair2/LAYER2/NR_MAC_UE/defs.h b/openair2/LAYER2/NR_MAC_UE/defs.h index b2a3ec259f..e7329616b7 100644 --- a/openair2/LAYER2/NR_MAC_UE/defs.h +++ b/openair2/LAYER2/NR_MAC_UE/defs.h @@ -72,12 +72,35 @@ /*!\brief Top level UE MAC structure */ typedef struct { + //// MAC config drx_Config_t *drx_config; SchedulingRequestConfig_t *SchedulingRequestConfig; BSR_Config_t *BSR_Config; TAG_Config_t *TAG_Config; phr_Config_t *phr_Config; cs_RNTI_t *cs_RNTI; + ServCellIndex_t *servCellIndex; + + //// Serving cell config + TDD_UL_DL_ConfigDedicated_t *tdd_UL_DL_ConfigurationDedicated; + // init DL BWP + BWP_DownlinkDedicated_t *init_DL_BWP; + // DL BWP list, not default one + BWP_Downlink_t **BWP_Downlink_list; + int BWP_Downlink_count; + //BWP_Id_t *firstActiveDownlinkBWP_Id; + long *bwp_InactivityTimer; + BWP_Id_t *defaultDownlinkBWP_Id; + //struct UplinkConfig *uplinkConfig; + //struct UplinkConfig *supplementaryUplink; + PDSCH_ServingCellConfig_t *pdsch_ServingCellConfig; + CSI_MeasConfig_t *csi_MeasConfig; + //SRS_CarrierSwitching_t *carrierSwitching; + //long *sCellDeactivationTimer /* OPTIONAL */; + //struct CrossCarrierSchedulingConfig *crossCarrierSchedulingConfig /* OPTIONAL */; + TAG_Id_t tag_Id; + //long *ue_BeamLockFunction /* OPTIONAL */; + //long *pathlossReferenceLinking /* OPTIONAL */; } UE_MAC_INST; #include "proto.h" diff --git a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c index d682cf5870..a1c3688fc4 100644 --- a/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c +++ b/openair2/LAYER2/NR_MAC_UE/main_ue_nr.c @@ -34,6 +34,7 @@ #include "extern.h" #include "assertions.h" +static NR_UE_MAC_INST_t *nr_ue_mac_inst; int nr_l2_init_ue(void) @@ -43,7 +44,12 @@ nr_l2_init_ue(void) LOG_I(MAC, "[MAIN] init UE MAC functions \n"); //init mac here + nr_ue_mac_inst = (NR_UE_MAC_INST_t *)malloc(sizeof(NR_UE_MAC_INST_t)*NB_NR_UE_MAC_INST); + return (1); } +NR_UE_MAC_INST_t *get_mac_inst(Module_id_t Mod_idP){ + return &nr_ue_mac_inst[(int)Mod_idP]; +} diff --git a/openair2/LAYER2/NR_MAC_UE/vars.c b/openair2/LAYER2/NR_MAC_UE/vars.c new file mode 100644 index 0000000000..300917b3c1 --- /dev/null +++ b/openair2/LAYER2/NR_MAC_UE/vars.c @@ -0,0 +1,34 @@ +/* + * 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 + */ + +/*! \file vars.h +* \brief mac vars +* \author Navid Nikaein and Raymond Knopp +* \date 2010 - 2014 +* \version 1.0 +* \email navid.nikaein@eurecom.fr +* @ingroup _mac + +*/ + +UE_MAC_INST_t UE_mac_inst; //[NB_MODULE_MAX]; + + diff --git a/openair2/NR_UE_PHY_INTERFACE/IF_Module.c b/openair2/NR_UE_PHY_INTERFACE/IF_Module.c new file mode 100644 index 0000000000..d0b8e57558 --- /dev/null +++ b/openair2/NR_UE_PHY_INTERFACE/IF_Module.c @@ -0,0 +1,647 @@ +#include "openair1/PHY/defs.h" +#include "openair2/PHY_INTERFACE/IF_Module.h" +#include "openair1/PHY/extern.h" +#include "LAYER2/MAC/extern.h" +#include "LAYER2/MAC/proto.h" +#include "common/ran_context.h" + +#define MAX_IF_MODULES 100 + +IF_Module_t *if_inst[MAX_IF_MODULES]; +Sched_Rsp_t Sched_INFO[MAX_IF_MODULES][MAX_NUM_CCs]; + +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 uint8_t nfapi_mode; +extern uint16_t sf_ahead; + +void handle_rach(UL_IND_t *UL_info) { + int i; + + if (UL_info->rach_ind.rach_indication_body.number_of_preambles>0) { + + AssertFatal(UL_info->rach_ind.rach_indication_body.number_of_preambles==1,"More than 1 preamble not supported\n"); + UL_info->rach_ind.rach_indication_body.number_of_preambles=0; + LOG_D(MAC,"UL_info[Frame %d, Subframe %d] Calling initiate_ra_proc RACH:SFN/SF:%d\n",UL_info->frame,UL_info->subframe, NFAPI_SFNSF2DEC(UL_info->rach_ind.sfn_sf)); + initiate_ra_proc(UL_info->module_id, + UL_info->CC_id, + NFAPI_SFNSF2SFN(UL_info->rach_ind.sfn_sf), + NFAPI_SFNSF2SF(UL_info->rach_ind.sfn_sf), + UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.preamble, + UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.timing_advance, + UL_info->rach_ind.rach_indication_body.preamble_list[0].preamble_rel8.rnti +#ifdef Rel14 + ,0 +#endif + ); + } + +#ifdef Rel14 + if (UL_info->rach_ind_br.rach_indication_body.number_of_preambles>0) { + + AssertFatal(UL_info->rach_ind_br.rach_indication_body.number_of_preambles<5,"More than 4 preambles not supported\n"); + for (i=0;irach_ind_br.rach_indication_body.number_of_preambles;i++) { + AssertFatal(UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel13.rach_resource_type>0, + "Got regular PRACH preamble, not BL/CE\n"); + LOG_D(MAC,"Frame %d, Subframe %d Calling initiate_ra_proc (CE_level %d)\n",UL_info->frame,UL_info->subframe, + UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel13.rach_resource_type-1); + initiate_ra_proc(UL_info->module_id, + UL_info->CC_id, + UL_info->frame, + UL_info->subframe, + UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel8.preamble, + UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel8.timing_advance, + UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel8.rnti, + UL_info->rach_ind_br.rach_indication_body.preamble_list[i].preamble_rel13.rach_resource_type); + } + UL_info->rach_ind_br.rach_indication_body.number_of_preambles=0; + } +#endif +} + +void handle_sr(UL_IND_t *UL_info) { + + int i; + + if (nfapi_mode == 1) // PNF + { + if (UL_info->sr_ind.sr_indication_body.number_of_srs>0) + { + oai_nfapi_sr_indication(&UL_info->sr_ind); + } + } + else + { + for (i=0;isr_ind.sr_indication_body.number_of_srs;i++) + SR_indication(UL_info->module_id, + UL_info->CC_id, + UL_info->frame, + UL_info->subframe, + UL_info->sr_ind.sr_indication_body.sr_pdu_list[i].rx_ue_information.rnti, + UL_info->sr_ind.sr_indication_body.sr_pdu_list[i].ul_cqi_information.ul_cqi); + } + + UL_info->sr_ind.sr_indication_body.number_of_srs=0; +} + +void handle_cqi(UL_IND_t *UL_info) { + + int i; + + if (nfapi_mode == 1) + { + if (UL_info->cqi_ind.number_of_cqis>0) + { + LOG_D(PHY,"UL_info->cqi_ind.number_of_cqis:%d\n", UL_info->cqi_ind.number_of_cqis); + nfapi_cqi_indication_t ind; + + ind.header.message_id = NFAPI_RX_CQI_INDICATION; + ind.sfn_sf = UL_info->frame<<4 | UL_info->subframe; + ind.cqi_indication_body = UL_info->cqi_ind; + + oai_nfapi_cqi_indication(&ind); + + UL_info->cqi_ind.number_of_cqis=0; + } + } + else + { + for (i=0;icqi_ind.number_of_cqis;i++) + cqi_indication(UL_info->module_id, + UL_info->CC_id, + UL_info->frame, + UL_info->subframe, + UL_info->cqi_ind.cqi_pdu_list[i].rx_ue_information.rnti, + &UL_info->cqi_ind.cqi_pdu_list[i].cqi_indication_rel9, + UL_info->cqi_ind.cqi_raw_pdu_list[i].pdu, + &UL_info->cqi_ind.cqi_pdu_list[i].ul_cqi_information); + + UL_info->cqi_ind.number_of_cqis=0; + } +} + +void handle_harq(UL_IND_t *UL_info) { + + int i; + + if (nfapi_mode == 1 && UL_info->harq_ind.harq_indication_body.number_of_harqs>0) // PNF + { + //LOG_D(PHY, "UL_info->harq_ind.harq_indication_body.number_of_harqs:%d Send to VNF\n", UL_info->harq_ind.harq_indication_body.number_of_harqs); + + int retval = oai_nfapi_harq_indication(&UL_info->harq_ind); + + if (retval!=0) + { + LOG_E(PHY, "Failed to encode NFAPI HARQ_IND retval:%d\n", retval); + } + + UL_info->harq_ind.harq_indication_body.number_of_harqs = 0; + } + else + { + for (i=0;iharq_ind.harq_indication_body.number_of_harqs;i++) + harq_indication(UL_info->module_id, + UL_info->CC_id, + NFAPI_SFNSF2SFN(UL_info->harq_ind.sfn_sf), + NFAPI_SFNSF2SF(UL_info->harq_ind.sfn_sf), + &UL_info->harq_ind.harq_indication_body.harq_pdu_list[i]); + + UL_info->harq_ind.harq_indication_body.number_of_harqs=0; + } +} + +void handle_ulsch(UL_IND_t *UL_info) { + + int i,j; + + if(nfapi_mode == 1) + { + if (UL_info->crc_ind.crc_indication_body.number_of_crcs>0) + { + //LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.number_of_crcs:%d CRC_IND:SFN/SF:%d\n", UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf)); + + oai_nfapi_crc_indication(&UL_info->crc_ind); + + UL_info->crc_ind.crc_indication_body.number_of_crcs = 0; + } + + if (UL_info->rx_ind.rx_indication_body.number_of_pdus>0) + { + //LOG_D(PHY,"UL_info->rx_ind.number_of_pdus:%d RX_IND:SFN/SF:%d\n", UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf)); + oai_nfapi_rx_ind(&UL_info->rx_ind); + UL_info->rx_ind.rx_indication_body.number_of_pdus = 0; + } + } + else + { + if (UL_info->rx_ind.rx_indication_body.number_of_pdus>0 && UL_info->crc_ind.crc_indication_body.number_of_crcs>0) { + for (i=0;irx_ind.rx_indication_body.number_of_pdus;i++) { + for (j=0;jcrc_ind.crc_indication_body.number_of_crcs;j++) { + // find crc_indication j corresponding rx_indication i + LOG_D(PHY,"UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].rx_ue_information.rnti:%04x UL_info->rx_ind.rx_indication_body.rx_pdu_list[%d].rx_ue_information.rnti:%04x\n", j, UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].rx_ue_information.rnti, i, UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti); + if (UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].rx_ue_information.rnti == + UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti) { + LOG_D(PHY, "UL_info->crc_ind.crc_indication_body.crc_pdu_list[%d].crc_indication_rel8.crc_flag:%d\n", j, UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].crc_indication_rel8.crc_flag); + if (UL_info->crc_ind.crc_indication_body.crc_pdu_list[j].crc_indication_rel8.crc_flag == 1) { // CRC error indication + LOG_D(MAC,"Frame %d, Subframe %d Calling rx_sdu (CRC error) \n",UL_info->frame,UL_info->subframe); + rx_sdu(UL_info->module_id, + UL_info->CC_id, + NFAPI_SFNSF2SFN(UL_info->rx_ind.sfn_sf), //UL_info->frame, + NFAPI_SFNSF2SF(UL_info->rx_ind.sfn_sf), //UL_info->subframe, + UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti, + (uint8_t *)NULL, + UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length, + UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.timing_advance, + UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.ul_cqi); + } + else { + LOG_D(MAC,"Frame %d, Subframe %d Calling rx_sdu (CRC ok) \n",UL_info->frame,UL_info->subframe); + rx_sdu(UL_info->module_id, + UL_info->CC_id, + NFAPI_SFNSF2SFN(UL_info->rx_ind.sfn_sf), //UL_info->frame, + NFAPI_SFNSF2SF(UL_info->rx_ind.sfn_sf), //UL_info->subframe, + UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_ue_information.rnti, + UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].data, + UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.length, + UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.timing_advance, + UL_info->rx_ind.rx_indication_body.rx_pdu_list[i].rx_indication_rel8.ul_cqi); + } + break; + } //if (UL_info->crc_ind.crc_pdu_list[j].rx_ue_information.rnti == + // UL_info->rx_ind.rx_pdu_list[i].rx_ue_information.rnti) + } // for (j=0;jcrc_ind.crc_indication_body.number_of_crcs;j++) + } // for (i=0;irx_ind.number_of_pdus;i++) + UL_info->crc_ind.crc_indication_body.number_of_crcs=0; + UL_info->rx_ind.rx_indication_body.number_of_pdus = 0; + } // UL_info->rx_ind.rx_indication_body.number_of_pdus>0 && UL_info->subframe && UL_info->crc_ind.crc_indication_body.number_of_crcs>0 + else if (UL_info->rx_ind.rx_indication_body.number_of_pdus!=0 || UL_info->crc_ind.crc_indication_body.number_of_crcs!=0) { + LOG_E(PHY,"hoping not to have mis-match between CRC ind and RX ind - hopefully the missing message is coming shortly rx_ind:%d(SFN/SF:%05d) crc_ind:%d(SFN/SF:%05d) UL_info(SFN/SF):%04d%d\n", + UL_info->rx_ind.rx_indication_body.number_of_pdus, NFAPI_SFNSF2DEC(UL_info->rx_ind.sfn_sf), + UL_info->crc_ind.crc_indication_body.number_of_crcs, NFAPI_SFNSF2DEC(UL_info->crc_ind.sfn_sf), + UL_info->frame, UL_info->subframe); + } + } +} + +/****************************************************************************/ +/* debug utility functions begin */ +/****************************************************************************/ + +//#define DUMP_FAPI + +#ifdef DUMP_FAPI + +#define C do { size = 0; put(0); } while (0) +#define A(...) do { char t[4096]; sprintf(t, __VA_ARGS__); append_string(t); } while (0) + +#if 0 + +/* eats lots of ms at startup, disrupts realtime */ +static char *s; +static int size; +static int maxsize; + +static void put(char x) +{ + if (size == maxsize) { + maxsize += 32768; + s = realloc(s, maxsize); if (s == NULL) abort(); + } + s[size++] = x; +} + +#else + +/* eats nothing at startup, but fixed size */ +#define SMAX 65536 +static char s[SMAX]; +static int size; +static int maxsize = SMAX; + +static void put(char x) +{ + if (size == maxsize) { printf("incrase SMAX\n"); exit(1); } + s[size++] = x; +} + +#endif + +static void append_string(char *t) +{ + size--; + while (*t) put(*t++); + put(0); +} + +static void dump_ul(UL_IND_t *u) +{ + int i; + + C; + A("XXXX UL mod %d CC %d f.sf %d.%d\n", + u->module_id, u->CC_id, u->frame, u->subframe); + + A("XXXX harq_ind %d\n", u->harq_ind.harq_indication_body.number_of_harqs); + for (i = 0; i < u->harq_ind.harq_indication_body.number_of_harqs; i++) { + nfapi_harq_indication_pdu_t *v = &u->harq_ind.harq_indication_body.harq_pdu_list[i]; + A("XXXX harq ind %d\n", i); + A("XXXX rnti %d\n", v->rx_ue_information.rnti); + A("XXXX tb1 %d tb2 %d\n", v->harq_indication_fdd_rel8.harq_tb1, + v->harq_indication_fdd_rel8.harq_tb2); + A("XXXX number_of_ack_nack %d\n", + v->harq_indication_fdd_rel9.number_of_ack_nack); + A("XXXX harq[0] = %d\n", + v->harq_indication_fdd_rel9.harq_tb_n[0]); + A("XXXX harq ul_cqi %d channel %d\n", v->ul_cqi_information.ul_cqi, + v->ul_cqi_information.channel); + } + + A("XXXX crc_ind %d\n", u->crc_ind.crc_indication_body.number_of_crcs); + + A("XXXX sr_ind %d\n", u->sr_ind.sr_indication_body.number_of_srs); + + A("XXXX cqi_ind %d\n", u->cqi_ind.number_of_cqis); + for (i = 0; i < u->cqi_ind.number_of_cqis; i++) { + nfapi_cqi_indication_pdu_t *v = &u->cqi_ind.cqi_pdu_list[i]; + A("XXXX cqi ind %d\n", i); + A("XXXX cqi ul_cqi %d channel %d\n", v->ul_cqi_information.ul_cqi, + v->ul_cqi_information.channel); + } + + A("XXXX rach_ind %d\n", u->rach_ind.rach_indication_body.number_of_preambles); + + A("XXXX rx_ind %d\n", u->rx_ind.rx_indication_body.number_of_pdus); + for (i = 0; i < u->rx_ind.rx_indication_body.number_of_pdus; i++) { + nfapi_rx_indication_pdu_t *v = &u->rx_ind.rx_indication_body.rx_pdu_list[i]; + A("XXXX rx ind %d\n", i); + A("XXXX timing_advance %d\n", + v->rx_indication_rel8.timing_advance); + A("XXXX rx ul_cqi %d\n", v->rx_indication_rel8.ul_cqi); + } + + LOG_I(PHY, "XXXX UL\nXXXX UL\n%s", s); +} + +static char *DL_PDU_TYPE(int x) +{ + switch (x) { + case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE: return "NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE"; + case NFAPI_DL_CONFIG_BCH_PDU_TYPE: return "NFAPI_DL_CONFIG_BCH_PDU_TYPE"; + case NFAPI_DL_CONFIG_MCH_PDU_TYPE: return "NFAPI_DL_CONFIG_MCH_PDU_TYPE"; + case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE: return "NFAPI_DL_CONFIG_DLSCH_PDU_TYPE"; + case NFAPI_DL_CONFIG_PCH_PDU_TYPE: return "NFAPI_DL_CONFIG_PCH_PDU_TYPE"; + case NFAPI_DL_CONFIG_PRS_PDU_TYPE: return "NFAPI_DL_CONFIG_PRS_PDU_TYPE"; + case NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE: return "NFAPI_DL_CONFIG_CSI_RS_PDU_TYPE"; + case NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE: return "NFAPI_DL_CONFIG_EPDCCH_DL_PDU_TYPE"; + case NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE: return "NFAPI_DL_CONFIG_MPDCCH_PDU_TYPE"; + case NFAPI_DL_CONFIG_NBCH_PDU_TYPE: return "NFAPI_DL_CONFIG_NBCH_PDU_TYPE"; + case NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE: return "NFAPI_DL_CONFIG_NPDCCH_PDU_TYPE"; + case NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE: return "NFAPI_DL_CONFIG_NDLSCH_PDU_TYPE"; + } + return "UNKNOWN"; +} + +static char *UL_PDU_TYPE(int x) +{ + switch (x) { + case NFAPI_UL_CONFIG_ULSCH_PDU_TYPE: return "NFAPI_UL_CONFIG_ULSCH_PDU_TYPE"; + case NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE: return "NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE"; + case NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE: return "NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE"; + case NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE: return "NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE"; + case NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE: return "NFAPI_UL_CONFIG_UCI_CQI_PDU_TYPE"; + case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE: return "NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE"; + case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE: return "NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE"; + case NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE: return "NFAPI_UL_CONFIG_UCI_SR_HARQ_PDU_TYPE"; + case NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE: return "NFAPI_UL_CONFIG_UCI_CQI_HARQ_PDU_TYPE"; + case NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE: return "NFAPI_UL_CONFIG_UCI_CQI_SR_PDU_TYPE"; + case NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE: return "NFAPI_UL_CONFIG_UCI_CQI_SR_HARQ_PDU_TYPE"; + case NFAPI_UL_CONFIG_SRS_PDU_TYPE: return "NFAPI_UL_CONFIG_SRS_PDU_TYPE"; + case NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE: return "NFAPI_UL_CONFIG_HARQ_BUFFER_PDU_TYPE"; + case NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE: return "NFAPI_UL_CONFIG_ULSCH_UCI_CSI_PDU_TYPE"; + case NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE: return "NFAPI_UL_CONFIG_ULSCH_UCI_HARQ_PDU_TYPE"; + case NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE: return "NFAPI_UL_CONFIG_ULSCH_CSI_UCI_HARQ_PDU_TYPE"; + case NFAPI_UL_CONFIG_NULSCH_PDU_TYPE: return "NFAPI_UL_CONFIG_NULSCH_PDU_TYPE"; + case NFAPI_UL_CONFIG_NRACH_PDU_TYPE: return "NFAPI_UL_CONFIG_NRACH_PDU_TYPE"; + } + return "UNKNOWN"; +} + +static char *HI_DCI0_PDU_TYPE(int x) +{ + switch (x) { + case NFAPI_HI_DCI0_HI_PDU_TYPE: return "NFAPI_HI_DCI0_HI_PDU_TYPE"; + case NFAPI_HI_DCI0_DCI_PDU_TYPE: return "NFAPI_HI_DCI0_DCI_PDU_TYPE"; + case NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE: return "NFAPI_HI_DCI0_EPDCCH_DCI_PDU_TYPE"; + case NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE: return "NFAPI_HI_DCI0_MPDCCH_DCI_PDU_TYPE"; + case NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE: return "NFAPI_HI_DCI0_NPDCCH_DCI_PDU_TYPE"; + } + return "UNKNOWN"; +} + +static void dump_dl(Sched_Rsp_t *d) +{ + int i; + + C; + A("XXXX DL mod %d CC %d f.sf %d.%d\n", + d->module_id, d->CC_id, d->frame, d->subframe); + + if (d->DL_req != NULL) { + nfapi_dl_config_request_body_t *v=&d->DL_req->dl_config_request_body; + nfapi_dl_config_request_pdu_t *p = v->dl_config_pdu_list; + A("XXXX DL_req sfnsf %d\n", d->DL_req->sfn_sf); + A("XXXX PDCCH size %d\n", v->number_pdcch_ofdm_symbols); + A("XXXX DCIs %d\n", v->number_dci); + A("XXXX PDUs %d\n", v->number_pdu); + A("XXXX rntis %d\n", v->number_pdsch_rnti); + A("XXXX pcfich power %d\n", v->transmission_power_pcfich); + for (i = 0; i < v->number_pdu; i++) { + A("XXXX pdu %d\n", i); + A("XXXX type %d %s\n", p[i].pdu_type, DL_PDU_TYPE(p[i].pdu_type)); + switch (p[i].pdu_type) { + case NFAPI_DL_CONFIG_DCI_DL_PDU_TYPE: { + nfapi_dl_config_dci_dl_pdu_rel8_t *q = + &p[i].dci_dl_pdu.dci_dl_pdu_rel8; + A("XXXX dci format %d\n", q->dci_format); + A("XXXX cce idx %d\n", q->cce_idx); + A("XXXX agg lvl %d\n", q->aggregation_level); + A("XXXX rnti %d\n", q->rnti); + A("XXXX rb coding %8.8x\n", q->resource_block_coding); + A("XXXX mcs_1 %d\n", q->mcs_1); + A("XXXX rv_1 %d\n", q->redundancy_version_1); + A("XXXX ndi_1 %d\n", q->new_data_indicator_1); + A("XXXX harq pid %d\n", q->harq_process); + A("XXXX tpc %d\n", q->tpc); + A("XXXX tbs idx %d\n", q->transport_block_size_index); + A("XXXX dl pow off %d\n", q->downlink_power_offset); + A("XXXX rnti type %d\n", q->rnti_type); + A("XXXX xmit pow %d\n", q->transmission_power); + break; + } + case NFAPI_DL_CONFIG_DLSCH_PDU_TYPE: { + nfapi_dl_config_dlsch_pdu_rel8_t *q = + &p[i].dlsch_pdu.dlsch_pdu_rel8; + A("XXXX pdu_index %d\n", q->pdu_index); + A("XXXX rnti %d\n", q->rnti); + A("XXXX rv %d\n", q->redundancy_version); + A("XXXX mcs %d\n", q->modulation); + A("XXXX pa %d\n", q->pa); + break; + }} + } + } + + if (d->HI_DCI0_req != NULL) { + nfapi_hi_dci0_request_body_t *v=&d->HI_DCI0_req->hi_dci0_request_body; + A("XXXX up HI_DCI0_req sfnsf %d (%d.%d)\n", d->HI_DCI0_req->sfn_sf, + d->HI_DCI0_req->sfn_sf/16, d->HI_DCI0_req->sfn_sf%16); + A("XXXX up sfnsf %d\n", v->sfnsf); + A("XXXX up DCIs %d\n", v->number_of_dci); + A("XXXX up HIs %d\n", v->number_of_hi); + for (i = 0; i < v->number_of_dci + v->number_of_hi; i++) { + nfapi_hi_dci0_request_pdu_t *p = &v->hi_dci0_pdu_list[i]; + A("XXXX up pdu %d\n", i); + A("XXXX up type %d %s\n",p->pdu_type,HI_DCI0_PDU_TYPE(p->pdu_type)); + if (p->pdu_type == NFAPI_HI_DCI0_DCI_PDU_TYPE) { + nfapi_hi_dci0_dci_pdu_rel8_t *q = &p->dci_pdu.dci_pdu_rel8; + A("XXXX up dci_format %d\n", q->dci_format); + A("XXXX up cce_index %d\n", q->cce_index); + A("XXXX up aggregation_level %d\n", q->aggregation_level); + A("XXXX up rnti %d\n", q->rnti); + A("XXXX up rb start %d\n", q->resource_block_start); + A("XXXX up # rb %d\n", q->number_of_resource_block); + A("XXXX up mcs_1 %d\n", q->mcs_1); + A("XXXX up cshift_2_for_drms %d\n", q->cyclic_shift_2_for_drms); + A("XXXX up freq hop enabled %d\n", q->frequency_hopping_enabled_flag); + A("XXXX up fre hop bits %d\n", q->frequency_hopping_bits); + A("XXXX up NDI_1 %d\n", q->new_data_indication_1); + A("XXXX up tx_antenna_seleciton %d\n", q->ue_tx_antenna_seleciton); + A("XXXX up tpc %d\n", q->tpc); + A("XXXX up cqi_csi_request %d\n", q->cqi_csi_request); + A("XXXX up ul_index %d\n", q->ul_index); + A("XXXX up dl_assignment_index %d\n", q->dl_assignment_index); + A("XXXX up tpc_bitmap %d\n", q->tpc_bitmap); + A("XXXX up transmission_power %d\n", q->transmission_power); + } + if (p->pdu_type == NFAPI_HI_DCI0_HI_PDU_TYPE) { + nfapi_hi_dci0_hi_pdu_rel8_t *q = &p->hi_pdu.hi_pdu_rel8; + A("XXXX up rb start %d\n", q->resource_block_start); + A("XXXX up cs2_drms %d\n", q->cyclic_shift_2_for_drms); + A("XXXX up ack %d\n", q->hi_value); + A("XXXX up i_phich %d\n", q->i_phich); + A("XXXX up power %d\n", q->transmission_power); + } + } + } + + if (d->UL_req != NULL) { + nfapi_ul_config_request_body_t *v=&d->UL_req->ul_config_request_body; + A("XXXX UL_req sfnsf %d (%d.%d)\n", d->UL_req->sfn_sf, + d->UL_req->sfn_sf/16, d->UL_req->sfn_sf%16); + A("XXXX PDUs %d\n", v->number_of_pdus); + A("XXXX ra freq %d\n", v->rach_prach_frequency_resources); + A("XXXX srs? %d\n", v->srs_present); + for (i = 0; i < v->number_of_pdus; i++) { + nfapi_ul_config_request_pdu_t *p = &v->ul_config_pdu_list[i]; + A("XXXX pdu %d\n", i); + A("XXXX type %d %s\n", p->pdu_type, UL_PDU_TYPE(p->pdu_type)); + switch(p->pdu_type) { + case NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE: { + nfapi_ul_config_uci_harq_pdu *q = &p->uci_harq_pdu; + nfapi_ul_config_harq_information_rel9_fdd_t *h = + &q->harq_information.harq_information_rel9_fdd; + A("XXXX rnti %d\n", + q->ue_information.ue_information_rel8.rnti); + A("XXXX harq size %d\n", h->harq_size); + A("XXXX ack_nack_mode %d\n", h->ack_nack_mode); + A("XXXX # pucch res %d\n", h->number_of_pucch_resources); + A("XXXX n_pucch_1_0 %d\n", h->n_pucch_1_0); + A("XXXX n_pucch_1_1 %d\n", h->n_pucch_1_1); + A("XXXX n_pucch_1_2 %d\n", h->n_pucch_1_2); + A("XXXX n_pucch_1_3 %d\n", h->n_pucch_1_3); + break; + } + case NFAPI_UL_CONFIG_UCI_SR_PDU_TYPE: { + nfapi_ul_config_uci_sr_pdu *q = &p->uci_sr_pdu; + nfapi_ul_config_sr_information_rel8_t *h = + &q->sr_information.sr_information_rel8; + A("XXXX rnti %d\n", + q->ue_information.ue_information_rel8.rnti); + A("XXXX pucch_index %d\n", h->pucch_index); + }} + } + } + + LOG_I(PHY, "XXXX DL\nXXXX DL\n%s", s); +} + +#undef C +#undef A + +#endif /* DUMP_FAPI */ + +/****************************************************************************/ +/* debug utility functions end */ +/****************************************************************************/ + +void UL_indication(UL_IND_t *UL_info) +{ + + AssertFatal(UL_info!=NULL,"UL_INFO is null\n"); + +#ifdef DUMP_FAPI + dump_ul(UL_info); +#endif + + module_id_t module_id = UL_info->module_id; + int CC_id = UL_info->CC_id; + Sched_Rsp_t *sched_info = &Sched_INFO[module_id][CC_id]; + IF_Module_t *ifi = if_inst[module_id]; + eNB_MAC_INST *mac = RC.mac[module_id]; + + LOG_D(PHY,"SFN/SF:%d%d module_id:%d CC_id:%d UL_info[rx_ind:%d harqs:%d crcs:%d cqis:%d preambles:%d sr_ind:%d]\n", + UL_info->frame,UL_info->subframe, + module_id,CC_id, + UL_info->rx_ind.rx_indication_body.number_of_pdus, UL_info->harq_ind.harq_indication_body.number_of_harqs, UL_info->crc_ind.crc_indication_body.number_of_crcs, UL_info->cqi_ind.number_of_cqis, UL_info->rach_ind.rach_indication_body.number_of_preambles, UL_info->sr_ind.sr_indication_body.number_of_srs); + + if (nfapi_mode != 1) + { + if (ifi->CC_mask==0) { + ifi->current_frame = UL_info->frame; + ifi->current_subframe = UL_info->subframe; + } + else { + AssertFatal(UL_info->frame != ifi->current_frame,"CC_mask %x is not full and frame has changed\n",ifi->CC_mask); + AssertFatal(UL_info->subframe != ifi->current_subframe,"CC_mask %x is not full and subframe has changed\n",ifi->CC_mask); + } + ifi->CC_mask |= (1<frame,UL_info->subframe); + + handle_rach(UL_info); + + handle_sr(UL_info); + + handle_cqi(UL_info); + + handle_harq(UL_info); + + // clear HI prior to handling ULSCH + mac->HI_DCI0_req[CC_id].hi_dci0_request_body.number_of_hi = 0; + + handle_ulsch(UL_info); + + if (nfapi_mode != 1) + { + if (ifi->CC_mask == ((1<frame+((UL_info->subframe>(9-sf_ahead))?1:0)) % 1024, + (UL_info->subframe+sf_ahead)%10); + + ifi->CC_mask = 0; + + sched_info->module_id = module_id; + sched_info->CC_id = CC_id; + sched_info->frame = (UL_info->frame + ((UL_info->subframe>(9-sf_ahead)) ? 1 : 0)) % 1024; + sched_info->subframe = (UL_info->subframe+sf_ahead)%10; + sched_info->DL_req = &mac->DL_req[CC_id]; + sched_info->HI_DCI0_req = &mac->HI_DCI0_req[CC_id]; + if ((mac->common_channels[CC_id].tdd_Config==NULL) || + (is_UL_sf(&mac->common_channels[CC_id],(sched_info->subframe+sf_ahead)%10)>0)) + sched_info->UL_req = &mac->UL_req[CC_id]; + else + sched_info->UL_req = NULL; + + sched_info->TX_req = &mac->TX_req[CC_id]; + +#ifdef DUMP_FAPI + dump_dl(sched_info); +#endif + + if (ifi->schedule_response) + { + AssertFatal(ifi->schedule_response!=NULL, + "schedule_response is null (mod %d, cc %d)\n", + module_id, + CC_id); + ifi->schedule_response(sched_info); + } + + LOG_D(PHY,"Schedule_response: SFN_SF:%d%d dl_pdus:%d\n",sched_info->frame,sched_info->subframe,sched_info->DL_req->dl_config_request_body.number_pdu); + } + } +} + +IF_Module_t *IF_Module_init(int Mod_id){ + + AssertFatal(Mod_id %d\n",Mod_id,MAX_IF_MODULES); + + LOG_D(PHY,"Installing callbacks for IF_Module - UL_indication\n"); + + if (if_inst[Mod_id]==NULL) { + if_inst[Mod_id] = (IF_Module_t*)malloc(sizeof(IF_Module_t)); + memset((void*)if_inst[Mod_id],0,sizeof(IF_Module_t)); + + if_inst[Mod_id]->CC_mask=0; + if_inst[Mod_id]->UL_indication = UL_indication; + + AssertFatal(pthread_mutex_init(&if_inst[Mod_id]->if_mutex,NULL)==0, + "allocation of if_inst[%d]->if_mutex fails\n",Mod_id); + } + return if_inst[Mod_id]; +} + +void IF_Module_kill(int Mod_id) { + + AssertFatal(Mod_id>MAX_MODULES,"Asking for Module %d > %d\n",Mod_id,MAX_IF_MODULES); + if (if_inst[Mod_id]!=NULL) free(if_inst[Mod_id]); + +} diff --git a/openair2/NR_UE_PHY_INTERFACE/IF_Module.h b/openair2/NR_UE_PHY_INTERFACE/IF_Module.h new file mode 100644 index 0000000000..3b1c88dda0 --- /dev/null +++ b/openair2/NR_UE_PHY_INTERFACE/IF_Module.h @@ -0,0 +1,142 @@ +/* + * 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 + */ + +/*! \file openair2/PHY_INTERFACE/IF_Module.h +* \brief data structures for PHY/MAC interface modules +* \author EURECOM/NTUST +* \date 2017 +* \version 0.1 +* \company Eurecom +* \email: raymond.knopp@eurecom.fr +* \note +* \warning +*/ +#ifndef __IF_MODULE__H__ +#define __IF_MODULE__H__ + + +#include +#include "openair1/PHY/LTE_TRANSPORT/defs.h" +#include "nfapi_interface.h" + + +#define MAX_NUM_DL_PDU 100 +#define MAX_NUM_UL_PDU 100 +#define MAX_NUM_HI_DCI0_PDU 100 +#define MAX_NUM_TX_REQUEST_PDU 100 + +#define MAX_NUM_HARQ_IND 100 +#define MAX_NUM_CRC_IND 100 +#define MAX_NUM_SR_IND 100 +#define MAX_NUM_CQI_IND 100 +#define MAX_NUM_RACH_IND 100 +#define MAX_NUM_SRS_IND 100 + +typedef struct{ + /// Module ID + module_id_t module_id; + /// CC ID + int CC_id; + /// frame + frame_t frame; + /// subframe + sub_frame_t subframe; + + /// harq indication list + nfapi_harq_indication_t harq_ind; + + /// crc indication list + nfapi_crc_indication_t crc_ind; + + /// SR indication list + nfapi_sr_indication_t sr_ind; + + /// CQI indication list + nfapi_cqi_indication_body_t cqi_ind; + + /// RACH indication list + nfapi_rach_indication_t rach_ind; + +#ifdef Rel14 + /// RACH indication list for BR UEs + nfapi_rach_indication_t rach_ind_br; +#endif + + /// SRS indication list + nfapi_srs_indication_body_t srs_ind; + + /// RX indication + nfapi_rx_indication_t rx_ind; + +} UL_IND_t; + +// Downlink subframe P7 + + +typedef struct{ + /// Module ID + module_id_t module_id; + /// CC ID + uint8_t CC_id; + /// frame + frame_t frame; + /// subframe + sub_frame_t subframe; + /// nFAPI DL Config Request + nfapi_dl_config_request_t *DL_req; + /// nFAPI UL Config Request + nfapi_ul_config_request_t *UL_req; + /// nFAPI HI_DCI Request + nfapi_hi_dci0_request_t *HI_DCI0_req; + /// Pointers to DL SDUs + nfapi_tx_request_t *TX_req; +}Sched_Rsp_t; + +typedef struct { + uint8_t Mod_id; + int CC_id; + nfapi_config_request_t *cfg; +}PHY_Config_t; + +typedef struct IF_Module_s{ +//define the function pointer + void (*UL_indication)(UL_IND_t *UL_INFO); + void (*schedule_response)(Sched_Rsp_t *Sched_INFO); + void (*PHY_config_req)(PHY_Config_t* config_INFO); + uint32_t CC_mask; + uint16_t current_frame; + uint8_t current_subframe; + pthread_mutex_t if_mutex; +}IF_Module_t; + +/*Initial */ +IF_Module_t *IF_Module_init(int Mod_id); +void IF_Module_kill(int Mod_id); + +/*Interface for uplink, transmitting the Preamble(list), ULSCH SDU, NAK, Tick (trigger scheduler) + */ +void UL_indication(UL_IND_t *UL_INFO); + +/*Interface for Downlink, transmitting the DLSCH SDU, DCI SDU*/ +void Schedule_Response(Sched_Rsp_t *Sched_INFO); + +#endif + diff --git a/openair2/NR_UE_PHY_INTERFACE/defs.h b/openair2/NR_UE_PHY_INTERFACE/defs.h new file mode 100644 index 0000000000..deb07443f1 --- /dev/null +++ b/openair2/NR_UE_PHY_INTERFACE/defs.h @@ -0,0 +1,373 @@ +/* + * 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 + */ + +/*! \file PHY_INTERFACE/defs.h +* \brief mac phy interface primitives +* \author Raymond Knopp and Navid Nikaein +* \date 2011 +* \version 0.5 +* \mail navid.nikaein@eurecom.fr or openair_tech@eurecom.fr +*/ + +#ifndef __MAC_PHY_PRIMITIVES_H__ +# define __MAC_PHY_PRIMITIVES_H__ + +#include "LAYER2/MAC/defs.h" + + +#define MAX_NUMBER_OF_MAC_INSTANCES 16 + +#define NULL_PDU 255 +#define DCI 0 +#define DLSCH 1 +#define ULSCH 2 + +#define mac_exit_wrapper(sTRING) \ +do { \ + char temp[300]; \ + snprintf(temp, sizeof(temp), "%s in file "__FILE__" at line %d\n", sTRING, __LINE__); \ + mac_xface->macphy_exit(temp); \ +} while(0) + +/** @defgroup _phy_if MAC-PHY interface + * @ingroup _oai2 + * @{ + */ +/*! \brief MACPHY Interface */ +/* +typedef struct { + /// Pointer function that initializes L2 + int (*macphy_init)(int eMBMS_active, char *uecap_xer, uint8_t CBA_active,uint8_t HO_active); + + /// Pointer function that stops the low-level scheduler due an exit condition + void (*macphy_exit)(const char *); + + // eNB functions + /// Invoke dlsch/ulsch scheduling procedure for new subframe + void (*eNB_dlsch_ulsch_scheduler)(module_id_t Mod_id,uint8_t cooperation_flag, frame_t frameP, sub_frame_t subframeP);//, int calibration_flag); + + /// Fill random access response sdu, passing timing advance + uint16_t (*fill_rar)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t *dlsch_buffer,uint16_t N_RB_UL, uint8_t input_buffer_length); + + /// Initiate the RA procedure upon reception (hypothetical) of a valid preamble + void (*initiate_ra_proc)(module_id_t Mod_id,int CC_id,frame_t frameP,uint16_t preamble,int16_t timing_offset,uint8_t sect_id,sub_frame_t subframe,uint8_t f_id); + + /// cancel an ongoing RA procedure + void (*cancel_ra_proc)(module_id_t Mod_id,int CC_id,frame_t frameP,uint16_t preamble); + + /// Inform MAC layer that an uplink is scheduled for Msg3 in given subframe. + /// This is used so that the MAC scheduler marks as busy the RBs used by the Msg3. + void (*set_msg3_subframe)(module_id_t Mod_id, + int CC_id, + int frame, + int subframe, + int rnti, + int Msg3_frame, + int Msg3_subframe); + + /// Get DCI for current subframe from MAC + DCI_PDU* (*get_dci_sdu)(module_id_t Mod_id,int CC_id,frame_t frameP,sub_frame_t subframe); + + /// Get DLSCH sdu for particular RNTI and Transport block index + uint8_t* (*get_dlsch_sdu)(module_id_t Mod_id,int CC_id,frame_t frameP,rnti_t rnti,uint8_t TB_index); + + /// Send ULSCH sdu to MAC for given rnti + void (*rx_sdu)(module_id_t Mod_id,int CC_id,frame_t frameP, sub_frame_t sub_frameP,rnti_t rnti, uint8_t *sdu,uint16_t sdu_len, int harq_pid,uint8_t *msg3_flag); + + /// Indicate failure to synch to external source + void (*mrbch_phy_sync_failure) (module_id_t Mod_id,frame_t frameP, uint8_t free_eNB_index); + + /// Indicate Scheduling Request from UE + void (*SR_indication)(module_id_t Mod_id,int CC_id,frame_t frameP,rnti_t rnti,sub_frame_t subframe); + /// Indicate UL Failure to eNodeB MAC + void (*UL_failure_indication)(module_id_t Mod_id,int CC_id,frame_t frameP,rnti_t rnti,sub_frame_t subframe); + + /// Configure Common PHY parameters from SIB1 + void (*phy_config_mib_eNB)(module_id_t Mod_id,int CC_id, + int eutra_band, + int N_RB_DL, + PHICH_Config_t *phich_Config, + int Nid_cell, + int Ncp, + int p_eNB, + uint32_t dl_CarrierFreq, + uint32_t ul_CarrierFreq); + + /// Configure Common PHY parameters from SIB1 + void (*phy_config_sib1_eNB)(module_id_t Mod_id,int CC_id, + TDD_Config_t *tdd_config, + uint8_t SIwindowsize, + uint16_t SIperiod); + + /// Configure Common PHY parameters from SIB2 + void (*phy_config_sib2_eNB)(module_id_t Mod_id, int CC_id, + RadioResourceConfigCommonSIB_t *radioResourceConfigCommon, + ARFCN_ValueEUTRA_t *ul_CArrierFreq, + long *ul_Bandwidth, + AdditionalSpectrumEmission_t *additionalSpectrumEmission, + struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList); + +#if defined(Rel10) || defined(Rel14) + /// Configure Common PHY parameters from SIB13 + void (*phy_config_sib13_eNB)(module_id_t Mod_id,int CC_id, int mbsfn_Area_idx, + long mbsfn_AreaId_r9); + + void (*phy_config_dedicated_scell_eNB)(uint8_t Mod_id, + uint16_t rnti, + SCellToAddMod_r10_t *sCellToAddMod_r10, + int CC_id); +#endif + + /// PHY-Config-Dedicated eNB + void (*phy_config_dedicated_eNB)(module_id_t Mod_id,int CC_id,rnti_t rnti, + struct PhysicalConfigDedicated *physicalConfigDedicated); + +#if defined(Rel10) || defined(Rel14) + /// Get MCH sdu and corresponding MCS for particular MBSFN subframe + MCH_PDU* (*get_mch_sdu)(module_id_t Mod_id, int CC_id, frame_t frameP,sub_frame_t subframe); +#endif + // configure the cba rnti at the physical layer + void (*phy_config_cba_rnti)(module_id_t Mod_id,int CC_id,eNB_flag_t eNB_flag, uint8_t index, uint16_t cba_rnti, uint8_t cba_group_id, uint8_t num_active_cba_groups); + /// get delta mcs for fast UL AMC + int16_t (*estimate_ue_tx_power)(uint32_t tbs, uint32_t nb_rb, uint8_t control_only, lte_prefix_type_t ncp, uint8_t use_srs); + + int (*mac_phy_remove_ue)(module_id_t Mod_idP,rnti_t rntiP); + /// UE functions + + /// reset the ue phy + void (*phy_reset_ue)(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index); + + /// Indicate loss of synchronization of PBCH for this eNB to MAC layer + void (*out_of_sync_ind)(module_id_t Mod_id,frame_t frameP,uint16_t eNB_index); + + /// Send a received SI sdu + void (*ue_decode_si)(module_id_t Mod_id,int CC_id,frame_t frameP, uint8_t CH_index, void *pdu, uint16_t len); + + /// Send a received Paging sdu + void (*ue_decode_p)(module_id_t Mod_id,int CC_id,frame_t frameP, uint8_t CH_index, void *pdu, uint16_t len); + + /// Send a received DLSCH sdu to MAC + void (*ue_send_sdu)(module_id_t Mod_id,uint8_t CC_id,frame_t frameP,sub_frame_t subframe,uint8_t *sdu,uint16_t sdu_len,uint8_t CH_index); + +#if defined(Rel10) || defined(Rel14) + /// Send a received MCH sdu to MAC + void (*ue_send_mch_sdu)(module_id_t Mod_id,uint8_t CC_id, frame_t frameP,uint8_t *sdu,uint16_t sdu_len,uint8_t eNB_index,uint8_t sync_area); + + /// Function to check if UE PHY needs to decode MCH for MAC + /// get the sync area id, and return MCS value if need to decode, otherwise -1 + int (*ue_query_mch)(module_id_t Mod_id, uint8_t CC_id,frame_t frameP,sub_frame_t subframe,uint8_t eNB_index,uint8_t *sync_area, uint8_t *mcch_active); +#endif + + /// Retrieve ULSCH sdu from MAC + void (*ue_get_sdu)(module_id_t Mod_id,int CC_id,frame_t frameP,sub_frame_t subframe, uint8_t CH_index,uint8_t *ulsch_buffer,uint16_t buflen,uint8_t *access_mode); + + /// Retrieve RRCConnectionReq from MAC + PRACH_RESOURCES_t* (*ue_get_rach)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t Msg3_flag,sub_frame_t subframe); + + /// Process Random-Access Response + uint16_t (*ue_process_rar)(module_id_t Mod_id,int CC_id,frame_t frameP, uint16_t ra_rnti, uint8_t *dlsch_buffer, uint16_t *t_crnti,uint8_t preamble_index, uint8_t* selected_rar_buffer); + + /// Get SR payload (0,1) from UE MAC + uint32_t (*ue_get_SR)(module_id_t Mod_id,int CC_id,frame_t frameP,uint8_t eNB_id,rnti_t rnti,sub_frame_t subframe); + + /// Indicate synchronization with valid PBCH + void (*dl_phy_sync_success) (module_id_t Mod_id,frame_t frameP, uint8_t CH_index,uint8_t first_sync); + + /// Only calls the PDCP for now + UE_L2_STATE_t (*ue_scheduler)(module_id_t Mod_id, frame_t rxFrameP,sub_frame_t rxSubframe, frame_t txFrameP,sub_frame_t txSubframe, lte_subframe_t direction, uint8_t eNB_id, int CC_id); + + /// PHY-Config-Dedicated UE + void (*phy_config_dedicated_ue)(module_id_t Mod_id,int CC_id,uint8_t CH_index, + struct PhysicalConfigDedicated *physicalConfigDedicated); + + /// PHY-Config-harq UE + void (*phy_config_harq_ue)(module_id_t Mod_id,int CC_id,uint8_t CH_index, + uint16_t max_harq_tx); + /// Configure Common PHY parameters from SIB1 + void (*phy_config_sib1_ue)(module_id_t Mod_id,int CC_id,uint8_t CH_index, + TDD_Config_t *tdd_config, + uint8_t SIwindowsize, + uint16_t SIperiod); + + /// Configure Common PHY parameters from SIB2 + void (*phy_config_sib2_ue)(module_id_t Mod_id,int CC_id,uint8_t CH_index, + RadioResourceConfigCommonSIB_t *radioResourceConfigCommon, + ARFCN_ValueEUTRA_t *ul_CArrierFreq, + long *ul_Bandwidth, + AdditionalSpectrumEmission_t *additionalSpectrumEmission, + struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList); + +#if defined(Rel10) || defined(Rel14) + /// Configure Common PHY parameters from SIB13 + void (*phy_config_sib13_ue)(uint8_t Mod_id,int CC_id, uint8_t eNB_index,int mbsfn_Area_idx, + long mbsfn_AreaId_r9); + + void (*phy_config_dedicated_scell_ue)(uint8_t Mod_id, + uint8_t eNB_index, + SCellToAddMod_r10_t *sCellToAddMod_r10, + int CC_id); +#endif + /// Configure Common PHY parameters from mobilityControlInfo + void (*phy_config_afterHO_ue)(module_id_t Mod_id,uint8_t CC_id,uint8_t CH_index, + MobilityControlInfo_t *mobilityControlInfo, + uint8_t ho_failed); + + /// Function to indicate failure of contention resolution or RA procedure + void (*ra_failed)(module_id_t Mod_id, uint8_t CC_id,uint8_t eNB_index); + + /// Function to indicate success of contention resolution or RA procedure + void (*ra_succeeded)(module_id_t Mod_id,uint8_t CC_id, uint8_t eNB_index); + + /// Function to indicate the transmission of msg1/rach to MAC + void (*Msg1_transmitted)(module_id_t Mod_id,uint8_t CC_id,frame_t frameP,uint8_t eNB_id); + + /// Function to indicate Msg3 transmission/retransmission which initiates/reset Contention Resolution Timer + void (*Msg3_transmitted)(module_id_t Mod_id,uint8_t CC_id,frame_t frameP,uint8_t eNB_id); + + /// Function to pass inter-cell measurement parameters to PHY (cell Ids) + void (*phy_config_meas_ue)(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,uint8_t n_adj_cells,uint32_t *adj_cell_id); + + // PHY Helper Functions + + /// RIV computation from PHY + uint16_t (*computeRIV)(uint16_t N_RB_DL,uint16_t RBstart,uint16_t Lcrbs); + + /// Downlink TBS table lookup from PHY + uint32_t (*get_TBS_DL)(uint8_t mcs, uint16_t nb_rb); + + /// Uplink TBS table lookup from PHY + uint32_t (*get_TBS_UL)(uint8_t mcs, uint16_t nb_rb); + + /// Function to retrieve the HARQ round index for a particular UL/DLSCH and harq_pid + int (*get_ue_active_harq_pid)(module_id_t Mod_id, uint8_t CC_id,rnti_t rnti, int frame, uint8_t subframe, uint8_t *harq_pid, uint8_t *round, uint8_t ul_flag); + + /// Function to retrieve number of CCE + uint16_t (*get_nCCE_max)(module_id_t Mod_id,uint8_t CC_id,int num_pdcch_symbols,int subframe); + + + int (*get_nCCE_offset)(int *CCE_table, + const unsigned char L, + const int nCCE, + const int common_dci, + const unsigned short rnti, + const unsigned char subframe); + + /// Function to retrieve number of PRB in an rb_alloc + uint32_t (*get_nb_rb)(uint8_t ra_header, uint32_t rb_alloc, int n_rb_dl); + + /// Function to convert VRB to PRB for distributed allocation + uint32_t (*get_prb)(int N_RB_DL,int odd_slot,int vrb,int Ngap); + + /// Function to retrieve transmission mode for UE + uint8_t (*get_transmission_mode)(module_id_t Mod_id,uint8_t CC_id,rnti_t rnti); + + /// Function to retrieve rb_alloc bitmap from dci rballoc field and VRB type + uint32_t (*get_rballoc)(vrb_t vrb_type, uint16_t rb_alloc_dci); + + /// Function for UE MAC to retrieve current PHY connectivity mode (PRACH,RA_RESPONSE,PUSCH) + UE_MODE_t (*get_ue_mode)(module_id_t Mod_id, uint8_t CC_id,uint8_t eNB_index); + + /// Function for UE MAC to retrieve measured Path Loss + int16_t (*get_PL)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index); + + /// Function for UE MAC to retrieve the rssi + uint32_t (*get_RSSI)(uint8_t Mod_id,uint8_t CC_id); + + /// Function for UE MAC to retrieve the total gain + uint32_t (*get_rx_total_gain_dB)(uint8_t Mod_id,uint8_t CC_id); + + /// Function for UE MAC to retrieve the number of adjustent cells + uint8_t (*get_n_adj_cells)(uint8_t Mod_id,uint8_t CC_id); + + /// Function for UE MAC to retrieve RSRP/RSRQ measurements + uint32_t (*get_RSRP)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index); + + /// Function for UE MAC to retrieve RSRP/RSRQ measurements + uint32_t (*get_RSRQ)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index); + + /// Function for UE MAC to set the layer3 filtered RSRP/RSRQ measurements + uint8_t (*set_RSRP_filtered)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp); + + /// Function for UE MAC to set the layer3 filtered RSRP/RSRQ measurements + uint8_t (*set_RSRQ_filtered)(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp); + + /// Function for UE/eNB MAC to retrieve number of PRACH in TDD + uint8_t (*get_num_prach_tdd)(LTE_DL_FRAME_PARMS *frame_parms); + + /// Function for UE/eNB MAC to retrieve f_id of particular PRACH resource in TDD + uint8_t (*get_fid_prach_tdd)(LTE_DL_FRAME_PARMS *frame_parms,uint8_t tdd_map_index); + + /// Function for eNB MAC to retrieve subframe direction + lte_subframe_t (*get_subframe_direction)(module_id_t Mod_id, uint8_t CC_id, uint8_t subframe); + + // MAC Helper functions + /// Function for UE/PHY to compute PUSCH transmit power in power-control procedure (Po_NOMINAL_PUSCH parameter) + int8_t (*get_Po_NOMINAL_PUSCH)(module_id_t Mod_id,uint8_t CC_id); + + /// Function for UE/PHY to compute PUSCH transmit power in power-control procedure (deltaP_rampup parameter) + int8_t (*get_deltaP_rampup)(module_id_t Mod_id,uint8_t CC_id); + + /// Function for UE/PHY to compute PHR + int8_t (*get_PHR)(module_id_t Mod_id, uint8_t CC_id,uint8_t eNB_index); + + /// Function for UE to process the timing advance command + void (*process_timing_advance)(module_id_t Mod_id,uint8_t CC_id, int16_t timing_advance); + + /// Function for MAC to get the UE stats from the PHY + LTE_eNB_UE_stats* (*get_eNB_UE_stats)(module_id_t Mod_id, uint8_t CC_id, rnti_t rnti); + + /// get the frame parameters from the PHY + LTE_DL_FRAME_PARMS* (*get_lte_frame_parms)(module_id_t Mod_id, uint8_t CC_id); + + /// get the Multiuser mimo mode + MU_MIMO_mode* (*get_mu_mimo_mode) (module_id_t Mod_id, uint8_t CC_id, rnti_t rnti); + + /// get the delta TF for Uplink Power Control Calculation + int16_t (*get_hundred_times_delta_TF) (module_id_t module_idP, uint8_t CC_id, rnti_t rnti, uint8_t harq_pid); + /// get target PUSCH received power + int16_t (*get_target_pusch_rx_power) (module_id_t module_idP, uint8_t CC_id); + /// get target PUSCH received power + int16_t (*get_target_pucch_rx_power) (module_id_t module_idP, uint8_t CC_id); + + unsigned char is_cluster_head; + unsigned char is_primary_cluster_head; + unsigned char is_secondary_cluster_head; + unsigned char cluster_head_index; + + /// PHY Frame Configuration + LTE_DL_FRAME_PARMS *frame_parms; + + uint8_t (*get_prach_prb_offset)(LTE_DL_FRAME_PARMS *frame_parms, uint8_t tdd_mapindex, uint16_t Nf); + + int (*is_prach_subframe)(LTE_DL_FRAME_PARMS *frame_parms,frame_t frame, uint8_t subframe); + + /// ICIC algos + uint8_t (*get_SB_size)(uint8_t n_rb_dl); + ///end ALU's algo + +} MAC_xface; + +*/ + +#endif + + +/** @} */ diff --git a/openair2/NR_UE_PHY_INTERFACE/extern.h b/openair2/NR_UE_PHY_INTERFACE/extern.h new file mode 100644 index 0000000000..b87fa42fe4 --- /dev/null +++ b/openair2/NR_UE_PHY_INTERFACE/extern.h @@ -0,0 +1,27 @@ +/* + * 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 + */ + +#ifndef __PHY_INTERFACE_EXTERN_H__ +#define __PHY_INTERFACE_EXTERN_H__ + + + +#endif diff --git a/openair2/NR_UE_PHY_INTERFACE/mac_phy_primitives.c b/openair2/NR_UE_PHY_INTERFACE/mac_phy_primitives.c new file mode 100644 index 0000000000..06e06d096d --- /dev/null +++ b/openair2/NR_UE_PHY_INTERFACE/mac_phy_primitives.c @@ -0,0 +1,283 @@ +/* + * 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 + */ + +/*________________________mac_phy_primitives.c________________________ + + Authors : Hicham Anouar, Raymond Knopp + Company : EURECOM + Emails : anouar@eurecom.fr, knopp@eurecom.fr +________________________________________________________________*/ + + +//#include "openair_extern.h" + +#ifdef MAC_CONTEXT +#include "LAYER2/MAC/defs.h" +#include "LAYER2/MAC/extern.h" +//#include "extern.h" +#include "defs.h" +#endif //MAC_CONTEXT + + +//#define DEBUG_UE_DECODE_SACH +//#define DEBUG_NODEB_DECODE_SACH + +#ifdef PHY_CONTEXT +#ifdef PHY_EMUL +#include "extern.h" +#include "SIMULATION/simulation_defs.h" +#else //PHY_EMUL +#include "MAC_INTERFACE/extern.h" +#endif //PHY_EMUL + +void clear_macphy_data_req(unsigned char Mod_id) +{ + //msg("CLEAR DATA_REQ\n"); + unsigned char i; + + Macphy_req_table[Mod_id].Macphy_req_cnt = 0; + + for (i=0; iTime_alloc==Phy2->Time_alloc && Phy1->Freq_alloc==Phy2->Freq_alloc)// && Phy1->Coding_fmt==Phy2->Coding_fmt && Phy1->Seq_index==Phy2->Seq_index) + return 1; + else + return 0; + +} +*/ + +MACPHY_DATA_REQ_TABLE_ENTRY* find_data_req_entry(unsigned char Mod_id,MACPHY_REQ_ENTRY_KEY *Search_key) +{ + + unsigned char i; + + //msg("[MAC_PHY]MAC_PHY_REQUEST_CNT=%d\n",Macphy_req_table.Macphy_req_cnt); + if (Macphy_req_table[Mod_id].Macphy_req_cnt > 0) { +#ifdef DEBUG_PHY + // msg("[MACPHY_FIND_REQ] SEARCH KEY=%d\n",Search_key->Key_type); +#endif //DEBUG_PHY + //msg("[MACPHY_FIND_REQ] SEARCH KEY=%d, NB_REQ_MAX=%d\n",Search_key->Key_type,NB_REQ_MAX); + + switch(Search_key->Key_type) { + case PDU_TYPE_KEY: + for(i=0; iKey.Pdu_type) && + (Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Active == 1) ) { + //msg("[MACPHY_FIND] MACPHY_req_table_entry=%p,idx=%d,Phy_resources %p", &Macphy_req_table.Macphy_req_table_entry[i],i,Macphy_req_table.Macphy_req_table_entry[i].Macphy_data_req.Phy_Resources_Entry); + return(&Macphy_req_table[Mod_id].Macphy_req_table_entry[i]); + } + } + + break; + /* + case LCHAN_KEY: + for(i=0;iKey.Lchan_id->Index) && + (Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Active == 1) ) + return(&Macphy_req_table[Mod_id].Macphy_req_table_entry[i]); + } + break; + + case PHY_RESOURCES_KEY: + for(i=0;iTime_alloc == + Search_key->Key.Phy_resources.Time_alloc ) + &&( Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Macphy_data_req.Phy_resources->Freq_alloc == + Search_key->Key.Phy_resources.Freq_alloc ) + &&( Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Macphy_data_req.CH_index == + Search_key->CH_index ) + && ( Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Macphy_data_req.Direction == RX)) + return(&Macphy_req_table[Mod_id].Macphy_req_table_entry[i]); + } + break; + */ + } + } + +#ifndef PHY_EMUL + // msg("[PHY][PHY_MAC] Frame %d : No data request\n",mac_xface->frame); +#endif //PHY_EMUL + + + return (MACPHY_DATA_REQ_TABLE_ENTRY*)0; + +} + + + + + + +void print_active_requests(unsigned char Mod_id) +{ + + int i; + msg("_________________________INST %d , FRAME %d ACTIVE_REQUESTS_________________\n",Mod_id,mac_xface->frame); + + for (i=0; iTime_alloc, + // Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Macphy_data_req.Phy_resources->Freq_alloc); + //if(Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Macphy_data_req.Pdu_type==RACH) + //msg("[RACH_REQ] Rach_pdu %p, Payload %p\n",Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Macphy_data_req.Dir.Req_rx.Pdu.Rach_pdu, + // Macphy_req_table[Mod_id].Macphy_req_table_entry[i].Macphy_data_req.Dir.Req_rx.Pdu.Rach_pdu->Rach_payload); + + } + } +} + + +/*___________________________________________________________________________________________________*/ +#define RCNT Macphy_req_table[Mod_id].Macphy_req_cnt + +MACPHY_DATA_REQ *new_macphy_data_req(unsigned char Mod_id) +{ + /*___________________________________________________________________________________________________*/ + unsigned char i; + + + + for (i=0; iframe,Mod_id,i); + // Macphy_req_table[Mod_id].Macphy_req_table_entry[i%NB_REQ_MAX].Macphy_data_req.Phy_resources=(PHY_RESOURCES*)malloc16(sizeof(PHY_RESOURCES)); + return(&Macphy_req_table[Mod_id].Macphy_req_table_entry[i%NB_REQ_MAX].Macphy_data_req); + } + } + + msg("[OPENAIR][MAC][ERROR] frame %d: No more DATA_REQ !!!!\n",mac_xface->frame); + + print_active_requests(Mod_id); + mac_xface->macphy_exit("new_macphy_data_req: no more DATA_REQ"); + //rt_sleep(nano2count(2000)); + + return((MACPHY_DATA_REQ*)0); +} + + +#endif //PHY_CONTEXT + +#ifdef MAC_CONTEXT +#include "LAYER2/MAC/extern.h" + +// Function called by PHY to indicate available data/measurements for MAC + +/*___________________________________________________________________________________________________*/ +void macphy_data_ind(unsigned char Mod_id,unsigned char Pdu_type,void *pdu,unsigned short rnti) +{ + /*___________________________________________________________________________________________________*/ + //msg("[OPENAIR][MACPHY] Calling mac_resp In\n"); + + int i; + + // if (Req_rx->crc_status[0]!= -1) { //CRC_STATUS + + // msg("[OPENAIR][MACPHY] Calling mac_indicate In\n"); + // Req_rx->Meas.UL_meas=&UL_meas[Mod_id]; + // Req_rx->Meas.DL_meas=&DL_meas[Mod_id]; + + switch (Pdu_type) { + case ULSCH: + + // msg("[OPENAIR][MACPHY] Received RACH, Sending to MAC\n"); + nodeb_decode_ulsch(Mod_id,(ULSCH_PDU *)pdu,rnti); + + break; + + case DLSCH: +#ifdef DEBUG_UE_DECODE_SACH + msg("[MAC][UE][MAC_PHY] TTI %d Inst %d\n",mac_xface->frame,Mod_id); +#endif + + // ue_decode_dlsch(Mod_id-NB_CH_INST, + // (DLSCH_PDU *)pdu,rnti); + + break; + + default: + break; + } + + // msg("Freeing Req %p\n",Macphy_data_req_table_entry); + // } + +} + + + + + +/*PHY_RESOURCES_TABLE_ENTRY *new_phy_resources() { + + + unsigned char i; + + //msg("[OPENAIR][PHY][MAC Interface] New Phy Resource, cnt %d\n",Phy_resources_table.Phy_resources_cnt); + + for (i=0;i Date: Mon, 28 May 2018 04:52:39 -0700 Subject: [PATCH 12/13] Modified and fixed common config --- cmake_targets/CMakeLists.txt | 58 +++++--- cmake_targets/build_oai | 2 +- cmake_targets/tools/build_helper | 15 +- cmake_targets/tools/fix_asn1 | 13 +- cmake_targets/tools/generate_asn1 | 7 +- openair2/COMMON/rrc_messages_types.h | 12 +- openair2/ENB_APP/gnb_config.c | 130 +++++++++++++++++- openair2/ENB_APP/gnb_paramdef.h | 27 +++- openair2/RRC/NR/MESSAGES/asn1_msg.c | 6 +- .../ASN1_files/NR-InterNodeDefinitions.asn | 0 .../asn1c/ASN1_files/NR-RRC-Definitions.asn | 96 ++++++------- .../asn1c/ASN1_files/NR-UE-Variables.asn | 0 openair2/RRC/NR/defs_NR.h | 77 +++++------ openair2/RRC/NR/rrc_gNB.c | 18 +-- targets/COMMON/openairinterface5g_limits.h | 42 ++++++ .../CONF/enb.band7.tm1.50PRB.usrpb210.conf | 8 ++ 16 files changed, 368 insertions(+), 143 deletions(-) mode change 100755 => 100644 openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-InterNodeDefinitions.asn mode change 100755 => 100644 openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-RRC-Definitions.asn mode change 100755 => 100644 openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-UE-Variables.asn diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt index d109a58876..cc844cd345 100644 --- a/cmake_targets/CMakeLists.txt +++ b/cmake_targets/CMakeLists.txt @@ -272,15 +272,16 @@ endif (${ENABLE_ITTI}) # New C code source file, cmake must be re-run (instead of re-running make only) ############# set(asn1c_call "${OPENAIR_CMAKE}/tools/generate_asn1") +set(asn1c_call_NR "${OPENAIR_CMAKE}/tools/generate_asn1_NR") set(fix_asn1c_call "${OPENAIR_CMAKE}/tools/fix_asn1") set(asn1_generated_dir ${OPENAIR_BIN_DIR}) - set(protoc_call "${OPENAIR_CMAKE}/tools/generate_protobuf") set(protobuf_generated_dir ${OPENAIR_BIN_DIR}) # RRC ###### -add_list2_option(RRC_ASN1_VERSION "Rel10" "ASN.1 version of RRC interface" "Rel8" "Rel10" "CBA") + +add_list2_option(RRC_ASN1_VERSION "Rel14" "ASN.1 version of RRC interface" "Rel8" "Rel10" "Rel14" "CBA") if (${RRC_ASN1_VERSION} STREQUAL "Rel8") set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-86.asn) @@ -330,32 +331,45 @@ add_custom_command ( #NR RRC -add_list2_option(NR_RRC_ASN1_VERSION "Rel15" "ASN.1 version of NR_RRC interface") +add_list2_option(NR_RRC_ASN1_VERSION "NR_Rel15" "ASN.1 version of NR_RRC interface") -if (${NR_RRC_ASN1_VERSION} STREQUAL "Rel15") - set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-RRC-Definitions.asn) -endif (${NR_RRC_ASN1_VERSION} STREQUAL "Rel15") +if (${NR_RRC_ASN1_VERSION} STREQUAL "NR_Rel15") + set (NR_RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-RRC-Definitions.asn) +endif (${NR_RRC_ASN1_VERSION} STREQUAL "NR_Rel15") set (NR_RRC_FULL_DIR ${asn1_generated_dir}/${NR_RRC_ASN1_VERSION}) -if(NOT EXISTS ${asn1c_call}) - message( FATAL_ERROR "The script ${asn1c_call} must be present" ) -endif(NOT EXISTS ${asn1c_call}) +if(NOT EXISTS ${asn1c_call_NR}) +message( FATAL_ERROR "The script ${asn1c_call_NR} must be present" ) +endif(NOT EXISTS ${asn1c_call_NR}) -execute_process(COMMAND ${asn1c_call} +#message("calling ASN1C_PREFIX=NR_ asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${RRC_FULL_DIR} ${RRC_GRAMMAR}") +#set (asn1_install_log ${OPENAIR_CMAKE}/log/NR_asn1c_install_log.txt) +#execute_process(COMMAND mkdir -p ${NR_RRC_FULL_DIR} +# COMMAND env "ASN1C_PREFIX=NR_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${NR_RRC_FULL_DIR} ${NR_RRC_GRAMMAR} +# RESULT_VARIABLE ret +# ) + + +execute_process(COMMAND ${asn1c_call_NR} ${NR_RRC_FULL_DIR} - ${RRC_GRAMMAR} + ${NR_RRC_GRAMMAR} + ${NR_RRC_ASN1_VERSION} RESULT_VARIABLE ret) if (NOT ${ret} STREQUAL 0) - message(FATAL_ERROR "${asn1c_call}: error") + message(FATAL_ERROR "${asn1c_call_NR}: error") endif (NOT ${ret} STREQUAL 0) if(NOT EXISTS ${fix_asn1c_call}) message( FATAL_ERROR "The script ${fix_asn1c_call} must be present" ) endif(NOT EXISTS ${fix_asn1c_call}) -execute_process(COMMAND ${fix_asn1c_call} ${NR_RRC_FULL_DIR} NR_RRC ${NR_RRC_ASN1_VERSION} - RESULT_VARIABLE ret) +execute_process(COMMAND ${fix_asn1c_call} + ${NR_RRC_FULL_DIR} + NR_RRC + ${NR_RRC_ASN1_VERSION} + RESULT_VARIABLE ret) + if (NOT ${ret} STREQUAL 0) message(FATAL_ERROR "${fix_asn1c_call}: error") endif (NOT ${ret} STREQUAL 0) @@ -364,18 +378,25 @@ file(GLOB nr_rrc_source ${NR_RRC_FULL_DIR}/*.c) file(GLOB nr_rrc_h ${NR_RRC_FULL_DIR}/*.h) set(nr_rrc_h ${nr_rrc_h} ${NR_RRC_FULL_DIR}/asn1_constants.h) set_source_files_properties(${nr_rrc_source} PROPERTIES COMPILE_FLAGS -w) # suppress warnings from generated code -#add_library(NR_RRC_LIB ${nr_rrc_h} ${nr_rrc_source} -# ${OPENAIR2_DIR}/RRC/NR/MESSAGES/asn1_msg.c) -#include_directories ("${NR_RRC_FULL_DIR}") +add_library(NR_RRC_LIB ${nr_rrc_h} ${nr_rrc_source} + ${OPENAIR2_DIR}/RRC/NR/MESSAGES/asn1_msg.c) +include_directories ("${NR_RRC_FULL_DIR}") # add the command to generate the source code # Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make + add_custom_command ( OUTPUT ${NR_RRC_FULL_DIR}/asn1_constants.h - COMMAND ${asn1c_call} ${NR_RRC_FULL_DIR} ${RRC_GRAMMAR} + COMMAND ${asn1c_call_NR} ${NR_RRC_FULL_DIR} ${NR_RRC_GRAMMAR} COMMAND ${fix_asn1c_call} ${NR_RRC_FULL_DIR} RRC ${NR_RRC_ASN1_VERSION} DEPENDS ${RRC_GRAMMAR} ) +#add_custom_command ( +# OUTPUT ${NR_RRC_FULL_DIR}/asn1_constants.h +# COMMAND mkdir -p ${NR_RRC_FULL_DIR} +# COMMAND env "ASN1C_PREFIX=NR_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${NR_RRC_FULL_DIR} ${NR_RRC_GRAMMAR} 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample +# DEPENDS ${NR_RRC_GRAMMAR} +# ) # S1AP @@ -419,7 +440,6 @@ if (NOT ${ret} STREQUAL 0) message(FATAL_ERROR "${fix_asn1c_call}: error") endif (NOT ${ret} STREQUAL 0) file(GLOB S1AP_source ${S1AP_C_DIR}/*.c) - set(S1AP_OAI_generated ${S1AP_C_DIR}/s1ap_decoder.c ${S1AP_C_DIR}/s1ap_encoder.c diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index 5af5499074..f565ebb985 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -48,7 +48,7 @@ DEADLINE_SCHEDULER_FLAG_USER="False" FORCE_DEADLINE_SCHEDULER_FLAG_USER="" CPU_AFFINITY_FLAG_USER="False" #Only valid when lowlatecy flag is set to False REL="Rel14" -NR_REL="Rel15" +NR_REL="NR_Rel15" HW="None" TP="None" NOS1=0 diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper index 4d95292f08..3d5a5a6177 100755 --- a/cmake_targets/tools/build_helper +++ b/cmake_targets/tools/build_helper @@ -307,7 +307,7 @@ check_install_usrp_uhd_driver(){ $SUDO apt-get -y --allow-unauthenticated install libuhd-dev libuhd003 uhd-host elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then $SUDO $INSTALLER -y install python boost libusb-devel libusbx-devel boost-devel python-mako python-docutils cmake - $SUDO pip install requests + $SUDO -H pip install requests if [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then # until EPEL repo hasn't bumped UHD driver to >=3.10 in EPEL, build driver from source $SUDO $INSTALLER -y remove uhd uhd-devel uhd-firmware @@ -490,8 +490,8 @@ check_install_additional_tools (){ #The packages below are already installed for Redhat distros (RHEL, CentOS, Fedora) if [[ "$OS_DISTRO" == "ubuntu" ]]; then - $SUDO pip install paramiko - $SUDO pip install pyroute2 colorama + $SUDO -H pip install paramiko + $SUDO -H pip install pyroute2 colorama log_netiface=$OPENAIR_DIR/cmake_targets/log/netiface_install_log.txt echo_info "Installing Netinterfaces package. The logfile for installation is in $log_netiface" ( @@ -689,11 +689,14 @@ install_asn1c_from_source(){ echo_info "\nInstalling ASN1. The log file for ASN1 installation is here: $asn1_install_log " ( $SUDO rm -rf /tmp/asn1c - GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/asn1c.git /tmp/asn1c + #GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/asn1c.git /tmp/asn1c + GIT_SSL_NO_VERIFY=true git clone https://github.com/velichkov/asn1c /tmp/asn1c cd /tmp/asn1c - ./configure + git checkout s1ap + test -f configure || autoreconf -iv + ./configure make -j`nproc` - $SUDO make install + $SUDO make install cd - $SUDO ldconfig ) > $asn1_install_log 2>&1 diff --git a/cmake_targets/tools/fix_asn1 b/cmake_targets/tools/fix_asn1 index 14e4d3262c..398db20ff8 100755 --- a/cmake_targets/tools/fix_asn1 +++ b/cmake_targets/tools/fix_asn1 @@ -23,7 +23,6 @@ reset_color="$(tput sgr0)" function error() { echo -e "$red_color"ERROR: "$@""$reset_color" - exit 1 } function check_sha1() @@ -94,7 +93,7 @@ function patch_rrc() case "$version" in Rel14 ) echo "patching RRC files release 14" - apply_patches "$directory" RRC_Rel14 ${#RRC_Rel14[*]} + apply_patches "$directory" RRC_Rel14 ${#RRC_Rel14[*]} ;; Rel10 ) echo "patching RRC files release 10" @@ -115,7 +114,7 @@ function patch_nr_rrc() local version="$2" case "$version" in - Rel15 ) + NR_Rel15 ) echo "patching NR_RRC files release 15" apply_patches "$directory" NR_RRC_Rel15 ${#NR_RRC_Rel15[*]} ;; @@ -175,16 +174,16 @@ function main() case "$module" in RRC ) - patch_rrc "$directory" "$version" + #patch_rrc "$directory" "$version" ;; NR_RRC ) - patch_nr_rrc "$directory" "$version" + #patch_nr_rrc "$directory" "$version" ;; X2AP ) - patch_x2ap "$directory" "$version" + #patch_x2ap "$directory" "$version" ;; S1AP ) - patch_s1ap "$directory" "$version" + #patch_s1ap "$directory" "$version" ;; * ) error unknown module "$module" diff --git a/cmake_targets/tools/generate_asn1 b/cmake_targets/tools/generate_asn1 index 79becbf288..a509ecf22f 100755 --- a/cmake_targets/tools/generate_asn1 +++ b/cmake_targets/tools/generate_asn1 @@ -5,7 +5,6 @@ function main() mkdir -p $1 cd $1 shift - #if this script is called with only 2 arguments (so 1 here after the shift), it's for RRC #(there may be a better way...) if [ $# -eq 1 ]; then @@ -98,8 +97,8 @@ rm -f asnfix asnfix.c echo done with asnfix echo running asn1c - -asn1c -gen-PER -fcompound-names fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample + +asn1c -gen-PER -fcompound-names -no-gen-example fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample rm -f fixed_grammar.asn @@ -107,7 +106,7 @@ echo asn1c done else -asn1c -gen-PER -fcompound-names $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample +asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample fi diff --git a/openair2/COMMON/rrc_messages_types.h b/openair2/COMMON/rrc_messages_types.h index 6d650b7261..93f1e4ea80 100644 --- a/openair2/COMMON/rrc_messages_types.h +++ b/openair2/COMMON/rrc_messages_types.h @@ -265,6 +265,7 @@ typedef struct NRRrcConfigurationReq_s { ///NR //MIB long MIB_subCarrierSpacingCommon[MAX_NUM_CCs]; + uint32_t MIB_ssb_SubcarrierOffset[MAX_NUM_CCs]; long MIB_dmrs_TypeA_Position[MAX_NUM_CCs]; uint32_t pdcch_ConfigSIB1[MAX_NUM_CCs]; @@ -292,7 +293,7 @@ typedef struct NRRrcConfigurationReq_s { //NR FrequencyInfoUL long UL_FreqBandIndicatorNR[MAX_NUM_CCs]; long UL_absoluteFrequencyPointA[MAX_NUM_CCs]; - lte_prefix_type_t UL_additionalSpectrumEmission[MAX_NUM_CCs] + lte_prefix_type_t UL_additionalSpectrumEmission[MAX_NUM_CCs]; long UL_p_Max[MAX_NUM_CCs]; long ULfrequencyShift7p5khz[MAX_NUM_CCs]; @@ -430,7 +431,14 @@ typedef struct NRRrcConfigurationReq_s { long Common_dci_Format2_3_nrofPDCCH_Candidates[MAX_NUM_CCs]; long ue_Specific__dci_Formats[MAX_NUM_CCs]; - + //RateMatchPatternLTE-CRS + uint32_t RateMatchPatternLTE_CRS_carrierFreqDL[MAX_NUM_CCs]; + long RateMatchPatternLTE_CRS_carrierBandwidthDL[MAX_NUM_CCs]; + long RateMatchPatternLTE_CRS_nrofCRS_Ports[MAX_NUM_CCs]; + long RateMatchPatternLTE_CRS_v_Shift[MAX_NUM_CCs]; + long RateMatchPatternLTE_CRS_radioframeAllocationPeriod[MAX_NUM_CCs]; + uint32_t RateMatchPatternLTE_CRS_radioframeAllocationOffset[MAX_NUM_CCs]; + long RateMatchPatternLTE_CRS_subframeAllocation_choice[MAX_NUM_CCs]; } gNB_RrcConfigurationReq; diff --git a/openair2/ENB_APP/gnb_config.c b/openair2/ENB_APP/gnb_config.c index a0000f79bd..a52809b62c 100644 --- a/openair2/ENB_APP/gnb_config.c +++ b/openair2/ENB_APP/gnb_config.c @@ -52,6 +52,7 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { ///NR //MIB int32_t MIB_subCarrierSpacingCommon = 0; + uint32_t MIB_ssb_SubcarrierOffset = 0; int32_t MIB_dmrs_TypeA_Position = 0; uint32_t pdcch_ConfigSIB1 = 0; @@ -213,7 +214,14 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { int32_t Common_dci_Format2_3_monitoringPeriodicity = 0; int32_t Common_dci_Format2_3_nrofPDCCH_Candidates = 0; int32_t ue_Specific__dci_Formats = 0; - + //NR RateMatchPatternLTE-CRS + uint32_t RateMatchPatternLTE_CRS_carrierFreqDL = 0; + int32_t RateMatchPatternLTE_CRS_carrierBandwidthDL = 0; + int32_t RateMatchPatternLTE_CRS_nrofCRS_Ports = 0; + int32_t RateMatchPatternLTE_CRS_v_Shift = 0; + int32_t RateMatchPatternLTE_CRS_radioframeAllocationPeriod = 0; + uint32_t RateMatchPatternLTE_CRS_radioframeAllocationOffset = 0; + int32_t RateMatchPatternLTE_CRS_subframeAllocation_choice = 0; int32_t my_int; @@ -419,6 +427,12 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { RC.config_file_name, i, MIB_subCarrierSpacingCommon); } + NRRRC_CONFIGURATION_REQ (msg_p).MIB_ssb_SubcarrierOffset[j] = MIB_ssb_SubcarrierOffset; + if ((MIB_ssb_SubcarrierOffset <0) || (MIB_ssb_SubcarrierOffset > 15)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for MIB_ssb_SubcarrierOffset choice: 1..23 !\n", + RC.config_file_name, i, MIB_ssb_SubcarrierOffset); + } + NRRRC_CONFIGURATION_REQ (msg_p).MIB_dmrs_TypeA_Position[j] = MIB_dmrs_TypeA_Position; if ((MIB_dmrs_TypeA_Position !=2) && (MIB_dmrs_TypeA_Position !=3)){ AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for MIB_dmrs_TypeA_Position choice:2,3 !\n", @@ -2050,6 +2064,120 @@ int RCconfig_NRRRC(MessageDef *msg_p, uint32_t i, gNB_RRC_INST *rrc) { RC.config_file_name, i, ue_Specific__dci_Formats); } + //////////////////////////////////NR RateMatchPatternLTE-CRS/////////////////////////// + + switch(RateMatchPatternLTE_CRS_carrierBandwidthDL){ + case 6: + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_carrierBandwidthDL[j] = RateMatchPatternLTE_CRS__carrierBandwidthDL_n6; + break; + case 15: + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_carrierBandwidthDL[j] = RateMatchPatternLTE_CRS__carrierBandwidthDL_n15; + break; + case 25: + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_carrierBandwidthDL[j] = RateMatchPatternLTE_CRS__carrierBandwidthDL_n25; + break; + case 50: + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_carrierBandwidthDL[j] = RateMatchPatternLTE_CRS__carrierBandwidthDL_n50; + break; + case 75: + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_carrierBandwidthDL[j] = RateMatchPatternLTE_CRS__carrierBandwidthDL_n75; + break; + case 100: + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_carrierBandwidthDL[j] = RateMatchPatternLTE_CRS__carrierBandwidthDL_n100; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for RateMatchPatternLTE_CRS_carrierBandwidthDL choice: 6,15,25,50,75,100 !\n", + RC.config_file_name, i, RateMatchPatternLTE_CRS_carrierBandwidthDL); + break; + } + + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_carrierBandwidthDL[j] = RateMatchPatternLTE_CRS_carrierBandwidthDL; + if ((RateMatchPatternLTE_CRS_carrierBandwidthDL <0) || (RateMatchPatternLTE_CRS_carrierBandwidthDL>16383)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for RateMatchPatternLTE_CRS_carrierBandwidthDL choice: 0..16383 !\n", + RC.config_file_name, i, RateMatchPatternLTE_CRS_carrierBandwidthDL); + } + + switch(RateMatchPatternLTE_CRS_nrofCRS_Ports){ + case 1: + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_nrofCRS_Ports[j] = RateMatchPatternLTE_CRS__nrofCRS_Ports_n1; + break; + case 2: + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_nrofCRS_Ports[j] = RateMatchPatternLTE_CRS__nrofCRS_Ports_n2; + break; + case 4: + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_nrofCRS_Ports[j] = RateMatchPatternLTE_CRS__nrofCRS_Ports_n4; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for RateMatchPatternLTE_CRS_nrofCRS_Ports choice: 1,2,4 !\n", + RC.config_file_name, i, RateMatchPatternLTE_CRS_nrofCRS_Ports); + break; + } + + switch(RateMatchPatternLTE_CRS_v_Shift){ + case 0: + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_v_Shift[j] = RateMatchPatternLTE_CRS__v_Shift_n0; + break; + case 1: + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_v_Shift[j] = RateMatchPatternLTE_CRS__v_Shift_n1; + break; + case 2: + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_v_Shift[j] = RateMatchPatternLTE_CRS__v_Shift_n2; + break; + case 3: + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_v_Shift[j] = RateMatchPatternLTE_CRS__v_Shift_n3; + break; + case 4: + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_v_Shift[j] = RateMatchPatternLTE_CRS__v_Shift_n4; + break; + case 5: + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_v_Shift[j] = RateMatchPatternLTE_CRS__v_Shift_n5; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for RateMatchPatternLTE_CRS_v_Shift choice: 0,1,2,3,4,5 !\n", + RC.config_file_name, i, RateMatchPatternLTE_CRS_v_Shift); + break; + } + + switch(RateMatchPatternLTE_CRS_radioframeAllocationPeriod){ + case 1: + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_radioframeAllocationPeriod[j] = EUTRA_MBSFN_SubframeConfig__radioframeAllocationPeriod_n1; + break; + case 2: + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_radioframeAllocationPeriod[j] = EUTRA_MBSFN_SubframeConfig__radioframeAllocationPeriod_n2; + break; + case 4: + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_radioframeAllocationPeriod[j] = EUTRA_MBSFN_SubframeConfig__radioframeAllocationPeriod_n4; + break; + case 8: + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_radioframeAllocationPeriod[j] = EUTRA_MBSFN_SubframeConfig__radioframeAllocationPeriod_n8; + break; + case 16: + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_radioframeAllocationPeriod[j] = EUTRA_MBSFN_SubframeConfig__radioframeAllocationPeriod_n16; + break; + case 32: + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_radioframeAllocationPeriod[j] = EUTRA_MBSFN_SubframeConfig__radioframeAllocationPeriod_n32; + break; + default: + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for RateMatchPatternLTE_CRS_radioframeAllocationPeriod choice: 1,2,4,8,16,32 !\n", + RC.config_file_name, i, RateMatchPatternLTE_CRS_radioframeAllocationPeriod); + break; + } + + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_radioframeAllocationOffset[j] = RateMatchPatternLTE_CRS_radioframeAllocationOffset; + if ((RateMatchPatternLTE_CRS_radioframeAllocationOffset <0) || (RateMatchPatternLTE_CRS_radioframeAllocationOffset>7)){ + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for RateMatchPatternLTE_CRS_radioframeAllocationOffset choice: 0..7 !\n", + RC.config_file_name, i, RateMatchPatternLTE_CRS_radioframeAllocationOffset); + } + + if (strcmp(RateMatchPatternLTE_CRS_subframeAllocation_choice , "oneFrame") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_subframeAllocation_choice[j] = EUTRA_MBSFN_SubframeConfig__subframeAllocation_PR_oneFrame; + }else if (strcmp(RateMatchPatternLTE_CRS_subframeAllocation_choice , "fourFrames") == 0){ + NRRRC_CONFIGURATION_REQ (msg_p).RateMatchPatternLTE_CRS_subframeAllocation_choice[j] = EUTRA_MBSFN_SubframeConfig__subframeAllocation_PR_fourFrames; + }else { + AssertFatal (0,"Failed to parse gNB configuration file %s, gnb %d unknown value \"%d\" for RateMatchPatternLTE_CRS_subframeAllocation_choice !\n", + RC.config_file_name, i, RateMatchPatternLTE_CRS_subframeAllocation_choice); + } + }//End for (j = 0; j < CCsParamList.numelt ;j++) diff --git a/openair2/ENB_APP/gnb_paramdef.h b/openair2/ENB_APP/gnb_paramdef.h index 3145b2aa17..96a18fa2ea 100644 --- a/openair2/ENB_APP/gnb_paramdef.h +++ b/openair2/ENB_APP/gnb_paramdef.h @@ -229,6 +229,7 @@ typedef enum { ///NR //MIB #define GNB_CONFIG_STRING_MIB_SUBCARRIERSPACINGCOMMON "MIB_subCarrierSpacingCommon" +#define GNB_CONFIG_STRING_MIB_SSB_SUBCARRIEROFFSET "MIB_ssb_SubcarrierOffset" #define GNB_CONFIG_STRING_MIB_DMRS_TYPEA_POSITION "MIB_dmrs_TypeA_Position" #define GNB_CONFIG_STRING_PDCCH_CONFIGSIB1 "pdcch_ConfigSIB1" @@ -392,7 +393,13 @@ typedef enum { #define GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_3_MONITORINGPERIODICITY "Common_dci_Format2_3_monitoringPeriodicity" #define GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_3_NROFPDCCH_CANDIDATES "Common_dci_Format2_3_nrofPDCCH_Candidates" #define GNB_CONFIG_STRING_UE_SPECIFIC__DCI_FORMATS "ue_Specific__dci_Formats" - +#define GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_CARRIERFREQDL "RateMatchPatternLTE_CRS_carrierFreqDL" +#define GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_CARRIERBANDWIDTHDL "RateMatchPatternLTE_CRS_carrierBandwidthDL" +#define GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_NROFCRS_PORTS "RateMatchPatternLTE_CRS_nrofCRS_Ports" +#define GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_V_SHIFT "RateMatchPatternLTE_CRS_v_Shift" +#define GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_RADIOFRAMEALLOCATIONPERIOD "RateMatchPatternLTE_CRS_radioframeAllocationPeriod" +#define GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_RADIOFRAMEALLOCATIONOFFSET "RateMatchPatternLTE_CRS_radioframeAllocationOffset" +#define GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_SUBFRAMEALLOCATION_CHOICE "RateMatchPatternLTE_CRS_subframeAllocation_choice" /*---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/ /* component carriers configuration parameters */ @@ -409,6 +416,7 @@ typedef enum { {GNB_CONFIG_STRING_N_RB_DL, NULL, 0, iptr:&N_RB_DL, defintval:25, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_NB_ANT_PORTS, NULL, 0, iptr:&nb_antenna_ports, defintval:1, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_MIB_SUBCARRIERSPACINGCOMMON, NULL, 0, iptr:&MIB_subCarrierSpacingCommon, defintval:0, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_MIB_SSB_SUBCARRIEROFFSET, NULL, 0, iptr:&MIB_ssb_SubcarrierOffset, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_MIB_DMRS_TYPEA_POSITION, NULL, 0, iptr:&MIB_dmrs_TypeA_Position, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_PDCCH_CONFIGSIB1, NULL, 0, iptr:&pdcch_ConfigSIB1, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_SIB1_FREQUENCYOFFSETSSB, NULL, 0, iptr:&SIB1_frequencyOffsetSSB, defintval:0, TYPE_UINT, 0}, \ @@ -427,7 +435,7 @@ typedef enum { {GNB_CONFIG_STRING_DL_BWP_PREFIX_TYPE, NULL, 0, iptr:&DL_BWP_prefix_type, defintval:0, TYPE_STRING, 0}, \ {GNB_CONFIG_STRING_UL_FREQBANDINDICATORNR, NULL, 0, iptr:&UL_FreqBandIndicatorNR, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_UL_ABSOLUTEFREQUENCYPOINTA, NULL, 0, iptr:&UL_absoluteFrequencyPointA, defintval:0, TYPE_UINT, 0}, \ -{GNB_CONFIG_STRING_UL_ADDITIONALSPECTRUMEMISSION, NULL, 0, iptr:&UL_additionalSpectrumEmission, defintval:0, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_UL_ADDITIONALSPECTRUMEMISSION, NULL, 0, iptr:&UL_additionalSpectrumEmission, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_UL_P_MAX, NULL, 0, iptr:&UL_p_Max, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_UL_FREQUENCYSHIFT7P5KHZ, NULL, 0, iptr:&UL_frequencyShift7p5khz, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_UL_OFFSETTOCARRIER, NULL, 0, iptr:&UL_offsetToCarrier, defintval:0, TYPE_UINT, 0}, \ @@ -534,6 +542,13 @@ typedef enum { {GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_3_MONITORINGPERIODICITY, NULL, 0, iptr:&Common_dci_Format2_3_monitoringPeriodicity, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_COMMON_DCI_FORMAT2_3_NROFPDCCH_CANDIDATES, NULL, 0, iptr:&Common_dci_Format2_3_nrofPDCCH_Candidates, defintval:0, TYPE_UINT, 0}, \ {GNB_CONFIG_STRING_UE_SPECIFIC__DCI_FORMATS, NULL, 0, iptr:&ue_Specific__dci_Formats, defintval:0, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_CARRIERFREQDL, NULL, 0, iptr:&RateMatchPatternLTE_CRS_carrierFreqDL, defintval:0, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_CARRIERBANDWIDTHDL, NULL, 0, iptr:&RateMatchPatternLTE_CRS_carrierBandwidthDL, defintval:0, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_NROFCRS_PORTS, NULL, 0, iptr:&RateMatchPatternLTE_CRS_nrofCRS_Ports, defintval:0, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_V_SHIFT, NULL, 0, iptr:&RateMatchPatternLTE_CRS_v_Shift, defintval:0, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_RADIOFRAMEALLOCATIONPERIOD, NULL, 0, iptr:&RateMatchPatternLTE_CRS_radioframeAllocationPeriod, defintval:0, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_RADIOFRAMEALLOCATIONOFFSET, NULL, 0, iptr:&RateMatchPatternLTE_CRS_radioframeAllocationOffset, defintval:0, TYPE_UINT, 0}, \ +{GNB_CONFIG_STRING_RATEMATCHPATTERNLTE_CRS_SUBFRAMEALLOCATION_CHOICE, NULL, 0, iptr:&RateMatchPatternLTE_CRS_subframeAllocation_choice, defintval:0, TYPE_UINT, 0}, \ } @@ -552,6 +567,7 @@ typedef enum { #define GNB_CONFIG_TX_GAIN_IDX #define GNB_CONFIG_RX_GAIN_IDX #define GNB_CONFIG_MIB_SUBCARRIERSPACINGCOMMON_IDX +#define GNB_CONFIG_MIB_SSB_SUBCARRIEROFFSET_IDX #define GNB_CONFIG_MIB_DMRS_TYPEA_POSITION_IDX #define GNB_CONFIG_PDCCH_CONFIGSIB1_IDX #define GNB_CONFIG_SIB1_FREQUENCYOFFSETSSB_IDX @@ -680,3 +696,10 @@ typedef enum { #define GNB_CONFIG_COMMON_DCI_FORMAT2_3_MONITORINGPERIODICITY_IDX #define GNB_CONFIG_COMMON_DCI_FORMAT2_3_NROFPDCCH_CANDIDATES_IDX #define GNB_CONFIG_UE_SPECIFIC__DCI_FORMATS_IDX +#define GNB_CONFIG_RATEMATCHPATTERNLTE_CRS_CARRIERFREQDL_IDX +#define GNB_CONFIG_RATEMATCHPATTERNLTE_CRS_CARRIERBANDWIDTHDL_IDX +#define GNB_CONFIG_RATEMATCHPATTERNLTE_CRS_NROFCRS_PORTS_IDX +#define GNB_CONFIG_RATEMATCHPATTERNLTE_CRS_V_SHIFT_IDX +#define GNB_CONFIG_RATEMATCHPATTERNLTE_CRS_RADIOFRAMEALLOCATIONPERIOD_IDX +#define GNB_CONFIG_RATEMATCHPATTERNLTE_CRS_RADIOFRAMEALLOCATIONOFFSET_IDX +#define GNB_CONFIG_RATEMATCHPATTERNLTE_CRS_SUBFRAMEALLOCATION_CHOICE_IDX \ No newline at end of file diff --git a/openair2/RRC/NR/MESSAGES/asn1_msg.c b/openair2/RRC/NR/MESSAGES/asn1_msg.c index 9510a29b48..5844013462 100644 --- a/openair2/RRC/NR/MESSAGES/asn1_msg.c +++ b/openair2/RRC/NR/MESSAGES/asn1_msg.c @@ -205,7 +205,7 @@ uint8_t do_MIB_NR(rrc_gNB_carrier_data_t *carrier, asn_enc_rval_t enc_rval; - BCCH_BCH_Message_t *mib=&carrier->mib_NR ; + BCCH_BCH_Message_t *mib=&carrier->mib memset(mib,0,sizeof(BCCH_BCH_Message_t)); mib->message.present = BCCH_BCH_MessageType_PR_mib; @@ -270,7 +270,7 @@ uint8_t do_MIB_NR(rrc_gNB_carrier_data_t *carrier, //encode MIB to data enc_rval = uper_encode_to_buffer(&asn_DEF_BCCH_BCH_Message, (void*)mib, - carrier->MIB_NR, + carrier->MIB, 24); AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); @@ -495,7 +495,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier, return((enc_rval.encoded+7)/8); } -uint8_t do_SERVINGCELLCONFIGCOMMON(uint8_t Mod_id, +void do_SERVINGCELLCONFIGCOMMON(uint8_t Mod_id, int CC_id #if defined(ENABLE_ITTI) ,gNB_RrcConfigurationReq *configuration diff --git a/openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-InterNodeDefinitions.asn b/openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-InterNodeDefinitions.asn old mode 100755 new mode 100644 diff --git a/openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-RRC-Definitions.asn b/openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-RRC-Definitions.asn old mode 100755 new mode 100644 index 84426f50bb..dd6b0c56a7 --- a/openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-RRC-Definitions.asn +++ b/openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-RRC-Definitions.asn @@ -252,29 +252,29 @@ BWP-UplinkCommon ::= SEQUENCE { genericParameters BWP, -- Configuration of cell specific random access parameters which the UE uses for contention based and contention free random access -- as well as for contention based beam failure recovery. - rach-ConfigCommon SetupRelease { RACH-ConfigCommon } OPTIONAL, -- Need M + rach-ConfigCommon RACH-ConfigCommon OPTIONAL, -- Need M -- Cell specific parameters for the PUSCH - pusch-ConfigCommon SetupRelease { PUSCH-ConfigCommon } OPTIONAL, -- Need M + pusch-ConfigCommon PUSCH-ConfigCommon OPTIONAL, -- Need M -- Cell specific parameters for the PUCCH - pucch-ConfigCommon SetupRelease { PUCCH-ConfigCommon } OPTIONAL, -- Need M + pucch-ConfigCommon PUCCH-ConfigCommon OPTIONAL, -- Need M ... } BWP-UplinkDedicated ::= SEQUENCE { -- PUCCH configuration for one BWP of the regular UL or SUL of a serving cell. If the UE is configured with SUL, the network -- configures PUCCH only on the BWPs of one of the uplinks (UL or SUL). - pucch-Config SetupRelease { PUCCH-Config } OPTIONAL, -- Need M + pucch-Config PUCCH-Config OPTIONAL, -- Need M -- PUSCH configuration for one BWP of the regular UL or SUL of a serving cell. If the UE is configured with SUL and -- if it has a PUSCH-Config for both UL and SUL, a carrier indicator field in DCI indicates for which of the two to use an UL grant. -- See also L1 parameter 'dynamicPUSCHSUL' (see 38.213, section FFS_Section) - pusch-Config SetupRelease { PUSCH-Config } OPTIONAL, -- Need M + pusch-Config PUSCH-Config OPTIONAL, -- Need M -- A Configured-Grant of typ1 or type2. It may be configured for Ul or SUL but in case of type1 [FFS also type2] not for both at a time. - configuredGrantConfig SetupRelease { ConfiguredGrantConfig } OPTIONAL, -- Need M + configuredGrantConfig ConfiguredGrantConfig OPTIONAL, -- Need M -- Uplink sounding reference signal configuration - srs-Config SetupRelease { SRS-Config } OPTIONAL, -- Need M + srs-Config SRS-Config OPTIONAL, -- Need M -- Determines how the UE performs Beam Failure Recovery upon detection of a Beam Failure (see RadioLinkMonitoringConfig) - beamFailureRecoveryConfig SetupRelease { BeamFailureRecoveryConfig } OPTIONAL, -- Need M + beamFailureRecoveryConfig BeamFailureRecoveryConfig OPTIONAL, -- Need M ... } @@ -296,16 +296,16 @@ BWP-Downlink ::= SEQUENCE { BWP-DownlinkCommon ::= SEQUENCE { genericParameters BWP, - pdcch-ConfigCommon SetupRelease { PDCCH-ConfigCommon } OPTIONAL, -- Need M - pdsch-ConfigCommon SetupRelease { PDSCH-ConfigCommon } OPTIONAL, -- Need M + pdcch-ConfigCommon PDCCH-ConfigCommon OPTIONAL, -- Need M + pdsch-ConfigCommon PDSCH-ConfigCommon OPTIONAL, -- Need M ... } BWP-DownlinkDedicated ::= SEQUENCE { - pdcch-Config SetupRelease { PDCCH-Config } OPTIONAL, -- Need M - pdsch-Config SetupRelease { PDSCH-Config } OPTIONAL, -- Need M - sps-Config SetupRelease { SPS-Config } OPTIONAL, -- Need M - radioLinkMonitoringConfig SetupRelease { RadioLinkMonitoringConfig } OPTIONAL, -- Need M + pdcch-Config PDCCH-Config OPTIONAL, -- Need M + pdsch-Config PDSCH-Config OPTIONAL, -- Need M + sps-Config SPS-Config OPTIONAL, -- Need M + radioLinkMonitoringConfig RadioLinkMonitoringConfig OPTIONAL, -- Need M ... } @@ -449,7 +449,7 @@ SpCellConfig ::= SEQUENCE { servCellIndex ServCellIndex OPTIONAL, -- Cond SCG -- Parameters for the synchronous reconfiguration to the target SpCell: reconfigurationWithSync ReconfigurationWithSync OPTIONAL, -- Cond ReconfWithSync - rlf-TimersAndConstants SetupRelease { RLF-TimersAndConstants } OPTIONAL, -- Need M + rlf-TimersAndConstants RLF-TimersAndConstants OPTIONAL, -- Need M rlmInSyncOutOfSyncThreshold INTEGER (0..1) OPTIONAL, -- Need M spCellConfigDedicated ServingCellConfig OPTIONAL, -- Need M ... @@ -600,7 +600,7 @@ ConfiguredGrantConfig ::= SEQUENCE { mcs-TableTransformPrecoder ENUMERATED {qam256} OPTIONAL, -- Need S -- Selection between and configuration of dynamic and semi-static beta-offset, as agreed in RAN1-AH18776 -- Note: For Type 1 UL data transmission without grant, "uci-on-PUSCH" should be set to semiStatic - uci-OnPUSCH SetupRelease { CG-UCI-OnPUSCH }, + uci-OnPUSCH CG-UCI-OnPUSCH , -- Configuration of resource allocation type 0 and resource allocation type 1, as agreed in RAN1-AH18776 -- Note: For Type 1 UL data transmission without grant, "resourceAllocation" should be resourceAllocationType0 or resourceAllocationType1 resourceAllocation ENUMERATED { resourceAllocationType0, resourceAllocationType1, dynamicSwitch }, @@ -918,8 +918,8 @@ CSI-MeasConfig ::= SEQUENCE { -- Contains trigger states for dynamically selecting one or more aperiodic and semi-persistent reporting configurations -- and/or triggering one or more aperiodic CSI-RS resource sets for channel and/or interference measurement. -- FFS: How to address the MAC-CE configuration - aperiodicTriggerStateList SetupRelease { CSI-AperiodicTriggerStateList } OPTIONAL, -- Need M - semiPersistentOnPUSCH-TriggerStateList SetupRelease { CSI-SemiPersistentOnPUSCH-TriggerStateList } OPTIONAL, -- Need M + aperiodicTriggerStateList CSI-AperiodicTriggerStateList OPTIONAL, -- Need M + semiPersistentOnPUSCH-TriggerStateList CSI-SemiPersistentOnPUSCH-TriggerStateList OPTIONAL, -- Need M ... } @@ -1292,7 +1292,7 @@ DMRS-DownlinkConfig ::= SEQUENCE { scramblingID1 INTEGER (0..65535) OPTIONAL, -- Need S -- Configures downlink PTRS. If absent of released, the UE assumes that downlink PTRS are not present. See 38.214 section 5.1.6.3 - phaseTrackingRS SetupRelease { PTRS-DownlinkConfig } OPTIONAL, -- Need M + phaseTrackingRS PTRS-DownlinkConfig OPTIONAL, -- Need M ... } @@ -1309,7 +1309,7 @@ DMRS-UplinkConfig ::= SEQUENCE { -- If the field is absent, the UE applies the value pos2. dmrs-AdditionalPosition ENUMERATED {pos0, pos1, pos3} OPTIONAL, -- Need R -- Configures uplink PTRS (see 38.211, section x.x.x.x) FFS_Ref - phaseTrackingRS SetupRelease { PTRS-UplinkConfig } OPTIONAL, -- Need M + phaseTrackingRS PTRS-UplinkConfig OPTIONAL, -- Need M -- The maximum number of OFDM symbols for UL front loaded DMRS. 'len1' corresponds to value 1. 'len2 corresponds to value 2. -- If the field is absent, the UE applies value len1. -- Corresponds to L1 parameter 'UL-DMRS-max-len' (see 38.214, section 6.4.1.1.2) @@ -1508,16 +1508,16 @@ LogicalChannelConfig ::= SEQUENCE { -- TAG-MAC-CELL-GROUP-CONFIG-START MAC-CellGroupConfig ::= SEQUENCE { - drx-Config SetupRelease { DRX-Config } OPTIONAL, -- Need M + drx-Config DRX-Config OPTIONAL, -- Need M schedulingRequestConfig SchedulingRequestConfig OPTIONAL, -- Need M - bsr-Config BSR-Config OPTIONAL, -- Need M - tag-Config TAG-Config OPTIONAL, -- Need M - phr-Config SetupRelease { PHR-Config } OPTIONAL, -- Need M + bsr-Config BSR-Config OPTIONAL, -- Need M + tag-Config TAG-Config OPTIONAL, -- Need M + phr-Config PHR-Config OPTIONAL, -- Need M -- FFS : configurable per SCell? skipUplinkTxDynamic BOOLEAN, -- RNTI value for downlink SPS (see SPS-config) and uplink configured scheduling (see ConfiguredSchedulingConfig). - cs-RNTI SetupRelease { RNTI-Value } OPTIONAL -- Need M + cs-RNTI RNTI-Value OPTIONAL -- Need M } DRX-Config ::= SEQUENCE { @@ -1654,7 +1654,7 @@ ReportConfigToRemoveList ::= SEQUENCE (SIZE (1..maxReportConfigId)) OF ReportC --TAG-MEAS-GAP-CONFIG-START MeasGapConfig ::= SEQUENCE { - gapFR2 SetupRelease { GapConfig } OPTIONAL, + gapFR2 GapConfig OPTIONAL, ... } @@ -1731,7 +1731,7 @@ ReferenceSignalConfig::= SEQUENCE { -- SSB configuration for mobility (nominal SSBs, timing configuration) ssb-ConfigMobility SSB-ConfigMobility OPTIONAL, -- Need M -- CSI-RS resources to be used for CSI-RS based RRM measurements - csi-rs-ResourceConfigMobility SetupRelease { CSI-RS-ResourceConfigMobility } OPTIONAL-- Need M + csi-rs-ResourceConfigMobility CSI-RS-ResourceConfigMobility OPTIONAL-- Need M } @@ -1743,7 +1743,7 @@ SSB-ConfigMobility::= SEQUENCE { -- Corresponds to L1 parameter 'SSB-measured' (see FFS_Spec, section FFS_Section) -- When the field is absent the UE measures on all SS-blocks -- FFS_CHECK: Is this IE placed correctly. - ssb-ToMeasure SetupRelease { SSB-ToMeasure } OPTIONAL, -- Need M + ssb-ToMeasure SSB-ToMeasure OPTIONAL, -- Need M -- Indicates whether the UE can utilize serving cell timing to derive the index of SS block transmitted by neighbour cell: useServingCellTimingForSync BOOLEAN, @@ -2137,17 +2137,17 @@ PDCCH-Config ::= SEQUENCE { -- Configuration of downlink preemtption indications to be monitored in this cell. -- Corresponds to L1 parameter 'Preemp-DL' (see 38.214, section 11.2) -- FFS_RAN1: LS R1-1801281 indicates this is "Per Cell (but association with each configured BWP is needed)" => Unclear, keep on BWP for now. - downlinkPreemption SetupRelease { DownlinkPreemption } OPTIONAL, -- Need M + downlinkPreemption DownlinkPreemption OPTIONAL, -- Need M -- Configuration of Slot-Format-Indicators to be monitored in this cell -- FFS_RAN1 discusses still whether this SFI payload configuration is BWP- or Cell-Specific. - slotFormatIndicator SetupRelease { SlotFormatIndicator } OPTIONAL, -- Need M + slotFormatIndicator SlotFormatIndicator OPTIONAL, -- Need M -- Enable and configure reception of group TPC commands for PUSCH - tpc-PUSCH SetupRelease { PUSCH-TPC-CommandConfig } OPTIONAL, -- Need M + tpc-PUSCH PUSCH-TPC-CommandConfig OPTIONAL, -- Need M -- Enable and configure reception of group TPC commands fpr PUCCH - tpc-PUCCH SetupRelease { PUCCH-TPC-CommandConfig } OPTIONAL, -- Cond PUCCH-CellOnly + tpc-PUCCH PUCCH-TPC-CommandConfig OPTIONAL, -- Cond PUCCH-CellOnly ... } @@ -2264,9 +2264,9 @@ PDSCH-Config ::= SEQUENCE { dataScramblingIdentityPDSCH INTEGER (0..1007) OPTIONAL, -- DMRS configuration for PDSCH transmissions using PDSCH mapping type A (chosen dynamically via PDSCH-TimeDomainResourceAllocation). - dmrs-DownlinkForPDSCH-MappingTypeA SetupRelease { DMRS-DownlinkConfig } OPTIONAL, -- Need M + dmrs-DownlinkForPDSCH-MappingTypeA DMRS-DownlinkConfig OPTIONAL, -- Need M -- DMRS configuration for PDSCH transmissions using PDSCH mapping type B (chosen dynamically via PDSCH-TimeDomainResourceAllocation). - dmrs-DownlinkForPDSCH-MappingTypeB SetupRelease { DMRS-DownlinkConfig } OPTIONAL, -- Need M + dmrs-DownlinkForPDSCH-MappingTypeB DMRS-DownlinkConfig OPTIONAL, -- Need M -- A list of Transmission Configuration Indicator (TCI) states for dynamically indicating (over DCI) a transmission configuration @@ -2371,7 +2371,7 @@ PDSCH-ConfigCommon ::= SEQUENCE { PDSCH-ServingCellConfig ::= SEQUENCE { -- Enables and configures code-block-group (CBG) based transmission (see 38.213, section 9.1.1) - codeBlockGroupTransmission SetupRelease { PDSCH-CodeBlockGroupTransmission } OPTIONAL, -- Need M + codeBlockGroupTransmission PDSCH-CodeBlockGroupTransmission OPTIONAL, -- Need M -- Accounts for overhead from CSI-RS, CORESET, etc. If the field is absent, the UE applies value xOh0. -- Corresponds to L1 parameter 'Xoh-PDSCH' (see 38.214, section 5.1.3.2) xOverhead ENUMERATED { xOh6, xOh12, xOh18 } OPTIONAL, -- Need S @@ -2496,13 +2496,13 @@ PUCCH-Config ::= SEQUENCE { resourceToReleaseList SEQUENCE (SIZE (1..maxNrofPUCCH-Resources)) OF PUCCH-ResourceId OPTIONAL, -- Need N -- Parameters that are common for all PUCCH resources of format 1 - format1 SetupRelease { PUCCH-FormatConfig } OPTIONAL, -- Need M + format1 PUCCH-FormatConfig OPTIONAL, -- Need M -- Parameters that are common for all PUCCH resources of format 2 - format2 SetupRelease { PUCCH-FormatConfig } OPTIONAL, -- Need M + format2 PUCCH-FormatConfig OPTIONAL, -- Need M -- Parameters that are common for all PUCCH resources of format 3 - format3 SetupRelease { PUCCH-FormatConfig } OPTIONAL, -- Need M + format3 PUCCH-FormatConfig OPTIONAL, -- Need M -- Parameters that are common for all PUCCH resources of format 4 - format4 SetupRelease { PUCCH-FormatConfig } OPTIONAL, -- Need M + format4 PUCCH-FormatConfig OPTIONAL, -- Need M schedulingRequestResourceToAddModList SEQUENCE (SIZE (1..maxNrofSR-Resources)) OF SchedulingRequestResourceConfig OPTIONAL, -- Need M schedulingRequestResourceToReleaseList SEQUENCE (SIZE (1..maxNrofSR-Resources)) OF SchedulingRequestResourceId OPTIONAL, -- Need M @@ -2759,9 +2759,9 @@ PUSCH-Config ::= SEQUENCE { txConfig ENUMERATED {codebook, nonCodebook}, -- DMRS configuration for PUSCH transmissions using PUSCH mapping type A (chosen dynamically via PUSCH-TimeDomainResourceAllocation). - dmrs-UplinkForPUSCH-MappingTypeA SetupRelease { DMRS-UplinkConfig } OPTIONAL, -- Need M + dmrs-UplinkForPUSCH-MappingTypeA DMRS-UplinkConfig OPTIONAL, -- Need M -- DMRS configuration for PUSCH transmissions using PUSCH mapping type B (chosen dynamically via PUSCH-TimeDomainResourceAllocation) - dmrs-UplinkForPUSCH-MappingTypeB SetupRelease { DMRS-UplinkConfig } OPTIONAL, -- Need M + dmrs-UplinkForPUSCH-MappingTypeB DMRS-UplinkConfig OPTIONAL, -- Need M pusch-PowerControl PUSCH-PowerControl OPTIONAL, -- Need M -- Configured one of two supported frequency hopping mode. If not configured frequency hopping is not configured @@ -2807,7 +2807,7 @@ PUSCH-Config ::= SEQUENCE { -- If the field is absent or released, the UE applies the value 'semiStatic' and the BetaOffsets according to -- FFS [BetaOffsets and/or section 9.x.x). -- Corresponds to L1 parameter 'UCI-on-PUSCH' (see 38.213, section 9.3) - uci-OnPUSCH SetupRelease { UCI-OnPUSCH} OPTIONAL, -- Need M + uci-OnPUSCH UCI-OnPUSCH OPTIONAL, -- Need M -- Interleaving unit configurable between 2 and 4 PRBs -- Corresponds to L1 parameter 'VRB-to-PRB-interleaver' (see 38.211, section 6.3.1.6) vrb-ToPRB-Interleaver ENUMERATED {n2, n4}, @@ -2971,7 +2971,7 @@ BetaOffsets ::= SEQUENCE { PUSCH-ServingCellConfig ::= SEQUENCE { -- Enables and configures code-block-group (CBG) based transmission (see 38.214, section FFS_Section) - codeBlockGroupTransmission SetupRelease { PUSCH-CodeBlockGroupGransmission } OPTIONAL, -- Need M + codeBlockGroupTransmission PUSCH-CodeBlockGroupGransmission OPTIONAL, -- Need M -- Enables LBRM (Limited buffer rate-matching). When the field is absent the UE applies FBRM (Full buffer rate-matchingLBRM). -- Corresponds to L1 parameter 'LBRM-FBRM-selection' (see 38.212, section 5.4.2) rateMatching ENUMERATED {limitedBufferRM} OPTIONAL, -- Need S @@ -3897,12 +3897,12 @@ ServingCellConfig ::= SEQUENCE { -- PDSCH releated parameters that are not BWP-specific. - pdsch-ServingCellConfig SetupRelease { PDSCH-ServingCellConfig } OPTIONAL, -- Need M - csi-MeasConfig SetupRelease { CSI-MeasConfig } OPTIONAL, -- Need M + pdsch-ServingCellConfig PDSCH-ServingCellConfig OPTIONAL, -- Need M + csi-MeasConfig CSI-MeasConfig OPTIONAL, -- Need M -- Includes parameters for configuration of carrier based SRS switching -- Corresponds to L1 parameter 'SRS-CarrierSwitching' (see 38,214, section FFS_Section) - carrierSwitching SetupRelease { SRS-CarrierSwitching } OPTIONAL, -- Need M + carrierSwitching SRS-CarrierSwitching OPTIONAL, -- Need M -- MAC parameters: sCellDeactivationTimer ENUMERATED {ms20, ms40, ms80, ms160, ms200, ms240, ms320, ms400, ms480, ms520, ms640, ms720, ms840, ms1280, spare2,spare1} OPTIONAL, -- Cond ServingCellWithoutPUCCH @@ -3944,7 +3944,7 @@ UplinkConfig ::= SEQUENCE { -- Configuration that is common across the UL BWPs: -- PUSCH related parameters that are not BWP-specific. - pusch-ServingCellConfig SetupRelease { PUSCH-ServingCellConfig } OPTIONAL, -- Need M + pusch-ServingCellConfig PUSCH-ServingCellConfig OPTIONAL, -- Need M ... } @@ -3980,7 +3980,7 @@ ServingCellConfigCommon ::= SEQUENCE { dmrs-TypeA-Position ENUMERATED {pos2, pos3}, -- Parameters to determine an LTE CRS pattern that the UE shall rate match around. - lte-CRS-ToMatchAround SetupRelease { RateMatchPatternLTE-CRS } OPTIONAL, -- Need M + lte-CRS-ToMatchAround RateMatchPatternLTE-CRS OPTIONAL, -- Need M -- Resources patterns which the UE should rate match PDSCH around. The UE rate matches around the union of all resources -- indicated in the nested bitmaps. Rate match patterns defined here on cell level apply only to PDSCH of the same numerology. diff --git a/openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-UE-Variables.asn b/openair2/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-UE-Variables.asn old mode 100755 new mode 100644 diff --git a/openair2/RRC/NR/defs_NR.h b/openair2/RRC/NR/defs_NR.h index cdb667076e..b1a37590be 100644 --- a/openair2/RRC/NR/defs_NR.h +++ b/openair2/RRC/NR/defs_NR.h @@ -41,27 +41,27 @@ #include "COMMON/platform_types.h" //#include "COMMON/mac_rrc_primitives.h" -#if defined(Rel15) -#include "SIB1.h" +#if defined(NR_Rel15) +#include "NR_SIB1.h" //#include "SystemInformation.h" //#include "RRCConnectionReconfiguration.h" -#include "RRCReconfigurationComplete.h" -#include "RRCReconfiguration" +#include "NR_RRCReconfigurationComplete.h" +#include "NR_RRCReconfiguration.h" //#include "RRCConnectionReconfigurationComplete.h" //#include "RRCConnectionSetup.h" //#include "RRCConnectionSetupComplete.h" //#include "RRCConnectionRequest.h" //#include "RRCConnectionReestablishmentRequest.h" //#include "BCCH-DL-SCH-Message.h" -#include "BCCH-BCH-Message.h" +#include "NR_BCCH-BCH-Message.h" //#include "MCCH-Message.h" //#include "MBSFNAreaConfiguration-r9.h" //#include "SCellToAddMod-r10.h" //#include "AS-Config.h" //#include "AS-Context.h" -#include "UE-NR-Capability.h" -#include "MeasResults.h" -#include "ServingCellConfigCommon.h" +#include "NR_UE-NR-Capability.h" +#include "NR_MeasResults.h" +#include "NR_ServingCellConfigCommon.h" #endif //------------------- @@ -90,7 +90,7 @@ /*I will change the name of the structure for compile purposes--> hope not to undo this process*/ typedef unsigned int uid_NR_t; -#define UID_LINEAR_ALLOCATOR_BITMAP_SIZE_NR (((NUMBER_OF_UE_MAX_NR/8)/sizeof(unsigned int)) + 1) +#define UID_LINEAR_ALLOCATOR_BITMAP_SIZE_NR (((NUMBER_OF_NR_UE_MAX/8)/sizeof(unsigned int)) + 1) typedef struct uid_linear_allocator_NR_s { unsigned int bitmap[UID_LINEAR_ALLOCATOR_BITMAP_SIZE_NR]; @@ -108,29 +108,29 @@ typedef struct uid_linear_allocator_NR_s { #define UE_INDEX_INVALID ((module_id_t) ~0) // FIXME attention! depends on type uint8_t!!! used to be -1 typedef enum { - RRC_OK=0, - RRC_ConnSetup_failed, - RRC_PHY_RESYNCH, - RRC_Handover_failed, - RRC_HO_STARTED -} RRC_status_NR_t; + NR_RRC_OK=0, + NR_RRC_ConnSetup_failed, + NR_RRC_PHY_RESYNCH, + NR_RRC_Handover_failed, + NR_RRC_HO_STARTED +} NR_RRC_status_t; typedef enum UE_STATE_NR_e { - RRC_INACTIVE=0, - RRC_IDLE, - RRC_SI_RECEIVED, - RRC_CONNECTED, - RRC_RECONFIGURED, - RRC_HO_EXECUTION -} UE_STATE_NR_t; + NR_RRC_INACTIVE=0, + NR_RRC_IDLE, + NR_RRC_SI_RECEIVED, + NR_RRC_CONNECTED, + NR_RRC_RECONFIGURED, + NR_RRC_HO_EXECUTION +} NR_UE_STATE_t; typedef enum HO_STATE_NR_e { - HO_IDLE=0, - HO_MEASURMENT, - HO_PREPARE, - HO_CMD, // initiated by the src eNB - HO_COMPLETE // initiated by the target eNB -} HO_STATE_NR_t; + NR_HO_IDLE=0, + NR_HO_MEASURMENT, + NR_HO_PREPARE, + NR_HO_CMD, // initiated by the src eNB + NR_HO_COMPLETE // initiated by the target eNB +} NR_HO_STATE_t; //#define NUMBER_OF_UE_MAX MAX_MOBILES_PER_RG #define RRM_FREE(p) if ( (p) != NULL) { free(p) ; p=NULL ; } @@ -161,7 +161,7 @@ typedef struct { } __attribute__ ((__packed__)) LCHAN_DESC_NR; typedef struct UE_RRC_INFO_NR_s { - UE_STATE_NR_t State; + NR_UE_STATE_t State; uint8_t SIB1systemInfoValueTag; uint32_t SIStatus; uint32_t SIcnt; @@ -318,8 +318,8 @@ typedef struct gNB_RRC_UE_s { /* Used integrity/ciphering algorithms */ //Specs. TS 38.331 V15.1.0 pag 432 Change position of chipering enumerative w.r.t previous version - e_CipheringAlgorithm ciphering_algorithm; - e_IntegrityProtAlgorithm integrity_algorithm; + e_NR_CipheringAlgorithm ciphering_algorithm; + e_NR_IntegrityProtAlgorithm integrity_algorithm; uint8_t Status; rnti_t rnti; @@ -332,8 +332,8 @@ typedef struct gNB_RRC_UE_s { /* NR not define at this moment EstablishmentCause_t establishment_cause_NR; //different set for NB-IoT - - /* NR not define at this moment + */ + /* NR not define at this moment*/ /* Information from UE RRC ConnectionReestablishmentRequest */ //ReestablishmentCause_t reestablishment_cause_NR; //different set for NB_IoT @@ -398,10 +398,6 @@ typedef struct { uint8_t *SIB1; uint8_t sizeof_SIB1; - uint8_t *SERVINGCELLCONFIGCOMMON; - uint8_t sizeof_SERVINGCELLCONFIGCOMMON; - - //implicit parameters needed int Ncp; //cyclic prefix for DL int Ncp_UL; //cyclic prefix for UL @@ -414,8 +410,8 @@ typedef struct { //are the only static one (memory has been already allocated) BCCH_BCH_Message_t mib; - SIB1_t *sib1; - ServingCellConfigCommon_t *servingcellconfigcommon; + NR_SIB1_t *sib1; + NR_ServingCellConfigCommon_t *servingcellconfigcommon; SRB_INFO_NR SI; @@ -472,7 +468,7 @@ typedef struct OAI_UECapability_NR_s { uint8_t sdu[MAX_UE_CAPABILITY_SIZE_NR]; uint8_t sdu_size; ////NR------ - UE_NR_Capability_t UE_Capability_NR; //replace the UE_EUTRA_Capability of LTE + NR_UE_NR_Capability_t UE_Capability_NR; //replace the UE_EUTRA_Capability of LTE } OAI_UECapability_NR_t; @@ -505,7 +501,6 @@ typedef struct UE_RRC_INST_NR_s { SystemInformation_t *si[NB_CNX_UE]; //!< Temporary storage for an SI message. Decoding happens in decode_SI(). SystemInformationBlockType2_t *sib2[NB_CNX_UE]; - /* SystemInformationBlockType3_t *sib3[NB_CNX_UE]; SystemInformationBlockType4_t *sib4[NB_CNX_UE]; SystemInformationBlockType5_t *sib5[NB_CNX_UE]; diff --git a/openair2/RRC/NR/rrc_gNB.c b/openair2/RRC/NR/rrc_gNB.c index 3a3827b593..4bc43a7d10 100644 --- a/openair2/RRC/NR/rrc_gNB.c +++ b/openair2/RRC/NR/rrc_gNB.c @@ -164,10 +164,10 @@ init_NR_SI( RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].MIB = (uint8_t*) malloc16(4); RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_MIB = do_MIB_NR(&RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id],0, #ifdef ENABLE_ITTI - configuration->ssb_SubcarrierOffset[CC_id], + configuration->MIB_ssb_SubcarrierOffset[CC_id], configuration->pdcch_ConfigSIB1[CC_id], - configuration->subCarrierSpacingCommon[CC_id], - configuration->dmrs_TypeA_Position[CC_id] + configuration->MIB_subCarrierSpacingCommon[CC_id], + configuration->MIB_dmrs_TypeA_Position[CC_id] #else 0,0,15,2 #endif @@ -189,12 +189,12 @@ init_NR_SI( AssertFatal(RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SIB1 != 255,"FATAL, RC.nrrrc[enb_mod_idP].carrier[CC_id].sizeof_SIB1 == 255"); - RC.nrrrc[ctxt_pP->module_id]->carrier[CC_id].sizeof_SERVINGCELLCONFIGCOMMON = do_SERVINGCELLCONFIGCOMMON(ctxt_pP->module_id, - CC_id - #if defined(ENABLE_ITTI) - ,configuration - #endif - ); + do_SERVINGCELLCONFIGCOMMON(ctxt_pP->module_id, + CC_id + #if defined(ENABLE_ITTI) + ,configuration + #endif + ); diff --git a/targets/COMMON/openairinterface5g_limits.h b/targets/COMMON/openairinterface5g_limits.h index 4ce85f4cad..dba7b5616e 100644 --- a/targets/COMMON/openairinterface5g_limits.h +++ b/targets/COMMON/openairinterface5g_limits.h @@ -3,32 +3,74 @@ #if defined(CBMIMO1) || defined(EXMIMO) || defined(OAI_USRP) || defined(OAI_LMSSDR) || defined(OAI_ADRV9371_ZC706) # define NUMBER_OF_eNB_MAX 1 +# define NUMBER_OF_gNB_MAX 1 + # define NUMBER_OF_RU_MAX 2 +# define NUMBER_OF_NR_RU_MAX 2 + # define NUMBER_OF_UE_MAX 16 +# define NUMBER_OF_NR_UE_MAX 16 + # define NUMBER_OF_CONNECTED_eNB_MAX 3 +# define NUMBER_OF_CONNECTED_gNB_MAX 3 + #else # define NUMBER_OF_eNB_MAX 7 +# define NUMBER_OF_gNB_MAX 7 + # define NUMBER_OF_RU_MAX 32 +# define NUMBER_OF_NR_RU_MAX 32 + # define NUMBER_OF_UE_MAX 20 +# define NUMBER_OF_NR_UE_MAX 20 + # define NUMBER_OF_CONNECTED_eNB_MAX 3 +# define NUMBER_OF_CONNECTED_gNB_MAX 3 + # if defined(STANDALONE) && STANDALONE==1 # undef NUMBER_OF_eNB_MAX +# undef NUMBER_OF_gNB_MAX + # undef NUMBER_OF_UE_MAX +# undef NUMBER_OF_NR_UE_MAX + # undef NUMBER_OF_RU_MAX +# undef NUMBER_OF_NR_RU_MAX + # define NUMBER_OF_eNB_MAX 3 +# define NUMBER_OF_gNB_MAX 3 + # define NUMBER_OF_UE_MAX 3 +# define NUMBER_OF_NR_UE_MAX 3 + # define NUMBER_OF_RU_MAX 3 +# define NUMBER_OF_NR_RU_MAX 3 # endif # if defined(LARGE_SCALE) && LARGE_SCALE # undef NUMBER_OF_eNB_MAX +# undef NUMBER_OF_gNB_MAX + # undef NUMBER_OF_UE_MAX +# undef NUMBER_OF_NR_UE_MAX + # undef NUMBER_OF_CONNECTED_eNB_MAX +# undef NUMBER_OF_CONNECTED_gNB_MAX + # undef NUMBER_OF_RU_MAX +# undef NUMBER_OF_NR_RU_MAX + # define NUMBER_OF_eNB_MAX 2 +# define NUMBER_OF_gNB_MAX 2 + # define NUMBER_OF_UE_MAX 120 +# define NUMBER_OF_NR_UE_MAX 120 + # define NUMBER_OF_RU_MAX 16 +# define NUMBER_OF_NR_RU_MAX 16 + # define NUMBER_OF_CONNECTED_eNB_MAX 1 // to save some memory +# define NUMBER_OF_CONNECTED_gNB_MAX 1 # endif #endif diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf index bc84e24a37..bc13b44db6 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.50PRB.usrpb210.conf @@ -265,6 +265,7 @@ gNBs = tx_gain = 90; rx_gain = 125; MIB_subCarrierSpacingCommon = 0; + MIB_ssb_SubcarrierOffset = 0; MIB_dmrs_TypeA_Position = 0; pdcch_ConfigSIB1 = 0; SIB1_frequencyOffsetSSB = 0; @@ -390,6 +391,13 @@ gNBs = Common_dci_Format2_3_monitoringPeriodicity = 0; Common_dci_Format2_3_nrofPDCCH_Candidates = 0; ue_Specific__dci_Formats = 0; + RateMatchPatternLTE_CRS_carrierFreqDL = 0; + RateMatchPatternLTE_CRS_carrierBandwidthDL = 0; + RateMatchPatternLTE_CRS_nrofCRS_Ports = 0; + RateMatchPatternLTE_CRS_v_Shift = 0; + RateMatchPatternLTE_CRS_radioframeAllocationPeriod = 0; + RateMatchPatternLTE_CRS_radioframeAllocationOffset = 0; + RateMatchPatternLTE_CRS_subframeAllocation_choice = 0; } ); From 45519c92494bb863d11d31f5ded8712bf699adf2 Mon Sep 17 00:00:00 2001 From: WEI-TAI CHEN Date: Mon, 28 May 2018 08:17:07 -0700 Subject: [PATCH 13/13] Merge feature-s1ap-r14-based-on-new-asn1c --- cmake_targets/CMakeLists.txt | 2534 +++++ cmake_targets/tools/build_helper | 771 ++ cmake_targets/tools/fix_asn1 | 202 + cmake_targets/tools/generate_asn1 | 165 + openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c | 748 ++ .../PHY/LTE_TRANSPORT/dlsch_demodulation.c | 6155 ++++++++++++ .../PHY/LTE_TRANSPORT/dlsch_llr_computation.c | 8899 +++++++++++++++++ .../dlsch_llr_computation_avx2.c | 4034 ++++++++ openair1/PHY/LTE_TRANSPORT/drs_modulation.c | 173 + openair1/PHY/LTE_TRANSPORT/ulsch_coding.c | 933 ++ openair1/PHY/LTE_TRANSPORT/ulsch_modulation.c | 777 ++ openair2/LAYER2/NR_MAC_gNB/config.c | 0 openair2/NR_PHY_INTERFACE/IF_Module.h | 0 openair2/RRC/LITE/rrc_UE.c | 6 +- openair2/RRC/NR/proto_NR.h | 0 15 files changed, 25394 insertions(+), 3 deletions(-) create mode 100644 cmake_targets/CMakeLists.txt create mode 100755 cmake_targets/tools/build_helper create mode 100755 cmake_targets/tools/fix_asn1 create mode 100755 cmake_targets/tools/generate_asn1 create mode 100644 openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c create mode 100644 openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c create mode 100644 openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c create mode 100644 openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation_avx2.c create mode 100644 openair1/PHY/LTE_TRANSPORT/drs_modulation.c create mode 100644 openair1/PHY/LTE_TRANSPORT/ulsch_coding.c create mode 100644 openair1/PHY/LTE_TRANSPORT/ulsch_modulation.c create mode 100644 openair2/LAYER2/NR_MAC_gNB/config.c create mode 100644 openair2/NR_PHY_INTERFACE/IF_Module.h create mode 100644 openair2/RRC/NR/proto_NR.h diff --git a/cmake_targets/CMakeLists.txt b/cmake_targets/CMakeLists.txt new file mode 100644 index 0000000000..89212ec3f1 --- /dev/null +++ b/cmake_targets/CMakeLists.txt @@ -0,0 +1,2534 @@ +#/* +# * 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: laurent THOMAS, Lionel GAUTHIER + +cmake_minimum_required (VERSION 2.8) + +############################################# +# Base directories, compatible with legacy OAI building +################################################ +set (OPENAIR_DIR $ENV{OPENAIR_DIR}) +set (NFAPI_DIR ${OPENAIR_DIR}/nfapi/open-nFAPI) +set (NFAPI_USER_DIR ${OPENAIR_DIR}/nfapi/oai_integration) +set (OPENAIR1_DIR ${OPENAIR_DIR}/openair1) +set (OPENAIR2_DIR ${OPENAIR_DIR}/openair2) +set (OPENAIR3_DIR ${OPENAIR_DIR}/openair3) +set (OPENAIR_TARGETS ${OPENAIR_DIR}/targets) +set (OPENAIR3_DIR ${OPENAIR_DIR}/openair3) +set (OPENAIR_CMAKE ${OPENAIR_DIR}/cmake_targets) +set (OPENAIR_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}) + +project (OpenAirInterface) + +########################################### +# macros to define options as there is numerous options in oai +################################################ +macro(add_option name val helpstr) + if(DEFINED ${name}) + set(value ${${name}}) + else(DEFINED ${name}) + set(value ${val}) + endif() + set(${name} ${value} CACHE STRING "${helpstr}") + add_definitions("-D${name}=${value}") +endmacro(add_option) + +macro(add_boolean_option name val helpstr) + if(DEFINED ${name}) + set(value ${${name}}) + else(DEFINED ${name}) + set(value ${val}) + endif() + set(${name} ${value} CACHE STRING "${helpstr}") + set_property(CACHE ${name} PROPERTY TYPE BOOL) + if (${value}) + add_definitions("-D${name}") + endif (${value}) +endmacro(add_boolean_option) + +macro(add_integer_option name val helpstr) + if(DEFINED ${name}) + set(value ${${name}}) + else(DEFINED ${name}) + set(value ${val}) + endif() + set(${name} ${value} CACHE STRING "${helpstr}") + add_definitions("-D${name}=${value}") +endmacro(add_integer_option) + +macro(add_list1_option name val helpstr) + if(DEFINED ${name}) + set(value ${${name}}) + else(DEFINED ${name}) + set(value ${val}) + endif() + set(${name} ${value} CACHE STRING "${helpstr}") + set_property(CACHE ${name} PROPERTY STRINGS ${ARGN}) + if(NOT "${value}" STREQUAL "False") + add_definitions("-D${name}=${value}") + endif() +endmacro(add_list1_option) + +macro(add_list2_option name val helpstr) + if(DEFINED ${name}) + set(value ${${name}}) + else(DEFINED ${name}) + set(value ${val}) + endif() + set(${name} ${value} CACHE STRING "${helpstr}") + set_property(CACHE ${name} PROPERTY STRINGS ${ARGN}) + if(NOT "${value}" STREQUAL "False") + add_definitions("-D${value}=1") + endif() +endmacro(add_list2_option) + +macro(add_list_string_option name val helpstr) + if(DEFINED ${name}) + set(value ${${name}}) + else(DEFINED ${name}) + set(value ${val}) + endif() + set(${name} ${value} CACHE STRING "${helpstr}") + set_property(CACHE ${name} PROPERTY STRINGS ${ARGN}) + if(NOT "${value}" STREQUAL "False") + add_definitions("-D${name}=\"${value}\"") + endif() +endmacro(add_list_string_option) +#################################################### +# compilation flags +############################################# + +#set(CMAKE_BUILD_TYPE "Debug") +if (CMAKE_BUILD_TYPE STREQUAL "") + set(CMAKE_BUILD_TYPE "RelWithDebInfo") +endif() +message("CMAKE_BUILD_TYPE is ${CMAKE_BUILD_TYPE}") +add_list_string_option(CMAKE_BUILD_TYPE "RelWithDebInfo" "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel." Debug Release RelWithDebInfo MinSizeRel) + +Message("Architecture is ${CMAKE_SYSTEM_PROCESSOR}") +if (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l") + set(C_FLAGS_PROCESSOR "-gdwarf-2 -mfloat-abi=hard -mfpu=neon -lgcc -lrt") +else (CMAKE_SYSTEM_PROCESSOR STREQUAL "armv7l") + if(EXISTS "/proc/cpuinfo") + file(STRINGS "/proc/cpuinfo" CPUINFO REGEX flags LIMIT_COUNT 1) + if (CPUINFO MATCHES "avx2") + set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -mavx2") + set(COMPILATION_AVX2 "True") + else() + set(COMPILATION_AVX2 "False") + endif() + if (CPUINFO MATCHES "sse4_1") + set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -msse4.1") + endif() + if (CPUINFO MATCHES "ssse3") + set(C_FLAGS_PROCESSOR "${C_FLAGS_PROCESSOR} -mssse3") + endif() + else() + Message("/proc/cpuinfo does not exit. We will use manual CPU flags") + endif() +endif() + +set(C_FLAGS_PROCESSOR " ${C_FLAGS_PROCESSOR} ${CFLAGS_PROCESSOR_USER}") + +Message("C_FLAGS_PROCESSOR is ${C_FLAGS_PROCESSOR}") + +if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86") + if ( (NOT( C_FLAGS_PROCESSOR MATCHES "ssse3")) OR (NOT( C_FLAGS_PROCESSOR MATCHES "msse4.1")) ) + Message(FATAL_ERROR "For x86 Architecture, you must have following flags: -mssse3 -msse4.1. The current detected flags are: ${C_FLAGS_PROCESSOR}. You can pass the flags manually in build script, for example: ./build_oai --cflags_processor \"-mssse3 -msse4.1 -mavx2\" ") + endif() +endif() + +# +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" +) +set(CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} ${C_FLAGS_PROCESSOR} -std=c++11 " +) + + +######################### +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-rpath -Wl,${CMAKE_CURRENT_BINARY_DIR}") +######################### +# set a flag for changes in the source code +# these changes are related to hardcoded path to include .h files +add_definitions(-DCMAKER) +set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3") +set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS} -g -DMALLOC_CHECK_=3 -O2") + + +set(GIT_BRANCH "UNKNOWN") +set(GIT_COMMIT_HASH "UNKNOWN") +set(GIT_COMMIT_DATE "UNKNOWN") + +find_package(Git) +if(GIT_FOUND) + message("git found: ${GIT_EXECUTABLE}") + # Get the current working branch + execute_process( + COMMAND git rev-parse --abbrev-ref HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_BRANCH + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + # Get the latest abbreviated commit hash of the working branch + execute_process( + COMMAND git log -1 --format=%h + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE + ) + + # Get the latest commit date of the working branch + execute_process( + COMMAND git log -1 --format=%cd + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMIT_DATE + OUTPUT_STRIP_TRAILING_WHITESPACE + ) +endif() + + +# Below is a hard-coded info +set (FIRMWARE_VERSION "No svn information") +add_definitions("-DFIRMWARE_VERSION=\"${FIRMWARE_VERSION}\"") +add_definitions("-DPACKAGE_VERSION=\"Branch: ${GIT_BRANCH} Abrev. Hash: ${GIT_COMMIT_HASH} Date: ${GIT_COMMIT_DATE}\"") +add_definitions("-DPACKAGE_BUGREPORT=\"openair4g-devel@lists.eurecom.fr\"") + + + +# Debug related options +######################################### +add_boolean_option(ASN_DEBUG False "ASN1 coder/decoder Debug") +add_boolean_option(EMIT_ASN_DEBUG False "ASN1 coder/decoder Debug") +add_boolean_option(MSG_PRINT False "print debug messages") +add_boolean_option(DISABLE_XER_PRINT False "print XER Format") +add_boolean_option(XER_PRINT False "print XER Format") +add_boolean_option(RRC_MSG_PRINT False "print RRC messages") +add_boolean_option(PDCP_MSG_PRINT False "print PDCP messages to /tmp/pdcp.log") +add_boolean_option(DEBUG_PDCP_PAYLOAD False "print PDCP PDU to stdout") # if true, make sure that global and PDCP log levels are trace +add_boolean_option(DEBUG_MAC_INTERFACE False "print MAC-RLC PDU exchange to stdout") # if true, make sure that global and PDCP log levels are trace +add_boolean_option(TRACE_RLC_PAYLOAD False "print RLC PDU to stdout") # if true, make sure that global and PDCP log levels are trace +add_boolean_option(TEST_OMG False "???") +add_boolean_option(DEBUG_OMG False "???") +add_boolean_option(XFORMS False "This adds the possibility to see the signal oscilloscope") +add_boolean_option(PRINT_STATS False "This adds the possibility to see the status") +add_boolean_option(T_TRACER False "Activate the T tracer, a debugging/monitoring framework" ) +add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs") +add_boolean_option(UE_DEBUG_TRACE False "Activate UE debug trace") +add_boolean_option(UE_TIMING_TRACE False "Activate UE timing trace") +add_boolean_option(DISABLE_LOG_X False "Deactivate all LOG_* macros") +add_boolean_option(USRP_REC_PLAY False "Enable USRP record playback mode") + +add_boolean_option(DEBUG_CONSOLE False "makes debugging easier, disables stdout/stderr buffering") + +add_boolean_option(ENABLE_ITTI True "ITTI is internal messaging, should remain enabled for most targets") +set (ITTI_DIR ${OPENAIR_DIR}/common/utils/itti) +if (${ENABLE_ITTI}) + add_library(ITTI + # add .h files if depend on (this one is generated) + ${ITTI_DIR}/intertask_interface.h + ${ITTI_DIR}/intertask_interface.c + ${ITTI_DIR}/intertask_interface_dump.c + ${ITTI_DIR}/backtrace.c + ${ITTI_DIR}/memory_pools.c + ${ITTI_DIR}/signals.c + ${ITTI_DIR}/timer.c + ) + set(ITTI_LIB ITTI) + set(GTPU_need_ITTI ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_eNB.c) +endif (${ENABLE_ITTI}) + +############################# +# ASN.1 grammar C code generation & dependancies +################################ +# A difficulty: asn1c generates C code of a un-predictable list of files +# so, generate the c from asn1c once at cmake run time +# So, if someone modify the asn.1 source file in such as way that it will create +# (so creating new asn.1 objects instead of modifying the object attributes) +# New C code source file, cmake must be re-run (instead of re-running make only) +############# +set(asn1c_call "${OPENAIR_CMAKE}/tools/generate_asn1") +set(fix_asn1c_call "${OPENAIR_CMAKE}/tools/fix_asn1") +set(asn1_generated_dir ${OPENAIR_BIN_DIR}) + +set(protoc_call "${OPENAIR_CMAKE}/tools/generate_protobuf") +set(protobuf_generated_dir ${OPENAIR_BIN_DIR}) + +# RRC +###### + +add_list2_option(RRC_ASN1_VERSION "Rel14" "ASN.1 version of RRC interface" "Rel8" "Rel10" "Rel14" "CBA") + +if (${RRC_ASN1_VERSION} STREQUAL "Rel8") + set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-86.asn) +elseif (${RRC_ASN1_VERSION} STREQUAL "CBA") + set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20-lola.asn) +elseif (${RRC_ASN1_VERSION} STREQUAL "Rel10") + set (RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1c/ASN1_files/EUTRA-RRC-Definitions-a20.asn) +else() + 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_${RRC_ASN1_VERSION}) + +if(NOT EXISTS ${asn1c_call}) + message( FATAL_ERROR "The script ${asn1c_call} must be present" ) +endif(NOT EXISTS ${asn1c_call}) + +message("calling asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${RRC_FULL_DIR} ${RRC_GRAMMAR}") +execute_process(COMMAND ${asn1c_call} + ${RRC_FULL_DIR} + ${RRC_GRAMMAR} + RRC + RESULT_VARIABLE ret) + +if (NOT ${ret} STREQUAL 0) + message(FATAL_ERROR "${asn1c_call}: error") +endif (NOT ${ret} STREQUAL 0) + +if(NOT EXISTS ${fix_asn1c_call}) + message( FATAL_ERROR "The script ${fix_asn1c_call} must be present" ) +endif(NOT EXISTS ${fix_asn1c_call}) + +execute_process(COMMAND ${fix_asn1c_call} + ${RRC_FULL_DIR} + RRC + ${RRC_ASN1_VERSION} + RESULT_VARIABLE ret) + +if (NOT ${ret} STREQUAL 0) + message(FATAL_ERROR "${fix_asn1c_call}: error") +endif (NOT ${ret} STREQUAL 0) + +file(GLOB rrc_source ${RRC_FULL_DIR}/*.c) +file(GLOB rrc_h ${RRC_FULL_DIR}/*.h) +set(rrc_h ${rrc_h} ${RRC_FULL_DIR}/asn1_constants.h) +set_source_files_properties(${rrc_source} PROPERTIES COMPILE_FLAGS -w) # suppress warnings from generated code +add_library(RRC_LIB ${rrc_h} ${rrc_source} + ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1_msg.c + ${OPENAIR2_DIR}/RRC/LITE/MESSAGES/asn1_msg_NB_IoT.c) +include_directories ("${RRC_FULL_DIR}") + +# add the command to generate the source code +# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make +add_custom_command ( + OUTPUT ${RRC_FULL_DIR}/asn1_constants.h + COMMAND ${asn1c_call} ${RRC_FULL_DIR} ${RRC_GRAMMAR} + COMMAND ${fix_asn1c_call} ${RRC_FULL_DIR} RRC ${RRC_ASN1_VERSION} + DEPENDS ${RRC_GRAMMAR} + ) + + +#NR RRC +###### + +add_list2_option(NR_RRC_ASN1_VERSION "NR_Rel15" "ASN.1 version of NR_RRC interface") + +if (${NR_RRC_ASN1_VERSION} STREQUAL "NR_Rel15") + set (NR_RRC_GRAMMAR ${OPENAIR2_DIR}/RRC/NR/MESSAGES/asn1c/ASN1_files/NR-RRC-Definitions.asn) +endif (${NR_RRC_ASN1_VERSION} STREQUAL "NR_Rel15") + +set (NR_RRC_FULL_DIR ${asn1_generated_dir}/${NR_RRC_ASN1_VERSION}) + +if(NOT EXISTS ${asn1c_call}) +message( FATAL_ERROR "The script ${asn1c_call} must be present" ) +endif(NOT EXISTS ${asn1c_call}) + +message("calling ASN1C_PREFIX=NR_ asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${RRC_FULL_DIR} ${RRC_GRAMMAR}") +execute_process(COMMAND ${asn1c_call} + ${NR_RRC_FULL_DIR} + ${NR_RRC_GRAMMAR} + NR_RRC + RESULT_VARIABLE ret) + +if (NOT ${ret} STREQUAL 0) + message(FATAL_ERROR "${asn1c_call}: error") +endif (NOT ${ret} STREQUAL 0) + +if(NOT EXISTS ${fix_asn1c_call}) + message( FATAL_ERROR "The script ${fix_asn1c_call} must be present" ) +endif(NOT EXISTS ${fix_asn1c_call}) + +execute_process(COMMAND ${fix_asn1c_call} + ${NR_RRC_FULL_DIR} + NR_RRC + ${NR_RRC_ASN1_VERSION} + RESULT_VARIABLE ret) + +if (NOT ${ret} STREQUAL 0) + message(FATAL_ERROR "${fix_asn1c_call}: error") +endif (NOT ${ret} STREQUAL 0) + +file(GLOB nr_rrc_source ${NR_RRC_FULL_DIR}/*.c) +file(GLOB nr_rrc_h ${NR_RRC_FULL_DIR}/*.h) +set(nr_rrc_h ${nr_rrc_h} ${NR_RRC_FULL_DIR}/asn1_constants.h) +set_source_files_properties(${nr_rrc_source} PROPERTIES COMPILE_FLAGS -w) # suppress warnings from generated code +add_library(NR_RRC_LIB ${nr_rrc_h} ${nr_rrc_source} + ${OPENAIR2_DIR}/RRC/NR/MESSAGES/asn1_msg.c) +include_directories ("${NR_RRC_FULL_DIR}") + +# add the command to generate the source code +# Warning: if you modify ASN.1 source file to generate new C files, cmake should be re-run instead of make + +add_custom_command ( + OUTPUT ${NR_RRC_FULL_DIR}/asn1_constants.h + COMMAND ${asn1c_call} ${NR_RRC_FULL_DIR} ${NR_RRC_GRAMMAR} RRC + COMMAND ${fix_asn1c_call} ${NR_RRC_FULL_DIR} RRC ${NR_RRC_ASN1_VERSION} + DEPENDS ${RRC_GRAMMAR} + ) + +# S1AP +# Same limitation as described in RRC: unknown generated file list +# so we generate it at cmake time +############## +add_list1_option(S1AP_VERSION R14 "S1AP Asn.1 grammar version" R8 R9 R10 R14) + +set(S1AP_DIR ${OPENAIR3_DIR}/S1AP) + +if (${S1AP_VERSION} STREQUAL "R14") + set (ASN1RELDIR R14.4) + add_definitions("-DUPDATE_RELEASE_9 -DUPDATE_RELEASE_10 -DUPDATE_RELEASE_14") + set(S1AP_ASN_FILES s1ap-14.4.0.asn1) +elseif (${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") + set (ASN1RELDIR R8.10) +endif(${S1AP_VERSION} STREQUAL "R14") + +set(S1AP_ASN_DIR ${S1AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR}) +set(S1AP_C_DIR ${asn1_generated_dir}/S1AP_${ASN1RELDIR}) + +message("calling ASN1C_PREFIX=S1AP_ asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${S1AP_C_DIR} ${S1AP_ASN_DIR}/${S1AP_ASN_FILES}") + +execute_process(COMMAND mkdir -p ${S1AP_C_DIR} + COMMAND env "ASN1C_PREFIX=S1AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${S1AP_C_DIR} ${S1AP_ASN_DIR}/${S1AP_ASN_FILES} + RESULT_VARIABLE ret) + +if (NOT ${ret} STREQUAL 0) + message(FATAL_ERROR "${ret}: error") +endif (NOT ${ret} STREQUAL 0) + +file(GLOB S1AP_source ${S1AP_C_DIR}/*.c) +file(GLOB s1ap_h ${S1AP_C_DIR}/*.h) +set(s1ap_h ${s1ap_h} ) + +add_custom_command ( + OUTPUT ${S1AP_C_DIR}/S1AP_asn_constant.h + COMMAND mkdir -p ${S1AP_C_DIR} + COMMAND env "ASN1C_PREFIX=S1AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${S1AP_C_DIR} ${S1AP_ASN_DIR}/${S1AP_ASN_FILES} + DEPENDS ${S1AP_ASN_DIR}/${S1AP_ASN_FILES} +) + +add_library(S1AP_LIB + ${S1AP_source} + ${S1AP_DIR}/s1ap_common.c + ) + +include_directories ("${S1AP_C_DIR}") +include_directories ("${S1AP_DIR}") + +add_library(S1AP_ENB + # ${S1AP_C_DIR}/s1ap_ies_defs.h + ${S1AP_DIR}/s1ap_eNB.c + ${S1AP_DIR}/s1ap_eNB_context_management_procedures.c + ${S1AP_DIR}/s1ap_eNB_encoder.c + ${S1AP_DIR}/s1ap_eNB_handlers.c + ${S1AP_DIR}/s1ap_eNB_itti_messaging.c + ${S1AP_DIR}/s1ap_eNB_management_procedures.c + ${S1AP_DIR}/s1ap_eNB_nas_procedures.c + ${S1AP_DIR}/s1ap_eNB_nnsf.c + ${S1AP_DIR}/s1ap_eNB_overload.c + ${S1AP_DIR}/s1ap_eNB_trace.c + ${S1AP_DIR}/s1ap_eNB_ue_context.c + ${S1AP_DIR}/s1ap_eNB_decoder.c + ) + + + +#X2AP +# Same limitation as described in RRC/S1AP: unknown generated file list +# so we generate it at cmake time +############## +add_list1_option(X2AP_VERSION R14 "X2AP Asn.1 grammar version" R10 R11 R14) +set(X2AP_DIR ${OPENAIR2_DIR}/X2AP) +if (${X2AP_VERSION} STREQUAL "R14") + set (ASN1RELDIR R14.5) + set (X2AP_ASN_FILES x2ap-14.5.0.asn1) +elseif (${X2AP_VERSION} STREQUAL "R11") + set (ASN1RELDIR R11.2) +elseif (${X2AP_VERSION} STREQUAL "R10") + set (ASN1RELDIR R.UNKNOWN) +endif(${X2AP_VERSION} STREQUAL "R14") +set(X2AP_ASN_DIR ${X2AP_DIR}/MESSAGES/ASN1/${ASN1RELDIR}) + +set(X2AP_C_DIR ${asn1_generated_dir}/X2AP_${ASN1RELDIR}) +message("calling asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${X2AP_C_DIR} ${X2AP_ASN_DIR}/${X2AP_ASN_FILES}") +execute_process(COMMAND mkdir -p ${X2AP_C_DIR} + COMMAND env "ASN1C_PREFIX=X2AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${X2AP_C_DIR} ${X2AP_ASN_DIR}/${X2AP_ASN_FILES} + RESULT_VARIABLE ret) +if (NOT ${ret} STREQUAL 0) + message(FATAL_ERROR "${asn1c_call}: error") +endif (NOT ${ret} STREQUAL 0) +file(GLOB X2AP_source ${X2AP_C_DIR}/*.c) + +file(GLOB x2ap_h ${X2AP_C_DIR}/*.h) +set(x2ap_h ${x2ap_h} ) + +add_custom_command ( + OUTPUT ${X2AP_C_DIR}/X2AP_asn_constant.h + COMMAND mkdir -p ${X2AP_C_DIR} + COMMAND env "ASN1C_PREFIX=X2AP_" asn1c -pdu=all -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example -D ${X2AP_C_DIR} ${X2AP_ASN_DIR}/${X2AP_ASN_FILES} + DEPENDS ${X2AP_ASN_DIR}/${X2AP_ASN_FILES} + ) + +add_library(X2AP_LIB + ${X2AP_source} + ${X2AP_DIR}/x2ap_common.c + ) + +include_directories ("${X2AP_C_DIR}") +include_directories ("${X2AP_DIR}") + +# Hardware dependant options +################################### +add_list1_option(NB_ANTENNAS_RX "2" "Number of antennas in reception" "1" "2" "4") +add_list1_option(NB_ANTENNAS_TX "4" "Number of antennas in transmission" "1" "2" "4") + +add_list2_option(RF_BOARD "EXMIMO" "RF head type" "None" "EXMIMO" "OAI_USRP" "OAI_BLADERF" "CPRIGW" "OAI_LMSSDR") + +add_list2_option(TRANSP_PRO "None" "Transport protocol type" "None" "ETHERNET") +#NOKIA config enhancement +set (CONFIG_ROOTDIR + ${OPENAIR_DIR}/common/config + ) +set (CONFIG_SOURCES + ${CONFIG_ROOTDIR}/config_load_configmodule.c + ${CONFIG_ROOTDIR}/config_userapi.c + ${CONFIG_ROOTDIR}/config_cmdline.c + ) +set (CONFIG_LIBCONFIG_SOURCES + ${CONFIG_ROOTDIR}/libconfig/config_libconfig.c + ) +add_library(params_libconfig MODULE ${CONFIG_LIBCONFIG_SOURCES} ) +target_link_libraries(params_libconfig config) +# shared library loader +set (SHLIB_LOADER_SOURCES + ${OPENAIR_DIR}/common/utils/load_module_shlib.c +) +# include RF devices / transport protocols library modules +###################################################################### + +include_directories("${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/") +include_directories ("${OPENAIR_TARGETS}/ARCH/EXMIMO/DEFS/") +#set (option_HWEXMIMOLIB_lib "-l ") +set(HWLIB_EXMIMO_SOURCE + ${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c +# ${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/gain_control.c + ) +add_library(oai_exmimodevif MODULE ${HWLIB_EXMIMO_SOURCE} ) + +include_directories("${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/") +set(HWLIB_USRP_SOURCE + ${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp + ) +add_library(oai_usrpdevif MODULE ${HWLIB_USRP_SOURCE} ) +target_link_libraries(oai_usrpdevif uhd) + +include_directories("${OPENAIR_TARGETS}/ARCH/BLADERF/USERSPACE/LIB/") +set(HWLIB_BLADERF_SOURCE + ${OPENAIR_TARGETS}/ARCH/BLADERF/USERSPACE/LIB/bladerf_lib.c + ) +add_library(oai_bladerfdevif MODULE ${HWLIB_BLADERF_SOURCE} ) +target_link_libraries(oai_bladerfdevif bladeRF) + +include_directories("${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/") + +set(HWLIB_LMSSDR_SOURCE + ${OPENAIR_TARGETS}/ARCH/LMSSDR/USERSPACE/LIB/lms_lib.cpp + ) +add_library(oai_lmssdrdevif MODULE ${HWLIB_LMSSDR_SOURCE} ) +target_include_directories(oai_lmssdrdevif PRIVATE /usr/local/include/lime) +target_link_libraries(oai_lmssdrdevif LimeSuite ) + +include_directories("${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/") +set(TPLIB_ETHERNET_SOURCE + ${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/ethernet_lib.c + ${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/eth_udp.c + ${OPENAIR_TARGETS}/ARCH/ETHERNET/USERSPACE/LIB/eth_raw.c + ) +add_library(oai_eth_transpro MODULE ${TPLIB_ETHERNET_SOURCE} ) + +include_directories("${OPENAIR_TARGETS}/ARCH/mobipass/") +set(TPLIB_MOBIPASS_SOURCE + ${OPENAIR_TARGETS}/ARCH/mobipass/interface.c + ${OPENAIR_TARGETS}/ARCH/mobipass/mobipass.c + ${OPENAIR_TARGETS}/ARCH/mobipass/queues.c + ) +add_library(oai_mobipass MODULE ${TPLIB_MOBIPASS_SOURCE} ) + +# Hide all functions/variables in the mobipass library. +# Use __attribute__((__visibility__("default"))) +# in the source code to unhide a function/variable. +get_target_property(mobipas_cflags oai_mobipass COMPILE_FLAGS) +set_target_properties(oai_mobipass PROPERTIES COMPILE_FLAGS "${mobipass_cflags} -fvisibility=hidden") + +set(HWLIB_TCP_BRIDGE_SOURCE + ${OPENAIR_TARGETS}/ARCH/tcp_bridge/tcp_bridge.c + ) +add_library(oai_tcp_bridge MODULE ${HWLIB_TCP_BRIDGE_SOURCE} ) + +#get_target_property(tcp_bridge_cflags oai_tcp_bridge COMPILE_FLAGS) +#set_target_properties(oai_tcp_bridge PROPERTIES COMPILE_FLAGS "${tcp_bridge_cflags} -fvisibility=hidden") +set_target_properties(oai_tcp_bridge PROPERTIES COMPILE_FLAGS "-fvisibility=hidden") + +########################################################## + +include_directories ("${OPENAIR_TARGETS}/ARCH/COMMON") + +Message("DEADLINE_SCHEDULER flag is ${DEADLINE_SCHEDULER}") +Message("CPU_Affinity flag is ${CPU_AFFINITY}") + +############################################################## +# ???!!! TO BE DOCUMENTED OPTIONS !!!??? +############################################################## +add_boolean_option(ENABLE_SECURITY True "Enable LTE integrity and ciphering between RRC UE and eNB") +add_boolean_option(ENABLE_USE_MME True "eNB connected to MME (INTERFACE S1-C), not standalone eNB") +add_boolean_option(NO_RRM True "DO WE HAVE A RADIO RESSOURCE MANAGER: NO") +add_boolean_option(RRC_DEFAULT_RAB_IS_AM False "set the RLC mode to AM for the default bearer") + +add_boolean_option(OAI_NW_DRIVER_TYPE_ETHERNET False "????") +add_boolean_option(DEADLINE_SCHEDULER True "Use the Linux scheduler SCHED_DEADLINE: kernel >= 3.14") +add_boolean_option(CPU_AFFINITY False "Enable CPU Affinity of threads (only valid without deadline scheduler). It is enabled only with >2 CPUs") +add_boolean_option(NAS_ADDRESS_FIX False "specific to oaisim: for nasmesh driver") +add_boolean_option(NAS_NETLINK False "useless ??? Must be True to compile nasmesh driver without rtai ????") +add_boolean_option(OAISIM False "specific to oaisim") +add_boolean_option(OAI_NW_DRIVER_USE_NETLINK True "????") + +add_boolean_option(USE_MME False "this flag is used only one time in lte-softmodem.c") +add_list_string_option(PACKAGE_NAME "NotDefined" "As per attribute name") +add_boolean_option(MESSAGE_CHART_GENERATOR False "For generating sequence diagrams") +add_boolean_option(MESSAGE_CHART_GENERATOR_RLC_MAC False "trace RLC-MAC exchanges in sequence diagrams") +add_boolean_option(MESSAGE_CHART_GENERATOR_PHY False "trace some PHY exchanges in sequence diagrams") + +######################## +# Include order +########################## +add_boolean_option(ENB_MODE True "Swap the include directories between openair2 and openair3" ) + +########################## +# SCHEDULING/REAL-TIME/PERF options +########################## +add_boolean_option(ENABLE_USE_CPU_EXECUTION_TIME True "Add data in vcd traces: disable it if perf issues") +add_boolean_option(ENABLE_VCD True "always true now, time measurements of proc calls and var displays") +add_boolean_option(ENABLE_VCD_FIFO True "time measurements of proc calls and var displays sent to FIFO (one more thread)") +add_boolean_option(LINUX False "used in weird memcpy() in pdcp.c ???") +add_boolean_option(LINUX_LIST False "used only in lists.c: either use OAI implementation of lists or Linux one (should be True, but it is False") +add_boolean_option(LOG_NO_THREAD True "Disable thread for log, seems always set to true") +add_boolean_option(OPENAIR_LTE True "Seems legacy: keep it to true") + +########################## +# PHY options +########################## +add_boolean_option(DRIVER2013 True "only relevant for EXMIMO") +add_boolean_option(ENABLE_NEW_MULTICAST False "specific to oaisim") +add_boolean_option(EXMIMO_IOT True "????") +add_boolean_option(LARGE_SCALE False "specific to oaisim: defines max eNB=2 and max UE=120") +add_boolean_option(LOCALIZATION False "???") +add_integer_option(MAX_NUM_CCs 1 "????") +add_boolean_option(MU_RECEIVER False "????") +add_boolean_option(PHYSIM True "for L1 simulators (dlsim, ulsim, ...)") +add_boolean_option(PHY_CONTEXT True "not clear: must remain False for dlsim") +add_boolean_option(PHY_EMUL False "not clear: must remain False for dlsim") +add_boolean_option(SMBV False "Rohde&Schwarz SMBV100A vector signal generator") +add_boolean_option(DEBUG_PHY False "Enable PHY layer debugging options") +add_boolean_option(DEBUG_PHY_PROC False "Enable debugging of PHY layer procedures") +add_boolean_option(DEBUG_DLSCH False "Enable debugging of DLSCH physical layer channel") + +########################## +# 802.21 options +########################## +add_boolean_option(ENABLE_RAL False "ENABLE 802.21 INTERFACE") +add_boolean_option(USE_3GPP_ADDR_AS_LINK_ADDR False "As per attribute name") + +########################## +# NAS LAYER OPTIONS +########################## +add_boolean_option(ENABLE_NAS_UE_LOGGING True "????") +add_boolean_option(NAS_BUILT_IN_UE True "UE NAS layer present in this executable") +add_boolean_option(NAS_UE True "NAS UE INSTANCE (<> NAS_MME)") + + +########################## +# ACCESS STRATUM LAYER2 OPTIONS +########################## +add_boolean_option(MAC_CONTEXT True "specific to oaisim") +add_boolean_option(JUMBO_FRAME True "ENABLE LARGE SDU in ACCESS STRATUM (larger than common MTU)") + +########################## +# RLC LAYER OPTIONS +########################## +add_boolean_option(OPENAIR2 True "Access Stratum layer 2 built in executable") +add_boolean_option(TRACE_RLC_PAYLOAD False "Fatal assert in this case") +add_boolean_option(RLC_STOP_ON_LOST_PDU False "Fatal assert in this case") + +add_boolean_option(TRACE_RLC_MUTEX True "TRACE for RLC, possible problem in thread scheduling") +add_boolean_option(TRACE_RLC_AM_BO False "TRACE for RLC AM, TO BE CHANGED IN A MORE GENERAL FLAG") +add_boolean_option(TRACE_RLC_AM_FREE_SDU False "TRACE for RLC AM, TO BE CHANGED IN A MORE GENERAL FLAG") +add_boolean_option(TRACE_RLC_AM_HOLE False "TRACE for RLC AM, TO BE CHANGED IN A MORE GENERAL FLAG") +add_boolean_option(TRACE_RLC_AM_PDU False "TRACE for RLC AM, TO BE CHANGED IN A MORE GENERAL FLAG") +add_boolean_option(TRACE_RLC_AM_RESEGMENT False "TRACE for RLC AM, TO BE CHANGED IN A MORE GENERAL FLAG") +add_boolean_option(TRACE_RLC_AM_RX False "TRACE for RLC AM, TO BE CHANGED IN A MORE GENERAL FLAG") +add_boolean_option(TRACE_RLC_AM_RX_DECODE False "TRACE for RLC AM, TO BE CHANGED IN A MORE GENERAL FLAG") +add_boolean_option(TRACE_RLC_AM_TX False "TRACE for RLC AM, TO BE CHANGED IN A MORE GENERAL FLAG") +add_boolean_option(TRACE_RLC_AM_TX_STATUS False "TRACE for RLC AM, TO BE CHANGED IN A MORE GENERAL FLAG") +add_boolean_option(TRACE_RLC_AM_STATUS_CREATION False "TRACE for RLC AM, TO BE CHANGED IN A MORE GENERAL FLAG") + +add_boolean_option(STOP_ON_IP_TRAFFIC_OVERLOAD False "") +add_boolean_option(TRACE_RLC_UM_DAR False "TRACE for RLC UM, TO BE CHANGED IN A MORE GENERAL FLAG") +add_boolean_option(TRACE_RLC_UM_DISPLAY_ASCII_DATA False "TRACE for RLC UM, TO BE CHANGED IN A MORE GENERAL FLAG") +add_boolean_option(TRACE_RLC_UM_PDU False "TRACE for RLC UM, TO BE CHANGED IN A MORE GENERAL FLAG") +add_boolean_option(TRACE_RLC_UM_RX False "TRACE for RLC UM, TO BE CHANGED IN A MORE GENERAL FLAG") +add_boolean_option(TRACE_RLC_UM_SEGMENT False "TRACE for RLC UM, TO BE CHANGED IN A MORE GENERAL FLAG") +add_boolean_option(TRACE_RLC_UM_TX_STATUS False "TRACE for RLC UM, TO BE CHANGED IN A MORE GENERAL FLAG") + + +########################## +# PDCP LAYER OPTIONS +########################## +add_boolean_option(PDCP_USE_NETLINK False "For eNB, PDCP communicate with a NETLINK socket if connected to network driver, else could use a RT-FIFO") +add_boolean_option(PDCP_USE_NETLINK_QUEUES False "When PDCP_USE_NETLINK is true, incoming IP packets are stored in queues") +add_boolean_option(LINK_ENB_PDCP_TO_IP_DRIVER False "For eNB, PDCP communicate with a IP driver") +add_boolean_option(LINK_ENB_PDCP_TO_GTPV1U True "For eNB, PDCP communicate with GTP-U protocol (eNB<->S-GW)") + +########################## +# RRC LAYER OPTIONS +########################## +add_boolean_option(RRC_DEFAULT_RAB_IS_AM False "Otherwise it is UM, configure params are actually set in rrc_eNB.c:rrc_eNB_generate_defaultRRCConnectionReconfiguration(...)") + + +########################## +# S1AP LAYER OPTIONS +########################## +# none + +# add the binary tree to the search path for include files +####################################################### +# We will find ConfigOAI.h after generation in target directory +include_directories("${OPENAIR_BIN_DIR}") +# add directories to find all include files +# the internal rule is to use generic names such as defs.h +# but to make it uniq name as adding the relative path in the include directtive +# example: #include "RRC/LITE/defs.h" +#find_path (include_dirs_all *.h ${OPENAIR_DIR}) +#find_path (include_dirs_all *.h PATHS /usr/include NO_CMAKE_PATH) +#include_directories("${include_dirs_all}") + +# Legacy exact order +if(ENB_MODE) + include_directories("${OPENAIR2_DIR}/COMMON") + include_directories("${OPENAIR2_DIR}/UTIL") + include_directories("${OPENAIR2_DIR}/UTIL/LOG") + include_directories("${OPENAIR3_DIR}/COMMON") + include_directories("${OPENAIR3_DIR}/UTILS") +else() + include_directories("${OPENAIR3_DIR}/COMMON") + include_directories("${OPENAIR3_DIR}/UTILS") + include_directories("${OPENAIR2_DIR}/COMMON") + include_directories("${OPENAIR2_DIR}/UTIL") + include_directories("${OPENAIR2_DIR}/UTIL/LOG") +endif() +include_directories("${NFAPI_DIR}/nfapi/public_inc") +include_directories("${NFAPI_DIR}/common/public_inc") +include_directories("${NFAPI_DIR}/pnf/public_inc") +include_directories("${NFAPI_DIR}/nfapi/inc") +include_directories("${NFAPI_DIR}/sim_common/inc") +include_directories("${NFAPI_DIR}/pnf_sim/inc") +include_directories("${OPENAIR1_DIR}") +include_directories("${OPENAIR2_DIR}") +include_directories("${OPENAIR2_DIR}/LAYER2/RLC") +include_directories("${OPENAIR2_DIR}/LAYER2/RLC/AM_v9.3.0") +include_directories("${OPENAIR2_DIR}/LAYER2/RLC/UM_v9.3.0") +include_directories("${OPENAIR2_DIR}/LAYER2/RLC/TM_v9.3.0") +include_directories("${OPENAIR2_DIR}/LAYER2/PDCP_v10.1.0") +include_directories("${OPENAIR2_DIR}/RRC/LITE/MESSAGES") +include_directories("${OPENAIR2_DIR}/RRC/LITE") +include_directories("${OPENAIR3_DIR}/RAL-LTE/INTERFACE-802.21/INCLUDE") +include_directories("${OPENAIR3_DIR}/RAL-LTE/LTE_RAL_ENB/INCLUDE") +include_directories("${OPENAIR3_DIR}/RAL-LTE/LTE_RAL_UE/INCLUDE") +include_directories("${OPENAIR_DIR}/common/utils") +include_directories("${OPENAIR_DIR}/common/utils/itti") +include_directories("${OPENAIR3_DIR}/NAS/COMMON") +include_directories("${OPENAIR3_DIR}/NAS/COMMON/API/NETWORK") +include_directories("${OPENAIR3_DIR}/NAS/COMMON/EMM/MSG") +include_directories("${OPENAIR3_DIR}/NAS/COMMON/ESM/MSG") +include_directories("${OPENAIR3_DIR}/NAS/COMMON/IES") +include_directories("${OPENAIR3_DIR}/NAS/COMMON/UTIL") +include_directories("${OPENAIR3_DIR}/SECU") +include_directories("${OPENAIR3_DIR}/SCTP") +include_directories("${OPENAIR3_DIR}/S1AP") +include_directories("${OPENAIR2_DIR}/X2AP") +include_directories("${OPENAIR3_DIR}/UDP") +include_directories("${OPENAIR3_DIR}/GTPV1-U") +include_directories("${OPENAIR_DIR}/targets/COMMON") +include_directories("${OPENAIR_DIR}/targets/ARCH/COMMON") +include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/USERSPACE/LIB/") +include_directories("${OPENAIR_DIR}/targets/ARCH/EXMIMO/DEFS") +include_directories("${OPENAIR2_DIR}/ENB_APP") +include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC") +include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/RRC") +include_directories("${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PDCP") +include_directories("${OPENAIR2_DIR}/UTIL/OSA") +include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds6.1.1/liblfds611/inc") +include_directories("${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/inc") +include_directories("${OPENAIR2_DIR}/UTIL/MEM") +include_directories("${OPENAIR2_DIR}/UTIL/LISTS") +include_directories("${OPENAIR2_DIR}/UTIL/FIFO") +include_directories("${OPENAIR2_DIR}/UTIL/OCG") +include_directories("${OPENAIR2_DIR}/UTIL/MATH") +include_directories("${OPENAIR2_DIR}/UTIL/TIMER") +include_directories("${OPENAIR2_DIR}/UTIL/OMG") +include_directories("${OPENAIR2_DIR}/UTIL/OTG") +include_directories("${OPENAIR2_DIR}/UTIL/CLI") +include_directories("${OPENAIR2_DIR}/UTIL/OPT") +include_directories("${OPENAIR2_DIR}/UTIL/OMV") +include_directories("${OPENAIR2_DIR}/RRC/LITE/MESSAGES") +include_directories("${OPENAIR3_DIR}/GTPV1-U/nw-gtpv1u/shared") +include_directories("${OPENAIR3_DIR}/GTPV1-U/nw-gtpv1u/include") +include_directories("${OPENAIR_DIR}") + +# Utilities Library +################ +# set the version of protobuf messages, V3 not supported yet +add_list1_option(FLPT_VERSION V2 "FLPT MSG protobuf grammar version" V2 V3) + +if (${FLPT_VERSION} STREQUAL "V2") + set (FLPTDIR V2) +elseif (${FLPT_VERSION} STREQUAL "V3") + set (FLPTDIR V3) +endif(${FLPT_VERSION} STREQUAL "V2") + +set(FLPT_MSG_DIR ${OPENAIR2_DIR}/ENB_APP/MESSAGES/${FLPTDIR} ) +set(FLPT_MSG_FILES + ${FLPT_MSG_DIR}/header.proto + ${FLPT_MSG_DIR}/flexran.proto + ${FLPT_MSG_DIR}/stats_common.proto + ${FLPT_MSG_DIR}/stats_messages.proto + ${FLPT_MSG_DIR}/time_common.proto + ${FLPT_MSG_DIR}/controller_commands.proto + ${FLPT_MSG_DIR}/mac_primitives.proto + ${FLPT_MSG_DIR}/config_messages.proto + ${FLPT_MSG_DIR}/config_common.proto + ${FLPT_MSG_DIR}/control_delegation.proto + ) + +set(FLPT_C_DIR ${protobuf_generated_dir}/${FLPTDIR}) +#message("calling protoc_call=${protoc_call} FLPT_C_DIR=${FLPT_C_DIR} FLPT_MSG_FILES=${FLPT_MSG_FILES}") +execute_process(COMMAND ${protoc_call} ${FLPT_C_DIR} ${FLPT_MSG_DIR} ${FLPT_MSG_FILES}) +file(GLOB FLPT_source ${FLPT_C_DIR}/*.c) +set(FLPT_OAI_generated + ${FLPT_C_DIR}/header.pb-c.c + ${FLPT_C_DIR}/flexran.pb-c.c + ${FLPT_C_DIR}/stats_common.pb-c.c + ${FLPT_C_DIR}/stats_messages.pb-c.c + ${FLPT_C_DIR}/time_common.pb-c.c + ${FLPT_C_DIR}/controller_commands.pb-c.c + ${FLPT_C_DIR}/mac_primitives.pb-c.c + ${FLPT_C_DIR}/config_messages.pb-c.c + ${FLPT_C_DIR}/config_common.pb-c.c + ${FLPT_C_DIR}/control_delegation.pb-c.c + ) + +file(GLOB flpt_h ${FLPT_C_DIR}/*.h) +set(flpt_h ${flpt_h} ) + +add_library(FLPT_MSG + ${FLPT_OAI_generated} + ${FLPT_source} + ) +set(FLPT_MSG_LIB FLPT_MSG) +#message("prpt c dir is : ${FLPT_C_DIR}") +include_directories (${FLPT_C_DIR}) + +add_library(ASYNC_IF + ${OPENAIR2_DIR}/UTIL/ASYNC_IF/socket_link.c + ${OPENAIR2_DIR}/UTIL/ASYNC_IF/link_manager.c + ${OPENAIR2_DIR}/UTIL/ASYNC_IF/message_queue.c + ${OPENAIR2_DIR}/UTIL/ASYNC_IF/ringbuffer_queue.c + ) +set(ASYNC_IF_LIB ASYNC_IF) +include_directories(${OPENAIR2_DIR}/UTIL/ASYNC_IF) + +add_library(FLEXRAN_AGENT + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_handler.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_common.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_ran_api.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_timer.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_common_internal.c + ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac.c + ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/RRC/flexran_agent_rrc.c + ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/PDCP/flexran_agent_pdcp.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_task_manager.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_net_comm.c + ${OPENAIR2_DIR}/ENB_APP/flexran_agent_async.c + ${OPENAIR2_DIR}/ENB_APP/CONTROL_MODULES/MAC/flexran_agent_mac_internal.c + ) +set(FLEXRAN_AGENT_LIB FLEXRAN_AGENT) +#include_directories(${OPENAIR2_DIR}/ENB_APP) + +set(PROTOBUF_LIB "protobuf-c") + +FIND_PATH(LIBYAML_INCLUDE_DIR NAMES yaml.h) +FIND_LIBRARY(LIBYAML_LIBRARIES NAMES yaml libyaml) + +INCLUDE(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Yaml DEFAULT_MSG LIBYAML_LIBRARIES LIBYAML_INCLUDE_DIR) +MARK_AS_ADVANCED(LIBYAML_INCLUDE_DIR LIBYAML_LIBRARIES) + +#set(PROTOBUF_LIB "protobuf") #for Cpp + + +add_library(HASHTABLE + ${OPENAIR_DIR}/common/utils/hashtable/hashtable.c + ${OPENAIR_DIR}/common/utils/hashtable/obj_hashtable.c +) +include_directories(${OPENAIR_DIR}/common/utils/hashtable) + +if (MESSAGE_CHART_GENERATOR) + add_library(MSC + ${OPENAIR_DIR}/common/utils/msc/msc.c + ) + set(MSC_LIB MSC) +endif() +include_directories(${OPENAIR_DIR}/common/utils/msc) + +set(UTIL_SRC + ${OPENAIR2_DIR}/UTIL/CLI/cli.c + ${OPENAIR2_DIR}/UTIL/CLI/cli_cmd.c + ${OPENAIR2_DIR}/UTIL/CLI/cli_server.c + ${OPENAIR2_DIR}/UTIL/FIFO/pad_list.c + ${OPENAIR2_DIR}/UTIL/LISTS/list.c + ${OPENAIR2_DIR}/UTIL/LISTS/list2.c + ${OPENAIR2_DIR}/UTIL/LOG/log.c + ${OPENAIR2_DIR}/UTIL/LOG/vcd_signal_dumper.c + ${OPENAIR2_DIR}/UTIL/MATH/oml.c + ${OPENAIR2_DIR}/UTIL/MEM/mem_block.c + ${OPENAIR2_DIR}/UTIL/OCG/OCG.c + ${OPENAIR2_DIR}/UTIL/OCG/OCG_create_dir.c + ${OPENAIR2_DIR}/UTIL/OCG/OCG_detect_file.c + ${OPENAIR2_DIR}/UTIL/OCG/OCG_generate_report.c + ${OPENAIR2_DIR}/UTIL/OCG/OCG_parse_filename.c + ${OPENAIR2_DIR}/UTIL/OCG/OCG_parse_XML.c + ${OPENAIR2_DIR}/UTIL/OCG/OCG_save_XML.c + ${OPENAIR2_DIR}/UTIL/OMG/common.c + ${OPENAIR2_DIR}/UTIL/OMG/grid.c + ${OPENAIR2_DIR}/UTIL/OMG/job.c + ${OPENAIR2_DIR}/UTIL/OMG/mobility_parser.c + ${OPENAIR2_DIR}/UTIL/OMG/omg.c + #${OPENAIR2_DIR}/UTIL/OMG/omg_hashtable.c + ${OPENAIR2_DIR}/UTIL/OMG/rwalk.c + ${OPENAIR2_DIR}/UTIL/OMG/rwp.c + ${OPENAIR2_DIR}/UTIL/OMG/static.c + ${OPENAIR2_DIR}/UTIL/OMG/steadystaterwp.c + ${OPENAIR2_DIR}/UTIL/OMG/trace.c + ${OPENAIR2_DIR}/UTIL/OMG/trace_hashtable.c + ${OPENAIR2_DIR}/UTIL/OPT/probe.c + ${OPENAIR2_DIR}/UTIL/OTG/otg_tx.c + ${OPENAIR2_DIR}/UTIL/OTG/otg.c + ${OPENAIR2_DIR}/UTIL/OTG/otg_kpi.c + ${OPENAIR2_DIR}/UTIL/OTG/otg_models.c + ${OPENAIR2_DIR}/UTIL/OTG/otg_form.c + ${OPENAIR2_DIR}/UTIL/OTG/otg_rx.c + ) +add_library(UTIL ${UTIL_SRC}) + +#set(OMG_SUMO_SRC +# ${OPENAIR2_DIR}/UTIL/OMG/client_traci_OMG.c +# ${OPENAIR2_DIR}/UTIL/OMG/id_manager.c +# ${OPENAIR2_DIR}/UTIL/OMG/sumo.c +# ${OPENAIR2_DIR}/UTIL/OMG/socket_traci_OMG.c +# ${OPENAIR2_DIR}/UTIL/OMG/storage_traci_OMG.c +# ) +#add_library(OMG_SUMO ${OMG_SUMO_SRC}) + +set(SECU_OSA_SRC + ${OPENAIR2_DIR}/UTIL/OSA/osa_key_deriver.c + ${OPENAIR2_DIR}/UTIL/OSA/osa_rijndael.c + ${OPENAIR2_DIR}/UTIL/OSA/osa_snow3g.c + ${OPENAIR2_DIR}/UTIL/OSA/osa_stream_eea.c + ${OPENAIR2_DIR}/UTIL/OSA/osa_stream_eia.c + ) +add_library(SECU_OSA ${SECU_OSA_SRC}) + +set(SECU_CN_SRC + ${OPENAIR3_DIR}/SECU/kdf.c + ${OPENAIR3_DIR}/SECU/rijndael.c + ${OPENAIR3_DIR}/SECU/snow3g.c + ${OPENAIR3_DIR}/SECU/key_nas_deriver.c + ${OPENAIR3_DIR}/SECU/nas_stream_eea1.c + ${OPENAIR3_DIR}/SECU/nas_stream_eia1.c + ${OPENAIR3_DIR}/SECU/nas_stream_eea2.c + ${OPENAIR3_DIR}/SECU/nas_stream_eia2.c + ) +add_library(SECU_CN ${SECU_CN_SRC}) + +# Scheduler +################################" +set(SCHED_SRC + ${OPENAIR1_DIR}/SCHED/fapi_l1.c + ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_eNb.c + ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_ue.c + ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_common.c + ${OPENAIR1_DIR}/SCHED/prach_procedures.c + ${OPENAIR1_DIR}/SCHED/ru_procedures.c +# ${OPENAIR1_DIR}/SCHED/phy_mac_stub.c + ${OPENAIR1_DIR}/SCHED/pucch_pc.c + ${OPENAIR1_DIR}/SCHED/pusch_pc.c + ${OPENAIR1_DIR}/SCHED/srs_pc.c +) +add_library(SCHED_LIB ${SCHED_SRC}) + +set(SCHED_SRC_UE + ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_ue.c + ${OPENAIR1_DIR}/SCHED/phy_procedures_lte_common.c + ${OPENAIR1_DIR}/SCHED/ru_procedures.c + ${OPENAIR1_DIR}/SCHED/prach_procedures.c + ${OPENAIR1_DIR}/SCHED/pucch_pc.c + ${OPENAIR1_DIR}/SCHED/pusch_pc.c + ${OPENAIR1_DIR}/SCHED/srs_pc.c +) +add_library(SCHED_UE_LIB ${SCHED_SRC_UE}) + +# nFAPI +################################# +set(NFAPI_COMMON_SRC + ${NFAPI_DIR}/common/src/debug.c +) +add_library(NFAPI_COMMON_LIB ${NFAPI_COMMON_SRC}) + +include_directories(${NFAPI_DIR}/common/public_inc) + +set(NFAPI_SRC + ${NFAPI_DIR}/nfapi/src/nfapi.c + ${NFAPI_DIR}/nfapi/src/nfapi_p4.c + ${NFAPI_DIR}/nfapi/src/nfapi_p5.c + ${NFAPI_DIR}/nfapi/src/nfapi_p7.c +) +add_library(NFAPI_LIB ${NFAPI_SRC}) + +include_directories(${NFAPI_DIR}/nfapi/public_inc) +include_directories(${NFAPI_DIR}/nfapi/inc) + +set(NFAPI_PNF_SRC + ${NFAPI_DIR}/pnf/src/pnf.c + ${NFAPI_DIR}/pnf/src/pnf_interface.c + ${NFAPI_DIR}/pnf/src/pnf_p7.c + ${NFAPI_DIR}/pnf/src/pnf_p7_interface.c +) +add_library(NFAPI_PNF_LIB ${NFAPI_PNF_SRC}) + +include_directories(${NFAPI_DIR}/pnf/public_inc) +include_directories(${NFAPI_DIR}/pnf/inc) + +set(NFAPI_VNF_SRC + ${NFAPI_DIR}/vnf/src/vnf.c + ${NFAPI_DIR}/vnf/src/vnf_interface.c + ${NFAPI_DIR}/vnf/src/vnf_p7.c + ${NFAPI_DIR}/vnf/src/vnf_p7_interface.c +) +add_library(NFAPI_VNF_LIB ${NFAPI_VNF_SRC}) + +include_directories(${NFAPI_DIR}/vnf/public_inc) +include_directories(${NFAPI_DIR}/vnf/inc) + +# nFAPI user defined code +############################# +set(NFAPI_USER_SRC + ${NFAPI_USER_DIR}/nfapi.c + ${NFAPI_USER_DIR}/nfapi_pnf.c + ${NFAPI_USER_DIR}/nfapi_vnf.c +) +add_library(NFAPI_USER_LIB ${NFAPI_USER_SRC}) +include_directories(${NFAPI_USER_DIR}) + +# Layer 1 +############################# +set(PHY_TURBOSRC + ${OPENAIR1_DIR}/PHY/CODING/3gpplte_sse.c + ${OPENAIR1_DIR}/PHY/CODING/3gpplte.c + ${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c + ${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c + ${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c + ${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder.c +) +set(PHY_TURBOIF + ${OPENAIR1_DIR}/PHY/CODING/coding_load.c +) + +add_library(coding MODULE ${PHY_TURBOSRC} ) +set(PHY_SRC + # depend on code generation from asn1c + ${RRC_FULL_DIR}/asn1_constants.h + # actual source + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pss.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/sss.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pilots.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pilots_mbsfn.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_coding.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_modulation.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_demodulation.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_llr_computation.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/power_control.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_decoding.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_scrambling.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci_tools.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/uci_tools.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_mcs.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pbch.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/edci.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/phich.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pcfich.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pucch.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/prach.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pmch.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pch.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/group_hopping.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/srs_modulation.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/drs_modulation.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_modulation.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_demodulation.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_coding.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_decoding.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/rar_tools.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/print_stats.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/initial_sync.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if4_tools.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if5_tools.c + ${OPENAIR1_DIR}/PHY/MODULATION/ofdm_mod.c + ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep.c + ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_mbsfn.c + ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_ul.c + ${OPENAIR1_DIR}/PHY/MODULATION/ul_7_5_kHz.c + ${OPENAIR1_DIR}/PHY/MODULATION/beamforming.c + ${OPENAIR1_DIR}/PHY/MODULATION/compute_bf_weights.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/freq_equalization.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_time.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_timefreq.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_adjust_sync.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_est_freq_offset.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ue_measurements.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_eNB_measurements.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/adjust_gain.c + ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_cell_spec.c + ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_uespec.c + ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold.c + ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold_mbsfn.c + ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_mbsfn.c + ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_ul_ref.c + ${OPENAIR1_DIR}/PHY/CODING/lte_segmentation.c + ${OPENAIR1_DIR}/PHY/CODING/ccoding_byte.c + ${OPENAIR1_DIR}/PHY/CODING/ccoding_byte_lte.c + ${OPENAIR1_DIR}/PHY/CODING/crc_byte.c + ${PHY_TURBOIF} + ${OPENAIR1_DIR}/PHY/CODING/lte_rate_matching.c + ${OPENAIR1_DIR}/PHY/CODING/viterbi.c + ${OPENAIR1_DIR}/PHY/CODING/viterbi_lte.c + ${OPENAIR1_DIR}/PHY/INIT/lte_init.c + ${OPENAIR1_DIR}/PHY/INIT/lte_init_ru.c + ${OPENAIR1_DIR}/PHY/INIT/lte_init_ue.c + ${OPENAIR1_DIR}/PHY/INIT/init_top.c + ${OPENAIR1_DIR}/PHY/INIT/lte_parms.c + ${OPENAIR1_DIR}/PHY/INIT/lte_param_init.c + ${OPENAIR1_DIR}/PHY/TOOLS/file_output.c + ${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c + ${OPENAIR1_DIR}/PHY/TOOLS/lte_dfts.c + ${OPENAIR1_DIR}/PHY/TOOLS/log2_approx.c + ${OPENAIR1_DIR}/PHY/TOOLS/cmult_sv.c + ${OPENAIR1_DIR}/PHY/TOOLS/cmult_vv.c + ${OPENAIR1_DIR}/PHY/TOOLS/cdot_prod.c + ${OPENAIR1_DIR}/PHY/TOOLS/signal_energy.c + ${OPENAIR1_DIR}/PHY/TOOLS/dB_routines.c + ${OPENAIR1_DIR}/PHY/TOOLS/sqrt.c + ${OPENAIR1_DIR}/PHY/TOOLS/time_meas.c + ${OPENAIR1_DIR}/PHY/TOOLS/lut.c + ) + +set(PHY_SRC_UE + # depend on code generation from asn1c + ${RRC_FULL_DIR}/asn1_constants.h + # actual source + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pss.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/sss.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pilots.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pilots_mbsfn.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_coding.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_modulation.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_demodulation.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_llr_computation.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/power_control.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_decoding.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_scrambling.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci_tools.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/uci_tools.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/lte_mcs.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pbch.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dci.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/edci.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/phich.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pcfich.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pucch.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/prach.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pmch.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/pch.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/group_hopping.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/srs_modulation.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/drs_modulation.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_modulation.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_demodulation.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_coding.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/ulsch_decoding.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/rar_tools.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/print_stats.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/initial_sync.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if4_tools.c + ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/if5_tools.c + ${OPENAIR1_DIR}/PHY/MODULATION/ofdm_mod.c + ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep.c + ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_mbsfn.c + ${OPENAIR1_DIR}/PHY/MODULATION/slot_fep_ul.c + ${OPENAIR1_DIR}/PHY/MODULATION/ul_7_5_kHz.c + ${OPENAIR1_DIR}/PHY/MODULATION/beamforming.c + ${OPENAIR1_DIR}/PHY/MODULATION/compute_bf_weights.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/freq_equalization.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_time.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_sync_timefreq.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_adjust_sync.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_channel_estimation.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_bf_channel_estimation.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_dl_mbsfn_channel_estimation.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ul_channel_estimation.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_est_freq_offset.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_ue_measurements.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/lte_eNB_measurements.c + ${OPENAIR1_DIR}/PHY/LTE_ESTIMATION/adjust_gain.c + ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_cell_spec.c + ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_uespec.c + ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold.c + ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_gold_mbsfn.c + ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_dl_mbsfn.c + ${OPENAIR1_DIR}/PHY/LTE_REFSIG/lte_ul_ref.c + ${OPENAIR1_DIR}/PHY/CODING/lte_segmentation.c + ${OPENAIR1_DIR}/PHY/CODING/ccoding_byte.c + ${OPENAIR1_DIR}/PHY/CODING/ccoding_byte_lte.c + ${OPENAIR1_DIR}/PHY/CODING/3gpplte_sse.c + ${OPENAIR1_DIR}/PHY/CODING/crc_byte.c + ${PHY_TURBOIF} + ${OPENAIR1_DIR}/PHY/CODING/lte_rate_matching.c + ${OPENAIR1_DIR}/PHY/CODING/viterbi.c + ${OPENAIR1_DIR}/PHY/CODING/viterbi_lte.c + ${OPENAIR1_DIR}/PHY/INIT/lte_init_ru.c + ${OPENAIR1_DIR}/PHY/INIT/lte_init_ue.c + ${OPENAIR1_DIR}/PHY/INIT/init_top.c + ${OPENAIR1_DIR}/PHY/INIT/lte_parms.c + ${OPENAIR1_DIR}/PHY/INIT/lte_param_init.c + ${OPENAIR1_DIR}/PHY/TOOLS/file_output.c + ${OPENAIR1_DIR}/PHY/TOOLS/cadd_vv.c + ${OPENAIR1_DIR}/PHY/TOOLS/lte_dfts.c + ${OPENAIR1_DIR}/PHY/TOOLS/log2_approx.c + ${OPENAIR1_DIR}/PHY/TOOLS/cmult_sv.c + ${OPENAIR1_DIR}/PHY/TOOLS/cmult_vv.c + ${OPENAIR1_DIR}/PHY/TOOLS/cdot_prod.c + ${OPENAIR1_DIR}/PHY/TOOLS/signal_energy.c + ${OPENAIR1_DIR}/PHY/TOOLS/dB_routines.c + ${OPENAIR1_DIR}/PHY/TOOLS/sqrt.c + ${OPENAIR1_DIR}/PHY/TOOLS/time_meas.c + ${OPENAIR1_DIR}/PHY/TOOLS/lut.c + ) + +if (${SMBV}) + set(PHY_SRC "${PHY_SRC} ${OPENAIR1_DIR}/PHY/TOOLS/smbv.c") +endif (${SMBV}) + +if (${COMPILATION_AVX2} STREQUAL "True") + set(PHY_SRC ${PHY_SRC} ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_llr_computation_avx2.c) + set(PHY_SRC_UE ${PHY_SRC_UE} ${OPENAIR1_DIR}/PHY/LTE_TRANSPORT/dlsch_llr_computation_avx2.c) +endif () + +add_library(PHY ${PHY_SRC}) +add_library(PHY_UE ${PHY_SRC_UE}) + +#Layer 2 library +##################### +set(MAC_DIR ${OPENAIR2_DIR}/LAYER2/MAC) +set(PHY_INTERFACE_DIR ${OPENAIR2_DIR}/PHY_INTERFACE) +set(RLC_DIR ${OPENAIR2_DIR}/LAYER2/RLC) +set(RLC_UM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/UM_v9.3.0) +set(RLC_AM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/AM_v9.3.0) +set(RLC_TM_DIR ${OPENAIR2_DIR}/LAYER2/RLC/TM_v9.3.0) +set(RRC_DIR ${OPENAIR2_DIR}/RRC/LITE) +set(PDCP_DIR ${OPENAIR2_DIR}/LAYER2/PDCP_v10.1.0) +set(L2_SRC + ${OPENAIR2_DIR}/LAYER2/openair2_proc.c + ${PDCP_DIR}/pdcp.c + ${PDCP_DIR}/pdcp_fifo.c + ${PDCP_DIR}/pdcp_sequence_manager.c + ${PDCP_DIR}/pdcp_primitives.c + ${PDCP_DIR}/pdcp_util.c + ${PDCP_DIR}/pdcp_security.c + ${PDCP_DIR}/pdcp_netlink.c + ${RLC_AM_DIR}/rlc_am.c + ${RLC_AM_DIR}/rlc_am_init.c + ${RLC_AM_DIR}/rlc_am_timer_poll_retransmit.c + ${RLC_AM_DIR}/rlc_am_timer_reordering.c + ${RLC_AM_DIR}/rlc_am_timer_status_prohibit.c + ${RLC_AM_DIR}/rlc_am_segment.c + ${RLC_AM_DIR}/rlc_am_segments_holes.c + ${RLC_AM_DIR}/rlc_am_in_sdu.c + ${RLC_AM_DIR}/rlc_am_receiver.c + ${RLC_AM_DIR}/rlc_am_retransmit.c + ${RLC_AM_DIR}/rlc_am_windows.c + ${RLC_AM_DIR}/rlc_am_rx_list.c + ${RLC_AM_DIR}/rlc_am_reassembly.c + ${RLC_AM_DIR}/rlc_am_status_report.c + ${RLC_TM_DIR}/rlc_tm.c + ${RLC_TM_DIR}/rlc_tm_init.c + ${RLC_UM_DIR}/rlc_um.c + ${RLC_UM_DIR}/rlc_um_fsm.c + ${RLC_UM_DIR}/rlc_um_control_primitives.c + ${RLC_UM_DIR}/rlc_um_segment.c + ${RLC_UM_DIR}/rlc_um_reassembly.c + ${RLC_UM_DIR}/rlc_um_receiver.c + ${RLC_UM_DIR}/rlc_um_dar.c + ${RLC_DIR}/rlc_mac.c + ${RLC_DIR}/rlc.c + ${RLC_DIR}/rlc_rrc.c + ${RLC_DIR}/rlc_mpls.c + ${RRC_DIR}/rrc_UE.c + ${RRC_DIR}/rrc_eNB.c + ${RRC_DIR}/rrc_eNB_S1AP.c + ${RRC_DIR}/rrc_eNB_UE_context.c + ${RRC_DIR}/rrc_common.c + ${RRC_DIR}/L2_interface.c + ${RRC_DIR}/L2_interface_common.c + ${RRC_DIR}/L2_interface_ue.c + ) + +set(L2_SRC_UE + ${PDCP_DIR}/pdcp.c + ${PDCP_DIR}/pdcp_fifo.c + ${PDCP_DIR}/pdcp_sequence_manager.c + ${PDCP_DIR}/pdcp_primitives.c + ${PDCP_DIR}/pdcp_util.c + ${PDCP_DIR}/pdcp_security.c + ${PDCP_DIR}/pdcp_netlink.c + ${RLC_AM_DIR}/rlc_am.c + ${RLC_AM_DIR}/rlc_am_init.c + ${RLC_AM_DIR}/rlc_am_timer_poll_retransmit.c + ${RLC_AM_DIR}/rlc_am_timer_reordering.c + ${RLC_AM_DIR}/rlc_am_timer_status_prohibit.c + ${RLC_AM_DIR}/rlc_am_segment.c + ${RLC_AM_DIR}/rlc_am_segments_holes.c + ${RLC_AM_DIR}/rlc_am_in_sdu.c + ${RLC_AM_DIR}/rlc_am_receiver.c + ${RLC_AM_DIR}/rlc_am_retransmit.c + ${RLC_AM_DIR}/rlc_am_windows.c + ${RLC_AM_DIR}/rlc_am_rx_list.c + ${RLC_AM_DIR}/rlc_am_reassembly.c + ${RLC_AM_DIR}/rlc_am_status_report.c + ${RLC_TM_DIR}/rlc_tm.c + ${RLC_TM_DIR}/rlc_tm_init.c + ${RLC_UM_DIR}/rlc_um.c + ${RLC_UM_DIR}/rlc_um_fsm.c + ${RLC_UM_DIR}/rlc_um_control_primitives.c + ${RLC_UM_DIR}/rlc_um_segment.c + ${RLC_UM_DIR}/rlc_um_reassembly.c + ${RLC_UM_DIR}/rlc_um_receiver.c + ${RLC_UM_DIR}/rlc_um_dar.c + ${RLC_DIR}/rlc_mac.c + ${RLC_DIR}/rlc.c + ${RLC_DIR}/rlc_rrc.c + ${RLC_DIR}/rlc_mpls.c + ${RRC_DIR}/rrc_UE.c + ${RRC_DIR}/rrc_common.c + ${RRC_DIR}/L2_interface_common.c + ${RRC_DIR}/L2_interface_ue.c + ) + +set (MAC_SRC + ${PHY_INTERFACE_DIR}/IF_Module.c + ${MAC_DIR}/main.c + ${MAC_DIR}/main_ue.c + ${MAC_DIR}/ue_procedures.c + ${MAC_DIR}/ra_procedures.c + ${MAC_DIR}/l1_helpers.c + ${MAC_DIR}/rar_tools.c + ${MAC_DIR}/rar_tools_ue.c + ${MAC_DIR}/eNB_scheduler.c + ${MAC_DIR}/eNB_scheduler_dlsch.c + ${MAC_DIR}/eNB_scheduler_ulsch.c + ${MAC_DIR}/eNB_scheduler_mch.c + ${MAC_DIR}/eNB_scheduler_bch.c + ${MAC_DIR}/eNB_scheduler_primitives.c + ${MAC_DIR}/eNB_scheduler_RA.c + ${MAC_DIR}/pre_processor.c + ${MAC_DIR}/config.c + ${MAC_DIR}/config_ue.c + ) + +set (MAC_SRC_UE + ${MAC_DIR}/main_ue.c + ${MAC_DIR}/ue_procedures.c + ${MAC_DIR}/ra_procedures.c + ${MAC_DIR}/l1_helpers.c + ${MAC_DIR}/rar_tools_ue.c + ${MAC_DIR}/config_ue.c + ) + +set (ENB_APP_SRC + ${OPENAIR2_DIR}/ENB_APP/enb_app.c + ${OPENAIR2_DIR}/ENB_APP/enb_config.c + ${OPENAIR2_DIR}/ENB_APP/RRC_config_tools.c + ) + +add_library(L2 + ${L2_SRC} + ${MAC_SRC} + ${ENB_APP_SRC}) +# ${OPENAIR2_DIR}/RRC/L2_INTERFACE/openair_rrc_L2_interface.c) + +add_library(L2_UE + ${L2_SRC_UE} + ${MAC_SRC_UE} +) + + +include_directories(${NFAPI_USER_DIR}) + +# L3 Libs +########################## + +set(RAL_LTE_DIR ${OPENAIR3_DIR}/RAL-LTE/) +if (${ENABLE_RAL}) + set(RAL_LTE_SRC + ${RRC_DIR}/rrc_UE_ral.c + ${RRC_DIR}/rrc_eNB_ral.c + ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_action.c + ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_main.c + ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_mih_msg.c + ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_parameters.c + ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_process.c + ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_rrc_msg.c + ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_subscribe.c + ${RAL_LTE_DIR}LTE_RAL_ENB/SRC/lteRALenb_thresholds.c + ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_action.c + ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_main.c + ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_mih_msg.c + ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_parameters.c + ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_process.c + ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_rrc_msg.c + ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_subscribe.c + ${RAL_LTE_DIR}LTE_RAL_UE/SRC/lteRALue_thresholds.c + ) + add_library(RAL ${RAL_LTE_SRC}) + set(RAL_LIB RAL) +endif() + +# CN libs +########################## + +add_library(CN_UTILS + ${OPENAIR3_DIR}/UTILS/conversions.c + ${OPENAIR3_DIR}/UTILS/enum_string.c + ${OPENAIR3_DIR}/UTILS/log.c + ${OPENAIR3_DIR}/UTILS/mcc_mnc_itu.c + ) + +set(GTPV1U_DIR ${OPENAIR3_DIR}/GTPV1-U) +set (GTPV1U_SRC + ${RRC_DIR}/rrc_eNB_GTPV1U.c + ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTunnelEndPoint.c + ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uTrxn.c + ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1uMsg.c + ${GTPV1U_DIR}/nw-gtpv1u/src/NwGtpv1u.c + ${GTPV1U_DIR}/gtpv1u_teid_pool.c +) +add_library(GTPV1U ${GTPV1U_SRC}) + +set(SCTP_SRC + ${OPENAIR3_DIR}/SCTP/sctp_common.c + ${OPENAIR3_DIR}/SCTP/sctp_eNB_task.c + ${OPENAIR3_DIR}/SCTP/sctp_eNB_itti_messaging.c +) +add_library(SCTP_CLIENT ${SCTP_SRC}) + +add_library(UDP ${OPENAIR3_DIR}/UDP/udp_eNB_task.c) + + +set(NAS_SRC ${OPENAIR3_DIR}/NAS/) +set(libnas_api_OBJS + ${NAS_SRC}COMMON/API/NETWORK/as_message.c + ${NAS_SRC}COMMON/API/NETWORK/nas_message.c + ${NAS_SRC}COMMON/API/NETWORK/network_api.c + ) + +set(libnas_emm_msg_OBJS + ${NAS_SRC}COMMON/EMM/MSG/AttachAccept.c + ${NAS_SRC}COMMON/EMM/MSG/AttachComplete.c + ${NAS_SRC}COMMON/EMM/MSG/AttachReject.c + ${NAS_SRC}COMMON/EMM/MSG/AttachRequest.c + ${NAS_SRC}COMMON/EMM/MSG/AuthenticationFailure.c + ${NAS_SRC}COMMON/EMM/MSG/AuthenticationReject.c + ${NAS_SRC}COMMON/EMM/MSG/AuthenticationRequest.c + ${NAS_SRC}COMMON/EMM/MSG/AuthenticationResponse.c + ${NAS_SRC}COMMON/EMM/MSG/CsServiceNotification.c + ${NAS_SRC}COMMON/EMM/MSG/DetachAccept.c + ${NAS_SRC}COMMON/EMM/MSG/DetachRequest.c + ${NAS_SRC}COMMON/EMM/MSG/DownlinkNasTransport.c + ${NAS_SRC}COMMON/EMM/MSG/EmmInformation.c + ${NAS_SRC}COMMON/EMM/MSG/emm_msg.c + ${NAS_SRC}COMMON/EMM/MSG/EmmStatus.c + ${NAS_SRC}COMMON/EMM/MSG/ExtendedServiceRequest.c + ${NAS_SRC}COMMON/EMM/MSG/GutiReallocationCommand.c + ${NAS_SRC}COMMON/EMM/MSG/GutiReallocationComplete.c + ${NAS_SRC}COMMON/EMM/MSG/IdentityRequest.c + ${NAS_SRC}COMMON/EMM/MSG/IdentityResponse.c + ${NAS_SRC}COMMON/EMM/MSG/SecurityModeCommand.c + ${NAS_SRC}COMMON/EMM/MSG/SecurityModeComplete.c + ${NAS_SRC}COMMON/EMM/MSG/SecurityModeReject.c + ${NAS_SRC}COMMON/EMM/MSG/ServiceReject.c + ${NAS_SRC}COMMON/EMM/MSG/ServiceRequest.c + ${NAS_SRC}COMMON/EMM/MSG/TrackingAreaUpdateAccept.c + ${NAS_SRC}COMMON/EMM/MSG/TrackingAreaUpdateComplete.c + ${NAS_SRC}COMMON/EMM/MSG/TrackingAreaUpdateReject.c + ${NAS_SRC}COMMON/EMM/MSG/TrackingAreaUpdateRequest.c + ${NAS_SRC}COMMON/EMM/MSG/UplinkNasTransport.c +) + +set(libnas_esm_msg_OBJS + ${NAS_SRC}COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextAccept.c + ${NAS_SRC}COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextReject.c + ${NAS_SRC}COMMON/ESM/MSG/ActivateDedicatedEpsBearerContextRequest.c + ${NAS_SRC}COMMON/ESM/MSG/ActivateDefaultEpsBearerContextAccept.c + ${NAS_SRC}COMMON/ESM/MSG/ActivateDefaultEpsBearerContextReject.c + ${NAS_SRC}COMMON/ESM/MSG/ActivateDefaultEpsBearerContextRequest.c + ${NAS_SRC}COMMON/ESM/MSG/BearerResourceAllocationReject.c + ${NAS_SRC}COMMON/ESM/MSG/BearerResourceAllocationRequest.c + ${NAS_SRC}COMMON/ESM/MSG/BearerResourceModificationReject.c + ${NAS_SRC}COMMON/ESM/MSG/BearerResourceModificationRequest.c + ${NAS_SRC}COMMON/ESM/MSG/DeactivateEpsBearerContextAccept.c + ${NAS_SRC}COMMON/ESM/MSG/DeactivateEpsBearerContextRequest.c + ${NAS_SRC}COMMON/ESM/MSG/EsmInformationRequest.c + ${NAS_SRC}COMMON/ESM/MSG/EsmInformationResponse.c + ${NAS_SRC}COMMON/ESM/MSG/esm_msg.c + ${NAS_SRC}COMMON/ESM/MSG/EsmStatus.c + ${NAS_SRC}COMMON/ESM/MSG/ModifyEpsBearerContextAccept.c + ${NAS_SRC}COMMON/ESM/MSG/ModifyEpsBearerContextReject.c + ${NAS_SRC}COMMON/ESM/MSG/ModifyEpsBearerContextRequest.c + ${NAS_SRC}COMMON/ESM/MSG/PdnConnectivityReject.c + ${NAS_SRC}COMMON/ESM/MSG/PdnConnectivityRequest.c + ${NAS_SRC}COMMON/ESM/MSG/PdnDisconnectReject.c + ${NAS_SRC}COMMON/ESM/MSG/PdnDisconnectRequest.c +) + +set(libnas_ies_OBJS + ${NAS_SRC}COMMON/IES/AccessPointName.c + ${NAS_SRC}COMMON/IES/AdditionalUpdateResult.c + ${NAS_SRC}COMMON/IES/AdditionalUpdateType.c + ${NAS_SRC}COMMON/IES/ApnAggregateMaximumBitRate.c + ${NAS_SRC}COMMON/IES/AuthenticationFailureParameter.c + ${NAS_SRC}COMMON/IES/AuthenticationParameterAutn.c + ${NAS_SRC}COMMON/IES/AuthenticationParameterRand.c + ${NAS_SRC}COMMON/IES/AuthenticationResponseParameter.c + ${NAS_SRC}COMMON/IES/CipheringKeySequenceNumber.c + ${NAS_SRC}COMMON/IES/Cli.c + ${NAS_SRC}COMMON/IES/CsfbResponse.c + ${NAS_SRC}COMMON/IES/DaylightSavingTime.c + ${NAS_SRC}COMMON/IES/DetachType.c + ${NAS_SRC}COMMON/IES/DrxParameter.c + ${NAS_SRC}COMMON/IES/EmergencyNumberList.c + ${NAS_SRC}COMMON/IES/EmmCause.c + ${NAS_SRC}COMMON/IES/EpsAttachResult.c + ${NAS_SRC}COMMON/IES/EpsAttachType.c + ${NAS_SRC}COMMON/IES/EpsBearerContextStatus.c + ${NAS_SRC}COMMON/IES/EpsBearerIdentity.c + ${NAS_SRC}COMMON/IES/EpsMobileIdentity.c + ${NAS_SRC}COMMON/IES/EpsNetworkFeatureSupport.c + ${NAS_SRC}COMMON/IES/EpsQualityOfService.c + ${NAS_SRC}COMMON/IES/EpsUpdateResult.c + ${NAS_SRC}COMMON/IES/EpsUpdateType.c + ${NAS_SRC}COMMON/IES/EsmCause.c + ${NAS_SRC}COMMON/IES/EsmInformationTransferFlag.c + ${NAS_SRC}COMMON/IES/EsmMessageContainer.c + ${NAS_SRC}COMMON/IES/GprsTimer.c + ${NAS_SRC}COMMON/IES/GutiType.c + ${NAS_SRC}COMMON/IES/IdentityType2.c + ${NAS_SRC}COMMON/IES/ImeisvRequest.c + ${NAS_SRC}COMMON/IES/KsiAndSequenceNumber.c + ${NAS_SRC}COMMON/IES/LcsClientIdentity.c + ${NAS_SRC}COMMON/IES/LcsIndicator.c + ${NAS_SRC}COMMON/IES/LinkedEpsBearerIdentity.c + ${NAS_SRC}COMMON/IES/LlcServiceAccessPointIdentifier.c + ${NAS_SRC}COMMON/IES/LocationAreaIdentification.c + ${NAS_SRC}COMMON/IES/MessageType.c + ${NAS_SRC}COMMON/IES/MobileIdentity.c + ${NAS_SRC}COMMON/IES/MobileStationClassmark2.c + ${NAS_SRC}COMMON/IES/MobileStationClassmark3.c + ${NAS_SRC}COMMON/IES/MsNetworkCapability.c + ${NAS_SRC}COMMON/IES/MsNetworkFeatureSupport.c + ${NAS_SRC}COMMON/IES/NasKeySetIdentifier.c + ${NAS_SRC}COMMON/IES/NasMessageContainer.c + ${NAS_SRC}COMMON/IES/NasRequestType.c + ${NAS_SRC}COMMON/IES/NasSecurityAlgorithms.c + ${NAS_SRC}COMMON/IES/NetworkName.c + ${NAS_SRC}COMMON/IES/Nonce.c + ${NAS_SRC}COMMON/IES/PacketFlowIdentifier.c + ${NAS_SRC}COMMON/IES/PagingIdentity.c + ${NAS_SRC}COMMON/IES/PdnAddress.c + ${NAS_SRC}COMMON/IES/PdnType.c + ${NAS_SRC}COMMON/IES/PlmnList.c + ${NAS_SRC}COMMON/IES/ProcedureTransactionIdentity.c + ${NAS_SRC}COMMON/IES/ProtocolConfigurationOptions.c + ${NAS_SRC}COMMON/IES/ProtocolDiscriminator.c + ${NAS_SRC}COMMON/IES/PTmsiSignature.c + ${NAS_SRC}COMMON/IES/QualityOfService.c + ${NAS_SRC}COMMON/IES/RadioPriority.c + ${NAS_SRC}COMMON/IES/SecurityHeaderType.c + ${NAS_SRC}COMMON/IES/ServiceType.c + ${NAS_SRC}COMMON/IES/ShortMac.c + ${NAS_SRC}COMMON/IES/SsCode.c + ${NAS_SRC}COMMON/IES/SupportedCodecList.c + ${NAS_SRC}COMMON/IES/TimeZoneAndTime.c + ${NAS_SRC}COMMON/IES/TimeZone.c + ${NAS_SRC}COMMON/IES/TmsiStatus.c + ${NAS_SRC}COMMON/IES/TrackingAreaIdentity.c + ${NAS_SRC}COMMON/IES/TrackingAreaIdentityList.c + ${NAS_SRC}COMMON/IES/TrafficFlowAggregateDescription.c + ${NAS_SRC}COMMON/IES/TrafficFlowTemplate.c + ${NAS_SRC}COMMON/IES/TransactionIdentifier.c + ${NAS_SRC}COMMON/IES/UeNetworkCapability.c + ${NAS_SRC}COMMON/IES/UeRadioCapabilityInformationUpdateNeeded.c + ${NAS_SRC}COMMON/IES/UeSecurityCapability.c + ${NAS_SRC}COMMON/IES/VoiceDomainPreferenceAndUeUsageSetting.c +) + +set (libnas_utils_OBJS + ${NAS_SRC}COMMON/UTIL/device.c + ${NAS_SRC}COMMON/UTIL/memory.c + ${NAS_SRC}COMMON/UTIL/nas_log.c + ${NAS_SRC}COMMON/UTIL/nas_timer.c + ${NAS_SRC}COMMON/UTIL/socket.c + ${NAS_SRC}COMMON/UTIL/stty.c + ${NAS_SRC}COMMON/UTIL/TLVEncoder.c + ${NAS_SRC}COMMON/UTIL/TLVDecoder.c + ${NAS_SRC}COMMON/UTIL/OctetString.c +) + +if(NAS_UE) + set(libnas_ue_api_OBJS + ${NAS_SRC}UE/API/USER/at_command.c + ${NAS_SRC}UE/API/USER/at_error.c + ${NAS_SRC}UE/API/USER/at_response.c + ${NAS_SRC}UE/API/USER/user_api.c + ${NAS_SRC}UE/API/USER/user_indication.c + ${NAS_SRC}UE/API/USIM/aka_functions.c + ${NAS_SRC}UE/API/USIM/usim_api.c + ) + set(libnas_ue_emm_OBJS + ${NAS_SRC}UE/EMM/Attach.c + ${NAS_SRC}UE/EMM/Authentication.c + ${NAS_SRC}UE/EMM/Detach.c + ${NAS_SRC}UE/EMM/emm_main.c + ${NAS_SRC}UE/EMM/EmmStatusHdl.c + ${NAS_SRC}UE/EMM/Identification.c + ${NAS_SRC}UE/EMM/IdleMode.c + ${NAS_SRC}UE/EMM/LowerLayer.c + ${NAS_SRC}UE/EMM/SecurityModeControl.c + ${NAS_SRC}UE/EMM/ServiceRequestHdl.c + ${NAS_SRC}UE/EMM/TrackingAreaUpdate.c + ) + set(libnas_ue_emm_sap_OBJS + ${NAS_SRC}UE/EMM/SAP/emm_as.c + ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredAttachNeeded.c + ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredAttemptingToAttach.c + ${NAS_SRC}UE/EMM/SAP/EmmDeregistered.c + ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredInitiated.c + ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredLimitedService.c + ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNoCellAvailable.c + ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNoImsi.c + ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredNormalService.c + ${NAS_SRC}UE/EMM/SAP/EmmDeregisteredPlmnSearch.c + ${NAS_SRC}UE/EMM/SAP/emm_esm.c + ${NAS_SRC}UE/EMM/SAP/emm_fsm.c + ${NAS_SRC}UE/EMM/SAP/EmmNull.c + ${NAS_SRC}UE/EMM/SAP/emm_recv.c + ${NAS_SRC}UE/EMM/SAP/emm_reg.c + ${NAS_SRC}UE/EMM/SAP/EmmRegisteredAttemptingToUpdate.c + ${NAS_SRC}UE/EMM/SAP/EmmRegistered.c + ${NAS_SRC}UE/EMM/SAP/EmmRegisteredImsiDetachInitiated.c + ${NAS_SRC}UE/EMM/SAP/EmmRegisteredInitiated.c + ${NAS_SRC}UE/EMM/SAP/EmmRegisteredLimitedService.c + ${NAS_SRC}UE/EMM/SAP/EmmRegisteredNoCellAvailable.c + ${NAS_SRC}UE/EMM/SAP/EmmRegisteredNormalService.c + ${NAS_SRC}UE/EMM/SAP/EmmRegisteredPlmnSearch.c + ${NAS_SRC}UE/EMM/SAP/EmmRegisteredUpdateNeeded.c + ${NAS_SRC}UE/EMM/SAP/emm_sap.c + ${NAS_SRC}UE/EMM/SAP/emm_send.c + ${NAS_SRC}UE/EMM/SAP/EmmServiceRequestInitiated.c + ${NAS_SRC}UE/EMM/SAP/EmmTrackingAreaUpdatingInitiated.c + ) + set (libnas_ue_esm_OBJS + ${NAS_SRC}UE/ESM/DedicatedEpsBearerContextActivation.c + ${NAS_SRC}UE/ESM/DefaultEpsBearerContextActivation.c + ${NAS_SRC}UE/ESM/EpsBearerContextDeactivation.c + ${NAS_SRC}UE/ESM/esm_ebr.c + ${NAS_SRC}UE/ESM/esm_ebr_context.c + ${NAS_SRC}UE/ESM/esm_ip.c + ${NAS_SRC}UE/ESM/esm_main.c + ${NAS_SRC}UE/ESM/esm_pt.c + ${NAS_SRC}UE/ESM/EsmStatusHdl.c + ${NAS_SRC}UE/ESM/PdnConnectivity.c + ${NAS_SRC}UE/ESM/PdnDisconnect.c + ) + set(libnas_ue_esm_sap_OBJS + ${NAS_SRC}UE/ESM/SAP/esm_recv.c + ${NAS_SRC}UE/ESM/SAP/esm_send.c + ${NAS_SRC}UE/ESM/SAP/esm_sap.c + ) + add_library(LIB_NAS_UE + ${NAS_SRC}UE/nas_itti_messaging.c + ${NAS_SRC}UE/nas_network.c + ${NAS_SRC}UE/nas_parser.c + ${NAS_SRC}UE/nas_proc.c + ${NAS_SRC}UE/nas_user.c + ${libnas_api_OBJS} + ${libnas_ue_api_OBJS} + ${libnas_emm_msg_OBJS} + ${libnas_esm_msg_OBJS} + ${libnas_ies_OBJS} + ${libnas_utils_OBJS} + ${libnas_ue_emm_OBJS} + ${libnas_ue_emm_sap_OBJS} + ${libnas_ue_esm_OBJS} + ${libnas_ue_esm_sap_OBJS} + ) + set(NAS_UE_LIB LIB_NAS_UE) + + include_directories(${NAS_SRC}UE) + include_directories(${NAS_SRC}UE/API/USER) + include_directories(${NAS_SRC}UE/API/USIM) + include_directories(${NAS_SRC}UE/EMM) + include_directories(${NAS_SRC}UE/EMM/SAP) + include_directories(${NAS_SRC}UE/ESM) + include_directories(${NAS_SRC}UE/ESM/SAP) +endif() + + +# nbiot +add_definitions("-DNUMBER_OF_UE_MAX_NB_IoT=16") +set (NBIOT_SOURCES + ${OPENAIR2_DIR}/ENB_APP/NB_IoT_config.c +) +add_library(NB_IoT MODULE ${NBIOT_SOURCES} ) + +# shared library loader +set (SHLIB_LOADER_SOURCES + ${OPENAIR_DIR}/common/utils/load_module_shlib.c +) + +# Make lfds as a own source code (even if it is a outside library) +# For better intergration with compilation flags & structure of cmake +################################################################### +set(lfds ${OPENAIR2_DIR}/UTIL/LFDS/liblfds6.1.1/liblfds611/src/) +file(GLOB lfds_queue ${lfds}/lfds611_queue/*.c) +file(GLOB lfds_ring ${lfds}/lfds611_ringbuffer/*.c) +file(GLOB lfds_slist ${lfds}/lfds611_slist/*.c) +file(GLOB lfds_stack ${lfds}/lfds611_stack/*.c) +file(GLOB lfds_freelist ${lfds}/lfds611_freelist/*.c) + +include_directories(${lfds}) +add_library(LFDS + ${lfds_queue} ${lfds_ring} ${lfds_slist} ${lfds_stack} ${lfds_freelist} + ${lfds}/lfds611_liblfds/lfds611_liblfds_abstraction_test_helpers.c + ${lfds}/lfds611_liblfds/lfds611_liblfds_aligned_free.c + ${lfds}/lfds611_liblfds/lfds611_liblfds_aligned_malloc.c + ${lfds}/lfds611_abstraction/lfds611_abstraction_free.c + ${lfds}/lfds611_abstraction/lfds611_abstraction_malloc.c +) + +set(lfds7 ${OPENAIR2_DIR}/UTIL/LFDS/liblfds7.0.0/liblfds700/src/) +file(GLOB lfds7_queue ${lfds7}/lfds700_queue/*.c) +file(GLOB lfds7_ring ${lfds7}/lfds700_ringbuffer/*.c) +file(GLOB lfds7_qbss ${lfds7}/lfds700_queue_bounded_singleconsumer_singleproducer/*.c) +file(GLOB lfds7_stack ${lfds7}/lfds700_stack/*.c) +file(GLOB lfds7_freelist ${lfds7}/lfds700_freelist/*.c) +file(GLOB lfds7_btree ${lfds7}/lfds700_btree_addonly_unbalanced/*.c) +file(GLOB lfds7_hash ${lfds7}/lfds700_hash_addonly/*.c) +file(GLOB lfds7_ordered_list ${lfds7}/lfds700_list_addonly_ordered_singlylinked/*.c) +file(GLOB lfds7_unordered_list ${lfds7}/lfds700_list_addonly_singlylinked_unordered/*.c) +file(GLOB lfds7_misc ${lfds7}/lfds700_misc/*.c) + +include_directories(${lfds7}) +add_library(LFDS7 + ${lfds7_queue} ${lfds7_ring} ${lfds7_qbss} ${lfds7_stack} ${lfds7_freelist} ${lfds7_btree} ${lfds7_hash} ${lfds7_ordered_list} ${lfds7_unordered_list} ${lfds7_misc} +) + +# Simulation library +########################## +add_library(SIMU +${OPENAIR1_DIR}/SIMULATION/TOOLS/random_channel.c +${OPENAIR1_DIR}/SIMULATION/TOOLS/rangen_double.c +${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c +${OPENAIR1_DIR}/SIMULATION/TOOLS/multipath_channel.c +${OPENAIR1_DIR}/SIMULATION/TOOLS/abstraction.c +${OPENAIR1_DIR}/SIMULATION/TOOLS/multipath_tv_channel.c +${OPENAIR1_DIR}/SIMULATION/RF/rf.c +${OPENAIR1_DIR}/SIMULATION/RF/dac.c +${OPENAIR1_DIR}/SIMULATION/RF/adc.c +${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c +) + +add_library(SIMU_ETH +${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c +${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/multicast_link.c +${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/socket.c +${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/bypass_session_layer.c +#${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/emu_transport.c +) + +add_library(OPENAIR0_LIB + ${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB/openair0_lib.c +) + +include_directories("${NFAPI_DIR}/nfapi/public_inc") +include_directories("${NFAPI_DIR}/common/public_inc") +include_directories("${NFAPI_DIR}/pnf/public_inc") +include_directories("${NFAPI_DIR}/nfapi/inc") +include_directories("${NFAPI_DIR}/sim_common/inc") +include_directories("${NFAPI_DIR}/pnf_sim/inc") + + +# System packages that are required +# We use either the cmake buildin, in ubuntu are in: /usr/share/cmake*/Modules/ +# or cmake provide a generic interface to pkg-config that widely used +################################### +include(FindPkgConfig) + +pkg_search_module(LIBXML2 libxml-2.0 REQUIRED) +include_directories(${LIBXML2_INCLUDE_DIRS}) + +pkg_search_module(LIBXSLT libxslt REQUIRED) +include_directories(${LIBXSLT_INCLUDE_DIRS}) + +pkg_search_module(OPENSSL openssl REQUIRED) +include_directories(${OPENSSL_INCLUDE_DIRS}) + +pkg_search_module(CONFIG libconfig REQUIRED) +include_directories(${CONFIG_INCLUDE_DIRS}) + +pkg_search_module(CRYPTO libcrypto REQUIRED) +include_directories(${CRYPTO_INCLUDE_DIRS}) + +#use native cmake method as this package is not in pkg-config +if (${RF_BOARD} STREQUAL "OAI_USRP") + find_package(Boost REQUIRED) + include_directories(${LIBBOOST_INCLUDE_DIR}) +endif (${RF_BOARD} STREQUAL "OAI_USRP") + +pkg_search_module(OPENPGM openpgm-5.1 openpgm-5.2) +if(NOT ${OPENPGM_FOUND}) + message("PACKAGE openpgm-5.1 is required by binaries such as oaisim: will fail later if this target is built") +else() + include_directories(${OPENPGM_INCLUDE_DIRS}) +endif() + +pkg_search_module(NETTLE nettle) +if(NOT ${NETTLE_FOUND}) + message( FATAL_ERROR "PACKAGE nettle not found: some targets will fail. Run build_oai -I again!") +else() + include_directories(${NETTLE_INCLUDE_DIRS}) +endif() + +message ("NETTLE VERSION_INSTALLED = ${NETTLE_VERSION}") + +string(REGEX REPLACE "([0-9]+).*" "\\1" NETTLE_VERSION_MAJOR ${NETTLE_VERSION}) +string(REGEX REPLACE "[0-9]+\\.([0-9]+).*" "\\1" NETTLE_VERSION_MINOR ${NETTLE_VERSION}) +message ("NETTLE_VERSION_MAJOR = ${NETTLE_VERSION_MAJOR}") +message ("NETTLE_VERSION_MINOR = ${NETTLE_VERSION_MINOR}") + +if ("${NETTLE_VERSION_MAJOR}" STREQUAL "" OR "${NETTLE_VERSION_MINOR}" STREQUAL "") + message( FATAL_ERROR "The nettle version not detected properly. Try to run build_oai -I again" ) +endif() + +add_definitions("-DNETTLE_VERSION_MAJOR=${NETTLE_VERSION_MAJOR}") +add_definitions("-DNETTLE_VERSION_MINOR=${NETTLE_VERSION_MINOR}") + +pkg_search_module(XPM xpm) +if(NOT ${XPM_FOUND}) + message("PACKAGE xpm not found: some targets will fail") +else() + include_directories(${XPM_INCLUDE_DIRS}) +endif() + +# Atlas is required by some packages, but not found in pkg-config +# So, here are some hacks here. Hope this gets fixed in future! +if(EXISTS "/usr/include/atlas/cblas.h" OR EXISTS "/usr/include/cblas.h") + include_directories("/usr/include/atlas") + LINK_DIRECTORIES("/usr/lib64") + LINK_DIRECTORIES("/usr/lib64/atlas") #Added because atlas libraries in CentOS 7 are here! + + if(EXISTS "/usr/lib64/libblas.so" OR EXISTS "/usr/lib/libblas.so") #Case for CentOS7 + list(APPEND ATLAS_LIBRARIES blas) + else() # Case for Ubuntu + list(APPEND ATLAS_LIBRARIES cblas) + endif() + + if(EXISTS "/usr/lib/atlas/libtatlas.so" OR EXISTS "/usr/lib64/atlas/libtatlas.so") #Case for CentOS7 + list(APPEND ATLAS_LIBRARIES tatlas) + else() + list(APPEND ATLAS_LIBRARIES atlas) #Case for Ubuntu + endif() + + list(APPEND ATLAS_LIBRARIES lapack) + +# for ubuntu 17.10, directories are different +elseif(EXISTS "/usr/include/x86_64-linux-gnu/cblas.h") + + include_directories("/usr/include/x86_64-linux-gnu") + LINK_DIRECTORIES("/usr/lib/x86_64-linux-gnu") + list(APPEND ATLAS_LIBRARIES cblas) + list(APPEND ATLAS_LIBRARIES atlas) + list(APPEND ATLAS_LIBRARIES lapack) + +else() + message("No Blas/Atlas libs found, some targets will fail") +endif() + +if (${XFORMS}) + include_directories ("/usr/include/X11") + set(XFORMS_SOURCE + ${OPENAIR1_DIR}/PHY/TOOLS/lte_phy_scope.c + ) + set(XFORMS_SOURCE_SOFTMODEM + ${OPENAIR_TARGETS}/RT/USER/stats.c + ) + set(XFORMS_LIBRARIES "forms") +endif (${XFORMS}) + +set(CMAKE_MODULE_PATH "${OPENAIR_DIR}/cmake_targets/tools/MODULES" "${CMAKE_MODULE_PATH}") + +#include T directory even if the T is off because T macros are in the code +#no matter what +include_directories("${OPENAIR_DIR}/common/utils/T") + +if (${T_TRACER}) + set(T_SOURCE + ${OPENAIR_DIR}/common/utils/T/T.c + ${OPENAIR_DIR}/common/utils/T/local_tracer.c) + set (T_LIB "rt") +endif (${T_TRACER}) + +#Some files in the T directory are generated. +#This rule and the following deal with it. +add_custom_command ( + OUTPUT ${OPENAIR_DIR}/common/utils/T/T_IDs.h + COMMAND make + WORKING_DIRECTORY ${OPENAIR_DIR}/common/utils/T + DEPENDS ${OPENAIR_DIR}/common/utils/T/T_messages.txt + ) + +#This rule is specifically needed to generate T files +#before anything else in a project that uses the T. +#See below, there are some 'add_dependencies' showing that. +#Basically we create a custom target and we make other +#targets depend on it. That forces cmake to generate +#T files before anything else. +add_custom_target ( + generate_T + DEPENDS ${OPENAIR_DIR}/common/utils/T/T_IDs.h +) + +# Hack on a test of asn1c version (already dirty) +add_definitions(-DASN1_MINIMUM_VERSION=924) + +################################# +# add executables for operation +################################# + +# lte-softmodem is both eNB and UE implementation +################################################### + +add_executable(lte-softmodem + ${rrc_h} + ${s1ap_h} + ${OPENAIR_BIN_DIR}/messages_xml.h + ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c + ${OPENAIR_TARGETS}/RT/USER/lte-enb.c + ${OPENAIR_TARGETS}/RT/USER/lte-ru.c + ${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c + ${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c + ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c + ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c + ${OPENAIR_TARGETS}/COMMON/create_tasks.c + ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c + ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c + ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c + ${OPENAIR_DIR}/common/utils/utils.c + ${OPENAIR_DIR}/common/utils/system.c + ${GTPU_need_ITTI} + ${XFORMS_SOURCE} + ${XFORMS_SOURCE_SOFTMODEM} + ${T_SOURCE} + ${CONFIG_SOURCES} + ${SHLIB_LOADER_SOURCES} + ) + +target_link_libraries (lte-softmodem + -Wl,--start-group + RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS L2 + ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 + NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB + -Wl,--end-group z dl) + +target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES}) +target_link_libraries (lte-softmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES}) +target_link_libraries (lte-softmodem ${LIB_LMS_LIBRARIES}) +target_link_libraries (lte-softmodem ${T_LIB}) + +# lte-softmodem-nos1 is both eNB and UE implementation +################################################### +add_executable(lte-softmodem-nos1 + ${rrc_h} + ${s1ap_h} + ${OPENAIR_BIN_DIR}/messages_xml.h + ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c + ${OPENAIR_TARGETS}/RT/USER/lte-enb.c + ${OPENAIR_TARGETS}/RT/USER/lte-ru.c + ${OPENAIR_TARGETS}/RT/USER/lte-softmodem.c + ${OPENAIR2_DIR}/ENB_APP/NB_IoT_interface.c + ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c + ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c + ${OPENAIR_TARGETS}/COMMON/create_tasks.c + ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c + ${OPENAIR2_DIR}/RRC/NAS/nas_config.c + ${OPENAIR2_DIR}/RRC/NAS/rb_config.c + ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c + ${OPENAIR_DIR}/common/utils/system.c + ${XFORMS_SOURCE} + ${XFORMS_SOURCE_SOFTMODEM} + ${T_SOURCE} + ${CONFIG_SOURCES} + ${SHLIB_LOADER_SOURCES} + ) +target_link_libraries (lte-softmodem-nos1 + -Wl,--start-group + RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB PHY LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} + ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 + NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB + -Wl,--end-group z dl ) + +target_link_libraries (lte-softmodem-nos1 ${LIBXML2_LIBRARIES}) +target_link_libraries (lte-softmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES}) +target_link_libraries (lte-softmodem-nos1 ${LIB_LMS_LIBRARIES}) +target_link_libraries (lte-softmodem-nos1 ${T_LIB}) + +# lte-uesoftmodem is UE implementation +####################################### + +add_executable(lte-uesoftmodem + ${rrc_h} + ${s1ap_h} + ${OPENAIR_BIN_DIR}/messages_xml.h + ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c + ${OPENAIR_TARGETS}/RT/USER/lte-ue.c + ${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c + ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c + ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c + ${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c + ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c + ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c + ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c + ${OPENAIR_DIR}/common/utils/utils.c + ${OPENAIR_DIR}/common/utils/system.c + ${XFORMS_SOURCE} + ${XFORMS_SOURCE_SOFTMODEM} + ${T_SOURCE} + ${CONFIG_SOURCES} + ${SHLIB_LOADER_SOURCES} + ) + +target_link_libraries (lte-uesoftmodem + -Wl,--start-group + RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_UE_LIB PHY_UE LFDS L2_UE + ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 + -Wl,--end-group z dl) + +target_link_libraries (lte-uesoftmodem ${LIBXML2_LIBRARIES}) +target_link_libraries (lte-uesoftmodem pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES}) +target_link_libraries (lte-uesoftmodem ${LIB_LMS_LIBRARIES}) +target_link_libraries (lte-uesoftmodem ${T_LIB}) + +# lte-softmodem-nos1 is both eNB and UE implementation +################################################### +add_executable(lte-uesoftmodem-nos1 + ${rrc_h} + ${s1ap_h} + ${OPENAIR_BIN_DIR}/messages_xml.h + ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c + ${OPENAIR_TARGETS}/RT/USER/lte-ue.c + ${OPENAIR_TARGETS}/RT/USER/lte-uesoftmodem.c + ${OPENAIR1_DIR}/SIMULATION/TOOLS/taus.c + ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c + ${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c + ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c + ${OPENAIR2_DIR}/RRC/NAS/nas_config.c + ${OPENAIR2_DIR}/RRC/NAS/rb_config.c + ${OPENAIR1_DIR}/SIMULATION/ETH_TRANSPORT/netlink_init.c + ${OPENAIR_DIR}/common/utils/system.c + ${XFORMS_SOURCE} + ${XFORMS_SOURCE_SOFTMODEM} + ${T_SOURCE} + ${CONFIG_SOURCES} + ${SHLIB_LOADER_SOURCES} + ) +target_link_libraries (lte-uesoftmodem-nos1 + -Wl,--start-group + RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_UE_LIB PHY_UE LFDS L2_UE ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} + ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 + -Wl,--end-group z dl ) + +target_link_libraries (lte-uesoftmodem-nos1 ${LIBXML2_LIBRARIES}) +target_link_libraries (lte-uesoftmodem-nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp ${XFORMS_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES}) +target_link_libraries (lte-uesoftmodem-nos1 ${LIB_LMS_LIBRARIES}) +target_link_libraries (lte-uesoftmodem-nos1 ${T_LIB}) + +# USIM process +################# +#add_executable(usim +# ${OPENAIR3_DIR}/NAS/TOOLS/usim_data.c +# ${OPENAIR3_DIR}/NAS/USER/API/USIM/usim_api.c +# ${OPENAIR3_DIR}/NAS/USER/API/USIM/aka_functions.c +# ${OPENAIR3_DIR}/NAS/COMMON/UTIL/memory.c +# ${OPENAIR3_DIR}/NAS/COMMON/UTIL/nas_log.c +# ${OPENAIR3_DIR}/NAS/COMMON/UTIL/OctetString.c +# ${OPENAIR3_DIR}/NAS/COMMON/UTIL/TLVEncoder.c +# ) +#target_link_libraries (usim ${NAS_LIB} UTIL ${ITTI_LIB} LFDS pthread rt nettle crypto m) + +# ??? +##################### +#add_executable(nvram +# ${OPENAIR3_DIR}/NAS/TOOLS/ue_data.c +# ${OPENAIR3_DIR}/NAS/COMMON/UTIL/memory.c +# ${OPENAIR3_DIR}/NAS/COMMON/UTIL/nas_log.c +# ) +#target_link_libraries (nvram LIB_NAS_UE UTIL ${ITTI_LIB} LFDS pthread rt nettle crypto m) + + +###################################" +# Addexecutables for tests +#################################### + +# A all in one network simulator +################ +add_executable(oaisim + ${rrc_h} + ${s1ap_h} + ${x2ap_h} + ${OPENAIR_BIN_DIR}/messages_xml.h + ${OPENAIR_TARGETS}/RT/USER/lte-ue.c + ${OPENAIR_TARGETS}/RT/USER/lte-ru.c + ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c + ${OPENAIR_TARGETS}/SIMU/USER/channel_sim.c + ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c + ${OPENAIR_TARGETS}/SIMU/USER/oaisim_config.c + ${OPENAIR_TARGETS}/SIMU/USER/sinr_sim.c + ${OPENAIR_TARGETS}/SIMU/USER/cor_SF_sim.c + ${OPENAIR_TARGETS}/SIMU/USER/oaisim_functions.c + ${OPENAIR_TARGETS}/SIMU/USER/event_handler.c + ${OPENAIR_TARGETS}/SIMU/USER/oaisim.c + ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c + ${OPENAIR2_DIR}/RRC/NAS/nas_config.c + ${OPENAIR2_DIR}/RRC/NAS/rb_config.c + ${OPENAIR3_DIR}/NAS/UE/nas_ue_task.c + ${OPENAIR_DIR}/common/utils/utils.c + ${OPENAIR_DIR}/common/utils/system.c + ${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c + ${XFORMS_SOURCE} + ${T_SOURCE} + ${CONFIG_SOURCES} + ${SHLIB_LOADER_SOURCES} +) + + +target_include_directories(oaisim PUBLIC ${OPENAIR_TARGETS}/SIMU/USER) +target_link_libraries (oaisim + -Wl,-ldl,--start-group + RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_UE_LIB PHY_UE LFDS L2_UE ${MSC_LIB} LIB_NAS_UE SIMU SECU_OSA ${ITTI_LIB} ${MIH_LIB} + ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 + -Wl,--end-group z dl) + +target_link_libraries (oaisim ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) +target_link_libraries (oaisim pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} sctp z + ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES}) +#Force link with forms, regardless XFORMS option +target_link_libraries (oaisim forms) +target_link_libraries (oaisim ${T_LIB}) + + +# A all in one network simulator +################ +add_executable(oaisim_nos1 + ${rrc_h} + ${s1ap_h} + ${x2ap_h} + ${OPENAIR_BIN_DIR}/messages_xml.h + ${OPENAIR_TARGETS}/RT/USER/lte-ue.c + ${OPENAIR_TARGETS}/RT/USER/lte-ru.c + ${OPENAIR_TARGETS}/RT/USER/rt_wrapper.c + ${OPENAIR_TARGETS}/SIMU/USER/channel_sim.c + ${OPENAIR_TARGETS}/SIMU/USER/init_lte.c + ${OPENAIR_TARGETS}/SIMU/USER/oaisim_config.c + ${OPENAIR_TARGETS}/SIMU/USER/sinr_sim.c + ${OPENAIR_TARGETS}/SIMU/USER/cor_SF_sim.c + ${OPENAIR_TARGETS}/SIMU/USER/oaisim_functions.c + ${OPENAIR_TARGETS}/SIMU/USER/event_handler.c + ${OPENAIR_TARGETS}/SIMU/USER/oaisim.c + ${OPENAIR_TARGETS}/ARCH/COMMON/common_lib.c + ${OPENAIR2_DIR}/RRC/NAS/nas_config.c + ${OPENAIR2_DIR}/RRC/NAS/rb_config.c + ${OPENAIR_TARGETS}/COMMON/create_tasks_ue.c + ${OPENAIR_DIR}/common/utils/system.c + ${XFORMS_SOURCE} + ${T_SOURCE} + ${CONFIG_SOURCES} + ${SHLIB_LOADER_SOURCES} +) +target_include_directories(oaisim_nos1 PUBLIC ${OPENAIR_TARGETS}/SIMU/USER) +target_link_libraries (oaisim_nos1 + -Wl,--start-group + RRC_LIB X2AP_LIB SECU_CN UTIL HASHTABLE SCHED_UE_LIB PHY_UE LFDS ${MSC_LIB} ${ITTI_LIB} SIMU L2_UE ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 + -Wl,--end-group z dl ) + +target_link_libraries (oaisim_nos1 ${LIBXML2_LIBRARIES} ${LAPACK_LIBRARIES}) +target_link_libraries (oaisim_nos1 pthread m ${CONFIG_LIBRARIES} rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} + ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${OPENPGM_LIBRARIES} ${PROTOBUF_LIB} ${CMAKE_DL_LIBS} ${LIBYAML_LIBRARIES}) +#Force link with forms, regardless XFORMS option +target_link_libraries (oaisim_nos1 forms) + +#message("protobuflib is ${PROTOBUF_LIB}") + +target_link_libraries (oaisim_nos1 ${T_LIB}) + + +# Unitary tests for each piece of L1: example, mbmssim is MBMS L1 simulator +##################################### + +#special case for dlim TM4, which uses its own version of phy_scope code +add_executable(dlsim_tm4 + ${OPENAIR_BIN_DIR}/messages_xml.h + ${OPENAIR1_DIR}/SIMULATION/LTE_PHY/dlsim_tm4.c + ${OPENAIR1_DIR}/PHY/TOOLS/lte_phy_scope_tm4.c + ${T_SOURCE} + ) +target_link_libraries (dlsim_tm4 + -Wl,--start-group SIMU UTIL SCHED_LIB PHY LFDS ${ITTI_LIB} -Wl,--end-group + pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} + ) + +foreach(myExe dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim pdcchsim pucchsim prachsim syncsim) + + add_executable(${myExe} + ${OPENAIR_BIN_DIR}/messages_xml.h + ${OPENAIR1_DIR}/SIMULATION/LTE_PHY/${myExe}.c + ${XFORMS_SOURCE} + ${T_SOURCE} + ${CONFIG_SOURCES} + ${SHLIB_LOADER_SOURCES} + ) + target_link_libraries (${myExe} + + -Wl,--start-group SIMU UTIL SCHED_LIB PHY LFDS ${ITTI_LIB} LFDS7 -Wl,--end-group + pthread m rt ${CONFIG_LIBRARIES} ${ATLAS_LIBRARIES} ${XFORMS_LIBRARIES} ${T_LIB} dl + ) +endforeach(myExe) + +add_executable(test_epc_generate_scenario + ${OPENAIR3_DIR}/TEST/EPC_TEST/generate_scenario.c + ${OPENAIR3_DIR}/TEST/EPC_TEST/generate_scenario.h + ${OPENAIR2_DIR}/ENB_APP/enb_config.h + ${OPENAIR2_DIR}/COMMON/commonDef.h + ${OPENAIR2_DIR}/COMMON/messages_def.h + ${OPENAIR2_DIR}/COMMON/messages_types.h + ${OPENAIR3_DIR}/S1AP/s1ap_eNB_defs.h + ${OPENAIR_BIN_DIR}/messages_xml.h + ) +target_link_libraries (test_epc_generate_scenario + -Wl,--start-group RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} L2 -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} + ) + +add_executable(test_epc_play_scenario + ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario.c + ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_decode.c + ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_display.c + ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_fsm.c + ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_parse.c + ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_s1ap.c + ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_s1ap_compare_ie.c + ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_s1ap_eNB_defs.h + ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario_sctp.c + ${OPENAIR3_DIR}/TEST/EPC_TEST/play_scenario.h + ${OPENAIR2_DIR}/COMMON/commonDef.h + ${OPENAIR2_DIR}/COMMON/messages_def.h + ${OPENAIR2_DIR}/COMMON/messages_types.h + ${OPENAIR_BIN_DIR}/messages_xml.h + ) +target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c) +target_link_libraries (test_epc_play_scenario + -Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} + ) + + +#unitary tests for Core NEtwork pieces +################################# +foreach(myExe s1ap + secu_knas_encrypt_eia1 + secu_kenb + aes128_ctr_encrypt + aes128_ctr_decrypt + secu_knas_encrypt_eea2 + secu_knas secu_knas_encrypt_eea1 + kdf + aes128_cmac_encrypt + secu_knas_encrypt_eia2) + add_executable(test_${myExe} + ${OPENAIR3_DIR}/TEST/test_${myExe}.c + ) + target_link_libraries (test_${myExe} + -Wl,--start-group SECU_CN UTIL LFDS -Wl,--end-group m rt crypt ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES} + ) +endforeach(myExe) + +# to be added +#../targets/TEST/PDCP/test_pdcp.c +#../targets/TEST/PDCP/with_rlc/test_pdcp_rlc.c + +#ensure that the T header files are generated before targets depending on them +if (${T_TRACER}) + foreach(i + #all "add_executable" definitions (except tests, rb_tool, updatefw) + lte-softmodem lte-softmodem-nos1 oaisim oaisim_nos1 + dlsim_tm4 dlsim dlsim_tm7 ulsim pbchsim scansim mbmssim + pdcchsim pucchsim prachsim syncsim + #all "add_library" definitions + ITTI RRC_LIB S1AP_LIB S1AP_ENB X2AP_LIB + oai_exmimodevif oai_usrpdevif oai_bladerfdevif oai_lmssdrdevif + oai_eth_transpro + FLPT_MSG ASYNC_IF FLEXRAN_AGENT HASHTABLE MSC UTIL OMG_SUMO SECU_OSA + SECU_CN SCHED_LIB PHY L2 default_sched remote_sched RAL CN_UTILS + GTPV1U SCTP_CLIENT UDP LIB_NAS_UE LFDS LFDS7 SIMU OPENAIR0_LIB) + if (TARGET ${i}) + add_dependencies(${i} generate_T) + endif() + endforeach(i) +endif (${T_TRACER}) + +################################################## +# Generated specific cases is not regular code +############################################### + +##################"" +# itti symbolic debug print require to generate a specific include file +######################################## + +# retrieve the compiler options to send it to gccxml +get_directory_property( DirDefs COMPILE_DEFINITIONS ) +foreach( d ${DirDefs} ) + list(APPEND itti_compiler_options "-D${d}") +endforeach() +get_directory_property( DirDefs INCLUDE_DIRECTORIES ) +foreach( d ${DirDefs} ) + list(APPEND itti_compiler_options "-I${d}") +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") +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}) +else() + set(xml_command castxml --castxml-gccxml ${itti_compiler_options} ${ITTI_H} -o ${OPENAIR_BIN_DIR}/messages.xml) +endif() + +add_custom_command ( + OUTPUT ${OPENAIR_BIN_DIR}/messages.xml + COMMAND ${xml_command} + DEPENDS ${S1AP_OAI_generated} ${RRC_FULL_DIR}/asn1_constants.h + ) + +add_custom_command ( + OUTPUT ${OPENAIR_BIN_DIR}/messages_xml.h + COMMAND sed -e 's/ *//' -e 's/\"/\\\\\"/g' -e 's/^/\"/' -e 's/$$/\\\\n\"/' ${OPENAIR_BIN_DIR}/messages.xml > ${OPENAIR_BIN_DIR}/messages_xml.h + DEPENDS ${OPENAIR_BIN_DIR}/messages.xml ${RRC_FULL_DIR}/asn1_constants.h + ) + +################ +# Kernel modules +############### +# Set compiler options for kernel modules +# we need to get out cmake to use the regular Linux Kernel process +# this is documented as https://www.kernel.org/doc/Documentation/kbuild/modules.txt +###################################### + +# retrieve the compiler options to send it to gccxml +get_directory_property(DirDefs COMPILE_DEFINITIONS ) +foreach( d ${DirDefs} ) + set(module_cc_opt "${module_cc_opt} -D${d}") +endforeach() +get_directory_property( DirDefs INCLUDE_DIRECTORIES ) +foreach( d ${DirDefs} ) + set(module_cc_opt "${module_cc_opt} -I${d}") +endforeach() + +EXECUTE_PROCESS(COMMAND uname -r + OUTPUT_VARIABLE os_release + OUTPUT_STRIP_TRAILING_WHITESPACE) +SET(module_build_path /lib/modules/${os_release}/build) + +function(make_driver name dir) + file(MAKE_DIRECTORY ${OPENAIR_BIN_DIR}/${name}) + foreach(f IN ITEMS ${ARGN}) + list(APPEND src_path_list ${dir}/${f}) + string(REGEX REPLACE "c *$" "o" obj ${f}) + set(objs "${objs} ${obj}") + endforeach() + CONFIGURE_FILE(${OPENAIR_CMAKE}/tools/Kbuild.cmake ${OPENAIR_BIN_DIR}/${name}/Kbuild) + add_custom_command(OUTPUT ${name}.ko + COMMAND make -C ${module_build_path} M=${OPENAIR_BIN_DIR}/${name} + WORKING_DIRECTORY ${OPENAIR_BIN_DIR}/${name} + COMMENT "building ${module}.ko" + VERBATIM + SOURCES ${src_path_list} + ) + add_custom_target(${name} DEPENDS ${name}.ko) +endfunction(make_driver name dir src) + +# nashmesh module +################ +list(APPEND nasmesh_src device.c common.c ioctl.c classifier.c tool.c mesh.c) +set(module_cc_opt "${module_cc_opt} -DNAS_NETLINK -DPDCP_USE_NETLINK") +# legacy Makefile was using NAS_NETLINK flag, but other drivers the hereafter flag +# so, this cmake use OAI_NW_DRIVER_USE_NETLINK everywhere +if (OAI_NW_DRIVER_USE_NETLINK) + list(APPEND nasmesh_src netlink.c) +endif() +make_driver(nasmesh ${OPENAIR2_DIR}/NETWORK_DRIVER/MESH ${nasmesh_src}) + +# user space tool for configuring MESH IP driver +################ +add_executable(rb_tool + ${OPENAIR2_DIR}/NETWORK_DRIVER/MESH/constant.h + ${OPENAIR2_DIR}/NETWORK_DRIVER/MESH/ioctl.h + ${OPENAIR2_DIR}/NETWORK_DRIVER/MESH/rrc_nas_primitives.h + ${OPENAIR2_DIR}/NETWORK_DRIVER/MESH/RB_TOOL/rb_tool.c +) +target_include_directories(rb_tool PRIVATE ${OPENAIR2_DIR}/NETWORK_DRIVER/MESH/) + +# ??? +#################### +list(APPEND oai_nw_drv_src device.c common.c ioctl.c classifier.c tool.c) +if(OAI_NW_DRIVER_USE_NETLINK) + list(APPEND oai_nw_drv_src netlink.c) +endif() +make_driver(oai_nw_drv ${OPENAIR2_DIR}/NETWORK_DRIVER/LITE ${oai_nw_drv_src}) + +# Exmimo board drivers +######################### +list(APPEND openair_rf_src module_main.c irq.c fileops.c exmimo_fw.c) +make_driver(openair_rf ${OPENAIR_TARGETS}/ARCH/EXMIMO/DRIVER/eurecom ${openair_rf_src}) + +add_executable(updatefw + ${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/OAI_FW_INIT/updatefw.c +) + +# ue_ip: purpose ??? +############### +list(APPEND ue_ip_src device.c common.c) +if(OAI_NW_DRIVER_USE_NETLINK) + list(APPEND ue_ip_src netlink.c) +endif() +make_driver(ue_ip ${OPENAIR2_DIR}/NETWORK_DRIVER/UE_IP ${ue_ip_src}) + + +# OCTAVE tools +############### +set(OCT_INCL -I${OPENAIR_TARGETS}/ARCH/EXMIMO/DEFS -I${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/LIB -I${OPENAIR_TARGETS}/ARCH/COMMON) +set(OCT_LIBS -L${CMAKE_CURRENT_BINARY_DIR} -lm -lOPENAIR0_LIB) +set(OCT_FLAGS -DEXMIMO) +set(OCT_DIR ${OPENAIR_TARGETS}/ARCH/EXMIMO/USERSPACE/OCTAVE) +set(OCT_FILES + oarf_config_exmimo.oct + oarf_config_exmimo.oct + oarf_get_frame.oct + oarf_stop.oct + oarf_send_frame.oct + oarf_get_num_detected_cards.oct + oarf_stop_without_reset.oct +) + +foreach(file IN ITEMS ${OCT_FILES}) + string(REGEX REPLACE "oct *$" "cc" src ${file}) + add_custom_command( + OUTPUT ${file} + DEPENDS ${OCT_DIR}/${src} OPENAIR0_LIB + COMMAND mkoctfile + ARGS ${OCT_FLAGS} ${OCT_INCL} ${OCT_LIBS} + ARGS -o ${file} ${OCT_DIR}/${src} + COMMENT "Generating ${file}" + VERBATIM + ) +endforeach(file) + +ADD_CUSTOM_TARGET(oarf + DEPENDS ${OCT_FILES} +) + +include (${OPENAIR_DIR}/common/utils/telnetsrv/telnetsrv_CMakeLists.txt) + + + + diff --git a/cmake_targets/tools/build_helper b/cmake_targets/tools/build_helper new file mode 100755 index 0000000000..f0ae7e79c8 --- /dev/null +++ b/cmake_targets/tools/build_helper @@ -0,0 +1,771 @@ +#/* +# * 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 +# */ + +# file build_helper +# brief +# authors Laurent Thomas, Lionel GAUTHIER +# +####################################### +if [ ! -f /etc/os-release ]; then + echo "No /etc/os-release file found. You're likely on an unsupported distro." + exit -1 +fi +OS_DISTRO=$(grep "^ID=" /etc/os-release | sed "s/ID=//" | sed "s/\"//g") +OS_RELEASE=$(grep "^VERSION_ID=" /etc/os-release | sed "s/VERSION_ID=//" | sed "s/\"//g") +case "$OS_DISTRO" in + fedora) OS_BASEDISTRO="fedora"; INSTALLER="dnf"; CMAKE="cmake" ;; + rhel) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE="cmake3" ;; + centos) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE="cmake3" ;; + debian) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;; + ubuntu) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;; +esac +KERNEL_VERSION=$(uname -r | cut -d '.' -f1) +KERNEL_MAJOR=$(uname -r | cut -d '.' -f2) + +SUDO='sudo -E' + +############################### +## echo and family +############################### +black='\E[30m' +red='\E[31m' +green='\E[32m' +yellow='\E[33m' +blue='\E[1;34m' +magenta='\E[35m' +cyan='\E[36m' +white='\E[37m' +reset_color='\E[00m' +COLORIZE=1 + +cecho() { + # Color-echo + # arg1 = message + # arg2 = color + local default_msg="No Message." + message=${1:-$default_msg} + color=${2:-$green} + [ "$COLORIZE" = "1" ] && message="$color$message$reset_color" + echo -e "$message" + return +} + +echo_error() { cecho "$*" $red ;} +echo_fatal() { cecho "$*" $red; exit -1 ;} +echo_warning() { cecho "$*" $yellow ;} +echo_success() { cecho "$*" $green ;} +echo_info() { cecho "$*" $blue ;} + +######################## +# distribution helpers # +######################## + +# This function return a string to identify the distribution we are running +# If we can't check the distribution, it returns "Unknown" +# This function return always true as exit code by design +# Examples: +# ubuntu16.04 +# debian8.5 +get_distribution_release() { + if [[ ! -z "$OS_DISTRO$OS_RELEASE" ]]; then + echo "$OS_DISTRO$OS_RELEASE" + else + echo Unknown + fi +} + +check_supported_distribution() { + local distribution=$(get_distribution_release) + case "$distribution" in + "ubuntu17.10") return 0 ;; + "ubuntu17.04") return 0 ;; + "ubuntu16.04") return 0 ;; + "ubuntu14.04") return 0 ;; + "fedora24") return 0 ;; + "rhel7") return 0 ;; + "centos7") return 0 ;; + esac + return 1 +} + +################## +# Error handlers # +################## + +handler_EXIT() { + local exit_code=$? + [ "$exit_code" -eq 0 ] || echo_error "build have failed" + exit $exit_code +} + +trap handler_EXIT EXIT + +########################### +# Cleaners +########################### + +clean_kernel() { + $SUDO modprobe ip_tables + $SUDO modprobe x_tables + $SUDO iptables -P INPUT ACCEPT + $SUDO iptables -F INPUT + $SUDO iptables -P OUTPUT ACCEPT + $SUDO iptables -F OUTPUT + $SUDO iptables -P FORWARD ACCEPT + $SUDO iptables -F FORWARD + $SUDO iptables -t nat -F + $SUDO iptables -t mangle -F + $SUDO iptables -t filter -F + $SUDO iptables -t raw -F + echo_info "Flushed iptables" + $SUDO rmmod nasmesh > /dev/null 2>&1 + $SUDO rmmod oai_nw_drv > /dev/null 2>&1 + $SUDO rmmod openair_rf > /dev/null 2>&1 + $SUDO rmmod ue_ip > /dev/null 2>&1 + echo_info "removed drivers from kernel" +} + +clean_all_files() { + set_openair_env + dir=$OPENAIR_DIR/cmake_targets + rm -rf $dir/log $OPENAIR_DIR/targets/bin/* + rm -rf $dir/lte_build_oai $dir/lte-simulators/build + rm -rf $dir/oaisim_build_oai/build $dir/oaisim_build_oai/CMakeLists.txt + rm -rf $dir/autotests/bin $dir/autotests/log $dir/autotests/*/build +} + +################################### +# Compilers +################################### + +#check_warnings: +# print error message if the compilation had warnings +#argument: +# $1: log file +check_warnings() { + #we look for 'warning:' in the compilation log file + #this is how gcc starts a warning + #this is not perfect, we may get false positive + warning_count=`grep "warning:" "$1"|wc -l` + if [ $warning_count -gt 0 ]; then + echo_error "WARNING: $warning_count warnings. See $1" + fi +} + +compilations() { + cd $OPENAIR_DIR/cmake_targets/$1/build + set +e + { + rm -f $3 + if [ "$VERBOSE_COMPILE" == "1" ]; then + make -j`nproc` $2 VERBOSE=$VERBOSE_COMPILE + else + make -j`nproc` $2 + fi + + } > $dlog/$2.$REL.txt 2>&1 + set -e + echo_info "Log file for compilation has been written to: $dlog/$2.$REL.txt" + if [ -s $3 ] ; then + cp $3 $4 + echo_success "$2 compiled" + check_warnings "$dlog/$2.$REL.txt" + else + echo_error "$2 compilation failed" + exit 1 + fi +} + +############################################ +# External packages installers +############################################ + +install_protobuf_from_source(){ + protobuf_install_log=$OPENAIR_DIR/cmake_targets/log/protobuf_install_log.txt + echo_info "\nInstalling Google Protobuf from sources. The log file for Protobuf installation is here: $protobuf_install_log " + ( + cd /tmp + echo "Downloading protobuf" + #rm -rf /tmp/protobuf-2.6.1.tar.gz* /tmp/protobuf-2.6.1 + #wget https://github.com/google/protobuf/releases/download/v2.6.1/protobuf-2.6.1.tar.gz + #tar -xzvf protobuf-2.6.1.tar.gz --owner $USER --group $USER --no-same-owner + #cd protobuf-2.6.1/ + rm -rf /tmp/protobuf-cpp-3.3.0.tar.gz* /tmp/protobuf-3.3.0 + wget https://github.com/google/protobuf/releases/download/v3.3.0/protobuf-cpp-3.3.0.tar.gz + tar -xzvf protobuf-cpp-3.3.0.tar.gz --owner $USER --group $(groups | cut -d" " -f1) --no-same-owner + cd protobuf-3.3.0/ + ./configure + echo "Compiling protobuf" + make -j`nproc` + $SUDO make install + $SUDO ldconfig + ) >& $protobuf_install_log +} + +install_protobuf_c_from_source(){ + protobuf_c_install_log=$OPENAIR_DIR/cmake_targets/log/protobuf_c_install_log.txt + echo_info "\nInstalling Google Protobuf_C from sources. The log file for Protobuf_C installation is here: $protobuf_c_install_log " + ( + if [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then + export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig + fi + cd /tmp + echo "Downloading protobuf-c" + rm -rf /tmp/protobuf-c + git clone https://github.com/protobuf-c/protobuf-c.git + cd protobuf-c + git checkout 2a46af42784abf86804d536f6e0122d47cfeea45 + ./autogen.sh + ./configure + echo "Compiling protobuf-c" + make -j`nproc` + $SUDO make install + $SUDO ldconfig + ) >& $protobuf_c_install_log +} + +install_usrp_uhd_driver_from_source(){ + uhd_install_log=$OPENAIR_DIR/cmake_targets/log/uhd_install_log.txt + echo_info "\nInstalling UHD driver from sources. The log file for UHD driver installation is here: $uhd_install_log " + ( + cd /tmp + echo "Downloading UHD driver" + rm -rf /tmp/uhd + git clone https://github.com/EttusResearch/uhd.git + cd uhd + git checkout tags/release_003_010_001_001 + mkdir -p host/build + cd host/build + $CMAKE ../ + echo "Compiling UHD" + make -j`nproc` + make test + $SUDO make install + $SUDO ldconfig + ) >& $uhd_install_log +} + +check_install_usrp_uhd_driver(){ + if [[ "$OS_DISTRO" == "ubuntu" ]]; then + #first we remove old installation + $SUDO apt-get remove -y uhd || true + $SUDO apt-get remove libuhd-dev libuhd003 uhd-host -y + v=$(lsb_release -cs) + $SUDO apt-add-repository --remove "deb http://files.ettus.com/binaries/uhd/repo/uhd/ubuntu/$v $v main" + #The new USRP repository + $SUDO add-apt-repository ppa:ettusresearch/uhd -y + $SUDO apt-get update + $SUDO apt-get -y --allow-unauthenticated install python python-tk libboost-all-dev libusb-1.0-0-dev + $SUDO apt-get -y --allow-unauthenticated install libuhd-dev libuhd003 uhd-host + elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then + $SUDO $INSTALLER -y install python boost libusb-devel libusbx-devel boost-devel python-mako python-docutils cmake + $SUDO pip install requests + if [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then + # until EPEL repo hasn't bumped UHD driver to >=3.10 in EPEL, build driver from source + $SUDO $INSTALLER -y remove uhd uhd-devel uhd-firmware + install_usrp_uhd_driver_from_source + else + $SUDO $INSTALLER -y install uhd uhd-devel uhd-firmware + fi + fi +} + +install_usrp_uhd_driver() { + if [[ "$OS_DISTRO" == "ubuntu" ]]; then + # We move uhd-host apart because it depends on linux kernel version + # On newer kernels, it fails to install + $SUDO apt-get -y install uhd-host + fi + if [ -z $1 ]; then + $SUDO uhd_images_downloader + else + $SUDO uhd_images_downloader -i $1 + fi +} + +install_bladerf_driver_from_source(){ + bladerf_install_log=$OPENAIR_DIR/cmake_targets/log/bladerf_install_log.txt + echo_info "\nInstalling BladeRF driver from sources. The log file for BladeRF driver installation is here: $bladerf_install_log " + ( + cd /tmp + echo "Downloading BladeRF driver" + rm -rf /tmp/bladeRF + git clone https://github.com/Nuand/bladeRF.git + cd bladeRF + git checkout tags/2016.06 + mkdir -p build + cd build + $CMAKE ../ + echo "Compiling BladeRF driver" + make + $SUDO make install + $SUDO ldconfig + echo "Downloading FPGA and firmware images" + cd /tmp/bladeRF + wget https://www.nuand.com/fx3/bladeRF_fw_latest.img + wget https://www.nuand.com/fpga/hostedx40-latest.rbf + sudo mkdir -p /usr/share/Nuand/bladeRF + sudo mv bladeRF_fw_latest.img /usr/share/Nuand/bladeRF/bladeRF_fw.img + sudo mv hostedx40-latest.rbf /usr/share/Nuand/bladeRF/hostedx40.rbf + ) >& $bladerf_install_log +} + +check_install_bladerf_driver(){ + if [[ "$OS_DISTRO" == "ubuntu" ]]; then + if [ "$(get_distribution_release)" == "ubuntu14.04" ] ; then + $SUDO add-apt-repository -y ppa:bladerf/bladerf + $SUDO apt-get update + fi + $SUDO apt-get install -y --allow-unauthenticated bladerf libbladerf-dev + $SUDO apt-get install -y --allow-unauthenticated bladerf-firmware-fx3 + $SUDO apt-get install -y --allow-unauthenticated bladerf-fpga-hostedx40 + elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then + install_bladerf_driver_from_source + else + echo_error "BladeRF Installer for OAI does not support automatic build. Install BladeRF compiling sources manually from BladeRF website" + fi +} + +flash_firmware_bladerf() { + $SUDO bladeRF-cli --flash-firmware /usr/share/Nuand/bladeRF/bladeRF_fw.img +} + +check_install_lmssdr_driver(){ + if ( [ -d "/usr/local/include/lime" ] && + [ -f "/usr/local/include/lime/LimeSuite.h" ] ) + then + echo_success "Found lmssdr drivers and tools installed from source" + else + echo_error "lmssdr support implies installing lmssdr drivers and tools" \ + " from sources. check:" + echo_info "https://open-cells.com/index.php/2017/05/10/limesdr-installation/" + echo_fatal "Cannot compile lmssdr device" + fi + + +} + +check_install_additional_tools (){ + $SUDO $INSTALLER update -y + if [[ "$OS_DISTRO" == "ubuntu" ]]; then + PACKAGE_LIST="\ + check \ + dialog \ + dkms \ + gawk \ + libboost-all-dev \ + libpthread-stubs0-dev \ + openvpn \ + pkg-config \ + python-dev \ + python-pexpect \ + sshfs \ + swig \ + tshark \ + uml-utilities \ + unzip \ + valgrind \ + vlan \ + ctags \ + ntpdate \ + iperf3 \ + android-tools-adb \ + wvdial \ + python-numpy \ + sshpass \ + nscd \ + bc \ + ntp \ + python-scipy \ + python-matplotlib" + elif [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then + PACKAGE_LIST="\ + check \ + dialog \ + dkms \ + gawk \ + boost-devel \ + openvpn \ + pkgconfig \ + pexpect \ + sshfs \ + swig \ + wireshark \ + unzip \ + valgrind \ + vconfig \ + ctags \ + ntpdate \ + iperf3 \ + wvdial \ + numpy \ + sshpass \ + nscd \ + python2-paramiko \ + python-pyroute2 \ + python-netifaces \ + scipy \ + python-matplotlib" + elif [[ "$OS_DISTRO" == "fedora" ]]; then + PACKAGE_LIST=" \ + check \ + dialog \ + dkms \ + gawk \ + boost-devel \ + openvpn \ + pkgconfig \ + python-pexpect \ + sshfs \ + swig \ + wireshark \ + unzip \ + valgrind \ + vconfig \ + ctags \ + ntpdate \ + iperf3 \ + wvdial \ + python-numpy \ + sshpass \ + nscd \ + python2-paramiko \ + python-pyroute2 \ + python-netifaces \ + python2-scipy \ + python2-matplotlib" + fi + $SUDO $INSTALLER install -y $PACKAGE_LIST + + $SUDO rm -fr /opt/ssh + $SUDO GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/ssh.git /opt/ssh + + #The packages below are already installed for Redhat distros (RHEL, CentOS, Fedora) + if [[ "$OS_DISTRO" == "ubuntu" ]]; then + $SUDO pip install paramiko + $SUDO pip install pyroute2 colorama + log_netiface=$OPENAIR_DIR/cmake_targets/log/netiface_install_log.txt + echo_info "Installing Netinterfaces package. The logfile for installation is in $log_netiface" + ( + $SUDO rm -fr /tmp/netifaces-0.10.4.tar.gz /tmp/netifaces + wget -P /tmp https://pypi.python.org/packages/18/fa/dd13d4910aea339c0bb87d2b3838d8fd923c11869b1f6e741dbd0ff3bc00/netifaces-0.10.4.tar.gz + tar -xzvf /tmp/netifaces-0.10.4.tar.gz -C /tmp + cd /tmp/netifaces-0.10.4 + $SUDO python setup.py install + cd - + ) >& $log_netiface + fi +} + +check_install_oai_software() { + local specific_packages="" + if ! check_supported_distribution; then + echo_error "Your distribution $(get_distribution_release) is not supported by oai !" + exit 1 + fi + $SUDO $INSTALLER update -y + if [[ "$OS_DISTRO" == "ubuntu" ]]; then + local LAPACK_LIBNAME="liblapack.so" + local LAPACK_TARGET="/usr/lib/atlas-base/atlas/liblapack.so" + $SUDO apt install -y software-properties-common + case "$(get_distribution_release)" in + "ubuntu14.04") + specific_packages="libtasn1-3-dev gccxml libgnutls-dev libatlas-dev" + # For iperf3 + $SUDO add-apt-repository "deb http://archive.ubuntu.com/ubuntu trusty-backports universe" + $SUDO apt-get update + ;; + "ubuntu16.04") + specific_packages="libtasn1-6-dev gccxml libgnutls-dev libatlas-dev" + ;; + "ubuntu17.04") + specific_packages="libtasn1-6-dev castxml libgnutls28-dev libatlas-dev" + ;; + "ubuntu17.10") + specific_packages="libtasn1-6-dev castxml libgnutls28-dev" + LAPACK_LIBNAME="liblapack.so-x86_64-linux-gnu" + LAPACK_TARGET="/usr/lib/x86_64-linux-gnu/atlas/liblapack.so" + ;; + esac + $SUDO apt-get install -y \ + $specific_packages \ + autoconf \ + automake \ + bison \ + build-essential \ + cmake \ + cmake-curses-gui \ + doxygen \ + doxygen-gui \ + texlive-latex-base \ + ethtool \ + flex \ + gdb \ + git \ + graphviz \ + gtkwave \ + guile-2.0-dev \ + iperf \ + iproute \ + iptables \ + iptables-dev \ + libatlas-base-dev \ + libblas-dev \ + libconfig8-dev \ + libffi-dev \ + libforms-bin \ + libforms-dev \ + libgcrypt11-dev \ + libgmp-dev \ + libgtk-3-dev \ + libidn2-0-dev \ + libidn11-dev \ + libmysqlclient-dev \ + liboctave-dev \ + libpgm-dev \ + libpython2.7-dev \ + libsctp1 \ + libsctp-dev \ + libssl-dev \ + libtool \ + libusb-1.0-0-dev \ + libxml2 \ + libxml2-dev \ + libxslt1-dev \ + mscgen \ + octave \ + octave-signal \ + openssh-client \ + openssh-server \ + openssl \ + python \ + subversion \ + xmlstarlet \ + python-pip \ + pydb \ + libyaml-dev \ + wget \ + libxpm-dev + + $SUDO update-alternatives --set "$LAPACK_LIBNAME" "$LAPACK_TARGET" + + $SUDO apt-get install -y nettle-dev nettle-bin + elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then + if [[ "$OS_DISTRO" == "rhel" ]] || [[ "$OS_DISTRO" == "centos" ]]; then + if rpm -q epel-release > /dev/null; then + echo "EPEL repos already present. Good." + else + echo "EPEL repos not present. Installing them." + $SUDO $INSTALLER install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm + fi + $SUDO $INSTALLER install -y python-epdb + $SUDO $INSTALLER install -y gccxml + else + $SUDO $INSTALLER install -y mscgen pydb + # Fedora repos already contain gccxml's successor castxml. + $SUDO $INSTALLER install -y castxml + fi + + $SUDO $INSTALLER install -y \ + autoconf \ + automake \ + bc \ + bison \ + $CMAKE \ + doxygen \ + ethtool \ + flex \ + gdb \ + git \ + graphviz \ + gtkwave \ + guile-devel \ + iperf \ + iproute \ + iptables \ + iptables-devel \ + atlas-devel \ + blas-devel \ + libconfig-devel \ + libffi-devel \ + xforms \ + xforms-devel \ + libgcrypt-devel \ + gmp-devel \ + gtk3-devel \ + libidn2-devel \ + libidn-devel \ + mariadb-devel \ + octave-devel \ + openpgm-devel \ + lksctp-tools \ + lksctp-tools-devel \ + openssl-devel \ + libtasn1 \ + libtool \ + libusb-devel \ + libxml2 \ + libxml2-devel \ + libxslt-devel \ + octave \ + octave-signal \ + openssh-clients \ + openssh-server \ + openssl \ + patch \ + psmisc \ + python \ + subversion \ + xmlstarlet \ + python-pip \ + wget \ + kernel-headers \ + kernel-devel \ + nettle-devel \ + gnutls-devel \ + libXpm-devel \ + lapack \ + lapack-devel \ + blas \ + blas-devel \ + libyaml-devel + fi + + install_asn1c_from_source + $SUDO rm -fr /opt/ssh + $SUDO git clone https://gist.github.com/2190472.git /opt/ssh +} + +install_asn1c_from_source(){ + asn1_install_log=$OPENAIR_DIR/cmake_targets/log/asn1c_install_log.txt + echo_info "\nInstalling ASN1. The log file for ASN1 installation is here: $asn1_install_log " + ( + $SUDO rm -rf /tmp/asn1c + # GIT_SSL_NO_VERIFY=true git clone https://gitlab.eurecom.fr/oai/asn1c.git /tmp/asn1c + git clone https://github.com/velichkov/asn1c /tmp/asn1c + cd /tmp/asn1c + git checkout s1ap + test -f configure || autoreconf -iv + ./configure + make -j`nproc` + $SUDO make install + cd - + $SUDO ldconfig + ) > $asn1_install_log 2>&1 +} + +################################################# +# 2. compile +################################################ + +install_nas_tools() { + if [ ! -f .ue.nvram0 ]; then + echo_success "generate .ue_emm.nvram .ue.nvram" + ./nvram --gen -c $1 -o $2 + else + [ ./nvram -nt .ue.nvram0 -o ./nvram -nt .ue_emm.nvram0 ] && ./nvram --gen -c $1 -o $2 + fi + + if [ ! -f .usim.nvram0 ]; then + echo_success "generate .usim.nvram" + ./usim --gen -c $1 -o $2 + else + [ ./usim -nt .usim.nvram0 ] && ./usim --gen -c $1 -o $2 + fi + +} + + +################################ +# set_openair_env +############################### +set_openair_env(){ + fullpath=`readlink -f $BASH_SOURCE` + [ -f "/.$fullpath" ] || fullpath=`readlink -f $PWD/$fullpath` + openair_path=${fullpath%/cmake_targets/*} + openair_path=${openair_path%/targets/*} + openair_path=${openair_path%/openair[123]/*} + export OPENAIR_DIR=$openair_path + export OPENAIR1_DIR=$openair_path/openair1 + export OPENAIR2_DIR=$openair_path/openair2 + export OPENAIR3_DIR=$openair_path/openair3 + export OPENAIR_TARGETS=$openair_path/targets +} + +################################ +# Function to killall the subprocesses when Ctrl-C Key is hit +############################### +function handle_ctrl_c(){ +CURPID=$$ +ppid=$$ +arraycounter=1 +echo_info "** Trapped CTRL-C. Killing all subprocesses now..." +echo_info "** Calling sync now..." +sync +while true +do + FORLOOP=FALSE + # Get all the child process id + for i in `ps -ef| awk '$3 == '$ppid' { print $2 }'` + do + if [ $i -ne $CURPID ] ; then + procid[$arraycounter]=$i + arraycounter=`expr $arraycounter + 1` + ppid=$i + FORLOOP=TRUE + fi + done + if [ "$FORLOOP" = "FALSE" ] ; then + arraycounter=`expr $arraycounter - 1` + ## We want to kill child process id first and then parent id's + while [ $arraycounter -ne 0 ] + do + echo "first we send ctrl-c to program" + $SUDO kill -INT "${procid[$arraycounter]}" + sleep 5 + echo "Now we force kill if that didn't work" + $SUDO kill -9 "${procid[$arraycounter]}" >/dev/null + arraycounter=`expr $arraycounter - 1` + done + exit + fi +done +} + + +# get from http://www.linuxjournal.com/content/validating-ip-address-bash-script +validate_ip() { + +local ip=$1 +local stat=1 + +if [[ $ip =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then + OIFS=$IFS + IFS='.' + ip=($ip) + IFS=$OIFS + [[ ${ip[0]} -le 255 && ${ip[1]} -le 255 \ + && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]] + stat=$? +fi + +return $stat +} diff --git a/cmake_targets/tools/fix_asn1 b/cmake_targets/tools/fix_asn1 new file mode 100755 index 0000000000..cba93f5898 --- /dev/null +++ b/cmake_targets/tools/fix_asn1 @@ -0,0 +1,202 @@ +#!/bin/bash + +# in those arrays, each line is: +# + +RRC_Rel14=( + "SystemInformation-r8-IEs.h" 4df485c5ddf2540eca271876cdc512caa19b0890 "fix_asn1.data/RRC.rel14/SystemInformation-r8-IEs.h.diff" + "SystemInformation-NB-r13-IEs.h" 6d91332d5c39205819b06e5e36efe62ff8e5b33b "fix_asn1.data/RRC.rel14/SystemInformation-NB-r13-IEs.h.diff" +) + +RRC_Rel10=( + "SystemInformation-r8-IEs.h" 603cd6615cff36ec7020692d72c0d6de7c4859cb "fix_asn1.data/RRC.rel10/SystemInformation-r8-IEs.h.diff" +) + +X2AP_Rel11_2=( + "X2ap-CriticalityDiagnostics-IE-List.h" ae96308b37fcbcbf39da5012e42968135fc5f27b "fix_asn1.data/X2AP.rel11.2/X2ap-CriticalityDiagnostics-IE-List.h.diff" +) + +red_color="$(tput setaf 1)" +green_color="$(tput setaf 2)" +reset_color="$(tput sgr0)" + +function error() +{ + echo -e "$red_color"ERROR: "$@""$reset_color" + exit 1 +} + +function check_sha1() +{ + local file="$1" + local target_sha1="$2" + + if [ ! -f "$file" ] + then + error "$file: no such file" + fi + + # we don't use the line 4 of the file + # it contains the location of the ASN1 grammar + # and this location is not the same on every + # installation (this is for *.h files, for *.c + # files it's no big deal to skip that line) + local computed_sha1=$(sed 4d "$file" | sha1sum | cut -f 1 -d ' ') + + if [ "$target_sha1" != "$computed_sha1" ] + then + error "$file: wrong SHA1" + fi +} + +function patch_file() +{ + local patch="$1" + local file="$2" + + echo -e "$green_color""patch file $file with $OPENAIR_DIR/cmake_targets/tools/$patch""$reset_color" + + patch "$file" "$OPENAIR_DIR/cmake_targets/tools/$patch" + if [ $? -ne 0 ] + then + error "patching of $file with $OPENAIR_DIR/cmake_targets/tools/$patch failed" + fi +} + +function apply_patches() +{ + local directory="$1" + local array=$2 + local len=$3 # the length could be computed locally but the way to do it is not clear to me [CROUX] + + local i + local file + local sha1 + local patch + local item + + for (( i = 0; i < $len; i += 3 )) + do + # special bash syntax to access the array + item=$array[$i]; file=${!item} + item=$array[$((i+1))]; sha1=${!item} + item=$array[$((i+2))]; patch=${!item} + check_sha1 "$directory/$file" "$sha1" + patch_file "$patch" "$directory/$file" + done +} + +function patch_rrc() +{ + local directory="$1" + local version="$2" + + case "$version" in + Rel14 ) + echo "patching RRC files release 14" + #apply_patches "$directory" RRC_Rel14 ${#RRC_Rel14[*]} + ;; + Rel10 ) + echo "patching RRC files release 10" + apply_patches "$directory" RRC_Rel10 ${#RRC_Rel10[*]} + ;; + Rel8 ) + echo "patching RRC files release 8 TODO?" + ;; + * ) + error unknwon/unhandled RRC version \'"$version"\' + ;; + esac +} + +function patch_nr_rrc() +{ + local directory="$1" + local version="$2" + + case "$version" in + NR_Rel15 ) + echo "patching NR_RRC files release 15" + apply_patches "$directory" NR_RRC_Rel15 ${#NR_RRC_Rel15[*]} + ;; + * ) + error unknwon/unhandled NR_RRC version \'"$version"\' + ;; + esac +} + + +function patch_x2ap() +{ + local directory="$1" + local version="$2" + + case "$version" in + R14 ) + ;; + R11 ) + echo "patching X2AP files release 11.2" + apply_patches "$directory" X2AP_Rel11_2 ${#X2AP_Rel11_2[*]} + ;; + * ) + error unknwon/unhandled X2AP version \'"$version"\' + ;; + esac +} + +function patch_s1ap() +{ + local directory="$1" + local version="$2" + + case "$version" in + R14 ) + ;; + R10 ) + #nothing to do anymore (fixes went to asn1c) + ;; + * ) + error unknwon/unhandled S1AP version \'"$version"\' + ;; + esac +} + +function main() +{ + if [ $# -ne 3 ] + then + echo "ERROR: pass " + exit 1 + fi + + if [ x"$OPENAIR_DIR" = x ] + then + error "the variable OPENAIR_DIR is not set" + fi + + local directory="$1" + local module="$2" + local version="$3" + + case "$module" in + RRC ) + patch_rrc "$directory" "$version" + ;; + NR_RRC ) + patch_nr_rrc "$directory" "$version" + ;; + X2AP ) + patch_x2ap "$directory" "$version" + ;; + S1AP ) + patch_s1ap "$directory" "$version" + ;; + * ) + error unknown module "$module" + ;; + esac + + exit 0 +} + +main "$@" diff --git a/cmake_targets/tools/generate_asn1 b/cmake_targets/tools/generate_asn1 new file mode 100755 index 0000000000..fb38455a12 --- /dev/null +++ b/cmake_targets/tools/generate_asn1 @@ -0,0 +1,165 @@ +#!/bin/bash + +function main() +{ +mkdir -p $1 +cd $1 +shift + +local module="$2" + +#if this script is called with only 2 arguments (so 1 here after the shift), it's for RRC +#(there may be a better way...) +if [ $# -eq 2 ]; then + +#asn1c does not work well with extension groups, we need the following fix: +# replace [[ by ' SEQUENCE {' +# and ]] by '} OPTIONAL' +# is ext with N starting from 1 and incremented at each new [[ ]] just +#following another [[ ]] +# +#this is what the following C program does + +echo generate asnfix.c + +cat << EOF > asnfix.c +/* transforms: + * '[[' to 'name SEQUENCE {' + * ']]' to '} OPTIONAL' + * name is ext1, ext2, ..., for each [[ at the same level + * levels are delimited by { and } + * -- to end of line is a comment and unprocessed + * nested [[ ]] not handled + * { and } must be balanced + * [[ and ]] can be whatever, every combination is valid + */ +#include +#include + +void level(int toplevel) +{ + int c; + int next_name = 1; + + while (1) { + c = getchar(); +next: + if (c == EOF) { if (toplevel) break; abort(); } + + if (c == '-') { + c = getchar(); + if (c != '-') { putchar('-'); goto next; } + putchar(c); putchar(c); + while (1) { + c = getchar(); if (c == EOF) abort(); + putchar(c); + if (c == '\n') break; + } + continue; + } + + if (c == '[') { + c = getchar(); + if (c != '[') { putchar('['); goto next; } + printf("ext%d SEQUENCE {", next_name); + next_name++; + continue; + } + + if (c == ']') { + c = getchar(); + if (c != ']') { putchar(']'); goto next; } + printf("} OPTIONAL"); + continue; + } + + putchar(c); + if (c == '}') { if (toplevel) abort(); break; } + if (c == '{') level(0); + } +} + +int main(void) +{ + level(1); + fflush(stdout); + return 0; +} +EOF + +echo compile asnfix.c + +gcc -Wall -o asnfix asnfix.c + +echo run asnfix on $1 + +./asnfix < $1 > fixed_grammar.asn + +rm -f asnfix asnfix.c + +echo done with asnfix + +echo running asn1c + +case "$module" in + RRC ) + asn1c -gen-PER -fcompound-names -no-gen-example fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample + ;; + NR_RRC ) + export ASN1C_PREFIX=NR_ + asn1c -gen-PER -fcompound-names -no-gen-example fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample + ;; + S1AP ) + export ASN1C_PREFIX=S1AP_ + asn1c -gen-PER -fcompound-names -no-gen-example fixed_grammar.asn 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample + ;; +esac + + + +rm -f fixed_grammar.asn + +echo asn1c done + +else + +case "$module" in + RRC ) + asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample + ;; + NR_RRC ) + export ASN1C_PREFIX=NR_ + asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample + ;; + S1AP ) + export ASN1C_PREFIX=S1AP_ + asn1c -fcompound-names -fno-include-deps -gen-PER -no-gen-OER -no-gen-example $* 2>&1 | grep -v -- '->' | grep -v '^Compiled' |grep -v sample + ;; +esac + +fi + +awk ' + BEGIN { + print "#ifndef __ASN1_CONSTANTS_H__" + print "#define __ASN1_CONSTANTS_H__" + } + /INTEGER ::=/ { + gsub("INTEGER ::=","") + gsub("--","//") + gsub("-1","_minus_1") + gsub("-","_") + printf("#define %s\n",$0) + } + /::=.*INTEGER.*[(]/ { + nb_fields=split($0,val,"[:=().]+"); + gsub("-","_",val[1]); + printf("#define min_val_%s %s\n",val[1],val[nb_fields-2]); + printf("#define max_val_%s %s\n",val[1],val[nb_fields-1]); + } + END { + print "#endif "; + } ' $1 > asn1_constants.h +} + +main "$@" diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c new file mode 100644 index 0000000000..4020056e6f --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_decoding.c @@ -0,0 +1,748 @@ +/* + * 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 + */ + +/*! \file PHY/LTE_TRANSPORT/dlsch_decoding.c +* \brief Top-level routines for decoding Turbo-coded (DLSCH) transport channels from 36-212, V8.6 2009-03 +* \author R. Knopp +* \date 2011 +* \version 0.1 +* \company Eurecom +* \email: knopp@eurecom.fr +* \note +* \warning +*/ + +//#include "defs.h" +#include "PHY/defs.h" +#include "PHY/extern.h" +#include "PHY/CODING/extern.h" +#include "SCHED/extern.h" +#include "SIMULATION/TOOLS/defs.h" +//#define DEBUG_DLSCH_DECODING +//#define UE_DEBUG_TRACE 1 + + +void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch) +{ + + int i,r; + + if (dlsch) { + for (i=0; iMdlharq; i++) { + if (dlsch->harq_processes[i]) { + if (dlsch->harq_processes[i]->b) { + free16(dlsch->harq_processes[i]->b,MAX_DLSCH_PAYLOAD_BYTES); + dlsch->harq_processes[i]->b = NULL; + } + + for (r=0; rharq_processes[i]->c[r],((r==0)?8:0) + 3+768); + dlsch->harq_processes[i]->c[r] = NULL; + } + + for (r=0; rharq_processes[i]->d[r]) { + free16(dlsch->harq_processes[i]->d[r],((3*8*6144)+12+96)*sizeof(short)); + dlsch->harq_processes[i]->d[r] = NULL; + } + + free16(dlsch->harq_processes[i],sizeof(LTE_DL_UE_HARQ_t)); + dlsch->harq_processes[i] = NULL; + } + } + + free16(dlsch,sizeof(LTE_UE_DLSCH_t)); + dlsch = NULL; + } +} + +LTE_UE_DLSCH_t *new_ue_dlsch(uint8_t Kmimo,uint8_t Mdlharq,uint32_t Nsoft,uint8_t max_turbo_iterations,uint8_t N_RB_DL, uint8_t abstraction_flag) +{ + + LTE_UE_DLSCH_t *dlsch; + uint8_t exit_flag = 0,i,r; + + unsigned char bw_scaling =1; + + switch (N_RB_DL) { + case 6: + bw_scaling =16; + break; + + case 25: + bw_scaling =4; + break; + + case 50: + bw_scaling =2; + break; + + default: + bw_scaling =1; + break; + } + + dlsch = (LTE_UE_DLSCH_t *)malloc16(sizeof(LTE_UE_DLSCH_t)); + + if (dlsch) { + memset(dlsch,0,sizeof(LTE_UE_DLSCH_t)); + dlsch->Kmimo = Kmimo; + dlsch->Mdlharq = Mdlharq; + dlsch->Nsoft = Nsoft; + dlsch->max_turbo_iterations = max_turbo_iterations; + + for (i=0; iharq_processes[i] = (LTE_DL_UE_HARQ_t *)malloc16(sizeof(LTE_DL_UE_HARQ_t)); + + if (dlsch->harq_processes[i]) { + memset(dlsch->harq_processes[i],0,sizeof(LTE_DL_UE_HARQ_t)); + dlsch->harq_processes[i]->first_tx=1; + dlsch->harq_processes[i]->b = (uint8_t*)malloc16(MAX_DLSCH_PAYLOAD_BYTES/bw_scaling); + + if (dlsch->harq_processes[i]->b) + memset(dlsch->harq_processes[i]->b,0,MAX_DLSCH_PAYLOAD_BYTES/bw_scaling); + else + exit_flag=3; + + if (abstraction_flag == 0) { + for (r=0; rharq_processes[i]->c[r] = (uint8_t*)malloc16(((r==0)?8:0) + 3+ 768); + + if (dlsch->harq_processes[i]->c[r]) + memset(dlsch->harq_processes[i]->c[r],0,((r==0)?8:0) + 3+ 768); + else + exit_flag=2; + + dlsch->harq_processes[i]->d[r] = (short*)malloc16(((3*8*6144)+12+96)*sizeof(short)); + + if (dlsch->harq_processes[i]->d[r]) + memset(dlsch->harq_processes[i]->d[r],0,((3*8*6144)+12+96)*sizeof(short)); + else + exit_flag=2; + } + } + } else { + exit_flag=1; + } + } + + if (exit_flag==0) + return(dlsch); + } + + printf("new_ue_dlsch with size %zu: exit_flag = %u\n",sizeof(LTE_DL_UE_HARQ_t), exit_flag); + free_ue_dlsch(dlsch); + + return(NULL); +} + +uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue, + short *dlsch_llr, + LTE_DL_FRAME_PARMS *frame_parms, + LTE_UE_DLSCH_t *dlsch, + LTE_DL_UE_HARQ_t *harq_process, + uint32_t frame, + uint8_t subframe, + uint8_t harq_pid, + uint8_t is_crnti, + uint8_t llr8_flag) +{ + +#if UE_TIMING_TRACE + time_stats_t *dlsch_rate_unmatching_stats=&phy_vars_ue->dlsch_rate_unmatching_stats; + time_stats_t *dlsch_turbo_decoding_stats=&phy_vars_ue->dlsch_turbo_decoding_stats; + time_stats_t *dlsch_deinterleaving_stats=&phy_vars_ue->dlsch_deinterleaving_stats; +#endif + uint32_t A,E; + uint32_t G; + uint32_t ret,offset; + uint16_t iind; + // uint8_t dummy_channel_output[(3*8*block_length)+12]; + short dummy_w[MAX_NUM_DLSCH_SEGMENTS][3*(6144+64)]; + uint32_t r,r_offset=0,Kr,Kr_bytes,err_flag=0; + uint8_t crc_type; +#ifdef DEBUG_DLSCH_DECODING + uint16_t i; +#endif + //#ifdef __AVX2__ +#if 0 + int Kr_last,skipped_last=0; + uint8_t (*tc_2cw)(int16_t *y, + int16_t *y2, + uint8_t *, + uint8_t *, + uint16_t, + uint16_t, + uint16_t, + uint8_t, + uint8_t, + uint8_t, + time_stats_t *, + time_stats_t *, + time_stats_t *, + time_stats_t *, + time_stats_t *, + time_stats_t *, + time_stats_t *); + +#endif +decoder_if_t tc; + + + + + if (!dlsch_llr) { + printf("dlsch_decoding.c: NULL dlsch_llr pointer\n"); + return(dlsch->max_turbo_iterations); + } + + if (!harq_process) { + printf("dlsch_decoding.c: NULL harq_process pointer\n"); + return(dlsch->max_turbo_iterations); + } + + if (!frame_parms) { + printf("dlsch_decoding.c: NULL frame_parms pointer\n"); + return(dlsch->max_turbo_iterations); + } + + if (subframe>9) { + printf("dlsch_decoding.c: Illegal subframe index %d\n",subframe); + return(dlsch->max_turbo_iterations); + } + + if (dlsch->harq_ack[subframe].ack != 2) { + LOG_D(PHY, "[UE %d] DLSCH @ SF%d : ACK bit is %d instead of DTX even before PDSCH is decoded!\n", + phy_vars_ue->Mod_id, subframe, dlsch->harq_ack[subframe].ack); + } + + if (llr8_flag == 0) { + //#ifdef __AVX2__ +#if 0 + tc_2cw = phy_threegpplte_turbo_decoder16avx2; +#endif + tc = decoder16; + } + else + { + AssertFatal (harq_process->TBS >= 256 , "Mismatch flag nbRB=%d TBS=%d mcs=%d Qm=%d RIV=%d round=%d \n", + harq_process->nb_rb, harq_process->TBS,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round); + tc = decoder8; + } + + + // nb_rb = dlsch->nb_rb; + + /* + if (nb_rb > frame_parms->N_RB_DL) { + printf("dlsch_decoding.c: Illegal nb_rb %d\n",nb_rb); + return(max_turbo_iterations); + }*/ + + /*harq_pid = dlsch->current_harq_pid[phy_vars_ue->current_thread_id[subframe]]; + if (harq_pid >= 8) { + printf("dlsch_decoding.c: Illegal harq_pid %d\n",harq_pid); + return(max_turbo_iterations); + } + */ + + harq_process->trials[harq_process->round]++; + + A = harq_process->TBS; //2072 for QPSK 1/3 + + ret = dlsch->max_turbo_iterations; + + + G = harq_process->G; + //get_G(frame_parms,nb_rb,dlsch->rb_alloc,mod_order,num_pdcch_symbols,phy_vars_ue->frame,subframe); + + // printf("DLSCH Decoding, harq_pid %d Ndi %d\n",harq_pid,harq_process->Ndi); + + if (harq_process->round == 0) { + // This is a new packet, so compute quantities regarding segmentation + harq_process->B = A+24; + lte_segmentation(NULL, + NULL, + harq_process->B, + &harq_process->C, + &harq_process->Cplus, + &harq_process->Cminus, + &harq_process->Kplus, + &harq_process->Kminus, + &harq_process->F); + // CLEAR LLR's HERE for first packet in process + } + + /* + else { + printf("dlsch_decoding.c: Ndi>0 not checked yet!!\n"); + return(max_turbo_iterations); + } + */ + err_flag = 0; + r_offset = 0; + + unsigned char bw_scaling =1; + + switch (frame_parms->N_RB_DL) { + case 6: + bw_scaling =16; + break; + + case 25: + bw_scaling =4; + break; + + case 50: + bw_scaling =2; + break; + + default: + bw_scaling =1; + break; + } + + if (harq_process->C > MAX_NUM_DLSCH_SEGMENTS/bw_scaling) { + LOG_E(PHY,"Illegal harq_process->C %d > %d\n",harq_process->C,MAX_NUM_DLSCH_SEGMENTS/bw_scaling); + return((1+dlsch->max_turbo_iterations)); + } +#ifdef DEBUG_DLSCH_DECODING + printf("Segmentation: C %d, Cminus %d, Kminus %d, Kplus %d\n",harq_process->C,harq_process->Cminus,harq_process->Kminus,harq_process->Kplus); +#endif + + opp_enabled=1; + + for (r=0; rC; r++) { + + + // Get Turbo interleaver parameters + if (rCminus) + Kr = harq_process->Kminus; + else + Kr = harq_process->Kplus; + + Kr_bytes = Kr>>3; + + if (Kr_bytes<=64) + iind = (Kr_bytes-5); + else if (Kr_bytes <=128) + iind = 59 + ((Kr_bytes-64)>>1); + else if (Kr_bytes <= 256) + iind = 91 + ((Kr_bytes-128)>>2); + else if (Kr_bytes <= 768) + iind = 123 + ((Kr_bytes-256)>>3); + else { + printf("dlsch_decoding: Illegal codeword size %d!!!\n",Kr_bytes); + return(dlsch->max_turbo_iterations); + } + +#ifdef DEBUG_DLSCH_DECODING + printf("f1 %d, f2 %d, F %d\n",f1f2mat_old[2*iind],f1f2mat_old[1+(2*iind)],(r==0) ? harq_process->F : 0); +#endif + +#if UE_TIMING_TRACE + start_meas(dlsch_rate_unmatching_stats); +#endif + memset(&dummy_w[r][0],0,3*(6144+64)*sizeof(short)); + harq_process->RTC[r] = generate_dummy_w(4+(Kr_bytes*8), + (uint8_t*) &dummy_w[r][0], + (r==0) ? harq_process->F : 0); + +#ifdef DEBUG_DLSCH_DECODING + LOG_D(PHY,"HARQ_PID %d Rate Matching Segment %d (coded bits %d,unpunctured/repeated bits %d, TBS %d, mod_order %d, nb_rb %d, Nl %d, rv %d, round %d)...\n", + harq_pid,r, G, + Kr*3, + harq_process->TBS, + harq_process->Qm, + harq_process->nb_rb, + harq_process->Nl, + harq_process->rvidx, + harq_process->round); +#endif + +#ifdef DEBUG_DLSCH_DECODING + printf(" in decoding dlsch->harq_processes[harq_pid]->rvidx = %d\n", dlsch->harq_processes[harq_pid]->rvidx); +#endif + if (lte_rate_matching_turbo_rx(harq_process->RTC[r], + G, + harq_process->w[r], + (uint8_t*)&dummy_w[r][0], + dlsch_llr+r_offset, + harq_process->C, + dlsch->Nsoft, + dlsch->Mdlharq, + dlsch->Kmimo, + harq_process->rvidx, + (harq_process->round==0)?1:0, + harq_process->Qm, + harq_process->Nl, + r, + &E)==-1) { +#if UE_TIMING_TRACE + stop_meas(dlsch_rate_unmatching_stats); +#endif + LOG_E(PHY,"dlsch_decoding.c: Problem in rate_matching\n"); + return(dlsch->max_turbo_iterations); + } else + { +#if UE_TIMING_TRACE + stop_meas(dlsch_rate_unmatching_stats); +#endif + } + r_offset += E; + + /* + printf("Subblock deinterleaving, d %p w %p\n", + harq_process->d[r], + harq_process->w); + */ +#if UE_TIMING_TRACE + start_meas(dlsch_deinterleaving_stats); +#endif + sub_block_deinterleaving_turbo(4+Kr, + &harq_process->d[r][96], + + harq_process->w[r]); +#if UE_TIMING_TRACE + stop_meas(dlsch_deinterleaving_stats); +#endif +#ifdef DEBUG_DLSCH_DECODING + /* + if (r==0) { + write_output("decoder_llr.m","decllr",dlsch_llr,G,1,0); + write_output("decoder_in.m","dec",&harq_process->d[0][96],(3*8*Kr_bytes)+12,1,0); + } + + printf("decoder input(segment %d) :",r); + int i; for (i=0;i<(3*8*Kr_bytes)+12;i++) + printf("%d : %d\n",i,harq_process->d[r][96+i]); + printf("\n");*/ +#endif + + + // printf("Clearing c, %p\n",harq_process->c[r]); + memset(harq_process->c[r],0,Kr_bytes); + + // printf("done\n"); + if (harq_process->C == 1) + crc_type = CRC24_A; + else + crc_type = CRC24_B; + + /* + printf("decoder input(segment %d)\n",r); + for (i=0;i<(3*8*Kr_bytes)+12;i++) + if ((harq_process->d[r][96+i]>7) || + (harq_process->d[r][96+i] < -8)) + printf("%d : %d\n",i,harq_process->d[r][96+i]); + printf("\n"); + */ + + //#ifndef __AVX2__ +#if 1 + if (err_flag == 0) { +/* + LOG_I(PHY, "turbo algo Kr=%d cb_cnt=%d C=%d nbRB=%d crc_type %d TBSInput=%d TBSHarq=%d TBSplus24=%d mcs=%d Qm=%d RIV=%d round=%d maxIter %d\n", + Kr,r,harq_process->C,harq_process->nb_rb,crc_type,A,harq_process->TBS, + harq_process->B,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round,dlsch->max_turbo_iterations); +*/ + if (llr8_flag) { + AssertFatal (Kr >= 256, "turbo algo issue Kr=%d cb_cnt=%d C=%d nbRB=%d TBSInput=%d TBSHarq=%d TBSplus24=%d mcs=%d Qm=%d RIV=%d round=%d\n", + Kr,r,harq_process->C,harq_process->nb_rb,A,harq_process->TBS,harq_process->B,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round); + } +#if UE_TIMING_TRACE + start_meas(dlsch_turbo_decoding_stats); +#endif + LOG_D(PHY,"AbsSubframe %d.%d Start turbo segment %d/%d \n",frame%1024,subframe,r,harq_process->C-1); + ret = tc + (&harq_process->d[r][96], + NULL, + harq_process->c[r], + NULL, + Kr, + f1f2mat_old[iind*2], + f1f2mat_old[(iind*2)+1], + dlsch->max_turbo_iterations, + crc_type, + (r==0) ? harq_process->F : 0, + &phy_vars_ue->dlsch_tc_init_stats, + &phy_vars_ue->dlsch_tc_alpha_stats, + &phy_vars_ue->dlsch_tc_beta_stats, + &phy_vars_ue->dlsch_tc_gamma_stats, + &phy_vars_ue->dlsch_tc_ext_stats, + &phy_vars_ue->dlsch_tc_intl1_stats, + &phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1); + +#if UE_TIMING_TRACE + stop_meas(dlsch_turbo_decoding_stats); +#endif + } +#else + if ((harq_process->C == 1) || + ((r==harq_process->C-1) && (skipped_last==0))) { // last segment with odd number of segments + +#if UE_TIMING_TRACE + start_meas(dlsch_turbo_decoding_stats); +#endif + ret = tc + (&harq_process->d[r][96], + harq_process->c[r], + Kr, + f1f2mat_old[iind*2], + f1f2mat_old[(iind*2)+1], + dlsch->max_turbo_iterations, + crc_type, + (r==0) ? harq_process->F : 0, + &phy_vars_ue->dlsch_tc_init_stats, + &phy_vars_ue->dlsch_tc_alpha_stats, + &phy_vars_ue->dlsch_tc_beta_stats, + &phy_vars_ue->dlsch_tc_gamma_stats, + &phy_vars_ue->dlsch_tc_ext_stats, + &phy_vars_ue->dlsch_tc_intl1_stats, + &phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1); + #if UE_TIMING_TRACE + stop_meas(dlsch_turbo_decoding_stats); +#endif + // printf("single decode, exit\n"); + // exit(-1); + } + else { + // we can merge code segments + if ((skipped_last == 0) && (rC-1)) { + skipped_last = 1; + Kr_last = Kr; + } + else { + skipped_last=0; + + if (Kr_last == Kr) { // decode 2 code segments with AVX2 version +#ifdef DEBUG_DLSCH_DECODING + printf("single decoding segment %d (%p)\n",r-1,&harq_process->d[r-1][96]); +#endif +#if UE_TIMING_TRACE + start_meas(dlsch_turbo_decoding_stats); +#endif +#ifdef DEBUG_DLSCH_DECODING + printf("double decoding segments %d,%d (%p,%p)\n",r-1,r,&harq_process->d[r-1][96],&harq_process->d[r][96]); +#endif + ret = tc_2cw + (&harq_process->d[r-1][96], + &harq_process->d[r][96], + harq_process->c[r-1], + harq_process->c[r], + Kr, + f1f2mat_old[iind*2], + f1f2mat_old[(iind*2)+1], + dlsch->max_turbo_iterations, + crc_type, + (r==0) ? harq_process->F : 0, + &phy_vars_ue->dlsch_tc_init_stats, + &phy_vars_ue->dlsch_tc_alpha_stats, + &phy_vars_ue->dlsch_tc_beta_stats, + &phy_vars_ue->dlsch_tc_gamma_stats, + &phy_vars_ue->dlsch_tc_ext_stats, + &phy_vars_ue->dlsch_tc_intl1_stats, + &phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1); + /* + ret = tc + (&harq_process->d[r-1][96], + harq_process->c[r-1], + Kr_last, + f1f2mat_old[iind*2], + f1f2mat_old[(iind*2)+1], + dlsch->max_turbo_iterations, + crc_type, + (r==0) ? harq_process->F : 0, + &phy_vars_ue->dlsch_tc_init_stats, + &phy_vars_ue->dlsch_tc_alpha_stats, + &phy_vars_ue->dlsch_tc_beta_stats, + &phy_vars_ue->dlsch_tc_gamma_stats, + &phy_vars_ue->dlsch_tc_ext_stats, + &phy_vars_ue->dlsch_tc_intl1_stats, + &phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1); + + exit(-1);*/ +#if UE_TIMING_TRACE + stop_meas(dlsch_turbo_decoding_stats); +#endif + } + else { // Kr_last != Kr +#if UE_TIMING_TRACE + start_meas(dlsch_turbo_decoding_stats); +#endif + ret = tc + (&harq_process->d[r-1][96], + harq_process->c[r-1], + Kr_last, + f1f2mat_old[iind*2], + f1f2mat_old[(iind*2)+1], + dlsch->max_turbo_iterations, + crc_type, + (r==0) ? harq_process->F : 0, + &phy_vars_ue->dlsch_tc_init_stats, + &phy_vars_ue->dlsch_tc_alpha_stats, + &phy_vars_ue->dlsch_tc_beta_stats, + &phy_vars_ue->dlsch_tc_gamma_stats, + &phy_vars_ue->dlsch_tc_ext_stats, + &phy_vars_ue->dlsch_tc_intl1_stats, + &phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1); +#if UE_TIMING_TRACE + stop_meas(dlsch_turbo_decoding_stats); + + start_meas(dlsch_turbo_decoding_stats); +#endif + + ret = tc + (&harq_process->d[r][96], + harq_process->c[r], + Kr, + f1f2mat_old[iind*2], + f1f2mat_old[(iind*2)+1], + dlsch->max_turbo_iterations, + crc_type, + (r==0) ? harq_process->F : 0, + &phy_vars_ue->dlsch_tc_init_stats, + &phy_vars_ue->dlsch_tc_alpha_stats, + &phy_vars_ue->dlsch_tc_beta_stats, + &phy_vars_ue->dlsch_tc_gamma_stats, + &phy_vars_ue->dlsch_tc_ext_stats, + &phy_vars_ue->dlsch_tc_intl1_stats, + &phy_vars_ue->dlsch_tc_intl2_stats); //(is_crnti==0)?harq_pid:harq_pid+1); + +#if UE_TIMING_TRACE + + stop_meas(dlsch_turbo_decoding_stats); + + /*printf("Segmentation: C %d r %d, dlsch_rate_unmatching_stats %5.3f dlsch_deinterleaving_stats %5.3f dlsch_turbo_decoding_stats %5.3f \n", + harq_process->C, + r, + dlsch_rate_unmatching_stats->p_time/(cpuf*1000.0), + dlsch_deinterleaving_stats->p_time/(cpuf*1000.0), + dlsch_turbo_decoding_stats->p_time/(cpuf*1000.0));*/ +#endif + } + } + } +#endif + + + if ((err_flag == 0) && (ret>=(1+dlsch->max_turbo_iterations))) {// a Code segment is in error so break; + LOG_D(PHY,"AbsSubframe %d.%d CRC failed, segment %d/%d \n",frame%1024,subframe,r,harq_process->C-1); + err_flag = 1; + } + } + + int32_t frame_rx_prev = frame; + int32_t subframe_rx_prev = subframe - 1; + if (subframe_rx_prev < 0) { + frame_rx_prev--; + subframe_rx_prev += 10; + } + frame_rx_prev = frame_rx_prev%1024; + + if (err_flag == 1) { +#if UE_DEBUG_TRACE + LOG_I(PHY,"[UE %d] DLSCH: Setting NAK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d) Kr %d r %d harq_process->round %d\n", + phy_vars_ue->Mod_id, frame, subframe, harq_pid,harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs,Kr,r,harq_process->round); +#endif + dlsch->harq_ack[subframe].ack = 0; + dlsch->harq_ack[subframe].harq_id = harq_pid; + dlsch->harq_ack[subframe].send_harq_status = 1; + harq_process->errors[harq_process->round]++; + harq_process->round++; + + + // printf("Rate: [UE %d] DLSCH: Setting NACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round); + if (harq_process->round >= dlsch->Mdlharq) { + harq_process->status = SCH_IDLE; + harq_process->round = 0; + } + if(is_crnti) + { + LOG_D(PHY,"[UE %d] DLSCH: Setting NACK for subframe %d (pid %d, pid status %d, round %d/Max %d, TBS %d)\n", + phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->status,harq_process->round,dlsch->Mdlharq,harq_process->TBS); + } + + return((1+dlsch->max_turbo_iterations)); + } else { +#if UE_DEBUG_TRACE + LOG_I(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d TBS %d mcs %d nb_rb %d\n", + phy_vars_ue->Mod_id,subframe,harq_process->TBS,harq_process->mcs,harq_process->nb_rb); +#endif + + harq_process->status = SCH_IDLE; + harq_process->round = 0; + dlsch->harq_ack[subframe].ack = 1; + dlsch->harq_ack[subframe].harq_id = harq_pid; + dlsch->harq_ack[subframe].send_harq_status = 1; + //LOG_I(PHY,"[UE %d] DLSCH: Setting ACK for SFN/SF %d/%d (pid %d, status %d, round %d, TBS %d, mcs %d)\n", + // phy_vars_ue->Mod_id, frame, subframe, harq_pid, harq_process->status, harq_process->round,harq_process->TBS,harq_process->mcs); + + if(is_crnti) + { + LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d (pid %d, round %d, TBS %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round,harq_process->TBS); + } + //LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for subframe %d (pid %d, round %d)\n",phy_vars_ue->Mod_id,subframe,harq_pid,harq_process->round); + + } + + // Reassembly of Transport block here + offset = 0; + + /* + printf("harq_pid %d\n",harq_pid); + printf("F %d, Fbytes %d\n",harq_process->F,harq_process->F>>3); + printf("C %d\n",harq_process->C); + */ + for (r=0; rC; r++) { + if (rCminus) + Kr = harq_process->Kminus; + else + Kr = harq_process->Kplus; + + Kr_bytes = Kr>>3; + + // printf("Segment %d : Kr= %d bytes\n",r,Kr_bytes); + if (r==0) { + memcpy(harq_process->b, + &harq_process->c[0][(harq_process->F>>3)], + Kr_bytes - (harq_process->F>>3)- ((harq_process->C>1)?3:0)); + offset = Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0); + // printf("copied %d bytes to b sequence (harq_pid %d)\n", + // Kr_bytes - (harq_process->F>>3),harq_pid); + // printf("b[0] = %x,c[%d] = %x\n", + // harq_process->b[0], + // harq_process->F>>3, + // harq_process->c[0][(harq_process->F>>3)]); + } else { + memcpy(harq_process->b+offset, + harq_process->c[r], + Kr_bytes- ((harq_process->C>1)?3:0)); + offset += (Kr_bytes - ((harq_process->C>1)?3:0)); + } + } + + dlsch->last_iteration_cnt = ret; + + return(ret); +} + diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c new file mode 100644 index 0000000000..6284f279d8 --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_demodulation.c @@ -0,0 +1,6155 @@ +/* + * 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 + */ + +/*! \file PHY/LTE_TRANSPORT/dlsch_demodulation.c + * \brief Top-level routines for demodulating the PDSCH physical channel from 36-211, V8.6 2009-03 + * \author R. Knopp, F. Kaltenberger,A. Bhamri, S. Aubert, X. Xiang + * \date 2011 + * \version 0.1 + * \company Eurecom + * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr,ankit.bhamri@eurecom.fr,sebastien.aubert@eurecom.fr + * \note + * \warning + */ +//#include "PHY/defs.h" +#include "PHY/extern.h" +#include "SCHED/defs.h" +#include "defs.h" +#include "extern.h" +#include "PHY/sse_intrin.h" +#include "T.h" + +#define NOCYGWIN_STATIC + +/* dynamic shift for LLR computation for TM3/4 + * set as command line argument, see lte-softmodem.c + * default value: 0 + */ +int16_t dlsch_demod_shift = 0; +int16_t interf_unaw_shift = 13; + +//#define DEBUG_HARQ + +#define DEBUG_PHY 1 +//#define DEBUG_DLSCH_DEMOD 1 + +//#define DISABLE_LOG_X + +// [MCS][i_mod (0,1,2) = (2,4,6)] +unsigned char offset_mumimo_llr_drange_fix=0; +//inferference-free case +unsigned char interf_unaw_shift_tm4_mcs[29]={5, 3, 4, 3, 3, 2, 1, 1, 2, 0, 1, 1, 1, 1, 0, 0, + 1, 1, 1, 1, 0, 2, 1, 0, 1, 0, 1, 0, 0} ; +unsigned char interf_unaw_shift_tm1_mcs[29]={5, 5, 4, 3, 3, 3, 2, 2, 4, 4, 2, 3, 3, 3, 1, 1, + 0, 1, 1, 2, 5, 4, 4, 6, 5, 1, 0, 5, 6} ; // mcs 21, 26, 28 seem to be errorneous + +/* +//original values from sebastion + same hand tuning +unsigned char offset_mumimo_llr_drange[29][3]={{8,8,8},{7,7,7},{7,7,7},{7,7,7},{6,6,6},{6,6,6},{6,6,6},{5,5,5},{4,4,4},{1,2,4}, // QPSK +{5,5,4},{5,5,5},{5,5,5},{3,3,3},{2,2,2},{2,2,2},{2,2,2}, // 16-QAM +{2,2,1},{3,3,3},{3,3,3},{3,3,1},{2,2,2},{2,2,2},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0},{0,0,0}}; //64-QAM +*/ + /* + //first optimization try + unsigned char offset_mumimo_llr_drange[29][3]={{7, 8, 7},{6, 6, 7},{6, 6, 7},{6, 6, 6},{5, 6, 6},{5, 5, 6},{5, 5, 6},{4, 5, 4},{4, 3, 4},{3, 2, 2},{6, 5, 5},{5, 4, 4},{5, 5, 4},{3, 3, 2},{2, 2, 1},{2, 1, 1},{2, 2, 2},{3, 3, 3},{3, 3, 2},{3, 3, 2},{3, 2, 1},{2, 2, 2},{2, 2, 2},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0}}; + */ + //second optimization try + /* + unsigned char offset_mumimo_llr_drange[29][3]={{5, 8, 7},{4, 6, 8},{3, 6, 7},{7, 7, 6},{4, 7, 8},{4, 7, 4},{6, 6, 6},{3, 6, 6},{3, 6, 6},{1, 3, 4},{1, 1, 0},{3, 3, 2},{3, 4, 1},{4, 0, 1},{4, 2, 2},{3, 1, 2},{2, 1, 0},{2, 1, 1},{1, 0, 1},{1, 0, 1},{0, 0, 0},{1, 0, 0},{0, 0, 0},{0, 1, 0},{1, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0}}; w + */ +unsigned char offset_mumimo_llr_drange[29][3]= {{0, 6, 5},{0, 4, 5},{0, 4, 5},{0, 5, 4},{0, 5, 6},{0, 5, 3},{0, 4, 4},{0, 4, 4},{0, 3, 3},{0, 1, 2},{1, 1, 0},{1, 3, 2},{3, 4, 1},{2, 0, 0},{2, 2, 2},{1, 1, 1},{2, 1, 0},{2, 1, 1},{1, 0, 1},{1, 0, 1},{0, 0, 0},{1, 0, 0},{0, 0, 0},{0, 1, 0},{1, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0},{0, 0, 0}}; + + +extern void print_shorts(char *s,int16_t *x); + + +int rx_pdsch(PHY_VARS_UE *ue, + PDSCH_t type, + unsigned char eNB_id, + unsigned char eNB_id_i, //if this == ue->n_connected_eNB, we assume MU interference + uint32_t frame, + uint8_t subframe, + unsigned char symbol, + unsigned char first_symbol_flag, + RX_type_t rx_type, + unsigned char i_mod, + unsigned char harq_pid) +{ + + LTE_UE_COMMON *common_vars = &ue->common_vars; + LTE_UE_PDSCH **pdsch_vars; + LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms; + PHY_MEASUREMENTS *measurements = &ue->measurements; + LTE_UE_DLSCH_t **dlsch; + + int avg[4]; + int avg_0[2]; + int avg_1[2]; + +#if UE_TIMING_TRACE + uint8_t slot = 0; +#endif + + unsigned char aatx,aarx; + + unsigned short nb_rb = 0, round; + int avgs = 0, rb; + LTE_DL_UE_HARQ_t *dlsch0_harq,*dlsch1_harq = 0; + + uint8_t beamforming_mode; + uint32_t *rballoc; + + int32_t **rxdataF_comp_ptr; + int32_t **dl_ch_mag_ptr; + int32_t codeword_TB0 = -1; + int32_t codeword_TB1 = -1; + + + + switch (type) { + case SI_PDSCH: + pdsch_vars = &ue->pdsch_vars_SI[eNB_id]; + dlsch = &ue->dlsch_SI[eNB_id]; + dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; + beamforming_mode = 0; + break; + + case RA_PDSCH: + pdsch_vars = &ue->pdsch_vars_ra[eNB_id]; + dlsch = &ue->dlsch_ra[eNB_id]; + dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; + beamforming_mode = 0; + break; + + case PDSCH: + pdsch_vars = ue->pdsch_vars[ue->current_thread_id[subframe]]; + dlsch = ue->dlsch[ue->current_thread_id[subframe]][eNB_id]; + //printf("status TB0 = %d, status TB1 = %d \n", dlsch[0]->harq_processes[harq_pid]->status, dlsch[1]->harq_processes[harq_pid]->status); + LOG_D(PHY,"AbsSubframe %d.%d / Sym %d harq_pid %d, harq status %d.%d \n", + frame,subframe,symbol,harq_pid, + dlsch[0]->harq_processes[harq_pid]->status, + dlsch[1]->harq_processes[harq_pid]->status); + + if ((dlsch[0]->harq_processes[harq_pid]->status == ACTIVE) && + (dlsch[1]->harq_processes[harq_pid]->status == ACTIVE)){ + codeword_TB0 = dlsch[0]->harq_processes[harq_pid]->codeword; + codeword_TB1 = dlsch[1]->harq_processes[harq_pid]->codeword; + dlsch0_harq = dlsch[codeword_TB0]->harq_processes[harq_pid]; + dlsch1_harq = dlsch[codeword_TB1]->harq_processes[harq_pid]; +#ifdef DEBUG_HARQ + printf("[DEMOD] I am assuming both TBs are active\n"); +#endif + } + else if ((dlsch[0]->harq_processes[harq_pid]->status == ACTIVE) && + (dlsch[1]->harq_processes[harq_pid]->status != ACTIVE) ) { + codeword_TB0 = dlsch[0]->harq_processes[harq_pid]->codeword; + dlsch0_harq = dlsch[0]->harq_processes[harq_pid]; + dlsch1_harq = NULL; + codeword_TB1 = -1; +#ifdef DEBUG_HARQ + printf("[DEMOD] I am assuming only TB0 is active\n"); +#endif + } + else if ((dlsch[0]->harq_processes[harq_pid]->status != ACTIVE) && + (dlsch[1]->harq_processes[harq_pid]->status == ACTIVE) ){ + codeword_TB1 = dlsch[1]->harq_processes[harq_pid]->codeword; + dlsch0_harq = dlsch[1]->harq_processes[harq_pid]; + dlsch1_harq = NULL; + codeword_TB0 = -1; +#ifdef DEBUG_HARQ + printf("[DEMOD] I am assuming only TB1 is active, it is in cw %d\n", dlsch0_harq->codeword); +#endif + } + else { + LOG_E(PHY,"[UE][FATAL] Frame %d subframe %d: no active DLSCH\n",ue->proc.proc_rxtx[0].frame_rx,subframe); + return(-1); + } + beamforming_mode = ue->transmission_mode[eNB_id]<7?0:ue->transmission_mode[eNB_id]; + break; + + default: + LOG_E(PHY,"[UE][FATAL] Frame %d subframe %d: Unknown PDSCH format %d\n",ue->proc.proc_rxtx[0].frame_rx,subframe,type); + return(-1); + break; + } +#ifdef DEBUG_HARQ + printf("[DEMOD] MIMO mode = %d\n", dlsch0_harq->mimo_mode); + printf("[DEMOD] cw for TB0 = %d, cw for TB1 = %d\n", codeword_TB0, codeword_TB1); +#endif + + DevAssert(dlsch0_harq); + round = dlsch0_harq->round; + //printf("round = %d\n", round); + + if (eNB_id > 2) { + LOG_W(PHY,"dlsch_demodulation.c: Illegal eNB_id %d\n",eNB_id); + return(-1); + } + + if (!common_vars) { + LOG_W(PHY,"dlsch_demodulation.c: Null common_vars\n"); + return(-1); + } + + if (!dlsch[0]) { + LOG_W(PHY,"dlsch_demodulation.c: Null dlsch_ue pointer\n"); + return(-1); + } + + if (!pdsch_vars) { + LOG_W(PHY,"dlsch_demodulation.c: Null pdsch_vars pointer\n"); + return(-1); + } + + if (!frame_parms) { + LOG_W(PHY,"dlsch_demodulation.c: Null frame_parms\n"); + return(-1); + } + + if (((frame_parms->Ncp == NORMAL) && (symbol>=7)) || + ((frame_parms->Ncp == EXTENDED) && (symbol>=6))) + rballoc = dlsch0_harq->rb_alloc_odd; + else + rballoc = dlsch0_harq->rb_alloc_even; + + + if (dlsch0_harq->mimo_mode>DUALSTREAM_PUSCH_PRECODING) { + LOG_E(PHY,"This transmission mode is not yet supported!\n"); + return(-1); + } + + + if ((dlsch0_harq->mimo_mode==LARGE_CDD) || ((dlsch0_harq->mimo_mode>=DUALSTREAM_UNIFORM_PRECODING1) && (dlsch0_harq->mimo_mode<=DUALSTREAM_PUSCH_PRECODING))) { + DevAssert(dlsch1_harq); + if (eNB_id!=eNB_id_i) { + LOG_E(PHY,"TM3/TM4 requires to set eNB_id==eNB_id_i!\n"); + return(-1); + } + } + +#if UE_TIMING_TRACE + if(symbol > ue->frame_parms.symbols_per_tti>>1) + { + slot = 1; + } +#endif + +#ifdef DEBUG_HARQ + printf("Demod dlsch0_harq->pmi_alloc %d\n", dlsch0_harq->pmi_alloc); +#endif + + if (frame_parms->nb_antenna_ports_eNB>1 && beamforming_mode==0) { +#ifdef DEBUG_DLSCH_MOD + LOG_I(PHY,"dlsch: using pmi %x (%p), rb_alloc %x\n",pmi2hex_2Ar1(dlsch0_harq->pmi_alloc),dlsch[0],dlsch0_harq->rb_alloc_even[0]); +#endif + +#if UE_TIMING_TRACE + start_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); +#endif + nb_rb = dlsch_extract_rbs_dual(common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF, + common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id], + pdsch_vars[eNB_id]->rxdataF_ext, + pdsch_vars[eNB_id]->dl_ch_estimates_ext, + dlsch0_harq->pmi_alloc, + pdsch_vars[eNB_id]->pmi_ext, + rballoc, + symbol, + subframe, + ue->high_speed_flag, + frame_parms, + dlsch0_harq->mimo_mode); +#ifdef DEBUG_DLSCH_MOD + printf("dlsch: using pmi %lx, rb_alloc %x, pmi_ext ",pmi2hex_2Ar1(dlsch0_harq->pmi_alloc),*rballoc); + for (rb=0;rbpmi_ext[rb]); + printf("\n"); +#endif + + if (rx_type >= rx_IC_single_stream) { + if (eNB_id_in_connected_eNB) // we are in TM5 + nb_rb = dlsch_extract_rbs_dual(common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF, + common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id_i], + pdsch_vars[eNB_id_i]->rxdataF_ext, + pdsch_vars[eNB_id_i]->dl_ch_estimates_ext, + dlsch0_harq->pmi_alloc, + pdsch_vars[eNB_id_i]->pmi_ext, + rballoc, + symbol, + subframe, + ue->high_speed_flag, + frame_parms, + dlsch0_harq->mimo_mode); + else + nb_rb = dlsch_extract_rbs_dual(common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF, + common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id], + pdsch_vars[eNB_id_i]->rxdataF_ext, + pdsch_vars[eNB_id_i]->dl_ch_estimates_ext, + dlsch0_harq->pmi_alloc, + pdsch_vars[eNB_id_i]->pmi_ext, + rballoc, + symbol, + subframe, + ue->high_speed_flag, + frame_parms, + dlsch0_harq->mimo_mode); + } + } else if (beamforming_mode==0) { //else if nb_antennas_ports_eNB==1 && beamforming_mode == 0 + nb_rb = dlsch_extract_rbs_single(common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF, + common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id], + pdsch_vars[eNB_id]->rxdataF_ext, + pdsch_vars[eNB_id]->dl_ch_estimates_ext, + dlsch0_harq->pmi_alloc, + pdsch_vars[eNB_id]->pmi_ext, + rballoc, + symbol, + subframe, + ue->high_speed_flag, + frame_parms); + + if (rx_type==rx_IC_single_stream) { + if (eNB_id_in_connected_eNB) + nb_rb = dlsch_extract_rbs_single(common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF, + common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id_i], + pdsch_vars[eNB_id_i]->rxdataF_ext, + pdsch_vars[eNB_id_i]->dl_ch_estimates_ext, + dlsch0_harq->pmi_alloc, + pdsch_vars[eNB_id_i]->pmi_ext, + rballoc, + symbol, + subframe, + ue->high_speed_flag, + frame_parms); + else + nb_rb = dlsch_extract_rbs_single(common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF, + common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id], + pdsch_vars[eNB_id_i]->rxdataF_ext, + pdsch_vars[eNB_id_i]->dl_ch_estimates_ext, + dlsch0_harq->pmi_alloc, + pdsch_vars[eNB_id_i]->pmi_ext, + rballoc, + symbol, + subframe, + ue->high_speed_flag, + frame_parms); + } + } else if (beamforming_mode==7) { //else if beamforming_mode == 7 + nb_rb = dlsch_extract_rbs_TM7(common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF, + pdsch_vars[eNB_id]->dl_bf_ch_estimates, + pdsch_vars[eNB_id]->rxdataF_ext, + pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext, + rballoc, + symbol, + subframe, + ue->high_speed_flag, + frame_parms); + + } else if(beamforming_mode>7) { + LOG_W(PHY,"dlsch_demodulation: beamforming mode not supported yet.\n"); + } + + //printf("nb_rb = %d, eNB_id %d\n",nb_rb,eNB_id); + if (nb_rb==0) { + // LOG_D(PHY,"dlsch_demodulation.c: nb_rb=0\n"); + return(-1); + } + + +#if UE_TIMING_TRACE + stop_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); +#if DISABLE_LOG_X + printf("[AbsSFN %d.%d] Slot%d Symbol %d Flag %d type %d: Pilot/Data extraction %5.2f \n",frame,subframe,slot, + symbol,ue->high_speed_flag,type,symbol,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); +#else + LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d Flag %d type %d: Pilot/Data extraction %5.2f \n",frame,subframe,slot,symbol, + ue->high_speed_flag,type,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); +#endif +#endif + + +#if UE_TIMING_TRACE + start_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); +#endif + aatx = frame_parms->nb_antenna_ports_eNB; + aarx = frame_parms->nb_antennas_rx; + + dlsch_scale_channel(pdsch_vars[eNB_id]->dl_ch_estimates_ext, + frame_parms, + dlsch, + symbol, + nb_rb); + + if ((dlsch0_harq->mimo_moden_connected_eNB) && + (dlsch0_harq->dl_power_off==0) + ) // TM5 two-user + { + dlsch_scale_channel(pdsch_vars[eNB_id_i]->dl_ch_estimates_ext, + frame_parms, + dlsch, + symbol, + nb_rb); + } + +#if UE_TIMING_TRACE + stop_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); +#if DISABLE_LOG_X + printf("[AbsSFN %d.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,subframe,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); +#else + LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d: Channel Scale %5.2f \n",frame,subframe,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); +#endif +#endif + +#if UE_TIMING_TRACE + start_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); +#endif + if (first_symbol_flag==1) { + if (beamforming_mode==0){ + if (dlsch0_harq->mimo_modedl_ch_estimates_ext, + frame_parms, + avg, + symbol, + nb_rb); + avgs = 0; + for (aatx=0;aatxnb_antenna_ports_eNB;aatx++) + for (aarx=0;aarxnb_antennas_rx;aarx++) + avgs = cmax(avgs,avg[(aatx<<1)+aarx]); + + pdsch_vars[eNB_id]->log2_maxh = (log2_approx(avgs)/2)+1; + } + else if ((dlsch0_harq->mimo_mode == LARGE_CDD) || + ((dlsch0_harq->mimo_mode >=DUALSTREAM_UNIFORM_PRECODING1) && + (dlsch0_harq->mimo_mode <=DUALSTREAM_PUSCH_PRECODING))) + { + dlsch_channel_level_TM34(pdsch_vars[eNB_id]->dl_ch_estimates_ext, + frame_parms, + pdsch_vars[eNB_id]->pmi_ext, + avg_0, + avg_1, + symbol, + nb_rb, + dlsch0_harq->mimo_mode); + + LOG_D(PHY,"Channel Level TM34 avg_0 %d, avg_1 %d, rx_type %d, rx_standard %d, dlsch_demod_shift %d \n", avg_0[0], + avg_1[0], rx_type, rx_standard, dlsch_demod_shift); + if (rx_type>rx_standard) { + avg_0[0] = (log2_approx(avg_0[0])/2) + dlsch_demod_shift;// + 2 ;//+ 4; + avg_1[0] = (log2_approx(avg_1[0])/2) + dlsch_demod_shift;// + 2 ;//+ 4; + pdsch_vars[eNB_id]->log2_maxh0 = cmax(avg_0[0],0); + pdsch_vars[eNB_id]->log2_maxh1 = cmax(avg_1[0],0); + // printf("dlsch_demod_shift %d\n", dlsch_demod_shift); + } + else { + avg_0[0] = (log2_approx(avg_0[0])/2) - 13 + interf_unaw_shift; + avg_1[0] = (log2_approx(avg_1[0])/2) - 13 + interf_unaw_shift; + pdsch_vars[eNB_id]->log2_maxh0 = cmax(avg_0[0],0); + pdsch_vars[eNB_id]->log2_maxh1 = cmax(avg_1[0],0); + } + } + else if (dlsch0_harq->mimo_moden_connected_eNB) && (dlsch0_harq->dl_power_off==0)) { + dlsch_channel_level_TM56(pdsch_vars[eNB_id]->dl_ch_estimates_ext, + frame_parms, + pdsch_vars[eNB_id]->pmi_ext, + avg, + symbol, + nb_rb); + avg[0] = log2_approx(avg[0]) - 13 + offset_mumimo_llr_drange[dlsch0_harq->mcs][(i_mod>>1)-1]; + pdsch_vars[eNB_id]->log2_maxh = cmax(avg[0],0); + + } + else if (dlsch0_harq->dl_power_off==1) { //TM6 + + dlsch_channel_level(pdsch_vars[eNB_id]->dl_ch_estimates_ext, + frame_parms, + avg, + symbol, + nb_rb); + + avgs = 0; + for (aatx=0;aatxnb_antenna_ports_eNB;aatx++) + for (aarx=0;aarxnb_antennas_rx;aarx++) + avgs = cmax(avgs,avg[(aatx<<1)+aarx]); + + pdsch_vars[eNB_id]->log2_maxh = (log2_approx(avgs)/2) + 1; + pdsch_vars[eNB_id]->log2_maxh++; + + } + } + + } + else if (beamforming_mode==7) + dlsch_channel_level_TM7(pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext, + frame_parms, + avg, + symbol, + nb_rb); +#ifdef UE_DEBUG_TRACE + LOG_D(PHY,"[DLSCH] AbsSubframe %d.%d log2_maxh = %d [log2_maxh0 %d log2_maxh1 %d] (%d,%d)\n", + frame%1024,subframe, pdsch_vars[eNB_id]->log2_maxh, + pdsch_vars[eNB_id]->log2_maxh0, + pdsch_vars[eNB_id]->log2_maxh1, + avg[0],avgs); + //LOG_D(PHY,"[DLSCH] mimo_mode = %d\n", dlsch0_harq->mimo_mode); +#endif + + //wait until pdcch is decoded + //proc->channel_level = 1; + } + + /* + uint32_t wait = 0; + while(proc->channel_level == 0) + { + usleep(1); + wait++; + } + */ + +#if T_TRACER + if (type == PDSCH) + { + T(T_UE_PHY_PDSCH_ENERGY, T_INT(eNB_id), T_INT(frame%1024), T_INT(subframe), + T_INT(avg[0]), T_INT(avg[1]), T_INT(avg[2]), T_INT(avg[3])); + } +#endif + +#if UE_TIMING_TRACE + stop_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); +#if DISABLE_LOG_X + printf("[AbsSFN %d.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,subframe,slot,symbol,first_symbol_flag,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); +#else + LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d first_symbol_flag %d: Channel Level %5.2f \n",frame,subframe,slot,symbol,first_symbol_flag,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); +#endif +#endif + + +#if UE_TIMING_TRACE + start_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); +#endif +// Now channel compensation + if (dlsch0_harq->mimo_moderxdataF_ext, + pdsch_vars[eNB_id]->dl_ch_estimates_ext, + pdsch_vars[eNB_id]->dl_ch_mag0, + pdsch_vars[eNB_id]->dl_ch_magb0, + pdsch_vars[eNB_id]->rxdataF_comp0, + (aatx>1) ? pdsch_vars[eNB_id]->rho : NULL, + frame_parms, + symbol, + first_symbol_flag, + dlsch0_harq->Qm, + nb_rb, + pdsch_vars[eNB_id]->log2_maxh, + measurements); // log2_maxh+I0_shift + /*if (symbol == 5) { + write_output("rxF_comp_d.m","rxF_c_d",&pdsch_vars[eNB_id]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); + } */ + if ((rx_type==rx_IC_single_stream) && + (eNB_id_in_connected_eNB)) { + dlsch_channel_compensation(pdsch_vars[eNB_id_i]->rxdataF_ext, + pdsch_vars[eNB_id_i]->dl_ch_estimates_ext, + pdsch_vars[eNB_id_i]->dl_ch_mag0, + pdsch_vars[eNB_id_i]->dl_ch_magb0, + pdsch_vars[eNB_id_i]->rxdataF_comp0, + (aatx>1) ? pdsch_vars[eNB_id_i]->rho : NULL, + frame_parms, + symbol, + first_symbol_flag, + i_mod, + nb_rb, + pdsch_vars[eNB_id]->log2_maxh, + measurements); // log2_maxh+I0_shift +#ifdef DEBUG_PHY + if (symbol == 5) { + write_output("rxF_comp_d.m","rxF_c_d",&pdsch_vars[eNB_id]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); + write_output("rxF_comp_i.m","rxF_c_i",&pdsch_vars[eNB_id_i]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); + } +#endif + + dlsch_dual_stream_correlation(frame_parms, + symbol, + nb_rb, + pdsch_vars[eNB_id]->dl_ch_estimates_ext, + pdsch_vars[eNB_id_i]->dl_ch_estimates_ext, + pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round], + pdsch_vars[eNB_id]->log2_maxh); + } + } else if ((dlsch0_harq->mimo_mode == LARGE_CDD) || ((dlsch0_harq->mimo_mode >=DUALSTREAM_UNIFORM_PRECODING1) && + (dlsch0_harq->mimo_mode <=DUALSTREAM_PUSCH_PRECODING))){ + dlsch_channel_compensation_TM34(frame_parms, + pdsch_vars[eNB_id], + measurements, + eNB_id, + symbol, + dlsch0_harq->Qm, + dlsch1_harq->Qm, + harq_pid, + dlsch0_harq->round, + dlsch0_harq->mimo_mode, + nb_rb, + pdsch_vars[eNB_id]->log2_maxh0, + pdsch_vars[eNB_id]->log2_maxh1); + /* if (symbol == 5) { + write_output("rxF_comp_d00.m","rxF_c_d00",&pdsch_vars[eNB_id]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);// should be QAM + write_output("rxF_comp_d01.m","rxF_c_d01",&pdsch_vars[eNB_id]->rxdataF_comp0[1][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0 + write_output("rxF_comp_d10.m","rxF_c_d10",&pdsch_vars[eNB_id]->rxdataF_comp1[harq_pid][round][0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0 + write_output("rxF_comp_d11.m","rxF_c_d11",&pdsch_vars[eNB_id]->rxdataF_comp1[harq_pid][round][1][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be QAM + } */ + // compute correlation between signal and interference channels (rho12 and rho21) + dlsch_dual_stream_correlation(frame_parms, // this is doing h11'*h12 and h21'*h22 + symbol, + nb_rb, + pdsch_vars[eNB_id]->dl_ch_estimates_ext, + &(pdsch_vars[eNB_id]->dl_ch_estimates_ext[2]), + pdsch_vars[eNB_id]->dl_ch_rho2_ext, + pdsch_vars[eNB_id]->log2_maxh0); + //printf("rho stream1 =%d\n", &pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round] ); + //to be optimized (just take complex conjugate) + dlsch_dual_stream_correlation(frame_parms, // this is doing h12'*h11 and h22'*h21 + symbol, + nb_rb, + &(pdsch_vars[eNB_id]->dl_ch_estimates_ext[2]), + pdsch_vars[eNB_id]->dl_ch_estimates_ext, + pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round], + pdsch_vars[eNB_id]->log2_maxh1); + // printf("rho stream2 =%d\n",&pdsch_vars[eNB_id]->dl_ch_rho2_ext ); + //printf("TM3 log2_maxh : %d\n",pdsch_vars[eNB_id]->log2_maxh); + /* if (symbol == 5) { + write_output("rho0_0.m","rho0_0",&pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round][0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);// should be QAM + write_output("rho2_0.m","rho2_0",&pdsch_vars[eNB_id]->dl_ch_rho2_ext[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0 + write_output("rho0_1.m.m","rho0_1",&pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round][1][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0 + write_output("rho2_1.m","rho2_1",&pdsch_vars[eNB_id]->dl_ch_rho2_ext[1][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be QAM + } */ + + } else if (dlsch0_harq->mimo_moden_connected_eNB) && (dlsch0_harq->dl_power_off==0)) { + dlsch_channel_compensation_TM56(pdsch_vars[eNB_id]->rxdataF_ext, + pdsch_vars[eNB_id]->dl_ch_estimates_ext, + pdsch_vars[eNB_id]->dl_ch_mag0, + pdsch_vars[eNB_id]->dl_ch_magb0, + pdsch_vars[eNB_id]->rxdataF_comp0, + pdsch_vars[eNB_id]->pmi_ext, + frame_parms, + measurements, + eNB_id, + symbol, + dlsch0_harq->Qm, + nb_rb, + pdsch_vars[eNB_id]->log2_maxh, + dlsch0_harq->dl_power_off); + + for (rb=0; rbpmi_ext[rb]) { + case 0: + pdsch_vars[eNB_id_i]->pmi_ext[rb]=1; + break; + case 1: + pdsch_vars[eNB_id_i]->pmi_ext[rb]=0; + break; + case 2: + pdsch_vars[eNB_id_i]->pmi_ext[rb]=3; + break; + case 3: + pdsch_vars[eNB_id_i]->pmi_ext[rb]=2; + break; + } + // if (rb==0) + // printf("pmi %d, pmi_i %d\n",pdsch_vars[eNB_id]->pmi_ext[rb],pdsch_vars[eNB_id_i]->pmi_ext[rb]); + } + dlsch_channel_compensation_TM56(pdsch_vars[eNB_id_i]->rxdataF_ext, + pdsch_vars[eNB_id_i]->dl_ch_estimates_ext, + pdsch_vars[eNB_id_i]->dl_ch_mag0, + pdsch_vars[eNB_id_i]->dl_ch_magb0, + pdsch_vars[eNB_id_i]->rxdataF_comp0, + pdsch_vars[eNB_id_i]->pmi_ext, + frame_parms, + measurements, + eNB_id_i, + symbol, + i_mod, + nb_rb, + pdsch_vars[eNB_id]->log2_maxh, + dlsch0_harq->dl_power_off); +#ifdef DEBUG_PHY + if (symbol==5) { + write_output("rxF_comp_d.m","rxF_c_d",&pdsch_vars[eNB_id]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); + write_output("rxF_comp_i.m","rxF_c_i",&pdsch_vars[eNB_id_i]->rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1); + } +#endif + dlsch_dual_stream_correlation(frame_parms, + symbol, + nb_rb, + pdsch_vars[eNB_id]->dl_ch_estimates_ext, + pdsch_vars[eNB_id_i]->dl_ch_estimates_ext, + pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round], + pdsch_vars[eNB_id]->log2_maxh); + } else if (dlsch0_harq->dl_power_off==1) { + dlsch_channel_compensation_TM56(pdsch_vars[eNB_id]->rxdataF_ext, + pdsch_vars[eNB_id]->dl_ch_estimates_ext, + pdsch_vars[eNB_id]->dl_ch_mag0, + pdsch_vars[eNB_id]->dl_ch_magb0, + pdsch_vars[eNB_id]->rxdataF_comp0, + pdsch_vars[eNB_id]->pmi_ext, + frame_parms, + measurements, + eNB_id, + symbol, + dlsch0_harq->Qm, + nb_rb, + pdsch_vars[eNB_id]->log2_maxh, + 1); + + } + + + } else if (dlsch0_harq->mimo_mode==TM7) { //TM7 + + dlsch_channel_compensation(pdsch_vars[eNB_id]->rxdataF_ext, + pdsch_vars[eNB_id]->dl_bf_ch_estimates_ext, + pdsch_vars[eNB_id]->dl_ch_mag0, + pdsch_vars[eNB_id]->dl_ch_magb0, + pdsch_vars[eNB_id]->rxdataF_comp0, + (aatx>1) ? pdsch_vars[eNB_id]->rho : NULL, + frame_parms, + symbol, + first_symbol_flag, + get_Qm(dlsch0_harq->mcs), + nb_rb, + //9, + pdsch_vars[eNB_id]->log2_maxh, + measurements); // log2_maxh+I0_shift + } + +#if UE_TIMING_TRACE + stop_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); +#if DISABLE_LOG_X + printf("[AbsSFN %d.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n",frame,subframe,slot,symbol,pdsch_vars[eNB_id]->log2_maxh,proc->channel_level,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); +#else + LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d log2_maxh %d channel_level %d: Channel Comp %5.2f \n",frame,subframe,slot,symbol,pdsch_vars[eNB_id]->log2_maxh,proc->channel_level,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); +#endif +#endif +// MRC +#if UE_TIMING_TRACE + start_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); +#endif + + if (frame_parms->nb_antennas_rx > 1) { + if ((dlsch0_harq->mimo_mode == LARGE_CDD) || + ((dlsch0_harq->mimo_mode >=DUALSTREAM_UNIFORM_PRECODING1) && + (dlsch0_harq->mimo_mode <=DUALSTREAM_PUSCH_PRECODING))){ // TM3 or TM4 + if (frame_parms->nb_antenna_ports_eNB == 2) { + dlsch_detection_mrc_TM34(frame_parms, + pdsch_vars[eNB_id], + harq_pid, + dlsch0_harq->round, + symbol, + nb_rb, + 1); + /* if (symbol == 5) { + write_output("rho0_mrc.m","rho0_0",&pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round][0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);// should be QAM + write_output("rho2_mrc.m","rho2_0",&pdsch_vars[eNB_id]->dl_ch_rho2_ext[0][symbol*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);//should be almost 0 + } */ + } + } else { + dlsch_detection_mrc(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + pdsch_vars[eNB_id_i]->rxdataF_comp0, + pdsch_vars[eNB_id]->rho, + pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round], + pdsch_vars[eNB_id]->dl_ch_mag0, + pdsch_vars[eNB_id]->dl_ch_magb0, + pdsch_vars[eNB_id_i]->dl_ch_mag0, + pdsch_vars[eNB_id_i]->dl_ch_magb0, + symbol, + nb_rb, + rx_type==rx_IC_single_stream); + } + } + // printf("Combining"); + if ((dlsch0_harq->mimo_mode == SISO) || + ((dlsch0_harq->mimo_mode >= UNIFORM_PRECODING11) && + (dlsch0_harq->mimo_mode <= PUSCH_PRECODING0)) || + (dlsch0_harq->mimo_mode == TM7)) { + /* + dlsch_siso(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp, + pdsch_vars[eNB_id_i]->rxdataF_comp, + symbol, + nb_rb); + */ + } else if (dlsch0_harq->mimo_mode == ALAMOUTI) { + dlsch_alamouti(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + pdsch_vars[eNB_id]->dl_ch_mag0, + pdsch_vars[eNB_id]->dl_ch_magb0, + symbol, + nb_rb); + } + + // printf("LLR"); + if ((dlsch0_harq->mimo_mode == LARGE_CDD) || + ((dlsch0_harq->mimo_mode >=DUALSTREAM_UNIFORM_PRECODING1) && + (dlsch0_harq->mimo_mode <=DUALSTREAM_PUSCH_PRECODING))) { + rxdataF_comp_ptr = pdsch_vars[eNB_id]->rxdataF_comp1[harq_pid][round]; + dl_ch_mag_ptr = pdsch_vars[eNB_id]->dl_ch_mag1[harq_pid][round]; + } + else { + rxdataF_comp_ptr = pdsch_vars[eNB_id_i]->rxdataF_comp0; + dl_ch_mag_ptr = pdsch_vars[eNB_id_i]->dl_ch_mag0; + //i_mod should have been passed as a parameter + } + +#if UE_TIMING_TRACE + stop_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); +#if DISABLE_LOG_X + printf("[AbsSFN %d.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,subframe,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); +#else + LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d: Channel Combine %5.2f \n",frame,subframe,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); +#endif +#endif + +#if UE_TIMING_TRACE + start_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); +#endif + //printf("LLR dlsch0_harq->Qm %d rx_type %d cw0 %d cw1 %d symbol %d \n",dlsch0_harq->Qm,rx_type,codeword_TB0,codeword_TB1,symbol); + // compute LLRs + // -> // compute @pointer where llrs should filled for this ofdm-symbol + int8_t *pllr_symbol_cw0; + int8_t *pllr_symbol_cw1; + uint32_t llr_offset_symbol; + llr_offset_symbol = pdsch_vars[eNB_id]->llr_offset[symbol]; + pllr_symbol_cw0 = (int8_t*)pdsch_vars[eNB_id]->llr[0]; + pllr_symbol_cw1 = (int8_t*)pdsch_vars[eNB_id]->llr[1]; + pllr_symbol_cw0 += llr_offset_symbol; + pllr_symbol_cw1 += llr_offset_symbol; + + LOG_I(PHY,"compute LLRs [AbsSubframe %d.%d-%d] NbRB %d Qm %d LLRs-Length %d LLR-Offset %d @LLR Buff %p @LLR Buff(symb) %p\n", + frame, subframe,symbol, + nb_rb,dlsch0_harq->Qm, + pdsch_vars[eNB_id]->llr_length[symbol], + pdsch_vars[eNB_id]->llr_offset[symbol], + (int16_t*)pdsch_vars[eNB_id]->llr[0], + pllr_symbol_cw0); + + switch (dlsch0_harq->Qm) { + case 2 : + if ((rx_type==rx_standard) || (codeword_TB1 == -1)) { + + + dlsch_qpsk_llr(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + (int16_t*)pllr_symbol_cw0, + symbol, + first_symbol_flag, + nb_rb, + adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,2,subframe,symbol), + beamforming_mode); + + } else if (codeword_TB0 == -1){ + + dlsch_qpsk_llr(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + (int16_t*)pllr_symbol_cw1, + symbol, + first_symbol_flag, + nb_rb, + adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,2,subframe,symbol), + beamforming_mode); + } + else if (rx_type >= rx_IC_single_stream) { + if (dlsch1_harq->Qm == 2) { + dlsch_qpsk_qpsk_llr(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + rxdataF_comp_ptr, + pdsch_vars[eNB_id]->dl_ch_rho2_ext, + pdsch_vars[eNB_id]->llr[0], + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,2,subframe,symbol), + pdsch_vars[eNB_id]->llr128); + if (rx_type==rx_IC_dual_stream) { + dlsch_qpsk_qpsk_llr(frame_parms, + rxdataF_comp_ptr, + pdsch_vars[eNB_id]->rxdataF_comp0, + pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round], + pdsch_vars[eNB_id]->llr[1], + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch1_harq->rb_alloc_even,2,subframe,symbol), + pdsch_vars[eNB_id]->llr128_2ndstream); + } + } + else if (dlsch1_harq->Qm == 4) { + dlsch_qpsk_16qam_llr(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + rxdataF_comp_ptr,//i + dl_ch_mag_ptr,//i + pdsch_vars[eNB_id]->dl_ch_rho2_ext, + pdsch_vars[eNB_id]->llr[0], + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,2,subframe,symbol), + pdsch_vars[eNB_id]->llr128); + if (rx_type==rx_IC_dual_stream) { + dlsch_16qam_qpsk_llr(frame_parms, + rxdataF_comp_ptr, + pdsch_vars[eNB_id]->rxdataF_comp0,//i + dl_ch_mag_ptr, + pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round], + pdsch_vars[eNB_id]->llr[1], + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch1_harq->rb_alloc_even,4,subframe,symbol), + pdsch_vars[eNB_id]->llr128_2ndstream); + } + } + else { + dlsch_qpsk_64qam_llr(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + rxdataF_comp_ptr,//i + dl_ch_mag_ptr,//i + pdsch_vars[eNB_id]->dl_ch_rho2_ext, + pdsch_vars[eNB_id]->llr[0], + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,2,subframe,symbol), + pdsch_vars[eNB_id]->llr128); + if (rx_type==rx_IC_dual_stream) { + dlsch_64qam_qpsk_llr(frame_parms, + rxdataF_comp_ptr, + pdsch_vars[eNB_id]->rxdataF_comp0,//i + dl_ch_mag_ptr, + pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round], + pdsch_vars[eNB_id]->llr[1], + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch1_harq->rb_alloc_even,6,subframe,symbol), + pdsch_vars[eNB_id]->llr128_2ndstream); + } + } + } + break; + case 4 : + if ((rx_type==rx_standard ) || (codeword_TB1 == -1)) { + dlsch_16qam_llr(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + pdsch_vars[eNB_id]->llr[0], + pdsch_vars[eNB_id]->dl_ch_mag0, + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,4,subframe,symbol), + pdsch_vars[eNB_id]->llr128, + beamforming_mode); + } else if (codeword_TB0 == -1){ + dlsch_16qam_llr(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + pdsch_vars[eNB_id]->llr[1], + pdsch_vars[eNB_id]->dl_ch_mag0, + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,4,subframe,symbol), + pdsch_vars[eNB_id]->llr128_2ndstream, + beamforming_mode); + } + else if (rx_type >= rx_IC_single_stream) { + if (dlsch1_harq->Qm == 2) { + dlsch_16qam_qpsk_llr(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + rxdataF_comp_ptr,//i + pdsch_vars[eNB_id]->dl_ch_mag0, + pdsch_vars[eNB_id]->dl_ch_rho2_ext, + pdsch_vars[eNB_id]->llr[0], + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,4,subframe,symbol), + pdsch_vars[eNB_id]->llr128); + if (rx_type==rx_IC_dual_stream) { + dlsch_qpsk_16qam_llr(frame_parms, + rxdataF_comp_ptr, + pdsch_vars[eNB_id]->rxdataF_comp0,//i + pdsch_vars[eNB_id]->dl_ch_mag0,//i + pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round], + pdsch_vars[eNB_id]->llr[1], + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch1_harq->rb_alloc_even,2,subframe,symbol), + pdsch_vars[eNB_id]->llr128_2ndstream); + } + } + else if (dlsch1_harq->Qm == 4) { + dlsch_16qam_16qam_llr(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + rxdataF_comp_ptr,//i + pdsch_vars[eNB_id]->dl_ch_mag0, + dl_ch_mag_ptr,//i + pdsch_vars[eNB_id]->dl_ch_rho2_ext, + pdsch_vars[eNB_id]->llr[0], + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,4,subframe,symbol), + pdsch_vars[eNB_id]->llr128); + if (rx_type==rx_IC_dual_stream) { + dlsch_16qam_16qam_llr(frame_parms, + rxdataF_comp_ptr, + pdsch_vars[eNB_id]->rxdataF_comp0,//i + dl_ch_mag_ptr, + pdsch_vars[eNB_id]->dl_ch_mag0,//i + pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round], + pdsch_vars[eNB_id]->llr[1], + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch1_harq->rb_alloc_even,4,subframe,symbol), + pdsch_vars[eNB_id]->llr128_2ndstream); + } + } + else { + dlsch_16qam_64qam_llr(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + rxdataF_comp_ptr,//i + pdsch_vars[eNB_id]->dl_ch_mag0, + dl_ch_mag_ptr,//i + pdsch_vars[eNB_id]->dl_ch_rho2_ext, + pdsch_vars[eNB_id]->llr[0], + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,4,subframe,symbol), + pdsch_vars[eNB_id]->llr128); + if (rx_type==rx_IC_dual_stream) { + dlsch_64qam_16qam_llr(frame_parms, + rxdataF_comp_ptr, + pdsch_vars[eNB_id]->rxdataF_comp0, + dl_ch_mag_ptr, + pdsch_vars[eNB_id]->dl_ch_mag0, + pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round], + pdsch_vars[eNB_id]->llr[1], + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch1_harq->rb_alloc_even,6,subframe,symbol), + pdsch_vars[eNB_id]->llr128_2ndstream); + } + } + } + break; + case 6 : + if ((rx_type==rx_standard) || (codeword_TB1 == -1)) { + dlsch_64qam_llr(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + (int16_t*)pllr_symbol_cw0, + pdsch_vars[eNB_id]->dl_ch_mag0, + pdsch_vars[eNB_id]->dl_ch_magb0, + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,6,subframe,symbol), + pdsch_vars[eNB_id]->llr_offset[symbol], + beamforming_mode); + } else if (codeword_TB0 == -1){ + dlsch_64qam_llr(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + (int16_t*)pllr_symbol_cw1, + pdsch_vars[eNB_id]->dl_ch_mag0, + pdsch_vars[eNB_id]->dl_ch_magb0, + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,6,subframe,symbol), + pdsch_vars[eNB_id]->llr_offset[symbol], + beamforming_mode); + } + else if (rx_type >= rx_IC_single_stream) { + if (dlsch1_harq->Qm == 2) { + dlsch_64qam_qpsk_llr(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + rxdataF_comp_ptr,//i + pdsch_vars[eNB_id]->dl_ch_mag0, + pdsch_vars[eNB_id]->dl_ch_rho2_ext, + pdsch_vars[eNB_id]->llr[0], + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,6,subframe,symbol), + pdsch_vars[eNB_id]->llr128); + if (rx_type==rx_IC_dual_stream) { + dlsch_qpsk_64qam_llr(frame_parms, + rxdataF_comp_ptr, + pdsch_vars[eNB_id]->rxdataF_comp0,//i + pdsch_vars[eNB_id]->dl_ch_mag0, + pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round], + pdsch_vars[eNB_id]->llr[1], + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch1_harq->rb_alloc_even,2,subframe,symbol), + pdsch_vars[eNB_id]->llr128_2ndstream); + } + } + else if (dlsch1_harq->Qm == 4) { + dlsch_64qam_16qam_llr(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + rxdataF_comp_ptr,//i + pdsch_vars[eNB_id]->dl_ch_mag0, + dl_ch_mag_ptr,//i + pdsch_vars[eNB_id]->dl_ch_rho2_ext, + pdsch_vars[eNB_id]->llr[0], + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,6,subframe,symbol), + pdsch_vars[eNB_id]->llr128); + if (rx_type==rx_IC_dual_stream) { + dlsch_16qam_64qam_llr(frame_parms, + rxdataF_comp_ptr, + pdsch_vars[eNB_id]->rxdataF_comp0,//i + dl_ch_mag_ptr, + pdsch_vars[eNB_id]->dl_ch_mag0,//i + pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round], + pdsch_vars[eNB_id]->llr[1], + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch1_harq->rb_alloc_even,4,subframe,symbol), + pdsch_vars[eNB_id]->llr128_2ndstream); + } + } + else { + dlsch_64qam_64qam_llr(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + rxdataF_comp_ptr,//i + pdsch_vars[eNB_id]->dl_ch_mag0, + dl_ch_mag_ptr,//i + pdsch_vars[eNB_id]->dl_ch_rho2_ext, + (int16_t*)pllr_symbol_cw0, + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,6,subframe,symbol), + pdsch_vars[eNB_id]->llr_offset[symbol]); + if (rx_type==rx_IC_dual_stream) { + dlsch_64qam_64qam_llr(frame_parms, + rxdataF_comp_ptr, + pdsch_vars[eNB_id]->rxdataF_comp0,//i + dl_ch_mag_ptr, + pdsch_vars[eNB_id]->dl_ch_mag0,//i + pdsch_vars[eNB_id]->dl_ch_rho_ext[harq_pid][round], + (int16_t*)pllr_symbol_cw1, + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch1_harq->rb_alloc_even,6,subframe,symbol), + pdsch_vars[eNB_id]->llr_offset[symbol]); + } + } + } + break; + default: + LOG_W(PHY,"rx_dlsch.c : Unknown mod_order!!!!\n"); + return(-1); + break; + } + if (dlsch1_harq) { + switch (get_Qm(dlsch1_harq->mcs)) { + case 2 : + if (rx_type==rx_standard) { + dlsch_qpsk_llr(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + (int16_t*)pllr_symbol_cw0, + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,2,subframe,symbol), + beamforming_mode); + } + break; + case 4: + if (rx_type==rx_standard) { + dlsch_16qam_llr(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + pdsch_vars[eNB_id]->llr[0], + pdsch_vars[eNB_id]->dl_ch_mag0, + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,4,subframe,symbol), + pdsch_vars[eNB_id]->llr128, + beamforming_mode); + } + break; + case 6 : + if (rx_type==rx_standard) { + dlsch_64qam_llr(frame_parms, + pdsch_vars[eNB_id]->rxdataF_comp0, + (int16_t*)pllr_symbol_cw0, + pdsch_vars[eNB_id]->dl_ch_mag0, + pdsch_vars[eNB_id]->dl_ch_magb0, + symbol,first_symbol_flag,nb_rb, + adjust_G2(frame_parms,dlsch0_harq->rb_alloc_even,6,subframe,symbol), + pdsch_vars[eNB_id]->llr_offset[symbol], + beamforming_mode); + } + break; + default: + LOG_W(PHY,"rx_dlsch.c : Unknown mod_order!!!!\n"); + return(-1); + break; + } + } + +#if UE_TIMING_TRACE + stop_meas(&ue->generic_stat_bis[ue->current_thread_id[subframe]][slot]); +#if DISABLE_LOG_X + printf("[AbsSFN %d.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,subframe,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); +#else + LOG_I(PHY, "[AbsSFN %d.%d] Slot%d Symbol %d: LLR Computation %5.2f \n",frame,subframe,slot,symbol,ue->generic_stat_bis[ue->current_thread_id[subframe]][slot].p_time/(cpuf*1000.0)); +#endif +#endif +// Please keep it: useful for debugging +#if 0 + if( (symbol == 13) && (subframe==0) && (dlsch0_harq->Qm == 6) /*&& (nb_rb==25)*/) + { + LOG_E(PHY,"Dump Phy Chan Est \n"); + if(1) + { +#if 1 + write_output("rxdataF0.m" , "rxdataF0", &common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[0][0],14*frame_parms->ofdm_symbol_size,1,1); + //write_output("rxdataF1.m" , "rxdataF1", &common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF[0][0],14*frame_parms->ofdm_symbol_size,1,1); + write_output("dl_ch_estimates00.m", "dl_ch_estimates00", &common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][0][0],14*frame_parms->ofdm_symbol_size,1,1); + //write_output("dl_ch_estimates01.m", "dl_ch_estimates01", &common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][1][0],14*frame_parms->ofdm_symbol_size,1,1); + //write_output("dl_ch_estimates10.m", "dl_ch_estimates10", &common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][2][0],14*frame_parms->ofdm_symbol_size,1,1); + //write_output("dl_ch_estimates11.m", "dl_ch_estimates11", &common_vars->common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].dl_ch_estimates[eNB_id][3][0],14*frame_parms->ofdm_symbol_size,1,1); + + + //write_output("rxdataF_ext00.m" , "rxdataF_ext00", &pdsch_vars[eNB_id]->rxdataF_ext[0][0],14*frame_parms->N_RB_DL*12,1,1); + //write_output("rxdataF_ext01.m" , "rxdataF_ext01", &pdsch_vars[eNB_id]->rxdataF_ext[1][0],14*frame_parms->N_RB_DL*12,1,1); + //write_output("rxdataF_ext10.m" , "rxdataF_ext10", &pdsch_vars[eNB_id]->rxdataF_ext[2][0],14*frame_parms->N_RB_DL*12,1,1); + //write_output("rxdataF_ext11.m" , "rxdataF_ext11", &pdsch_vars[eNB_id]->rxdataF_ext[3][0],14*frame_parms->N_RB_DL*12,1,1); + write_output("dl_ch_estimates_ext00.m", "dl_ch_estimates_ext00", &pdsch_vars[eNB_id]->dl_ch_estimates_ext[0][0],14*frame_parms->N_RB_DL*12,1,1); + //write_output("dl_ch_estimates_ext01.m", "dl_ch_estimates_ext01", &pdsch_vars[eNB_id]->dl_ch_estimates_ext[1][0],14*frame_parms->N_RB_DL*12,1,1); + //write_output("dl_ch_estimates_ext10.m", "dl_ch_estimates_ext10", &pdsch_vars[eNB_id]->dl_ch_estimates_ext[2][0],14*frame_parms->N_RB_DL*12,1,1); + //write_output("dl_ch_estimates_ext11.m", "dl_ch_estimates_ext11", &pdsch_vars[eNB_id]->dl_ch_estimates_ext[3][0],14*frame_parms->N_RB_DL*12,1,1); + write_output("rxdataF_comp00.m","rxdataF_comp00", &pdsch_vars[eNB_id]->rxdataF_comp0[0][0],14*frame_parms->N_RB_DL*12,1,1); + //write_output("rxdataF_comp01.m","rxdataF_comp01", &pdsch_vars[eNB_id]->rxdataF_comp0[1][0],14*frame_parms->N_RB_DL*12,1,1); + //write_output("rxdataF_comp10.m","rxdataF_comp10", &pdsch_vars[eNB_id]->rxdataF_comp1[harq_pid][round][0][0],14*frame_parms->N_RB_DL*12,1,1); + //write_output("rxdataF_comp11.m","rxdataF_comp11", &pdsch_vars[eNB_id]->rxdataF_comp1[harq_pid][round][1][0],14*frame_parms->N_RB_DL*12,1,1); +#endif + write_output("llr0.m","llr0", &pdsch_vars[eNB_id]->llr[0][0],(14*nb_rb*12*dlsch1_harq->Qm) - 4*(nb_rb*4*dlsch1_harq->Qm),1,0); + //write_output("llr1.m","llr1", &pdsch_vars[eNB_id]->llr[1][0],(14*nb_rb*12*dlsch1_harq->Qm) - 4*(nb_rb*4*dlsch1_harq->Qm),1,0); + + + AssertFatal(0," "); + } + + } +#endif + + T(T_UE_PHY_PDSCH_IQ, T_INT(eNB_id), T_INT(frame%1024), + T_INT(subframe), T_INT(nb_rb), + T_INT(frame_parms->N_RB_UL), T_INT(frame_parms->symbols_per_tti), + T_BUFFER(&pdsch_vars[eNB_id]->rxdataF_comp0[eNB_id][0], + 2 * /* ulsch[UE_id]->harq_processes[harq_pid]->nb_rb */ frame_parms->N_RB_UL *12*frame_parms->symbols_per_tti*2)); + + return 0; +} + +//============================================================================================== +// Pre-processing for LLR computation +//============================================================================================== + +void dlsch_channel_compensation(int **rxdataF_ext, + int **dl_ch_estimates_ext, + int **dl_ch_mag, + int **dl_ch_magb, + int **rxdataF_comp, + int **rho, + LTE_DL_FRAME_PARMS *frame_parms, + unsigned char symbol, + uint8_t first_symbol_flag, + unsigned char mod_order, + unsigned short nb_rb, + unsigned char output_shift, + PHY_MEASUREMENTS *measurements) +{ + +#if defined(__i386) || defined(__x86_64) + + unsigned short rb; + unsigned char aatx,aarx,symbol_mod,pilots=0; + __m128i *dl_ch128,*dl_ch128_2,*dl_ch_mag128,*dl_ch_mag128b,*rxdataF128,*rxdataF_comp128,*rho128; + __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128,QAM_amp128b; + + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + + if ((symbol_mod == 0) || (symbol_mod == (4-frame_parms->Ncp))) { + + if (frame_parms->nb_antenna_ports_eNB==1) // 10 out of 12 so don't reduce size + nb_rb=1+(5*nb_rb/6); + else + pilots=1; + } + + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) { + if (mod_order == 4) { + QAM_amp128 = _mm_set1_epi16(QAM16_n1); // 2/sqrt(10) + QAM_amp128b = _mm_setzero_si128(); + } else if (mod_order == 6) { + QAM_amp128 = _mm_set1_epi16(QAM64_n1); // + QAM_amp128b = _mm_set1_epi16(QAM64_n2); + } + + // printf("comp: rxdataF_comp %p, symbol %d\n",rxdataF_comp[0],symbol); + + for (aarx=0; aarxnb_antennas_rx; aarx++) { + + dl_ch128 = (__m128i *)&dl_ch_estimates_ext[(aatx<<1)+aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128 = (__m128i *)&dl_ch_mag[(aatx<<1)+aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128b = (__m128i *)&dl_ch_magb[(aatx<<1)+aarx][symbol*frame_parms->N_RB_DL*12]; + rxdataF128 = (__m128i *)&rxdataF_ext[aarx][symbol*frame_parms->N_RB_DL*12]; + rxdataF_comp128 = (__m128i *)&rxdataF_comp[(aatx<<1)+aarx][symbol*frame_parms->N_RB_DL*12]; + + + for (rb=0; rb2) { + // get channel amplitude if not QPSK + + mmtmpD0 = _mm_madd_epi16(dl_ch128[0],dl_ch128[0]); + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); + + mmtmpD1 = _mm_madd_epi16(dl_ch128[1],dl_ch128[1]); + mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift); + + mmtmpD0 = _mm_packs_epi32(mmtmpD0,mmtmpD1); + + // store channel magnitude here in a new field of dlsch + + dl_ch_mag128[0] = _mm_unpacklo_epi16(mmtmpD0,mmtmpD0); + dl_ch_mag128b[0] = dl_ch_mag128[0]; + dl_ch_mag128[0] = _mm_mulhi_epi16(dl_ch_mag128[0],QAM_amp128); + dl_ch_mag128[0] = _mm_slli_epi16(dl_ch_mag128[0],1); + //print_ints("Re(ch):",(int16_t*)&mmtmpD0); + //print_shorts("QAM_amp:",(int16_t*)&QAM_amp128); + //print_shorts("mag:",(int16_t*)&dl_ch_mag128[0]); + dl_ch_mag128[1] = _mm_unpackhi_epi16(mmtmpD0,mmtmpD0); + dl_ch_mag128b[1] = dl_ch_mag128[1]; + dl_ch_mag128[1] = _mm_mulhi_epi16(dl_ch_mag128[1],QAM_amp128); + dl_ch_mag128[1] = _mm_slli_epi16(dl_ch_mag128[1],1); + + if (pilots==0) { + mmtmpD0 = _mm_madd_epi16(dl_ch128[2],dl_ch128[2]); + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); + mmtmpD1 = _mm_packs_epi32(mmtmpD0,mmtmpD0); + + dl_ch_mag128[2] = _mm_unpacklo_epi16(mmtmpD1,mmtmpD1); + dl_ch_mag128b[2] = dl_ch_mag128[2]; + + dl_ch_mag128[2] = _mm_mulhi_epi16(dl_ch_mag128[2],QAM_amp128); + dl_ch_mag128[2] = _mm_slli_epi16(dl_ch_mag128[2],1); + } + + dl_ch_mag128b[0] = _mm_mulhi_epi16(dl_ch_mag128b[0],QAM_amp128b); + dl_ch_mag128b[0] = _mm_slli_epi16(dl_ch_mag128b[0],1); + + + dl_ch_mag128b[1] = _mm_mulhi_epi16(dl_ch_mag128b[1],QAM_amp128b); + dl_ch_mag128b[1] = _mm_slli_epi16(dl_ch_mag128b[1],1); + + if (pilots==0) { + dl_ch_mag128b[2] = _mm_mulhi_epi16(dl_ch_mag128b[2],QAM_amp128b); + dl_ch_mag128b[2] = _mm_slli_epi16(dl_ch_mag128b[2],1); + } + } + + // multiply by conjugated channel + mmtmpD0 = _mm_madd_epi16(dl_ch128[0],rxdataF128[0]); + // print_ints("re",&mmtmpD0); + + // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) + mmtmpD1 = _mm_shufflelo_epi16(dl_ch128[0],_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)&conjugate[0]); + // print_ints("im",&mmtmpD1); + mmtmpD1 = _mm_madd_epi16(mmtmpD1,rxdataF128[0]); + // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); + // print_ints("re(shift)",&mmtmpD0); + mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift); + // print_ints("im(shift)",&mmtmpD1); + mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); + mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); + // print_ints("c0",&mmtmpD2); + // print_ints("c1",&mmtmpD3); + rxdataF_comp128[0] = _mm_packs_epi32(mmtmpD2,mmtmpD3); + // print_shorts("rx:",rxdataF128); + // print_shorts("ch:",dl_ch128); + // print_shorts("pack:",rxdataF_comp128); + + // multiply by conjugated channel + mmtmpD0 = _mm_madd_epi16(dl_ch128[1],rxdataF128[1]); + // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) + mmtmpD1 = _mm_shufflelo_epi16(dl_ch128[1],_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)conjugate); + mmtmpD1 = _mm_madd_epi16(mmtmpD1,rxdataF128[1]); + // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); + mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift); + mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); + mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); + + rxdataF_comp128[1] = _mm_packs_epi32(mmtmpD2,mmtmpD3); + // print_shorts("rx:",rxdataF128+1); + // print_shorts("ch:",dl_ch128+1); + // print_shorts("pack:",rxdataF_comp128+1); + + if (pilots==0) { + // multiply by conjugated channel + mmtmpD0 = _mm_madd_epi16(dl_ch128[2],rxdataF128[2]); + // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) + mmtmpD1 = _mm_shufflelo_epi16(dl_ch128[2],_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)conjugate); + mmtmpD1 = _mm_madd_epi16(mmtmpD1,rxdataF128[2]); + // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); + mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift); + mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); + mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); + + rxdataF_comp128[2] = _mm_packs_epi32(mmtmpD2,mmtmpD3); + // print_shorts("rx:",rxdataF128+2); + // print_shorts("ch:",dl_ch128+2); + // print_shorts("pack:",rxdataF_comp128+2); + + dl_ch128+=3; + dl_ch_mag128+=3; + dl_ch_mag128b+=3; + rxdataF128+=3; + rxdataF_comp128+=3; + } else { // we have a smaller PDSCH in symbols with pilots so skip last group of 4 REs and increment less + dl_ch128+=2; + dl_ch_mag128+=2; + dl_ch_mag128b+=2; + rxdataF128+=2; + rxdataF_comp128+=2; + } + + } + } + } + + if (rho) { + + + for (aarx=0; aarxnb_antennas_rx; aarx++) { + rho128 = (__m128i *)&rho[aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch128 = (__m128i *)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch128_2 = (__m128i *)&dl_ch_estimates_ext[2+aarx][symbol*frame_parms->N_RB_DL*12]; + + for (rb=0; rbrx_correlation[0][aarx] = signal_energy(&rho[aarx][symbol*frame_parms->N_RB_DL*12],rb*12); + } + } + } + + _mm_empty(); + _m_empty(); + +#elif defined(__arm__) + + + unsigned short rb; + unsigned char aatx,aarx,symbol_mod,pilots=0; + + int16x4_t *dl_ch128,*dl_ch128_2,*rxdataF128; + int32x4_t mmtmpD0,mmtmpD1,mmtmpD0b,mmtmpD1b; + int16x8_t *dl_ch_mag128,*dl_ch_mag128b,mmtmpD2,mmtmpD3,mmtmpD4; + int16x8_t QAM_amp128,QAM_amp128b; + int16x4x2_t *rxdataF_comp128,*rho128; + + int16_t conj[4]__attribute__((aligned(16))) = {1,-1,1,-1}; + int32x4_t output_shift128 = vmovq_n_s32(-(int32_t)output_shift); + + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + + if ((symbol_mod == 0) || (symbol_mod == (4-frame_parms->Ncp))) { + if (frame_parms->nb_antenna_ports_eNB==1) { // 10 out of 12 so don't reduce size + nb_rb=1+(5*nb_rb/6); + } + else { + pilots=1; + } + } + + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) { + if (mod_order == 4) { + QAM_amp128 = vmovq_n_s16(QAM16_n1); // 2/sqrt(10) + QAM_amp128b = vmovq_n_s16(0); + } else if (mod_order == 6) { + QAM_amp128 = vmovq_n_s16(QAM64_n1); // + QAM_amp128b = vmovq_n_s16(QAM64_n2); + } + // printf("comp: rxdataF_comp %p, symbol %d\n",rxdataF_comp[0],symbol); + + for (aarx=0; aarxnb_antennas_rx; aarx++) { + dl_ch128 = (int16x4_t*)&dl_ch_estimates_ext[(aatx<<1)+aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128 = (int16x8_t*)&dl_ch_mag[(aatx<<1)+aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128b = (int16x8_t*)&dl_ch_magb[(aatx<<1)+aarx][symbol*frame_parms->N_RB_DL*12]; + rxdataF128 = (int16x4_t*)&rxdataF_ext[aarx][symbol*frame_parms->N_RB_DL*12]; + rxdataF_comp128 = (int16x4x2_t*)&rxdataF_comp[(aatx<<1)+aarx][symbol*frame_parms->N_RB_DL*12]; + + for (rb=0; rb2) { + // get channel amplitude if not QPSK + mmtmpD0 = vmull_s16(dl_ch128[0], dl_ch128[0]); + // mmtmpD0 = [ch0*ch0,ch1*ch1,ch2*ch2,ch3*ch3]; + mmtmpD0 = vqshlq_s32(vqaddq_s32(mmtmpD0,vrev64q_s32(mmtmpD0)),output_shift128); + // mmtmpD0 = [ch0*ch0 + ch1*ch1,ch0*ch0 + ch1*ch1,ch2*ch2 + ch3*ch3,ch2*ch2 + ch3*ch3]>>output_shift128 on 32-bits + mmtmpD1 = vmull_s16(dl_ch128[1], dl_ch128[1]); + mmtmpD1 = vqshlq_s32(vqaddq_s32(mmtmpD1,vrev64q_s32(mmtmpD1)),output_shift128); + mmtmpD2 = vcombine_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + // mmtmpD2 = [ch0*ch0 + ch1*ch1,ch0*ch0 + ch1*ch1,ch2*ch2 + ch3*ch3,ch2*ch2 + ch3*ch3,ch4*ch4 + ch5*ch5,ch4*ch4 + ch5*ch5,ch6*ch6 + ch7*ch7,ch6*ch6 + ch7*ch7]>>output_shift128 on 16-bits + mmtmpD0 = vmull_s16(dl_ch128[2], dl_ch128[2]); + mmtmpD0 = vqshlq_s32(vqaddq_s32(mmtmpD0,vrev64q_s32(mmtmpD0)),output_shift128); + mmtmpD1 = vmull_s16(dl_ch128[3], dl_ch128[3]); + mmtmpD1 = vqshlq_s32(vqaddq_s32(mmtmpD1,vrev64q_s32(mmtmpD1)),output_shift128); + mmtmpD3 = vcombine_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + if (pilots==0) { + mmtmpD0 = vmull_s16(dl_ch128[4], dl_ch128[4]); + mmtmpD0 = vqshlq_s32(vqaddq_s32(mmtmpD0,vrev64q_s32(mmtmpD0)),output_shift128); + mmtmpD1 = vmull_s16(dl_ch128[5], dl_ch128[5]); + mmtmpD1 = vqshlq_s32(vqaddq_s32(mmtmpD1,vrev64q_s32(mmtmpD1)),output_shift128); + mmtmpD4 = vcombine_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + } + + dl_ch_mag128b[0] = vqdmulhq_s16(mmtmpD2,QAM_amp128b); + dl_ch_mag128b[1] = vqdmulhq_s16(mmtmpD3,QAM_amp128b); + dl_ch_mag128[0] = vqdmulhq_s16(mmtmpD2,QAM_amp128); + dl_ch_mag128[1] = vqdmulhq_s16(mmtmpD3,QAM_amp128); + + if (pilots==0) { + dl_ch_mag128b[2] = vqdmulhq_s16(mmtmpD4,QAM_amp128b); + dl_ch_mag128[2] = vqdmulhq_s16(mmtmpD4,QAM_amp128); + } + } + + mmtmpD0 = vmull_s16(dl_ch128[0], rxdataF128[0]); + //mmtmpD0 = [Re(ch[0])Re(rx[0]) Im(ch[0])Im(ch[0]) Re(ch[1])Re(rx[1]) Im(ch[1])Im(ch[1])] + mmtmpD1 = vmull_s16(dl_ch128[1], rxdataF128[1]); + //mmtmpD1 = [Re(ch[2])Re(rx[2]) Im(ch[2])Im(ch[2]) Re(ch[3])Re(rx[3]) Im(ch[3])Im(ch[3])] + mmtmpD0 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0),vget_high_s32(mmtmpD0)), + vpadd_s32(vget_low_s32(mmtmpD1),vget_high_s32(mmtmpD1))); + //mmtmpD0 = [Re(ch[0])Re(rx[0])+Im(ch[0])Im(ch[0]) Re(ch[1])Re(rx[1])+Im(ch[1])Im(ch[1]) Re(ch[2])Re(rx[2])+Im(ch[2])Im(ch[2]) Re(ch[3])Re(rx[3])+Im(ch[3])Im(ch[3])] + + mmtmpD0b = vmull_s16(vrev32_s16(vmul_s16(dl_ch128[0],*(int16x4_t*)conj)), rxdataF128[0]); + //mmtmpD0 = [-Im(ch[0])Re(rx[0]) Re(ch[0])Im(rx[0]) -Im(ch[1])Re(rx[1]) Re(ch[1])Im(rx[1])] + mmtmpD1b = vmull_s16(vrev32_s16(vmul_s16(dl_ch128[1],*(int16x4_t*)conj)), rxdataF128[1]); + //mmtmpD0 = [-Im(ch[2])Re(rx[2]) Re(ch[2])Im(rx[2]) -Im(ch[3])Re(rx[3]) Re(ch[3])Im(rx[3])] + mmtmpD1 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0b),vget_high_s32(mmtmpD0b)), + vpadd_s32(vget_low_s32(mmtmpD1b),vget_high_s32(mmtmpD1b))); + //mmtmpD1 = [-Im(ch[0])Re(rx[0])+Re(ch[0])Im(rx[0]) -Im(ch[1])Re(rx[1])+Re(ch[1])Im(rx[1]) -Im(ch[2])Re(rx[2])+Re(ch[2])Im(rx[2]) -Im(ch[3])Re(rx[3])+Re(ch[3])Im(rx[3])] + + mmtmpD0 = vqshlq_s32(mmtmpD0,output_shift128); + mmtmpD1 = vqshlq_s32(mmtmpD1,output_shift128); + rxdataF_comp128[0] = vzip_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + mmtmpD0 = vmull_s16(dl_ch128[2], rxdataF128[2]); + mmtmpD1 = vmull_s16(dl_ch128[3], rxdataF128[3]); + mmtmpD0 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0),vget_high_s32(mmtmpD0)), + vpadd_s32(vget_low_s32(mmtmpD1),vget_high_s32(mmtmpD1))); + mmtmpD0b = vmull_s16(vrev32_s16(vmul_s16(dl_ch128[2],*(int16x4_t*)conj)), rxdataF128[2]); + mmtmpD1b = vmull_s16(vrev32_s16(vmul_s16(dl_ch128[3],*(int16x4_t*)conj)), rxdataF128[3]); + mmtmpD1 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0b),vget_high_s32(mmtmpD0b)), + vpadd_s32(vget_low_s32(mmtmpD1b),vget_high_s32(mmtmpD1b))); + mmtmpD0 = vqshlq_s32(mmtmpD0,output_shift128); + mmtmpD1 = vqshlq_s32(mmtmpD1,output_shift128); + rxdataF_comp128[1] = vzip_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + + if (pilots==0) { + mmtmpD0 = vmull_s16(dl_ch128[4], rxdataF128[4]); + mmtmpD1 = vmull_s16(dl_ch128[5], rxdataF128[5]); + mmtmpD0 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0),vget_high_s32(mmtmpD0)), + vpadd_s32(vget_low_s32(mmtmpD1),vget_high_s32(mmtmpD1))); + + mmtmpD0b = vmull_s16(vrev32_s16(vmul_s16(dl_ch128[4],*(int16x4_t*)conj)), rxdataF128[4]); + mmtmpD1b = vmull_s16(vrev32_s16(vmul_s16(dl_ch128[5],*(int16x4_t*)conj)), rxdataF128[5]); + mmtmpD1 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0b),vget_high_s32(mmtmpD0b)), + vpadd_s32(vget_low_s32(mmtmpD1b),vget_high_s32(mmtmpD1b))); + + + mmtmpD0 = vqshlq_s32(mmtmpD0,output_shift128); + mmtmpD1 = vqshlq_s32(mmtmpD1,output_shift128); + rxdataF_comp128[2] = vzip_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + + + dl_ch128+=6; + dl_ch_mag128+=3; + dl_ch_mag128b+=3; + rxdataF128+=6; + rxdataF_comp128+=3; + + } else { // we have a smaller PDSCH in symbols with pilots so skip last group of 4 REs and increment less + dl_ch128+=4; + dl_ch_mag128+=2; + dl_ch_mag128b+=2; + rxdataF128+=4; + rxdataF_comp128+=2; + } + } + } + } + + if (rho) { + for (aarx=0; aarxnb_antennas_rx; aarx++) { + rho128 = (int16x4x2_t*)&rho[aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch128 = (int16x4_t*)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch128_2 = (int16x4_t*)&dl_ch_estimates_ext[2+aarx][symbol*frame_parms->N_RB_DL*12]; + for (rb=0; rbrx_correlation[0][aarx] = signal_energy(&rho[aarx][symbol*frame_parms->N_RB_DL*12],rb*12); + } + } + } +#endif +} + +#if defined(__x86_64__) || defined(__i386__) + +void prec2A_TM56_128(unsigned char pmi,__m128i *ch0,__m128i *ch1) +{ + + __m128i amp; + amp = _mm_set1_epi16(ONE_OVER_SQRT2_Q15); + + switch (pmi) { + + case 0 : // +1 +1 + // print_shorts("phase 0 :ch0",ch0); + // print_shorts("phase 0 :ch1",ch1); + ch0[0] = _mm_adds_epi16(ch0[0],ch1[0]); + break; + + case 1 : // +1 -1 + // print_shorts("phase 1 :ch0",ch0); + // print_shorts("phase 1 :ch1",ch1); + ch0[0] = _mm_subs_epi16(ch0[0],ch1[0]); + // print_shorts("phase 1 :ch0-ch1",ch0); + break; + + case 2 : // +1 +j + ch1[0] = _mm_sign_epi16(ch1[0],*(__m128i*)&conjugate[0]); + ch1[0] = _mm_shufflelo_epi16(ch1[0],_MM_SHUFFLE(2,3,0,1)); + ch1[0] = _mm_shufflehi_epi16(ch1[0],_MM_SHUFFLE(2,3,0,1)); + ch0[0] = _mm_subs_epi16(ch0[0],ch1[0]); + + break; // +1 -j + + case 3 : + ch1[0] = _mm_sign_epi16(ch1[0],*(__m128i*)&conjugate[0]); + ch1[0] = _mm_shufflelo_epi16(ch1[0],_MM_SHUFFLE(2,3,0,1)); + ch1[0] = _mm_shufflehi_epi16(ch1[0],_MM_SHUFFLE(2,3,0,1)); + ch0[0] = _mm_adds_epi16(ch0[0],ch1[0]); + break; + } + + ch0[0] = _mm_mulhi_epi16(ch0[0],amp); + ch0[0] = _mm_slli_epi16(ch0[0],1); + + _mm_empty(); + _m_empty(); +} +#elif defined(__arm__) +void prec2A_TM56_128(unsigned char pmi,__m128i *ch0,__m128i *ch1) { + + // sqrt(2) is already taken into account in computation sqrt_rho_a, sqrt_rho_b, + //so removed it + + //__m128i amp; + //amp = _mm_set1_epi16(ONE_OVER_SQRT2_Q15); + + switch (pmi) { + + case 0 : // +1 +1 + // print_shorts("phase 0 :ch0",ch0); + // print_shorts("phase 0 :ch1",ch1); + ch0[0] = _mm_adds_epi16(ch0[0],ch1[0]); + break; + case 1 : // +1 -1 + // print_shorts("phase 1 :ch0",ch0); + // print_shorts("phase 1 :ch1",ch1); + ch0[0] = _mm_subs_epi16(ch0[0],ch1[0]); + // print_shorts("phase 1 :ch0-ch1",ch0); + break; + case 2 : // +1 +j + ch1[0] = _mm_sign_epi16(ch1[0],*(__m128i*)&conjugate[0]); + ch1[0] = _mm_shufflelo_epi16(ch1[0],_MM_SHUFFLE(2,3,0,1)); + ch1[0] = _mm_shufflehi_epi16(ch1[0],_MM_SHUFFLE(2,3,0,1)); + ch0[0] = _mm_subs_epi16(ch0[0],ch1[0]); + + break; // +1 -j + case 3 : + ch1[0] = _mm_sign_epi16(ch1[0],*(__m128i*)&conjugate[0]); + ch1[0] = _mm_shufflelo_epi16(ch1[0],_MM_SHUFFLE(2,3,0,1)); + ch1[0] = _mm_shufflehi_epi16(ch1[0],_MM_SHUFFLE(2,3,0,1)); + ch0[0] = _mm_adds_epi16(ch0[0],ch1[0]); + break; + } + + //ch0[0] = _mm_mulhi_epi16(ch0[0],amp); + //ch0[0] = _mm_slli_epi16(ch0[0],1); + + _mm_empty(); + _m_empty(); +} +#endif +// precoding is stream 0 .5(1,1) .5(1,-1) .5(1,1) .5(1,-1) +// stream 1 .5(1,-1) .5(1,1) .5(1,-1) .5(1,1) +// store "precoded" channel for stream 0 in ch0, stream 1 in ch1 + +short TM3_prec[8]__attribute__((aligned(16))) = {1,1,-1,-1,1,1,-1,-1} ; + +void prec2A_TM3_128(__m128i *ch0,__m128i *ch1) { + + __m128i amp = _mm_set1_epi16(ONE_OVER_SQRT2_Q15); + + __m128i tmp0,tmp1; + + //_mm_mulhi_epi16 + // print_shorts("prec2A_TM3 ch0 (before):",ch0); + // print_shorts("prec2A_TM3 ch1 (before):",ch1); + + tmp0 = ch0[0]; + tmp1 = _mm_sign_epi16(ch1[0],((__m128i*)&TM3_prec)[0]); + // print_shorts("prec2A_TM3 ch1*s (mid):",(__m128i*)TM3_prec); + + ch0[0] = _mm_adds_epi16(ch0[0],tmp1); + ch1[0] = _mm_subs_epi16(tmp0,tmp1); + + ch0[0] = _mm_mulhi_epi16(ch0[0],amp); + ch0[0] = _mm_slli_epi16(ch0[0],1); + + ch1[0] = _mm_mulhi_epi16(ch1[0],amp); + ch1[0] = _mm_slli_epi16(ch1[0],1); + + // print_shorts("prec2A_TM3 ch0 (mid):",&tmp0); + // print_shorts("prec2A_TM3 ch1 (mid):",ch1); + + //ch0[0] = _mm_mulhi_epi16(ch0[0],amp); + //ch0[0] = _mm_slli_epi16(ch0[0],1); + //ch1[0] = _mm_mulhi_epi16(ch1[0],amp); + //ch1[0] = _mm_slli_epi16(ch1[0],1); + + //ch0[0] = _mm_srai_epi16(ch0[0],1); + //ch1[0] = _mm_srai_epi16(ch1[0],1); + + // print_shorts("prec2A_TM3 ch0 (after):",ch0); + // print_shorts("prec2A_TM3 ch1 (after):",ch1); + + _mm_empty(); + _m_empty(); +} + +// pmi = 0 => stream 0 (1,1), stream 1 (1,-1) +// pmi = 1 => stream 0 (1,j), stream 2 (1,-j) + +void prec2A_TM4_128(int pmi,__m128i *ch0,__m128i *ch1) { + +// sqrt(2) is already taken into account in computation sqrt_rho_a, sqrt_rho_b, +//so divide by 2 is replaced by divide by sqrt(2). + + // printf ("demod pmi=%d\n", pmi); + __m128i amp; + amp = _mm_set1_epi16(ONE_OVER_SQRT2_Q15); + __m128i tmp0,tmp1; + + // print_shorts("prec2A_TM4 ch0 (before):",ch0); + // print_shorts("prec2A_TM4 ch1 (before):",ch1); + + if (pmi == 0) { //[1 1;1 -1] + tmp0 = ch0[0]; + tmp1 = ch1[0]; + ch0[0] = _mm_adds_epi16(tmp0,tmp1); + ch1[0] = _mm_subs_epi16(tmp0,tmp1); + } + else { //ch0+j*ch1 ch0-j*ch1 + tmp0 = ch0[0]; + tmp1 = _mm_sign_epi16(ch1[0],*(__m128i*)&conjugate[0]); + tmp1 = _mm_shufflelo_epi16(tmp1,_MM_SHUFFLE(2,3,0,1)); + tmp1 = _mm_shufflehi_epi16(tmp1,_MM_SHUFFLE(2,3,0,1)); + ch0[0] = _mm_subs_epi16(tmp0,tmp1); + ch1[0] = _mm_add_epi16(tmp0,tmp1); + } + + //print_shorts("prec2A_TM4 ch0 (middle):",ch0); + //print_shorts("prec2A_TM4 ch1 (middle):",ch1); + + ch0[0] = _mm_mulhi_epi16(ch0[0],amp); + ch0[0] = _mm_slli_epi16(ch0[0],1); + ch1[0] = _mm_mulhi_epi16(ch1[0],amp); + ch1[0] = _mm_slli_epi16(ch1[0],1); + + + // ch0[0] = _mm_srai_epi16(ch0[0],1); //divide by 2 + // ch1[0] = _mm_srai_epi16(ch1[0],1); //divide by 2 + //print_shorts("prec2A_TM4 ch0 (end):",ch0); + //print_shorts("prec2A_TM4 ch1 (end):",ch1); + _mm_empty(); + _m_empty(); + // print_shorts("prec2A_TM4 ch0 (end):",ch0); + //print_shorts("prec2A_TM4 ch1 (end):",ch1); +} + +void dlsch_channel_compensation_TM56(int **rxdataF_ext, + int **dl_ch_estimates_ext, + int **dl_ch_mag, + int **dl_ch_magb, + int **rxdataF_comp, + unsigned char *pmi_ext, + LTE_DL_FRAME_PARMS *frame_parms, + PHY_MEASUREMENTS *measurements, + int eNB_id, + unsigned char symbol, + unsigned char mod_order, + unsigned short nb_rb, + unsigned char output_shift, + unsigned char dl_power_off) +{ + +#if defined(__x86_64__) || defined(__i386__) + + unsigned short rb,Nre; + __m128i *dl_ch0_128,*dl_ch1_128,*dl_ch_mag128,*dl_ch_mag128b,*rxdataF128,*rxdataF_comp128; + unsigned char aarx=0,symbol_mod,pilots=0; + int precoded_signal_strength=0; + __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp128,QAM_amp128b; + + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + + if ((symbol_mod == 0) || (symbol_mod == (4-frame_parms->Ncp))) + pilots=1; + + + //printf("comp prec: symbol %d, pilots %d\n",symbol, pilots); + + if (mod_order == 4) { + QAM_amp128 = _mm_set1_epi16(QAM16_n1); + QAM_amp128b = _mm_setzero_si128(); + } else if (mod_order == 6) { + QAM_amp128 = _mm_set1_epi16(QAM64_n1); + QAM_amp128b = _mm_set1_epi16(QAM64_n2); + } + + for (aarx=0; aarxnb_antennas_rx; aarx++) { + + dl_ch0_128 = (__m128i *)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch1_128 = (__m128i *)&dl_ch_estimates_ext[2+aarx][symbol*frame_parms->N_RB_DL*12]; + + + dl_ch_mag128 = (__m128i *)&dl_ch_mag[aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128b = (__m128i *)&dl_ch_magb[aarx][symbol*frame_parms->N_RB_DL*12]; + rxdataF128 = (__m128i *)&rxdataF_ext[aarx][symbol*frame_parms->N_RB_DL*12]; + rxdataF_comp128 = (__m128i *)&rxdataF_comp[aarx][symbol*frame_parms->N_RB_DL*12]; + + + for (rb=0; rb%d\n",rb,pmi_ext[rb]); +#endif + prec2A_TM56_128(pmi_ext[rb],&dl_ch0_128[0],&dl_ch1_128[0]); + prec2A_TM56_128(pmi_ext[rb],&dl_ch0_128[1],&dl_ch1_128[1]); + + if (pilots==0) { + + prec2A_TM56_128(pmi_ext[rb],&dl_ch0_128[2],&dl_ch1_128[2]); + } + + if (mod_order>2) { + // get channel amplitude if not QPSK + + mmtmpD0 = _mm_madd_epi16(dl_ch0_128[0],dl_ch0_128[0]); + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); + + mmtmpD1 = _mm_madd_epi16(dl_ch0_128[1],dl_ch0_128[1]); + mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift); + + mmtmpD0 = _mm_packs_epi32(mmtmpD0,mmtmpD1); + + dl_ch_mag128[0] = _mm_unpacklo_epi16(mmtmpD0,mmtmpD0); + dl_ch_mag128b[0] = dl_ch_mag128[0]; + dl_ch_mag128[0] = _mm_mulhi_epi16(dl_ch_mag128[0],QAM_amp128); + dl_ch_mag128[0] = _mm_slli_epi16(dl_ch_mag128[0],1); + + + //print_shorts("dl_ch_mag128[0]=",&dl_ch_mag128[0]); + + //print_shorts("dl_ch_mag128[0]=",&dl_ch_mag128[0]); + + dl_ch_mag128[1] = _mm_unpackhi_epi16(mmtmpD0,mmtmpD0); + dl_ch_mag128b[1] = dl_ch_mag128[1]; + dl_ch_mag128[1] = _mm_mulhi_epi16(dl_ch_mag128[1],QAM_amp128); + dl_ch_mag128[1] = _mm_slli_epi16(dl_ch_mag128[1],1); + + if (pilots==0) { + mmtmpD0 = _mm_madd_epi16(dl_ch0_128[2],dl_ch0_128[2]); + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); + + mmtmpD1 = _mm_packs_epi32(mmtmpD0,mmtmpD0); + + dl_ch_mag128[2] = _mm_unpacklo_epi16(mmtmpD1,mmtmpD1); + dl_ch_mag128b[2] = dl_ch_mag128[2]; + + dl_ch_mag128[2] = _mm_mulhi_epi16(dl_ch_mag128[2],QAM_amp128); + dl_ch_mag128[2] = _mm_slli_epi16(dl_ch_mag128[2],1); + } + + dl_ch_mag128b[0] = _mm_mulhi_epi16(dl_ch_mag128b[0],QAM_amp128b); + dl_ch_mag128b[0] = _mm_slli_epi16(dl_ch_mag128b[0],1); + + //print_shorts("dl_ch_mag128b[0]=",&dl_ch_mag128b[0]); + + dl_ch_mag128b[1] = _mm_mulhi_epi16(dl_ch_mag128b[1],QAM_amp128b); + dl_ch_mag128b[1] = _mm_slli_epi16(dl_ch_mag128b[1],1); + + if (pilots==0) { + dl_ch_mag128b[2] = _mm_mulhi_epi16(dl_ch_mag128b[2],QAM_amp128b); + dl_ch_mag128b[2] = _mm_slli_epi16(dl_ch_mag128b[2],1); + + } + } + + // MF multiply by conjugated channel + mmtmpD0 = _mm_madd_epi16(dl_ch0_128[0],rxdataF128[0]); + // print_ints("re",&mmtmpD0); + + // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) + mmtmpD1 = _mm_shufflelo_epi16(dl_ch0_128[0],_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)&conjugate[0]); + + // print_ints("im",&mmtmpD1); + mmtmpD1 = _mm_madd_epi16(mmtmpD1,rxdataF128[0]); + // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); + // print_ints("re(shift)",&mmtmpD0); + mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift); + // print_ints("im(shift)",&mmtmpD1); + mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); + mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); + // print_ints("c0",&mmtmpD2); + // print_ints("c1",&mmtmpD3); + rxdataF_comp128[0] = _mm_packs_epi32(mmtmpD2,mmtmpD3); + // print_shorts("rx:",rxdataF128); + // print_shorts("ch:",dl_ch128); + // print_shorts("pack:",rxdataF_comp128); + + // multiply by conjugated channel + mmtmpD0 = _mm_madd_epi16(dl_ch0_128[1],rxdataF128[1]); + // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) + mmtmpD1 = _mm_shufflelo_epi16(dl_ch0_128[1],_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)conjugate); + mmtmpD1 = _mm_madd_epi16(mmtmpD1,rxdataF128[1]); + // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); + mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift); + mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); + mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); + + rxdataF_comp128[1] = _mm_packs_epi32(mmtmpD2,mmtmpD3); + // print_shorts("rx:",rxdataF128+1); + // print_shorts("ch:",dl_ch128+1); + // print_shorts("pack:",rxdataF_comp128+1); + + if (pilots==0) { + // multiply by conjugated channel + mmtmpD0 = _mm_madd_epi16(dl_ch0_128[2],rxdataF128[2]); + // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) + mmtmpD1 = _mm_shufflelo_epi16(dl_ch0_128[2],_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)conjugate); + mmtmpD1 = _mm_madd_epi16(mmtmpD1,rxdataF128[2]); + // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift); + mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift); + mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); + mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); + + rxdataF_comp128[2] = _mm_packs_epi32(mmtmpD2,mmtmpD3); + // print_shorts("rx:",rxdataF128+2); + // print_shorts("ch:",dl_ch128+2); + // print_shorts("pack:",rxdataF_comp128+2); + + dl_ch0_128+=3; + dl_ch1_128+=3; + dl_ch_mag128+=3; + dl_ch_mag128b+=3; + rxdataF128+=3; + rxdataF_comp128+=3; + } else { + dl_ch0_128+=2; + dl_ch1_128+=2; + dl_ch_mag128+=2; + dl_ch_mag128b+=2; + rxdataF128+=2; + rxdataF_comp128+=2; + } + } + + Nre = (pilots==0) ? 12 : 8; + + precoded_signal_strength += ((signal_energy_nodc(&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*Nre], + (nb_rb*Nre))) - (measurements->n0_power[aarx])); + } // rx_antennas + + measurements->precoded_cqi_dB[eNB_id][0] = dB_fixed2(precoded_signal_strength,measurements->n0_power_tot); + + //printf("eNB_id %d, symbol %d: precoded CQI %d dB\n",eNB_id,symbol, + // measurements->precoded_cqi_dB[eNB_id][0]); + +#elif defined(__arm__) + + uint32_t rb,Nre; + uint32_t aarx,symbol_mod,pilots=0; + + int16x4_t *dl_ch0_128,*dl_ch1_128,*rxdataF128; + int16x8_t *dl_ch0_128b,*dl_ch1_128b; + int32x4_t mmtmpD0,mmtmpD1,mmtmpD0b,mmtmpD1b; + int16x8_t *dl_ch_mag128,*dl_ch_mag128b,mmtmpD2,mmtmpD3,mmtmpD4,*rxdataF_comp128; + int16x8_t QAM_amp128,QAM_amp128b; + + int16_t conj[4]__attribute__((aligned(16))) = {1,-1,1,-1}; + int32x4_t output_shift128 = vmovq_n_s32(-(int32_t)output_shift); + int32_t precoded_signal_strength=0; + + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + if ((symbol_mod == 0) || (symbol_mod == (4-frame_parms->Ncp))) { + if (frame_parms->nb_antenna_ports_eNB==1) // 10 out of 12 so don't reduce size + { nb_rb=1+(5*nb_rb/6); } + + else + { pilots=1; } + } + + + if (mod_order == 4) { + QAM_amp128 = vmovq_n_s16(QAM16_n1); // 2/sqrt(10) + QAM_amp128b = vmovq_n_s16(0); + + } else if (mod_order == 6) { + QAM_amp128 = vmovq_n_s16(QAM64_n1); // + QAM_amp128b = vmovq_n_s16(QAM64_n2); + } + + // printf("comp: rxdataF_comp %p, symbol %d\n",rxdataF_comp[0],symbol); + + for (aarx=0; aarxnb_antennas_rx; aarx++) { + + + + dl_ch0_128 = (int16x4_t*)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch1_128 = (int16x4_t*)&dl_ch_estimates_ext[2+aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch0_128b = (int16x8_t*)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch1_128b = (int16x8_t*)&dl_ch_estimates_ext[2+aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128 = (int16x8_t*)&dl_ch_mag[aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128b = (int16x8_t*)&dl_ch_magb[aarx][symbol*frame_parms->N_RB_DL*12]; + rxdataF128 = (int16x4_t*)&rxdataF_ext[aarx][symbol*frame_parms->N_RB_DL*12]; + rxdataF_comp128 = (int16x8_t*)&rxdataF_comp[aarx][symbol*frame_parms->N_RB_DL*12]; + + for (rb=0; rb%d\n",rb,pmi_ext[rb]); +#endif + prec2A_TM56_128(pmi_ext[rb],&dl_ch0_128b[0],&dl_ch1_128b[0]); + prec2A_TM56_128(pmi_ext[rb],&dl_ch0_128b[1],&dl_ch1_128b[1]); + + if (pilots==0) { + prec2A_TM56_128(pmi_ext[rb],&dl_ch0_128b[2],&dl_ch1_128b[2]); + } + + if (mod_order>2) { + // get channel amplitude if not QPSK + mmtmpD0 = vmull_s16(dl_ch0_128[0], dl_ch0_128[0]); + // mmtmpD0 = [ch0*ch0,ch1*ch1,ch2*ch2,ch3*ch3]; + mmtmpD0 = vqshlq_s32(vqaddq_s32(mmtmpD0,vrev64q_s32(mmtmpD0)),output_shift128); + // mmtmpD0 = [ch0*ch0 + ch1*ch1,ch0*ch0 + ch1*ch1,ch2*ch2 + ch3*ch3,ch2*ch2 + ch3*ch3]>>output_shift128 on 32-bits + mmtmpD1 = vmull_s16(dl_ch0_128[1], dl_ch0_128[1]); + mmtmpD1 = vqshlq_s32(vqaddq_s32(mmtmpD1,vrev64q_s32(mmtmpD1)),output_shift128); + mmtmpD2 = vcombine_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + // mmtmpD2 = [ch0*ch0 + ch1*ch1,ch0*ch0 + ch1*ch1,ch2*ch2 + ch3*ch3,ch2*ch2 + ch3*ch3,ch4*ch4 + ch5*ch5,ch4*ch4 + ch5*ch5,ch6*ch6 + ch7*ch7,ch6*ch6 + ch7*ch7]>>output_shift128 on 16-bits + mmtmpD0 = vmull_s16(dl_ch0_128[2], dl_ch0_128[2]); + mmtmpD0 = vqshlq_s32(vqaddq_s32(mmtmpD0,vrev64q_s32(mmtmpD0)),output_shift128); + mmtmpD1 = vmull_s16(dl_ch0_128[3], dl_ch0_128[3]); + mmtmpD1 = vqshlq_s32(vqaddq_s32(mmtmpD1,vrev64q_s32(mmtmpD1)),output_shift128); + mmtmpD3 = vcombine_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + if (pilots==0) { + mmtmpD0 = vmull_s16(dl_ch0_128[4], dl_ch0_128[4]); + mmtmpD0 = vqshlq_s32(vqaddq_s32(mmtmpD0,vrev64q_s32(mmtmpD0)),output_shift128); + mmtmpD1 = vmull_s16(dl_ch0_128[5], dl_ch0_128[5]); + mmtmpD1 = vqshlq_s32(vqaddq_s32(mmtmpD1,vrev64q_s32(mmtmpD1)),output_shift128); + mmtmpD4 = vcombine_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + + + } + + dl_ch_mag128b[0] = vqdmulhq_s16(mmtmpD2,QAM_amp128b); + dl_ch_mag128b[1] = vqdmulhq_s16(mmtmpD3,QAM_amp128b); + dl_ch_mag128[0] = vqdmulhq_s16(mmtmpD2,QAM_amp128); + dl_ch_mag128[1] = vqdmulhq_s16(mmtmpD3,QAM_amp128); + + + if (pilots==0) { + dl_ch_mag128b[2] = vqdmulhq_s16(mmtmpD4,QAM_amp128b); + dl_ch_mag128[2] = vqdmulhq_s16(mmtmpD4,QAM_amp128); + } + } + mmtmpD0 = vmull_s16(dl_ch0_128[0], rxdataF128[0]); + //mmtmpD0 = [Re(ch[0])Re(rx[0]) Im(ch[0])Im(ch[0]) Re(ch[1])Re(rx[1]) Im(ch[1])Im(ch[1])] + mmtmpD1 = vmull_s16(dl_ch0_128[1], rxdataF128[1]); + //mmtmpD1 = [Re(ch[2])Re(rx[2]) Im(ch[2])Im(ch[2]) Re(ch[3])Re(rx[3]) Im(ch[3])Im(ch[3])] + mmtmpD0 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0),vget_high_s32(mmtmpD0)), + vpadd_s32(vget_low_s32(mmtmpD1),vget_high_s32(mmtmpD1))); + //mmtmpD0 = [Re(ch[0])Re(rx[0])+Im(ch[0])Im(ch[0]) Re(ch[1])Re(rx[1])+Im(ch[1])Im(ch[1]) Re(ch[2])Re(rx[2])+Im(ch[2])Im(ch[2]) Re(ch[3])Re(rx[3])+Im(ch[3])Im(ch[3])] + + mmtmpD0b = vmull_s16(vrev32_s16(vmul_s16(dl_ch0_128[0],*(int16x4_t*)conj)), rxdataF128[0]); + //mmtmpD0 = [-Im(ch[0])Re(rx[0]) Re(ch[0])Im(rx[0]) -Im(ch[1])Re(rx[1]) Re(ch[1])Im(rx[1])] + mmtmpD1b = vmull_s16(vrev32_s16(vmul_s16(dl_ch0_128[1],*(int16x4_t*)conj)), rxdataF128[1]); + //mmtmpD0 = [-Im(ch[2])Re(rx[2]) Re(ch[2])Im(rx[2]) -Im(ch[3])Re(rx[3]) Re(ch[3])Im(rx[3])] + mmtmpD1 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0b),vget_high_s32(mmtmpD0b)), + vpadd_s32(vget_low_s32(mmtmpD1b),vget_high_s32(mmtmpD1b))); + //mmtmpD1 = [-Im(ch[0])Re(rx[0])+Re(ch[0])Im(rx[0]) -Im(ch[1])Re(rx[1])+Re(ch[1])Im(rx[1]) -Im(ch[2])Re(rx[2])+Re(ch[2])Im(rx[2]) -Im(ch[3])Re(rx[3])+Re(ch[3])Im(rx[3])] + + mmtmpD0 = vqshlq_s32(mmtmpD0,output_shift128); + mmtmpD1 = vqshlq_s32(mmtmpD1,output_shift128); + rxdataF_comp128[0] = vcombine_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + + mmtmpD0 = vmull_s16(dl_ch0_128[2], rxdataF128[2]); + mmtmpD1 = vmull_s16(dl_ch0_128[3], rxdataF128[3]); + mmtmpD0 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0),vget_high_s32(mmtmpD0)), + vpadd_s32(vget_low_s32(mmtmpD1),vget_high_s32(mmtmpD1))); + + mmtmpD0b = vmull_s16(vrev32_s16(vmul_s16(dl_ch0_128[2],*(int16x4_t*)conj)), rxdataF128[2]); + mmtmpD1b = vmull_s16(vrev32_s16(vmul_s16(dl_ch0_128[3],*(int16x4_t*)conj)), rxdataF128[3]); + mmtmpD1 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0b),vget_high_s32(mmtmpD0b)), + vpadd_s32(vget_low_s32(mmtmpD1b),vget_high_s32(mmtmpD1b))); + + mmtmpD0 = vqshlq_s32(mmtmpD0,output_shift128); + mmtmpD1 = vqshlq_s32(mmtmpD1,output_shift128); + rxdataF_comp128[1] = vcombine_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + + if (pilots==0) { + mmtmpD0 = vmull_s16(dl_ch0_128[4], rxdataF128[4]); + mmtmpD1 = vmull_s16(dl_ch0_128[5], rxdataF128[5]); + mmtmpD0 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0),vget_high_s32(mmtmpD0)), + vpadd_s32(vget_low_s32(mmtmpD1),vget_high_s32(mmtmpD1))); + + mmtmpD0b = vmull_s16(vrev32_s16(vmul_s16(dl_ch0_128[4],*(int16x4_t*)conj)), rxdataF128[4]); + mmtmpD1b = vmull_s16(vrev32_s16(vmul_s16(dl_ch0_128[5],*(int16x4_t*)conj)), rxdataF128[5]); + mmtmpD1 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0b),vget_high_s32(mmtmpD0b)), + vpadd_s32(vget_low_s32(mmtmpD1b),vget_high_s32(mmtmpD1b))); + + + mmtmpD0 = vqshlq_s32(mmtmpD0,output_shift128); + mmtmpD1 = vqshlq_s32(mmtmpD1,output_shift128); + rxdataF_comp128[2] = vcombine_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + + + dl_ch0_128+=6; + dl_ch1_128+=6; + dl_ch_mag128+=3; + dl_ch_mag128b+=3; + rxdataF128+=6; + rxdataF_comp128+=3; + + } else { // we have a smaller PDSCH in symbols with pilots so skip last group of 4 REs and increment less + dl_ch0_128+=4; + dl_ch1_128+=4; + dl_ch_mag128+=2; + dl_ch_mag128b+=2; + rxdataF128+=4; + rxdataF_comp128+=2; + } + } + + Nre = (pilots==0) ? 12 : 8; + + + precoded_signal_strength += ((signal_energy_nodc(&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*Nre], + + (nb_rb*Nre))) - (measurements->n0_power[aarx])); + // rx_antennas + } + measurements->precoded_cqi_dB[eNB_id][0] = dB_fixed2(precoded_signal_strength,measurements->n0_power_tot); + + //printf("eNB_id %d, symbol %d: precoded CQI %d dB\n",eNB_id,symbol, + // measurements->precoded_cqi_dB[eNB_id][0]); + +#endif + _mm_empty(); + _m_empty(); +} + +void dlsch_channel_compensation_TM34(LTE_DL_FRAME_PARMS *frame_parms, + LTE_UE_PDSCH *pdsch_vars, + PHY_MEASUREMENTS *measurements, + int eNB_id, + unsigned char symbol, + unsigned char mod_order0, + unsigned char mod_order1, + int harq_pid, + int round, + MIMO_mode_t mimo_mode, + unsigned short nb_rb, + unsigned char output_shift0, + unsigned char output_shift1) { + +#if defined(__x86_64__) || defined(__i386__) + + unsigned short rb,Nre; + __m128i *dl_ch0_128,*dl_ch1_128,*dl_ch_mag0_128,*dl_ch_mag1_128,*dl_ch_mag0_128b,*dl_ch_mag1_128b,*rxdataF128,*rxdataF_comp0_128,*rxdataF_comp1_128; + unsigned char aarx=0,symbol_mod,pilots=0; + int precoded_signal_strength0=0,precoded_signal_strength1=0; + int rx_power_correction; + + int **rxdataF_ext = pdsch_vars->rxdataF_ext; + int **dl_ch_estimates_ext = pdsch_vars->dl_ch_estimates_ext; + int **dl_ch_mag0 = pdsch_vars->dl_ch_mag0; + int **dl_ch_mag1 = pdsch_vars->dl_ch_mag1[harq_pid][round]; + int **dl_ch_magb0 = pdsch_vars->dl_ch_magb0; + int **dl_ch_magb1 = pdsch_vars->dl_ch_magb1[harq_pid][round]; + int **rxdataF_comp0 = pdsch_vars->rxdataF_comp0; + int **rxdataF_comp1 = pdsch_vars->rxdataF_comp1[harq_pid][round]; + unsigned char *pmi_ext = pdsch_vars->pmi_ext; + __m128i mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3,QAM_amp0_128,QAM_amp0_128b,QAM_amp1_128,QAM_amp1_128b; + + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + + if ((symbol_mod == 0) || (symbol_mod == (4-frame_parms->Ncp))) + pilots=1; + + rx_power_correction = 1; + + // printf("comp prec: symbol %d, pilots %d\n",symbol, pilots); + + if (mod_order0 == 4) { + QAM_amp0_128 = _mm_set1_epi16(QAM16_n1); + QAM_amp0_128b = _mm_setzero_si128(); + } else if (mod_order0 == 6) { + QAM_amp0_128 = _mm_set1_epi16(QAM64_n1); + QAM_amp0_128b = _mm_set1_epi16(QAM64_n2); + } + + if (mod_order1 == 4) { + QAM_amp1_128 = _mm_set1_epi16(QAM16_n1); + QAM_amp1_128b = _mm_setzero_si128(); + } else if (mod_order1 == 6) { + QAM_amp1_128 = _mm_set1_epi16(QAM64_n1); + QAM_amp1_128b = _mm_set1_epi16(QAM64_n2); + } + + for (aarx=0;aarxnb_antennas_rx;aarx++) { + + /* if (aarx==0) { + output_shift=output_shift0; + } + else { + output_shift=output_shift1; + } */ + + // printf("antenna %d\n", aarx); + // printf("symbol %d, rx antenna %d\n", symbol, aarx); + + dl_ch0_128 = (__m128i *)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12]; // this is h11 + dl_ch1_128 = (__m128i *)&dl_ch_estimates_ext[2+aarx][symbol*frame_parms->N_RB_DL*12]; // this is h12 + + + dl_ch_mag0_128 = (__m128i *)&dl_ch_mag0[aarx][symbol*frame_parms->N_RB_DL*12]; //responsible for x1 + dl_ch_mag0_128b = (__m128i *)&dl_ch_magb0[aarx][symbol*frame_parms->N_RB_DL*12];//responsible for x1 + dl_ch_mag1_128 = (__m128i *)&dl_ch_mag1[aarx][symbol*frame_parms->N_RB_DL*12]; //responsible for x2. always coming from tx2 + dl_ch_mag1_128b = (__m128i *)&dl_ch_magb1[aarx][symbol*frame_parms->N_RB_DL*12]; //responsible for x2. always coming from tx2 + rxdataF128 = (__m128i *)&rxdataF_ext[aarx][symbol*frame_parms->N_RB_DL*12]; //received signal on antenna of interest h11*x1+h12*x2 + rxdataF_comp0_128 = (__m128i *)&rxdataF_comp0[aarx][symbol*frame_parms->N_RB_DL*12]; //result of multipl with MF x1 on antenna of interest + rxdataF_comp1_128 = (__m128i *)&rxdataF_comp1[aarx][symbol*frame_parms->N_RB_DL*12]; //result of multipl with MF x2 on antenna of interest + + for (rb=0; rb2) { + // get channel amplitude if not QPSK + + mmtmpD0 = _mm_madd_epi16(dl_ch0_128[0],dl_ch0_128[0]); + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift0); + + mmtmpD1 = _mm_madd_epi16(dl_ch0_128[1],dl_ch0_128[1]); + mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift0); + + mmtmpD0 = _mm_packs_epi32(mmtmpD0,mmtmpD1); + + dl_ch_mag0_128[0] = _mm_unpacklo_epi16(mmtmpD0,mmtmpD0); + dl_ch_mag0_128b[0] = dl_ch_mag0_128[0]; + dl_ch_mag0_128[0] = _mm_mulhi_epi16(dl_ch_mag0_128[0],QAM_amp0_128); + dl_ch_mag0_128[0] = _mm_slli_epi16(dl_ch_mag0_128[0],1); + + // print_shorts("dl_ch_mag0_128[0]=",&dl_ch_mag0_128[0]); + + + dl_ch_mag0_128[1] = _mm_unpackhi_epi16(mmtmpD0,mmtmpD0); + dl_ch_mag0_128b[1] = dl_ch_mag0_128[1]; + dl_ch_mag0_128[1] = _mm_mulhi_epi16(dl_ch_mag0_128[1],QAM_amp0_128); + dl_ch_mag0_128[1] = _mm_slli_epi16(dl_ch_mag0_128[1],1); + + if (pilots==0) { + mmtmpD0 = _mm_madd_epi16(dl_ch0_128[2],dl_ch0_128[2]); + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift0); + + mmtmpD1 = _mm_packs_epi32(mmtmpD0,mmtmpD0); + + dl_ch_mag0_128[2] = _mm_unpacklo_epi16(mmtmpD1,mmtmpD1); + dl_ch_mag0_128b[2] = dl_ch_mag0_128[2]; + + dl_ch_mag0_128[2] = _mm_mulhi_epi16(dl_ch_mag0_128[2],QAM_amp0_128); + dl_ch_mag0_128[2] = _mm_slli_epi16(dl_ch_mag0_128[2],1); + } + + dl_ch_mag0_128b[0] = _mm_mulhi_epi16(dl_ch_mag0_128b[0],QAM_amp0_128b); + dl_ch_mag0_128b[0] = _mm_slli_epi16(dl_ch_mag0_128b[0],1); + + // print_shorts("dl_ch_mag0_128b[0]=",&dl_ch_mag0_128b[0]); + + dl_ch_mag0_128b[1] = _mm_mulhi_epi16(dl_ch_mag0_128b[1],QAM_amp0_128b); + dl_ch_mag0_128b[1] = _mm_slli_epi16(dl_ch_mag0_128b[1],1); + + if (pilots==0) { + dl_ch_mag0_128b[2] = _mm_mulhi_epi16(dl_ch_mag0_128b[2],QAM_amp0_128b); + dl_ch_mag0_128b[2] = _mm_slli_epi16(dl_ch_mag0_128b[2],1); + } + } + + if (mod_order1>2) { + // get channel amplitude if not QPSK + + mmtmpD0 = _mm_madd_epi16(dl_ch1_128[0],dl_ch1_128[0]); + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift1); + + mmtmpD1 = _mm_madd_epi16(dl_ch1_128[1],dl_ch1_128[1]); + mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift1); + + mmtmpD0 = _mm_packs_epi32(mmtmpD0,mmtmpD1); + + dl_ch_mag1_128[0] = _mm_unpacklo_epi16(mmtmpD0,mmtmpD0); + dl_ch_mag1_128b[0] = dl_ch_mag1_128[0]; + dl_ch_mag1_128[0] = _mm_mulhi_epi16(dl_ch_mag1_128[0],QAM_amp1_128); + dl_ch_mag1_128[0] = _mm_slli_epi16(dl_ch_mag1_128[0],1); + + // print_shorts("dl_ch_mag1_128[0]=",&dl_ch_mag1_128[0]); + + dl_ch_mag1_128[1] = _mm_unpackhi_epi16(mmtmpD0,mmtmpD0); + dl_ch_mag1_128b[1] = dl_ch_mag1_128[1]; + dl_ch_mag1_128[1] = _mm_mulhi_epi16(dl_ch_mag1_128[1],QAM_amp1_128); + dl_ch_mag1_128[1] = _mm_slli_epi16(dl_ch_mag1_128[1],1); + + if (pilots==0) { + mmtmpD0 = _mm_madd_epi16(dl_ch1_128[2],dl_ch1_128[2]); + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift1); + + mmtmpD1 = _mm_packs_epi32(mmtmpD0,mmtmpD0); + + dl_ch_mag1_128[2] = _mm_unpacklo_epi16(mmtmpD1,mmtmpD1); + dl_ch_mag1_128b[2] = dl_ch_mag1_128[2]; + + dl_ch_mag1_128[2] = _mm_mulhi_epi16(dl_ch_mag1_128[2],QAM_amp1_128); + dl_ch_mag1_128[2] = _mm_slli_epi16(dl_ch_mag1_128[2],1); + } + + dl_ch_mag1_128b[0] = _mm_mulhi_epi16(dl_ch_mag1_128b[0],QAM_amp1_128b); + dl_ch_mag1_128b[0] = _mm_slli_epi16(dl_ch_mag1_128b[0],1); + + // print_shorts("dl_ch_mag1_128b[0]=",&dl_ch_mag1_128b[0]); + + dl_ch_mag1_128b[1] = _mm_mulhi_epi16(dl_ch_mag1_128b[1],QAM_amp1_128b); + dl_ch_mag1_128b[1] = _mm_slli_epi16(dl_ch_mag1_128b[1],1); + + if (pilots==0) { + dl_ch_mag1_128b[2] = _mm_mulhi_epi16(dl_ch_mag1_128b[2],QAM_amp1_128b); + dl_ch_mag1_128b[2] = _mm_slli_epi16(dl_ch_mag1_128b[2],1); + } + } + + // layer 0 + // MF multiply by conjugated channel + mmtmpD0 = _mm_madd_epi16(dl_ch0_128[0],rxdataF128[0]); + // print_ints("re",&mmtmpD0); + + // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) + mmtmpD1 = _mm_shufflelo_epi16(dl_ch0_128[0],_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)&conjugate[0]); + mmtmpD1 = _mm_madd_epi16(mmtmpD1,rxdataF128[0]); + // print_ints("im",&mmtmpD1); + // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift0); + // printf("Shift: %d\n",output_shift); + // print_ints("re(shift)",&mmtmpD0); + mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift0); + // print_ints("im(shift)",&mmtmpD1); + mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); + mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); + // print_ints("c0",&mmtmpD2); + // print_ints("c1",&mmtmpD3); + rxdataF_comp0_128[0] = _mm_packs_epi32(mmtmpD2,mmtmpD3); + + // print_shorts("rx:",rxdataF128); + // print_shorts("ch:",dl_ch0_128); + // print_shorts("pack:",rxdataF_comp0_128); + + // multiply by conjugated channel + mmtmpD0 = _mm_madd_epi16(dl_ch0_128[1],rxdataF128[1]); + // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) + mmtmpD1 = _mm_shufflelo_epi16(dl_ch0_128[1],_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)conjugate); + mmtmpD1 = _mm_madd_epi16(mmtmpD1,rxdataF128[1]); + // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift0); + mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift0); + mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); + mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); + + rxdataF_comp0_128[1] = _mm_packs_epi32(mmtmpD2,mmtmpD3); + // print_shorts("rx:",rxdataF128+1); + // print_shorts("ch:",dl_ch0_128+1); + // print_shorts("pack:",rxdataF_comp0_128+1); + + if (pilots==0) { + // multiply by conjugated channel + mmtmpD0 = _mm_madd_epi16(dl_ch0_128[2],rxdataF128[2]); + // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) + mmtmpD1 = _mm_shufflelo_epi16(dl_ch0_128[2],_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)conjugate); + mmtmpD1 = _mm_madd_epi16(mmtmpD1,rxdataF128[2]); + // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift0); + mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift0); + mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); + mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); + + rxdataF_comp0_128[2] = _mm_packs_epi32(mmtmpD2,mmtmpD3); + // print_shorts("rx:",rxdataF128+2); + // print_shorts("ch:",dl_ch0_128+2); + // print_shorts("pack:",rxdataF_comp0_128+2); + + } + + + // layer 1 + // MF multiply by conjugated channel + mmtmpD0 = _mm_madd_epi16(dl_ch1_128[0],rxdataF128[0]); + // print_ints("re",&mmtmpD0); + + // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) + mmtmpD1 = _mm_shufflelo_epi16(dl_ch1_128[0],_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)&conjugate[0]); + // print_ints("im",&mmtmpD1); + mmtmpD1 = _mm_madd_epi16(mmtmpD1,rxdataF128[0]); + // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift1); + // print_ints("re(shift)",&mmtmpD0); + mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift1); + // print_ints("im(shift)",&mmtmpD1); + mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); + mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); + // print_ints("c0",&mmtmpD2); + // print_ints("c1",&mmtmpD3); + rxdataF_comp1_128[0] = _mm_packs_epi32(mmtmpD2,mmtmpD3); + // print_shorts("rx:",rxdataF128); + // print_shorts("ch:",dl_ch1_128); + // print_shorts("pack:",rxdataF_comp1_128); + + // multiply by conjugated channel + mmtmpD0 = _mm_madd_epi16(dl_ch1_128[1],rxdataF128[1]); + // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) + mmtmpD1 = _mm_shufflelo_epi16(dl_ch1_128[1],_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)conjugate); + mmtmpD1 = _mm_madd_epi16(mmtmpD1,rxdataF128[1]); + // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift1); + mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift1); + mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); + mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); + + rxdataF_comp1_128[1] = _mm_packs_epi32(mmtmpD2,mmtmpD3); + // print_shorts("rx:",rxdataF128+1); + // print_shorts("ch:",dl_ch1_128+1); + // print_shorts("pack:",rxdataF_comp1_128+1); + + if (pilots==0) { + // multiply by conjugated channel + mmtmpD0 = _mm_madd_epi16(dl_ch1_128[2],rxdataF128[2]); + // mmtmpD0 contains real part of 4 consecutive outputs (32-bit) + mmtmpD1 = _mm_shufflelo_epi16(dl_ch1_128[2],_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_shufflehi_epi16(mmtmpD1,_MM_SHUFFLE(2,3,0,1)); + mmtmpD1 = _mm_sign_epi16(mmtmpD1,*(__m128i*)conjugate); + mmtmpD1 = _mm_madd_epi16(mmtmpD1,rxdataF128[2]); + // mmtmpD1 contains imag part of 4 consecutive outputs (32-bit) + mmtmpD0 = _mm_srai_epi32(mmtmpD0,output_shift1); + mmtmpD1 = _mm_srai_epi32(mmtmpD1,output_shift1); + mmtmpD2 = _mm_unpacklo_epi32(mmtmpD0,mmtmpD1); + mmtmpD3 = _mm_unpackhi_epi32(mmtmpD0,mmtmpD1); + + rxdataF_comp1_128[2] = _mm_packs_epi32(mmtmpD2,mmtmpD3); + // print_shorts("rx:",rxdataF128+2); + // print_shorts("ch:",dl_ch1_128+2); + // print_shorts("pack:",rxdataF_comp1_128+2); + + dl_ch0_128+=3; + dl_ch1_128+=3; + dl_ch_mag0_128+=3; + dl_ch_mag1_128+=3; + dl_ch_mag0_128b+=3; + dl_ch_mag1_128b+=3; + rxdataF128+=3; + rxdataF_comp0_128+=3; + rxdataF_comp1_128+=3; + } + else { + dl_ch0_128+=2; + dl_ch1_128+=2; + dl_ch_mag0_128+=2; + dl_ch_mag1_128+=2; + dl_ch_mag0_128b+=2; + dl_ch_mag1_128b+=2; + rxdataF128+=2; + rxdataF_comp0_128+=2; + rxdataF_comp1_128+=2; + } + + } // rb loop + Nre = (pilots==0) ? 12 : 8; + + precoded_signal_strength0 += ((signal_energy_nodc(&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*Nre], + (nb_rb*Nre))*rx_power_correction) - (measurements->n0_power[aarx])); + + precoded_signal_strength1 += ((signal_energy_nodc(&dl_ch_estimates_ext[aarx+2][symbol*frame_parms->N_RB_DL*Nre], + (nb_rb*Nre))*rx_power_correction) - (measurements->n0_power[aarx])); + } // rx_antennas + + measurements->precoded_cqi_dB[eNB_id][0] = dB_fixed2(precoded_signal_strength0,measurements->n0_power_tot); + measurements->precoded_cqi_dB[eNB_id][1] = dB_fixed2(precoded_signal_strength1,measurements->n0_power_tot); + + // printf("eNB_id %d, symbol %d: precoded CQI %d dB\n",eNB_id,symbol, + // measurements->precoded_cqi_dB[eNB_id][0]); + + _mm_empty(); + _m_empty(); + + #elif defined(__arm__) + + unsigned short rb,Nre; + unsigned char aarx,symbol_mod,pilots=0; + int precoded_signal_strength0=0,precoded_signal_strength1=0, rx_power_correction; + int16x4_t *dl_ch0_128,*rxdataF128; + int16x4_t *dl_ch1_128; + int16x8_t *dl_ch0_128b,*dl_ch1_128b; + + int32x4_t mmtmpD0,mmtmpD1,mmtmpD0b,mmtmpD1b; + int16x8_t *dl_ch_mag0_128,*dl_ch_mag0_128b,*dl_ch_mag1_128,*dl_ch_mag1_128b,mmtmpD2,mmtmpD3,mmtmpD4,*rxdataF_comp0_128,*rxdataF_comp1_128; + int16x8_t QAM_amp0_128,QAM_amp0_128b,QAM_amp1_128,QAM_amp1_128b; + int32x4_t output_shift128 = vmovq_n_s32(-(int32_t)output_shift); + + int **rxdataF_ext = pdsch_vars->rxdataF_ext; + int **dl_ch_estimates_ext = pdsch_vars->dl_ch_estimates_ext; + int **dl_ch_mag0 = pdsch_vars->dl_ch_mag0; + int **dl_ch_mag1 = pdsch_vars->dl_ch_mag1[harq_pid][round]; + int **dl_ch_magb0 = pdsch_vars->dl_ch_magb0; + int **dl_ch_magb1 = pdsch_vars->dl_ch_magb1[harq_pid][round]; + int **rxdataF_comp0 = pdsch_vars->rxdataF_comp0; + int **rxdataF_comp1 = pdsch_vars->rxdataF_comp1[harq_pid][round]; + + int16_t conj[4]__attribute__((aligned(16))) = {1,-1,1,-1}; + + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + + if ((symbol_mod == 0) || (symbol_mod == (4-frame_parms->Ncp))) { + if (frame_parms->nb_antenna_ports_eNB==1) // 10 out of 12 so don't reduce size + { nb_rb=1+(5*nb_rb/6); } + + else + { pilots=1; } + } + + rx_power_correction=1; + + if (mod_order0 == 4) { + QAM_amp0_128 = vmovq_n_s16(QAM16_n1); // 2/sqrt(10) + QAM_amp0_128b = vmovq_n_s16(0); + + } else if (mod_order0 == 6) { + QAM_amp0_128 = vmovq_n_s16(QAM64_n1); // + QAM_amp0_128b = vmovq_n_s16(QAM64_n2); + } + + if (mod_order1 == 4) { + QAM_amp1_128 = vmovq_n_s16(QAM16_n1); // 2/sqrt(10) + QAM_amp1_128b = vmovq_n_s16(0); + + } else if (mod_order1 == 6) { + QAM_amp1_128 = vmovq_n_s16(QAM64_n1); // + QAM_amp1_128b = vmovq_n_s16(QAM64_n2); + } + + // printf("comp: rxdataF_comp %p, symbol %d\n",rxdataF_comp[0],symbol); + + for (aarx=0; aarxnb_antennas_rx; aarx++) { + + + + dl_ch0_128 = (int16x4_t*)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch1_128 = (int16x4_t*)&dl_ch_estimates_ext[2+aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch0_128b = (int16x8_t*)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch1_128b = (int16x8_t*)&dl_ch_estimates_ext[2+aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag0_128 = (int16x8_t*)&dl_ch_mag0[aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag0_128b = (int16x8_t*)&dl_ch_magb0[aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag1_128 = (int16x8_t*)&dl_ch_mag1[aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag1_128b = (int16x8_t*)&dl_ch_magb1[aarx][symbol*frame_parms->N_RB_DL*12]; + rxdataF128 = (int16x4_t*)&rxdataF_ext[aarx][symbol*frame_parms->N_RB_DL*12]; + rxdataF_comp0_128 = (int16x8_t*)&rxdataF_comp0[aarx][symbol*frame_parms->N_RB_DL*12]; + rxdataF_comp1_128 = (int16x8_t*)&rxdataF_comp1[aarx][symbol*frame_parms->N_RB_DL*12]; + + for (rb=0; rb2) { + // get channel amplitude if not QPSK + mmtmpD0 = vmull_s16(dl_ch0_128[0], dl_ch0_128[0]); + // mmtmpD0 = [ch0*ch0,ch1*ch1,ch2*ch2,ch3*ch3]; + mmtmpD0 = vqshlq_s32(vqaddq_s32(mmtmpD0,vrev64q_s32(mmtmpD0)),output_shift128); + // mmtmpD0 = [ch0*ch0 + ch1*ch1,ch0*ch0 + ch1*ch1,ch2*ch2 + ch3*ch3,ch2*ch2 + ch3*ch3]>>output_shift128 on 32-bits + mmtmpD1 = vmull_s16(dl_ch0_128[1], dl_ch0_128[1]); + mmtmpD1 = vqshlq_s32(vqaddq_s32(mmtmpD1,vrev64q_s32(mmtmpD1)),output_shift128); + mmtmpD2 = vcombine_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + // mmtmpD2 = [ch0*ch0 + ch1*ch1,ch0*ch0 + ch1*ch1,ch2*ch2 + ch3*ch3,ch2*ch2 + ch3*ch3,ch4*ch4 + ch5*ch5,ch4*ch4 + ch5*ch5,ch6*ch6 + ch7*ch7,ch6*ch6 + ch7*ch7]>>output_shift128 on 16-bits + mmtmpD0 = vmull_s16(dl_ch0_128[2], dl_ch0_128[2]); + mmtmpD0 = vqshlq_s32(vqaddq_s32(mmtmpD0,vrev64q_s32(mmtmpD0)),output_shift128); + mmtmpD1 = vmull_s16(dl_ch0_128[3], dl_ch0_128[3]); + mmtmpD1 = vqshlq_s32(vqaddq_s32(mmtmpD1,vrev64q_s32(mmtmpD1)),output_shift128); + mmtmpD3 = vcombine_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + + if (pilots==0) { + mmtmpD0 = vmull_s16(dl_ch0_128[4], dl_ch0_128[4]); + mmtmpD0 = vqshlq_s32(vqaddq_s32(mmtmpD0,vrev64q_s32(mmtmpD0)),output_shift128); + mmtmpD1 = vmull_s16(dl_ch0_128[5], dl_ch0_128[5]); + mmtmpD1 = vqshlq_s32(vqaddq_s32(mmtmpD1,vrev64q_s32(mmtmpD1)),output_shift128); + mmtmpD4 = vcombine_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + + + } + + dl_ch_mag0_128b[0] = vqdmulhq_s16(mmtmpD2,QAM_amp0_128b); + dl_ch_mag0_128b[1] = vqdmulhq_s16(mmtmpD3,QAM_amp0_128b); + dl_ch_mag0_128[0] = vqdmulhq_s16(mmtmpD2,QAM_amp0_128); + dl_ch_mag0_128[1] = vqdmulhq_s16(mmtmpD3,QAM_amp0_128); + + + if (pilots==0) { + dl_ch_mag0_128b[2] = vqdmulhq_s16(mmtmpD4,QAM_amp0_128b); + dl_ch_mag0_128[2] = vqdmulhq_s16(mmtmpD4,QAM_amp0_128); + } + } + + if (mod_order1>2) { + // get channel amplitude if not QPSK + mmtmpD0 = vmull_s16(dl_ch1_128[0], dl_ch1_128[0]); + // mmtmpD0 = [ch0*ch0,ch1*ch1,ch2*ch2,ch3*ch3]; + mmtmpD0 = vqshlq_s32(vqaddq_s32(mmtmpD0,vrev64q_s32(mmtmpD0)),output_shift128); + // mmtmpD0 = [ch0*ch0 + ch1*ch1,ch0*ch0 + ch1*ch1,ch2*ch2 + ch3*ch3,ch2*ch2 + ch3*ch3]>>output_shift128 on 32-bits + mmtmpD1 = vmull_s16(dl_ch1_128[1], dl_ch1_128[1]); + mmtmpD1 = vqshlq_s32(vqaddq_s32(mmtmpD1,vrev64q_s32(mmtmpD1)),output_shift128); + mmtmpD2 = vcombine_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + // mmtmpD2 = [ch0*ch0 + ch1*ch1,ch0*ch0 + ch1*ch1,ch2*ch2 + ch3*ch3,ch2*ch2 + ch3*ch3,ch4*ch4 + ch5*ch5,ch4*ch4 + ch5*ch5,ch6*ch6 + ch7*ch7,ch6*ch6 + ch7*ch7]>>output_shift128 on 16-bits + mmtmpD0 = vmull_s16(dl_ch1_128[2], dl_ch1_128[2]); + mmtmpD0 = vqshlq_s32(vqaddq_s32(mmtmpD0,vrev64q_s32(mmtmpD0)),output_shift128); + mmtmpD1 = vmull_s16(dl_ch1_128[3], dl_ch1_128[3]); + mmtmpD1 = vqshlq_s32(vqaddq_s32(mmtmpD1,vrev64q_s32(mmtmpD1)),output_shift128); + mmtmpD3 = vcombine_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + + if (pilots==0) { + mmtmpD0 = vmull_s16(dl_ch1_128[4], dl_ch1_128[4]); + mmtmpD0 = vqshlq_s32(vqaddq_s32(mmtmpD0,vrev64q_s32(mmtmpD0)),output_shift128); + mmtmpD1 = vmull_s16(dl_ch1_128[5], dl_ch1_128[5]); + mmtmpD1 = vqshlq_s32(vqaddq_s32(mmtmpD1,vrev64q_s32(mmtmpD1)),output_shift128); + mmtmpD4 = vcombine_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + + + } + + dl_ch_mag1_128b[0] = vqdmulhq_s16(mmtmpD2,QAM_amp1_128b); + dl_ch_mag1_128b[1] = vqdmulhq_s16(mmtmpD3,QAM_amp1_128b); + dl_ch_mag1_128[0] = vqdmulhq_s16(mmtmpD2,QAM_amp1_128); + dl_ch_mag1_128[1] = vqdmulhq_s16(mmtmpD3,QAM_amp1_128); + + + if (pilots==0) { + dl_ch_mag1_128b[2] = vqdmulhq_s16(mmtmpD4,QAM_amp1_128b); + dl_ch_mag1_128[2] = vqdmulhq_s16(mmtmpD4,QAM_amp1_128); + } + } + + mmtmpD0 = vmull_s16(dl_ch0_128[0], rxdataF128[0]); + //mmtmpD0 = [Re(ch[0])Re(rx[0]) Im(ch[0])Im(ch[0]) Re(ch[1])Re(rx[1]) Im(ch[1])Im(ch[1])] + mmtmpD1 = vmull_s16(dl_ch0_128[1], rxdataF128[1]); + //mmtmpD1 = [Re(ch[2])Re(rx[2]) Im(ch[2])Im(ch[2]) Re(ch[3])Re(rx[3]) Im(ch[3])Im(ch[3])] + mmtmpD0 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0),vget_high_s32(mmtmpD0)), + vpadd_s32(vget_low_s32(mmtmpD1),vget_high_s32(mmtmpD1))); + //mmtmpD0 = [Re(ch[0])Re(rx[0])+Im(ch[0])Im(ch[0]) Re(ch[1])Re(rx[1])+Im(ch[1])Im(ch[1]) Re(ch[2])Re(rx[2])+Im(ch[2])Im(ch[2]) Re(ch[3])Re(rx[3])+Im(ch[3])Im(ch[3])] + + mmtmpD0b = vmull_s16(vrev32_s16(vmul_s16(dl_ch0_128[0],*(int16x4_t*)conj)), rxdataF128[0]); + //mmtmpD0 = [-Im(ch[0])Re(rx[0]) Re(ch[0])Im(rx[0]) -Im(ch[1])Re(rx[1]) Re(ch[1])Im(rx[1])] + mmtmpD1b = vmull_s16(vrev32_s16(vmul_s16(dl_ch0_128[1],*(int16x4_t*)conj)), rxdataF128[1]); + //mmtmpD0 = [-Im(ch[2])Re(rx[2]) Re(ch[2])Im(rx[2]) -Im(ch[3])Re(rx[3]) Re(ch[3])Im(rx[3])] + mmtmpD1 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0b),vget_high_s32(mmtmpD0b)), + vpadd_s32(vget_low_s32(mmtmpD1b),vget_high_s32(mmtmpD1b))); + //mmtmpD1 = [-Im(ch[0])Re(rx[0])+Re(ch[0])Im(rx[0]) -Im(ch[1])Re(rx[1])+Re(ch[1])Im(rx[1]) -Im(ch[2])Re(rx[2])+Re(ch[2])Im(rx[2]) -Im(ch[3])Re(rx[3])+Re(ch[3])Im(rx[3])] + + mmtmpD0 = vqshlq_s32(mmtmpD0,output_shift128); + mmtmpD1 = vqshlq_s32(mmtmpD1,output_shift128); + rxdataF_comp0_128[0] = vcombine_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + + mmtmpD0 = vmull_s16(dl_ch0_128[2], rxdataF128[2]); + mmtmpD1 = vmull_s16(dl_ch0_128[3], rxdataF128[3]); + mmtmpD0 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0),vget_high_s32(mmtmpD0)), + vpadd_s32(vget_low_s32(mmtmpD1),vget_high_s32(mmtmpD1))); + + mmtmpD0b = vmull_s16(vrev32_s16(vmul_s16(dl_ch0_128[2],*(int16x4_t*)conj)), rxdataF128[2]); + mmtmpD1b = vmull_s16(vrev32_s16(vmul_s16(dl_ch0_128[3],*(int16x4_t*)conj)), rxdataF128[3]); + mmtmpD1 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0b),vget_high_s32(mmtmpD0b)), + vpadd_s32(vget_low_s32(mmtmpD1b),vget_high_s32(mmtmpD1b))); + + mmtmpD0 = vqshlq_s32(mmtmpD0,output_shift128); + mmtmpD1 = vqshlq_s32(mmtmpD1,output_shift128); + rxdataF_comp0_128[1] = vcombine_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + + // second stream + mmtmpD0 = vmull_s16(dl_ch1_128[0], rxdataF128[0]); + mmtmpD1 = vmull_s16(dl_ch1_128[1], rxdataF128[1]); + mmtmpD0 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0),vget_high_s32(mmtmpD0)), + vpadd_s32(vget_low_s32(mmtmpD1),vget_high_s32(mmtmpD1))); + mmtmpD0b = vmull_s16(vrev32_s16(vmul_s16(dl_ch0_128[0],*(int16x4_t*)conj)), rxdataF128[0]); + + mmtmpD1b = vmull_s16(vrev32_s16(vmul_s16(dl_ch0_128[1],*(int16x4_t*)conj)), rxdataF128[1]); + //mmtmpD0 = [-Im(ch[2])Re(rx[2]) Re(ch[2])Im(rx[2]) -Im(ch[3])Re(rx[3]) Re(ch[3])Im(rx[3])] + mmtmpD1 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0b),vget_high_s32(mmtmpD0b)), + vpadd_s32(vget_low_s32(mmtmpD1b),vget_high_s32(mmtmpD1b))); + //mmtmpD1 = [-Im(ch[0])Re(rx[0])+Re(ch[0])Im(rx[0]) -Im(ch[1])Re(rx[1])+Re(ch[1])Im(rx[1]) -Im(ch[2])Re(rx[2])+Re(ch[2])Im(rx[2]) -Im(ch[3])Re(rx[3])+Re(ch[3])Im(rx[3])] + + mmtmpD0 = vqshlq_s32(mmtmpD0,output_shift128); + mmtmpD1 = vqshlq_s32(mmtmpD1,output_shift128); + rxdataF_comp1_128[0] = vcombine_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + + mmtmpD0 = vmull_s16(dl_ch1_128[2], rxdataF128[2]); + mmtmpD1 = vmull_s16(dl_ch1_128[3], rxdataF128[3]); + mmtmpD0 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0),vget_high_s32(mmtmpD0)), + vpadd_s32(vget_low_s32(mmtmpD1),vget_high_s32(mmtmpD1))); + + mmtmpD0b = vmull_s16(vrev32_s16(vmul_s16(dl_ch0_128[2],*(int16x4_t*)conj)), rxdataF128[2]); + mmtmpD1b = vmull_s16(vrev32_s16(vmul_s16(dl_ch0_128[3],*(int16x4_t*)conj)), rxdataF128[3]); + mmtmpD1 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0b),vget_high_s32(mmtmpD0b)), + vpadd_s32(vget_low_s32(mmtmpD1b),vget_high_s32(mmtmpD1b))); + + mmtmpD0 = vqshlq_s32(mmtmpD0,output_shift128); + mmtmpD1 = vqshlq_s32(mmtmpD1,output_shift128); + rxdataF_comp1_128[1] = vcombine_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + + if (pilots==0) { + mmtmpD0 = vmull_s16(dl_ch0_128[4], rxdataF128[4]); + mmtmpD1 = vmull_s16(dl_ch0_128[5], rxdataF128[5]); + mmtmpD0 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0),vget_high_s32(mmtmpD0)), + vpadd_s32(vget_low_s32(mmtmpD1),vget_high_s32(mmtmpD1))); + + mmtmpD0b = vmull_s16(vrev32_s16(vmul_s16(dl_ch0_128[4],*(int16x4_t*)conj)), rxdataF128[4]); + mmtmpD1b = vmull_s16(vrev32_s16(vmul_s16(dl_ch0_128[5],*(int16x4_t*)conj)), rxdataF128[5]); + mmtmpD1 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0b),vget_high_s32(mmtmpD0b)), + vpadd_s32(vget_low_s32(mmtmpD1b),vget_high_s32(mmtmpD1b))); + + + mmtmpD0 = vqshlq_s32(mmtmpD0,output_shift128); + mmtmpD1 = vqshlq_s32(mmtmpD1,output_shift128); + rxdataF_comp0_128[2] = vcombine_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + mmtmpD0 = vmull_s16(dl_ch1_128[4], rxdataF128[4]); + mmtmpD1 = vmull_s16(dl_ch1_128[5], rxdataF128[5]); + mmtmpD0 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0),vget_high_s32(mmtmpD0)), + vpadd_s32(vget_low_s32(mmtmpD1),vget_high_s32(mmtmpD1))); + + mmtmpD0b = vmull_s16(vrev32_s16(vmul_s16(dl_ch1_128[4],*(int16x4_t*)conj)), rxdataF128[4]); + mmtmpD1b = vmull_s16(vrev32_s16(vmul_s16(dl_ch1_128[5],*(int16x4_t*)conj)), rxdataF128[5]); + mmtmpD1 = vcombine_s32(vpadd_s32(vget_low_s32(mmtmpD0b),vget_high_s32(mmtmpD0b)), + vpadd_s32(vget_low_s32(mmtmpD1b),vget_high_s32(mmtmpD1b))); + + + mmtmpD0 = vqshlq_s32(mmtmpD0,output_shift128); + mmtmpD1 = vqshlq_s32(mmtmpD1,output_shift128); + rxdataF_comp1_128[2] = vcombine_s16(vmovn_s32(mmtmpD0),vmovn_s32(mmtmpD1)); + } + } + + + + Nre = (pilots==0) ? 12 : 8; + + // rx_antennas + } + + + Nre = (pilots==0) ? 12 : 8; + + precoded_signal_strength0 += ((signal_energy_nodc(&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*Nre], + (nb_rb*Nre))*rx_power_correction) - (measurements->n0_power[aarx])); + precoded_signal_strength1 += ((signal_energy_nodc(&dl_ch_estimates_ext[aarx+2][symbol*frame_parms->N_RB_DL*Nre], + (nb_rb*Nre))*rx_power_correction) - (measurements->n0_power[aarx])); + + measurements->precoded_cqi_dB[eNB_id][0] = dB_fixed2(precoded_signal_strength0,measurements->n0_power_tot); + measurements->precoded_cqi_dB[eNB_id][1] = dB_fixed2(precoded_signal_strength1,measurements->n0_power_tot); + +#endif +} + + +void dlsch_dual_stream_correlation(LTE_DL_FRAME_PARMS *frame_parms, + unsigned char symbol, + unsigned short nb_rb, + int **dl_ch_estimates_ext, + int **dl_ch_estimates_ext_i, + int **dl_ch_rho_ext, + unsigned char output_shift) +{ + +#if defined(__x86_64__)||defined(__i386__) + + unsigned short rb; + __m128i *dl_ch128,*dl_ch128i,*dl_ch_rho128,mmtmpD0,mmtmpD1,mmtmpD2,mmtmpD3; + unsigned char aarx,symbol_mod,pilots=0; + + // printf("dlsch_dual_stream_correlation: symbol %d\n",symbol); + + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + + if ((symbol_mod == 0) || (symbol_mod == (4-frame_parms->Ncp))) { + pilots=1; + } + + // printf("Dual stream correlation (%p)\n",dl_ch_estimates_ext_i); + + for (aarx=0; aarxnb_antennas_rx; aarx++) { + + + + //printf ("antenna %d", aarx); + dl_ch128 = (__m128i *)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12]; + + if (dl_ch_estimates_ext_i == NULL) // TM3/4 + dl_ch128i = (__m128i *)&dl_ch_estimates_ext[2+aarx][symbol*frame_parms->N_RB_DL*12]; + else + dl_ch128i = (__m128i *)&dl_ch_estimates_ext_i[aarx][symbol*frame_parms->N_RB_DL*12]; + + dl_ch_rho128 = (__m128i *)&dl_ch_rho_ext[aarx][symbol*frame_parms->N_RB_DL*12]; + + + for (rb=0; rb=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + + if ((symbol_mod == 0) || (symbol_mod == (4-frame_parms->Ncp))) { + pilots=1; + } + + // printf("Dual stream correlation (%p)\n",dl_ch_estimates_ext_i); + + for (aarx=0; aarxnb_antennas_rx; aarx++) { + + if (aarx==0) { + output_shift=output_shift0; + } + else { + output_shift=output_shift1; + } + + //printf ("antenna %d", aarx); + dl_ch128 = (__m128i *)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12]; + + if (dl_ch_estimates_ext_i == NULL) // TM3/4 + dl_ch128i = (__m128i *)&dl_ch_estimates_ext[2+aarx][symbol*frame_parms->N_RB_DL*12]; + else + dl_ch128i = (__m128i *)&dl_ch_estimates_ext_i[aarx][symbol*frame_parms->N_RB_DL*12]; + + dl_ch_rho128 = (__m128i *)&dl_ch_rho_ext[aarx][symbol*frame_parms->N_RB_DL*12]; + + + for (rb=0; rbnb_antennas_rx>1) { + + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) { + + rxdataF_comp128_0 = (__m128i *)&rxdataF_comp[(aatx<<1)][symbol*frame_parms->N_RB_DL*12]; + rxdataF_comp128_1 = (__m128i *)&rxdataF_comp[(aatx<<1)+1][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_0 = (__m128i *)&dl_ch_mag[(aatx<<1)][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_1 = (__m128i *)&dl_ch_mag[(aatx<<1)+1][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_0b = (__m128i *)&dl_ch_magb[(aatx<<1)][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_1b = (__m128i *)&dl_ch_magb[(aatx<<1)+1][symbol*frame_parms->N_RB_DL*12]; + + // MRC on each re of rb, both on MF output and magnitude (for 16QAM/64QAM llr computation) + for (i=0;iN_RB_DL*12]; + rho128_1 = (__m128i *) &rho[1][symbol*frame_parms->N_RB_DL*12]; + for (i=0;iN_RB_DL*12]; + rho128_i1 = (__m128i *) &rho_i[1][symbol*frame_parms->N_RB_DL*12]; + rxdataF_comp128_i0 = (__m128i *)&rxdataF_comp_i[0][symbol*frame_parms->N_RB_DL*12]; + rxdataF_comp128_i1 = (__m128i *)&rxdataF_comp_i[1][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_i0 = (__m128i *)&dl_ch_mag_i[0][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_i1 = (__m128i *)&dl_ch_mag_i[1][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_i0b = (__m128i *)&dl_ch_magb_i[0][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_i1b = (__m128i *)&dl_ch_magb_i[1][symbol*frame_parms->N_RB_DL*12]; + + for (i=0; inb_antennas_rx>1) { + + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) { + + rxdataF_comp128_0 = (int16x8_t *)&rxdataF_comp[(aatx<<1)][symbol*frame_parms->N_RB_DL*12]; + rxdataF_comp128_1 = (int16x8_t *)&rxdataF_comp[(aatx<<1)+1][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_0 = (int16x8_t *)&dl_ch_mag[(aatx<<1)][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_1 = (int16x8_t *)&dl_ch_mag[(aatx<<1)+1][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_0b = (int16x8_t *)&dl_ch_magb[(aatx<<1)][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_1b = (int16x8_t *)&dl_ch_magb[(aatx<<1)+1][symbol*frame_parms->N_RB_DL*12]; + + // MRC on each re of rb, both on MF output and magnitude (for 16QAM/64QAM llr computation) + for (i=0; iN_RB_DL*12]; + rho128_1 = (int16x8_t *) &rho[1][symbol*frame_parms->N_RB_DL*12]; + + for (i=0; iN_RB_DL*12]; + rho128_i1 = (int16x8_t *) &rho_i[1][symbol*frame_parms->N_RB_DL*12]; + rxdataF_comp128_i0 = (int16x8_t *)&rxdataF_comp_i[0][symbol*frame_parms->N_RB_DL*12]; + rxdataF_comp128_i1 = (int16x8_t *)&rxdataF_comp_i[1][symbol*frame_parms->N_RB_DL*12]; + + dl_ch_mag128_i0 = (int16x8_t *)&dl_ch_mag_i[0][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_i1 = (int16x8_t *)&dl_ch_mag_i[1][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_i0b = (int16x8_t *)&dl_ch_magb_i[0][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_i1b = (int16x8_t *)&dl_ch_magb_i[1][symbol*frame_parms->N_RB_DL*12]; + + for (i=0; irxdataF_comp0; + int **rxdataF_comp1 = pdsch_vars->rxdataF_comp1[harq_pid][round]; + int **dl_ch_rho_ext = pdsch_vars->dl_ch_rho_ext[harq_pid][round]; //for second stream + int **dl_ch_rho2_ext = pdsch_vars->dl_ch_rho2_ext; + int **dl_ch_mag0 = pdsch_vars->dl_ch_mag0; + int **dl_ch_mag1 = pdsch_vars->dl_ch_mag1[harq_pid][round]; + int **dl_ch_magb0 = pdsch_vars->dl_ch_magb0; + int **dl_ch_magb1 = pdsch_vars->dl_ch_magb1[harq_pid][round]; + + if (frame_parms->nb_antennas_rx>1) { + + rxdataF_comp128_0 = (__m128i *)&rxdataF_comp0[0][symbol*frame_parms->N_RB_DL*12]; + rxdataF_comp128_1 = (__m128i *)&rxdataF_comp0[1][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_0 = (__m128i *)&dl_ch_mag0[0][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_1 = (__m128i *)&dl_ch_mag0[1][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_0b = (__m128i *)&dl_ch_magb0[0][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_1b = (__m128i *)&dl_ch_magb0[1][symbol*frame_parms->N_RB_DL*12]; + + // MRC on each re of rb, both on MF output and magnitude (for 16QAM/64QAM llr computation) + for (i=0;iN_RB_DL*12]; + rho128_1 = (__m128i *) &dl_ch_rho2_ext[1][symbol*frame_parms->N_RB_DL*12]; + for (i=0;iN_RB_DL*12]; + rho128_i1 = (__m128i *) &dl_ch_rho_ext[1][symbol*frame_parms->N_RB_DL*12]; + rxdataF_comp128_i0 = (__m128i *)&rxdataF_comp1[0][symbol*frame_parms->N_RB_DL*12]; + rxdataF_comp128_i1 = (__m128i *)&rxdataF_comp1[1][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_i0 = (__m128i *)&dl_ch_mag1[0][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_i1 = (__m128i *)&dl_ch_mag1[1][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_i0b = (__m128i *)&dl_ch_magb1[0][symbol*frame_parms->N_RB_DL*12]; + dl_ch_mag128_i1b = (__m128i *)&dl_ch_magb1[1][symbol*frame_parms->N_RB_DL*12]; + for (i=0;i=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + + if ((symbol_mod == 0) || (symbol_mod == (4-frame_parms->Ncp))) { + if (frame_parms->nb_antenna_ports_eNB==1) // 10 out of 12 so don't reduce size + nb_rb=1+(5*nb_rb/6); + else + pilots=1; + } + + // Determine scaling amplitude based the symbol + + ch_amp = ((pilots) ? (dlsch_ue[0]->sqrt_rho_b) : (dlsch_ue[0]->sqrt_rho_a)); + + LOG_D(PHY,"Scaling PDSCH Chest in OFDM symbol %d by %d, pilots %d nb_rb %d NCP %d symbol %d\n",symbol_mod,ch_amp,pilots,nb_rb,frame_parms->Ncp,symbol); + // printf("Scaling PDSCH Chest in OFDM symbol %d by %d\n",symbol_mod,ch_amp); + + ch_amp128 = _mm_set1_epi16(ch_amp); // Q3.13 + + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) { + for (aarx=0; aarxnb_antennas_rx; aarx++) { + + dl_ch128=(__m128i *)&dl_ch_estimates_ext[(aatx<<1)+aarx][symbol*frame_parms->N_RB_DL*12]; + + for (rb=0;rb=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + + if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_eNB!=1)) + nre=8; + else if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_eNB==1)) + nre=10; + else + nre=12; + + //nb_rb*nre = y * 2^x + int16_t x = factor2(nb_rb*nre); + int16_t y = (nb_rb*nre)>>x; + //printf("nb_rb*nre = %d = %d * 2^(%d)\n",nb_rb*nre,y,x); + + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) + for (aarx=0; aarxnb_antennas_rx; aarx++) { + //clear average level + avg128D = _mm_setzero_si128(); + // 5 is always a symbol with no pilots for both normal and extended prefix + + dl_ch128=(__m128i *)&dl_ch_estimates_ext[(aatx<<1)+aarx][symbol*frame_parms->N_RB_DL*12]; + + for (rb=0;rbNcp-1)))&&(frame_parms->nb_antenna_ports_eNB!=1)) { + dl_ch128+=2; + } + else { + avg128D = _mm_add_epi32(avg128D,_mm_srai_epi16(_mm_madd_epi16(dl_ch128[2],dl_ch128[2]),x)); + //avg128D = _mm_add_epi32(avg128D,_mm_madd_epi16(dl_ch128[2],_mm_srai_epi16(_mm_mulhi_epi16(dl_ch128[2], coeff128),15))); + dl_ch128+=3; + } + /* + if (rb==0) { + print_shorts("dl_ch128",&dl_ch128[0]); + print_shorts("dl_ch128",&dl_ch128[1]); + print_shorts("dl_ch128",&dl_ch128[2]); + } + */ + } + + avg[(aatx<<1)+aarx] =(((int32_t*)&avg128D)[0] + + ((int32_t*)&avg128D)[1] + + ((int32_t*)&avg128D)[2] + + ((int32_t*)&avg128D)[3])/y; + // printf("Channel level : %d\n",avg[(aatx<<1)+aarx]); + } + + _mm_empty(); + _m_empty(); + +#elif defined(__arm__) + + short rb; + unsigned char aatx,aarx,nre=12,symbol_mod; + int32x4_t avg128D; + int16x4_t *dl_ch128; + + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) + for (aarx=0; aarxnb_antennas_rx; aarx++) { + //clear average level + avg128D = vdupq_n_s32(0); + // 5 is always a symbol with no pilots for both normal and extended prefix + + dl_ch128=(int16x4_t *)&dl_ch_estimates_ext[(aatx<<1)+aarx][symbol*frame_parms->N_RB_DL*12]; + + for (rb=0; rbNcp-1)))&&(frame_parms->nb_antenna_ports_eNB!=1)) { + dl_ch128+=4; + } else { + avg128D = vqaddq_s32(avg128D,vmull_s16(dl_ch128[4],dl_ch128[4])); + avg128D = vqaddq_s32(avg128D,vmull_s16(dl_ch128[5],dl_ch128[5])); + dl_ch128+=6; + } + + /* + if (rb==0) { + print_shorts("dl_ch128",&dl_ch128[0]); + print_shorts("dl_ch128",&dl_ch128[1]); + print_shorts("dl_ch128",&dl_ch128[2]); + } + */ + } + + + if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_eNB!=1)) + nre=8; + else if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_eNB==1)) + nre=10; + else + nre=12; + + avg[(aatx<<1)+aarx] = (((int32_t*)&avg128D)[0] + + ((int32_t*)&avg128D)[1] + + ((int32_t*)&avg128D)[2] + + ((int32_t*)&avg128D)[3])/(nb_rb*nre); + + // printf("Channel level : %d\n",avg[(aatx<<1)+aarx]); + } + + +#endif +} + +//compute average channel_level of effective (precoded) channel + +//compute average channel_level of effective (precoded) channel +void dlsch_channel_level_TM34(int **dl_ch_estimates_ext, + LTE_DL_FRAME_PARMS *frame_parms, + unsigned char *pmi_ext, + int *avg_0, + int *avg_1, + uint8_t symbol, + unsigned short nb_rb, + MIMO_mode_t mimo_mode){ + +#if defined(__x86_64__)||defined(__i386__) + + + short rb; + unsigned char aarx,nre=12,symbol_mod; + __m128i *dl_ch0_128,*dl_ch1_128, dl_ch0_128_tmp, dl_ch1_128_tmp, avg_0_128D, avg_1_128D; + + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + + //clear average level + // avg_0_128D = _mm_setzero_si128(); + // avg_1_128D = _mm_setzero_si128(); + avg_0[0] = 0; + avg_0[1] = 0; + avg_1[0] = 0; + avg_1[1] = 0; + // 5 is always a symbol with no pilots for both normal and extended prefix + + if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_eNB!=1)) + nre=8; + else if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_eNB==1)) + nre=10; + else + nre=12; + + for (aarx=0; aarxnb_antennas_rx; aarx++) { + dl_ch0_128 = (__m128i *)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch1_128 = (__m128i *)&dl_ch_estimates_ext[2+aarx][symbol*frame_parms->N_RB_DL*12]; + + avg_0_128D = _mm_setzero_si128(); + avg_1_128D = _mm_setzero_si128(); + for (rb=0; rbNcp-1)))&&(frame_parms->nb_antenna_ports_eNB!=1)) { + dl_ch0_128+=2; + dl_ch1_128+=2; + } + else { + dl_ch0_128_tmp = _mm_load_si128(&dl_ch0_128[2]); + dl_ch1_128_tmp = _mm_load_si128(&dl_ch1_128[2]); + + if (mimo_mode==LARGE_CDD) + prec2A_TM3_128(&dl_ch0_128_tmp,&dl_ch1_128_tmp); + else if (mimo_mode==DUALSTREAM_UNIFORM_PRECODING1) + prec2A_TM4_128(0,&dl_ch0_128_tmp,&dl_ch1_128_tmp); + else if (mimo_mode==DUALSTREAM_UNIFORM_PRECODINGj) + prec2A_TM4_128(1,&dl_ch0_128_tmp,&dl_ch1_128_tmp); + else if (mimo_mode==DUALSTREAM_PUSCH_PRECODING) + prec2A_TM4_128(pmi_ext[rb],&dl_ch0_128_tmp,&dl_ch1_128_tmp); + // mmtmpD2 = _mm_madd_epi16(dl_ch0_128_tmp,dl_ch0_128_tmp); + + avg_1_128D = _mm_add_epi32(avg_1_128D,_mm_madd_epi16(dl_ch1_128_tmp,dl_ch1_128_tmp)); + avg_0_128D = _mm_add_epi32(avg_0_128D,_mm_madd_epi16(dl_ch0_128_tmp,dl_ch0_128_tmp)); + + dl_ch0_128+=3; + dl_ch1_128+=3; + } + } + + + avg_0[aarx] = (((int*)&avg_0_128D)[0])/(nb_rb*nre) + + (((int*)&avg_0_128D)[1])/(nb_rb*nre) + + (((int*)&avg_0_128D)[2])/(nb_rb*nre) + + (((int*)&avg_0_128D)[3])/(nb_rb*nre); + // printf("From Chan_level aver stream 0 %d =%d\n", aarx, avg_0[aarx]); + + avg_1[aarx] = (((int*)&avg_1_128D)[0])/(nb_rb*nre) + + (((int*)&avg_1_128D)[1])/(nb_rb*nre) + + (((int*)&avg_1_128D)[2])/(nb_rb*nre) + + (((int*)&avg_1_128D)[3])/(nb_rb*nre); + // printf("From Chan_level aver stream 1 %d =%d\n", aarx, avg_1[aarx]); + } +//avg_0[0] = max(avg_0[0],avg_0[1]); +//avg_1[0] = max(avg_1[0],avg_1[1]); +//avg_0[0]= max(avg_0[0], avg_1[0]); + + avg_0[0] = avg_0[0] + avg_0[1]; + // printf("From Chan_level aver stream 0 final =%d\n", avg_0[0]); + avg_1[0] = avg_1[0] + avg_1[1]; + // printf("From Chan_level aver stream 1 final =%d\n", avg_1[0]); + avg_0[0] = min (avg_0[0], avg_1[0]); + avg_1[0] = avg_0[0]; + + _mm_empty(); + _m_empty(); + +#elif defined(__arm__) + +#endif +} + + + +/*void dlsch_channel_level_TM34(int **dl_ch_estimates_ext, + LTE_DL_FRAME_PARMS *frame_parms, + int *avg, + uint8_t symbol, + unsigned short nb_rb, + MIMO_mode_t mimo_mode){ + +#if defined(__x86_64__)||defined(__i386__) + + + short rb; + unsigned char aarx,nre=12,symbol_mod; + __m128i *dl_ch0_128,*dl_ch1_128, dl_ch0_128_tmp, dl_ch1_128_tmp,avg128D; + + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + + //clear average level + avg128D = _mm_setzero_si128(); + avg[0] = 0; + avg[1] = 0; + // 5 is always a symbol with no pilots for both normal and extended prefix + + if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_eNB!=1)) + nre=8; + else if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_eNB==1)) + nre=10; + else + nre=12; + + for (aarx=0; aarxnb_antennas_rx; aarx++) { + dl_ch0_128 = (__m128i *)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch1_128 = (__m128i *)&dl_ch_estimates_ext[2+aarx][symbol*frame_parms->N_RB_DL*12]; + + for (rb=0; rbNcp-1)))&&(frame_parms->nb_antenna_ports_eNB!=1)) { + dl_ch0_128+=2; + dl_ch1_128+=2; + } + else { + dl_ch0_128_tmp = _mm_load_si128(&dl_ch0_128[2]); + dl_ch1_128_tmp = _mm_load_si128(&dl_ch1_128[2]); + + if (mimo_mode==LARGE_CDD) + prec2A_TM3_128(&dl_ch0_128_tmp,&dl_ch1_128_tmp); + else if (mimo_mode==DUALSTREAM_UNIFORM_PRECODING1) + prec2A_TM4_128(0,&dl_ch0_128_tmp,&dl_ch1_128_tmp); + else if (mimo_mode==DUALSTREAM_UNIFORM_PRECODINGj) + prec2A_TM4_128(1,&dl_ch0_128_tmp,&dl_ch1_128_tmp); + + // mmtmpD2 = _mm_madd_epi16(dl_ch0_128_tmp,dl_ch0_128_tmp); + avg128D = _mm_add_epi32(avg128D,_mm_madd_epi16(dl_ch0_128_tmp,dl_ch0_128_tmp)); + + dl_ch0_128+=3; + dl_ch1_128+=3; + } + } + + avg[aarx] = (((int*)&avg128D)[0])/(nb_rb*nre) + + (((int*)&avg128D)[1])/(nb_rb*nre) + + (((int*)&avg128D)[2])/(nb_rb*nre) + + (((int*)&avg128D)[3])/(nb_rb*nre); + } + + // choose maximum of the 2 effective channels + avg[0] = cmax(avg[0],avg[1]); + + _mm_empty(); + _m_empty(); + +#elif defined(__arm__) + +#endif +}*/ + +//compute average channel_level of effective (precoded) channel +void dlsch_channel_level_TM56(int **dl_ch_estimates_ext, + LTE_DL_FRAME_PARMS *frame_parms, + unsigned char *pmi_ext, + int *avg, + uint8_t symbol, + unsigned short nb_rb) +{ + +#if defined(__x86_64__)||defined(__i386__) + + short rb; + unsigned char aarx,nre=12,symbol_mod; + __m128i *dl_ch0_128,*dl_ch1_128, dl_ch0_128_tmp, dl_ch1_128_tmp,avg128D; + + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + + //clear average level + avg128D = _mm_setzero_si128(); + avg[0] = 0; + avg[1] = 0; + // 5 is always a symbol with no pilots for both normal and extended prefix + + if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_eNB!=1)) + nre=8; + else if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))&&(frame_parms->nb_antenna_ports_eNB==1)) + nre=10; + else + nre=12; + + for (aarx=0; aarxnb_antennas_rx; aarx++) { + dl_ch0_128 = (__m128i *)&dl_ch_estimates_ext[aarx][symbol*frame_parms->N_RB_DL*12]; + dl_ch1_128 = (__m128i *)&dl_ch_estimates_ext[2+aarx][symbol*frame_parms->N_RB_DL*12]; + + for (rb=0; rbNcp-1)))&&(frame_parms->nb_antenna_ports_eNB!=1)) { + dl_ch0_128+=2; + dl_ch1_128+=2; + } + else { + dl_ch0_128_tmp = _mm_load_si128(&dl_ch0_128[2]); + dl_ch1_128_tmp = _mm_load_si128(&dl_ch1_128[2]); + + prec2A_TM56_128(pmi_ext[rb],&dl_ch0_128_tmp,&dl_ch1_128_tmp); + // mmtmpD2 = _mm_madd_epi16(dl_ch0_128_tmp,dl_ch0_128_tmp); + avg128D = _mm_add_epi32(avg128D,_mm_madd_epi16(dl_ch0_128_tmp,dl_ch0_128_tmp)); + + dl_ch0_128+=3; + dl_ch1_128+=3; + } + } + + avg[aarx] = (((int*)&avg128D)[0])/(nb_rb*nre) + + (((int*)&avg128D)[1])/(nb_rb*nre) + + (((int*)&avg128D)[2])/(nb_rb*nre) + + (((int*)&avg128D)[3])/(nb_rb*nre); + } + + // choose maximum of the 2 effective channels + avg[0] = cmax(avg[0],avg[1]); + + _mm_empty(); + _m_empty(); + +#elif defined(__arm__) + + +#endif +} + +//compute average channel_level for TM7 +void dlsch_channel_level_TM7(int **dl_bf_ch_estimates_ext, + LTE_DL_FRAME_PARMS *frame_parms, + int *avg, + uint8_t symbol, + unsigned short nb_rb) +{ + +#if defined(__x86_64__)||defined(__i386__) + + short rb; + unsigned char aatx,aarx,nre=12,symbol_mod; + __m128i *dl_ch128,avg128D; + + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + + for (aatx=0; aatxnb_antenna_ports_eNB; aatx++) + for (aarx=0; aarxnb_antennas_rx; aarx++) { + //clear average level + avg128D = _mm_setzero_si128(); + // 5 is always a symbol with no pilots for both normal and extended prefix + + dl_ch128=(__m128i *)&dl_bf_ch_estimates_ext[(aatx<<1)+aarx][symbol*frame_parms->N_RB_DL*12]; + + for (rb=0; rbNcp-1)))&&(frame_parms->nb_antenna_ports_eNB!=1)) { + dl_ch128+=2; + } else { + avg128D = _mm_add_epi32(avg128D,_mm_madd_epi16(dl_ch128[2],dl_ch128[2])); + dl_ch128+=3; + } + + /* + if (rb==0) { + print_shorts("dl_ch128",&dl_ch128[0]); + print_shorts("dl_ch128",&dl_ch128[1]); + print_shorts("dl_ch128",&dl_ch128[2]); + } + */ + } + + if (((symbol_mod == 0) || (symbol_mod == (frame_parms->Ncp-1)))) + nre=10; + else if ((frame_parms->Ncp==0) && (symbol==3 || symbol==6 || symbol==9 || symbol==12)) + nre=9; + else if ((frame_parms->Ncp==1) && (symbol==4 || symbol==7 || symbol==9)) + nre=8; + else + nre=12; + + avg[(aatx<<1)+aarx] = (((int*)&avg128D)[0] + + ((int*)&avg128D)[1] + + ((int*)&avg128D)[2] + + ((int*)&avg128D)[3])/(nb_rb*nre); + + // printf("Channel level : %d\n",avg[(aatx<<1)+aarx]); + } + + _mm_empty(); + _m_empty(); + +#elif defined(__arm__) + +#endif +} +//#define ONE_OVER_2_Q15 16384 +void dlsch_alamouti(LTE_DL_FRAME_PARMS *frame_parms, + int **rxdataF_comp, + int **dl_ch_mag, + int **dl_ch_magb, + unsigned char symbol, + unsigned short nb_rb) +{ + +#if defined(__x86_64__)||defined(__i386__) + + short *rxF0,*rxF1; + __m128i *ch_mag0,*ch_mag1,*ch_mag0b,*ch_mag1b, *rxF0_128; + unsigned char rb,re; + int jj = (symbol*frame_parms->N_RB_DL*12); + uint8_t symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + uint8_t pilots = ((symbol_mod==0)||(symbol_mod==(4-frame_parms->Ncp))) ? 1 : 0; + rxF0_128 = (__m128i*) &rxdataF_comp[0][jj]; + + //amp = _mm_set1_epi16(ONE_OVER_2_Q15); + + + // printf("Doing alamouti!\n"); + rxF0 = (short*)&rxdataF_comp[0][jj]; //tx antenna 0 h0*y + rxF1 = (short*)&rxdataF_comp[2][jj]; //tx antenna 1 h1*y + ch_mag0 = (__m128i *)&dl_ch_mag[0][jj]; + ch_mag1 = (__m128i *)&dl_ch_mag[2][jj]; + ch_mag0b = (__m128i *)&dl_ch_magb[0][jj]; + ch_mag1b = (__m128i *)&dl_ch_magb[2][jj]; + + for (rb=0; rb=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + pilots = ((symbol_mod==0)||(symbol_mod==(4-frame_parms->Ncp))) ? 1 : 0; + l=symbol; + nsymb = (frame_parms->Ncp==NORMAL) ? 14:12; + + if (frame_parms->frame_type == TDD) { // TDD + sss_symb = nsymb-1; + pss_symb = 2; + } else { + sss_symb = (nsymb>>1)-2; + pss_symb = (nsymb>>1)-1; + } + + if (symbol_mod==(4-frame_parms->Ncp)) + poffset=3; + + for (aarx=0; aarxnb_antennas_rx; aarx++) { + + if (high_speed_flag == 1) + dl_ch0 = &dl_ch_estimates[aarx][5+(symbol*(frame_parms->ofdm_symbol_size))]; + else + dl_ch0 = &dl_ch_estimates[aarx][5]; + + dl_ch0_ext = &dl_ch_estimates_ext[aarx][symbol*(frame_parms->N_RB_DL*12)]; + + rxF_ext = &rxdataF_ext[aarx][symbol*(frame_parms->N_RB_DL*12)]; + rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + (symbol*(frame_parms->ofdm_symbol_size)))]; + + if ((frame_parms->N_RB_DL&1) == 0) // even number of RBs + + for (rb=0;rbN_RB_DL;rb++) { + + if (rb < 32) + rb_alloc_ind = (rb_alloc[0]>>rb) & 1; + else if (rb < 64) + rb_alloc_ind = (rb_alloc[1]>>(rb-32)) & 1; + else if (rb < 96) + rb_alloc_ind = (rb_alloc[2]>>(rb-64)) & 1; + else if (rb < 100) + rb_alloc_ind = (rb_alloc[3]>>(rb-96)) & 1; + else + rb_alloc_ind = 0; + + if (rb_alloc_ind == 1) + nb_rb++; + + // For second half of RBs skip DC carrier + if (rb==(frame_parms->N_RB_DL>>1)) { + rxF = &rxdataF[aarx][(1 + (symbol*(frame_parms->ofdm_symbol_size)))]; + //dl_ch0++; + } + + // PBCH + if ((subframe==0) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=nsymb>>1) && (l<((nsymb>>1) + 4))) { + rb_alloc_ind = 0; + } + + //SSS + if (((subframe==0)||(subframe==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb) ) { + rb_alloc_ind = 0; + } + + + if (frame_parms->frame_type == FDD) { + //PSS + if (((subframe==0)||(subframe==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + } + + if ((frame_parms->frame_type == TDD) && + (subframe==6)) { //TDD Subframe 6 + if ((rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + } + + if (rb_alloc_ind==1) { + *pmi_ext = (pmi>>((rb>>2)<<1))&3; + memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); + + /* + printf("rb %d\n",rb); + for (i=0;i<12;i++) + printf("(%d %d)",((short *)dl_ch0)[i<<1],((short*)dl_ch0)[1+(i<<1)]); + printf("\n"); + */ + if (pilots==0) { + for (i=0; i<12; i++) { + rxF_ext[i]=rxF[i]; + /* + printf("%d : (%d,%d)\n",(rxF+i-&rxdataF[aarx][( (symbol*(frame_parms->ofdm_symbol_size)))]), + ((short*)&rxF[i])[0],((short*)&rxF[i])[1]);*/ + } + + dl_ch0_ext+=12; + rxF_ext+=12; + } else { + j=0; + + for (i=0; i<12; i++) { + if ((i!=(frame_parms->nushift+poffset)) && + (i!=((frame_parms->nushift+poffset+6)%12))) { + rxF_ext[j]=rxF[i]; + // printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); + dl_ch0_ext[j++]=dl_ch0[i]; + + } + } + + dl_ch0_ext+=10; + rxF_ext+=10; + } + + + } + + dl_ch0+=12; + rxF+=12; + + } + else { // Odd number of RBs + for (rb=0; rbN_RB_DL>>1; rb++) { +#ifdef DEBUG_DLSCH_DEMOD + printf("dlch_ext %d\n",dl_ch0_ext-&dl_ch_estimates_ext[aarx][0]); +#endif + skip_half=0; + + if (rb < 32) + rb_alloc_ind = (rb_alloc[0]>>rb) & 1; + else if (rb < 64) + rb_alloc_ind = (rb_alloc[1]>>(rb-32)) & 1; + else if (rb < 96) + rb_alloc_ind = (rb_alloc[2]>>(rb-64)) & 1; + else if (rb < 100) + rb_alloc_ind = (rb_alloc[3]>>(rb-96)) & 1; + else + rb_alloc_ind = 0; + + if (rb_alloc_ind == 1) + nb_rb++; + + + // PBCH + if ((subframe==0) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) { + rb_alloc_ind = 0; + } + + //PBCH subframe 0, symbols nsymb>>1 ... nsymb>>1 + 3 + if ((subframe==0) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) + skip_half=1; + else if ((subframe==0) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) + skip_half=2; + + //SSS + + if (((subframe==0)||(subframe==5)) && + (rb>((frame_parms->N_RB_DL>>1)-3)) && + (rb<((frame_parms->N_RB_DL>>1)+3)) && + (l==sss_symb) ) { + rb_alloc_ind = 0; + } + //SSS + if (((subframe==0)||(subframe==5)) && + (rb==((frame_parms->N_RB_DL>>1)-3)) && + (l==sss_symb)) + skip_half=1; + else if (((subframe==0)||(subframe==5)) && + (rb==((frame_parms->N_RB_DL>>1)+3)) && + (l==sss_symb)) + skip_half=2; + + //PSS in subframe 0/5 if FDD + if (frame_parms->frame_type == FDD) { //FDD + + if (((subframe==0)||(subframe==5)) && + (rb>((frame_parms->N_RB_DL>>1)-3)) && + (rb<((frame_parms->N_RB_DL>>1)+3)) && + (l==pss_symb) ) { + rb_alloc_ind = 0; + } + + if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb)) + skip_half=1; + else if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb)) + skip_half=2; + } + + if ((frame_parms->frame_type == TDD) && + (subframe==6)){ //TDD Subframe 6 + if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + if ((rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb)) + skip_half=1; + else if ((rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb)) + skip_half=2; + } + + + if (rb_alloc_ind==1) { + +#ifdef DEBUG_DLSCH_DEMOD + printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half); +#endif + if (pilots==0) { + // printf("Extracting w/o pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); + if (skip_half==1) { + memcpy(dl_ch0_ext,dl_ch0,6*sizeof(int)); + + for (i=0; i<6; i++) { + rxF_ext[i]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + dl_ch0_ext+=6; + rxF_ext+=6; + } else if (skip_half==2) { + memcpy(dl_ch0_ext,dl_ch0+6,6*sizeof(int)); + + for (i=0; i<6; i++) { + rxF_ext[i]=rxF[(i+6)]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + dl_ch0_ext+=6; + rxF_ext+=6; + } else { + memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); + + for (i=0; i<12; i++) { + rxF_ext[i]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + dl_ch0_ext+=12; + rxF_ext+=12; + } + } else { + // printf("Extracting with pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); + j=0; + + if (skip_half==1) { + for (i=0; i<6; i++) { + if (i!=((frame_parms->nushift+poffset)%6)) { + rxF_ext[j]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#endif + dl_ch0_ext[j++]=dl_ch0[i]; + } + } + rxF_ext+=5; + dl_ch0_ext+=5; + } else if (skip_half==2) { + for (i=0; i<6; i++) { + if (i!=((frame_parms->nushift+poffset)%6)) { + rxF_ext[j]=rxF[(i+6)]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#endif + dl_ch0_ext[j++]=dl_ch0[i+6]; + } + } + + dl_ch0_ext+=5; + rxF_ext+=5; + } else { + for (i=0; i<12; i++) { + if ((i!=(frame_parms->nushift+poffset)) && + (i!=((frame_parms->nushift+poffset+6)%12))) { + rxF_ext[j]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#endif + dl_ch0_ext[j++]=dl_ch0[i]; + + } + } + + dl_ch0_ext+=10; + rxF_ext+=10; + } + } + } + dl_ch0+=12; + rxF+=12; + } // first half loop + + + // Do middle RB (around DC) + if (rb < 32) + rb_alloc_ind = (rb_alloc[0]>>rb) & 1; + else if (rb < 64) + rb_alloc_ind = (rb_alloc[1]>>(rb-32)) & 1; + else if (rb < 96) + rb_alloc_ind = (rb_alloc[2]>>(rb-64)) & 1; + else if (rb < 100) + rb_alloc_ind = (rb_alloc[3]>>(rb-96)) & 1; + else + rb_alloc_ind = 0; + + + if (rb_alloc_ind == 1) + nb_rb++; + + // PBCH + + if ((subframe==0) && + (l>=(nsymb>>1)) && + (l<((nsymb>>1) + 4))) { + rb_alloc_ind = 0; + } + + //SSS + if (((subframe==0)||(subframe==5)) && (l==sss_symb) ) { + rb_alloc_ind = 0; + } + + if (frame_parms->frame_type == FDD) { + //PSS + if (((subframe==0)||(subframe==5)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + } + + //PSS + if ((frame_parms->frame_type == TDD) && + (subframe==6) && + (l==pss_symb) ) { + rb_alloc_ind = 0; + } + + + // printf("dlch_ext %d\n",dl_ch0_ext-&dl_ch_estimates_ext[aarx][0]); + // printf("DC rb %d (%p)\n",rb,rxF); + if (rb_alloc_ind==1) { +#ifdef DEBUG_DLSCH_DEMOD + printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half); +#endif + if (pilots==0) { + for (i=0; i<6; i++) { + dl_ch0_ext[i]=dl_ch0[i]; + rxF_ext[i]=rxF[i]; + } + + rxF = &rxdataF[aarx][((symbol*(frame_parms->ofdm_symbol_size)))]; + + for (; i<12; i++) { + dl_ch0_ext[i]=dl_ch0[i]; + rxF_ext[i]=rxF[(1+i-6)]; + } + + dl_ch0_ext+=12; + rxF_ext+=12; + } else { // pilots==1 + j=0; + + for (i=0; i<6; i++) { + if (i!=((frame_parms->nushift+poffset)%6)) { + dl_ch0_ext[j]=dl_ch0[i]; + rxF_ext[j++]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("**extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1])); +#endif + } + } + + rxF = &rxdataF[aarx][((symbol*(frame_parms->ofdm_symbol_size)))]; + + for (; i<12; i++) { + if (i!=((frame_parms->nushift+6+poffset)%12)) { + dl_ch0_ext[j]=dl_ch0[i]; + rxF_ext[j++]=rxF[(1+i-6)]; +#ifdef DEBUG_DLSCH_DEMOD + printf("**extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j-1],*(1+(short*)&rxF_ext[j-1])); +#endif + } + } + + dl_ch0_ext+=10; + rxF_ext+=10; + } // symbol_mod==0 + } // rballoc==1 + else { + rxF = &rxdataF[aarx][((symbol*(frame_parms->ofdm_symbol_size)))]; + } + + dl_ch0+=12; + rxF+=7; + rb++; + + for (;rbN_RB_DL;rb++) { + // printf("dlch_ext %d\n",dl_ch0_ext-&dl_ch_estimates_ext[aarx][0]); + // printf("rb %d (%p)\n",rb,rxF); + skip_half=0; + + if (rb < 32) + rb_alloc_ind = (rb_alloc[0]>>rb) & 1; + else if (rb < 64) + rb_alloc_ind = (rb_alloc[1]>>(rb-32)) & 1; + else if (rb < 96) + rb_alloc_ind = (rb_alloc[2]>>(rb-64)) & 1; + else if (rb < 100) + rb_alloc_ind = (rb_alloc[3]>>(rb-96)) & 1; + else + rb_alloc_ind = 0; + + if (rb_alloc_ind == 1) + nb_rb++; + + // PBCH + if ((subframe==0) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=nsymb>>1) && (l<((nsymb>>1) + 4))) { + rb_alloc_ind = 0; + } + //PBCH subframe 0, symbols nsymb>>1 ... nsymb>>1 + 3 + if ((subframe==0) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) + skip_half=1; + else if ((subframe==0) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) + skip_half=2; + + //SSS + if (((subframe==0)||(subframe==5)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb) ) { + rb_alloc_ind = 0; + } + //SSS + if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l==sss_symb)) + skip_half=1; + else if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb)) + skip_half=2; + if (frame_parms->frame_type == FDD) { + //PSS + if (((subframe==0)||(subframe==5)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + + //PSS + + if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb)) + skip_half=1; + else if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb)) + skip_half=2; + } + + if ((frame_parms->frame_type == TDD) && + + (subframe==6)) { //TDD Subframe 6 + if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + + if ((rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb)) + skip_half=1; + else if ((rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb)) + skip_half=2; + } + + if (rb_alloc_ind==1) { +#ifdef DEBUG_DLSCH_DEMOD + printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half); +#endif + /* + printf("rb %d\n",rb); + for (i=0;i<12;i++) + printf("(%d %d)",((short *)dl_ch0)[i<<1],((short*)dl_ch0)[1+(i<<1)]); + printf("\n"); + */ + if (pilots==0) { + // printf("Extracting w/o pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); + if (skip_half==1) { + memcpy(dl_ch0_ext,dl_ch0,6*sizeof(int)); + + for (i=0; i<6; i++) { + rxF_ext[i]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + dl_ch0_ext+=6; + rxF_ext+=6; + + } else if (skip_half==2) { + memcpy(dl_ch0_ext,dl_ch0+6,6*sizeof(int)); + + for (i=0; i<6; i++) { + rxF_ext[i]=rxF[(i+6)]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + dl_ch0_ext+=6; + rxF_ext+=6; + + } else { + memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); + + for (i=0; i<12; i++) { + rxF_ext[i]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + dl_ch0_ext+=12; + rxF_ext+=12; + } + } else { + // printf("Extracting with pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); + j=0; + + if (skip_half==1) { + for (i=0; i<6; i++) { + if (i!=((frame_parms->nushift+poffset)%6)) { + rxF_ext[j]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#endif + dl_ch0_ext[j++]=dl_ch0[i]; + } + } + + dl_ch0_ext+=5; + rxF_ext+=5; + } else if (skip_half==2) { + for (i=0; i<6; i++) { + if (i!=((frame_parms->nushift+poffset)%6)) { + rxF_ext[j]=rxF[(i+6)]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#endif + dl_ch0_ext[j++]=dl_ch0[i+6]; + } + } + + dl_ch0_ext+=5; + rxF_ext+=5; + } else { + for (i=0; i<12; i++) { + if ((i!=(frame_parms->nushift+poffset)) && + (i!=((frame_parms->nushift+poffset+6)%12))) { + rxF_ext[j]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#endif + dl_ch0_ext[j++]=dl_ch0[i]; + } + } + dl_ch0_ext+=10; + rxF_ext+=10; + } + } // pilots=0 + } + + dl_ch0+=12; + rxF+=12; + } + } + } + + + return(nb_rb/frame_parms->nb_antennas_rx); +} + +unsigned short dlsch_extract_rbs_dual(int **rxdataF, + int **dl_ch_estimates, + int **rxdataF_ext, + int **dl_ch_estimates_ext, + unsigned short pmi, + unsigned char *pmi_ext, + unsigned int *rb_alloc, + unsigned char symbol, + unsigned char subframe, + uint32_t high_speed_flag, + LTE_DL_FRAME_PARMS *frame_parms, + MIMO_mode_t mimo_mode) { + + int prb,nb_rb=0; + int prb_off,prb_off2; + int rb_alloc_ind,skip_half=0,sss_symb,pss_symb=0,nsymb,l; + int i,aarx; + int32_t *dl_ch0,*dl_ch0p,*dl_ch0_ext,*dl_ch1,*dl_ch1p,*dl_ch1_ext,*rxF,*rxF_ext; + int symbol_mod,pilots=0,j=0; + unsigned char *pmi_loc; + + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + // printf("extract_rbs: symbol_mod %d\n",symbol_mod); + + if ((symbol_mod == 0) || (symbol_mod == (4-frame_parms->Ncp))) + pilots=1; + + nsymb = (frame_parms->Ncp==NORMAL) ? 14:12; + l=symbol; + + if (frame_parms->frame_type == TDD) { // TDD + sss_symb = nsymb-1; + pss_symb = 2; + } else { + sss_symb = (nsymb>>1)-2; + pss_symb = (nsymb>>1)-1; + } + + for (aarx=0; aarxnb_antennas_rx; aarx++) { + + if (high_speed_flag==1) { + dl_ch0 = &dl_ch_estimates[aarx][5+(symbol*(frame_parms->ofdm_symbol_size))]; + dl_ch1 = &dl_ch_estimates[2+aarx][5+(symbol*(frame_parms->ofdm_symbol_size))]; + } else { + dl_ch0 = &dl_ch_estimates[aarx][5]; + dl_ch1 = &dl_ch_estimates[2+aarx][5]; + } + + pmi_loc = pmi_ext; + + // pointers to extracted RX signals and channel estimates + rxF_ext = &rxdataF_ext[aarx][symbol*(frame_parms->N_RB_DL*12)]; + dl_ch0_ext = &dl_ch_estimates_ext[aarx][symbol*(frame_parms->N_RB_DL*12)]; + dl_ch1_ext = &dl_ch_estimates_ext[2+aarx][symbol*(frame_parms->N_RB_DL*12)]; + + for (prb=0; prbN_RB_DL; prb++) { + skip_half=0; + + if (prb < 32) + rb_alloc_ind = (rb_alloc[0]>>prb) & 1; + else if (prb < 64) + rb_alloc_ind = (rb_alloc[1]>>(prb-32)) & 1; + else if (prb < 96) + rb_alloc_ind = (rb_alloc[2]>>(prb-64)) & 1; + else if (prb < 100) + rb_alloc_ind = (rb_alloc[3]>>(prb-96)) & 1; + else + rb_alloc_ind = 0; + + if (rb_alloc_ind == 1) + nb_rb++; + + + if ((frame_parms->N_RB_DL&1) == 0) { // even number of RBs + + // PBCH + if ((subframe==0) && + (prb>=((frame_parms->N_RB_DL>>1)-3)) && + (prb<((frame_parms->N_RB_DL>>1)+3)) && + (l>=(nsymb>>1)) && + (l<((nsymb>>1) + 4))) { + rb_alloc_ind = 0; + // printf("symbol %d / rb %d: skipping PBCH REs\n",symbol,prb); + } + + //SSS + + if (((subframe==0)||(subframe==5)) && + (prb>=((frame_parms->N_RB_DL>>1)-3)) && + (prb<((frame_parms->N_RB_DL>>1)+3)) && + (l==sss_symb) ) { + rb_alloc_ind = 0; + // printf("symbol %d / rb %d: skipping SSS REs\n",symbol,prb); + } + + + + //PSS in subframe 0/5 if FDD + if (frame_parms->frame_type == FDD) { //FDD + if (((subframe==0)||(subframe==5)) && + (prb>=((frame_parms->N_RB_DL>>1)-3)) && + (prb<((frame_parms->N_RB_DL>>1)+3)) && + (l==pss_symb) ) { + rb_alloc_ind = 0; + // printf("symbol %d / rb %d: skipping PSS REs\n",symbol,prb); + } + } + + if ((frame_parms->frame_type == TDD) && + (subframe==6)) { //TDD Subframe 6 + if ((prb>=((frame_parms->N_RB_DL>>1)-3)) && + (prb<((frame_parms->N_RB_DL>>1)+3)) && + (l==pss_symb) ) { + rb_alloc_ind = 0; + } + } + + if (rb_alloc_ind==1) { // PRB is allocated + + + + prb_off = 12*prb; + prb_off2 = 1+(12*(prb-(frame_parms->N_RB_DL>>1))); + dl_ch0p = dl_ch0+(12*prb); + dl_ch1p = dl_ch1+(12*prb); + if (prb<(frame_parms->N_RB_DL>>1)){ + rxF = &rxdataF[aarx][prb_off+ + frame_parms->first_carrier_offset + + (symbol*(frame_parms->ofdm_symbol_size))]; + } + else { + rxF = &rxdataF[aarx][prb_off2+ + (symbol*(frame_parms->ofdm_symbol_size))]; + } + + /* + if (mimo_mode <= PUSCH_PRECODING1) + *pmi_loc = (pmi>>((prb>>2)<<1))&3; + else + *pmi_loc=(pmi>>prb)&1;*/ + + *pmi_loc = get_pmi(frame_parms->N_RB_DL,mimo_mode,pmi,prb); + pmi_loc++; + + + if (pilots == 0) { + + memcpy(dl_ch0_ext,dl_ch0p,12*sizeof(int)); + memcpy(dl_ch1_ext,dl_ch1p,12*sizeof(int)); + memcpy(rxF_ext,rxF,12*sizeof(int)); + dl_ch0_ext +=12; + dl_ch1_ext +=12; + rxF_ext +=12; + } else { // pilots==1 + j=0; + for (i=0; i<12; i++) { + if ((i!=frame_parms->nushift) && + (i!=frame_parms->nushift+3) && + (i!=frame_parms->nushift+6) && + (i!=((frame_parms->nushift+9)%12))) { + rxF_ext[j]=rxF[i]; + // printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); + dl_ch0_ext[j]=dl_ch0p[i]; + dl_ch1_ext[j++]=dl_ch1p[i]; + } + } + dl_ch0_ext+=8; + dl_ch1_ext+=8; + rxF_ext+=8; + } // pilots==1 + + } + } else { // Odd number of RBs + + + // PBCH + if ((subframe==0) && + (prb>((frame_parms->N_RB_DL>>1)-3)) && + (prb<((frame_parms->N_RB_DL>>1)+3)) && + (l>=(nsymb>>1)) && + (l<((nsymb>>1) + 4))) { + rb_alloc_ind = 0; + // printf("symbol %d / rb %d: skipping PBCH REs\n",symbol,prb); + } + + //SSS + + if (((subframe==0)||(subframe==5)) && + (prb>((frame_parms->N_RB_DL>>1)-3)) && + (prb<((frame_parms->N_RB_DL>>1)+3)) && + (l==sss_symb) ) { + rb_alloc_ind = 0; + // printf("symbol %d / rb %d: skipping SSS REs\n",symbol,prb); + } + + + + //PSS in subframe 0/5 if FDD + if (frame_parms->frame_type == FDD) { //FDD + if (((subframe==0)||(subframe==5)) && + (prb>((frame_parms->N_RB_DL>>1)-3)) && + (prb<((frame_parms->N_RB_DL>>1)+3)) && + (l==pss_symb) ) { + rb_alloc_ind = 0; + // printf("symbol %d / rb %d: skipping PSS REs\n",symbol,prb); + } + } + + if ((frame_parms->frame_type == TDD) && + ((subframe==1) || (subframe==6))) { //TDD Subframe 1-6 + if ((prb>((frame_parms->N_RB_DL>>1)-3)) && + (prb<((frame_parms->N_RB_DL>>1)+3)) && + (l==pss_symb) ) { + rb_alloc_ind = 0; + } + } + + if (rb_alloc_ind == 1) { + skip_half=0; + + //Check if we have to drop half a PRB due to PSS/SSS/PBCH + // skip_half == 0 means full PRB + // skip_half == 1 means first half is used (leftmost half-PRB from PSS/SSS/PBCH) + // skip_half == 2 means second half is used (rightmost half-PRB from PSS/SSS/PBCH) + //PBCH subframe 0, symbols nsymb>>1 ... nsymb>>1 + 3 + if ((subframe==0) && + (prb==((frame_parms->N_RB_DL>>1)-3)) && + (l>=(nsymb>>1)) && + (l<((nsymb>>1) + 4))) + skip_half=1; + else if ((subframe==0) && + (prb==((frame_parms->N_RB_DL>>1)+3)) && + (l>=(nsymb>>1)) && + (l<((nsymb>>1) + 4))) + skip_half=2; + + //SSS + if (((subframe==0)||(subframe==5)) && + (prb==((frame_parms->N_RB_DL>>1)-3)) && + (l==sss_symb)) + skip_half=1; + else if (((subframe==0)||(subframe==5)) && + (prb==((frame_parms->N_RB_DL>>1)+3)) && + (l==sss_symb)) + skip_half=2; + + //PSS Subframe 0,5 + if (((frame_parms->frame_type == FDD) && + (((subframe==0)||(subframe==5)))) || //FDD Subframes 0,5 + ((frame_parms->frame_type == TDD) && + (((subframe==1) || (subframe==6))))) { //TDD Subframes 1,6 + + if ((prb==((frame_parms->N_RB_DL>>1)-3)) && + (l==pss_symb)) + skip_half=1; + else if ((prb==((frame_parms->N_RB_DL>>1)+3)) && + (l==pss_symb)) + skip_half=2; + } + + + prb_off = 12*prb; + prb_off2 = 7+(12*(prb-(frame_parms->N_RB_DL>>1)-1)); + dl_ch0p = dl_ch0+(12*prb); + dl_ch1p = dl_ch1+(12*prb); + + if (prb<=(frame_parms->N_RB_DL>>1)){ + rxF = &rxdataF[aarx][prb_off+ + frame_parms->first_carrier_offset + + (symbol*(frame_parms->ofdm_symbol_size))]; + } + else { + rxF = &rxdataF[aarx][prb_off2+ + (symbol*(frame_parms->ofdm_symbol_size))]; + } +#ifdef DEBUG_DLSCH_DEMOD + printf("symbol %d / rb %d: alloc %d skip_half %d (rxF %p, rxF_ext %p) prb_off (%d,%d)\n",symbol,prb,rb_alloc_ind,skip_half,rxF,rxF_ext,prb_off,prb_off2); +#endif + /* if (mimo_mode <= PUSCH_PRECODING1) + *pmi_loc = (pmi>>((prb>>2)<<1))&3; + else + *pmi_loc=(pmi>>prb)&1; + // printf("symbol_mod %d (pilots %d) rb %d, sb %d, pmi %d (pmi_loc %p,rxF %p, ch00 %p, ch01 %p, rxF_ext %p dl_ch0_ext %p dl_ch1_ext %p)\n",symbol_mod,pilots,prb,prb>>2,*pmi_loc,pmi_loc,rxF,dl_ch0, dl_ch1, rxF_ext,dl_ch0_ext,dl_ch1_ext); +*/ + *pmi_loc = get_pmi(frame_parms->N_RB_DL,mimo_mode,pmi,prb); + pmi_loc++; + + if (prb != (frame_parms->N_RB_DL>>1)) { // This PRB is not around DC + if (pilots==0) { + if (skip_half==1) { + memcpy(dl_ch0_ext,dl_ch0p,6*sizeof(int32_t)); + memcpy(dl_ch1_ext,dl_ch1p,6*sizeof(int32_t)); + memcpy(rxF_ext,rxF,6*sizeof(int32_t)); +#ifdef DEBUG_DLSCH_DEMOD + for (i=0;i<6;i++) + printf("extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + dl_ch0_ext+=6; + dl_ch1_ext+=6; + rxF_ext+=6; + } else if (skip_half==2) { + memcpy(dl_ch0_ext,dl_ch0p+6,6*sizeof(int32_t)); + memcpy(dl_ch1_ext,dl_ch1p+6,6*sizeof(int32_t)); + memcpy(rxF_ext,rxF+6,6*sizeof(int32_t)); +#ifdef DEBUG_DLSCH_DEMOD + for (i=0;i<6;i++) + printf("extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + dl_ch0_ext+=6; + dl_ch1_ext+=6; + rxF_ext+=6; + } else { // skip_half==0 + memcpy(dl_ch0_ext,dl_ch0p,12*sizeof(int32_t)); + memcpy(dl_ch1_ext,dl_ch1p,12*sizeof(int32_t)); + memcpy(rxF_ext,rxF,12*sizeof(int32_t)); +#ifdef DEBUG_DLSCH_DEMOD + for (i=0;i<12;i++) + printf("extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + dl_ch0_ext+=12; + dl_ch1_ext+=12; + rxF_ext+=12; + } + } else { // pilots=1 + j=0; + + if (skip_half==1) { + for (i=0; i<6; i++) { + if ((i!=frame_parms->nushift) && + (i!=((frame_parms->nushift+3)%6))) { + rxF_ext[j]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("(pilots,skip1)extract rb %d, re %d (%d)=> (%d,%d)\n",prb,i,j,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#endif + dl_ch0_ext[j]=dl_ch0p[i]; + dl_ch1_ext[j++]=dl_ch1p[i]; + } + } + dl_ch0_ext+=4; + dl_ch1_ext+=4; + rxF_ext+=4; + } else if (skip_half==2) { + for (i=0; i<6; i++) { + if ((i!=frame_parms->nushift) && + (i!=((frame_parms->nushift+3)%6))) { + rxF_ext[j]=rxF[(i+6)]; +#ifdef DEBUG_DLSCH_DEMOD + printf("(pilots,skip2)extract rb %d, re %d (%d) => (%d,%d)\n",prb,i,j,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#endif + dl_ch0_ext[j]=dl_ch0p[i+6]; + dl_ch1_ext[j++]=dl_ch1p[i+6]; + } + } + dl_ch0_ext+=4; + dl_ch1_ext+=4; + rxF_ext+=4; + + } else { //skip_half==0 + for (i=0; i<12; i++) { + if ((i!=frame_parms->nushift) && + (i!=frame_parms->nushift+3) && + (i!=frame_parms->nushift+6) && + (i!=((frame_parms->nushift+9)%12))) { + rxF_ext[j]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("(pilots)extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#endif + dl_ch0_ext[j] =dl_ch0p[i]; + dl_ch1_ext[j++]=dl_ch1p[i]; + } + } + dl_ch0_ext+=8; + dl_ch1_ext+=8; + rxF_ext+=8; + } //skip_half==0 + } //pilots==1 + } else { // Do middle RB (around DC) + + if (pilots==0) { + memcpy(dl_ch0_ext,dl_ch0p,6*sizeof(int32_t)); + memcpy(dl_ch1_ext,dl_ch1p,6*sizeof(int32_t)); + memcpy(rxF_ext,rxF,6*sizeof(int32_t)); +#ifdef DEBUG_DLSCH_DEMOD + for (i=0; i<6; i++) { + printf("extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); + } +#endif + rxF_ext+=6; + dl_ch0_ext+=6; + dl_ch1_ext+=6; + dl_ch0p+=6; + dl_ch1p+=6; + + rxF = &rxdataF[aarx][1+((symbol*(frame_parms->ofdm_symbol_size)))]; + + memcpy(dl_ch0_ext,dl_ch0p,6*sizeof(int32_t)); + memcpy(dl_ch1_ext,dl_ch1p,6*sizeof(int32_t)); + memcpy(rxF_ext,rxF,6*sizeof(int32_t)); +#ifdef DEBUG_DLSCH_DEMOD + for (i=0; i<6; i++) { + printf("extract rb %d, re %d => (%d,%d)\n",prb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); + } +#endif + rxF_ext+=6; + dl_ch0_ext+=6; + dl_ch1_ext+=6; + } else { // pilots==1 + j=0; + + for (i=0; i<6; i++) { + if ((i!=frame_parms->nushift) && + (i!=((frame_parms->nushift+3)%6))) { + dl_ch0_ext[j]=dl_ch0p[i]; + dl_ch1_ext[j]=dl_ch1p[i]; + rxF_ext[j++]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("(pilots)extract rb %d, re %d (%d) => (%d,%d)\n",prb,i,j,*(short *)&rxF[i],*(1+(short*)&rxF[i])); +#endif + } + } + rxF = &rxdataF[aarx][1+symbol*(frame_parms->ofdm_symbol_size)]; + + for (; i<12; i++) { + if ((i!=((frame_parms->nushift+6)%12)) && + (i!=((frame_parms->nushift+9)%12))) { + dl_ch0_ext[j]=dl_ch0p[i]; + dl_ch1_ext[j]=dl_ch1p[i]; + rxF_ext[j++]=rxF[i-6]; +#ifdef DEBUG_DLSCH_DEMOD + printf("(pilots)extract rb %d, re %d (%d) => (%d,%d)\n",prb,i,j,*(short *)&rxF[1+i-6],*(1+(short*)&rxF[1+i-6])); +#endif + } + } + + dl_ch0_ext+=8; + dl_ch1_ext+=8; + rxF_ext+=8; + } //pilots==1 + } // if Middle PRB + } // if odd PRB + } // if rballoc==1 + } // for prb + } // for aarx + return(nb_rb/frame_parms->nb_antennas_rx); +} + +unsigned short dlsch_extract_rbs_TM7(int **rxdataF, + int **dl_bf_ch_estimates, + int **rxdataF_ext, + int **dl_bf_ch_estimates_ext, + unsigned int *rb_alloc, + unsigned char symbol, + unsigned char subframe, + uint32_t high_speed_flag, + LTE_DL_FRAME_PARMS *frame_parms) +{ + + unsigned short rb,nb_rb=0; + unsigned char rb_alloc_ind; + unsigned char i,aarx,l,nsymb,skip_half=0,sss_symb,pss_symb=0; + int *dl_ch0,*dl_ch0_ext,*rxF,*rxF_ext; + + unsigned char symbol_mod,pilots=0,uespec_pilots=0,j=0,poffset=0,uespec_poffset=0; + int8_t uespec_nushift = frame_parms->Nid_cell%3; + + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + pilots = ((symbol_mod==0)||(symbol_mod==(4-frame_parms->Ncp))) ? 1 : 0; + l=symbol; + nsymb = (frame_parms->Ncp==NORMAL) ? 14:12; + + if (frame_parms->Ncp==0){ + if (symbol==3 || symbol==6 || symbol==9 || symbol==12) + uespec_pilots = 1; + } else{ + if (symbol==4 || symbol==7 || symbol==10) + uespec_pilots = 1; + } + + if (frame_parms->frame_type == TDD) {// TDD + sss_symb = nsymb-1; + pss_symb = 2; + } else { + sss_symb = (nsymb>>1)-2; + pss_symb = (nsymb>>1)-1; + } + + if (symbol_mod==(4-frame_parms->Ncp)) + poffset=3; + + if ((frame_parms->Ncp==0 && (symbol==6 ||symbol ==12)) || (frame_parms->Ncp==1 && symbol==7)) + uespec_poffset=2; + + for (aarx=0; aarxnb_antennas_rx; aarx++) { + + if (high_speed_flag == 1) + dl_ch0 = &dl_bf_ch_estimates[aarx][symbol*(frame_parms->ofdm_symbol_size)]; + else + dl_ch0 = &dl_bf_ch_estimates[aarx][0]; + + dl_ch0_ext = &dl_bf_ch_estimates_ext[aarx][symbol*(frame_parms->N_RB_DL*12)]; + + rxF_ext = &rxdataF_ext[aarx][symbol*(frame_parms->N_RB_DL*12)]; + rxF = &rxdataF[aarx][(frame_parms->first_carrier_offset + (symbol*(frame_parms->ofdm_symbol_size)))]; + + if ((frame_parms->N_RB_DL&1) == 0) // even number of RBs + for (rb=0; rbN_RB_DL; rb++) { + + if (rb < 32) + rb_alloc_ind = (rb_alloc[0]>>rb) & 1; + else if (rb < 64) + rb_alloc_ind = (rb_alloc[1]>>(rb-32)) & 1; + else if (rb < 96) + rb_alloc_ind = (rb_alloc[2]>>(rb-64)) & 1; + else if (rb < 100) + rb_alloc_ind = (rb_alloc[3]>>(rb-96)) & 1; + else + rb_alloc_ind = 0; + + if (rb_alloc_ind == 1) + nb_rb++; + + // For second half of RBs skip DC carrier + if (rb==(frame_parms->N_RB_DL>>1)) { + rxF = &rxdataF[aarx][(1 + (symbol*(frame_parms->ofdm_symbol_size)))]; + //dl_ch0++; + } + + // PBCH + if ((subframe==0) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=nsymb>>1) && (l<((nsymb>>1) + 4))) { + rb_alloc_ind = 0; + } + + //SSS + if (((subframe==0)||(subframe==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb) ) { + rb_alloc_ind = 0; + } + + + if (frame_parms->frame_type == FDD) { + //PSS + if (((subframe==0)||(subframe==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + } + + if ((frame_parms->frame_type == TDD) && + (subframe==6)) { //TDD Subframe 6 + if ((rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + } + + if (rb_alloc_ind==1) { + + /* + printf("rb %d\n",rb); + for (i=0;i<12;i++) + printf("(%d %d)",((short *)dl_ch0)[i<<1],((short*)dl_ch0)[1+(i<<1)]); + printf("\n"); + */ + if (pilots==0 && uespec_pilots==0) { + memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); + + for (i=0; i<12; i++) { + rxF_ext[i]=rxF[i]; + } + + dl_ch0_ext+=12; + rxF_ext+=12; + } else if(pilots==1 && uespec_pilots==0) { + j=0; + + for (i=0; i<12; i++) { + if ((i!=(frame_parms->nushift+poffset)) && + (i!=((frame_parms->nushift+poffset+6)%12))) { + rxF_ext[j]=rxF[i]; + dl_ch0_ext[j++]=dl_ch0[i]; + } + } + + dl_ch0_ext+=10; + rxF_ext+=10; + + } else if (pilots==0 && uespec_pilots==1) { + j=0; + + + for (i=0; i<12; i++){ + if (frame_parms->Ncp==0){ + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ + rxF_ext[j] = rxF[i]; + dl_ch0_ext[j++]=dl_ch0[i]; + } + } else{ + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ + rxF_ext[j] = rxF[i]; + dl_ch0_ext[j++]=dl_ch0[i]; + } + } + + } + + dl_ch0_ext+=9-frame_parms->Ncp; + rxF_ext+=9-frame_parms->Ncp; + + } else { + LOG_E(PHY,"dlsch_extract_rbs_TM7(dl_demodulation.c):pilot or ue spec pilot detection error\n"); + exit(-1); + } + + } + + dl_ch0+=12; + rxF+=12; + + } + else { // Odd number of RBs + for (rb=0; rbN_RB_DL>>1; rb++) { + skip_half=0; + + if (rb < 32) + rb_alloc_ind = (rb_alloc[0]>>rb) & 1; + else if (rb < 64) + rb_alloc_ind = (rb_alloc[1]>>(rb-32)) & 1; + else if (rb < 96) + rb_alloc_ind = (rb_alloc[2]>>(rb-64)) & 1; + else if (rb < 100) + rb_alloc_ind = (rb_alloc[3]>>(rb-96)) & 1; + else + rb_alloc_ind = 0; + + if (rb_alloc_ind == 1) + nb_rb++; + + // PBCH + if ((subframe==0) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) { + rb_alloc_ind = 0; + } + + //PBCH subframe 0, symbols nsymb>>1 ... nsymb>>1 + 3 + if ((subframe==0) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) + skip_half=1; + else if ((subframe==0) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) + skip_half=2; + + //SSS + + if (((subframe==0)||(subframe==5)) && + (rb>((frame_parms->N_RB_DL>>1)-3)) && + (rb<((frame_parms->N_RB_DL>>1)+3)) && + (l==sss_symb) ) { + rb_alloc_ind = 0; + } + + //SSS + if (((subframe==0)||(subframe==5)) && + (rb==((frame_parms->N_RB_DL>>1)-3)) && + (l==sss_symb)) + skip_half=1; + else if (((subframe==0)||(subframe==5)) && + (rb==((frame_parms->N_RB_DL>>1)+3)) && + (l==sss_symb)) + skip_half=2; + + //PSS in subframe 0/5 if FDD + if (frame_parms->frame_type == FDD) { //FDD + if (((subframe==0)||(subframe==5)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + + if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb)) + skip_half=1; + else if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb)) + skip_half=2; + } + + if ((frame_parms->frame_type == TDD) && ((subframe==1)||(subframe==6))) { //TDD Subframe 1 and 6 + if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + + if ((rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb)) + skip_half=1; + else if ((rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb)) + skip_half=2; + } + + + if (rb_alloc_ind==1) { +#ifdef DEBUG_DLSCH_DEMOD + printf("rb %d/symbol %d pilots %d, uespec_pilots %d, (skip_half %d)\n",rb,l,pilots,uespec_pilots,skip_half); +#endif + + if (pilots==0 && uespec_pilots==0) { + //printf("Extracting w/o pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); + + if (skip_half==1) { + memcpy(dl_ch0_ext,dl_ch0,6*sizeof(int)); + + for (i=0; i<6; i++) { + rxF_ext[i]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + + dl_ch0_ext+=6; + rxF_ext+=6; + } else if (skip_half==2) { + memcpy(dl_ch0_ext,dl_ch0+6,6*sizeof(int)); + + for (i=0; i<6; i++) { + rxF_ext[i]=rxF[(i+6)]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + + dl_ch0_ext+=6; + rxF_ext+=6; + } else { + memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); + + for (i=0; i<12; i++){ + rxF_ext[i]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",symbol,rb,i,*(short *)&rxF[i],*(1+(short*)&rxF[i])); +#endif + } + dl_ch0_ext+=12; + rxF_ext+=12; + } + } else if (pilots==1 && uespec_pilots==0) { + // printf("Extracting with pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); + j=0; + + if (skip_half==1) { + for (i=0; i<6; i++) { + if (i!=((frame_parms->nushift+poffset)%6)) { + rxF_ext[j]=rxF[i]; + dl_ch0_ext[j++]=dl_ch0[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + } + + dl_ch0_ext+=5; + rxF_ext+=5; + } else if (skip_half==2) { + for (i=0; i<6; i++) { + if (i!=((frame_parms->nushift+poffset)%6)) { + rxF_ext[j]=rxF[(i+6)]; + dl_ch0_ext[j++]=dl_ch0[i+6]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + } + + dl_ch0_ext+=5; + rxF_ext+=5; + } else { + for (i=0; i<12; i++) { + if ((i!=(frame_parms->nushift+poffset)) && + (i!=((frame_parms->nushift+poffset+6)%12))) { + rxF_ext[j]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#endif + dl_ch0_ext[j++]=dl_ch0[i]; + + } + } + + dl_ch0_ext+=10; + rxF_ext+=10; + } + } else if(pilots==0 && uespec_pilots==1){ + //printf("Extracting with uespec pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); + j=0; + + if (skip_half==1) { + if (frame_parms->Ncp==0){ + for (i=0; i<6; i++) { + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ + rxF_ext[j]=rxF[i]; + dl_ch0_ext[j++]=dl_ch0[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + } + dl_ch0_ext+=6-(uespec_nushift+uespec_poffset<6)-(uespec_nushift+uespec_poffset+4<6)-((uespec_nushift+uespec_poffset+8)%12<6); + rxF_ext+=6-(uespec_nushift+uespec_poffset<6)-(uespec_nushift+uespec_poffset+4<6)-((uespec_nushift+uespec_poffset+8)%12<6); + + } else{ + for (i=0; i<6; i++) { + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ + rxF_ext[j]=rxF[i]; + dl_ch0_ext[j++]=dl_ch0[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + } + dl_ch0_ext+=4; + rxF_ext+=4; + } + + } else if (skip_half==2) { + if(frame_parms->Ncp==0){ + for (i=0; i<6; i++) { + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ + rxF_ext[j]=rxF[(i+6)]; + dl_ch0_ext[j++]=dl_ch0[i+6]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + } + dl_ch0_ext+=6-(uespec_nushift+uespec_poffset>6)-(uespec_nushift+uespec_poffset+4>6)-((uespec_nushift+uespec_poffset+8)%12>6); + rxF_ext+=6-(uespec_nushift+uespec_poffset>6)-(uespec_nushift+uespec_poffset+4>6)-((uespec_nushift+uespec_poffset+8)%12>6); + + } else { + for (i=0; i<6; i++) { + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ + rxF_ext[j]=rxF[(i+6)]; + dl_ch0_ext[j++]=dl_ch0[i+6]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + } + dl_ch0_ext+=4; + rxF_ext+=4; + } + + } else { + + for (i=0; i<12; i++){ + if (frame_parms->Ncp==0){ + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ + rxF_ext[j] = rxF[i]; + dl_ch0_ext[j++] = dl_ch0[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d, j %d => (%d,%d)\n",symbol,rb,i,j-1,*(short *)&dl_ch0[j],*(1+(short*)&dl_ch0[i])); +#endif + } + } else{ + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ + rxF_ext[j] = rxF[i]; + dl_ch0_ext[j++]=dl_ch0[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + } + + } + + dl_ch0_ext+=9-frame_parms->Ncp; + rxF_ext+=9-frame_parms->Ncp; + } + + } else { + LOG_E(PHY,"dlsch_extract_rbs_TM7(dl_demodulation.c):pilot or ue spec pilot detection error\n"); + exit(-1); + + } + } + + dl_ch0+=12; + rxF+=12; + } // first half loop + + + // Do middle RB (around DC) + if (rb < 32) + rb_alloc_ind = (rb_alloc[0]>>rb) & 1; + else if (rb < 64) + rb_alloc_ind = (rb_alloc[1]>>(rb-32)) & 1; + else if (rb < 96) + rb_alloc_ind = (rb_alloc[2]>>(rb-64)) & 1; + else if (rb < 100) + rb_alloc_ind = (rb_alloc[3]>>(rb-96)) & 1; + else + rb_alloc_ind = 0; + + if (rb_alloc_ind == 1) + nb_rb++; + + // PBCH + if ((subframe==0) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) { + rb_alloc_ind = 0; + } + + //SSS + if (((subframe==0)||(subframe==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb) ) { + rb_alloc_ind = 0; + } + + if (frame_parms->frame_type == FDD) { + //PSS + if (((subframe==0)||(subframe==5)) && (rb>=((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + } + + if ((frame_parms->frame_type == TDD) && ((subframe==1)||(subframe==6))) { + //PSS + if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + } + + //printf("dlch_ext %d\n",dl_ch0_ext-&dl_ch_estimates_ext[aarx][0]); + //printf("DC rb %d (%p)\n",rb,rxF); + if (rb_alloc_ind==1) { + //printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half); + if (pilots==0 && uespec_pilots==0) { + for (i=0; i<6; i++) { + dl_ch0_ext[i]=dl_ch0[i]; + rxF_ext[i]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + + rxF = &rxdataF[aarx][((symbol*(frame_parms->ofdm_symbol_size)))]; + + for (; i<12; i++) { + dl_ch0_ext[i]=dl_ch0[i]; + rxF_ext[i]=rxF[(1+i-6)]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + + dl_ch0_ext+=12; + rxF_ext+=12; + } else if(pilots==1 && uespec_pilots==0){ // pilots==1 + j=0; + + for (i=0; i<6; i++) { + if (i!=((frame_parms->nushift+poffset)%6)) { + dl_ch0_ext[j]=dl_ch0[i]; + rxF_ext[j++]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + } + + rxF = &rxdataF[aarx][((symbol*(frame_parms->ofdm_symbol_size)))]; + + for (; i<12; i++) { + if (i!=((frame_parms->nushift+6+poffset)%12)) { + dl_ch0_ext[j]=dl_ch0[i]; + rxF_ext[j++]=rxF[(1+i-6)]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + } + + dl_ch0_ext+=10; + rxF_ext+=10; + } else if(pilots==0 && uespec_pilots==1) { + j=0; + + for (i=0; i<6; i++) { + if (frame_parms->Ncp==0){ + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ + dl_ch0_ext[j]=dl_ch0[i]; + rxF_ext[j++] = rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + } else { + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ + dl_ch0_ext[j]=dl_ch0[i]; + rxF_ext[j++] = rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + } + } + + rxF = &rxdataF[aarx][((symbol*(frame_parms->ofdm_symbol_size)))]; + + for (; i<12; i++) { + if (frame_parms->Ncp==0){ + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ + dl_ch0_ext[j]=dl_ch0[i]; + rxF_ext[j++]=rxF[(1+i-6)]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + } else { + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ + dl_ch0_ext[j]=dl_ch0[i]; + rxF_ext[j++] = rxF[(1+i-6)]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + } + } + + dl_ch0_ext+=9-frame_parms->Ncp; + rxF_ext+=9-frame_parms->Ncp; + + }// symbol_mod==0 + + } // rballoc==1 + else { + rxF = &rxdataF[aarx][((symbol*(frame_parms->ofdm_symbol_size)))]; + } + + dl_ch0+=12; + rxF+=7; + rb++; + + for (; rbN_RB_DL; rb++) { + // printf("dlch_ext %d\n",dl_ch0_ext-&dl_ch_estimates_ext[aarx][0]); + // printf("rb %d (%p)\n",rb,rxF); + skip_half=0; + + if (rb < 32) + rb_alloc_ind = (rb_alloc[0]>>rb) & 1; + else if (rb < 64) + rb_alloc_ind = (rb_alloc[1]>>(rb-32)) & 1; + else if (rb < 96) + rb_alloc_ind = (rb_alloc[2]>>(rb-64)) & 1; + else if (rb < 100) + rb_alloc_ind = (rb_alloc[3]>>(rb-96)) & 1; + else + rb_alloc_ind = 0; + + if (rb_alloc_ind==1) + nb_rb++; + + // PBCH + if ((subframe==0) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l>=nsymb>>1) && (l<((nsymb>>1) + 4))) { + rb_alloc_ind = 0; + } + + //PBCH subframe 0, symbols nsymb>>1 ... nsymb>>1 + 3 + if ((subframe==0) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) + skip_half=1; + else if ((subframe==0) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l>=(nsymb>>1)) && (l<((nsymb>>1) + 4))) + skip_half=2; + + //SSS + if (((subframe==0)||(subframe==5)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb) ) { + rb_alloc_ind = 0; + } + + //SSS + if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l==sss_symb)) + skip_half=1; + else if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l==sss_symb)) + skip_half=2; + + //PSS + if (frame_parms->frame_type == FDD) { + if (((subframe==0)||(subframe==5)) && (rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + + if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb)) + skip_half=1; + else if (((subframe==0)||(subframe==5)) && (rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb)) + skip_half=2; + } + + if ((frame_parms->frame_type == TDD) && ((subframe==1)||(subframe==6))) { //TDD Subframe 1 and 6 + if ((rb>((frame_parms->N_RB_DL>>1)-3)) && (rb<((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb) ) { + rb_alloc_ind = 0; + } + + if ((rb==((frame_parms->N_RB_DL>>1)-3)) && (l==pss_symb)) + skip_half=1; + else if ((rb==((frame_parms->N_RB_DL>>1)+3)) && (l==pss_symb)) + skip_half=2; + } + + if (rb_alloc_ind==1) { +#ifdef DEBUG_DLSCH_DEMOD + printf("rb %d/symbol %d (skip_half %d)\n",rb,l,skip_half); +#endif + /* + printf("rb %d\n",rb); + for (i=0;i<12;i++) + printf("(%d %d)",((short *)dl_ch0)[i<<1],((short*)dl_ch0)[1+(i<<1)]); + printf("\n"); + */ + if (pilots==0 && uespec_pilots==0) { + //printf("Extracting w/o pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); + if (skip_half==1) { + memcpy(dl_ch0_ext,dl_ch0,6*sizeof(int)); + + for (i=0; i<6; i++) { + rxF_ext[i]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + + dl_ch0_ext+=6; + rxF_ext+=6; + + } else if (skip_half==2) { + memcpy(dl_ch0_ext,dl_ch0+6,6*sizeof(int)); + + for (i=0; i<6; i++) { + rxF_ext[i]=rxF[i+6]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + + dl_ch0_ext+=6; + rxF_ext+=6; + + } else { + memcpy(dl_ch0_ext,dl_ch0,12*sizeof(int)); + //printf("symbol %d, extract rb %d, => (%d,%d)\n",symbol,rb,*(short *)&dl_ch0[j],*(1+(short*)&dl_ch0[i])); + + for (i=0; i<12; i++) { + rxF_ext[i]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + + dl_ch0_ext+=12; + rxF_ext+=12; + } + } else if (pilots==1 && uespec_pilots==0){ + //printf("Extracting with pilots (symbol %d, rb %d, skip_half %d)\n",l,rb,skip_half); + j=0; + + if (skip_half==1) { + for (i=0; i<6; i++) { + if (i!=((frame_parms->nushift+poffset)%6)) { + rxF_ext[j]=rxF[i]; + dl_ch0_ext[j++]=dl_ch0[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + } + + dl_ch0_ext+=5; + rxF_ext+=5; + } else if (skip_half==2) { + for (i=0; i<6; i++) { + if (i!=((frame_parms->nushift+poffset)%6)) { + rxF_ext[j]=rxF[(i+6)]; + dl_ch0_ext[j++]=dl_ch0[i+6]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + } + + dl_ch0_ext+=5; + rxF_ext+=5; + } else { + for (i=0; i<12; i++) { + if ((i!=(frame_parms->nushift+poffset)) && + (i!=((frame_parms->nushift+poffset+6)%12))) { + rxF_ext[j]=rxF[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[j],*(1+(short*)&rxF_ext[j])); +#endif + dl_ch0_ext[j++]=dl_ch0[i]; + } + } + + dl_ch0_ext+=10; + rxF_ext+=10; + } + } else if(pilots==0 && uespec_pilots==1) { + j=0; + + if (skip_half==1) { + if (frame_parms->Ncp==0){ + for (i=0; i<6; i++) { + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ + rxF_ext[j]=rxF[i]; + dl_ch0_ext[j++]=dl_ch0[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + } + dl_ch0_ext+=6-(uespec_nushift+uespec_poffset<6)-(uespec_nushift+uespec_poffset+4<6)-((uespec_nushift+uespec_poffset+8)%12<6); + rxF_ext+=6-(uespec_nushift+uespec_poffset<6)-(uespec_nushift+uespec_poffset+4<6)-((uespec_nushift+uespec_poffset+8)%12<6); + + } else{ + for (i=0; i<6; i++) { + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ + rxF_ext[j]=rxF[i]; + dl_ch0_ext[j++]=dl_ch0[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + } + dl_ch0_ext+=4; + rxF_ext+=4; + } + + } else if (skip_half==2) { + if(frame_parms->Ncp==0){ + for (i=0; i<6; i++) { + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ + rxF_ext[j]=rxF[i+6]; + dl_ch0_ext[j++]=dl_ch0[i+6]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + } + dl_ch0_ext+=6-(uespec_nushift+uespec_poffset>6)-(uespec_nushift+uespec_poffset+4>6)-((uespec_nushift+uespec_poffset+8)%12>6); + rxF_ext+=6-(uespec_nushift+uespec_poffset>6)-(uespec_nushift+uespec_poffset+4>6)-((uespec_nushift+uespec_poffset+8)%12>6); + + } else { + for (i=0; i<6; i++) { + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ + rxF_ext[j]=rxF[(i+6)]; + dl_ch0_ext[j++]=dl_ch0[i+6]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + } + dl_ch0_ext+=4; + rxF_ext+=4; + } + + } else { + for (i=0; i<12; i++){ + if (frame_parms->Ncp==0){ + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+4 && i!=(uespec_nushift+uespec_poffset+8)%12){ + rxF_ext[j] = rxF[i]; + dl_ch0_ext[j++]=dl_ch0[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + } else{ + if (i!=uespec_nushift+uespec_poffset && i!=uespec_nushift+uespec_poffset+3 && i!=uespec_nushift+uespec_poffset+6 && i!=(uespec_nushift+uespec_poffset+9)%12){ + rxF_ext[j] = rxF[i]; + dl_ch0_ext[j++]=dl_ch0[i]; +#ifdef DEBUG_DLSCH_DEMOD + printf("extract rb %d, re %d => (%d,%d)\n",rb,i,*(short *)&rxF_ext[i],*(1+(short*)&rxF_ext[i])); +#endif + } + } + } + + dl_ch0_ext+=9-frame_parms->Ncp; + rxF_ext+=9-frame_parms->Ncp; + + } + + }// pilots=0 + } + + dl_ch0+=12; + rxF+=12; + } + } + } + + _mm_empty(); + _m_empty(); + + return(nb_rb/frame_parms->nb_antennas_rx); +} + +//============================================================================================== + +void dump_dlsch2(PHY_VARS_UE *ue,uint8_t eNB_id,uint8_t subframe,unsigned int *coded_bits_per_codeword,int round, unsigned char harq_pid) +{ + unsigned int nsymb = (ue->frame_parms.Ncp == 0) ? 14 : 12; + char fname[32],vname[32]; + int N_RB_DL=ue->frame_parms.N_RB_DL; + + sprintf(fname,"dlsch%d_rxF_r%d_ext0.m",eNB_id,round); + sprintf(vname,"dl%d_rxF_r%d_ext0",eNB_id,round); + write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->rxdataF_ext[0],12*N_RB_DL*nsymb,1,1); + + if (ue->frame_parms.nb_antennas_rx >1) { + sprintf(fname,"dlsch%d_rxF_r%d_ext1.m",eNB_id,round); + sprintf(vname,"dl%d_rxF_r%d_ext1",eNB_id,round); + write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->rxdataF_ext[1],12*N_RB_DL*nsymb,1,1); + } + + sprintf(fname,"dlsch%d_ch_r%d_ext00.m",eNB_id,round); + sprintf(vname,"dl%d_ch_r%d_ext00",eNB_id,round); + write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_estimates_ext[0],12*N_RB_DL*nsymb,1,1); + + if (ue->transmission_mode[eNB_id]==7){ + sprintf(fname,"dlsch%d_bf_ch_r%d.m",eNB_id,round); + sprintf(vname,"dl%d_bf_ch_r%d",eNB_id,round); + write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_bf_ch_estimates[0],512*nsymb,1,1); + //write_output(fname,vname,phy_vars_ue->lte_ue_pdsch_vars[eNB_id]->dl_bf_ch_estimates[0],512,1,1); + + sprintf(fname,"dlsch%d_bf_ch_r%d_ext00.m",eNB_id,round); + sprintf(vname,"dl%d_bf_ch_r%d_ext00",eNB_id,round); + write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_bf_ch_estimates_ext[0],12*N_RB_DL*nsymb,1,1); + } + + if (ue->frame_parms.nb_antennas_rx == 2) { + sprintf(fname,"dlsch%d_ch_r%d_ext01.m",eNB_id,round); + sprintf(vname,"dl%d_ch_r%d_ext01",eNB_id,round); + write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*nsymb,1,1); + } + + if (ue->frame_parms.nb_antenna_ports_eNB == 2) { + sprintf(fname,"dlsch%d_ch_r%d_ext10.m",eNB_id,round); + sprintf(vname,"dl%d_ch_r%d_ext10",eNB_id,round); + write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*nsymb,1,1); + + if (ue->frame_parms.nb_antennas_rx == 2) { + sprintf(fname,"dlsch%d_ch_r%d_ext11.m",eNB_id,round); + sprintf(vname,"dl%d_ch_r%d_ext11",eNB_id,round); + write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_estimates_ext[3],12*N_RB_DL*nsymb,1,1); + } + } + + sprintf(fname,"dlsch%d_rxF_r%d_uespec0.m",eNB_id,round); + sprintf(vname,"dl%d_rxF_r%d_uespec0",eNB_id,round); + write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->rxdataF_uespec_pilots[0],12*N_RB_DL,1,1); + + /* + write_output("dlsch%d_ch_ext01.m","dl01_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[1],12*N_RB_DL*nsymb,1,1); + write_output("dlsch%d_ch_ext10.m","dl10_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[2],12*N_RB_DL*nsymb,1,1); + write_output("dlsch%d_ch_ext11.m","dl11_ch0_ext",pdsch_vars[eNB_id]->dl_ch_estimates_ext[3],12*N_RB_DL*nsymb,1,1); + */ + sprintf(fname,"dlsch%d_r%d_rho.m",eNB_id,round); + sprintf(vname,"dl_rho_r%d_%d",eNB_id,round); + + write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_rho_ext[harq_pid][round][0],12*N_RB_DL*nsymb,1,1); + + sprintf(fname,"dlsch%d_r%d_rho2.m",eNB_id,round); + sprintf(vname,"dl_rho2_r%d_%d",eNB_id,round); + + write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_rho2_ext[0],12*N_RB_DL*nsymb,1,1); + + sprintf(fname,"dlsch%d_rxF_r%d_comp0.m",eNB_id,round); + sprintf(vname,"dl%d_rxF_r%d_comp0",eNB_id,round); + write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp0[0],12*N_RB_DL*nsymb,1,1); + if (ue->frame_parms.nb_antenna_ports_eNB == 2) { + sprintf(fname,"dlsch%d_rxF_r%d_comp1.m",eNB_id,round); + sprintf(vname,"dl%d_rxF_r%d_comp1",eNB_id,round); + write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->rxdataF_comp1[harq_pid][round][0],12*N_RB_DL*nsymb,1,1); + } + + sprintf(fname,"dlsch%d_rxF_r%d_llr.m",eNB_id,round); + sprintf(vname,"dl%d_r%d_llr",eNB_id,round); + write_output(fname,vname, ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->llr[0],coded_bits_per_codeword[0],1,0); + sprintf(fname,"dlsch%d_r%d_mag1.m",eNB_id,round); + sprintf(vname,"dl%d_r%d_mag1",eNB_id,round); + write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_mag0[0],12*N_RB_DL*nsymb,1,1); + sprintf(fname,"dlsch%d_r%d_mag2.m",eNB_id,round); + sprintf(vname,"dl%d_r%d_mag2",eNB_id,round); + write_output(fname,vname,ue->pdsch_vars[ue->current_thread_id[subframe]][eNB_id]->dl_ch_magb0[0],12*N_RB_DL*nsymb,1,1); + + // printf("log2_maxh = %d\n",ue->pdsch_vars[eNB_id]->log2_maxh); +} + +#ifdef DEBUG_DLSCH_DEMOD +/* +void print_bytes(char *s,__m128i *x) +{ + + char *tempb = (char *)x; + + printf("%s : %d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d\n",s, + tempb[0],tempb[1],tempb[2],tempb[3],tempb[4],tempb[5],tempb[6],tempb[7], + tempb[8],tempb[9],tempb[10],tempb[11],tempb[12],tempb[13],tempb[14],tempb[15] + ); + +} + +void print_shorts(char *s,__m128i *x) +{ + + short *tempb = (short *)x; + printf("%s : %d,%d,%d,%d,%d,%d,%d,%d\n",s, + tempb[0],tempb[1],tempb[2],tempb[3],tempb[4],tempb[5],tempb[6],tempb[7]); + +} + +void print_shorts2(char *s,__m64 *x) +{ + + short *tempb = (short *)x; + printf("%s : %d,%d,%d,%d\n",s, + tempb[0],tempb[1],tempb[2],tempb[3]); + +} + +void print_ints(char *s,__m128i *x) +{ + + int *tempb = (int *)x; + printf("%s : %d,%d,%d,%d\n",s, + tempb[0],tempb[1],tempb[2],tempb[3]); + +}*/ +#endif diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c new file mode 100644 index 0000000000..7682045ae1 --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation.c @@ -0,0 +1,8899 @@ +/* + * 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 + */ + +/*! \file PHY/LTE_TRANSPORT/dlsch_llr_computation.c + * \brief Top-level routines for LLR computation of the PDSCH physical channel from 36-211, V8.6 2009-03 + * \author R. Knopp, F. Kaltenberger,A. Bhamri, S. Aubert, S. Wagner, X Jiang + * \date 2011 + * \version 0.1 + * \company Eurecom + * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr,ankit.bhamri@eurecom.fr,sebastien.aubert@eurecom.fr, sebastian.wagner@eurecom.fr + * \note + * \warning + */ + +#include "PHY/defs.h" +#include "PHY/TOOLS/defs.h" +#include "PHY/extern.h" +#include "defs.h" +#include "extern.h" +#include "PHY/sse_intrin.h" + +//#define DEBUG_LLR_SIC + + +int16_t zeros[8] __attribute__ ((aligned(16))) = {0,0,0,0,0,0,0,0}; +int16_t ones[8] __attribute__ ((aligned(16))) = {0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff}; +#if defined(__x86_64__) || defined(__i386__) +__m128i rho_rpi __attribute__ ((aligned(16))); +__m128i rho_rmi __attribute__ ((aligned(16))); +__m128i rho_rpi_1_1 __attribute__ ((aligned(16))); +__m128i rho_rpi_1_3 __attribute__ ((aligned(16))); +__m128i rho_rpi_1_5 __attribute__ ((aligned(16))); +__m128i rho_rpi_1_7 __attribute__ ((aligned(16))); +__m128i rho_rpi_3_1 __attribute__ ((aligned(16))); +__m128i rho_rpi_3_3 __attribute__ ((aligned(16))); +__m128i rho_rpi_3_5 __attribute__ ((aligned(16))); +__m128i rho_rpi_3_7 __attribute__ ((aligned(16))); +__m128i rho_rpi_5_1 __attribute__ ((aligned(16))); +__m128i rho_rpi_5_3 __attribute__ ((aligned(16))); +__m128i rho_rpi_5_5 __attribute__ ((aligned(16))); +__m128i rho_rpi_5_7 __attribute__ ((aligned(16))); +__m128i rho_rpi_7_1 __attribute__ ((aligned(16))); +__m128i rho_rpi_7_3 __attribute__ ((aligned(16))); +__m128i rho_rpi_7_5 __attribute__ ((aligned(16))); +__m128i rho_rpi_7_7 __attribute__ ((aligned(16))); +__m128i rho_rmi_1_1 __attribute__ ((aligned(16))); +__m128i rho_rmi_1_3 __attribute__ ((aligned(16))); +__m128i rho_rmi_1_5 __attribute__ ((aligned(16))); +__m128i rho_rmi_1_7 __attribute__ ((aligned(16))); +__m128i rho_rmi_3_1 __attribute__ ((aligned(16))); +__m128i rho_rmi_3_3 __attribute__ ((aligned(16))); +__m128i rho_rmi_3_5 __attribute__ ((aligned(16))); +__m128i rho_rmi_3_7 __attribute__ ((aligned(16))); +__m128i rho_rmi_5_1 __attribute__ ((aligned(16))); +__m128i rho_rmi_5_3 __attribute__ ((aligned(16))); +__m128i rho_rmi_5_5 __attribute__ ((aligned(16))); +__m128i rho_rmi_5_7 __attribute__ ((aligned(16))); +__m128i rho_rmi_7_1 __attribute__ ((aligned(16))); +__m128i rho_rmi_7_3 __attribute__ ((aligned(16))); +__m128i rho_rmi_7_5 __attribute__ ((aligned(16))); +__m128i rho_rmi_7_7 __attribute__ ((aligned(16))); + +__m128i psi_r_m7_m7 __attribute__ ((aligned(16))); +__m128i psi_r_m7_m5 __attribute__ ((aligned(16))); +__m128i psi_r_m7_m3 __attribute__ ((aligned(16))); +__m128i psi_r_m7_m1 __attribute__ ((aligned(16))); +__m128i psi_r_m7_p1 __attribute__ ((aligned(16))); +__m128i psi_r_m7_p3 __attribute__ ((aligned(16))); +__m128i psi_r_m7_p5 __attribute__ ((aligned(16))); +__m128i psi_r_m7_p7 __attribute__ ((aligned(16))); +__m128i psi_r_m5_m7 __attribute__ ((aligned(16))); +__m128i psi_r_m5_m5 __attribute__ ((aligned(16))); +__m128i psi_r_m5_m3 __attribute__ ((aligned(16))); +__m128i psi_r_m5_m1 __attribute__ ((aligned(16))); +__m128i psi_r_m5_p1 __attribute__ ((aligned(16))); +__m128i psi_r_m5_p3 __attribute__ ((aligned(16))); +__m128i psi_r_m5_p5 __attribute__ ((aligned(16))); +__m128i psi_r_m5_p7 __attribute__ ((aligned(16))); +__m128i psi_r_m3_m7 __attribute__ ((aligned(16))); +__m128i psi_r_m3_m5 __attribute__ ((aligned(16))); +__m128i psi_r_m3_m3 __attribute__ ((aligned(16))); +__m128i psi_r_m3_m1 __attribute__ ((aligned(16))); +__m128i psi_r_m3_p1 __attribute__ ((aligned(16))); +__m128i psi_r_m3_p3 __attribute__ ((aligned(16))); +__m128i psi_r_m3_p5 __attribute__ ((aligned(16))); +__m128i psi_r_m3_p7 __attribute__ ((aligned(16))); +__m128i psi_r_m1_m7 __attribute__ ((aligned(16))); +__m128i psi_r_m1_m5 __attribute__ ((aligned(16))); +__m128i psi_r_m1_m3 __attribute__ ((aligned(16))); +__m128i psi_r_m1_m1 __attribute__ ((aligned(16))); +__m128i psi_r_m1_p1 __attribute__ ((aligned(16))); +__m128i psi_r_m1_p3 __attribute__ ((aligned(16))); +__m128i psi_r_m1_p5 __attribute__ ((aligned(16))); +__m128i psi_r_m1_p7 __attribute__ ((aligned(16))); +__m128i psi_r_p1_m7 __attribute__ ((aligned(16))); +__m128i psi_r_p1_m5 __attribute__ ((aligned(16))); +__m128i psi_r_p1_m3 __attribute__ ((aligned(16))); +__m128i psi_r_p1_m1 __attribute__ ((aligned(16))); +__m128i psi_r_p1_p1 __attribute__ ((aligned(16))); +__m128i psi_r_p1_p3 __attribute__ ((aligned(16))); +__m128i psi_r_p1_p5 __attribute__ ((aligned(16))); +__m128i psi_r_p1_p7 __attribute__ ((aligned(16))); +__m128i psi_r_p3_m7 __attribute__ ((aligned(16))); +__m128i psi_r_p3_m5 __attribute__ ((aligned(16))); +__m128i psi_r_p3_m3 __attribute__ ((aligned(16))); +__m128i psi_r_p3_m1 __attribute__ ((aligned(16))); +__m128i psi_r_p3_p1 __attribute__ ((aligned(16))); +__m128i psi_r_p3_p3 __attribute__ ((aligned(16))); +__m128i psi_r_p3_p5 __attribute__ ((aligned(16))); +__m128i psi_r_p3_p7 __attribute__ ((aligned(16))); +__m128i psi_r_p5_m7 __attribute__ ((aligned(16))); +__m128i psi_r_p5_m5 __attribute__ ((aligned(16))); +__m128i psi_r_p5_m3 __attribute__ ((aligned(16))); +__m128i psi_r_p5_m1 __attribute__ ((aligned(16))); +__m128i psi_r_p5_p1 __attribute__ ((aligned(16))); +__m128i psi_r_p5_p3 __attribute__ ((aligned(16))); +__m128i psi_r_p5_p5 __attribute__ ((aligned(16))); +__m128i psi_r_p5_p7 __attribute__ ((aligned(16))); +__m128i psi_r_p7_m7 __attribute__ ((aligned(16))); +__m128i psi_r_p7_m5 __attribute__ ((aligned(16))); +__m128i psi_r_p7_m3 __attribute__ ((aligned(16))); +__m128i psi_r_p7_m1 __attribute__ ((aligned(16))); +__m128i psi_r_p7_p1 __attribute__ ((aligned(16))); +__m128i psi_r_p7_p3 __attribute__ ((aligned(16))); +__m128i psi_r_p7_p5 __attribute__ ((aligned(16))); +__m128i psi_r_p7_p7 __attribute__ ((aligned(16))); + +__m128i psi_i_m7_m7 __attribute__ ((aligned(16))); +__m128i psi_i_m7_m5 __attribute__ ((aligned(16))); +__m128i psi_i_m7_m3 __attribute__ ((aligned(16))); +__m128i psi_i_m7_m1 __attribute__ ((aligned(16))); +__m128i psi_i_m7_p1 __attribute__ ((aligned(16))); +__m128i psi_i_m7_p3 __attribute__ ((aligned(16))); +__m128i psi_i_m7_p5 __attribute__ ((aligned(16))); +__m128i psi_i_m7_p7 __attribute__ ((aligned(16))); +__m128i psi_i_m5_m7 __attribute__ ((aligned(16))); +__m128i psi_i_m5_m5 __attribute__ ((aligned(16))); +__m128i psi_i_m5_m3 __attribute__ ((aligned(16))); +__m128i psi_i_m5_m1 __attribute__ ((aligned(16))); +__m128i psi_i_m5_p1 __attribute__ ((aligned(16))); +__m128i psi_i_m5_p3 __attribute__ ((aligned(16))); +__m128i psi_i_m5_p5 __attribute__ ((aligned(16))); +__m128i psi_i_m5_p7 __attribute__ ((aligned(16))); +__m128i psi_i_m3_m7 __attribute__ ((aligned(16))); +__m128i psi_i_m3_m5 __attribute__ ((aligned(16))); +__m128i psi_i_m3_m3 __attribute__ ((aligned(16))); +__m128i psi_i_m3_m1 __attribute__ ((aligned(16))); +__m128i psi_i_m3_p1 __attribute__ ((aligned(16))); +__m128i psi_i_m3_p3 __attribute__ ((aligned(16))); +__m128i psi_i_m3_p5 __attribute__ ((aligned(16))); +__m128i psi_i_m3_p7 __attribute__ ((aligned(16))); +__m128i psi_i_m1_m7 __attribute__ ((aligned(16))); +__m128i psi_i_m1_m5 __attribute__ ((aligned(16))); +__m128i psi_i_m1_m3 __attribute__ ((aligned(16))); +__m128i psi_i_m1_m1 __attribute__ ((aligned(16))); +__m128i psi_i_m1_p1 __attribute__ ((aligned(16))); +__m128i psi_i_m1_p3 __attribute__ ((aligned(16))); +__m128i psi_i_m1_p5 __attribute__ ((aligned(16))); +__m128i psi_i_m1_p7 __attribute__ ((aligned(16))); +__m128i psi_i_p1_m7 __attribute__ ((aligned(16))); +__m128i psi_i_p1_m5 __attribute__ ((aligned(16))); +__m128i psi_i_p1_m3 __attribute__ ((aligned(16))); +__m128i psi_i_p1_m1 __attribute__ ((aligned(16))); +__m128i psi_i_p1_p1 __attribute__ ((aligned(16))); +__m128i psi_i_p1_p3 __attribute__ ((aligned(16))); +__m128i psi_i_p1_p5 __attribute__ ((aligned(16))); +__m128i psi_i_p1_p7 __attribute__ ((aligned(16))); +__m128i psi_i_p3_m7 __attribute__ ((aligned(16))); +__m128i psi_i_p3_m5 __attribute__ ((aligned(16))); +__m128i psi_i_p3_m3 __attribute__ ((aligned(16))); +__m128i psi_i_p3_m1 __attribute__ ((aligned(16))); +__m128i psi_i_p3_p1 __attribute__ ((aligned(16))); +__m128i psi_i_p3_p3 __attribute__ ((aligned(16))); +__m128i psi_i_p3_p5 __attribute__ ((aligned(16))); +__m128i psi_i_p3_p7 __attribute__ ((aligned(16))); +__m128i psi_i_p5_m7 __attribute__ ((aligned(16))); +__m128i psi_i_p5_m5 __attribute__ ((aligned(16))); +__m128i psi_i_p5_m3 __attribute__ ((aligned(16))); +__m128i psi_i_p5_m1 __attribute__ ((aligned(16))); +__m128i psi_i_p5_p1 __attribute__ ((aligned(16))); +__m128i psi_i_p5_p3 __attribute__ ((aligned(16))); +__m128i psi_i_p5_p5 __attribute__ ((aligned(16))); +__m128i psi_i_p5_p7 __attribute__ ((aligned(16))); +__m128i psi_i_p7_m7 __attribute__ ((aligned(16))); +__m128i psi_i_p7_m5 __attribute__ ((aligned(16))); +__m128i psi_i_p7_m3 __attribute__ ((aligned(16))); +__m128i psi_i_p7_m1 __attribute__ ((aligned(16))); +__m128i psi_i_p7_p1 __attribute__ ((aligned(16))); +__m128i psi_i_p7_p3 __attribute__ ((aligned(16))); +__m128i psi_i_p7_p5 __attribute__ ((aligned(16))); +__m128i psi_i_p7_p7 __attribute__ ((aligned(16))); + +__m128i a_r_m7_m7 __attribute__ ((aligned(16))); +__m128i a_r_m7_m5 __attribute__ ((aligned(16))); +__m128i a_r_m7_m3 __attribute__ ((aligned(16))); +__m128i a_r_m7_m1 __attribute__ ((aligned(16))); +__m128i a_r_m7_p1 __attribute__ ((aligned(16))); +__m128i a_r_m7_p3 __attribute__ ((aligned(16))); +__m128i a_r_m7_p5 __attribute__ ((aligned(16))); +__m128i a_r_m7_p7 __attribute__ ((aligned(16))); +__m128i a_r_m5_m7 __attribute__ ((aligned(16))); +__m128i a_r_m5_m5 __attribute__ ((aligned(16))); +__m128i a_r_m5_m3 __attribute__ ((aligned(16))); +__m128i a_r_m5_m1 __attribute__ ((aligned(16))); +__m128i a_r_m5_p1 __attribute__ ((aligned(16))); +__m128i a_r_m5_p3 __attribute__ ((aligned(16))); +__m128i a_r_m5_p5 __attribute__ ((aligned(16))); +__m128i a_r_m5_p7 __attribute__ ((aligned(16))); +__m128i a_r_m3_m7 __attribute__ ((aligned(16))); +__m128i a_r_m3_m5 __attribute__ ((aligned(16))); +__m128i a_r_m3_m3 __attribute__ ((aligned(16))); +__m128i a_r_m3_m1 __attribute__ ((aligned(16))); +__m128i a_r_m3_p1 __attribute__ ((aligned(16))); +__m128i a_r_m3_p3 __attribute__ ((aligned(16))); +__m128i a_r_m3_p5 __attribute__ ((aligned(16))); +__m128i a_r_m3_p7 __attribute__ ((aligned(16))); +__m128i a_r_m1_m7 __attribute__ ((aligned(16))); +__m128i a_r_m1_m5 __attribute__ ((aligned(16))); +__m128i a_r_m1_m3 __attribute__ ((aligned(16))); +__m128i a_r_m1_m1 __attribute__ ((aligned(16))); +__m128i a_r_m1_p1 __attribute__ ((aligned(16))); +__m128i a_r_m1_p3 __attribute__ ((aligned(16))); +__m128i a_r_m1_p5 __attribute__ ((aligned(16))); +__m128i a_r_m1_p7 __attribute__ ((aligned(16))); +__m128i a_r_p1_m7 __attribute__ ((aligned(16))); +__m128i a_r_p1_m5 __attribute__ ((aligned(16))); +__m128i a_r_p1_m3 __attribute__ ((aligned(16))); +__m128i a_r_p1_m1 __attribute__ ((aligned(16))); +__m128i a_r_p1_p1 __attribute__ ((aligned(16))); +__m128i a_r_p1_p3 __attribute__ ((aligned(16))); +__m128i a_r_p1_p5 __attribute__ ((aligned(16))); +__m128i a_r_p1_p7 __attribute__ ((aligned(16))); +__m128i a_r_p3_m7 __attribute__ ((aligned(16))); +__m128i a_r_p3_m5 __attribute__ ((aligned(16))); +__m128i a_r_p3_m3 __attribute__ ((aligned(16))); +__m128i a_r_p3_m1 __attribute__ ((aligned(16))); +__m128i a_r_p3_p1 __attribute__ ((aligned(16))); +__m128i a_r_p3_p3 __attribute__ ((aligned(16))); +__m128i a_r_p3_p5 __attribute__ ((aligned(16))); +__m128i a_r_p3_p7 __attribute__ ((aligned(16))); +__m128i a_r_p5_m7 __attribute__ ((aligned(16))); +__m128i a_r_p5_m5 __attribute__ ((aligned(16))); +__m128i a_r_p5_m3 __attribute__ ((aligned(16))); +__m128i a_r_p5_m1 __attribute__ ((aligned(16))); +__m128i a_r_p5_p1 __attribute__ ((aligned(16))); +__m128i a_r_p5_p3 __attribute__ ((aligned(16))); +__m128i a_r_p5_p5 __attribute__ ((aligned(16))); +__m128i a_r_p5_p7 __attribute__ ((aligned(16))); +__m128i a_r_p7_m7 __attribute__ ((aligned(16))); +__m128i a_r_p7_m5 __attribute__ ((aligned(16))); +__m128i a_r_p7_m3 __attribute__ ((aligned(16))); +__m128i a_r_p7_m1 __attribute__ ((aligned(16))); +__m128i a_r_p7_p1 __attribute__ ((aligned(16))); +__m128i a_r_p7_p3 __attribute__ ((aligned(16))); +__m128i a_r_p7_p5 __attribute__ ((aligned(16))); +__m128i a_r_p7_p7 __attribute__ ((aligned(16))); + +__m128i a_i_m7_m7 __attribute__ ((aligned(16))); +__m128i a_i_m7_m5 __attribute__ ((aligned(16))); +__m128i a_i_m7_m3 __attribute__ ((aligned(16))); +__m128i a_i_m7_m1 __attribute__ ((aligned(16))); +__m128i a_i_m7_p1 __attribute__ ((aligned(16))); +__m128i a_i_m7_p3 __attribute__ ((aligned(16))); +__m128i a_i_m7_p5 __attribute__ ((aligned(16))); +__m128i a_i_m7_p7 __attribute__ ((aligned(16))); +__m128i a_i_m5_m7 __attribute__ ((aligned(16))); +__m128i a_i_m5_m5 __attribute__ ((aligned(16))); +__m128i a_i_m5_m3 __attribute__ ((aligned(16))); +__m128i a_i_m5_m1 __attribute__ ((aligned(16))); +__m128i a_i_m5_p1 __attribute__ ((aligned(16))); +__m128i a_i_m5_p3 __attribute__ ((aligned(16))); +__m128i a_i_m5_p5 __attribute__ ((aligned(16))); +__m128i a_i_m5_p7 __attribute__ ((aligned(16))); +__m128i a_i_m3_m7 __attribute__ ((aligned(16))); +__m128i a_i_m3_m5 __attribute__ ((aligned(16))); +__m128i a_i_m3_m3 __attribute__ ((aligned(16))); +__m128i a_i_m3_m1 __attribute__ ((aligned(16))); +__m128i a_i_m3_p1 __attribute__ ((aligned(16))); +__m128i a_i_m3_p3 __attribute__ ((aligned(16))); +__m128i a_i_m3_p5 __attribute__ ((aligned(16))); +__m128i a_i_m3_p7 __attribute__ ((aligned(16))); +__m128i a_i_m1_m7 __attribute__ ((aligned(16))); +__m128i a_i_m1_m5 __attribute__ ((aligned(16))); +__m128i a_i_m1_m3 __attribute__ ((aligned(16))); +__m128i a_i_m1_m1 __attribute__ ((aligned(16))); +__m128i a_i_m1_p1 __attribute__ ((aligned(16))); +__m128i a_i_m1_p3 __attribute__ ((aligned(16))); +__m128i a_i_m1_p5 __attribute__ ((aligned(16))); +__m128i a_i_m1_p7 __attribute__ ((aligned(16))); +__m128i a_i_p1_m7 __attribute__ ((aligned(16))); +__m128i a_i_p1_m5 __attribute__ ((aligned(16))); +__m128i a_i_p1_m3 __attribute__ ((aligned(16))); +__m128i a_i_p1_m1 __attribute__ ((aligned(16))); +__m128i a_i_p1_p1 __attribute__ ((aligned(16))); +__m128i a_i_p1_p3 __attribute__ ((aligned(16))); +__m128i a_i_p1_p5 __attribute__ ((aligned(16))); +__m128i a_i_p1_p7 __attribute__ ((aligned(16))); +__m128i a_i_p3_m7 __attribute__ ((aligned(16))); +__m128i a_i_p3_m5 __attribute__ ((aligned(16))); +__m128i a_i_p3_m3 __attribute__ ((aligned(16))); +__m128i a_i_p3_m1 __attribute__ ((aligned(16))); +__m128i a_i_p3_p1 __attribute__ ((aligned(16))); +__m128i a_i_p3_p3 __attribute__ ((aligned(16))); +__m128i a_i_p3_p5 __attribute__ ((aligned(16))); +__m128i a_i_p3_p7 __attribute__ ((aligned(16))); +__m128i a_i_p5_m7 __attribute__ ((aligned(16))); +__m128i a_i_p5_m5 __attribute__ ((aligned(16))); +__m128i a_i_p5_m3 __attribute__ ((aligned(16))); +__m128i a_i_p5_m1 __attribute__ ((aligned(16))); +__m128i a_i_p5_p1 __attribute__ ((aligned(16))); +__m128i a_i_p5_p3 __attribute__ ((aligned(16))); +__m128i a_i_p5_p5 __attribute__ ((aligned(16))); +__m128i a_i_p5_p7 __attribute__ ((aligned(16))); +__m128i a_i_p7_m7 __attribute__ ((aligned(16))); +__m128i a_i_p7_m5 __attribute__ ((aligned(16))); +__m128i a_i_p7_m3 __attribute__ ((aligned(16))); +__m128i a_i_p7_m1 __attribute__ ((aligned(16))); +__m128i a_i_p7_p1 __attribute__ ((aligned(16))); +__m128i a_i_p7_p3 __attribute__ ((aligned(16))); +__m128i a_i_p7_p5 __attribute__ ((aligned(16))); +__m128i a_i_p7_p7 __attribute__ ((aligned(16))); + +__m128i psi_a_m7_m7 __attribute__ ((aligned(16))); +__m128i psi_a_m7_m5 __attribute__ ((aligned(16))); +__m128i psi_a_m7_m3 __attribute__ ((aligned(16))); +__m128i psi_a_m7_m1 __attribute__ ((aligned(16))); +__m128i psi_a_m7_p1 __attribute__ ((aligned(16))); +__m128i psi_a_m7_p3 __attribute__ ((aligned(16))); +__m128i psi_a_m7_p5 __attribute__ ((aligned(16))); +__m128i psi_a_m7_p7 __attribute__ ((aligned(16))); +__m128i psi_a_m5_m7 __attribute__ ((aligned(16))); +__m128i psi_a_m5_m5 __attribute__ ((aligned(16))); +__m128i psi_a_m5_m3 __attribute__ ((aligned(16))); +__m128i psi_a_m5_m1 __attribute__ ((aligned(16))); +__m128i psi_a_m5_p1 __attribute__ ((aligned(16))); +__m128i psi_a_m5_p3 __attribute__ ((aligned(16))); +__m128i psi_a_m5_p5 __attribute__ ((aligned(16))); +__m128i psi_a_m5_p7 __attribute__ ((aligned(16))); +__m128i psi_a_m3_m7 __attribute__ ((aligned(16))); +__m128i psi_a_m3_m5 __attribute__ ((aligned(16))); +__m128i psi_a_m3_m3 __attribute__ ((aligned(16))); +__m128i psi_a_m3_m1 __attribute__ ((aligned(16))); +__m128i psi_a_m3_p1 __attribute__ ((aligned(16))); +__m128i psi_a_m3_p3 __attribute__ ((aligned(16))); +__m128i psi_a_m3_p5 __attribute__ ((aligned(16))); +__m128i psi_a_m3_p7 __attribute__ ((aligned(16))); +__m128i psi_a_m1_m7 __attribute__ ((aligned(16))); +__m128i psi_a_m1_m5 __attribute__ ((aligned(16))); +__m128i psi_a_m1_m3 __attribute__ ((aligned(16))); +__m128i psi_a_m1_m1 __attribute__ ((aligned(16))); +__m128i psi_a_m1_p1 __attribute__ ((aligned(16))); +__m128i psi_a_m1_p3 __attribute__ ((aligned(16))); +__m128i psi_a_m1_p5 __attribute__ ((aligned(16))); +__m128i psi_a_m1_p7 __attribute__ ((aligned(16))); +__m128i psi_a_p1_m7 __attribute__ ((aligned(16))); +__m128i psi_a_p1_m5 __attribute__ ((aligned(16))); +__m128i psi_a_p1_m3 __attribute__ ((aligned(16))); +__m128i psi_a_p1_m1 __attribute__ ((aligned(16))); +__m128i psi_a_p1_p1 __attribute__ ((aligned(16))); +__m128i psi_a_p1_p3 __attribute__ ((aligned(16))); +__m128i psi_a_p1_p5 __attribute__ ((aligned(16))); +__m128i psi_a_p1_p7 __attribute__ ((aligned(16))); +__m128i psi_a_p3_m7 __attribute__ ((aligned(16))); +__m128i psi_a_p3_m5 __attribute__ ((aligned(16))); +__m128i psi_a_p3_m3 __attribute__ ((aligned(16))); +__m128i psi_a_p3_m1 __attribute__ ((aligned(16))); +__m128i psi_a_p3_p1 __attribute__ ((aligned(16))); +__m128i psi_a_p3_p3 __attribute__ ((aligned(16))); +__m128i psi_a_p3_p5 __attribute__ ((aligned(16))); +__m128i psi_a_p3_p7 __attribute__ ((aligned(16))); +__m128i psi_a_p5_m7 __attribute__ ((aligned(16))); +__m128i psi_a_p5_m5 __attribute__ ((aligned(16))); +__m128i psi_a_p5_m3 __attribute__ ((aligned(16))); +__m128i psi_a_p5_m1 __attribute__ ((aligned(16))); +__m128i psi_a_p5_p1 __attribute__ ((aligned(16))); +__m128i psi_a_p5_p3 __attribute__ ((aligned(16))); +__m128i psi_a_p5_p5 __attribute__ ((aligned(16))); +__m128i psi_a_p5_p7 __attribute__ ((aligned(16))); +__m128i psi_a_p7_m7 __attribute__ ((aligned(16))); +__m128i psi_a_p7_m5 __attribute__ ((aligned(16))); +__m128i psi_a_p7_m3 __attribute__ ((aligned(16))); +__m128i psi_a_p7_m1 __attribute__ ((aligned(16))); +__m128i psi_a_p7_p1 __attribute__ ((aligned(16))); +__m128i psi_a_p7_p3 __attribute__ ((aligned(16))); +__m128i psi_a_p7_p5 __attribute__ ((aligned(16))); +__m128i psi_a_p7_p7 __attribute__ ((aligned(16))); + +__m128i a_sq_m7_m7 __attribute__ ((aligned(16))); +__m128i a_sq_m7_m5 __attribute__ ((aligned(16))); +__m128i a_sq_m7_m3 __attribute__ ((aligned(16))); +__m128i a_sq_m7_m1 __attribute__ ((aligned(16))); +__m128i a_sq_m7_p1 __attribute__ ((aligned(16))); +__m128i a_sq_m7_p3 __attribute__ ((aligned(16))); +__m128i a_sq_m7_p5 __attribute__ ((aligned(16))); +__m128i a_sq_m7_p7 __attribute__ ((aligned(16))); +__m128i a_sq_m5_m7 __attribute__ ((aligned(16))); +__m128i a_sq_m5_m5 __attribute__ ((aligned(16))); +__m128i a_sq_m5_m3 __attribute__ ((aligned(16))); +__m128i a_sq_m5_m1 __attribute__ ((aligned(16))); +__m128i a_sq_m5_p1 __attribute__ ((aligned(16))); +__m128i a_sq_m5_p3 __attribute__ ((aligned(16))); +__m128i a_sq_m5_p5 __attribute__ ((aligned(16))); +__m128i a_sq_m5_p7 __attribute__ ((aligned(16))); +__m128i a_sq_m3_m7 __attribute__ ((aligned(16))); +__m128i a_sq_m3_m5 __attribute__ ((aligned(16))); +__m128i a_sq_m3_m3 __attribute__ ((aligned(16))); +__m128i a_sq_m3_m1 __attribute__ ((aligned(16))); +__m128i a_sq_m3_p1 __attribute__ ((aligned(16))); +__m128i a_sq_m3_p3 __attribute__ ((aligned(16))); +__m128i a_sq_m3_p5 __attribute__ ((aligned(16))); +__m128i a_sq_m3_p7 __attribute__ ((aligned(16))); +__m128i a_sq_m1_m7 __attribute__ ((aligned(16))); +__m128i a_sq_m1_m5 __attribute__ ((aligned(16))); +__m128i a_sq_m1_m3 __attribute__ ((aligned(16))); +__m128i a_sq_m1_m1 __attribute__ ((aligned(16))); +__m128i a_sq_m1_p1 __attribute__ ((aligned(16))); +__m128i a_sq_m1_p3 __attribute__ ((aligned(16))); +__m128i a_sq_m1_p5 __attribute__ ((aligned(16))); +__m128i a_sq_m1_p7 __attribute__ ((aligned(16))); +__m128i a_sq_p1_m7 __attribute__ ((aligned(16))); +__m128i a_sq_p1_m5 __attribute__ ((aligned(16))); +__m128i a_sq_p1_m3 __attribute__ ((aligned(16))); +__m128i a_sq_p1_m1 __attribute__ ((aligned(16))); +__m128i a_sq_p1_p1 __attribute__ ((aligned(16))); +__m128i a_sq_p1_p3 __attribute__ ((aligned(16))); +__m128i a_sq_p1_p5 __attribute__ ((aligned(16))); +__m128i a_sq_p1_p7 __attribute__ ((aligned(16))); +__m128i a_sq_p3_m7 __attribute__ ((aligned(16))); +__m128i a_sq_p3_m5 __attribute__ ((aligned(16))); +__m128i a_sq_p3_m3 __attribute__ ((aligned(16))); +__m128i a_sq_p3_m1 __attribute__ ((aligned(16))); +__m128i a_sq_p3_p1 __attribute__ ((aligned(16))); +__m128i a_sq_p3_p3 __attribute__ ((aligned(16))); +__m128i a_sq_p3_p5 __attribute__ ((aligned(16))); +__m128i a_sq_p3_p7 __attribute__ ((aligned(16))); +__m128i a_sq_p5_m7 __attribute__ ((aligned(16))); +__m128i a_sq_p5_m5 __attribute__ ((aligned(16))); +__m128i a_sq_p5_m3 __attribute__ ((aligned(16))); +__m128i a_sq_p5_m1 __attribute__ ((aligned(16))); +__m128i a_sq_p5_p1 __attribute__ ((aligned(16))); +__m128i a_sq_p5_p3 __attribute__ ((aligned(16))); +__m128i a_sq_p5_p5 __attribute__ ((aligned(16))); +__m128i a_sq_p5_p7 __attribute__ ((aligned(16))); +__m128i a_sq_p7_m7 __attribute__ ((aligned(16))); +__m128i a_sq_p7_m5 __attribute__ ((aligned(16))); +__m128i a_sq_p7_m3 __attribute__ ((aligned(16))); +__m128i a_sq_p7_m1 __attribute__ ((aligned(16))); +__m128i a_sq_p7_p1 __attribute__ ((aligned(16))); +__m128i a_sq_p7_p3 __attribute__ ((aligned(16))); +__m128i a_sq_p7_p5 __attribute__ ((aligned(16))); +__m128i a_sq_p7_p7 __attribute__ ((aligned(16))); + +__m128i bit_met_m7_m7 __attribute__ ((aligned(16))); +__m128i bit_met_m7_m5 __attribute__ ((aligned(16))); +__m128i bit_met_m7_m3 __attribute__ ((aligned(16))); +__m128i bit_met_m7_m1 __attribute__ ((aligned(16))); +__m128i bit_met_m7_p1 __attribute__ ((aligned(16))); +__m128i bit_met_m7_p3 __attribute__ ((aligned(16))); +__m128i bit_met_m7_p5 __attribute__ ((aligned(16))); +__m128i bit_met_m7_p7 __attribute__ ((aligned(16))); +__m128i bit_met_m5_m7 __attribute__ ((aligned(16))); +__m128i bit_met_m5_m5 __attribute__ ((aligned(16))); +__m128i bit_met_m5_m3 __attribute__ ((aligned(16))); +__m128i bit_met_m5_m1 __attribute__ ((aligned(16))); +__m128i bit_met_m5_p1 __attribute__ ((aligned(16))); +__m128i bit_met_m5_p3 __attribute__ ((aligned(16))); +__m128i bit_met_m5_p5 __attribute__ ((aligned(16))); +__m128i bit_met_m5_p7 __attribute__ ((aligned(16))); +__m128i bit_met_m3_m7 __attribute__ ((aligned(16))); +__m128i bit_met_m3_m5 __attribute__ ((aligned(16))); +__m128i bit_met_m3_m3 __attribute__ ((aligned(16))); +__m128i bit_met_m3_m1 __attribute__ ((aligned(16))); +__m128i bit_met_m3_p1 __attribute__ ((aligned(16))); +__m128i bit_met_m3_p3 __attribute__ ((aligned(16))); +__m128i bit_met_m3_p5 __attribute__ ((aligned(16))); +__m128i bit_met_m3_p7 __attribute__ ((aligned(16))); +__m128i bit_met_m1_m7 __attribute__ ((aligned(16))); +__m128i bit_met_m1_m5 __attribute__ ((aligned(16))); +__m128i bit_met_m1_m3 __attribute__ ((aligned(16))); +__m128i bit_met_m1_m1 __attribute__ ((aligned(16))); +__m128i bit_met_m1_p1 __attribute__ ((aligned(16))); +__m128i bit_met_m1_p3 __attribute__ ((aligned(16))); +__m128i bit_met_m1_p5 __attribute__ ((aligned(16))); +__m128i bit_met_m1_p7 __attribute__ ((aligned(16))); +__m128i bit_met_p1_m7 __attribute__ ((aligned(16))); +__m128i bit_met_p1_m5 __attribute__ ((aligned(16))); +__m128i bit_met_p1_m3 __attribute__ ((aligned(16))); +__m128i bit_met_p1_m1 __attribute__ ((aligned(16))); +__m128i bit_met_p1_p1 __attribute__ ((aligned(16))); +__m128i bit_met_p1_p3 __attribute__ ((aligned(16))); +__m128i bit_met_p1_p5 __attribute__ ((aligned(16))); +__m128i bit_met_p1_p7 __attribute__ ((aligned(16))); +__m128i bit_met_p3_m7 __attribute__ ((aligned(16))); +__m128i bit_met_p3_m5 __attribute__ ((aligned(16))); +__m128i bit_met_p3_m3 __attribute__ ((aligned(16))); +__m128i bit_met_p3_m1 __attribute__ ((aligned(16))); +__m128i bit_met_p3_p1 __attribute__ ((aligned(16))); +__m128i bit_met_p3_p3 __attribute__ ((aligned(16))); +__m128i bit_met_p3_p5 __attribute__ ((aligned(16))); +__m128i bit_met_p3_p7 __attribute__ ((aligned(16))); +__m128i bit_met_p5_m7 __attribute__ ((aligned(16))); +__m128i bit_met_p5_m5 __attribute__ ((aligned(16))); +__m128i bit_met_p5_m3 __attribute__ ((aligned(16))); +__m128i bit_met_p5_m1 __attribute__ ((aligned(16))); +__m128i bit_met_p5_p1 __attribute__ ((aligned(16))); +__m128i bit_met_p5_p3 __attribute__ ((aligned(16))); +__m128i bit_met_p5_p5 __attribute__ ((aligned(16))); +__m128i bit_met_p5_p7 __attribute__ ((aligned(16))); +__m128i bit_met_p7_m7 __attribute__ ((aligned(16))); +__m128i bit_met_p7_m5 __attribute__ ((aligned(16))); +__m128i bit_met_p7_m3 __attribute__ ((aligned(16))); +__m128i bit_met_p7_m1 __attribute__ ((aligned(16))); +__m128i bit_met_p7_p1 __attribute__ ((aligned(16))); +__m128i bit_met_p7_p3 __attribute__ ((aligned(16))); +__m128i bit_met_p7_p5 __attribute__ ((aligned(16))); +__m128i bit_met_p7_p7 __attribute__ ((aligned(16))); + +__m128i y0_p_1_1 __attribute__ ((aligned(16))); +__m128i y0_p_1_3 __attribute__ ((aligned(16))); +__m128i y0_p_1_5 __attribute__ ((aligned(16))); +__m128i y0_p_1_7 __attribute__ ((aligned(16))); +__m128i y0_p_3_1 __attribute__ ((aligned(16))); +__m128i y0_p_3_3 __attribute__ ((aligned(16))); +__m128i y0_p_3_5 __attribute__ ((aligned(16))); +__m128i y0_p_3_7 __attribute__ ((aligned(16))); +__m128i y0_p_5_1 __attribute__ ((aligned(16))); +__m128i y0_p_5_3 __attribute__ ((aligned(16))); +__m128i y0_p_5_5 __attribute__ ((aligned(16))); +__m128i y0_p_5_7 __attribute__ ((aligned(16))); +__m128i y0_p_7_1 __attribute__ ((aligned(16))); +__m128i y0_p_7_3 __attribute__ ((aligned(16))); +__m128i y0_p_7_5 __attribute__ ((aligned(16))); +__m128i y0_p_7_7 __attribute__ ((aligned(16))); +__m128i y0_m_1_1 __attribute__ ((aligned(16))); +__m128i y0_m_1_3 __attribute__ ((aligned(16))); +__m128i y0_m_1_5 __attribute__ ((aligned(16))); +__m128i y0_m_1_7 __attribute__ ((aligned(16))); +__m128i y0_m_3_1 __attribute__ ((aligned(16))); +__m128i y0_m_3_3 __attribute__ ((aligned(16))); +__m128i y0_m_3_5 __attribute__ ((aligned(16))); +__m128i y0_m_3_7 __attribute__ ((aligned(16))); +__m128i y0_m_5_1 __attribute__ ((aligned(16))); +__m128i y0_m_5_3 __attribute__ ((aligned(16))); +__m128i y0_m_5_5 __attribute__ ((aligned(16))); +__m128i y0_m_5_7 __attribute__ ((aligned(16))); +__m128i y0_m_7_1 __attribute__ ((aligned(16))); +__m128i y0_m_7_3 __attribute__ ((aligned(16))); +__m128i y0_m_7_5 __attribute__ ((aligned(16))); +__m128i y0_m_7_7 __attribute__ ((aligned(16))); + +__m128i xmm0 __attribute__ ((aligned(16))); +__m128i xmm1 __attribute__ ((aligned(16))); +__m128i xmm2 __attribute__ ((aligned(16))); +__m128i xmm3 __attribute__ ((aligned(16))); +__m128i xmm4 __attribute__ ((aligned(16))); +__m128i xmm5 __attribute__ ((aligned(16))); +__m128i xmm6 __attribute__ ((aligned(16))); +__m128i xmm7 __attribute__ ((aligned(16))); +__m128i xmm8 __attribute__ ((aligned(16))); + +__m128i y0r __attribute__ ((aligned(16))); +__m128i y0i __attribute__ ((aligned(16))); +__m128i y1r __attribute__ ((aligned(16))); +__m128i y1i __attribute__ ((aligned(16))); +__m128i y2r __attribute__ ((aligned(16))); +__m128i y2i __attribute__ ((aligned(16))); + +__m128i logmax_num_re0 __attribute__ ((aligned(16))); +__m128i logmax_num_im0 __attribute__ ((aligned(16))); +__m128i logmax_den_re0 __attribute__ ((aligned(16))); +__m128i logmax_den_im0 __attribute__ ((aligned(16))); +__m128i logmax_num_re1 __attribute__ ((aligned(16))); +__m128i logmax_num_im1 __attribute__ ((aligned(16))); +__m128i logmax_den_re1 __attribute__ ((aligned(16))); +__m128i logmax_den_im1 __attribute__ ((aligned(16))); + +__m128i tmp_result __attribute__ ((aligned(16))); +__m128i tmp_result2 __attribute__ ((aligned(16))); +__m128i tmp_result3 __attribute__ ((aligned(16))); +__m128i tmp_result4 __attribute__ ((aligned(16))); + + +//============================================================================================== +// Auxiliary Makros + +// calculates psi_a = psi_r*a_r + psi_i*a_i +#define prodsum_psi_a_epi16(psi_r,a_r,psi_i,a_i,psi_a) tmp_result = _mm_mulhi_epi16(psi_r,a_r); tmp_result = _mm_slli_epi16(tmp_result,1); tmp_result2 = _mm_mulhi_epi16(psi_i,a_i); tmp_result2 = _mm_slli_epi16(tmp_result2,1); psi_a = _mm_adds_epi16(tmp_result,tmp_result2); + +// calculate interference magnitude +#define interference_abs_epi16(psi,int_ch_mag,int_mag,c1,c2) tmp_result = _mm_cmplt_epi16(psi,int_ch_mag); tmp_result2 = _mm_xor_si128(tmp_result,(*(__m128i*)&ones[0])); tmp_result = _mm_and_si128(tmp_result,c1); tmp_result2 = _mm_and_si128(tmp_result2,c2); int_mag = _mm_or_si128(tmp_result,tmp_result2); + +// calculate interference magnitude +// tmp_result = ones in shorts corr. to interval 2<=x<=4, tmp_result2 interval < 2, tmp_result3 interval 46 +#define interference_abs_64qam_epi16(psi,int_ch_mag,int_two_ch_mag,int_three_ch_mag,a,c1,c3,c5,c7) tmp_result = _mm_cmplt_epi16(psi,int_two_ch_mag); tmp_result3 = _mm_xor_si128(tmp_result,(*(__m128i*)&ones[0])); tmp_result2 = _mm_cmplt_epi16(psi,int_ch_mag); tmp_result = _mm_xor_si128(tmp_result,tmp_result2); tmp_result4 = _mm_cmpgt_epi16(psi,int_three_ch_mag); tmp_result3 = _mm_xor_si128(tmp_result3,tmp_result4); tmp_result = _mm_and_si128(tmp_result,c3); tmp_result2 = _mm_and_si128(tmp_result2,c1); tmp_result3 = _mm_and_si128(tmp_result3,c5); tmp_result4 = _mm_and_si128(tmp_result4,c7); tmp_result = _mm_or_si128(tmp_result,tmp_result2); tmp_result3 = _mm_or_si128(tmp_result3,tmp_result4); a = _mm_or_si128(tmp_result,tmp_result3); + +// calculates a_sq = int_ch_mag*(a_r^2 + a_i^2)*scale_factor +#define square_a_epi16(a_r,a_i,int_ch_mag,scale_factor,a_sq) tmp_result = _mm_mulhi_epi16(a_r,a_r); tmp_result = _mm_slli_epi16(tmp_result,1); tmp_result = _mm_mulhi_epi16(tmp_result,scale_factor); tmp_result = _mm_slli_epi16(tmp_result,1); tmp_result = _mm_mulhi_epi16(tmp_result,int_ch_mag); tmp_result = _mm_slli_epi16(tmp_result,1); tmp_result2 = _mm_mulhi_epi16(a_i,a_i); tmp_result2 = _mm_slli_epi16(tmp_result2,1); tmp_result2 = _mm_mulhi_epi16(tmp_result2,scale_factor); tmp_result2 = _mm_slli_epi16(tmp_result2,1); tmp_result2 = _mm_mulhi_epi16(tmp_result2,int_ch_mag); tmp_result2 = _mm_slli_epi16(tmp_result2,1); a_sq = _mm_adds_epi16(tmp_result,tmp_result2); + +// calculates a_sq = int_ch_mag*(a_r^2 + a_i^2)*scale_factor for 64-QAM +#define square_a_64qam_epi16(a_r,a_i,int_ch_mag,scale_factor,a_sq) tmp_result = _mm_mulhi_epi16(a_r,a_r); tmp_result = _mm_slli_epi16(tmp_result,1); tmp_result = _mm_mulhi_epi16(tmp_result,scale_factor); tmp_result = _mm_slli_epi16(tmp_result,3); tmp_result = _mm_mulhi_epi16(tmp_result,int_ch_mag); tmp_result = _mm_slli_epi16(tmp_result,1); tmp_result2 = _mm_mulhi_epi16(a_i,a_i); tmp_result2 = _mm_slli_epi16(tmp_result2,1); tmp_result2 = _mm_mulhi_epi16(tmp_result2,scale_factor); tmp_result2 = _mm_slli_epi16(tmp_result2,3); tmp_result2 = _mm_mulhi_epi16(tmp_result2,int_ch_mag); tmp_result2 = _mm_slli_epi16(tmp_result2,1); a_sq = _mm_adds_epi16(tmp_result,tmp_result2); + +#elif defined(__arm__) + +#endif + +//============================================================================================== +// SINGLE-STREAM +//============================================================================================== + +//---------------------------------------------------------------------------------------------- +// QPSK +//---------------------------------------------------------------------------------------------- + +int dlsch_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, + int32_t **rxdataF_comp, + int16_t *dlsch_llr, + uint8_t symbol, + uint8_t first_symbol_flag, + uint16_t nb_rb, + uint16_t pbch_pss_sss_adjust, + uint8_t beamforming_mode) +{ + + uint32_t *rxF = (uint32_t*)&rxdataF_comp[0][((int32_t)symbol*frame_parms->N_RB_DL*12)]; + uint32_t *llr32; + int i,len; + uint8_t symbol_mod = (symbol >= (7-frame_parms->Ncp))? (symbol-(7-frame_parms->Ncp)) : symbol; + + /* + if (first_symbol_flag==1) { + llr32 = (uint32_t*)dlsch_llr; + } else { + llr32 = (uint32_t*)(*llr32p); + }*/ + + llr32 = (uint32_t*)dlsch_llr; + if (!llr32) { + LOG_E(PHY,"dlsch_qpsk_llr: llr is null, symbol %d, llr32=%p\n",symbol, llr32); + return(-1); + } + + + if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { + if (frame_parms->nb_antenna_ports_eNB!=1) + len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); + else + len = (nb_rb*10) - (5*pbch_pss_sss_adjust/6); + } else if((beamforming_mode==7) && (frame_parms->Ncp==0) && (symbol==3 || symbol==6 || symbol==9 || symbol==12)){ + len = (nb_rb*9) - (3*pbch_pss_sss_adjust/4); + } else if((beamforming_mode==7) && (frame_parms->Ncp==1) && (symbol==4 || symbol==7 || symbol==10)){ + len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); + } else { + len = (nb_rb*12) - pbch_pss_sss_adjust; + } + + + /* + LOG_I(PHY,"dlsch_qpsk_llr: [symb %d / FirstSym %d / Length %d]: @LLR Buff %x, @LLR Buff(symb) %x \n", + symbol, + first_symbol_flag, + len, + dlsch_llr, + llr32); + */ + //printf("ll32p=%p , dlsch_llr=%p, symbol=%d, flag=%d \n", llr32, dlsch_llr, symbol, first_symbol_flag); + for (i=0; iN_RB_DL*12]; + int16_t rho_rho_amp_x0[2*frame_parms->N_RB_DL*12]; + uint16_t amp_tmp; + uint16_t *llr16=(uint16_t*)dlsch_llr; + int i, len, nsymb; + uint8_t symbol, symbol_mod; + int len_acc=0; + uint16_t *sic_data; + uint16_t pbch_pss_sss_adjust; + + nsymb = (frame_parms->Ncp==0) ? 14:12; + + for (symbol=num_pdcch_symbols; symbolN_RB_DL*12)]); + int16_t *rho_1=(int16_t*)(&rho_i[0][((int16_t)symbol*frame_parms->N_RB_DL*12)]); + sic_data = (uint16_t*)&sic_buffer[0][((int16_t)len_acc)]; + + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + + + + + if ((symbol_mod == 0) || (symbol_mod == (4-frame_parms->Ncp))) //pilots=1 + amp_tmp=0x1fff;//dlsch0->sqrt_rho_b; already taken into account + else //pilots=0 + amp_tmp=0x1fff;//1.5*dlsch0->sqrt_rho_a; already taken into account + + if (mod_order_0==6) + amp_tmp=amp_tmp<<1; // to compensate for >> 1 shift in modulation + + + pbch_pss_sss_adjust=adjust_G2(frame_parms,&rb_alloc,2,subframe,symbol); + + if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { + if (frame_parms->nb_antenna_ports_eNB!=1) + len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); + else + len = (nb_rb*10) - (5*pbch_pss_sss_adjust/6); + } else { + len = (nb_rb*12) - pbch_pss_sss_adjust; + } + + // printf("dlsch_qpsk_llr: symbol %d,nb_rb %d, len %d,pbch_pss_sss_adjust %d\n",symbol,nb_rb,len,pbch_pss_sss_adjust); + + len_acc+=len; //accumulated length; this is done because in sic_buffer we have only data symbols + + multadd_complex_vector_real_scalar((int16_t *)sic_data, + amp_tmp, + (int16_t *)rho_amp_x0, //this is in Q13 + 1, + len); + + mult_cpx_vector((int16_t *)rho_1, //Q15 + (int16_t *)rho_amp_x0, //Q13 + (int16_t*)rho_rho_amp_x0, + len, + 13); + +#ifdef DEBUG_LLR_SIC + write_output("rho_for_multipl.m","rho_for_m", rho_1,len,1, + symbol==num_pdcch_symbols ? 15 : + symbol==nsymb-1 ? 14 : 13); + + write_output("rho_rho_in_llr.m","rho2", rho_rho_amp_x0,len,1, + symbol==num_pdcch_symbols ? 15 : + symbol==nsymb-1 ? 14 : 13); +#endif + + sub_cpx_vector16((int16_t *)rxF, + (int16_t *)rho_rho_amp_x0, + //(int16_t *)clean_x1, + (int16_t *)rxF, + len*2); + +#ifdef DEBUG_LLR_SIC + write_output("rxFdata_comp1_after.m","rxF_a", rxF,len,1,1); + write_output("rxF_comp1.m","rxF_1_comp", rxF,len,1, + symbol==num_pdcch_symbols ? 15 : + symbol==nsymb-1 ? 14 : 13); +#endif + + //this is for QPSK only!!! + for (i=0; iN_RB_DL*12)]; + __m128i *ch_mag; + __m128i llr128[2]; + uint32_t *llr32; +#elif defined(__arm__) + int16x8_t *rxF = (int16x8_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)]; + int16x8_t *ch_mag; + int16x8_t xmm0; + int16_t *llr16; +#endif + + + int i,len; + unsigned char symbol_mod,len_mod4=0; + + +#if defined(__x86_64__) || defined(__i386__) + if (first_symbol_flag==1) { + llr32 = (uint32_t*)dlsch_llr; + } else { + llr32 = (uint32_t*)*llr32p; + } +#elif defined(__arm__) + if (first_symbol_flag==1) { + llr16 = (int16_t*)dlsch_llr; + } else { + llr16 = (int16_t*)*llr32p; + } +#endif + + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + +#if defined(__x86_64__) || defined(__i386__) + ch_mag = (__m128i*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)]; +#elif defined(__arm__) + ch_mag = (int16x8_t*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)]; +#endif + if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { + if (frame_parms->nb_antenna_ports_eNB!=1) + len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); + else + len = (nb_rb*10) - (5*pbch_pss_sss_adjust/6); + } else if((beamforming_mode==7) && (frame_parms->Ncp==0) && (symbol==3 || symbol==6 || symbol==9 || symbol==12)){ + len = (nb_rb*9) - (3*pbch_pss_sss_adjust/4); + } else if((beamforming_mode==7) && (frame_parms->Ncp==1) && (symbol==4 || symbol==7 || symbol==10)){ + len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); + } else { + len = (nb_rb*12) - pbch_pss_sss_adjust; + } + + // update output pointer according to number of REs in this symbol (<<2 because 4 bits per RE) + if (first_symbol_flag == 1) + *llr32p = dlsch_llr + (len<<2); + else + *llr32p += (len<<2); + + // printf("len=%d\n", len); + len_mod4 = len&3; + // printf("len_mod4=%d\n", len_mod4); + len>>=2; // length in quad words (4 REs) + // printf("len>>=2=%d\n", len); + len+=(len_mod4==0 ? 0 : 1); + // printf("len+=%d\n", len); + for (i=0; iN_RB_DL*12]; + int16_t rho_rho_amp_x0[2*frame_parms->N_RB_DL*12]; + uint16_t amp_tmp; + uint32_t *llr32=(uint32_t*)dlsch_llr; + int i, len, nsymb; + uint8_t symbol, symbol_mod; + int len_acc=0; + uint16_t *sic_data; + uint16_t pbch_pss_sss_adjust; + unsigned char len_mod4=0; + __m128i llr128[2]; + __m128i *ch_mag; + nsymb = (frame_parms->Ncp==0) ? 14:12; + + for (symbol=num_pdcch_symbols; symbolN_RB_DL*12)]); + int16_t *rho_1=(int16_t*)(&rho_i[0][((int16_t)symbol*frame_parms->N_RB_DL*12)]); + ch_mag = (__m128i*)(&dl_ch_mag[0][((int16_t)symbol*frame_parms->N_RB_DL*12)]); + sic_data = (uint16_t*)(&sic_buffer[0][((int16_t)len_acc)]); + + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + + pbch_pss_sss_adjust=adjust_G2(frame_parms,&rb_alloc,4,subframe,symbol); + + if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { + amp_tmp=0x1fff;//dlsch0->sqrt_rho_b; already taken into account + if (frame_parms->nb_antenna_ports_eNB!=1) + len = nb_rb*8 - (2*pbch_pss_sss_adjust/3); + else + len = nb_rb*10 - (5*pbch_pss_sss_adjust/6); + } else { + amp_tmp=0x1fff;;//dlsch0->sqrt_rho_a; already taken into account + len = nb_rb*12 - pbch_pss_sss_adjust; + } + + if (mod_order_0==6) + amp_tmp=amp_tmp<<1; // to compensate for >> 1 shift in modulation + + len_acc+=len; + + multadd_complex_vector_real_scalar((int16_t *)sic_data, + amp_tmp, + (int16_t *)rho_amp_x0, //this is in Q13 + 1, + len); + + mult_cpx_vector((int16_t *)rho_1, //Q15 + (int16_t *)rho_amp_x0, //Q13 + (int16_t*)rho_rho_amp_x0, + len, + 13); + + sub_cpx_vector16((int16_t *)rxF, + (int16_t *)rho_rho_amp_x0, + //(int16_t *)clean_x1, + (int16_t *)rxF, + len*2); + + len_mod4 = len&3; + len>>=2; // length in quad words (4 REs) + len+=(len_mod4==0 ? 0 : 1); + + for (i=0; iN_RB_DL*12)]; + __m128i *ch_mag,*ch_magb; +#elif defined(__arm__) + int16x8_t *rxF = (int16x8_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)]; + int16x8_t *ch_mag,*ch_magb,xmm1,xmm2; +#endif + int i,len,len2; + unsigned char symbol_mod,len_mod4; + short *llr; + int16_t *llr2; + int8_t *pllr_symbol; + + /* + if (first_symbol_flag==1) + llr = dlsch_llr; + else + llr = *llr_save; + */ + llr = dlsch_llr; + + pllr_symbol = (int8_t*)dlsch_llr; + pllr_symbol += llr_offset; + + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + +#if defined(__x86_64__) || defined(__i386__) + ch_mag = (__m128i*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)]; + ch_magb = (__m128i*)&dl_ch_magb[0][(symbol*frame_parms->N_RB_DL*12)]; +#elif defined(__arm__) + ch_mag = (int16x8_t*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)]; + ch_magb = (int16x8_t*)&dl_ch_magb[0][(symbol*frame_parms->N_RB_DL*12)]; +#endif + if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { + if (frame_parms->nb_antenna_ports_eNB!=1) + len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); + else + len = (nb_rb*10) - (5*pbch_pss_sss_adjust/6); + } else if((beamforming_mode==7) && (frame_parms->Ncp==0) && (symbol==3 || symbol==6 || symbol==9 || symbol==12)){ + len = (nb_rb*9) - (3*pbch_pss_sss_adjust/4); + } else if((beamforming_mode==7) && (frame_parms->Ncp==1) && (symbol==4 || symbol==7 || symbol==10)){ + len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); + } else { + len = (nb_rb*12) - pbch_pss_sss_adjust; + } + +// printf("dlsch_64qam_llr: symbol %d,nb_rb %d, len %d,pbch_pss_sss_adjust %d\n",symbol,nb_rb,len,pbch_pss_sss_adjust); + +/* LOG_I(PHY,"dlsch_64qam_llr [symb %d / FirstSym %d / Length %d]: @LLR Buff %x \n", + symbol, + first_symbol_flag, + len, + dlsch_llr, + pllr_symbol);*/ + + llr2 = llr; + llr += (len*6); + + len_mod4 =len&3; + len2=len>>2; // length in quad words (4 REs) + len2+=((len_mod4==0)?0:1); + + for (i=0; iN_RB_DL*12]; + int16_t rho_rho_amp_x0[2*frame_parms->N_RB_DL*12]; + uint16_t amp_tmp; + uint16_t *llr32=(uint16_t*)dlsch_llr; + int i, len, nsymb, len2; + uint8_t symbol, symbol_mod; + int len_acc=0; + uint16_t *sic_data; + uint16_t pbch_pss_sss_adjust; + unsigned char len_mod4=0; + uint16_t *llr2; + __m128i *ch_mag,*ch_magb; + + nsymb = (frame_parms->Ncp==0) ? 14:12; + + for (symbol=num_pdcch_symbols; symbolN_RB_DL*12)]); + int16_t *rho_1=(int16_t*)(&rho_i[0][((int16_t)symbol*frame_parms->N_RB_DL*12)]); + ch_mag = (__m128i*)(&dl_ch_mag[0][((int16_t)symbol*frame_parms->N_RB_DL*12)]); + ch_magb = (__m128i*)(&dl_ch_magb[0][((int16_t)symbol*frame_parms->N_RB_DL*12)]); + sic_data = (uint16_t*)(&sic_buffer[0][((int16_t)len_acc)]); + + symbol_mod = (symbol>=(7-frame_parms->Ncp)) ? symbol-(7-frame_parms->Ncp) : symbol; + + pbch_pss_sss_adjust=adjust_G2(frame_parms,&rb_alloc,6,subframe,symbol); + + if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { + amp_tmp = 0x1fff;//dlsch0->sqrt_rho_b; already taken into account + if (frame_parms->nb_antenna_ports_eNB!=1) + len = nb_rb*8 - (2*pbch_pss_sss_adjust/3); + else + len = nb_rb*10 - (5*pbch_pss_sss_adjust/6); + } else { + amp_tmp = 0x1fff; //dlsch0->sqrt_rho_a; already taken into account + len = nb_rb*12 - pbch_pss_sss_adjust; + } + + if (mod_order_0==6) + amp_tmp=amp_tmp<<1; // to compensate for >> 1 shift in modulation + + len_acc+=len; + + multadd_complex_vector_real_scalar((int16_t *)sic_data, + amp_tmp, + (int16_t *)rho_amp_x0, //this is in Q13 + 1, + len); + + mult_cpx_vector((int16_t *)rho_1, //Q15 + (int16_t *)rho_amp_x0, //Q13 + (int16_t*)rho_rho_amp_x0, + len, + 13); + + sub_cpx_vector16((int16_t *)rxF, + (int16_t *)rho_rho_amp_x0, + //(int16_t *)clean_x1, + (int16_t *)rxF, + len*2); + + llr2 = llr32; + llr32 += (len*6); + + len_mod4 =len&3; + len2=len>>2; // length in quad words (4 REs) + len2+=(len_mod4?0:1); + + + + for (i=0; iN_RB_DL*12)]; + int16_t *rxF_i=(int16_t*)&rxdataF_comp_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *rho=(int16_t*)&rho_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *llr16; + int len; + uint8_t symbol_mod = (symbol >= (7-frame_parms->Ncp))? (symbol-(7-frame_parms->Ncp)) : symbol; + + if (first_symbol_flag == 1) { + llr16 = (int16_t*)dlsch_llr; + } else { + llr16 = (int16_t*)(*llr16p); + } + + AssertFatal(llr16!=NULL,"dlsch_qpsk_qpsk_llr: llr is null, symbol %d\n",symbol); + + if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { + // if symbol has pilots + if (frame_parms->nb_antenna_ports_eNB!=1) + // in 2 antenna ports we have 8 REs per symbol per RB + len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); + else + // for 1 antenna port we have 10 REs per symbol per RB + len = (nb_rb*10) - (5*pbch_pss_sss_adjust/6); + } else { + // symbol has no pilots + len = (nb_rb*12) - pbch_pss_sss_adjust; + } + + // printf("dlsch_qpsk_qpsk_llr: symbol %d,nb_rb %d, len %d,pbch_pss_sss_adjust %d\n",symbol,nb_rb,len,pbch_pss_sss_adjust); + // printf("qpsk_qpsk: len %d, llr16 %p\n",len,llr16); + qpsk_qpsk((short *)rxF, + (short *)rxF_i, + (short *)llr16, + (short *)rho, + len); + + llr16 += (len<<1); + *llr16p = (short *)llr16; + + return(0); +} + +//__m128i ONE_OVER_SQRT_8 __attribute__((aligned(16))); + +void qpsk_qpsk(short *stream0_in, + short *stream1_in, + short *stream0_out, + short *rho01, + int length + ) +{ + + /* + This function computes the LLRs of stream 0 (s_0) in presence of the interfering stream 1 (s_1) assuming that both symbols are QPSK. It can be used for both MU-MIMO interference-aware receiver or for SU-MIMO receivers. + + Parameters: + stream0_in = Matched filter output y0' = (h0*g0)*y0 + stream1_in = Matched filter output y1' = (h0*g1)*y0 + stream0_out = LLRs + rho01 = Correlation between the two effective channels \rho_{10} = (h1*g1)*(h0*g0) + length = number of resource elements + */ + +#if defined(__x86_64__) || defined(__i386__) + __m128i *rho01_128i = (__m128i *)rho01; + __m128i *stream0_128i_in = (__m128i *)stream0_in; + __m128i *stream1_128i_in = (__m128i *)stream1_in; + __m128i *stream0_128i_out = (__m128i *)stream0_out; + __m128i ONE_OVER_SQRT_8 = _mm_set1_epi16(23170); //round(2^16/sqrt(8)) +#elif defined(__arm__) + int16x8_t *rho01_128i = (int16x8_t *)rho01; + int16x8_t *stream0_128i_in = (int16x8_t *)stream0_in; + int16x8_t *stream1_128i_in = (int16x8_t *)stream1_in; + int16x8_t *stream0_128i_out = (int16x8_t *)stream0_out; + int16x8_t ONE_OVER_SQRT_8 = vdupq_n_s16(23170); //round(2^16/sqrt(8)) +#endif + + int i; + + + for (i=0; i>2; i+=2) { + // in each iteration, we take 8 complex samples +#if defined(__x86_64__) || defined(__i386__) + xmm0 = rho01_128i[i]; // 4 symbols + xmm1 = rho01_128i[i+1]; + + // put (rho_r + rho_i)/2sqrt2 in rho_rpi + // put (rho_r - rho_i)/2sqrt2 in rho_rmi + + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + xmm2 = _mm_unpacklo_epi64(xmm0,xmm1); // Re(rho) + xmm3 = _mm_unpackhi_epi64(xmm0,xmm1); // Im(rho) + rho_rpi = _mm_adds_epi16(xmm2,xmm3); // rho = Re(rho) + Im(rho) + rho_rmi = _mm_subs_epi16(xmm2,xmm3); // rho* = Re(rho) - Im(rho) + + // divide by sqrt(8), no shift needed ONE_OVER_SQRT_8 = Q1.16 + rho_rpi = _mm_mulhi_epi16(rho_rpi,ONE_OVER_SQRT_8); + rho_rmi = _mm_mulhi_epi16(rho_rmi,ONE_OVER_SQRT_8); +#elif defined(__arm__) + + +#endif + // Compute LLR for first bit of stream 0 + + // Compute real and imaginary parts of MF output for stream 0 +#if defined(__x86_64__) || defined(__i386__) + xmm0 = stream0_128i_in[i]; + xmm1 = stream0_128i_in[i+1]; + + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + y0r = _mm_unpacklo_epi64(xmm0,xmm1); // = [y0r(1),y0r(2),y0r(3),y0r(4)] + y0i = _mm_unpackhi_epi64(xmm0,xmm1); + + y0r_over2 = _mm_srai_epi16(y0r,1); // divide by 2 + y0i_over2 = _mm_srai_epi16(y0i,1); // divide by 2 +#elif defined(__arm__) + + +#endif + // Compute real and imaginary parts of MF output for stream 1 +#if defined(__x86_64__) || defined(__i386__) + xmm0 = stream1_128i_in[i]; + xmm1 = stream1_128i_in[i+1]; + + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + y1r = _mm_unpacklo_epi64(xmm0,xmm1); //[y1r(1),y1r(2),y1r(3),y1r(4)] + y1i = _mm_unpackhi_epi64(xmm0,xmm1); //[y1i(1),y1i(2),y1i(3),y1i(4)] + + y1r_over2 = _mm_srai_epi16(y1r,1); // divide by 2 + y1i_over2 = _mm_srai_epi16(y1i,1); // divide by 2 + + // Compute the terms for the LLR of first bit + + xmm0 = _mm_setzero_si128(); // ZERO + + // 1 term for numerator of LLR + xmm3 = _mm_subs_epi16(y1r_over2,rho_rpi); + A = _mm_abs_epi16(xmm3); // A = |y1r/2 - rho/sqrt(8)| + xmm2 = _mm_adds_epi16(A,y0i_over2); // = |y1r/2 - rho/sqrt(8)| + y0i/2 + xmm3 = _mm_subs_epi16(y1i_over2,rho_rmi); + B = _mm_abs_epi16(xmm3); // B = |y1i/2 - rho*/sqrt(8)| + logmax_num_re0 = _mm_adds_epi16(B,xmm2); // = |y1r/2 - rho/sqrt(8)|+|y1i/2 - rho*/sqrt(8)| + y0i/2 + + // 2 term for numerator of LLR + xmm3 = _mm_subs_epi16(y1r_over2,rho_rmi); + C = _mm_abs_epi16(xmm3); // C = |y1r/2 - rho*/4| + xmm2 = _mm_subs_epi16(C,y0i_over2); // = |y1r/2 - rho*/4| - y0i/2 + xmm3 = _mm_adds_epi16(y1i_over2,rho_rpi); + D = _mm_abs_epi16(xmm3); // D = |y1i/2 + rho/4| + xmm2 = _mm_adds_epi16(xmm2,D); // |y1r/2 - rho*/4| + |y1i/2 + rho/4| - y0i/2 + logmax_num_re0 = _mm_max_epi16(logmax_num_re0,xmm2); // max, numerator done + + // 1 term for denominator of LLR + xmm3 = _mm_adds_epi16(y1r_over2,rho_rmi); + E = _mm_abs_epi16(xmm3); // E = |y1r/2 + rho*/4| + xmm2 = _mm_adds_epi16(E,y0i_over2); // = |y1r/2 + rho*/4| + y0i/2 + xmm3 = _mm_subs_epi16(y1i_over2,rho_rpi); + F = _mm_abs_epi16(xmm3); // F = |y1i/2 - rho/4| + logmax_den_re0 = _mm_adds_epi16(F,xmm2); // = |y1r/2 + rho*/4| + |y1i/2 - rho/4| + y0i/2 + + // 2 term for denominator of LLR + xmm3 = _mm_adds_epi16(y1r_over2,rho_rpi); + G = _mm_abs_epi16(xmm3); // G = |y1r/2 + rho/4| + xmm2 = _mm_subs_epi16(G,y0i_over2); // = |y1r/2 + rho/4| - y0i/2 + xmm3 = _mm_adds_epi16(y1i_over2,rho_rmi); + H = _mm_abs_epi16(xmm3); // H = |y1i/2 + rho*/4| + xmm2 = _mm_adds_epi16(xmm2,H); // = |y1r/2 + rho/4| + |y1i/2 + rho*/4| - y0i/2 + logmax_den_re0 = _mm_max_epi16(logmax_den_re0,xmm2); // max, denominator done + + // Compute the terms for the LLR of first bit + + // 1 term for nominator of LLR + xmm2 = _mm_adds_epi16(A,y0r_over2); + logmax_num_im0 = _mm_adds_epi16(B,xmm2); // = |y1r/2 - rho/4| + |y1i/2 - rho*/4| + y0r/2 + + // 2 term for nominator of LLR + xmm2 = _mm_subs_epi16(E,y0r_over2); + xmm2 = _mm_adds_epi16(xmm2,F); // = |y1r/2 + rho*/4| + |y1i/2 - rho/4| - y0r/2 + + logmax_num_im0 = _mm_max_epi16(logmax_num_im0,xmm2); // max, nominator done + + // 1 term for denominator of LLR + xmm2 = _mm_adds_epi16(C,y0r_over2); + logmax_den_im0 = _mm_adds_epi16(D,xmm2); // = |y1r/2 - rho*/4| + |y1i/2 + rho/4| - y0r/2 + + xmm2 = _mm_subs_epi16(G,y0r_over2); + xmm2 = _mm_adds_epi16(xmm2,H); // = |y1r/2 + rho/4| + |y1i/2 + rho*/4| - y0r/2 + + logmax_den_im0 = _mm_max_epi16(logmax_den_im0,xmm2); // max, denominator done + + // LLR of first bit [L1(1), L1(2), L1(3), L1(4)] + y0r = _mm_adds_epi16(y0r,logmax_num_re0); + y0r = _mm_subs_epi16(y0r,logmax_den_re0); + + // LLR of second bit [L2(1), L2(2), L2(3), L2(4)] + y0i = _mm_adds_epi16(y0i,logmax_num_im0); + y0i = _mm_subs_epi16(y0i,logmax_den_im0); + + _mm_storeu_si128(&stream0_128i_out[i],_mm_unpacklo_epi16(y0r,y0i)); // = [L1(1), L2(1), L1(2), L2(2)] + + if (i<((length>>1) - 1)) // false if only 2 REs remain + _mm_storeu_si128(&stream0_128i_out[i+1],_mm_unpackhi_epi16(y0r,y0i)); + +#elif defined(__x86_64__) + +#endif + } + +#if defined(__x86_64__) || defined(__i386__) + _mm_empty(); + _m_empty(); +#endif +} + +int dlsch_qpsk_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms, + int32_t **rxdataF_comp, + int32_t **rxdataF_comp_i, + int32_t **dl_ch_mag_i, //|h_1|^2*(2/sqrt{10}) + int32_t **rho_i, + int16_t *dlsch_llr, + uint8_t symbol, + uint8_t first_symbol_flag, + uint16_t nb_rb, + uint16_t pbch_pss_sss_adjust, + int16_t **llr16p) +{ + + int16_t *rxF=(int16_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *rxF_i=(int16_t*)&rxdataF_comp_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *ch_mag_i = (int16_t*)&dl_ch_mag_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *rho=(int16_t*)&rho_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *llr16; + int len; + uint8_t symbol_mod = (symbol >= (7-frame_parms->Ncp))? (symbol-(7-frame_parms->Ncp)) : symbol; + + if (first_symbol_flag == 1) { + llr16 = (int16_t*)dlsch_llr; + } else { + llr16 = (int16_t*)(*llr16p); + } + + AssertFatal(llr16!=NULL,"dlsch_qpsk_qpsk_llr: llr is null, symbol %d\n",symbol); + + + if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { + // if symbol has pilots + if (frame_parms->nb_antenna_ports_eNB!=1) + // in 2 antenna ports we have 8 REs per symbol per RB + len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); + else + // for 1 antenna port we have 10 REs per symbol per RB + len = (nb_rb*10) - (5*pbch_pss_sss_adjust/6); + } else { + // symbol has no pilots + len = (nb_rb*12) - pbch_pss_sss_adjust; + } + + qpsk_qam16((short *)rxF, + (short *)rxF_i, + (short *)ch_mag_i, + (short *)llr16, + (short *)rho, + len); + + llr16 += (len<<1); + *llr16p = (short *)llr16; + + return(0); +} + +/* +#if defined(__x86_64__) || defined(__i386__) +__m128i ONE_OVER_SQRT_2 __attribute__((aligned(16))); +__m128i ONE_OVER_SQRT_10 __attribute__((aligned(16))); +__m128i THREE_OVER_SQRT_10 __attribute__((aligned(16))); +__m128i ONE_OVER_SQRT_10_Q15 __attribute__((aligned(16))); +__m128i SQRT_10_OVER_FOUR __attribute__((aligned(16))); +__m128i ch_mag_int; +#endif +*/ +void qpsk_qam16(int16_t *stream0_in, + int16_t *stream1_in, + int16_t *ch_mag_i, + int16_t *stream0_out, + int16_t *rho01, + int32_t length + ) +{ + /* + This function computes the LLRs of stream 0 (s_0) in presence of the interfering stream 1 (s_1) assuming that both symbols are QPSK. It can be used for both MU-MIMO interference-aware receiver or for SU-MIMO receivers. + + Parameters: + stream0_in = Matched filter output y0' = (h0*g0)*y0 + stream1_in = Matched filter output y1' = (h0*g1)*y0 + stream0_out = LLRs + rho01 = Correlation between the two effective channels \rho_{10} = (h1*g1)*(h0*g0) + length = number of resource elements + */ + +#if defined(__x86_64__) || defined(__i386__) + __m128i *rho01_128i = (__m128i *)rho01; + __m128i *stream0_128i_in = (__m128i *)stream0_in; + __m128i *stream1_128i_in = (__m128i *)stream1_in; + __m128i *stream0_128i_out = (__m128i *)stream0_out; + __m128i *ch_mag_128i_i = (__m128i *)ch_mag_i; + __m128i ONE_OVER_SQRT_2 = _mm_set1_epi16(23170); // round(1/sqrt(2)*2^15) + __m128i ONE_OVER_SQRT_10_Q15 = _mm_set1_epi16(10362); // round(1/sqrt(10)*2^15) + __m128i THREE_OVER_SQRT_10 = _mm_set1_epi16(31086); // round(3/sqrt(10)*2^15) + __m128i SQRT_10_OVER_FOUR = _mm_set1_epi16(25905); // round(sqrt(10)/4*2^15) + __m128i ch_mag_int __attribute__((aligned(16))); +#elif defined(__arm__) + int16x8_t *rho01_128i = (int16x8_t *)rho01; + int16x8_t *stream0_128i_in = (int16x8_t *)stream0_in; + int16x8_t *stream1_128i_in = (int16x8_t *)stream1_in; + int16x8_t *stream0_128i_out = (int16x8_t *)stream0_out; + int16x8_t *ch_mag_128i_i = (int16x8_t *)ch_mag_i; + int16x8_t ONE_OVER_SQRT_2 = vdupq_n_s16(23170); // round(1/sqrt(2)*2^15) + int16x8_t ONE_OVER_SQRT_10_Q15 = vdupq_n_s16(10362); // round(1/sqrt(10)*2^15) + int16x8_t THREE_OVER_SQRT_10 = vdupq_n_s16(31086); // round(3/sqrt(10)*2^15) + int16x8_t SQRT_10_OVER_FOUR = vdupq_n_s16(25905); // round(sqrt(10)/4*2^15) + int16x8_t ch_mag_int __attribute__((aligned(16))); +#endif + +#ifdef DEBUG_LLR + print_shorts2("rho01_128i:\n",rho01_128i); +#endif + + int i; + + + for (i=0; i>2; i+=2) { + // in each iteration, we take 8 complex samples + +#if defined(__x86_64__) || defined(__i386__) + + xmm0 = rho01_128i[i]; // 4 symbols + xmm1 = rho01_128i[i+1]; + + // put (rho_r + rho_i)/2sqrt2 in rho_rpi + // put (rho_r - rho_i)/2sqrt2 in rho_rmi + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + xmm2 = _mm_unpacklo_epi64(xmm0,xmm1); // Re(rho) + xmm3 = _mm_unpackhi_epi64(xmm0,xmm1); // Im(rho) + rho_rpi = _mm_adds_epi16(xmm2,xmm3); // rho = Re(rho) + Im(rho) + rho_rmi = _mm_subs_epi16(xmm2,xmm3); // rho* = Re(rho) - Im(rho) + + // divide by sqrt(2) + rho_rpi = _mm_mulhi_epi16(rho_rpi, ONE_OVER_SQRT_2); + rho_rmi = _mm_mulhi_epi16(rho_rmi, ONE_OVER_SQRT_2); + rho_rpi = _mm_slli_epi16(rho_rpi,1); + rho_rmi = _mm_slli_epi16(rho_rmi,1); + + // Compute LLR for first bit of stream 0 + + // Compute real and imaginary parts of MF output for stream 0 + xmm0 = stream0_128i_in[i]; + xmm1 = stream0_128i_in[i+1]; + + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + y0r = _mm_unpacklo_epi64(xmm0,xmm1); // = [y0r(1),y0r(2),y0r(3),y0r(4)] + y0i = _mm_unpackhi_epi64(xmm0,xmm1); + + // divide by sqrt(2) + y0r_over2 = _mm_mulhi_epi16(y0r, ONE_OVER_SQRT_2); + y0i_over2 = _mm_mulhi_epi16(y0i, ONE_OVER_SQRT_2); + y0r_over2 = _mm_slli_epi16(y0r,1); + y0i_over2 = _mm_slli_epi16(y0i,1); + + y0_p_1_1 = _mm_adds_epi16(y0r_over2, y0i_over2); + y0_m_1_1 = _mm_subs_epi16(y0r_over2, y0i_over2); + + // Compute real and imaginary parts of MF output for stream 1 + xmm0 = stream1_128i_in[i]; + xmm1 = stream1_128i_in[i+1]; + + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + y1r = _mm_unpacklo_epi64(xmm0,xmm1); //[y1r(1),y1r(2),y1r(3),y1r(4)] + y1i = _mm_unpackhi_epi64(xmm0,xmm1); //[y1i(1),y1i(2),y1i(3),y1i(4)] + + xmm0 = _mm_setzero_si128(); // ZERO + + // compute psi + xmm3 = _mm_subs_epi16(y1r,rho_rpi); + psi_r_p1_p1 = _mm_abs_epi16(xmm3); + xmm3 = _mm_subs_epi16(y1i,rho_rmi); + psi_i_p1_p1 = _mm_abs_epi16(xmm3); + xmm3 = _mm_subs_epi16(y1r,rho_rmi); + psi_r_p1_m1 = _mm_abs_epi16(xmm3); + xmm3 = _mm_adds_epi16(y1i,rho_rpi); + psi_i_p1_m1 = _mm_abs_epi16(xmm3); + xmm3 = _mm_adds_epi16(y1r,rho_rmi); + psi_r_m1_p1 = _mm_abs_epi16(xmm3); + xmm3 = _mm_subs_epi16(y1i,rho_rpi); + psi_i_m1_p1 = _mm_abs_epi16(xmm3); + xmm3 = _mm_adds_epi16(y1r,rho_rpi); + psi_r_m1_m1 = _mm_abs_epi16(xmm3); + xmm3 = _mm_adds_epi16(y1i,rho_rmi); + psi_i_m1_m1 = _mm_abs_epi16(xmm3); + + // Rearrange interfering channel magnitudes + xmm2 = ch_mag_128i_i[i]; + xmm3 = ch_mag_128i_i[i+1]; + + xmm2 = _mm_shufflelo_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shufflehi_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shuffle_epi32(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflelo_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflehi_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shuffle_epi32(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + + ch_mag_int = _mm_unpacklo_epi64(xmm2,xmm3); + + // calculate optimal interference amplitudes + interference_abs_epi16(psi_r_p1_p1 , ch_mag_int, a_r_p1_p1 , ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p1_p1 , ch_mag_int, a_i_p1_p1 , ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p1_m1 , ch_mag_int, a_r_p1_m1 , ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p1_m1 , ch_mag_int, a_i_p1_m1 , ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m1_p1 , ch_mag_int, a_r_m1_p1 , ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m1_p1 , ch_mag_int, a_i_m1_p1 , ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m1_m1 , ch_mag_int, a_r_m1_m1 , ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m1_m1 , ch_mag_int, a_i_m1_m1 , ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + + // prodsum + prodsum_psi_a_epi16(psi_r_p1_p1, a_r_p1_p1, psi_i_p1_p1, a_i_p1_p1, psi_a_p1_p1); + prodsum_psi_a_epi16(psi_r_p1_m1, a_r_p1_m1, psi_i_p1_m1, a_i_p1_m1, psi_a_p1_m1); + prodsum_psi_a_epi16(psi_r_m1_p1, a_r_m1_p1, psi_i_m1_p1, a_i_m1_p1, psi_a_m1_p1); + prodsum_psi_a_epi16(psi_r_m1_m1, a_r_m1_m1, psi_i_m1_m1, a_i_m1_m1, psi_a_m1_m1); + + // squares + square_a_epi16(a_r_p1_p1, a_i_p1_p1, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p1_p1); + square_a_epi16(a_r_p1_m1, a_i_p1_m1, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p1_m1); + square_a_epi16(a_r_m1_p1, a_i_m1_p1, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m1_p1); + square_a_epi16(a_r_m1_m1, a_i_m1_m1, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m1_m1); + + // Computing Metrics + xmm0 = _mm_subs_epi16(psi_a_p1_p1, a_sq_p1_p1); + bit_met_p1_p1 = _mm_adds_epi16(xmm0, y0_p_1_1); + + xmm0 = _mm_subs_epi16(psi_a_p1_m1, a_sq_p1_m1); + bit_met_p1_m1 = _mm_adds_epi16(xmm0, y0_m_1_1); + + xmm0 = _mm_subs_epi16(psi_a_m1_p1, a_sq_m1_p1); + bit_met_m1_p1 = _mm_subs_epi16(xmm0, y0_m_1_1); + + xmm0 = _mm_subs_epi16(psi_a_m1_m1, a_sq_m1_m1); + bit_met_m1_m1 = _mm_subs_epi16(xmm0, y0_p_1_1); + + // MSB + logmax_num_re0 = _mm_max_epi16(bit_met_p1_p1,bit_met_p1_m1); // bit=0 + logmax_den_re0 = _mm_max_epi16(bit_met_m1_p1,bit_met_m1_m1); // bit=1 + + y0r = _mm_subs_epi16(logmax_num_re0,logmax_den_re0); + + // LSB + logmax_num_im0 = _mm_max_epi16(bit_met_p1_p1,bit_met_m1_p1); // bit=0 + logmax_den_im0 = _mm_max_epi16(bit_met_p1_m1,bit_met_m1_m1); // bit=1 + + y0i = _mm_subs_epi16(logmax_num_im0,logmax_den_im0); + + stream0_128i_out[i] = _mm_unpacklo_epi16(y0r,y0i); // = [L1(1), L2(1), L1(2), L2(2)] + + if (i<((length>>1) - 1)) // false if only 2 REs remain + stream0_128i_out[i+1] = _mm_unpackhi_epi16(y0r,y0i); + +#elif defined(__arm__) + +#endif + } + +#if defined(__x86_64__) || defined(__i386__) + _mm_empty(); + _m_empty(); +#endif +} + +int dlsch_qpsk_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, + int32_t **rxdataF_comp, + int32_t **rxdataF_comp_i, + int32_t **dl_ch_mag_i, //|h_1|^2*(2/sqrt{10}) + int32_t **rho_i, + int16_t *dlsch_llr, + uint8_t symbol, + uint8_t first_symbol_flag, + uint16_t nb_rb, + uint16_t pbch_pss_sss_adjust, + int16_t **llr16p) +{ + + int16_t *rxF=(int16_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *rxF_i=(int16_t*)&rxdataF_comp_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *ch_mag_i = (int16_t*)&dl_ch_mag_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *rho=(int16_t*)&rho_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *llr16; + int len; + uint8_t symbol_mod = (symbol >= (7-frame_parms->Ncp))? (symbol-(7-frame_parms->Ncp)) : symbol; + + + if (first_symbol_flag == 1) { + llr16 = (int16_t*)dlsch_llr; + } else { + llr16 = (int16_t*)(*llr16p); + } + + AssertFatal(llr16!=NULL,"dlsch_qpsk_qam64_llr: llr is null, symbol %d\n",symbol); + + if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { + // if symbol has pilots + if (frame_parms->nb_antenna_ports_eNB!=1) + // in 2 antenna ports we have 8 REs per symbol per RB + len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); + else + // for 1 antenna port we have 10 REs per symbol per RB + len = (nb_rb*10) - (5*pbch_pss_sss_adjust/6); + } else { + // symbol has no pilots + len = (nb_rb*12) - pbch_pss_sss_adjust; + } + + qpsk_qam64((short *)rxF, + (short *)rxF_i, + (short *)ch_mag_i, + (short *)llr16, + (short *)rho, + len); + + llr16 += (len<<1); + *llr16p = (short *)llr16; + + return(0); +} +/* +__m128i ONE_OVER_SQRT_2_42 __attribute__((aligned(16))); +__m128i THREE_OVER_SQRT_2_42 __attribute__((aligned(16))); +__m128i FIVE_OVER_SQRT_2_42 __attribute__((aligned(16))); +__m128i SEVEN_OVER_SQRT_2_42 __attribute__((aligned(16))); + +__m128i ch_mag_int_with_sigma2 __attribute__((aligned(16))); +__m128i two_ch_mag_int_with_sigma2 __attribute__((aligned(16))); +__m128i three_ch_mag_int_with_sigma2 __attribute__((aligned(16))); +__m128i SQRT_42_OVER_FOUR __attribute__((aligned(16))); +*/ +void qpsk_qam64(short *stream0_in, + short *stream1_in, + short *ch_mag_i, + short *stream0_out, + short *rho01, + int length + ) +{ + + /* + This function computes the LLRs of stream 0 (s_0) in presence of the interfering stream 1 (s_1) assuming that both symbols are QPSK. It can be used for both MU-MIMO interference-aware receiver or for SU-MIMO receivers. + + Parameters: + stream0_in = Matched filter output y0' = (h0*g0)*y0 + stream1_in = Matched filter output y1' = (h0*g1)*y0 + stream0_out = LLRs + rho01 = Correlation between the two effective channels \rho_{10} = (h1*g1)*(h0*g0) + length = number of resource elements + */ + +#if defined(__x86_64__) || defined(__i386__) + __m128i *rho01_128i = (__m128i *)rho01; + __m128i *stream0_128i_in = (__m128i *)stream0_in; + __m128i *stream1_128i_in = (__m128i *)stream1_in; + __m128i *stream0_128i_out = (__m128i *)stream0_out; + __m128i *ch_mag_128i_i = (__m128i *)ch_mag_i; + __m128i ONE_OVER_SQRT_2 = _mm_set1_epi16(23170); // round(1/sqrt(2)*2^15) + __m128i ONE_OVER_SQRT_2_42 = _mm_set1_epi16(3575); // round(1/sqrt(2*42)*2^15) + __m128i THREE_OVER_SQRT_2_42 = _mm_set1_epi16(10726); // round(3/sqrt(2*42)*2^15) + __m128i FIVE_OVER_SQRT_2_42 = _mm_set1_epi16(17876); // round(5/sqrt(2*42)*2^15) + __m128i SEVEN_OVER_SQRT_2_42 = _mm_set1_epi16(25027); // round(7/sqrt(2*42)*2^15) + __m128i SQRT_42_OVER_FOUR = _mm_set1_epi16(13272); // round(sqrt(42)/4*2^13), Q3.1 + __m128i ch_mag_int; + __m128i ch_mag_int_with_sigma2; + __m128i two_ch_mag_int_with_sigma2; + __m128i three_ch_mag_int_with_sigma2; +#elif defined(__arm__) + +#endif + +#ifdef DEBUG_LLR + print_shorts2("rho01_128i:\n",rho01_128i); +#endif + + int i; + + + for (i=0; i>2; i+=2) { + // in each iteration, we take 8 complex samples + +#if defined(__x86_64__) || defined(__i386__) + + xmm0 = rho01_128i[i]; // 4 symbols + xmm1 = rho01_128i[i+1]; + + // put (rho_r + rho_i)/sqrt2 in rho_rpi + // put (rho_r - rho_i)/sqrt2 in rho_rmi + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + xmm2 = _mm_unpacklo_epi64(xmm0,xmm1); // Re(rho) + xmm3 = _mm_unpackhi_epi64(xmm0,xmm1); // Im(rho) + rho_rpi = _mm_adds_epi16(xmm2,xmm3); // rho = Re(rho) + Im(rho) + rho_rmi = _mm_subs_epi16(xmm2,xmm3); // rho* = Re(rho) - Im(rho) + + // divide by sqrt(2) + rho_rpi = _mm_mulhi_epi16(rho_rpi, ONE_OVER_SQRT_2); + rho_rmi = _mm_mulhi_epi16(rho_rmi, ONE_OVER_SQRT_2); + rho_rpi = _mm_slli_epi16(rho_rpi,1); + rho_rmi = _mm_slli_epi16(rho_rmi,1); + + // Compute LLR for first bit of stream 0 + + // Compute real and imaginary parts of MF output for stream 0 + xmm0 = stream0_128i_in[i]; + xmm1 = stream0_128i_in[i+1]; + + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + y0r = _mm_unpacklo_epi64(xmm0,xmm1); // = [y0r(1),y0r(2),y0r(3),y0r(4)] + y0i = _mm_unpackhi_epi64(xmm0,xmm1); + + // divide by sqrt(2) + y0r_over2 = _mm_mulhi_epi16(y0r, ONE_OVER_SQRT_2); + y0i_over2 = _mm_mulhi_epi16(y0i, ONE_OVER_SQRT_2); + y0r_over2 = _mm_slli_epi16(y0r,1); + y0i_over2 = _mm_slli_epi16(y0i,1); + + y0_p_1_1 = _mm_adds_epi16(y0r_over2, y0i_over2); + y0_m_1_1 = _mm_subs_epi16(y0r_over2, y0i_over2); + + // Compute real and imaginary parts of MF output for stream 1 + xmm0 = stream1_128i_in[i]; + xmm1 = stream1_128i_in[i+1]; + + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + y1r = _mm_unpacklo_epi64(xmm0,xmm1); //[y1r(1),y1r(2),y1r(3),y1r(4)] + y1i = _mm_unpackhi_epi64(xmm0,xmm1); //[y1i(1),y1i(2),y1i(3),y1i(4)] + + xmm0 = _mm_setzero_si128(); // ZERO + + // compute psi + xmm3 = _mm_subs_epi16(y1r,rho_rpi); + psi_r_p1_p1 = _mm_abs_epi16(xmm3); + xmm3 = _mm_subs_epi16(y1i,rho_rmi); + psi_i_p1_p1 = _mm_abs_epi16(xmm3); + xmm3 = _mm_subs_epi16(y1r,rho_rmi); + psi_r_p1_m1 = _mm_abs_epi16(xmm3); + xmm3 = _mm_adds_epi16(y1i,rho_rpi); + psi_i_p1_m1 = _mm_abs_epi16(xmm3); + xmm3 = _mm_adds_epi16(y1r,rho_rmi); + psi_r_m1_p1 = _mm_abs_epi16(xmm3); + xmm3 = _mm_subs_epi16(y1i,rho_rpi); + psi_i_m1_p1 = _mm_abs_epi16(xmm3); + xmm3 = _mm_adds_epi16(y1r,rho_rpi); + psi_r_m1_m1 = _mm_abs_epi16(xmm3); + xmm3 = _mm_adds_epi16(y1i,rho_rmi); + psi_i_m1_m1 = _mm_abs_epi16(xmm3); + + // Rearrange interfering channel magnitudes + xmm2 = ch_mag_128i_i[i]; + xmm3 = ch_mag_128i_i[i+1]; + + xmm2 = _mm_shufflelo_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shufflehi_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shuffle_epi32(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflelo_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflehi_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shuffle_epi32(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + + ch_mag_int = _mm_unpacklo_epi64(xmm2,xmm3); + ch_mag_int_with_sigma2 = _mm_srai_epi16(ch_mag_int, 1); // *2 + two_ch_mag_int_with_sigma2 = ch_mag_int; // *4 + three_ch_mag_int_with_sigma2 = _mm_adds_epi16(ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2); // *6 + + interference_abs_64qam_epi16(psi_r_p1_p1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p1_p1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p1_p1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p1_p1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p1_m1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p1_m1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p1_m1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p1_m1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m1_p1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m1_p1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m1_p1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m1_p1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m1_m1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m1_m1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m1_m1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m1_m1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + + // prodsum + prodsum_psi_a_epi16(psi_r_p1_p1, a_r_p1_p1, psi_i_p1_p1, a_i_p1_p1, psi_a_p1_p1); + prodsum_psi_a_epi16(psi_r_p1_m1, a_r_p1_m1, psi_i_p1_m1, a_i_p1_m1, psi_a_p1_m1); + prodsum_psi_a_epi16(psi_r_m1_p1, a_r_m1_p1, psi_i_m1_p1, a_i_m1_p1, psi_a_m1_p1); + prodsum_psi_a_epi16(psi_r_m1_m1, a_r_m1_m1, psi_i_m1_m1, a_i_m1_m1, psi_a_m1_m1); + + // Multiply by sqrt(2) + psi_a_p1_p1 = _mm_mulhi_epi16(psi_a_p1_p1, ONE_OVER_SQRT_2); + psi_a_p1_p1 = _mm_slli_epi16(psi_a_p1_p1, 2); + psi_a_p1_m1 = _mm_mulhi_epi16(psi_a_p1_m1, ONE_OVER_SQRT_2); + psi_a_p1_m1 = _mm_slli_epi16(psi_a_p1_m1, 2); + psi_a_m1_p1 = _mm_mulhi_epi16(psi_a_m1_p1, ONE_OVER_SQRT_2); + psi_a_m1_p1 = _mm_slli_epi16(psi_a_m1_p1, 2); + psi_a_m1_m1 = _mm_mulhi_epi16(psi_a_m1_m1, ONE_OVER_SQRT_2); + psi_a_m1_m1 = _mm_slli_epi16(psi_a_m1_m1, 2); + + square_a_64qam_epi16(a_r_p1_p1, a_i_p1_p1, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p1_p1); + square_a_64qam_epi16(a_r_p1_m1, a_i_p1_m1, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p1_m1); + square_a_64qam_epi16(a_r_m1_p1, a_i_m1_p1, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m1_p1); + square_a_64qam_epi16(a_r_m1_m1, a_i_m1_m1, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m1_m1); + + // Computing Metrics + xmm0 = _mm_subs_epi16(psi_a_p1_p1, a_sq_p1_p1); + bit_met_p1_p1 = _mm_adds_epi16(xmm0, y0_p_1_1); + + xmm0 = _mm_subs_epi16(psi_a_p1_m1, a_sq_p1_m1); + bit_met_p1_m1 = _mm_adds_epi16(xmm0, y0_m_1_1); + + xmm0 = _mm_subs_epi16(psi_a_m1_p1, a_sq_m1_p1); + bit_met_m1_p1 = _mm_subs_epi16(xmm0, y0_m_1_1); + + xmm0 = _mm_subs_epi16(psi_a_m1_m1, a_sq_m1_m1); + bit_met_m1_m1 = _mm_subs_epi16(xmm0, y0_p_1_1); + + // MSB + logmax_num_re0 = _mm_max_epi16(bit_met_p1_p1,bit_met_p1_m1); // bit=0 + logmax_den_re0 = _mm_max_epi16(bit_met_m1_p1,bit_met_m1_m1); // bit=1 + + y0r = _mm_subs_epi16(logmax_num_re0,logmax_den_re0); + + // LSB + logmax_num_im0 = _mm_max_epi16(bit_met_p1_p1,bit_met_m1_p1); // bit=0 + logmax_den_im0 = _mm_max_epi16(bit_met_p1_m1,bit_met_m1_m1); // bit=1 + + y0i = _mm_subs_epi16(logmax_num_im0,logmax_den_im0); + + stream0_128i_out[i] = _mm_unpacklo_epi16(y0r,y0i); // = [L1(1), L2(1), L1(2), L2(2)] + + if (i<((length>>1) - 1)) // false if only 2 REs remain + stream0_128i_out[i+1] = _mm_unpackhi_epi16(y0r,y0i); + +#elif defined(__arm__) + +#endif + } + +#if defined(__x86_64__) || defined(__i386__) + _mm_empty(); + _m_empty(); +#endif +} + + +//---------------------------------------------------------------------------------------------- +// 16-QAM +//---------------------------------------------------------------------------------------------- + +/* +__m128i ONE_OVER_TWO_SQRT_10 __attribute__((aligned(16))); +__m128i NINE_OVER_TWO_SQRT_10 __attribute__((aligned(16))); + +__m128i y0r_over_sqrt10 __attribute__ ((aligned(16))); +__m128i y0i_over_sqrt10 __attribute__ ((aligned(16))); +__m128i y0r_three_over_sqrt10 __attribute__ ((aligned(16))); +__m128i y0i_three_over_sqrt10 __attribute__ ((aligned(16))); + +__m128i ch_mag_des __attribute__((aligned(16))); +__m128i ch_mag_over_10 __attribute__ ((aligned(16))); +__m128i ch_mag_over_2 __attribute__ ((aligned(16))); +__m128i ch_mag_9_over_10 __attribute__ ((aligned(16))); +*/ + +void qam16_qpsk(short *stream0_in, + short *stream1_in, + short *ch_mag, + short *stream0_out, + short *rho01, + int length + ) +{ + + /* + Author: Sebastian Wagner + Date: 2012-06-04 + + Input: + stream0_in: MF filter for 1st stream, i.e., y0=h0'*y + stream!_in: MF filter for 2nd stream, i.e., y1=h1'*y + ch_mag: 2*h0/sqrt(00), [Re0 Im0 Re1 Im1] s.t. Im0=Re0, Im1=Re1, etc + ch_mag_i: 2*h1/sqrt(00), [Re0 Im0 Re1 Im1] s.t. Im0=Re0, Im1=Re1, etc + rho01: Channel cross correlation, i.e., h1'*h0 + + Output: + stream0_out: output LLRs for 1st stream + */ + +#if defined(__x86_64__) || defined(__i386__) + __m128i *rho01_128i = (__m128i *)rho01; + __m128i *stream0_128i_in = (__m128i *)stream0_in; + __m128i *stream1_128i_in = (__m128i *)stream1_in; + __m128i *stream0_128i_out = (__m128i *)stream0_out; + __m128i *ch_mag_128i = (__m128i *)ch_mag; + __m128i ONE_OVER_SQRT_2 = _mm_set1_epi16(23170); // round(1/sqrt(2)*2^15) + __m128i ONE_OVER_SQRT_10 = _mm_set1_epi16(20724); // round(1/sqrt(10)*2^16) + __m128i THREE_OVER_SQRT_10 = _mm_set1_epi16(31086); // round(3/sqrt(10)*2^15) + __m128i SQRT_10_OVER_FOUR = _mm_set1_epi16(25905); // round(sqrt(10)/4*2^15) + __m128i ONE_OVER_TWO_SQRT_10 = _mm_set1_epi16(10362); // round(1/2/sqrt(10)*2^16) + __m128i NINE_OVER_TWO_SQRT_10 = _mm_set1_epi16(23315); // round(9/2/sqrt(10)*2^14) + __m128i y0r_over_sqrt10; + __m128i y0i_over_sqrt10; + __m128i y0r_three_over_sqrt10; + __m128i y0i_three_over_sqrt10; + + __m128i ch_mag_des; + __m128i ch_mag_over_10; + __m128i ch_mag_over_2; + __m128i ch_mag_9_over_10; +#elif defined(__arm__) + +#endif + + int i; + + + for (i=0; i>2; i+=2) { + // In one iteration, we deal with 8 REs + +#if defined(__x86_64__) || defined(__i386__) + // Get rho + xmm0 = rho01_128i[i]; + xmm1 = rho01_128i[i+1]; + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + xmm2 = _mm_unpacklo_epi64(xmm0,xmm1); // Re(rho) + xmm3 = _mm_unpackhi_epi64(xmm0,xmm1); // Im(rho) + rho_rpi = _mm_adds_epi16(xmm2,xmm3); // rho = Re(rho) + Im(rho) + rho_rmi = _mm_subs_epi16(xmm2,xmm3); // rho* = Re(rho) - Im(rho) + + // Compute the different rhos + rho_rpi_1_1 = _mm_mulhi_epi16(rho_rpi,ONE_OVER_SQRT_10); + rho_rmi_1_1 = _mm_mulhi_epi16(rho_rmi,ONE_OVER_SQRT_10); + rho_rpi_3_3 = _mm_mulhi_epi16(rho_rpi,THREE_OVER_SQRT_10); + rho_rmi_3_3 = _mm_mulhi_epi16(rho_rmi,THREE_OVER_SQRT_10); + rho_rpi_3_3 = _mm_slli_epi16(rho_rpi_3_3,1); + rho_rmi_3_3 = _mm_slli_epi16(rho_rmi_3_3,1); + + xmm4 = _mm_mulhi_epi16(xmm2,ONE_OVER_SQRT_10); // Re(rho) + xmm5 = _mm_mulhi_epi16(xmm3,THREE_OVER_SQRT_10); // Im(rho) + xmm5 = _mm_slli_epi16(xmm5,1); + + rho_rpi_1_3 = _mm_adds_epi16(xmm4,xmm5); + rho_rmi_1_3 = _mm_subs_epi16(xmm4,xmm5); + + xmm6 = _mm_mulhi_epi16(xmm2,THREE_OVER_SQRT_10); // Re(rho) + xmm7 = _mm_mulhi_epi16(xmm3,ONE_OVER_SQRT_10); // Im(rho) + xmm6 = _mm_slli_epi16(xmm6,1); + + rho_rpi_3_1 = _mm_adds_epi16(xmm6,xmm7); + rho_rmi_3_1 = _mm_subs_epi16(xmm6,xmm7); + + // Rearrange interfering MF output + xmm0 = stream1_128i_in[i]; + xmm1 = stream1_128i_in[i+1]; + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + y1r = _mm_unpacklo_epi64(xmm0,xmm1); //[y1r(1),y1r(2),y1r(3),y1r(4)] + y1i = _mm_unpackhi_epi64(xmm0,xmm1); //[y1i(1),y1i(2),y1i(3),y1i(4)] + + xmm0 = _mm_setzero_si128(); // ZERO + xmm2 = _mm_subs_epi16(rho_rpi_1_1,y1r); // = [Re(rho)+ Im(rho)]/sqrt(10) - y1r + psi_r_p1_p1 = _mm_abs_epi16(xmm2); // = |[Re(rho)+ Im(rho)]/sqrt(10) - y1r| + + xmm2= _mm_subs_epi16(rho_rmi_1_1,y1r); + psi_r_p1_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rmi_1_1,y1i); + psi_i_p1_p1 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rpi_1_3,y1r); + psi_r_p1_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rmi_1_3,y1r); + psi_r_p1_m3 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rmi_3_1,y1i); + psi_i_p1_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rpi_3_1,y1r); + psi_r_p3_p1 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rmi_3_1,y1r); + psi_r_p3_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rmi_1_3,y1i); + psi_i_p3_p1 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rpi_3_3,y1r); + psi_r_p3_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rmi_3_3,y1r); + psi_r_p3_m3 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rmi_3_3,y1i); + psi_i_p3_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rpi_1_1,y1i); + psi_i_m1_p1 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rpi_3_1,y1i); + psi_i_m1_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rpi_1_3,y1i); + psi_i_m3_p1 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rpi_3_3,y1i); + psi_i_m3_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_1_1,y1i); + psi_i_p1_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_3_1,y1i); + psi_i_p1_m3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_1_3,y1i); + psi_i_p3_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_3_3,y1i); + psi_i_p3_m3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_1_1,y1r); + psi_r_m1_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_1_3,y1r); + psi_r_m1_m3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_3_1,y1r); + psi_r_m3_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_3_3,y1r); + psi_r_m3_m3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1r,rho_rmi_1_1); + psi_r_m1_p1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1r,rho_rmi_1_3); + psi_r_m1_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1i,rho_rmi_1_1); + psi_i_m1_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1i,rho_rmi_3_1); + psi_i_m1_m3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1r,rho_rmi_3_1); + psi_r_m3_p1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1r,rho_rmi_3_3); + psi_r_m3_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1i,rho_rmi_1_3); + psi_i_m3_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1i,rho_rmi_3_3); + psi_i_m3_m3 = _mm_abs_epi16(xmm2); + + // Rearrange desired MF output + xmm0 = stream0_128i_in[i]; + xmm1 = stream0_128i_in[i+1]; + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + y0r = _mm_unpacklo_epi64(xmm0,xmm1); // = [y0r(1),y0r(2),y0r(3),y0r(4)] + y0i = _mm_unpackhi_epi64(xmm0,xmm1); + + // Rearrange desired channel magnitudes + xmm2 = ch_mag_128i[i]; // = [|h|^2(1),|h|^2(1),|h|^2(2),|h|^2(2)]*(2/sqrt(10)) + xmm3 = ch_mag_128i[i+1]; // = [|h|^2(3),|h|^2(3),|h|^2(4),|h|^2(4)]*(2/sqrt(10)) + xmm2 = _mm_shufflelo_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shufflehi_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shuffle_epi32(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflelo_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflehi_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shuffle_epi32(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + + ch_mag_des = _mm_unpacklo_epi64(xmm2,xmm3); // = [|h|^2(1),|h|^2(2),|h|^2(3),|h|^2(4)]*(2/sqrt(10)) + + // Scale MF output of desired signal + y0r_over_sqrt10 = _mm_mulhi_epi16(y0r,ONE_OVER_SQRT_10); + y0i_over_sqrt10 = _mm_mulhi_epi16(y0i,ONE_OVER_SQRT_10); + y0r_three_over_sqrt10 = _mm_mulhi_epi16(y0r,THREE_OVER_SQRT_10); + y0i_three_over_sqrt10 = _mm_mulhi_epi16(y0i,THREE_OVER_SQRT_10); + y0r_three_over_sqrt10 = _mm_slli_epi16(y0r_three_over_sqrt10,1); + y0i_three_over_sqrt10 = _mm_slli_epi16(y0i_three_over_sqrt10,1); + + // Compute necessary combination of required terms + y0_p_1_1 = _mm_adds_epi16(y0r_over_sqrt10,y0i_over_sqrt10); + y0_m_1_1 = _mm_subs_epi16(y0r_over_sqrt10,y0i_over_sqrt10); + + y0_p_1_3 = _mm_adds_epi16(y0r_over_sqrt10,y0i_three_over_sqrt10); + y0_m_1_3 = _mm_subs_epi16(y0r_over_sqrt10,y0i_three_over_sqrt10); + + y0_p_3_1 = _mm_adds_epi16(y0r_three_over_sqrt10,y0i_over_sqrt10); + y0_m_3_1 = _mm_subs_epi16(y0r_three_over_sqrt10,y0i_over_sqrt10); + + y0_p_3_3 = _mm_adds_epi16(y0r_three_over_sqrt10,y0i_three_over_sqrt10); + y0_m_3_3 = _mm_subs_epi16(y0r_three_over_sqrt10,y0i_three_over_sqrt10); + + // Add psi + psi_a_p1_p1 = _mm_adds_epi16(psi_r_p1_p1 ,psi_i_p1_p1); + psi_a_p1_p3 = _mm_adds_epi16(psi_r_p1_p3 ,psi_i_p1_p3); + psi_a_p3_p1 = _mm_adds_epi16(psi_r_p3_p1 ,psi_i_p3_p1); + psi_a_p3_p3 = _mm_adds_epi16(psi_r_p3_p3 ,psi_i_p3_p3); + psi_a_p1_m1 = _mm_adds_epi16(psi_r_p1_m1 ,psi_i_p1_m1); + psi_a_p1_m3 = _mm_adds_epi16(psi_r_p1_m3 ,psi_i_p1_m3); + psi_a_p3_m1 = _mm_adds_epi16(psi_r_p3_m1 ,psi_i_p3_m1); + psi_a_p3_m3 = _mm_adds_epi16(psi_r_p3_m3 ,psi_i_p3_m3); + psi_a_m1_p1 = _mm_adds_epi16(psi_r_m1_p1 ,psi_i_m1_p1); + psi_a_m1_p3 = _mm_adds_epi16(psi_r_m1_p3 ,psi_i_m1_p3); + psi_a_m3_p1 = _mm_adds_epi16(psi_r_m3_p1 ,psi_i_m3_p1); + psi_a_m3_p3 = _mm_adds_epi16(psi_r_m3_p3 ,psi_i_m3_p3); + psi_a_m1_m1 = _mm_adds_epi16(psi_r_m1_m1 ,psi_i_m1_m1); + psi_a_m1_m3 = _mm_adds_epi16(psi_r_m1_m3 ,psi_i_m1_m3); + psi_a_m3_m1 = _mm_adds_epi16(psi_r_m3_m1 ,psi_i_m3_m1); + psi_a_m3_m3 = _mm_adds_epi16(psi_r_m3_m3 ,psi_i_m3_m3); + + // scale by sqrt(2) + psi_a_p1_p1 = _mm_mulhi_epi16(psi_a_p1_p1,ONE_OVER_SQRT_2); + psi_a_p1_p1 = _mm_slli_epi16(psi_a_p1_p1,1); + psi_a_p1_p3 = _mm_mulhi_epi16(psi_a_p1_p3,ONE_OVER_SQRT_2); + psi_a_p1_p3 = _mm_slli_epi16(psi_a_p1_p3,1); + psi_a_p3_p1 = _mm_mulhi_epi16(psi_a_p3_p1,ONE_OVER_SQRT_2); + psi_a_p3_p1 = _mm_slli_epi16(psi_a_p3_p1,1); + psi_a_p3_p3 = _mm_mulhi_epi16(psi_a_p3_p3,ONE_OVER_SQRT_2); + psi_a_p3_p3 = _mm_slli_epi16(psi_a_p3_p3,1); + + psi_a_p1_m1 = _mm_mulhi_epi16(psi_a_p1_m1,ONE_OVER_SQRT_2); + psi_a_p1_m1 = _mm_slli_epi16(psi_a_p1_m1,1); + psi_a_p1_m3 = _mm_mulhi_epi16(psi_a_p1_m3,ONE_OVER_SQRT_2); + psi_a_p1_m3 = _mm_slli_epi16(psi_a_p1_m3,1); + psi_a_p3_m1 = _mm_mulhi_epi16(psi_a_p3_m1,ONE_OVER_SQRT_2); + psi_a_p3_m1 = _mm_slli_epi16(psi_a_p3_m1,1); + psi_a_p3_m3 = _mm_mulhi_epi16(psi_a_p3_m3,ONE_OVER_SQRT_2); + psi_a_p3_m3 = _mm_slli_epi16(psi_a_p3_m3,1); + + psi_a_m1_p1 = _mm_mulhi_epi16(psi_a_m1_p1,ONE_OVER_SQRT_2); + psi_a_m1_p1 = _mm_slli_epi16(psi_a_m1_p1,1); + psi_a_m1_p3 = _mm_mulhi_epi16(psi_a_m1_p3,ONE_OVER_SQRT_2); + psi_a_m1_p3 = _mm_slli_epi16(psi_a_m1_p3,1); + psi_a_m3_p1 = _mm_mulhi_epi16(psi_a_m3_p1,ONE_OVER_SQRT_2); + psi_a_m3_p1 = _mm_slli_epi16(psi_a_m3_p1,1); + psi_a_m3_p3 = _mm_mulhi_epi16(psi_a_m3_p3,ONE_OVER_SQRT_2); + psi_a_m3_p3 = _mm_slli_epi16(psi_a_m3_p3,1); + + psi_a_m1_m1 = _mm_mulhi_epi16(psi_a_m1_m1,ONE_OVER_SQRT_2); + psi_a_m1_m1 = _mm_slli_epi16(psi_a_m1_m1,1); + psi_a_m1_m3 = _mm_mulhi_epi16(psi_a_m1_m3,ONE_OVER_SQRT_2); + psi_a_m1_m3 = _mm_slli_epi16(psi_a_m1_m3,1); + psi_a_m3_m1 = _mm_mulhi_epi16(psi_a_m3_m1,ONE_OVER_SQRT_2); + psi_a_m3_m1 = _mm_slli_epi16(psi_a_m3_m1,1); + psi_a_m3_m3 = _mm_mulhi_epi16(psi_a_m3_m3,ONE_OVER_SQRT_2); + psi_a_m3_m3 = _mm_slli_epi16(psi_a_m3_m3,1); + + // Computing different multiples of channel norms + ch_mag_over_10=_mm_mulhi_epi16(ch_mag_des, ONE_OVER_TWO_SQRT_10); + ch_mag_over_2=_mm_mulhi_epi16(ch_mag_des, SQRT_10_OVER_FOUR); + ch_mag_over_2=_mm_slli_epi16(ch_mag_over_2, 1); + ch_mag_9_over_10=_mm_mulhi_epi16(ch_mag_des, NINE_OVER_TWO_SQRT_10); + ch_mag_9_over_10=_mm_slli_epi16(ch_mag_9_over_10, 2); + + // Computing Metrics + xmm1 = _mm_adds_epi16(psi_a_p1_p1, y0_p_1_1); + bit_met_p1_p1= _mm_subs_epi16(xmm1, ch_mag_over_10); + + xmm1 = _mm_adds_epi16(psi_a_p1_p3, y0_p_1_3); + bit_met_p1_p3= _mm_subs_epi16(xmm1, ch_mag_over_2); + + xmm1 = _mm_adds_epi16(psi_a_p1_m1, y0_m_1_1); + bit_met_p1_m1= _mm_subs_epi16(xmm1, ch_mag_over_10); + + xmm1 = _mm_adds_epi16(psi_a_p1_m3, y0_m_1_3); + bit_met_p1_m3= _mm_subs_epi16(xmm1, ch_mag_over_2); + + xmm1 = _mm_adds_epi16(psi_a_p3_p1, y0_p_3_1); + bit_met_p3_p1= _mm_subs_epi16(xmm1, ch_mag_over_2); + + xmm1 = _mm_adds_epi16(psi_a_p3_p3, y0_p_3_3); + bit_met_p3_p3= _mm_subs_epi16(xmm1, ch_mag_9_over_10); + + xmm1 = _mm_adds_epi16(psi_a_p3_m1, y0_m_3_1); + bit_met_p3_m1= _mm_subs_epi16(xmm1, ch_mag_over_2); + + xmm1 = _mm_adds_epi16(psi_a_p3_m3, y0_m_3_3); + bit_met_p3_m3= _mm_subs_epi16(xmm1, ch_mag_9_over_10); + + xmm1 = _mm_subs_epi16(psi_a_m1_p1, y0_m_1_1); + bit_met_m1_p1= _mm_subs_epi16(xmm1, ch_mag_over_10); + + xmm1 = _mm_subs_epi16(psi_a_m1_p3, y0_m_1_3); + bit_met_m1_p3= _mm_subs_epi16(xmm1, ch_mag_over_2); + + xmm1 = _mm_subs_epi16(psi_a_m1_m1, y0_p_1_1); + bit_met_m1_m1= _mm_subs_epi16(xmm1, ch_mag_over_10); + + xmm1 = _mm_subs_epi16(psi_a_m1_m3, y0_p_1_3); + bit_met_m1_m3= _mm_subs_epi16(xmm1, ch_mag_over_2); + + xmm1 = _mm_subs_epi16(psi_a_m3_p1, y0_m_3_1); + bit_met_m3_p1= _mm_subs_epi16(xmm1, ch_mag_over_2); + + xmm1 = _mm_subs_epi16(psi_a_m3_p3, y0_m_3_3); + bit_met_m3_p3= _mm_subs_epi16(xmm1, ch_mag_9_over_10); + + xmm1 = _mm_subs_epi16(psi_a_m3_m1, y0_p_3_1); + bit_met_m3_m1= _mm_subs_epi16(xmm1, ch_mag_over_2); + + xmm1 = _mm_subs_epi16(psi_a_m3_m3, y0_p_3_3); + bit_met_m3_m3= _mm_subs_epi16(xmm1, ch_mag_9_over_10); + + // LLR of the first bit + // Bit = 1 + xmm0 = _mm_max_epi16(bit_met_m1_p1,bit_met_m1_p3); + xmm1 = _mm_max_epi16(bit_met_m1_m1,bit_met_m1_m3); + xmm2 = _mm_max_epi16(bit_met_m3_p1,bit_met_m3_p3); + xmm3 = _mm_max_epi16(bit_met_m3_m1,bit_met_m3_m3); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_num_re0= _mm_max_epi16(xmm4,xmm5); + + // Bit = 0 + xmm0 = _mm_max_epi16(bit_met_p1_p1,bit_met_p1_p3); + xmm1 = _mm_max_epi16(bit_met_p1_m1,bit_met_p1_m3); + xmm2 = _mm_max_epi16(bit_met_p3_p1,bit_met_p3_p3); + xmm3 = _mm_max_epi16(bit_met_p3_m1,bit_met_p3_m3); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_den_re0 = _mm_max_epi16(xmm4,xmm5); + + // LLR of first bit [L1(1), L1(2), L1(3), L1(4), L1(5), L1(6), L1(7), L1(8)] + y0r = _mm_subs_epi16(logmax_den_re0,logmax_num_re0); + + // LLR of the second bit + // Bit = 1 + xmm0 = _mm_max_epi16(bit_met_p1_m1,bit_met_p3_m1); + xmm1 = _mm_max_epi16(bit_met_m1_m1,bit_met_m3_m1); + xmm2 = _mm_max_epi16(bit_met_p1_m3,bit_met_p3_m3); + xmm3 = _mm_max_epi16(bit_met_m1_m3,bit_met_m3_m3); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_num_re1 = _mm_max_epi16(xmm4,xmm5); + + // Bit = 0 + xmm0 = _mm_max_epi16(bit_met_p1_p1,bit_met_p3_p1); + xmm1 = _mm_max_epi16(bit_met_m1_p1,bit_met_m3_p1); + xmm2 = _mm_max_epi16(bit_met_p1_p3,bit_met_p3_p3); + xmm3 = _mm_max_epi16(bit_met_m1_p3,bit_met_m3_p3); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_den_re1 = _mm_max_epi16(xmm4,xmm5); + + // LLR of second bit [L2(1), L2(2), L2(3), L2(4)] + y1r = _mm_subs_epi16(logmax_den_re1,logmax_num_re1); + + // LLR of the third bit + // Bit = 1 + xmm0 = _mm_max_epi16(bit_met_m3_p1,bit_met_m3_p3); + xmm1 = _mm_max_epi16(bit_met_m3_m1,bit_met_m3_m3); + xmm2 = _mm_max_epi16(bit_met_p3_p1,bit_met_p3_p3); + xmm3 = _mm_max_epi16(bit_met_p3_m1,bit_met_p3_m3); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_num_im0 = _mm_max_epi16(xmm4,xmm5); + + // Bit = 0 + xmm0 = _mm_max_epi16(bit_met_m1_p1,bit_met_m1_p3); + xmm1 = _mm_max_epi16(bit_met_m1_m1,bit_met_m1_m3); + xmm2 = _mm_max_epi16(bit_met_p1_p1,bit_met_p1_p3); + xmm3 = _mm_max_epi16(bit_met_p1_m1,bit_met_p1_m3); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_den_im0 = _mm_max_epi16(xmm4,xmm5); + + // LLR of third bit [L3(1), L3(2), L3(3), L3(4)] + y0i = _mm_subs_epi16(logmax_den_im0,logmax_num_im0); + + // LLR of the fourth bit + // Bit = 1 + xmm0 = _mm_max_epi16(bit_met_p1_m3,bit_met_p3_m3); + xmm1 = _mm_max_epi16(bit_met_m1_m3,bit_met_m3_m3); + xmm2 = _mm_max_epi16(bit_met_p1_p3,bit_met_p3_p3); + xmm3 = _mm_max_epi16(bit_met_m1_p3,bit_met_m3_p3); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_num_im1 = _mm_max_epi16(xmm4,xmm5); + + // Bit = 0 + xmm0 = _mm_max_epi16(bit_met_p1_m1,bit_met_p3_m1); + xmm1 = _mm_max_epi16(bit_met_m1_m1,bit_met_m3_m1); + xmm2 = _mm_max_epi16(bit_met_p1_p1,bit_met_p3_p1); + xmm3 = _mm_max_epi16(bit_met_m1_p1,bit_met_m3_p1); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_den_im1 = _mm_max_epi16(xmm4,xmm5); + + // LLR of fourth bit [L4(1), L4(2), L4(3), L4(4)] + y1i = _mm_subs_epi16(logmax_den_im1,logmax_num_im1); + + // Pack LLRs in output + // [L1(1), L2(1), L1(2), L2(2), L1(3), L2(3), L1(4), L2(4)] + xmm0 = _mm_unpacklo_epi16(y0r,y1r); + // [L1(5), L2(5), L1(6), L2(6), L1(7), L2(7), L1(8), L2(8)] + xmm1 = _mm_unpackhi_epi16(y0r,y1r); + // [L3(1), L4(1), L3(2), L4(2), L3(3), L4(3), L3(4), L4(4)] + xmm2 = _mm_unpacklo_epi16(y0i,y1i); + // [L3(5), L4(5), L3(6), L4(6), L3(7), L4(7), L3(8), L4(8)] + xmm3 = _mm_unpackhi_epi16(y0i,y1i); + + stream0_128i_out[2*i+0] = _mm_unpacklo_epi32(xmm0,xmm2); // 8LLRs, 2REs + stream0_128i_out[2*i+1] = _mm_unpackhi_epi32(xmm0,xmm2); + stream0_128i_out[2*i+2] = _mm_unpacklo_epi32(xmm1,xmm3); + stream0_128i_out[2*i+3] = _mm_unpackhi_epi32(xmm1,xmm3); + +#elif defined(__arm__) + +#endif + } + +#if defined(__x86_64__) || defined(__i386__) + _mm_empty(); + _m_empty(); +#endif + +} + +int dlsch_16qam_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, + int32_t **rxdataF_comp, + int32_t **rxdataF_comp_i, + int32_t **dl_ch_mag, //|h_0|^2*(2/sqrt{10}) + int32_t **rho_i, + int16_t *dlsch_llr, + uint8_t symbol, + uint8_t first_symbol_flag, + uint16_t nb_rb, + uint16_t pbch_pss_sss_adjust, + int16_t **llr16p) +{ + + int16_t *rxF = (int16_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *rxF_i = (int16_t*)&rxdataF_comp_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *ch_mag = (int16_t*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *rho = (int16_t*)&rho_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *llr16; + int len; + uint8_t symbol_mod = (symbol >= (7-frame_parms->Ncp))? (symbol-(7-frame_parms->Ncp)) : symbol; + + // first symbol has different structure due to more pilots + if (first_symbol_flag == 1) { + llr16 = (int16_t*)dlsch_llr; + } else { + llr16 = (int16_t*)(*llr16p); + } + + AssertFatal(llr16!=NULL,"dlsch_16qam_qpsk_llr: llr is null, symbol %d\n",symbol); + + if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { + // if symbol has pilots + if (frame_parms->nb_antenna_ports_eNB!=1) + // in 2 antenna ports we have 8 REs per symbol per RB + len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); + else + // for 1 antenna port we have 10 REs per symbol per RB + len = (nb_rb*10) - (5*pbch_pss_sss_adjust/6); + } else { + // symbol has no pilots + len = (nb_rb*12) - pbch_pss_sss_adjust; + } + + // printf("symbol %d: qam16_llr, len %d (llr16 %p)\n",symbol,len,llr16); + + qam16_qpsk((short *)rxF, + (short *)rxF_i, + (short *)ch_mag, + (short *)llr16, + (short *)rho, + len); + + llr16 += (len<<2); + *llr16p = (short *)llr16; + + return(0); +} + +void qam16_qam16(short *stream0_in, + short *stream1_in, + short *ch_mag, + short *ch_mag_i, + short *stream0_out, + short *rho01, + int length + ) +{ + + /* + Author: Sebastian Wagner + Date: 2012-06-04 + + Input: + stream0_in: MF filter for 1st stream, i.e., y0=h0'*y + stream!_in: MF filter for 2nd stream, i.e., y1=h1'*y + ch_mag: 2*h0/sqrt(00), [Re0 Im0 Re1 Im1] s.t. Im0=Re0, Im1=Re1, etc + ch_mag_i: 2*h1/sqrt(00), [Re0 Im0 Re1 Im1] s.t. Im0=Re0, Im1=Re1, etc + rho01: Channel cross correlation, i.e., h1'*h0 + + Output: + stream0_out: output LLRs for 1st stream + */ +#if defined(__x86_64__) || defined(__i386__) + __m128i *rho01_128i = (__m128i *)rho01; + __m128i *stream0_128i_in = (__m128i *)stream0_in; + __m128i *stream1_128i_in = (__m128i *)stream1_in; + __m128i *stream0_128i_out = (__m128i *)stream0_out; + __m128i *ch_mag_128i = (__m128i *)ch_mag; + __m128i *ch_mag_128i_i = (__m128i *)ch_mag_i; + + + + __m128i ONE_OVER_SQRT_10 = _mm_set1_epi16(20724); // round(1/sqrt(10)*2^16) + __m128i ONE_OVER_SQRT_10_Q15 = _mm_set1_epi16(10362); // round(1/sqrt(10)*2^15) + __m128i THREE_OVER_SQRT_10 = _mm_set1_epi16(31086); // round(3/sqrt(10)*2^15) + __m128i SQRT_10_OVER_FOUR = _mm_set1_epi16(25905); // round(sqrt(10)/4*2^15) + __m128i ONE_OVER_TWO_SQRT_10 = _mm_set1_epi16(10362); // round(1/2/sqrt(10)*2^16) + __m128i NINE_OVER_TWO_SQRT_10 = _mm_set1_epi16(23315); // round(9/2/sqrt(10)*2^14) + __m128i ch_mag_des,ch_mag_int; + __m128i y0r_over_sqrt10; + __m128i y0i_over_sqrt10; + __m128i y0r_three_over_sqrt10; + __m128i y0i_three_over_sqrt10; + __m128i ch_mag_over_10; + __m128i ch_mag_over_2; + __m128i ch_mag_9_over_10; +#elif defined(__arm__) + +#endif + + int i; + + for (i=0; i>2; i+=2) { + // In one iteration, we deal with 8 REs + +#if defined(__x86_64__) || defined(__i386__) + // Get rho + xmm0 = rho01_128i[i]; + xmm1 = rho01_128i[i+1]; + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + xmm2 = _mm_unpacklo_epi64(xmm0,xmm1); // Re(rho) + xmm3 = _mm_unpackhi_epi64(xmm0,xmm1); // Im(rho) + rho_rpi = _mm_adds_epi16(xmm2,xmm3); // rho = Re(rho) + Im(rho) + rho_rmi = _mm_subs_epi16(xmm2,xmm3); // rho* = Re(rho) - Im(rho) + + // Compute the different rhos + rho_rpi_1_1 = _mm_mulhi_epi16(rho_rpi,ONE_OVER_SQRT_10); + rho_rmi_1_1 = _mm_mulhi_epi16(rho_rmi,ONE_OVER_SQRT_10); + rho_rpi_3_3 = _mm_mulhi_epi16(rho_rpi,THREE_OVER_SQRT_10); + rho_rmi_3_3 = _mm_mulhi_epi16(rho_rmi,THREE_OVER_SQRT_10); + rho_rpi_3_3 = _mm_slli_epi16(rho_rpi_3_3,1); + rho_rmi_3_3 = _mm_slli_epi16(rho_rmi_3_3,1); + + xmm4 = _mm_mulhi_epi16(xmm2,ONE_OVER_SQRT_10); // Re(rho) + xmm5 = _mm_mulhi_epi16(xmm3,THREE_OVER_SQRT_10); // Im(rho) + xmm5 = _mm_slli_epi16(xmm5,1); + + rho_rpi_1_3 = _mm_adds_epi16(xmm4,xmm5); + rho_rmi_1_3 = _mm_subs_epi16(xmm4,xmm5); + + xmm6 = _mm_mulhi_epi16(xmm2,THREE_OVER_SQRT_10); // Re(rho) + xmm7 = _mm_mulhi_epi16(xmm3,ONE_OVER_SQRT_10); // Im(rho) + xmm6 = _mm_slli_epi16(xmm6,1); + + rho_rpi_3_1 = _mm_adds_epi16(xmm6,xmm7); + rho_rmi_3_1 = _mm_subs_epi16(xmm6,xmm7); + + // Rearrange interfering MF output + xmm0 = stream1_128i_in[i]; + xmm1 = stream1_128i_in[i+1]; + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + y1r = _mm_unpacklo_epi64(xmm0,xmm1); //[y1r(1),y1r(2),y1r(3),y1r(4)] + y1i = _mm_unpackhi_epi64(xmm0,xmm1); //[y1i(1),y1i(2),y1i(3),y1i(4)] + + xmm0 = _mm_setzero_si128(); // ZERO + xmm2 = _mm_subs_epi16(rho_rpi_1_1,y1r); // = [Re(rho)+ Im(rho)]/sqrt(10) - y1r + psi_r_p1_p1 = _mm_abs_epi16(xmm2); // = |[Re(rho)+ Im(rho)]/sqrt(10) - y1r| + + xmm2= _mm_subs_epi16(rho_rmi_1_1,y1r); + psi_r_p1_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rmi_1_1,y1i); + psi_i_p1_p1 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rpi_1_3,y1r); + psi_r_p1_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rmi_1_3,y1r); + psi_r_p1_m3 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rmi_3_1,y1i); + psi_i_p1_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rpi_3_1,y1r); + psi_r_p3_p1 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rmi_3_1,y1r); + psi_r_p3_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rmi_1_3,y1i); + psi_i_p3_p1 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rpi_3_3,y1r); + psi_r_p3_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rmi_3_3,y1r); + psi_r_p3_m3 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rmi_3_3,y1i); + psi_i_p3_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rpi_1_1,y1i); + psi_i_m1_p1 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rpi_3_1,y1i); + psi_i_m1_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rpi_1_3,y1i); + psi_i_m3_p1 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rpi_3_3,y1i); + psi_i_m3_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_1_1,y1i); + psi_i_p1_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_3_1,y1i); + psi_i_p1_m3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_1_3,y1i); + psi_i_p3_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_3_3,y1i); + psi_i_p3_m3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_1_1,y1r); + psi_r_m1_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_1_3,y1r); + psi_r_m1_m3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_3_1,y1r); + psi_r_m3_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_3_3,y1r); + psi_r_m3_m3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1r,rho_rmi_1_1); + psi_r_m1_p1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1r,rho_rmi_1_3); + psi_r_m1_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1i,rho_rmi_1_1); + psi_i_m1_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1i,rho_rmi_3_1); + psi_i_m1_m3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1r,rho_rmi_3_1); + psi_r_m3_p1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1r,rho_rmi_3_3); + psi_r_m3_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1i,rho_rmi_1_3); + psi_i_m3_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1i,rho_rmi_3_3); + psi_i_m3_m3 = _mm_abs_epi16(xmm2); + + // Rearrange desired MF output + xmm0 = stream0_128i_in[i]; + xmm1 = stream0_128i_in[i+1]; + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + y0r = _mm_unpacklo_epi64(xmm0,xmm1); // = [y0r(1),y0r(2),y0r(3),y0r(4)] + y0i = _mm_unpackhi_epi64(xmm0,xmm1); + + // Rearrange desired channel magnitudes + xmm2 = ch_mag_128i[i]; // = [|h|^2(1),|h|^2(1),|h|^2(2),|h|^2(2)]*(2/sqrt(10)) + xmm3 = ch_mag_128i[i+1]; // = [|h|^2(3),|h|^2(3),|h|^2(4),|h|^2(4)]*(2/sqrt(10)) + xmm2 = _mm_shufflelo_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shufflehi_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shuffle_epi32(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflelo_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflehi_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shuffle_epi32(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + + ch_mag_des = _mm_unpacklo_epi64(xmm2,xmm3); // = [|h|^2(1),|h|^2(2),|h|^2(3),|h|^2(4)]*(2/sqrt(10)) + + // Rearrange interfering channel magnitudes + xmm2 = ch_mag_128i_i[i]; + xmm3 = ch_mag_128i_i[i+1]; + + xmm2 = _mm_shufflelo_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shufflehi_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shuffle_epi32(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflelo_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflehi_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shuffle_epi32(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + + ch_mag_int = _mm_unpacklo_epi64(xmm2,xmm3); + + // Scale MF output of desired signal + y0r_over_sqrt10 = _mm_mulhi_epi16(y0r,ONE_OVER_SQRT_10); + y0i_over_sqrt10 = _mm_mulhi_epi16(y0i,ONE_OVER_SQRT_10); + y0r_three_over_sqrt10 = _mm_mulhi_epi16(y0r,THREE_OVER_SQRT_10); + y0i_three_over_sqrt10 = _mm_mulhi_epi16(y0i,THREE_OVER_SQRT_10); + y0r_three_over_sqrt10 = _mm_slli_epi16(y0r_three_over_sqrt10,1); + y0i_three_over_sqrt10 = _mm_slli_epi16(y0i_three_over_sqrt10,1); + + // Compute necessary combination of required terms + y0_p_1_1 = _mm_adds_epi16(y0r_over_sqrt10,y0i_over_sqrt10); + y0_m_1_1 = _mm_subs_epi16(y0r_over_sqrt10,y0i_over_sqrt10); + + y0_p_1_3 = _mm_adds_epi16(y0r_over_sqrt10,y0i_three_over_sqrt10); + y0_m_1_3 = _mm_subs_epi16(y0r_over_sqrt10,y0i_three_over_sqrt10); + + y0_p_3_1 = _mm_adds_epi16(y0r_three_over_sqrt10,y0i_over_sqrt10); + y0_m_3_1 = _mm_subs_epi16(y0r_three_over_sqrt10,y0i_over_sqrt10); + + y0_p_3_3 = _mm_adds_epi16(y0r_three_over_sqrt10,y0i_three_over_sqrt10); + y0_m_3_3 = _mm_subs_epi16(y0r_three_over_sqrt10,y0i_three_over_sqrt10); + + // Compute optimal interfering symbol magnitude + interference_abs_epi16(psi_r_p1_p1 ,ch_mag_int,a_r_p1_p1,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p1_p1 ,ch_mag_int,a_i_p1_p1,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p1_p3 ,ch_mag_int,a_r_p1_p3,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p1_p3 ,ch_mag_int,a_i_p1_p3,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p1_m1 ,ch_mag_int,a_r_p1_m1,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p1_m1 ,ch_mag_int,a_i_p1_m1,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p1_m3 ,ch_mag_int,a_r_p1_m3,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p1_m3 ,ch_mag_int,a_i_p1_m3,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p3_p1 ,ch_mag_int,a_r_p3_p1,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p3_p1 ,ch_mag_int,a_i_p3_p1,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p3_p3 ,ch_mag_int,a_r_p3_p3,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p3_p3 ,ch_mag_int,a_i_p3_p3,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p3_m1 ,ch_mag_int,a_r_p3_m1,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p3_m1 ,ch_mag_int,a_i_p3_m1,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p3_m3 ,ch_mag_int,a_r_p3_m3,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p3_m3 ,ch_mag_int,a_i_p3_m3,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m1_p1 ,ch_mag_int,a_r_m1_p1,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m1_p1 ,ch_mag_int,a_i_m1_p1,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m1_p3 ,ch_mag_int,a_r_m1_p3,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m1_p3 ,ch_mag_int,a_i_m1_p3,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m1_m1 ,ch_mag_int,a_r_m1_m1,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m1_m1 ,ch_mag_int,a_i_m1_m1,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m1_m3 ,ch_mag_int,a_r_m1_m3,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m1_m3 ,ch_mag_int,a_i_m1_m3,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m3_p1 ,ch_mag_int,a_r_m3_p1,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m3_p1 ,ch_mag_int,a_i_m3_p1,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m3_p3 ,ch_mag_int,a_r_m3_p3,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m3_p3 ,ch_mag_int,a_i_m3_p3,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m3_m1 ,ch_mag_int,a_r_m3_m1,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m3_m1 ,ch_mag_int,a_i_m3_m1,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m3_m3 ,ch_mag_int,a_r_m3_m3,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m3_m3 ,ch_mag_int,a_i_m3_m3,ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + + // Calculation of groups of two terms in the bit metric involving product of psi and interference magnitude + prodsum_psi_a_epi16(psi_r_p1_p1,a_r_p1_p1,psi_i_p1_p1,a_i_p1_p1,psi_a_p1_p1); + prodsum_psi_a_epi16(psi_r_p1_p3,a_r_p1_p3,psi_i_p1_p3,a_i_p1_p3,psi_a_p1_p3); + prodsum_psi_a_epi16(psi_r_p3_p1,a_r_p3_p1,psi_i_p3_p1,a_i_p3_p1,psi_a_p3_p1); + prodsum_psi_a_epi16(psi_r_p3_p3,a_r_p3_p3,psi_i_p3_p3,a_i_p3_p3,psi_a_p3_p3); + prodsum_psi_a_epi16(psi_r_p1_m1,a_r_p1_m1,psi_i_p1_m1,a_i_p1_m1,psi_a_p1_m1); + prodsum_psi_a_epi16(psi_r_p1_m3,a_r_p1_m3,psi_i_p1_m3,a_i_p1_m3,psi_a_p1_m3); + prodsum_psi_a_epi16(psi_r_p3_m1,a_r_p3_m1,psi_i_p3_m1,a_i_p3_m1,psi_a_p3_m1); + prodsum_psi_a_epi16(psi_r_p3_m3,a_r_p3_m3,psi_i_p3_m3,a_i_p3_m3,psi_a_p3_m3); + prodsum_psi_a_epi16(psi_r_m1_p1,a_r_m1_p1,psi_i_m1_p1,a_i_m1_p1,psi_a_m1_p1); + prodsum_psi_a_epi16(psi_r_m1_p3,a_r_m1_p3,psi_i_m1_p3,a_i_m1_p3,psi_a_m1_p3); + prodsum_psi_a_epi16(psi_r_m3_p1,a_r_m3_p1,psi_i_m3_p1,a_i_m3_p1,psi_a_m3_p1); + prodsum_psi_a_epi16(psi_r_m3_p3,a_r_m3_p3,psi_i_m3_p3,a_i_m3_p3,psi_a_m3_p3); + prodsum_psi_a_epi16(psi_r_m1_m1,a_r_m1_m1,psi_i_m1_m1,a_i_m1_m1,psi_a_m1_m1); + prodsum_psi_a_epi16(psi_r_m1_m3,a_r_m1_m3,psi_i_m1_m3,a_i_m1_m3,psi_a_m1_m3); + prodsum_psi_a_epi16(psi_r_m3_m1,a_r_m3_m1,psi_i_m3_m1,a_i_m3_m1,psi_a_m3_m1); + prodsum_psi_a_epi16(psi_r_m3_m3,a_r_m3_m3,psi_i_m3_m3,a_i_m3_m3,psi_a_m3_m3); + + + // squared interference magnitude times int. ch. power + square_a_epi16(a_r_p1_p1,a_i_p1_p1,ch_mag_int,SQRT_10_OVER_FOUR,a_sq_p1_p1); + square_a_epi16(a_r_p1_p3,a_i_p1_p3,ch_mag_int,SQRT_10_OVER_FOUR,a_sq_p1_p3); + square_a_epi16(a_r_p3_p1,a_i_p3_p1,ch_mag_int,SQRT_10_OVER_FOUR,a_sq_p3_p1); + square_a_epi16(a_r_p3_p3,a_i_p3_p3,ch_mag_int,SQRT_10_OVER_FOUR,a_sq_p3_p3); + square_a_epi16(a_r_p1_m1,a_i_p1_m1,ch_mag_int,SQRT_10_OVER_FOUR,a_sq_p1_m1); + square_a_epi16(a_r_p1_m3,a_i_p1_m3,ch_mag_int,SQRT_10_OVER_FOUR,a_sq_p1_m3); + square_a_epi16(a_r_p3_m1,a_i_p3_m1,ch_mag_int,SQRT_10_OVER_FOUR,a_sq_p3_m1); + square_a_epi16(a_r_p3_m3,a_i_p3_m3,ch_mag_int,SQRT_10_OVER_FOUR,a_sq_p3_m3); + square_a_epi16(a_r_m1_p1,a_i_m1_p1,ch_mag_int,SQRT_10_OVER_FOUR,a_sq_m1_p1); + square_a_epi16(a_r_m1_p3,a_i_m1_p3,ch_mag_int,SQRT_10_OVER_FOUR,a_sq_m1_p3); + square_a_epi16(a_r_m3_p1,a_i_m3_p1,ch_mag_int,SQRT_10_OVER_FOUR,a_sq_m3_p1); + square_a_epi16(a_r_m3_p3,a_i_m3_p3,ch_mag_int,SQRT_10_OVER_FOUR,a_sq_m3_p3); + square_a_epi16(a_r_m1_m1,a_i_m1_m1,ch_mag_int,SQRT_10_OVER_FOUR,a_sq_m1_m1); + square_a_epi16(a_r_m1_m3,a_i_m1_m3,ch_mag_int,SQRT_10_OVER_FOUR,a_sq_m1_m3); + square_a_epi16(a_r_m3_m1,a_i_m3_m1,ch_mag_int,SQRT_10_OVER_FOUR,a_sq_m3_m1); + square_a_epi16(a_r_m3_m3,a_i_m3_m3,ch_mag_int,SQRT_10_OVER_FOUR,a_sq_m3_m3); + + // Computing different multiples of channel norms + ch_mag_over_10=_mm_mulhi_epi16(ch_mag_des, ONE_OVER_TWO_SQRT_10); + ch_mag_over_2=_mm_mulhi_epi16(ch_mag_des, SQRT_10_OVER_FOUR); + ch_mag_over_2=_mm_slli_epi16(ch_mag_over_2, 1); + ch_mag_9_over_10=_mm_mulhi_epi16(ch_mag_des, NINE_OVER_TWO_SQRT_10); + ch_mag_9_over_10=_mm_slli_epi16(ch_mag_9_over_10, 2); + + // Computing Metrics + xmm0 = _mm_subs_epi16(psi_a_p1_p1,a_sq_p1_p1); + xmm1 = _mm_adds_epi16(xmm0,y0_p_1_1); + bit_met_p1_p1= _mm_subs_epi16(xmm1,ch_mag_over_10); + + xmm0 = _mm_subs_epi16(psi_a_p1_p3,a_sq_p1_p3); + xmm1 = _mm_adds_epi16(xmm0,y0_p_1_3); + bit_met_p1_p3= _mm_subs_epi16(xmm1,ch_mag_over_2); + + xmm0 = _mm_subs_epi16(psi_a_p1_m1,a_sq_p1_m1); + xmm1 = _mm_adds_epi16(xmm0,y0_m_1_1); + bit_met_p1_m1= _mm_subs_epi16(xmm1,ch_mag_over_10); + + xmm0 = _mm_subs_epi16(psi_a_p1_m3,a_sq_p1_m3); + xmm1 = _mm_adds_epi16(xmm0,y0_m_1_3); + bit_met_p1_m3= _mm_subs_epi16(xmm1,ch_mag_over_2); + + xmm0 = _mm_subs_epi16(psi_a_p3_p1,a_sq_p3_p1); + xmm1 = _mm_adds_epi16(xmm0,y0_p_3_1); + bit_met_p3_p1= _mm_subs_epi16(xmm1,ch_mag_over_2); + + xmm0 = _mm_subs_epi16(psi_a_p3_p3,a_sq_p3_p3); + xmm1 = _mm_adds_epi16(xmm0,y0_p_3_3); + bit_met_p3_p3= _mm_subs_epi16(xmm1,ch_mag_9_over_10); + + xmm0 = _mm_subs_epi16(psi_a_p3_m1,a_sq_p3_m1); + xmm1 = _mm_adds_epi16(xmm0,y0_m_3_1); + bit_met_p3_m1= _mm_subs_epi16(xmm1,ch_mag_over_2); + + xmm0 = _mm_subs_epi16(psi_a_p3_m3,a_sq_p3_m3); + xmm1 = _mm_adds_epi16(xmm0,y0_m_3_3); + bit_met_p3_m3= _mm_subs_epi16(xmm1,ch_mag_9_over_10); + + xmm0 = _mm_subs_epi16(psi_a_m1_p1,a_sq_m1_p1); + xmm1 = _mm_subs_epi16(xmm0,y0_m_1_1); + bit_met_m1_p1= _mm_subs_epi16(xmm1,ch_mag_over_10); + + xmm0 = _mm_subs_epi16(psi_a_m1_p3,a_sq_m1_p3); + xmm1 = _mm_subs_epi16(xmm0,y0_m_1_3); + bit_met_m1_p3= _mm_subs_epi16(xmm1,ch_mag_over_2); + + xmm0 = _mm_subs_epi16(psi_a_m1_m1,a_sq_m1_m1); + xmm1 = _mm_subs_epi16(xmm0,y0_p_1_1); + bit_met_m1_m1= _mm_subs_epi16(xmm1,ch_mag_over_10); + + xmm0 = _mm_subs_epi16(psi_a_m1_m3,a_sq_m1_m3); + xmm1 = _mm_subs_epi16(xmm0,y0_p_1_3); + bit_met_m1_m3= _mm_subs_epi16(xmm1,ch_mag_over_2); + + xmm0 = _mm_subs_epi16(psi_a_m3_p1,a_sq_m3_p1); + xmm1 = _mm_subs_epi16(xmm0,y0_m_3_1); + bit_met_m3_p1= _mm_subs_epi16(xmm1,ch_mag_over_2); + + xmm0 = _mm_subs_epi16(psi_a_m3_p3,a_sq_m3_p3); + xmm1 = _mm_subs_epi16(xmm0,y0_m_3_3); + bit_met_m3_p3= _mm_subs_epi16(xmm1,ch_mag_9_over_10); + + xmm0 = _mm_subs_epi16(psi_a_m3_m1,a_sq_m3_m1); + xmm1 = _mm_subs_epi16(xmm0,y0_p_3_1); + bit_met_m3_m1= _mm_subs_epi16(xmm1,ch_mag_over_2); + + xmm0 = _mm_subs_epi16(psi_a_m3_m3,a_sq_m3_m3); + xmm1 = _mm_subs_epi16(xmm0,y0_p_3_3); + bit_met_m3_m3= _mm_subs_epi16(xmm1,ch_mag_9_over_10); + + // LLR of the first bit + // Bit = 1 + xmm0 = _mm_max_epi16(bit_met_m1_p1,bit_met_m1_p3); + xmm1 = _mm_max_epi16(bit_met_m1_m1,bit_met_m1_m3); + xmm2 = _mm_max_epi16(bit_met_m3_p1,bit_met_m3_p3); + xmm3 = _mm_max_epi16(bit_met_m3_m1,bit_met_m3_m3); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_num_re0= _mm_max_epi16(xmm4,xmm5); + + // Bit = 0 + xmm0 = _mm_max_epi16(bit_met_p1_p1,bit_met_p1_p3); + xmm1 = _mm_max_epi16(bit_met_p1_m1,bit_met_p1_m3); + xmm2 = _mm_max_epi16(bit_met_p3_p1,bit_met_p3_p3); + xmm3 = _mm_max_epi16(bit_met_p3_m1,bit_met_p3_m3); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_den_re0 = _mm_max_epi16(xmm4,xmm5); + + // LLR of first bit [L1(1), L1(2), L1(3), L1(4), L1(5), L1(6), L1(7), L1(8)] + y0r = _mm_subs_epi16(logmax_den_re0,logmax_num_re0); + + // LLR of the second bit + // Bit = 1 + xmm0 = _mm_max_epi16(bit_met_p1_m1,bit_met_p3_m1); + xmm1 = _mm_max_epi16(bit_met_m1_m1,bit_met_m3_m1); + xmm2 = _mm_max_epi16(bit_met_p1_m3,bit_met_p3_m3); + xmm3 = _mm_max_epi16(bit_met_m1_m3,bit_met_m3_m3); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_num_re1 = _mm_max_epi16(xmm4,xmm5); + + // Bit = 0 + xmm0 = _mm_max_epi16(bit_met_p1_p1,bit_met_p3_p1); + xmm1 = _mm_max_epi16(bit_met_m1_p1,bit_met_m3_p1); + xmm2 = _mm_max_epi16(bit_met_p1_p3,bit_met_p3_p3); + xmm3 = _mm_max_epi16(bit_met_m1_p3,bit_met_m3_p3); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_den_re1 = _mm_max_epi16(xmm4,xmm5); + + // LLR of second bit [L2(1), L2(2), L2(3), L2(4)] + y1r = _mm_subs_epi16(logmax_den_re1,logmax_num_re1); + + // LLR of the third bit + // Bit = 1 + xmm0 = _mm_max_epi16(bit_met_m3_p1,bit_met_m3_p3); + xmm1 = _mm_max_epi16(bit_met_m3_m1,bit_met_m3_m3); + xmm2 = _mm_max_epi16(bit_met_p3_p1,bit_met_p3_p3); + xmm3 = _mm_max_epi16(bit_met_p3_m1,bit_met_p3_m3); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_num_im0 = _mm_max_epi16(xmm4,xmm5); + + // Bit = 0 + xmm0 = _mm_max_epi16(bit_met_m1_p1,bit_met_m1_p3); + xmm1 = _mm_max_epi16(bit_met_m1_m1,bit_met_m1_m3); + xmm2 = _mm_max_epi16(bit_met_p1_p1,bit_met_p1_p3); + xmm3 = _mm_max_epi16(bit_met_p1_m1,bit_met_p1_m3); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_den_im0 = _mm_max_epi16(xmm4,xmm5); + + // LLR of third bit [L3(1), L3(2), L3(3), L3(4)] + y0i = _mm_subs_epi16(logmax_den_im0,logmax_num_im0); + + // LLR of the fourth bit + // Bit = 1 + xmm0 = _mm_max_epi16(bit_met_p1_m3,bit_met_p3_m3); + xmm1 = _mm_max_epi16(bit_met_m1_m3,bit_met_m3_m3); + xmm2 = _mm_max_epi16(bit_met_p1_p3,bit_met_p3_p3); + xmm3 = _mm_max_epi16(bit_met_m1_p3,bit_met_m3_p3); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_num_im1 = _mm_max_epi16(xmm4,xmm5); + + // Bit = 0 + xmm0 = _mm_max_epi16(bit_met_p1_m1,bit_met_p3_m1); + xmm1 = _mm_max_epi16(bit_met_m1_m1,bit_met_m3_m1); + xmm2 = _mm_max_epi16(bit_met_p1_p1,bit_met_p3_p1); + xmm3 = _mm_max_epi16(bit_met_m1_p1,bit_met_m3_p1); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_den_im1 = _mm_max_epi16(xmm4,xmm5); + + // LLR of fourth bit [L4(1), L4(2), L4(3), L4(4)] + y1i = _mm_subs_epi16(logmax_den_im1,logmax_num_im1); + + // Pack LLRs in output + // [L1(1), L2(1), L1(2), L2(2), L1(3), L2(3), L1(4), L2(4)] + xmm0 = _mm_unpacklo_epi16(y0r,y1r); + // [L1(5), L2(5), L1(6), L2(6), L1(7), L2(7), L1(8), L2(8)] + xmm1 = _mm_unpackhi_epi16(y0r,y1r); + // [L3(1), L4(1), L3(2), L4(2), L3(3), L4(3), L3(4), L4(4)] + xmm2 = _mm_unpacklo_epi16(y0i,y1i); + // [L3(5), L4(5), L3(6), L4(6), L3(7), L4(7), L3(8), L4(8)] + xmm3 = _mm_unpackhi_epi16(y0i,y1i); + + stream0_128i_out[2*i+0] = _mm_unpacklo_epi32(xmm0,xmm2); // 8LLRs, 2REs + stream0_128i_out[2*i+1] = _mm_unpackhi_epi32(xmm0,xmm2); + stream0_128i_out[2*i+2] = _mm_unpacklo_epi32(xmm1,xmm3); + stream0_128i_out[2*i+3] = _mm_unpackhi_epi32(xmm1,xmm3); +#elif defined(__arm__) + +#endif + + } + +#if defined(__x86_64__) || defined(__i386__) + _mm_empty(); + _m_empty(); +#endif +} + +int dlsch_16qam_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms, + int32_t **rxdataF_comp, + int32_t **rxdataF_comp_i, + int32_t **dl_ch_mag, //|h_0|^2*(2/sqrt{10}) + int32_t **dl_ch_mag_i, //|h_1|^2*(2/sqrt{10}) + int32_t **rho_i, + int16_t *dlsch_llr, + uint8_t symbol, + uint8_t first_symbol_flag, + uint16_t nb_rb, + uint16_t pbch_pss_sss_adjust, + int16_t **llr16p) +{ + + int16_t *rxF = (int16_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *rxF_i = (int16_t*)&rxdataF_comp_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *ch_mag = (int16_t*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *ch_mag_i = (int16_t*)&dl_ch_mag_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *rho = (int16_t*)&rho_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *llr16; + int len; + uint8_t symbol_mod = (symbol >= (7-frame_parms->Ncp))? (symbol-(7-frame_parms->Ncp)) : symbol; + + // first symbol has different structure due to more pilots + if (first_symbol_flag == 1) { + llr16 = (int16_t*)dlsch_llr; + } else { + llr16 = (int16_t*)(*llr16p); + } + + + AssertFatal(llr16!=NULL,"dlsch_16qam_16qam_llr: llr is null, symbol %d\n",symbol); + + if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { + // if symbol has pilots + if (frame_parms->nb_antenna_ports_eNB!=1) + // in 2 antenna ports we have 8 REs per symbol per RB + len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); + else + // for 1 antenna port we have 10 REs per symbol per RB + len = (nb_rb*10) - (5*pbch_pss_sss_adjust/6); + } else { + // symbol has no pilots + len = (nb_rb*12) - pbch_pss_sss_adjust; + } + + // printf("symbol %d: qam16_llr, len %d (llr16 %p)\n",symbol,len,llr16); + + qam16_qam16((short *)rxF, + (short *)rxF_i, + (short *)ch_mag, + (short *)ch_mag_i, + (short *)llr16, + (short *)rho, + len); + + llr16 += (len<<2); + *llr16p = (short *)llr16; + + return(0); +} + +void qam16_qam64(int16_t *stream0_in, + int16_t *stream1_in, + int16_t *ch_mag, + int16_t *ch_mag_i, + int16_t *stream0_out, + int16_t *rho01, + int32_t length + ) +{ + + /* + Author: Sebastian Wagner + Date: 2012-06-04 + + Input: + stream0_in: MF filter for 1st stream, i.e., y0=h0'*y + stream!_in: MF filter for 2nd stream, i.e., y1=h1'*y + ch_mag: 2*h0/sqrt(00), [Re0 Im0 Re1 Im1] s.t. Im0=Re0, Im1=Re1, etc + ch_mag_i: 2*h1/sqrt(00), [Re0 Im0 Re1 Im1] s.t. Im0=Re0, Im1=Re1, etc + rho01: Channel cross correlation, i.e., h1'*h0 + + Output: + stream0_out: output LLRs for 1st stream + */ + +#if defined(__x86_64__) || defined(__i386__) + __m128i *rho01_128i = (__m128i *)rho01; + __m128i *stream0_128i_in = (__m128i *)stream0_in; + __m128i *stream1_128i_in = (__m128i *)stream1_in; + __m128i *stream0_128i_out = (__m128i *)stream0_out; + __m128i *ch_mag_128i = (__m128i *)ch_mag; + __m128i *ch_mag_128i_i = (__m128i *)ch_mag_i; + + + __m128i ONE_OVER_SQRT_2 = _mm_set1_epi16(23170); // round(1/sqrt(2)*2^15) + __m128i ONE_OVER_SQRT_10 = _mm_set1_epi16(20724); // round(1/sqrt(10)*2^16) + __m128i THREE_OVER_SQRT_10 = _mm_set1_epi16(31086); // round(3/sqrt(10)*2^15) + __m128i SQRT_10_OVER_FOUR = _mm_set1_epi16(25905); // round(sqrt(10)/4*2^15) + __m128i ONE_OVER_TWO_SQRT_10 = _mm_set1_epi16(10362); // round(1/2/sqrt(10)*2^16) + __m128i NINE_OVER_TWO_SQRT_10 = _mm_set1_epi16(23315); // round(9/2/sqrt(10)*2^14) + __m128i ONE_OVER_SQRT_2_42 = _mm_set1_epi16(3575); // round(1/sqrt(2*42)*2^15) + __m128i THREE_OVER_SQRT_2_42 = _mm_set1_epi16(10726); // round(3/sqrt(2*42)*2^15) + __m128i FIVE_OVER_SQRT_2_42 = _mm_set1_epi16(17876); // round(5/sqrt(2*42)*2^15) + __m128i SEVEN_OVER_SQRT_2_42 = _mm_set1_epi16(25027); // round(7/sqrt(2*42)*2^15) + __m128i SQRT_42_OVER_FOUR = _mm_set1_epi16(13272); // round(sqrt(42)/4*2^13), Q3. + __m128i ch_mag_des,ch_mag_int; + __m128i y0r_over_sqrt10; + __m128i y0i_over_sqrt10; + __m128i y0r_three_over_sqrt10; + __m128i y0i_three_over_sqrt10; + __m128i ch_mag_over_10; + __m128i ch_mag_over_2; + __m128i ch_mag_9_over_10; + __m128i ch_mag_int_with_sigma2; + __m128i two_ch_mag_int_with_sigma2; + __m128i three_ch_mag_int_with_sigma2; + +#elif defined(__arm__) + +#endif + int i; + + for (i=0; i>2; i+=2) { + // In one iteration, we deal with 8 REs + +#if defined(__x86_64__) || defined(__i386__) + // Get rho + xmm0 = rho01_128i[i]; + xmm1 = rho01_128i[i+1]; + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + xmm2 = _mm_unpacklo_epi64(xmm0,xmm1); // Re(rho) + xmm3 = _mm_unpackhi_epi64(xmm0,xmm1); // Im(rho) + rho_rpi = _mm_adds_epi16(xmm2,xmm3); // rho = Re(rho) + Im(rho) + rho_rmi = _mm_subs_epi16(xmm2,xmm3); // rho* = Re(rho) - Im(rho) + + // Compute the different rhos + rho_rpi_1_1 = _mm_mulhi_epi16(rho_rpi,ONE_OVER_SQRT_10); + rho_rmi_1_1 = _mm_mulhi_epi16(rho_rmi,ONE_OVER_SQRT_10); + rho_rpi_3_3 = _mm_mulhi_epi16(rho_rpi,THREE_OVER_SQRT_10); + rho_rmi_3_3 = _mm_mulhi_epi16(rho_rmi,THREE_OVER_SQRT_10); + rho_rpi_3_3 = _mm_slli_epi16(rho_rpi_3_3,1); + rho_rmi_3_3 = _mm_slli_epi16(rho_rmi_3_3,1); + + xmm4 = _mm_mulhi_epi16(xmm2,ONE_OVER_SQRT_10); // Re(rho) + xmm5 = _mm_mulhi_epi16(xmm3,THREE_OVER_SQRT_10); // Im(rho) + xmm5 = _mm_slli_epi16(xmm5,1); + + rho_rpi_1_3 = _mm_adds_epi16(xmm4,xmm5); + rho_rmi_1_3 = _mm_subs_epi16(xmm4,xmm5); + + xmm6 = _mm_mulhi_epi16(xmm2,THREE_OVER_SQRT_10); // Re(rho) + xmm7 = _mm_mulhi_epi16(xmm3,ONE_OVER_SQRT_10); // Im(rho) + xmm6 = _mm_slli_epi16(xmm6,1); + + rho_rpi_3_1 = _mm_adds_epi16(xmm6,xmm7); + rho_rmi_3_1 = _mm_subs_epi16(xmm6,xmm7); + + // Rearrange interfering MF output + xmm0 = stream1_128i_in[i]; + xmm1 = stream1_128i_in[i+1]; + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + y1r = _mm_unpacklo_epi64(xmm0,xmm1); //[y1r(1),y1r(2),y1r(3),y1r(4)] + y1i = _mm_unpackhi_epi64(xmm0,xmm1); //[y1i(1),y1i(2),y1i(3),y1i(4)] + + xmm0 = _mm_setzero_si128(); // ZERO + xmm2 = _mm_subs_epi16(rho_rpi_1_1,y1r); // = [Re(rho)+ Im(rho)]/sqrt(10) - y1r + psi_r_p1_p1 = _mm_abs_epi16(xmm2); // = |[Re(rho)+ Im(rho)]/sqrt(10) - y1r| + + xmm2= _mm_subs_epi16(rho_rmi_1_1,y1r); + psi_r_p1_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rmi_1_1,y1i); + psi_i_p1_p1 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rpi_1_3,y1r); + psi_r_p1_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rmi_1_3,y1r); + psi_r_p1_m3 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rmi_3_1,y1i); + psi_i_p1_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rpi_3_1,y1r); + psi_r_p3_p1 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rmi_3_1,y1r); + psi_r_p3_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rmi_1_3,y1i); + psi_i_p3_p1 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rpi_3_3,y1r); + psi_r_p3_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rmi_3_3,y1r); + psi_r_p3_m3 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rmi_3_3,y1i); + psi_i_p3_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rpi_1_1,y1i); + psi_i_m1_p1 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rpi_3_1,y1i); + psi_i_m1_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rpi_1_3,y1i); + psi_i_m3_p1 = _mm_abs_epi16(xmm2); + xmm2= _mm_subs_epi16(rho_rpi_3_3,y1i); + psi_i_m3_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_1_1,y1i); + psi_i_p1_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_3_1,y1i); + psi_i_p1_m3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_1_3,y1i); + psi_i_p3_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_3_3,y1i); + psi_i_p3_m3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_1_1,y1r); + psi_r_m1_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_1_3,y1r); + psi_r_m1_m3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_3_1,y1r); + psi_r_m3_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(rho_rpi_3_3,y1r); + psi_r_m3_m3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1r,rho_rmi_1_1); + psi_r_m1_p1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1r,rho_rmi_1_3); + psi_r_m1_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1i,rho_rmi_1_1); + psi_i_m1_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1i,rho_rmi_3_1); + psi_i_m1_m3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1r,rho_rmi_3_1); + psi_r_m3_p1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1r,rho_rmi_3_3); + psi_r_m3_p3 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1i,rho_rmi_1_3); + psi_i_m3_m1 = _mm_abs_epi16(xmm2); + xmm2= _mm_adds_epi16(y1i,rho_rmi_3_3); + psi_i_m3_m3 = _mm_abs_epi16(xmm2); + + // Rearrange desired MF output + xmm0 = stream0_128i_in[i]; + xmm1 = stream0_128i_in[i+1]; + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + y0r = _mm_unpacklo_epi64(xmm0,xmm1); // = [y0r(1),y0r(2),y0r(3),y0r(4)] + y0i = _mm_unpackhi_epi64(xmm0,xmm1); + + // Rearrange desired channel magnitudes + xmm2 = ch_mag_128i[i]; // = [|h|^2(1),|h|^2(1),|h|^2(2),|h|^2(2)]*(2/sqrt(10)) + xmm3 = ch_mag_128i[i+1]; // = [|h|^2(3),|h|^2(3),|h|^2(4),|h|^2(4)]*(2/sqrt(10)) + xmm2 = _mm_shufflelo_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shufflehi_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shuffle_epi32(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflelo_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflehi_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shuffle_epi32(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + + ch_mag_des = _mm_unpacklo_epi64(xmm2,xmm3); // = [|h|^2(1),|h|^2(2),|h|^2(3),|h|^2(4)]*(2/sqrt(10)) + + // Rearrange interfering channel magnitudes + xmm2 = ch_mag_128i_i[i]; + xmm3 = ch_mag_128i_i[i+1]; + + xmm2 = _mm_shufflelo_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shufflehi_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shuffle_epi32(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflelo_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflehi_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shuffle_epi32(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + + ch_mag_int = _mm_unpacklo_epi64(xmm2,xmm3); + + // Scale MF output of desired signal + y0r_over_sqrt10 = _mm_mulhi_epi16(y0r,ONE_OVER_SQRT_10); + y0i_over_sqrt10 = _mm_mulhi_epi16(y0i,ONE_OVER_SQRT_10); + y0r_three_over_sqrt10 = _mm_mulhi_epi16(y0r,THREE_OVER_SQRT_10); + y0i_three_over_sqrt10 = _mm_mulhi_epi16(y0i,THREE_OVER_SQRT_10); + y0r_three_over_sqrt10 = _mm_slli_epi16(y0r_three_over_sqrt10,1); + y0i_three_over_sqrt10 = _mm_slli_epi16(y0i_three_over_sqrt10,1); + + // Compute necessary combination of required terms + y0_p_1_1 = _mm_adds_epi16(y0r_over_sqrt10,y0i_over_sqrt10); + y0_m_1_1 = _mm_subs_epi16(y0r_over_sqrt10,y0i_over_sqrt10); + + y0_p_1_3 = _mm_adds_epi16(y0r_over_sqrt10,y0i_three_over_sqrt10); + y0_m_1_3 = _mm_subs_epi16(y0r_over_sqrt10,y0i_three_over_sqrt10); + + y0_p_3_1 = _mm_adds_epi16(y0r_three_over_sqrt10,y0i_over_sqrt10); + y0_m_3_1 = _mm_subs_epi16(y0r_three_over_sqrt10,y0i_over_sqrt10); + + y0_p_3_3 = _mm_adds_epi16(y0r_three_over_sqrt10,y0i_three_over_sqrt10); + y0_m_3_3 = _mm_subs_epi16(y0r_three_over_sqrt10,y0i_three_over_sqrt10); + + // Compute optimal interfering symbol magnitude + ch_mag_int_with_sigma2 = _mm_srai_epi16(ch_mag_int, 1); // *2 + two_ch_mag_int_with_sigma2 = ch_mag_int; // *4 + three_ch_mag_int_with_sigma2 = _mm_adds_epi16(ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2); // *6 + + interference_abs_64qam_epi16(psi_r_p1_p1 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p1_p1,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p1_p1 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p1_p1,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p1_p3 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p1_p3,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p1_p3 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p1_p3,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p1_m1 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p1_m1,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p1_m1 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p1_m1,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p1_m3 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p1_m3,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p1_m3 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p1_m3,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p3_p1 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p3_p1,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p3_p1 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p3_p1,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p3_p3 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p3_p3,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p3_p3 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p3_p3,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p3_m1 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p3_m1,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p3_m1 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p3_m1,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p3_m3 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p3_m3,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p3_m3 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p3_m3,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m1_p1 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m1_p1,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m1_p1 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m1_p1,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m1_p3 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m1_p3,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m1_p3 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m1_p3,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m1_m1 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m1_m1,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m1_m1 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m1_m1,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m1_m3 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m1_m3,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m1_m3 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m1_m3,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m3_p1 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m3_p1,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m3_p1 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m3_p1,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m3_p3 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m3_p3,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m3_p3 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m3_p3,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m3_m1 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m3_m1,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m3_m1 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m3_m1,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m3_m3 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m3_m3,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m3_m3 ,ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m3_m3,ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42,FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + + // Calculation of groups of two terms in the bit metric involving product of psi and interference magnitude + prodsum_psi_a_epi16(psi_r_p1_p1,a_r_p1_p1,psi_i_p1_p1,a_i_p1_p1,psi_a_p1_p1); + prodsum_psi_a_epi16(psi_r_p1_p3,a_r_p1_p3,psi_i_p1_p3,a_i_p1_p3,psi_a_p1_p3); + prodsum_psi_a_epi16(psi_r_p3_p1,a_r_p3_p1,psi_i_p3_p1,a_i_p3_p1,psi_a_p3_p1); + prodsum_psi_a_epi16(psi_r_p3_p3,a_r_p3_p3,psi_i_p3_p3,a_i_p3_p3,psi_a_p3_p3); + prodsum_psi_a_epi16(psi_r_p1_m1,a_r_p1_m1,psi_i_p1_m1,a_i_p1_m1,psi_a_p1_m1); + prodsum_psi_a_epi16(psi_r_p1_m3,a_r_p1_m3,psi_i_p1_m3,a_i_p1_m3,psi_a_p1_m3); + prodsum_psi_a_epi16(psi_r_p3_m1,a_r_p3_m1,psi_i_p3_m1,a_i_p3_m1,psi_a_p3_m1); + prodsum_psi_a_epi16(psi_r_p3_m3,a_r_p3_m3,psi_i_p3_m3,a_i_p3_m3,psi_a_p3_m3); + prodsum_psi_a_epi16(psi_r_m1_p1,a_r_m1_p1,psi_i_m1_p1,a_i_m1_p1,psi_a_m1_p1); + prodsum_psi_a_epi16(psi_r_m1_p3,a_r_m1_p3,psi_i_m1_p3,a_i_m1_p3,psi_a_m1_p3); + prodsum_psi_a_epi16(psi_r_m3_p1,a_r_m3_p1,psi_i_m3_p1,a_i_m3_p1,psi_a_m3_p1); + prodsum_psi_a_epi16(psi_r_m3_p3,a_r_m3_p3,psi_i_m3_p3,a_i_m3_p3,psi_a_m3_p3); + prodsum_psi_a_epi16(psi_r_m1_m1,a_r_m1_m1,psi_i_m1_m1,a_i_m1_m1,psi_a_m1_m1); + prodsum_psi_a_epi16(psi_r_m1_m3,a_r_m1_m3,psi_i_m1_m3,a_i_m1_m3,psi_a_m1_m3); + prodsum_psi_a_epi16(psi_r_m3_m1,a_r_m3_m1,psi_i_m3_m1,a_i_m3_m1,psi_a_m3_m1); + prodsum_psi_a_epi16(psi_r_m3_m3,a_r_m3_m3,psi_i_m3_m3,a_i_m3_m3,psi_a_m3_m3); + + // Multiply by sqrt(2) + psi_a_p1_p1 = _mm_mulhi_epi16(psi_a_p1_p1, ONE_OVER_SQRT_2); + psi_a_p1_p1 = _mm_slli_epi16(psi_a_p1_p1, 2); + psi_a_p1_p3 = _mm_mulhi_epi16(psi_a_p1_p3, ONE_OVER_SQRT_2); + psi_a_p1_p3 = _mm_slli_epi16(psi_a_p1_p3, 2); + psi_a_p3_p1 = _mm_mulhi_epi16(psi_a_p3_p1, ONE_OVER_SQRT_2); + psi_a_p3_p1 = _mm_slli_epi16(psi_a_p3_p1, 2); + psi_a_p3_p3 = _mm_mulhi_epi16(psi_a_p3_p3, ONE_OVER_SQRT_2); + psi_a_p3_p3 = _mm_slli_epi16(psi_a_p3_p3, 2); + psi_a_p1_m1 = _mm_mulhi_epi16(psi_a_p1_m1, ONE_OVER_SQRT_2); + psi_a_p1_m1 = _mm_slli_epi16(psi_a_p1_m1, 2); + psi_a_p1_m3 = _mm_mulhi_epi16(psi_a_p1_m3, ONE_OVER_SQRT_2); + psi_a_p1_m3 = _mm_slli_epi16(psi_a_p1_m3, 2); + psi_a_p3_m1 = _mm_mulhi_epi16(psi_a_p3_m1, ONE_OVER_SQRT_2); + psi_a_p3_m1 = _mm_slli_epi16(psi_a_p3_m1, 2); + psi_a_p3_m3 = _mm_mulhi_epi16(psi_a_p3_m3, ONE_OVER_SQRT_2); + psi_a_p3_m3 = _mm_slli_epi16(psi_a_p3_m3, 2); + psi_a_m1_p1 = _mm_mulhi_epi16(psi_a_m1_p1, ONE_OVER_SQRT_2); + psi_a_m1_p1 = _mm_slli_epi16(psi_a_m1_p1, 2); + psi_a_m1_p3 = _mm_mulhi_epi16(psi_a_m1_p3, ONE_OVER_SQRT_2); + psi_a_m1_p3 = _mm_slli_epi16(psi_a_m1_p3, 2); + psi_a_m3_p1 = _mm_mulhi_epi16(psi_a_m3_p1, ONE_OVER_SQRT_2); + psi_a_m3_p1 = _mm_slli_epi16(psi_a_m3_p1, 2); + psi_a_m3_p3 = _mm_mulhi_epi16(psi_a_m3_p3, ONE_OVER_SQRT_2); + psi_a_m3_p3 = _mm_slli_epi16(psi_a_m3_p3, 2); + psi_a_m1_m1 = _mm_mulhi_epi16(psi_a_m1_m1, ONE_OVER_SQRT_2); + psi_a_m1_m1 = _mm_slli_epi16(psi_a_m1_m1, 2); + psi_a_m1_m3 = _mm_mulhi_epi16(psi_a_m1_m3, ONE_OVER_SQRT_2); + psi_a_m1_m3 = _mm_slli_epi16(psi_a_m1_m3, 2); + psi_a_m3_m1 = _mm_mulhi_epi16(psi_a_m3_m1, ONE_OVER_SQRT_2); + psi_a_m3_m1 = _mm_slli_epi16(psi_a_m3_m1, 2); + psi_a_m3_m3 = _mm_mulhi_epi16(psi_a_m3_m3, ONE_OVER_SQRT_2); + psi_a_m3_m3 = _mm_slli_epi16(psi_a_m3_m3, 2); + + // squared interference magnitude times int. ch. power + square_a_64qam_epi16(a_r_p1_p1,a_i_p1_p1,ch_mag_int,SQRT_42_OVER_FOUR,a_sq_p1_p1); + square_a_64qam_epi16(a_r_p1_p3,a_i_p1_p3,ch_mag_int,SQRT_42_OVER_FOUR,a_sq_p1_p3); + square_a_64qam_epi16(a_r_p3_p1,a_i_p3_p1,ch_mag_int,SQRT_42_OVER_FOUR,a_sq_p3_p1); + square_a_64qam_epi16(a_r_p3_p3,a_i_p3_p3,ch_mag_int,SQRT_42_OVER_FOUR,a_sq_p3_p3); + square_a_64qam_epi16(a_r_p1_m1,a_i_p1_m1,ch_mag_int,SQRT_42_OVER_FOUR,a_sq_p1_m1); + square_a_64qam_epi16(a_r_p1_m3,a_i_p1_m3,ch_mag_int,SQRT_42_OVER_FOUR,a_sq_p1_m3); + square_a_64qam_epi16(a_r_p3_m1,a_i_p3_m1,ch_mag_int,SQRT_42_OVER_FOUR,a_sq_p3_m1); + square_a_64qam_epi16(a_r_p3_m3,a_i_p3_m3,ch_mag_int,SQRT_42_OVER_FOUR,a_sq_p3_m3); + square_a_64qam_epi16(a_r_m1_p1,a_i_m1_p1,ch_mag_int,SQRT_42_OVER_FOUR,a_sq_m1_p1); + square_a_64qam_epi16(a_r_m1_p3,a_i_m1_p3,ch_mag_int,SQRT_42_OVER_FOUR,a_sq_m1_p3); + square_a_64qam_epi16(a_r_m3_p1,a_i_m3_p1,ch_mag_int,SQRT_42_OVER_FOUR,a_sq_m3_p1); + square_a_64qam_epi16(a_r_m3_p3,a_i_m3_p3,ch_mag_int,SQRT_42_OVER_FOUR,a_sq_m3_p3); + square_a_64qam_epi16(a_r_m1_m1,a_i_m1_m1,ch_mag_int,SQRT_42_OVER_FOUR,a_sq_m1_m1); + square_a_64qam_epi16(a_r_m1_m3,a_i_m1_m3,ch_mag_int,SQRT_42_OVER_FOUR,a_sq_m1_m3); + square_a_64qam_epi16(a_r_m3_m1,a_i_m3_m1,ch_mag_int,SQRT_42_OVER_FOUR,a_sq_m3_m1); + square_a_64qam_epi16(a_r_m3_m3,a_i_m3_m3,ch_mag_int,SQRT_42_OVER_FOUR,a_sq_m3_m3); + + // Computing different multiples of channel norms + ch_mag_over_10=_mm_mulhi_epi16(ch_mag_des, ONE_OVER_TWO_SQRT_10); + ch_mag_over_2=_mm_mulhi_epi16(ch_mag_des, SQRT_10_OVER_FOUR); + ch_mag_over_2=_mm_slli_epi16(ch_mag_over_2, 1); + ch_mag_9_over_10=_mm_mulhi_epi16(ch_mag_des, NINE_OVER_TWO_SQRT_10); + ch_mag_9_over_10=_mm_slli_epi16(ch_mag_9_over_10, 2); + + // Computing Metrics + xmm0 = _mm_subs_epi16(psi_a_p1_p1,a_sq_p1_p1); + xmm1 = _mm_adds_epi16(xmm0,y0_p_1_1); + bit_met_p1_p1= _mm_subs_epi16(xmm1,ch_mag_over_10); + + xmm0 = _mm_subs_epi16(psi_a_p1_p3,a_sq_p1_p3); + xmm1 = _mm_adds_epi16(xmm0,y0_p_1_3); + bit_met_p1_p3= _mm_subs_epi16(xmm1,ch_mag_over_2); + + xmm0 = _mm_subs_epi16(psi_a_p1_m1,a_sq_p1_m1); + xmm1 = _mm_adds_epi16(xmm0,y0_m_1_1); + bit_met_p1_m1= _mm_subs_epi16(xmm1,ch_mag_over_10); + + xmm0 = _mm_subs_epi16(psi_a_p1_m3,a_sq_p1_m3); + xmm1 = _mm_adds_epi16(xmm0,y0_m_1_3); + bit_met_p1_m3= _mm_subs_epi16(xmm1,ch_mag_over_2); + + xmm0 = _mm_subs_epi16(psi_a_p3_p1,a_sq_p3_p1); + xmm1 = _mm_adds_epi16(xmm0,y0_p_3_1); + bit_met_p3_p1= _mm_subs_epi16(xmm1,ch_mag_over_2); + + xmm0 = _mm_subs_epi16(psi_a_p3_p3,a_sq_p3_p3); + xmm1 = _mm_adds_epi16(xmm0,y0_p_3_3); + bit_met_p3_p3= _mm_subs_epi16(xmm1,ch_mag_9_over_10); + + xmm0 = _mm_subs_epi16(psi_a_p3_m1,a_sq_p3_m1); + xmm1 = _mm_adds_epi16(xmm0,y0_m_3_1); + bit_met_p3_m1= _mm_subs_epi16(xmm1,ch_mag_over_2); + + xmm0 = _mm_subs_epi16(psi_a_p3_m3,a_sq_p3_m3); + xmm1 = _mm_adds_epi16(xmm0,y0_m_3_3); + bit_met_p3_m3= _mm_subs_epi16(xmm1,ch_mag_9_over_10); + + xmm0 = _mm_subs_epi16(psi_a_m1_p1,a_sq_m1_p1); + xmm1 = _mm_subs_epi16(xmm0,y0_m_1_1); + bit_met_m1_p1= _mm_subs_epi16(xmm1,ch_mag_over_10); + + xmm0 = _mm_subs_epi16(psi_a_m1_p3,a_sq_m1_p3); + xmm1 = _mm_subs_epi16(xmm0,y0_m_1_3); + bit_met_m1_p3= _mm_subs_epi16(xmm1,ch_mag_over_2); + + xmm0 = _mm_subs_epi16(psi_a_m1_m1,a_sq_m1_m1); + xmm1 = _mm_subs_epi16(xmm0,y0_p_1_1); + bit_met_m1_m1= _mm_subs_epi16(xmm1,ch_mag_over_10); + + xmm0 = _mm_subs_epi16(psi_a_m1_m3,a_sq_m1_m3); + xmm1 = _mm_subs_epi16(xmm0,y0_p_1_3); + bit_met_m1_m3= _mm_subs_epi16(xmm1,ch_mag_over_2); + + xmm0 = _mm_subs_epi16(psi_a_m3_p1,a_sq_m3_p1); + xmm1 = _mm_subs_epi16(xmm0,y0_m_3_1); + bit_met_m3_p1= _mm_subs_epi16(xmm1,ch_mag_over_2); + + xmm0 = _mm_subs_epi16(psi_a_m3_p3,a_sq_m3_p3); + xmm1 = _mm_subs_epi16(xmm0,y0_m_3_3); + bit_met_m3_p3= _mm_subs_epi16(xmm1,ch_mag_9_over_10); + + xmm0 = _mm_subs_epi16(psi_a_m3_m1,a_sq_m3_m1); + xmm1 = _mm_subs_epi16(xmm0,y0_p_3_1); + bit_met_m3_m1= _mm_subs_epi16(xmm1,ch_mag_over_2); + + xmm0 = _mm_subs_epi16(psi_a_m3_m3,a_sq_m3_m3); + xmm1 = _mm_subs_epi16(xmm0,y0_p_3_3); + bit_met_m3_m3= _mm_subs_epi16(xmm1,ch_mag_9_over_10); + + // LLR of the first bit + // Bit = 1 + xmm0 = _mm_max_epi16(bit_met_m1_p1,bit_met_m1_p3); + xmm1 = _mm_max_epi16(bit_met_m1_m1,bit_met_m1_m3); + xmm2 = _mm_max_epi16(bit_met_m3_p1,bit_met_m3_p3); + xmm3 = _mm_max_epi16(bit_met_m3_m1,bit_met_m3_m3); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_num_re0= _mm_max_epi16(xmm4,xmm5); + + // Bit = 0 + xmm0 = _mm_max_epi16(bit_met_p1_p1,bit_met_p1_p3); + xmm1 = _mm_max_epi16(bit_met_p1_m1,bit_met_p1_m3); + xmm2 = _mm_max_epi16(bit_met_p3_p1,bit_met_p3_p3); + xmm3 = _mm_max_epi16(bit_met_p3_m1,bit_met_p3_m3); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_den_re0 = _mm_max_epi16(xmm4,xmm5); + + // LLR of first bit [L1(1), L1(2), L1(3), L1(4), L1(5), L1(6), L1(7), L1(8)] + y0r = _mm_subs_epi16(logmax_den_re0,logmax_num_re0); + + // LLR of the second bit + // Bit = 1 + xmm0 = _mm_max_epi16(bit_met_p1_m1,bit_met_p3_m1); + xmm1 = _mm_max_epi16(bit_met_m1_m1,bit_met_m3_m1); + xmm2 = _mm_max_epi16(bit_met_p1_m3,bit_met_p3_m3); + xmm3 = _mm_max_epi16(bit_met_m1_m3,bit_met_m3_m3); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_num_re1 = _mm_max_epi16(xmm4,xmm5); + + // Bit = 0 + xmm0 = _mm_max_epi16(bit_met_p1_p1,bit_met_p3_p1); + xmm1 = _mm_max_epi16(bit_met_m1_p1,bit_met_m3_p1); + xmm2 = _mm_max_epi16(bit_met_p1_p3,bit_met_p3_p3); + xmm3 = _mm_max_epi16(bit_met_m1_p3,bit_met_m3_p3); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_den_re1 = _mm_max_epi16(xmm4,xmm5); + + // LLR of second bit [L2(1), L2(2), L2(3), L2(4)] + y1r = _mm_subs_epi16(logmax_den_re1,logmax_num_re1); + + // LLR of the third bit + // Bit = 1 + xmm0 = _mm_max_epi16(bit_met_m3_p1,bit_met_m3_p3); + xmm1 = _mm_max_epi16(bit_met_m3_m1,bit_met_m3_m3); + xmm2 = _mm_max_epi16(bit_met_p3_p1,bit_met_p3_p3); + xmm3 = _mm_max_epi16(bit_met_p3_m1,bit_met_p3_m3); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_num_im0 = _mm_max_epi16(xmm4,xmm5); + + // Bit = 0 + xmm0 = _mm_max_epi16(bit_met_m1_p1,bit_met_m1_p3); + xmm1 = _mm_max_epi16(bit_met_m1_m1,bit_met_m1_m3); + xmm2 = _mm_max_epi16(bit_met_p1_p1,bit_met_p1_p3); + xmm3 = _mm_max_epi16(bit_met_p1_m1,bit_met_p1_m3); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_den_im0 = _mm_max_epi16(xmm4,xmm5); + + // LLR of third bit [L3(1), L3(2), L3(3), L3(4)] + y0i = _mm_subs_epi16(logmax_den_im0,logmax_num_im0); + + // LLR of the fourth bit + // Bit = 1 + xmm0 = _mm_max_epi16(bit_met_p1_m3,bit_met_p3_m3); + xmm1 = _mm_max_epi16(bit_met_m1_m3,bit_met_m3_m3); + xmm2 = _mm_max_epi16(bit_met_p1_p3,bit_met_p3_p3); + xmm3 = _mm_max_epi16(bit_met_m1_p3,bit_met_m3_p3); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_num_im1 = _mm_max_epi16(xmm4,xmm5); + + // Bit = 0 + xmm0 = _mm_max_epi16(bit_met_p1_m1,bit_met_p3_m1); + xmm1 = _mm_max_epi16(bit_met_m1_m1,bit_met_m3_m1); + xmm2 = _mm_max_epi16(bit_met_p1_p1,bit_met_p3_p1); + xmm3 = _mm_max_epi16(bit_met_m1_p1,bit_met_m3_p1); + xmm4 = _mm_max_epi16(xmm0,xmm1); + xmm5 = _mm_max_epi16(xmm2,xmm3); + logmax_den_im1 = _mm_max_epi16(xmm4,xmm5); + + // LLR of fourth bit [L4(1), L4(2), L4(3), L4(4)] + y1i = _mm_subs_epi16(logmax_den_im1,logmax_num_im1); + + // Pack LLRs in output + // [L1(1), L2(1), L1(2), L2(2), L1(3), L2(3), L1(4), L2(4)] + xmm0 = _mm_unpacklo_epi16(y0r,y1r); + // [L1(5), L2(5), L1(6), L2(6), L1(7), L2(7), L1(8), L2(8)] + xmm1 = _mm_unpackhi_epi16(y0r,y1r); + // [L3(1), L4(1), L3(2), L4(2), L3(3), L4(3), L3(4), L4(4)] + xmm2 = _mm_unpacklo_epi16(y0i,y1i); + // [L3(5), L4(5), L3(6), L4(6), L3(7), L4(7), L3(8), L4(8)] + xmm3 = _mm_unpackhi_epi16(y0i,y1i); + + stream0_128i_out[2*i+0] = _mm_unpacklo_epi32(xmm0,xmm2); // 8LLRs, 2REs + stream0_128i_out[2*i+1] = _mm_unpackhi_epi32(xmm0,xmm2); + stream0_128i_out[2*i+2] = _mm_unpacklo_epi32(xmm1,xmm3); + stream0_128i_out[2*i+3] = _mm_unpackhi_epi32(xmm1,xmm3); +#elif defined(__arm__) + +#endif + + } + +#if defined(__x86_64__) || defined(__i386__) + _mm_empty(); + _m_empty(); +#endif +} + +int dlsch_16qam_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, + int32_t **rxdataF_comp, + int32_t **rxdataF_comp_i, + int32_t **dl_ch_mag, //|h_0|^2*(2/sqrt{10}) + int32_t **dl_ch_mag_i, //|h_1|^2*(2/sqrt{10}) + int32_t **rho_i, + int16_t *dlsch_llr, + uint8_t symbol, + uint8_t first_symbol_flag, + uint16_t nb_rb, + uint16_t pbch_pss_sss_adjust, + int16_t **llr16p) +{ + + int16_t *rxF = (int16_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *rxF_i = (int16_t*)&rxdataF_comp_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *ch_mag = (int16_t*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *ch_mag_i = (int16_t*)&dl_ch_mag_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *rho = (int16_t*)&rho_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *llr16; + int len; + uint8_t symbol_mod = (symbol >= (7-frame_parms->Ncp))? (symbol-(7-frame_parms->Ncp)) : symbol; + + // first symbol has different structure due to more pilots + if (first_symbol_flag == 1) { + llr16 = (int16_t*)dlsch_llr; + } else { + llr16 = (int16_t*)(*llr16p); + } + + + AssertFatal(llr16!=NULL,"dlsch_16qam_64qam_llr:llr is null, symbol %d\n",symbol); + + + if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { + // if symbol has pilots + if (frame_parms->nb_antenna_ports_eNB!=1) + // in 2 antenna ports we have 8 REs per symbol per RB + len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); + else + // for 1 antenna port we have 10 REs per symbol per RB + len = (nb_rb*10) - (5*pbch_pss_sss_adjust/6); + } else { + // symbol has no pilots + len = (nb_rb*12) - pbch_pss_sss_adjust; + } + + // printf("symbol %d: qam16_llr, len %d (llr16 %p)\n",symbol,len,llr16); + + qam16_qam64((short *)rxF, + (short *)rxF_i, + (short *)ch_mag, + (short *)ch_mag_i, + (short *)llr16, + (short *)rho, + len); + + llr16 += (len<<2); + *llr16p = (short *)llr16; + + return(0); +} + +//---------------------------------------------------------------------------------------------- +// 64-QAM +//---------------------------------------------------------------------------------------------- + +/* +__m128i ONE_OVER_SQRT_42 __attribute__((aligned(16))); +__m128i THREE_OVER_SQRT_42 __attribute__((aligned(16))); +__m128i FIVE_OVER_SQRT_42 __attribute__((aligned(16))); +__m128i SEVEN_OVER_SQRT_42 __attribute__((aligned(16))); + +__m128i FORTYNINE_OVER_FOUR_SQRT_42 __attribute__((aligned(16))); +__m128i THIRTYSEVEN_OVER_FOUR_SQRT_42 __attribute__((aligned(16))); +__m128i TWENTYNINE_OVER_FOUR_SQRT_42 __attribute__((aligned(16))); +__m128i TWENTYFIVE_OVER_FOUR_SQRT_42 __attribute__((aligned(16))); +__m128i SEVENTEEN_OVER_FOUR_SQRT_42 __attribute__((aligned(16))); +__m128i NINE_OVER_FOUR_SQRT_42 __attribute__((aligned(16))); +__m128i THIRTEEN_OVER_FOUR_SQRT_42 __attribute__((aligned(16))); +__m128i FIVE_OVER_FOUR_SQRT_42 __attribute__((aligned(16))); +__m128i ONE_OVER_FOUR_SQRT_42 __attribute__((aligned(16))); + +__m128i y0r_one_over_sqrt_21 __attribute__((aligned(16))); +__m128i y0r_three_over_sqrt_21 __attribute__((aligned(16))); +__m128i y0r_five_over_sqrt_21 __attribute__((aligned(16))); +__m128i y0r_seven_over_sqrt_21 __attribute__((aligned(16))); +__m128i y0i_one_over_sqrt_21 __attribute__((aligned(16))); +__m128i y0i_three_over_sqrt_21 __attribute__((aligned(16))); +__m128i y0i_five_over_sqrt_21 __attribute__((aligned(16))); +__m128i y0i_seven_over_sqrt_21 __attribute__((aligned(16))); + +__m128i ch_mag_98_over_42_with_sigma2 __attribute__((aligned(16))); +__m128i ch_mag_74_over_42_with_sigma2 __attribute__((aligned(16))); +__m128i ch_mag_58_over_42_with_sigma2 __attribute__((aligned(16))); +__m128i ch_mag_50_over_42_with_sigma2 __attribute__((aligned(16))); +__m128i ch_mag_34_over_42_with_sigma2 __attribute__((aligned(16))); +__m128i ch_mag_18_over_42_with_sigma2 __attribute__((aligned(16))); +__m128i ch_mag_26_over_42_with_sigma2 __attribute__((aligned(16))); +__m128i ch_mag_10_over_42_with_sigma2 __attribute__((aligned(16))); +__m128i ch_mag_2_over_42_with_sigma2 __attribute__((aligned(16))); + +*/ + +void qam64_qpsk(int16_t *stream0_in, + int16_t *stream1_in, + int16_t *ch_mag, + int16_t *stream0_out, + int16_t *rho01, + int32_t length + ) +{ + + /* + Author: S. Wagner + Date: 31-07-12 + + Input: + stream0_in: MF filter for 1st stream, i.e., y0=h0'*y + stream1_in: MF filter for 2nd stream, i.e., y1=h1'*y + ch_mag: 4*h0/sqrt(42), [Re0 Im0 Re1 Im1] s.t. Im0=Re0, Im1=Re1, etc + ch_mag_i: 4*h1/sqrt(42), [Re0 Im0 Re1 Im1] s.t. Im0=Re0, Im1=Re1, etc + rho01: Channel cross correlation, i.e., h1'*h0 + + Output: + stream0_out: output LLRs for 1st stream + */ + +#if defined(__x86_64__) || defined(__i386__) + __m128i *rho01_128i = (__m128i *)rho01; + __m128i *stream0_128i_in = (__m128i *)stream0_in; + __m128i *stream1_128i_in = (__m128i *)stream1_in; + __m128i *ch_mag_128i = (__m128i *)ch_mag; + + + __m128i ONE_OVER_SQRT_42 = _mm_set1_epi16(10112); // round(1/sqrt(42)*2^16) + __m128i THREE_OVER_SQRT_42 = _mm_set1_epi16(30337); // round(3/sqrt(42)*2^16) + __m128i FIVE_OVER_SQRT_42 = _mm_set1_epi16(25281); // round(5/sqrt(42)*2^15) + __m128i SEVEN_OVER_SQRT_42 = _mm_set1_epi16(17697); // round(5/sqrt(42)*2^15) + __m128i ONE_OVER_SQRT_2 = _mm_set1_epi16(23170); // round(1/sqrt(2)*2^15) + __m128i FORTYNINE_OVER_FOUR_SQRT_42 = _mm_set1_epi16(30969); // round(49/(4*sqrt(42))*2^14), Q2.14 + __m128i THIRTYSEVEN_OVER_FOUR_SQRT_42 = _mm_set1_epi16(23385); // round(37/(4*sqrt(42))*2^14), Q2.14 + __m128i TWENTYFIVE_OVER_FOUR_SQRT_42 = _mm_set1_epi16(31601); // round(25/(4*sqrt(42))*2^15) + __m128i TWENTYNINE_OVER_FOUR_SQRT_42 = _mm_set1_epi16(18329); // round(29/(4*sqrt(42))*2^15), Q2.14 + __m128i SEVENTEEN_OVER_FOUR_SQRT_42 = _mm_set1_epi16(21489); // round(17/(4*sqrt(42))*2^15) + __m128i NINE_OVER_FOUR_SQRT_42 = _mm_set1_epi16(11376); // round(9/(4*sqrt(42))*2^15) + __m128i THIRTEEN_OVER_FOUR_SQRT_42 = _mm_set1_epi16(16433); // round(13/(4*sqrt(42))*2^15) + __m128i FIVE_OVER_FOUR_SQRT_42 = _mm_set1_epi16(6320); // round(5/(4*sqrt(42))*2^15) + __m128i ONE_OVER_FOUR_SQRT_42 = _mm_set1_epi16(1264); // round(1/(4*sqrt(42))*2^15) + + + __m128i ch_mag_des; + __m128i ch_mag_98_over_42_with_sigma2; + __m128i ch_mag_74_over_42_with_sigma2; + __m128i ch_mag_58_over_42_with_sigma2; + __m128i ch_mag_50_over_42_with_sigma2; + __m128i ch_mag_34_over_42_with_sigma2; + __m128i ch_mag_18_over_42_with_sigma2; + __m128i ch_mag_26_over_42_with_sigma2; + __m128i ch_mag_10_over_42_with_sigma2; + __m128i ch_mag_2_over_42_with_sigma2; + __m128i y0r_one_over_sqrt_21; + __m128i y0r_three_over_sqrt_21; + __m128i y0r_five_over_sqrt_21; + __m128i y0r_seven_over_sqrt_21; + __m128i y0i_one_over_sqrt_21; + __m128i y0i_three_over_sqrt_21; + __m128i y0i_five_over_sqrt_21; + __m128i y0i_seven_over_sqrt_21; +#elif defined(__arm__) + +#endif + + int i,j; + + for (i=0; i>2; i+=2) { + +#if defined(__x86_64) || defined(__i386__) + // Get rho + xmm0 = rho01_128i[i]; + xmm1 = rho01_128i[i+1]; + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + xmm2 = _mm_unpacklo_epi64(xmm0,xmm1); // Re(rho) + xmm3 = _mm_unpackhi_epi64(xmm0,xmm1); // Im(rho) + rho_rpi = _mm_adds_epi16(xmm2,xmm3); // rho = Re(rho) + Im(rho) + rho_rmi = _mm_subs_epi16(xmm2,xmm3); // rho* = Re(rho) - Im(rho) + + // Compute the different rhos + rho_rpi_1_1 = _mm_mulhi_epi16(rho_rpi, ONE_OVER_SQRT_42); + rho_rmi_1_1 = _mm_mulhi_epi16(rho_rmi, ONE_OVER_SQRT_42); + rho_rpi_3_3 = _mm_mulhi_epi16(rho_rpi, THREE_OVER_SQRT_42); + rho_rmi_3_3 = _mm_mulhi_epi16(rho_rmi, THREE_OVER_SQRT_42); + rho_rpi_5_5 = _mm_mulhi_epi16(rho_rpi, FIVE_OVER_SQRT_42); + rho_rmi_5_5 = _mm_mulhi_epi16(rho_rmi, FIVE_OVER_SQRT_42); + rho_rpi_7_7 = _mm_mulhi_epi16(rho_rpi, SEVEN_OVER_SQRT_42); + rho_rmi_7_7 = _mm_mulhi_epi16(rho_rmi, SEVEN_OVER_SQRT_42); + + rho_rpi_5_5 = _mm_slli_epi16(rho_rpi_5_5, 1); + rho_rmi_5_5 = _mm_slli_epi16(rho_rmi_5_5, 1); + rho_rpi_7_7 = _mm_slli_epi16(rho_rpi_7_7, 2); + rho_rmi_7_7 = _mm_slli_epi16(rho_rmi_7_7, 2); + + xmm4 = _mm_mulhi_epi16(xmm2, ONE_OVER_SQRT_42); + xmm5 = _mm_mulhi_epi16(xmm3, ONE_OVER_SQRT_42); + xmm6 = _mm_mulhi_epi16(xmm3, THREE_OVER_SQRT_42); + xmm7 = _mm_mulhi_epi16(xmm3, FIVE_OVER_SQRT_42); + xmm8 = _mm_mulhi_epi16(xmm3, SEVEN_OVER_SQRT_42); + xmm7 = _mm_slli_epi16(xmm7, 1); + xmm8 = _mm_slli_epi16(xmm8, 2); + + rho_rpi_1_3 = _mm_adds_epi16(xmm4, xmm6); + rho_rmi_1_3 = _mm_subs_epi16(xmm4, xmm6); + rho_rpi_1_5 = _mm_adds_epi16(xmm4, xmm7); + rho_rmi_1_5 = _mm_subs_epi16(xmm4, xmm7); + rho_rpi_1_7 = _mm_adds_epi16(xmm4, xmm8); + rho_rmi_1_7 = _mm_subs_epi16(xmm4, xmm8); + + xmm4 = _mm_mulhi_epi16(xmm2, THREE_OVER_SQRT_42); + rho_rpi_3_1 = _mm_adds_epi16(xmm4, xmm5); + rho_rmi_3_1 = _mm_subs_epi16(xmm4, xmm5); + rho_rpi_3_5 = _mm_adds_epi16(xmm4, xmm7); + rho_rmi_3_5 = _mm_subs_epi16(xmm4, xmm7); + rho_rpi_3_7 = _mm_adds_epi16(xmm4, xmm8); + rho_rmi_3_7 = _mm_subs_epi16(xmm4, xmm8); + + xmm4 = _mm_mulhi_epi16(xmm2, FIVE_OVER_SQRT_42); + xmm4 = _mm_slli_epi16(xmm4, 1); + rho_rpi_5_1 = _mm_adds_epi16(xmm4, xmm5); + rho_rmi_5_1 = _mm_subs_epi16(xmm4, xmm5); + rho_rpi_5_3 = _mm_adds_epi16(xmm4, xmm6); + rho_rmi_5_3 = _mm_subs_epi16(xmm4, xmm6); + rho_rpi_5_7 = _mm_adds_epi16(xmm4, xmm8); + rho_rmi_5_7 = _mm_subs_epi16(xmm4, xmm8); + + xmm4 = _mm_mulhi_epi16(xmm2, SEVEN_OVER_SQRT_42); + xmm4 = _mm_slli_epi16(xmm4, 2); + rho_rpi_7_1 = _mm_adds_epi16(xmm4, xmm5); + rho_rmi_7_1 = _mm_subs_epi16(xmm4, xmm5); + rho_rpi_7_3 = _mm_adds_epi16(xmm4, xmm6); + rho_rmi_7_3 = _mm_subs_epi16(xmm4, xmm6); + rho_rpi_7_5 = _mm_adds_epi16(xmm4, xmm7); + rho_rmi_7_5 = _mm_subs_epi16(xmm4, xmm7); + + // Rearrange interfering MF output + xmm0 = stream1_128i_in[i]; + xmm1 = stream1_128i_in[i+1]; + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + y1r = _mm_unpacklo_epi64(xmm0,xmm1); //[y1r(1),y1r(2),y1r(3),y1r(4)] + y1i = _mm_unpackhi_epi64(xmm0,xmm1); //[y1i(1),y1i(2),y1i(3),y1i(4)] + + // Psi_r calculation from rho_rpi or rho_rmi + xmm0 = _mm_setzero_si128(); // ZERO for abs_pi16 + xmm2 = _mm_subs_epi16(rho_rpi_7_7, y1r); + psi_r_p7_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_7_5, y1r); + psi_r_p7_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_7_3, y1r); + psi_r_p7_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_7_1, y1r); + psi_r_p7_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_7_1, y1r); + psi_r_p7_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_7_3, y1r); + psi_r_p7_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_7_5, y1r); + psi_r_p7_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_7_7, y1r); + psi_r_p7_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_7, y1r); + psi_r_p5_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_5, y1r); + psi_r_p5_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_3, y1r); + psi_r_p5_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_1, y1r); + psi_r_p5_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_1, y1r); + psi_r_p5_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_3, y1r); + psi_r_p5_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_5, y1r); + psi_r_p5_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_7, y1r); + psi_r_p5_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_7, y1r); + psi_r_p3_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_5, y1r); + psi_r_p3_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_3, y1r); + psi_r_p3_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_1, y1r); + psi_r_p3_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_1, y1r); + psi_r_p3_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_3, y1r); + psi_r_p3_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_5, y1r); + psi_r_p3_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_7, y1r); + psi_r_p3_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_7, y1r); + psi_r_p1_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_5, y1r); + psi_r_p1_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_3, y1r); + psi_r_p1_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_1, y1r); + psi_r_p1_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_1, y1r); + psi_r_p1_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_3, y1r); + psi_r_p1_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_5, y1r); + psi_r_p1_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_7, y1r); + psi_r_p1_m7 = _mm_abs_epi16(xmm2); + + xmm2 = _mm_adds_epi16(rho_rmi_1_7, y1r); + psi_r_m1_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_1_5, y1r); + psi_r_m1_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_1_3, y1r); + psi_r_m1_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_1_1, y1r); + psi_r_m1_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_1, y1r); + psi_r_m1_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_3, y1r); + psi_r_m1_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_5, y1r); + psi_r_m1_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_7, y1r); + psi_r_m1_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_7, y1r); + psi_r_m3_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_5, y1r); + psi_r_m3_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_3, y1r); + psi_r_m3_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_1, y1r); + psi_r_m3_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_1, y1r); + psi_r_m3_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_3, y1r); + psi_r_m3_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_5, y1r); + psi_r_m3_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_7, y1r); + psi_r_m3_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_7, y1r); + psi_r_m5_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_5, y1r); + psi_r_m5_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_3, y1r); + psi_r_m5_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_1, y1r); + psi_r_m5_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_1, y1r); + psi_r_m5_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_3, y1r); + psi_r_m5_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_5, y1r); + psi_r_m5_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_7, y1r); + psi_r_m5_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_7, y1r); + psi_r_m7_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_5, y1r); + psi_r_m7_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_3, y1r); + psi_r_m7_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_1, y1r); + psi_r_m7_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_1, y1r); + psi_r_m7_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_3, y1r); + psi_r_m7_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_5, y1r); + psi_r_m7_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_7, y1r); + psi_r_m7_m7 = _mm_abs_epi16(xmm2); + + // Psi_i calculation from rho_rpi or rho_rmi + xmm2 = _mm_subs_epi16(rho_rmi_7_7, y1i); + psi_i_p7_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_7, y1i); + psi_i_p7_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_7, y1i); + psi_i_p7_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_7, y1i); + psi_i_p7_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_7, y1i); + psi_i_p7_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_7, y1i); + psi_i_p7_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_7, y1i); + psi_i_p7_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_7, y1i); + psi_i_p7_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_7_5, y1i); + psi_i_p5_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_5, y1i); + psi_i_p5_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_5, y1i); + psi_i_p5_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_5, y1i); + psi_i_p5_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_5, y1i); + psi_i_p5_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_5, y1i); + psi_i_p5_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_5, y1i); + psi_i_p5_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_5, y1i); + psi_i_p5_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_7_3, y1i); + psi_i_p3_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_3, y1i); + psi_i_p3_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_3, y1i); + psi_i_p3_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_3, y1i); + psi_i_p3_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_3, y1i); + psi_i_p3_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_3, y1i); + psi_i_p3_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_3, y1i); + psi_i_p3_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_3, y1i); + psi_i_p3_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_7_1, y1i); + psi_i_p1_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_1, y1i); + psi_i_p1_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_1, y1i); + psi_i_p1_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_1, y1i); + psi_i_p1_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_1, y1i); + psi_i_p1_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_1, y1i); + psi_i_p1_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_1, y1i); + psi_i_p1_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_1, y1i); + psi_i_p1_m7 = _mm_abs_epi16(xmm2); + + xmm2 = _mm_subs_epi16(rho_rpi_7_1, y1i); + psi_i_m1_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_1, y1i); + psi_i_m1_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_1, y1i); + psi_i_m1_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_1, y1i); + psi_i_m1_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_1_1, y1i); + psi_i_m1_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_1, y1i); + psi_i_m1_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_1, y1i); + psi_i_m1_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_1, y1i); + psi_i_m1_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_7_3, y1i); + psi_i_m3_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_3, y1i); + psi_i_m3_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_3, y1i); + psi_i_m3_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_3, y1i); + psi_i_m3_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_1_3, y1i); + psi_i_m3_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_3, y1i); + psi_i_m3_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_3, y1i); + psi_i_m3_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_3, y1i); + psi_i_m3_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_7_5, y1i); + psi_i_m5_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_5, y1i); + psi_i_m5_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_5, y1i); + psi_i_m5_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_5, y1i); + psi_i_m5_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_1_5, y1i); + psi_i_m5_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_5, y1i); + psi_i_m5_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_5, y1i); + psi_i_m5_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_5, y1i); + psi_i_m5_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_7_7, y1i); + psi_i_m7_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_7, y1i); + psi_i_m7_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_7, y1i); + psi_i_m7_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_7, y1i); + psi_i_m7_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_1_7, y1i); + psi_i_m7_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_7, y1i); + psi_i_m7_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_7, y1i); + psi_i_m7_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_7, y1i); + psi_i_m7_m7 = _mm_abs_epi16(xmm2); + + + // Rearrange desired MF output + xmm0 = stream0_128i_in[i]; + xmm1 = stream0_128i_in[i+1]; + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + y0r = _mm_unpacklo_epi64(xmm0,xmm1); // = [y0r(1),y0r(2),y0r(3),y0r(4)] + y0i = _mm_unpackhi_epi64(xmm0,xmm1); + + // Rearrange desired channel magnitudes + xmm2 = ch_mag_128i[i]; // = [|h|^2(1),|h|^2(1),|h|^2(2),|h|^2(2)]*(2/sqrt(10)) + xmm3 = ch_mag_128i[i+1]; // = [|h|^2(3),|h|^2(3),|h|^2(4),|h|^2(4)]*(2/sqrt(10)) + xmm2 = _mm_shufflelo_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shufflehi_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shuffle_epi32(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflelo_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflehi_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shuffle_epi32(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + ch_mag_des = _mm_unpacklo_epi64(xmm2,xmm3); + + y0r_one_over_sqrt_21 = _mm_mulhi_epi16(y0r, ONE_OVER_SQRT_42); + y0r_three_over_sqrt_21 = _mm_mulhi_epi16(y0r, THREE_OVER_SQRT_42); + y0r_five_over_sqrt_21 = _mm_mulhi_epi16(y0r, FIVE_OVER_SQRT_42); + y0r_five_over_sqrt_21 = _mm_slli_epi16(y0r_five_over_sqrt_21, 1); + y0r_seven_over_sqrt_21 = _mm_mulhi_epi16(y0r, SEVEN_OVER_SQRT_42); + y0r_seven_over_sqrt_21 = _mm_slli_epi16(y0r_seven_over_sqrt_21, 2); // Q2.14 + + y0i_one_over_sqrt_21 = _mm_mulhi_epi16(y0i, ONE_OVER_SQRT_42); + y0i_three_over_sqrt_21 = _mm_mulhi_epi16(y0i, THREE_OVER_SQRT_42); + y0i_five_over_sqrt_21 = _mm_mulhi_epi16(y0i, FIVE_OVER_SQRT_42); + y0i_five_over_sqrt_21 = _mm_slli_epi16(y0i_five_over_sqrt_21, 1); + y0i_seven_over_sqrt_21 = _mm_mulhi_epi16(y0i, SEVEN_OVER_SQRT_42); + y0i_seven_over_sqrt_21 = _mm_slli_epi16(y0i_seven_over_sqrt_21, 2); // Q2.14 + + y0_p_7_1 = _mm_adds_epi16(y0r_seven_over_sqrt_21, y0i_one_over_sqrt_21); + y0_p_7_3 = _mm_adds_epi16(y0r_seven_over_sqrt_21, y0i_three_over_sqrt_21); + y0_p_7_5 = _mm_adds_epi16(y0r_seven_over_sqrt_21, y0i_five_over_sqrt_21); + y0_p_7_7 = _mm_adds_epi16(y0r_seven_over_sqrt_21, y0i_seven_over_sqrt_21); + y0_p_5_1 = _mm_adds_epi16(y0r_five_over_sqrt_21, y0i_one_over_sqrt_21); + y0_p_5_3 = _mm_adds_epi16(y0r_five_over_sqrt_21, y0i_three_over_sqrt_21); + y0_p_5_5 = _mm_adds_epi16(y0r_five_over_sqrt_21, y0i_five_over_sqrt_21); + y0_p_5_7 = _mm_adds_epi16(y0r_five_over_sqrt_21, y0i_seven_over_sqrt_21); + y0_p_3_1 = _mm_adds_epi16(y0r_three_over_sqrt_21, y0i_one_over_sqrt_21); + y0_p_3_3 = _mm_adds_epi16(y0r_three_over_sqrt_21, y0i_three_over_sqrt_21); + y0_p_3_5 = _mm_adds_epi16(y0r_three_over_sqrt_21, y0i_five_over_sqrt_21); + y0_p_3_7 = _mm_adds_epi16(y0r_three_over_sqrt_21, y0i_seven_over_sqrt_21); + y0_p_1_1 = _mm_adds_epi16(y0r_one_over_sqrt_21, y0i_one_over_sqrt_21); + y0_p_1_3 = _mm_adds_epi16(y0r_one_over_sqrt_21, y0i_three_over_sqrt_21); + y0_p_1_5 = _mm_adds_epi16(y0r_one_over_sqrt_21, y0i_five_over_sqrt_21); + y0_p_1_7 = _mm_adds_epi16(y0r_one_over_sqrt_21, y0i_seven_over_sqrt_21); + + y0_m_1_1 = _mm_subs_epi16(y0r_one_over_sqrt_21, y0i_one_over_sqrt_21); + y0_m_1_3 = _mm_subs_epi16(y0r_one_over_sqrt_21, y0i_three_over_sqrt_21); + y0_m_1_5 = _mm_subs_epi16(y0r_one_over_sqrt_21, y0i_five_over_sqrt_21); + y0_m_1_7 = _mm_subs_epi16(y0r_one_over_sqrt_21, y0i_seven_over_sqrt_21); + y0_m_3_1 = _mm_subs_epi16(y0r_three_over_sqrt_21, y0i_one_over_sqrt_21); + y0_m_3_3 = _mm_subs_epi16(y0r_three_over_sqrt_21, y0i_three_over_sqrt_21); + y0_m_3_5 = _mm_subs_epi16(y0r_three_over_sqrt_21, y0i_five_over_sqrt_21); + y0_m_3_7 = _mm_subs_epi16(y0r_three_over_sqrt_21, y0i_seven_over_sqrt_21); + y0_m_5_1 = _mm_subs_epi16(y0r_five_over_sqrt_21, y0i_one_over_sqrt_21); + y0_m_5_3 = _mm_subs_epi16(y0r_five_over_sqrt_21, y0i_three_over_sqrt_21); + y0_m_5_5 = _mm_subs_epi16(y0r_five_over_sqrt_21, y0i_five_over_sqrt_21); + y0_m_5_7 = _mm_subs_epi16(y0r_five_over_sqrt_21, y0i_seven_over_sqrt_21); + y0_m_7_1 = _mm_subs_epi16(y0r_seven_over_sqrt_21, y0i_one_over_sqrt_21); + y0_m_7_3 = _mm_subs_epi16(y0r_seven_over_sqrt_21, y0i_three_over_sqrt_21); + y0_m_7_5 = _mm_subs_epi16(y0r_seven_over_sqrt_21, y0i_five_over_sqrt_21); + y0_m_7_7 = _mm_subs_epi16(y0r_seven_over_sqrt_21, y0i_seven_over_sqrt_21); + + // divide by sqrt(2) + psi_r_p7_p7 = _mm_mulhi_epi16(psi_r_p7_p7, ONE_OVER_SQRT_2); + psi_r_p7_p7 = _mm_slli_epi16(psi_r_p7_p7, 1); + psi_r_p7_p5 = _mm_mulhi_epi16(psi_r_p7_p5, ONE_OVER_SQRT_2); + psi_r_p7_p5 = _mm_slli_epi16(psi_r_p7_p5, 1); + psi_r_p7_p3 = _mm_mulhi_epi16(psi_r_p7_p3, ONE_OVER_SQRT_2); + psi_r_p7_p3 = _mm_slli_epi16(psi_r_p7_p3, 1); + psi_r_p7_p1 = _mm_mulhi_epi16(psi_r_p7_p1, ONE_OVER_SQRT_2); + psi_r_p7_p1 = _mm_slli_epi16(psi_r_p7_p1, 1); + psi_r_p7_m1 = _mm_mulhi_epi16(psi_r_p7_m1, ONE_OVER_SQRT_2); + psi_r_p7_m1 = _mm_slli_epi16(psi_r_p7_m1, 1); + psi_r_p7_m3 = _mm_mulhi_epi16(psi_r_p7_m3, ONE_OVER_SQRT_2); + psi_r_p7_m3 = _mm_slli_epi16(psi_r_p7_m3, 1); + psi_r_p7_m5 = _mm_mulhi_epi16(psi_r_p7_m5, ONE_OVER_SQRT_2); + psi_r_p7_m5 = _mm_slli_epi16(psi_r_p7_m5, 1); + psi_r_p7_m7 = _mm_mulhi_epi16(psi_r_p7_m7, ONE_OVER_SQRT_2); + psi_r_p7_m7 = _mm_slli_epi16(psi_r_p7_m7, 1); + psi_r_p5_p7 = _mm_mulhi_epi16(psi_r_p5_p7, ONE_OVER_SQRT_2); + psi_r_p5_p7 = _mm_slli_epi16(psi_r_p5_p7, 1); + psi_r_p5_p5 = _mm_mulhi_epi16(psi_r_p5_p5, ONE_OVER_SQRT_2); + psi_r_p5_p5 = _mm_slli_epi16(psi_r_p5_p5, 1); + psi_r_p5_p3 = _mm_mulhi_epi16(psi_r_p5_p3, ONE_OVER_SQRT_2); + psi_r_p5_p3 = _mm_slli_epi16(psi_r_p5_p3, 1); + psi_r_p5_p1 = _mm_mulhi_epi16(psi_r_p5_p1, ONE_OVER_SQRT_2); + psi_r_p5_p1 = _mm_slli_epi16(psi_r_p5_p1, 1); + psi_r_p5_m1 = _mm_mulhi_epi16(psi_r_p5_m1, ONE_OVER_SQRT_2); + psi_r_p5_m1 = _mm_slli_epi16(psi_r_p5_m1, 1); + psi_r_p5_m3 = _mm_mulhi_epi16(psi_r_p5_m3, ONE_OVER_SQRT_2); + psi_r_p5_m3 = _mm_slli_epi16(psi_r_p5_m3, 1); + psi_r_p5_m5 = _mm_mulhi_epi16(psi_r_p5_m5, ONE_OVER_SQRT_2); + psi_r_p5_m5 = _mm_slli_epi16(psi_r_p5_m5, 1); + psi_r_p5_m7 = _mm_mulhi_epi16(psi_r_p5_m7, ONE_OVER_SQRT_2); + psi_r_p5_m7 = _mm_slli_epi16(psi_r_p5_m7, 1); + psi_r_p3_p7 = _mm_mulhi_epi16(psi_r_p3_p7, ONE_OVER_SQRT_2); + psi_r_p3_p7 = _mm_slli_epi16(psi_r_p3_p7, 1); + psi_r_p3_p5 = _mm_mulhi_epi16(psi_r_p3_p5, ONE_OVER_SQRT_2); + psi_r_p3_p5 = _mm_slli_epi16(psi_r_p3_p5, 1); + psi_r_p3_p3 = _mm_mulhi_epi16(psi_r_p3_p3, ONE_OVER_SQRT_2); + psi_r_p3_p3 = _mm_slli_epi16(psi_r_p3_p3, 1); + psi_r_p3_p1 = _mm_mulhi_epi16(psi_r_p3_p1, ONE_OVER_SQRT_2); + psi_r_p3_p1 = _mm_slli_epi16(psi_r_p3_p1, 1); + psi_r_p3_m1 = _mm_mulhi_epi16(psi_r_p3_m1, ONE_OVER_SQRT_2); + psi_r_p3_m1 = _mm_slli_epi16(psi_r_p3_m1, 1); + psi_r_p3_m3 = _mm_mulhi_epi16(psi_r_p3_m3, ONE_OVER_SQRT_2); + psi_r_p3_m3 = _mm_slli_epi16(psi_r_p3_m3, 1); + psi_r_p3_m5 = _mm_mulhi_epi16(psi_r_p3_m5, ONE_OVER_SQRT_2); + psi_r_p3_m5 = _mm_slli_epi16(psi_r_p3_m5, 1); + psi_r_p3_m7 = _mm_mulhi_epi16(psi_r_p3_m7, ONE_OVER_SQRT_2); + psi_r_p3_m7 = _mm_slli_epi16(psi_r_p3_m7, 1); + psi_r_p1_p7 = _mm_mulhi_epi16(psi_r_p1_p7, ONE_OVER_SQRT_2); + psi_r_p1_p7 = _mm_slli_epi16(psi_r_p1_p7, 1); + psi_r_p1_p5 = _mm_mulhi_epi16(psi_r_p1_p5, ONE_OVER_SQRT_2); + psi_r_p1_p5 = _mm_slli_epi16(psi_r_p1_p5, 1); + psi_r_p1_p3 = _mm_mulhi_epi16(psi_r_p1_p3, ONE_OVER_SQRT_2); + psi_r_p1_p3 = _mm_slli_epi16(psi_r_p1_p3, 1); + psi_r_p1_p1 = _mm_mulhi_epi16(psi_r_p1_p1, ONE_OVER_SQRT_2); + psi_r_p1_p1 = _mm_slli_epi16(psi_r_p1_p1, 1); + psi_r_p1_m1 = _mm_mulhi_epi16(psi_r_p1_m1, ONE_OVER_SQRT_2); + psi_r_p1_m1 = _mm_slli_epi16(psi_r_p1_m1, 1); + psi_r_p1_m3 = _mm_mulhi_epi16(psi_r_p1_m3, ONE_OVER_SQRT_2); + psi_r_p1_m3 = _mm_slli_epi16(psi_r_p1_m3, 1); + psi_r_p1_m5 = _mm_mulhi_epi16(psi_r_p1_m5, ONE_OVER_SQRT_2); + psi_r_p1_m5 = _mm_slli_epi16(psi_r_p1_m5, 1); + psi_r_p1_m7 = _mm_mulhi_epi16(psi_r_p1_m7, ONE_OVER_SQRT_2); + psi_r_p1_m7 = _mm_slli_epi16(psi_r_p1_m7, 1); + psi_r_m1_p7 = _mm_mulhi_epi16(psi_r_m1_p7, ONE_OVER_SQRT_2); + psi_r_m1_p7 = _mm_slli_epi16(psi_r_m1_p7, 1); + psi_r_m1_p5 = _mm_mulhi_epi16(psi_r_m1_p5, ONE_OVER_SQRT_2); + psi_r_m1_p5 = _mm_slli_epi16(psi_r_m1_p5, 1); + psi_r_m1_p3 = _mm_mulhi_epi16(psi_r_m1_p3, ONE_OVER_SQRT_2); + psi_r_m1_p3 = _mm_slli_epi16(psi_r_m1_p3, 1); + psi_r_m1_p1 = _mm_mulhi_epi16(psi_r_m1_p1, ONE_OVER_SQRT_2); + psi_r_m1_p1 = _mm_slli_epi16(psi_r_m1_p1, 1); + psi_r_m1_m1 = _mm_mulhi_epi16(psi_r_m1_m1, ONE_OVER_SQRT_2); + psi_r_m1_m1 = _mm_slli_epi16(psi_r_m1_m1, 1); + psi_r_m1_m3 = _mm_mulhi_epi16(psi_r_m1_m3, ONE_OVER_SQRT_2); + psi_r_m1_m3 = _mm_slli_epi16(psi_r_m1_m3, 1); + psi_r_m1_m5 = _mm_mulhi_epi16(psi_r_m1_m5, ONE_OVER_SQRT_2); + psi_r_m1_m5 = _mm_slli_epi16(psi_r_m1_m5, 1); + psi_r_m1_m7 = _mm_mulhi_epi16(psi_r_m1_m7, ONE_OVER_SQRT_2); + psi_r_m1_m7 = _mm_slli_epi16(psi_r_m1_m7, 1); + psi_r_m3_p7 = _mm_mulhi_epi16(psi_r_m3_p7, ONE_OVER_SQRT_2); + psi_r_m3_p7 = _mm_slli_epi16(psi_r_m3_p7, 1); + psi_r_m3_p5 = _mm_mulhi_epi16(psi_r_m3_p5, ONE_OVER_SQRT_2); + psi_r_m3_p5 = _mm_slli_epi16(psi_r_m3_p5, 1); + psi_r_m3_p3 = _mm_mulhi_epi16(psi_r_m3_p3, ONE_OVER_SQRT_2); + psi_r_m3_p3 = _mm_slli_epi16(psi_r_m3_p3, 1); + psi_r_m3_p1 = _mm_mulhi_epi16(psi_r_m3_p1, ONE_OVER_SQRT_2); + psi_r_m3_p1 = _mm_slli_epi16(psi_r_m3_p1, 1); + psi_r_m3_m1 = _mm_mulhi_epi16(psi_r_m3_m1, ONE_OVER_SQRT_2); + psi_r_m3_m1 = _mm_slli_epi16(psi_r_m3_m1, 1); + psi_r_m3_m3 = _mm_mulhi_epi16(psi_r_m3_m3, ONE_OVER_SQRT_2); + psi_r_m3_m3 = _mm_slli_epi16(psi_r_m3_m3, 1); + psi_r_m3_m5 = _mm_mulhi_epi16(psi_r_m3_m5, ONE_OVER_SQRT_2); + psi_r_m3_m5 = _mm_slli_epi16(psi_r_m3_m5, 1); + psi_r_m3_m7 = _mm_mulhi_epi16(psi_r_m3_m7, ONE_OVER_SQRT_2); + psi_r_m3_m7 = _mm_slli_epi16(psi_r_m3_m7, 1); + psi_r_m5_p7 = _mm_mulhi_epi16(psi_r_m5_p7, ONE_OVER_SQRT_2); + psi_r_m5_p7 = _mm_slli_epi16(psi_r_m5_p7, 1); + psi_r_m5_p5 = _mm_mulhi_epi16(psi_r_m5_p5, ONE_OVER_SQRT_2); + psi_r_m5_p5 = _mm_slli_epi16(psi_r_m5_p5, 1); + psi_r_m5_p3 = _mm_mulhi_epi16(psi_r_m5_p3, ONE_OVER_SQRT_2); + psi_r_m5_p3 = _mm_slli_epi16(psi_r_m5_p3, 1); + psi_r_m5_p1 = _mm_mulhi_epi16(psi_r_m5_p1, ONE_OVER_SQRT_2); + psi_r_m5_p1 = _mm_slli_epi16(psi_r_m5_p1, 1); + psi_r_m5_m1 = _mm_mulhi_epi16(psi_r_m5_m1, ONE_OVER_SQRT_2); + psi_r_m5_m1 = _mm_slli_epi16(psi_r_m5_m1, 1); + psi_r_m5_m3 = _mm_mulhi_epi16(psi_r_m5_m3, ONE_OVER_SQRT_2); + psi_r_m5_m3 = _mm_slli_epi16(psi_r_m5_m3, 1); + psi_r_m5_m5 = _mm_mulhi_epi16(psi_r_m5_m5, ONE_OVER_SQRT_2); + psi_r_m5_m5 = _mm_slli_epi16(psi_r_m5_m5, 1); + psi_r_m5_m7 = _mm_mulhi_epi16(psi_r_m5_m7, ONE_OVER_SQRT_2); + psi_r_m5_m7 = _mm_slli_epi16(psi_r_m5_m7, 1); + psi_r_m7_p7 = _mm_mulhi_epi16(psi_r_m7_p7, ONE_OVER_SQRT_2); + psi_r_m7_p7 = _mm_slli_epi16(psi_r_m7_p7, 1); + psi_r_m7_p5 = _mm_mulhi_epi16(psi_r_m7_p5, ONE_OVER_SQRT_2); + psi_r_m7_p5 = _mm_slli_epi16(psi_r_m7_p5, 1); + psi_r_m7_p3 = _mm_mulhi_epi16(psi_r_m7_p3, ONE_OVER_SQRT_2); + psi_r_m7_p3 = _mm_slli_epi16(psi_r_m7_p3, 1); + psi_r_m7_p1 = _mm_mulhi_epi16(psi_r_m7_p1, ONE_OVER_SQRT_2); + psi_r_m7_p1 = _mm_slli_epi16(psi_r_m7_p1, 1); + psi_r_m7_m1 = _mm_mulhi_epi16(psi_r_m7_m1, ONE_OVER_SQRT_2); + psi_r_m7_m1 = _mm_slli_epi16(psi_r_m7_m1, 1); + psi_r_m7_m3 = _mm_mulhi_epi16(psi_r_m7_m3, ONE_OVER_SQRT_2); + psi_r_m7_m3 = _mm_slli_epi16(psi_r_m7_m3, 1); + psi_r_m7_m5 = _mm_mulhi_epi16(psi_r_m7_m5, ONE_OVER_SQRT_2); + psi_r_m7_m5 = _mm_slli_epi16(psi_r_m7_m5, 1); + psi_r_m7_m7 = _mm_mulhi_epi16(psi_r_m7_m7, ONE_OVER_SQRT_2); + psi_r_m7_m7 = _mm_slli_epi16(psi_r_m7_m7, 1); + + psi_i_p7_p7 = _mm_mulhi_epi16(psi_i_p7_p7, ONE_OVER_SQRT_2); + psi_i_p7_p7 = _mm_slli_epi16(psi_i_p7_p7, 1); + psi_i_p7_p5 = _mm_mulhi_epi16(psi_i_p7_p5, ONE_OVER_SQRT_2); + psi_i_p7_p5 = _mm_slli_epi16(psi_i_p7_p5, 1); + psi_i_p7_p3 = _mm_mulhi_epi16(psi_i_p7_p3, ONE_OVER_SQRT_2); + psi_i_p7_p3 = _mm_slli_epi16(psi_i_p7_p3, 1); + psi_i_p7_p1 = _mm_mulhi_epi16(psi_i_p7_p1, ONE_OVER_SQRT_2); + psi_i_p7_p1 = _mm_slli_epi16(psi_i_p7_p1, 1); + psi_i_p7_m1 = _mm_mulhi_epi16(psi_i_p7_m1, ONE_OVER_SQRT_2); + psi_i_p7_m1 = _mm_slli_epi16(psi_i_p7_m1, 1); + psi_i_p7_m3 = _mm_mulhi_epi16(psi_i_p7_m3, ONE_OVER_SQRT_2); + psi_i_p7_m3 = _mm_slli_epi16(psi_i_p7_m3, 1); + psi_i_p7_m5 = _mm_mulhi_epi16(psi_i_p7_m5, ONE_OVER_SQRT_2); + psi_i_p7_m5 = _mm_slli_epi16(psi_i_p7_m5, 1); + psi_i_p7_m7 = _mm_mulhi_epi16(psi_i_p7_m7, ONE_OVER_SQRT_2); + psi_i_p7_m7 = _mm_slli_epi16(psi_i_p7_m7, 1); + psi_i_p5_p7 = _mm_mulhi_epi16(psi_i_p5_p7, ONE_OVER_SQRT_2); + psi_i_p5_p7 = _mm_slli_epi16(psi_i_p5_p7, 1); + psi_i_p5_p5 = _mm_mulhi_epi16(psi_i_p5_p5, ONE_OVER_SQRT_2); + psi_i_p5_p5 = _mm_slli_epi16(psi_i_p5_p5, 1); + psi_i_p5_p3 = _mm_mulhi_epi16(psi_i_p5_p3, ONE_OVER_SQRT_2); + psi_i_p5_p3 = _mm_slli_epi16(psi_i_p5_p3, 1); + psi_i_p5_p1 = _mm_mulhi_epi16(psi_i_p5_p1, ONE_OVER_SQRT_2); + psi_i_p5_p1 = _mm_slli_epi16(psi_i_p5_p1, 1); + psi_i_p5_m1 = _mm_mulhi_epi16(psi_i_p5_m1, ONE_OVER_SQRT_2); + psi_i_p5_m1 = _mm_slli_epi16(psi_i_p5_m1, 1); + psi_i_p5_m3 = _mm_mulhi_epi16(psi_i_p5_m3, ONE_OVER_SQRT_2); + psi_i_p5_m3 = _mm_slli_epi16(psi_i_p5_m3, 1); + psi_i_p5_m5 = _mm_mulhi_epi16(psi_i_p5_m5, ONE_OVER_SQRT_2); + psi_i_p5_m5 = _mm_slli_epi16(psi_i_p5_m5, 1); + psi_i_p5_m7 = _mm_mulhi_epi16(psi_i_p5_m7, ONE_OVER_SQRT_2); + psi_i_p5_m7 = _mm_slli_epi16(psi_i_p5_m7, 1); + psi_i_p3_p7 = _mm_mulhi_epi16(psi_i_p3_p7, ONE_OVER_SQRT_2); + psi_i_p3_p7 = _mm_slli_epi16(psi_i_p3_p7, 1); + psi_i_p3_p5 = _mm_mulhi_epi16(psi_i_p3_p5, ONE_OVER_SQRT_2); + psi_i_p3_p5 = _mm_slli_epi16(psi_i_p3_p5, 1); + psi_i_p3_p3 = _mm_mulhi_epi16(psi_i_p3_p3, ONE_OVER_SQRT_2); + psi_i_p3_p3 = _mm_slli_epi16(psi_i_p3_p3, 1); + psi_i_p3_p1 = _mm_mulhi_epi16(psi_i_p3_p1, ONE_OVER_SQRT_2); + psi_i_p3_p1 = _mm_slli_epi16(psi_i_p3_p1, 1); + psi_i_p3_m1 = _mm_mulhi_epi16(psi_i_p3_m1, ONE_OVER_SQRT_2); + psi_i_p3_m1 = _mm_slli_epi16(psi_i_p3_m1, 1); + psi_i_p3_m3 = _mm_mulhi_epi16(psi_i_p3_m3, ONE_OVER_SQRT_2); + psi_i_p3_m3 = _mm_slli_epi16(psi_i_p3_m3, 1); + psi_i_p3_m5 = _mm_mulhi_epi16(psi_i_p3_m5, ONE_OVER_SQRT_2); + psi_i_p3_m5 = _mm_slli_epi16(psi_i_p3_m5, 1); + psi_i_p3_m7 = _mm_mulhi_epi16(psi_i_p3_m7, ONE_OVER_SQRT_2); + psi_i_p3_m7 = _mm_slli_epi16(psi_i_p3_m7, 1); + psi_i_p1_p7 = _mm_mulhi_epi16(psi_i_p1_p7, ONE_OVER_SQRT_2); + psi_i_p1_p7 = _mm_slli_epi16(psi_i_p1_p7, 1); + psi_i_p1_p5 = _mm_mulhi_epi16(psi_i_p1_p5, ONE_OVER_SQRT_2); + psi_i_p1_p5 = _mm_slli_epi16(psi_i_p1_p5, 1); + psi_i_p1_p3 = _mm_mulhi_epi16(psi_i_p1_p3, ONE_OVER_SQRT_2); + psi_i_p1_p3 = _mm_slli_epi16(psi_i_p1_p3, 1); + psi_i_p1_p1 = _mm_mulhi_epi16(psi_i_p1_p1, ONE_OVER_SQRT_2); + psi_i_p1_p1 = _mm_slli_epi16(psi_i_p1_p1, 1); + psi_i_p1_m1 = _mm_mulhi_epi16(psi_i_p1_m1, ONE_OVER_SQRT_2); + psi_i_p1_m1 = _mm_slli_epi16(psi_i_p1_m1, 1); + psi_i_p1_m3 = _mm_mulhi_epi16(psi_i_p1_m3, ONE_OVER_SQRT_2); + psi_i_p1_m3 = _mm_slli_epi16(psi_i_p1_m3, 1); + psi_i_p1_m5 = _mm_mulhi_epi16(psi_i_p1_m5, ONE_OVER_SQRT_2); + psi_i_p1_m5 = _mm_slli_epi16(psi_i_p1_m5, 1); + psi_i_p1_m7 = _mm_mulhi_epi16(psi_i_p1_m7, ONE_OVER_SQRT_2); + psi_i_p1_m7 = _mm_slli_epi16(psi_i_p1_m7, 1); + psi_i_m1_p7 = _mm_mulhi_epi16(psi_i_m1_p7, ONE_OVER_SQRT_2); + psi_i_m1_p7 = _mm_slli_epi16(psi_i_m1_p7, 1); + psi_i_m1_p5 = _mm_mulhi_epi16(psi_i_m1_p5, ONE_OVER_SQRT_2); + psi_i_m1_p5 = _mm_slli_epi16(psi_i_m1_p5, 1); + psi_i_m1_p3 = _mm_mulhi_epi16(psi_i_m1_p3, ONE_OVER_SQRT_2); + psi_i_m1_p3 = _mm_slli_epi16(psi_i_m1_p3, 1); + psi_i_m1_p1 = _mm_mulhi_epi16(psi_i_m1_p1, ONE_OVER_SQRT_2); + psi_i_m1_p1 = _mm_slli_epi16(psi_i_m1_p1, 1); + psi_i_m1_m1 = _mm_mulhi_epi16(psi_i_m1_m1, ONE_OVER_SQRT_2); + psi_i_m1_m1 = _mm_slli_epi16(psi_i_m1_m1, 1); + psi_i_m1_m3 = _mm_mulhi_epi16(psi_i_m1_m3, ONE_OVER_SQRT_2); + psi_i_m1_m3 = _mm_slli_epi16(psi_i_m1_m3, 1); + psi_i_m1_m5 = _mm_mulhi_epi16(psi_i_m1_m5, ONE_OVER_SQRT_2); + psi_i_m1_m5 = _mm_slli_epi16(psi_i_m1_m5, 1); + psi_i_m1_m7 = _mm_mulhi_epi16(psi_i_m1_m7, ONE_OVER_SQRT_2); + psi_i_m1_m7 = _mm_slli_epi16(psi_i_m1_m7, 1); + psi_i_m3_p7 = _mm_mulhi_epi16(psi_i_m3_p7, ONE_OVER_SQRT_2); + psi_i_m3_p7 = _mm_slli_epi16(psi_i_m3_p7, 1); + psi_i_m3_p5 = _mm_mulhi_epi16(psi_i_m3_p5, ONE_OVER_SQRT_2); + psi_i_m3_p5 = _mm_slli_epi16(psi_i_m3_p5, 1); + psi_i_m3_p3 = _mm_mulhi_epi16(psi_i_m3_p3, ONE_OVER_SQRT_2); + psi_i_m3_p3 = _mm_slli_epi16(psi_i_m3_p3, 1); + psi_i_m3_p1 = _mm_mulhi_epi16(psi_i_m3_p1, ONE_OVER_SQRT_2); + psi_i_m3_p1 = _mm_slli_epi16(psi_i_m3_p1, 1); + psi_i_m3_m1 = _mm_mulhi_epi16(psi_i_m3_m1, ONE_OVER_SQRT_2); + psi_i_m3_m1 = _mm_slli_epi16(psi_i_m3_m1, 1); + psi_i_m3_m3 = _mm_mulhi_epi16(psi_i_m3_m3, ONE_OVER_SQRT_2); + psi_i_m3_m3 = _mm_slli_epi16(psi_i_m3_m3, 1); + psi_i_m3_m5 = _mm_mulhi_epi16(psi_i_m3_m5, ONE_OVER_SQRT_2); + psi_i_m3_m5 = _mm_slli_epi16(psi_i_m3_m5, 1); + psi_i_m3_m7 = _mm_mulhi_epi16(psi_i_m3_m7, ONE_OVER_SQRT_2); + psi_i_m3_m7 = _mm_slli_epi16(psi_i_m3_m7, 1); + psi_i_m5_p7 = _mm_mulhi_epi16(psi_i_m5_p7, ONE_OVER_SQRT_2); + psi_i_m5_p7 = _mm_slli_epi16(psi_i_m5_p7, 1); + psi_i_m5_p5 = _mm_mulhi_epi16(psi_i_m5_p5, ONE_OVER_SQRT_2); + psi_i_m5_p5 = _mm_slli_epi16(psi_i_m5_p5, 1); + psi_i_m5_p3 = _mm_mulhi_epi16(psi_i_m5_p3, ONE_OVER_SQRT_2); + psi_i_m5_p3 = _mm_slli_epi16(psi_i_m5_p3, 1); + psi_i_m5_p1 = _mm_mulhi_epi16(psi_i_m5_p1, ONE_OVER_SQRT_2); + psi_i_m5_p1 = _mm_slli_epi16(psi_i_m5_p1, 1); + psi_i_m5_m1 = _mm_mulhi_epi16(psi_i_m5_m1, ONE_OVER_SQRT_2); + psi_i_m5_m1 = _mm_slli_epi16(psi_i_m5_m1, 1); + psi_i_m5_m3 = _mm_mulhi_epi16(psi_i_m5_m3, ONE_OVER_SQRT_2); + psi_i_m5_m3 = _mm_slli_epi16(psi_i_m5_m3, 1); + psi_i_m5_m5 = _mm_mulhi_epi16(psi_i_m5_m5, ONE_OVER_SQRT_2); + psi_i_m5_m5 = _mm_slli_epi16(psi_i_m5_m5, 1); + psi_i_m5_m7 = _mm_mulhi_epi16(psi_i_m5_m7, ONE_OVER_SQRT_2); + psi_i_m5_m7 = _mm_slli_epi16(psi_i_m5_m7, 1); + psi_i_m7_p7 = _mm_mulhi_epi16(psi_i_m7_p7, ONE_OVER_SQRT_2); + psi_i_m7_p7 = _mm_slli_epi16(psi_i_m7_p7, 1); + psi_i_m7_p5 = _mm_mulhi_epi16(psi_i_m7_p5, ONE_OVER_SQRT_2); + psi_i_m7_p5 = _mm_slli_epi16(psi_i_m7_p5, 1); + psi_i_m7_p3 = _mm_mulhi_epi16(psi_i_m7_p3, ONE_OVER_SQRT_2); + psi_i_m7_p3 = _mm_slli_epi16(psi_i_m7_p3, 1); + psi_i_m7_p1 = _mm_mulhi_epi16(psi_i_m7_p1, ONE_OVER_SQRT_2); + psi_i_m7_p1 = _mm_slli_epi16(psi_i_m7_p1, 1); + psi_i_m7_m1 = _mm_mulhi_epi16(psi_i_m7_m1, ONE_OVER_SQRT_2); + psi_i_m7_m1 = _mm_slli_epi16(psi_i_m7_m1, 1); + psi_i_m7_m3 = _mm_mulhi_epi16(psi_i_m7_m3, ONE_OVER_SQRT_2); + psi_i_m7_m3 = _mm_slli_epi16(psi_i_m7_m3, 1); + psi_i_m7_m5 = _mm_mulhi_epi16(psi_i_m7_m5, ONE_OVER_SQRT_2); + psi_i_m7_m5 = _mm_slli_epi16(psi_i_m7_m5, 1); + psi_i_m7_m7 = _mm_mulhi_epi16(psi_i_m7_m7, ONE_OVER_SQRT_2); + psi_i_m7_m7 = _mm_slli_epi16(psi_i_m7_m7, 1); + + psi_a_p7_p7 = _mm_adds_epi16(psi_r_p7_p7, psi_i_p7_p7); + psi_a_p7_p5 = _mm_adds_epi16(psi_r_p7_p5, psi_i_p7_p5); + psi_a_p7_p3 = _mm_adds_epi16(psi_r_p7_p3, psi_i_p7_p3); + psi_a_p7_p1 = _mm_adds_epi16(psi_r_p7_p1, psi_i_p7_p1); + psi_a_p7_m1 = _mm_adds_epi16(psi_r_p7_m1, psi_i_p7_m1); + psi_a_p7_m3 = _mm_adds_epi16(psi_r_p7_m3, psi_i_p7_m3); + psi_a_p7_m5 = _mm_adds_epi16(psi_r_p7_m5, psi_i_p7_m5); + psi_a_p7_m7 = _mm_adds_epi16(psi_r_p7_m7, psi_i_p7_m7); + psi_a_p5_p7 = _mm_adds_epi16(psi_r_p5_p7, psi_i_p5_p7); + psi_a_p5_p5 = _mm_adds_epi16(psi_r_p5_p5, psi_i_p5_p5); + psi_a_p5_p3 = _mm_adds_epi16(psi_r_p5_p3, psi_i_p5_p3); + psi_a_p5_p1 = _mm_adds_epi16(psi_r_p5_p1, psi_i_p5_p1); + psi_a_p5_m1 = _mm_adds_epi16(psi_r_p5_m1, psi_i_p5_m1); + psi_a_p5_m3 = _mm_adds_epi16(psi_r_p5_m3, psi_i_p5_m3); + psi_a_p5_m5 = _mm_adds_epi16(psi_r_p5_m5, psi_i_p5_m5); + psi_a_p5_m7 = _mm_adds_epi16(psi_r_p5_m7, psi_i_p5_m7); + psi_a_p3_p7 = _mm_adds_epi16(psi_r_p3_p7, psi_i_p3_p7); + psi_a_p3_p5 = _mm_adds_epi16(psi_r_p3_p5, psi_i_p3_p5); + psi_a_p3_p3 = _mm_adds_epi16(psi_r_p3_p3, psi_i_p3_p3); + psi_a_p3_p1 = _mm_adds_epi16(psi_r_p3_p1, psi_i_p3_p1); + psi_a_p3_m1 = _mm_adds_epi16(psi_r_p3_m1, psi_i_p3_m1); + psi_a_p3_m3 = _mm_adds_epi16(psi_r_p3_m3, psi_i_p3_m3); + psi_a_p3_m5 = _mm_adds_epi16(psi_r_p3_m5, psi_i_p3_m5); + psi_a_p3_m7 = _mm_adds_epi16(psi_r_p3_m7, psi_i_p3_m7); + psi_a_p1_p7 = _mm_adds_epi16(psi_r_p1_p7, psi_i_p1_p7); + psi_a_p1_p5 = _mm_adds_epi16(psi_r_p1_p5, psi_i_p1_p5); + psi_a_p1_p3 = _mm_adds_epi16(psi_r_p1_p3, psi_i_p1_p3); + psi_a_p1_p1 = _mm_adds_epi16(psi_r_p1_p1, psi_i_p1_p1); + psi_a_p1_m1 = _mm_adds_epi16(psi_r_p1_m1, psi_i_p1_m1); + psi_a_p1_m3 = _mm_adds_epi16(psi_r_p1_m3, psi_i_p1_m3); + psi_a_p1_m5 = _mm_adds_epi16(psi_r_p1_m5, psi_i_p1_m5); + psi_a_p1_m7 = _mm_adds_epi16(psi_r_p1_m7, psi_i_p1_m7); + psi_a_m1_p7 = _mm_adds_epi16(psi_r_m1_p7, psi_i_m1_p7); + psi_a_m1_p5 = _mm_adds_epi16(psi_r_m1_p5, psi_i_m1_p5); + psi_a_m1_p3 = _mm_adds_epi16(psi_r_m1_p3, psi_i_m1_p3); + psi_a_m1_p1 = _mm_adds_epi16(psi_r_m1_p1, psi_i_m1_p1); + psi_a_m1_m1 = _mm_adds_epi16(psi_r_m1_m1, psi_i_m1_m1); + psi_a_m1_m3 = _mm_adds_epi16(psi_r_m1_m3, psi_i_m1_m3); + psi_a_m1_m5 = _mm_adds_epi16(psi_r_m1_m5, psi_i_m1_m5); + psi_a_m1_m7 = _mm_adds_epi16(psi_r_m1_m7, psi_i_m1_m7); + psi_a_m3_p7 = _mm_adds_epi16(psi_r_m3_p7, psi_i_m3_p7); + psi_a_m3_p5 = _mm_adds_epi16(psi_r_m3_p5, psi_i_m3_p5); + psi_a_m3_p3 = _mm_adds_epi16(psi_r_m3_p3, psi_i_m3_p3); + psi_a_m3_p1 = _mm_adds_epi16(psi_r_m3_p1, psi_i_m3_p1); + psi_a_m3_m1 = _mm_adds_epi16(psi_r_m3_m1, psi_i_m3_m1); + psi_a_m3_m3 = _mm_adds_epi16(psi_r_m3_m3, psi_i_m3_m3); + psi_a_m3_m5 = _mm_adds_epi16(psi_r_m3_m5, psi_i_m3_m5); + psi_a_m3_m7 = _mm_adds_epi16(psi_r_m3_m7, psi_i_m3_m7); + psi_a_m5_p7 = _mm_adds_epi16(psi_r_m5_p7, psi_i_m5_p7); + psi_a_m5_p5 = _mm_adds_epi16(psi_r_m5_p5, psi_i_m5_p5); + psi_a_m5_p3 = _mm_adds_epi16(psi_r_m5_p3, psi_i_m5_p3); + psi_a_m5_p1 = _mm_adds_epi16(psi_r_m5_p1, psi_i_m5_p1); + psi_a_m5_m1 = _mm_adds_epi16(psi_r_m5_m1, psi_i_m5_m1); + psi_a_m5_m3 = _mm_adds_epi16(psi_r_m5_m3, psi_i_m5_m3); + psi_a_m5_m5 = _mm_adds_epi16(psi_r_m5_m5, psi_i_m5_m5); + psi_a_m5_m7 = _mm_adds_epi16(psi_r_m5_m7, psi_i_m5_m7); + psi_a_m7_p7 = _mm_adds_epi16(psi_r_m7_p7, psi_i_m7_p7); + psi_a_m7_p5 = _mm_adds_epi16(psi_r_m7_p5, psi_i_m7_p5); + psi_a_m7_p3 = _mm_adds_epi16(psi_r_m7_p3, psi_i_m7_p3); + psi_a_m7_p1 = _mm_adds_epi16(psi_r_m7_p1, psi_i_m7_p1); + psi_a_m7_m1 = _mm_adds_epi16(psi_r_m7_m1, psi_i_m7_m1); + psi_a_m7_m3 = _mm_adds_epi16(psi_r_m7_m3, psi_i_m7_m3); + psi_a_m7_m5 = _mm_adds_epi16(psi_r_m7_m5, psi_i_m7_m5); + psi_a_m7_m7 = _mm_adds_epi16(psi_r_m7_m7, psi_i_m7_m7); + + // Computing different multiples of ||h0||^2 + // x=1, y=1 + ch_mag_2_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,ONE_OVER_FOUR_SQRT_42); + ch_mag_2_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_2_over_42_with_sigma2,1); + // x=1, y=3 + ch_mag_10_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,FIVE_OVER_FOUR_SQRT_42); + ch_mag_10_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_10_over_42_with_sigma2,1); + // x=1, x=5 + ch_mag_26_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,THIRTEEN_OVER_FOUR_SQRT_42); + ch_mag_26_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_26_over_42_with_sigma2,1); + // x=1, y=7 + ch_mag_50_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,TWENTYFIVE_OVER_FOUR_SQRT_42); + ch_mag_50_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_50_over_42_with_sigma2,1); + // x=3, y=3 + ch_mag_18_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,NINE_OVER_FOUR_SQRT_42); + ch_mag_18_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_18_over_42_with_sigma2,1); + // x=3, y=5 + ch_mag_34_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,SEVENTEEN_OVER_FOUR_SQRT_42); + ch_mag_34_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_34_over_42_with_sigma2,1); + // x=3, y=7 + ch_mag_58_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,TWENTYNINE_OVER_FOUR_SQRT_42); + ch_mag_58_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_58_over_42_with_sigma2,2); + // x=5, y=5 + ch_mag_50_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,TWENTYFIVE_OVER_FOUR_SQRT_42); + ch_mag_50_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_50_over_42_with_sigma2,1); + // x=5, y=7 + ch_mag_74_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,THIRTYSEVEN_OVER_FOUR_SQRT_42); + ch_mag_74_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_74_over_42_with_sigma2,2); + // x=7, y=7 + ch_mag_98_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,FORTYNINE_OVER_FOUR_SQRT_42); + ch_mag_98_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_98_over_42_with_sigma2,2); + + // Computing Metrics + xmm1 = _mm_adds_epi16(psi_a_p7_p7, y0_p_7_7); + bit_met_p7_p7 = _mm_subs_epi16(xmm1, ch_mag_98_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p7_p5, y0_p_7_5); + bit_met_p7_p5 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p7_p3, y0_p_7_3); + bit_met_p7_p3 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p7_p1, y0_p_7_1); + bit_met_p7_p1 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p7_m1, y0_m_7_1); + bit_met_p7_m1 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p7_m3, y0_m_7_3); + bit_met_p7_m3 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p7_m5, y0_m_7_5); + bit_met_p7_m5 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p7_m7, y0_m_7_7); + bit_met_p7_m7 = _mm_subs_epi16(xmm1, ch_mag_98_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p5_p7, y0_p_5_7); + bit_met_p5_p7 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p5_p5, y0_p_5_5); + bit_met_p5_p5 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p5_p3, y0_p_5_3); + bit_met_p5_p3 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p5_p1, y0_p_5_1); + bit_met_p5_p1 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p5_m1, y0_m_5_1); + bit_met_p5_m1 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p5_m3, y0_m_5_3); + bit_met_p5_m3 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p5_m5, y0_m_5_5); + bit_met_p5_m5 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p5_m7, y0_m_5_7); + bit_met_p5_m7 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p3_p7, y0_p_3_7); + bit_met_p3_p7 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p3_p5, y0_p_3_5); + bit_met_p3_p5 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p3_p3, y0_p_3_3); + bit_met_p3_p3 = _mm_subs_epi16(xmm1, ch_mag_18_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p3_p1, y0_p_3_1); + bit_met_p3_p1 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p3_m1, y0_m_3_1); + bit_met_p3_m1 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p3_m3, y0_m_3_3); + bit_met_p3_m3 = _mm_subs_epi16(xmm1, ch_mag_18_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p3_m5, y0_m_3_5); + bit_met_p3_m5 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p3_m7, y0_m_3_7); + bit_met_p3_m7 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p1_p7, y0_p_1_7); + bit_met_p1_p7 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p1_p5, y0_p_1_5); + bit_met_p1_p5 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p1_p3, y0_p_1_3); + bit_met_p1_p3 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p1_p1, y0_p_1_1); + bit_met_p1_p1 = _mm_subs_epi16(xmm1, ch_mag_2_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p1_m1, y0_m_1_1); + bit_met_p1_m1 = _mm_subs_epi16(xmm1, ch_mag_2_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p1_m3, y0_m_1_3); + bit_met_p1_m3 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p1_m5, y0_m_1_5); + bit_met_p1_m5 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm1 = _mm_adds_epi16(psi_a_p1_m7, y0_m_1_7); + bit_met_p1_m7 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + + xmm1 = _mm_subs_epi16(psi_a_m1_p7, y0_m_1_7); + bit_met_m1_p7 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m1_p5, y0_m_1_5); + bit_met_m1_p5 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m1_p3, y0_m_1_3); + bit_met_m1_p3 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m1_p1, y0_m_1_1); + bit_met_m1_p1 = _mm_subs_epi16(xmm1, ch_mag_2_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m1_m1, y0_p_1_1); + bit_met_m1_m1 = _mm_subs_epi16(xmm1, ch_mag_2_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m1_m3, y0_p_1_3); + bit_met_m1_m3 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m1_m5, y0_p_1_5); + bit_met_m1_m5 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m1_m7, y0_p_1_7); + bit_met_m1_m7 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m3_p7, y0_m_3_7); + bit_met_m3_p7 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m3_p5, y0_m_3_5); + bit_met_m3_p5 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m3_p3, y0_m_3_3); + bit_met_m3_p3 = _mm_subs_epi16(xmm1, ch_mag_18_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m3_p1, y0_m_3_1); + bit_met_m3_p1 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m3_m1, y0_p_3_1); + bit_met_m3_m1 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m3_m3, y0_p_3_3); + bit_met_m3_m3 = _mm_subs_epi16(xmm1, ch_mag_18_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m3_m5, y0_p_3_5); + bit_met_m3_m5 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m3_m7, y0_p_3_7); + bit_met_m3_m7 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m5_p7, y0_m_5_7); + bit_met_m5_p7 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m5_p5, y0_m_5_5); + bit_met_m5_p5 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m5_p3, y0_m_5_3); + bit_met_m5_p3 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m5_p1, y0_m_5_1); + bit_met_m5_p1 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m5_m1, y0_p_5_1); + bit_met_m5_m1 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m5_m3, y0_p_5_3); + bit_met_m5_m3 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m5_m5, y0_p_5_5); + bit_met_m5_m5 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m5_m7, y0_p_5_7); + bit_met_m5_m7 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m7_p7, y0_m_7_7); + bit_met_m7_p7 = _mm_subs_epi16(xmm1, ch_mag_98_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m7_p5, y0_m_7_5); + bit_met_m7_p5 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m7_p3, y0_m_7_3); + bit_met_m7_p3 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m7_p1, y0_m_7_1); + bit_met_m7_p1 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m7_m1, y0_p_7_1); + bit_met_m7_m1 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m7_m3, y0_p_7_3); + bit_met_m7_m3 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m7_m5, y0_p_7_5); + bit_met_m7_m5 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm1 = _mm_subs_epi16(psi_a_m7_m7, y0_p_7_7); + bit_met_m7_m7 = _mm_subs_epi16(xmm1, ch_mag_98_over_42_with_sigma2); + + // Detection for 1st bit (LTE mapping) + // bit = 1 + xmm0 = _mm_max_epi16(bit_met_m7_p7, bit_met_m7_p5); + xmm1 = _mm_max_epi16(bit_met_m7_p3, bit_met_m7_p1); + xmm2 = _mm_max_epi16(bit_met_m7_m1, bit_met_m7_m3); + xmm3 = _mm_max_epi16(bit_met_m7_m5, bit_met_m7_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_m5_p7, bit_met_m5_p5); + xmm1 = _mm_max_epi16(bit_met_m5_p3, bit_met_m5_p1); + xmm2 = _mm_max_epi16(bit_met_m5_m1, bit_met_m5_m3); + xmm3 = _mm_max_epi16(bit_met_m5_m5, bit_met_m5_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_m3_p7, bit_met_m3_p5); + xmm1 = _mm_max_epi16(bit_met_m3_p3, bit_met_m3_p1); + xmm2 = _mm_max_epi16(bit_met_m3_m1, bit_met_m3_m3); + xmm3 = _mm_max_epi16(bit_met_m3_m5, bit_met_m3_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_m1_p7, bit_met_m1_p5); + xmm1 = _mm_max_epi16(bit_met_m1_p3, bit_met_m1_p1); + xmm2 = _mm_max_epi16(bit_met_m1_m1, bit_met_m1_m3); + xmm3 = _mm_max_epi16(bit_met_m1_m5, bit_met_m1_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + + // bit = 0 + xmm0 = _mm_max_epi16(bit_met_p7_p7, bit_met_p7_p5); + xmm1 = _mm_max_epi16(bit_met_p7_p3, bit_met_p7_p1); + xmm2 = _mm_max_epi16(bit_met_p7_m1, bit_met_p7_m3); + xmm3 = _mm_max_epi16(bit_met_p7_m5, bit_met_p7_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_p5_p7, bit_met_p5_p5); + xmm1 = _mm_max_epi16(bit_met_p5_p3, bit_met_p5_p1); + xmm2 = _mm_max_epi16(bit_met_p5_m1, bit_met_p5_m3); + xmm3 = _mm_max_epi16(bit_met_p5_m5, bit_met_p5_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p3_p7, bit_met_p3_p5); + xmm1 = _mm_max_epi16(bit_met_p3_p3, bit_met_p3_p1); + xmm2 = _mm_max_epi16(bit_met_p3_m1, bit_met_p3_m3); + xmm3 = _mm_max_epi16(bit_met_p3_m5, bit_met_p3_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p1_p7, bit_met_p1_p5); + xmm1 = _mm_max_epi16(bit_met_p1_p3, bit_met_p1_p1); + xmm2 = _mm_max_epi16(bit_met_p1_m1, bit_met_p1_m3); + xmm3 = _mm_max_epi16(bit_met_p1_m5, bit_met_p1_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + + y0r = _mm_subs_epi16(logmax_num_re0, logmax_den_re0); + + // Detection for 2nd bit (LTE mapping) + // bit = 1 + xmm0 = _mm_max_epi16(bit_met_p7_m1, bit_met_p5_m1); + xmm1 = _mm_max_epi16(bit_met_p3_m1, bit_met_p1_m1); + xmm2 = _mm_max_epi16(bit_met_m1_m1, bit_met_m3_m1); + xmm3 = _mm_max_epi16(bit_met_m5_m1, bit_met_m7_m1); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m3, bit_met_p5_m3); + xmm1 = _mm_max_epi16(bit_met_p3_m3, bit_met_p1_m3); + xmm2 = _mm_max_epi16(bit_met_m1_m3, bit_met_m3_m3); + xmm3 = _mm_max_epi16(bit_met_m5_m3, bit_met_m7_m3); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m5, bit_met_p5_m5); + xmm1 = _mm_max_epi16(bit_met_p3_m5, bit_met_p1_m5); + xmm2 = _mm_max_epi16(bit_met_m1_m5, bit_met_m3_m5); + xmm3 = _mm_max_epi16(bit_met_m5_m5, bit_met_m7_m5); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m7, bit_met_p5_m7); + xmm1 = _mm_max_epi16(bit_met_p3_m7, bit_met_p1_m7); + xmm2 = _mm_max_epi16(bit_met_m1_m7, bit_met_m3_m7); + xmm3 = _mm_max_epi16(bit_met_m5_m7, bit_met_m7_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + + // bit = 0 + xmm0 = _mm_max_epi16(bit_met_p7_p1, bit_met_p5_p1); + xmm1 = _mm_max_epi16(bit_met_p3_p1, bit_met_p1_p1); + xmm2 = _mm_max_epi16(bit_met_m1_p1, bit_met_m3_p1); + xmm3 = _mm_max_epi16(bit_met_m5_p1, bit_met_m7_p1); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p3, bit_met_p5_p3); + xmm1 = _mm_max_epi16(bit_met_p3_p3, bit_met_p1_p3); + xmm2 = _mm_max_epi16(bit_met_m1_p3, bit_met_m3_p3); + xmm3 = _mm_max_epi16(bit_met_m5_p3, bit_met_m7_p3); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p5, bit_met_p5_p5); + xmm1 = _mm_max_epi16(bit_met_p3_p5, bit_met_p1_p5); + xmm2 = _mm_max_epi16(bit_met_m1_p5, bit_met_m3_p5); + xmm3 = _mm_max_epi16(bit_met_m5_p5, bit_met_m7_p5); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p7, bit_met_p5_p7); + xmm1 = _mm_max_epi16(bit_met_p3_p7, bit_met_p1_p7); + xmm2 = _mm_max_epi16(bit_met_m1_p7, bit_met_m3_p7); + xmm3 = _mm_max_epi16(bit_met_m5_p7, bit_met_m7_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + + y1r = _mm_subs_epi16(logmax_num_re0, logmax_den_re0); + + // Detection for 3rd bit (LTE mapping) + xmm0 = _mm_max_epi16(bit_met_m7_m7, bit_met_m7_m5); + xmm1 = _mm_max_epi16(bit_met_m7_m3, bit_met_m7_m1); + xmm2 = _mm_max_epi16(bit_met_m7_p1, bit_met_m7_p3); + xmm3 = _mm_max_epi16(bit_met_m7_p5, bit_met_m7_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_m5_m7, bit_met_m5_m5); + xmm1 = _mm_max_epi16(bit_met_m5_m3, bit_met_m5_m1); + xmm2 = _mm_max_epi16(bit_met_m5_p1, bit_met_m5_p3); + xmm3 = _mm_max_epi16(bit_met_m5_p5, bit_met_m5_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p5_m7, bit_met_p5_m5); + xmm1 = _mm_max_epi16(bit_met_p5_m3, bit_met_p5_m1); + xmm2 = _mm_max_epi16(bit_met_p5_p1, bit_met_p5_p3); + xmm3 = _mm_max_epi16(bit_met_p5_p5, bit_met_p5_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m7, bit_met_p7_m5); + xmm1 = _mm_max_epi16(bit_met_p7_m3, bit_met_p7_m1); + xmm2 = _mm_max_epi16(bit_met_p7_p1, bit_met_p7_p3); + xmm3 = _mm_max_epi16(bit_met_p7_p5, bit_met_p7_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + + xmm0 = _mm_max_epi16(bit_met_m3_m7, bit_met_m3_m5); + xmm1 = _mm_max_epi16(bit_met_m3_m3, bit_met_m3_m1); + xmm2 = _mm_max_epi16(bit_met_m3_p1, bit_met_m3_p3); + xmm3 = _mm_max_epi16(bit_met_m3_p5, bit_met_m3_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_m1_m7, bit_met_m1_m5); + xmm1 = _mm_max_epi16(bit_met_m1_m3, bit_met_m1_m1); + xmm2 = _mm_max_epi16(bit_met_m1_p1, bit_met_m1_p3); + xmm3 = _mm_max_epi16(bit_met_m1_p5, bit_met_m1_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p1_m7, bit_met_p1_m5); + xmm1 = _mm_max_epi16(bit_met_p1_m3, bit_met_p1_m1); + xmm2 = _mm_max_epi16(bit_met_p1_p1, bit_met_p1_p3); + xmm3 = _mm_max_epi16(bit_met_p1_p5, bit_met_p1_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p3_m7, bit_met_p3_m5); + xmm1 = _mm_max_epi16(bit_met_p3_m3, bit_met_p3_m1); + xmm2 = _mm_max_epi16(bit_met_p3_p1, bit_met_p3_p3); + xmm3 = _mm_max_epi16(bit_met_p3_p5, bit_met_p3_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + + y2r = _mm_subs_epi16(logmax_num_re0, logmax_den_re0); + + // Detection for 4th bit (LTE mapping) + xmm0 = _mm_max_epi16(bit_met_p7_p7, bit_met_p5_p7); + xmm1 = _mm_max_epi16(bit_met_p3_p7, bit_met_p1_p7); + xmm2 = _mm_max_epi16(bit_met_m1_p7, bit_met_m3_p7); + xmm3 = _mm_max_epi16(bit_met_m5_p7, bit_met_m7_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p5, bit_met_p5_p5); + xmm1 = _mm_max_epi16(bit_met_p3_p5, bit_met_p1_p5); + xmm2 = _mm_max_epi16(bit_met_m1_p5, bit_met_m3_p5); + xmm3 = _mm_max_epi16(bit_met_m5_p5, bit_met_m5_p5); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m5, bit_met_p5_m5); + xmm1 = _mm_max_epi16(bit_met_p3_m5, bit_met_p1_m5); + xmm2 = _mm_max_epi16(bit_met_m1_m5, bit_met_m3_m5); + xmm3 = _mm_max_epi16(bit_met_m5_m5, bit_met_m7_m5); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m7, bit_met_p5_m7); + xmm1 = _mm_max_epi16(bit_met_p3_m7, bit_met_p1_m7); + xmm2 = _mm_max_epi16(bit_met_m1_m7, bit_met_m3_m7); + xmm3 = _mm_max_epi16(bit_met_m5_m7, bit_met_m7_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + + xmm0 = _mm_max_epi16(bit_met_p7_m1, bit_met_p5_m1); + xmm1 = _mm_max_epi16(bit_met_p3_m1, bit_met_p1_m1); + xmm2 = _mm_max_epi16(bit_met_m1_m1, bit_met_m3_m1); + xmm3 = _mm_max_epi16(bit_met_m5_m1, bit_met_m7_m1); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m3, bit_met_p5_m3); + xmm1 = _mm_max_epi16(bit_met_p3_m3, bit_met_p1_m3); + xmm2 = _mm_max_epi16(bit_met_m1_m3, bit_met_m3_m3); + xmm3 = _mm_max_epi16(bit_met_m5_m3, bit_met_m7_m3); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p1, bit_met_p5_p1); + xmm1 = _mm_max_epi16(bit_met_p3_p1, bit_met_p1_p1); + xmm2 = _mm_max_epi16(bit_met_m1_p1, bit_met_m3_p1); + xmm3 = _mm_max_epi16(bit_met_m5_p1, bit_met_m7_p1); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p3, bit_met_p5_p3); + xmm1 = _mm_max_epi16(bit_met_p3_p3, bit_met_p1_p3); + xmm2 = _mm_max_epi16(bit_met_m1_p3, bit_met_m3_p3); + xmm3 = _mm_max_epi16(bit_met_m5_p3, bit_met_m7_p3); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + + y0i = _mm_subs_epi16(logmax_num_re0, logmax_den_re0); + + + // Detection for 5th bit (LTE mapping) + xmm0 = _mm_max_epi16(bit_met_m7_m7, bit_met_m7_m5); + xmm1 = _mm_max_epi16(bit_met_m7_m3, bit_met_m7_m1); + xmm2 = _mm_max_epi16(bit_met_m7_p1, bit_met_m7_p3); + xmm3 = _mm_max_epi16(bit_met_m7_p5, bit_met_m7_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_m1_m7, bit_met_m1_m5); + xmm1 = _mm_max_epi16(bit_met_m1_m3, bit_met_m1_m1); + xmm2 = _mm_max_epi16(bit_met_m1_p1, bit_met_m1_p3); + xmm3 = _mm_max_epi16(bit_met_m1_p5, bit_met_m1_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p1_m7, bit_met_p1_m5); + xmm1 = _mm_max_epi16(bit_met_p1_m3, bit_met_p1_m1); + xmm2 = _mm_max_epi16(bit_met_p1_p1, bit_met_p1_p3); + xmm3 = _mm_max_epi16(bit_met_p1_p5, bit_met_p1_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m7, bit_met_p7_m5); + xmm1 = _mm_max_epi16(bit_met_p7_m3, bit_met_p7_m1); + xmm2 = _mm_max_epi16(bit_met_p7_p1, bit_met_p7_p3); + xmm3 = _mm_max_epi16(bit_met_p7_p5, bit_met_p7_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + + xmm0 = _mm_max_epi16(bit_met_m5_m7, bit_met_m5_m5); + xmm1 = _mm_max_epi16(bit_met_m5_m3, bit_met_m5_m1); + xmm2 = _mm_max_epi16(bit_met_m5_p1, bit_met_m5_p3); + xmm3 = _mm_max_epi16(bit_met_m5_p5, bit_met_m5_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_m3_m7, bit_met_m3_m5); + xmm1 = _mm_max_epi16(bit_met_m3_m3, bit_met_m3_m1); + xmm2 = _mm_max_epi16(bit_met_m3_p1, bit_met_m3_p3); + xmm3 = _mm_max_epi16(bit_met_m3_p5, bit_met_m3_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p3_m7, bit_met_p3_m5); + xmm1 = _mm_max_epi16(bit_met_p3_m3, bit_met_p3_m1); + xmm2 = _mm_max_epi16(bit_met_p3_p1, bit_met_p3_p3); + xmm3 = _mm_max_epi16(bit_met_p3_p5, bit_met_p3_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p5_m7, bit_met_p5_m5); + xmm1 = _mm_max_epi16(bit_met_p5_m3, bit_met_p5_m1); + xmm2 = _mm_max_epi16(bit_met_p5_p1, bit_met_p5_p3); + xmm3 = _mm_max_epi16(bit_met_p5_p5, bit_met_p5_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + + y1i = _mm_subs_epi16(logmax_num_re0, logmax_den_re0); + + // Detection for 6th bit (LTE mapping) + xmm0 = _mm_max_epi16(bit_met_p7_p7, bit_met_p5_p7); + xmm1 = _mm_max_epi16(bit_met_p3_p7, bit_met_p1_p7); + xmm2 = _mm_max_epi16(bit_met_m1_p7, bit_met_m3_p7); + xmm3 = _mm_max_epi16(bit_met_m5_p7, bit_met_m7_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p1, bit_met_p5_p1); + xmm1 = _mm_max_epi16(bit_met_p3_p1, bit_met_p1_p1); + xmm2 = _mm_max_epi16(bit_met_m1_p1, bit_met_m3_p1); + xmm3 = _mm_max_epi16(bit_met_m5_p1, bit_met_m5_p1); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m1, bit_met_p5_m1); + xmm1 = _mm_max_epi16(bit_met_p3_m1, bit_met_p1_m1); + xmm2 = _mm_max_epi16(bit_met_m1_m1, bit_met_m3_m1); + xmm3 = _mm_max_epi16(bit_met_m5_m1, bit_met_m7_m1); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m7, bit_met_p5_m7); + xmm1 = _mm_max_epi16(bit_met_p3_m7, bit_met_p1_m7); + xmm2 = _mm_max_epi16(bit_met_m1_m7, bit_met_m3_m7); + xmm3 = _mm_max_epi16(bit_met_m5_m7, bit_met_m7_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + + xmm0 = _mm_max_epi16(bit_met_p7_m5, bit_met_p5_m5); + xmm1 = _mm_max_epi16(bit_met_p3_m5, bit_met_p1_m5); + xmm2 = _mm_max_epi16(bit_met_m1_m5, bit_met_m3_m5); + xmm3 = _mm_max_epi16(bit_met_m5_m5, bit_met_m7_m5); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m3, bit_met_p5_m3); + xmm1 = _mm_max_epi16(bit_met_p3_m3, bit_met_p1_m3); + xmm2 = _mm_max_epi16(bit_met_m1_m3, bit_met_m3_m3); + xmm3 = _mm_max_epi16(bit_met_m5_m3, bit_met_m7_m3); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p3, bit_met_p5_p3); + xmm1 = _mm_max_epi16(bit_met_p3_p3, bit_met_p1_p3); + xmm2 = _mm_max_epi16(bit_met_m1_p3, bit_met_m3_p3); + xmm3 = _mm_max_epi16(bit_met_m5_p3, bit_met_m7_p3); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p5, bit_met_p5_p5); + xmm1 = _mm_max_epi16(bit_met_p3_p5, bit_met_p1_p5); + xmm2 = _mm_max_epi16(bit_met_m1_p5, bit_met_m3_p5); + xmm3 = _mm_max_epi16(bit_met_m5_p5, bit_met_m7_p5); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + + y2i = _mm_subs_epi16(logmax_num_re0, logmax_den_re0); + + + // map to output stream, difficult to do in SIMD since we have 6 16bit LLRs + // RE 1 + j = 24*i; + stream0_out[j + 0] = ((short *)&y0r)[0]; + stream0_out[j + 1] = ((short *)&y1r)[0]; + stream0_out[j + 2] = ((short *)&y2r)[0]; + stream0_out[j + 3] = ((short *)&y0i)[0]; + stream0_out[j + 4] = ((short *)&y1i)[0]; + stream0_out[j + 5] = ((short *)&y2i)[0]; + // RE 2 + stream0_out[j + 6] = ((short *)&y0r)[1]; + stream0_out[j + 7] = ((short *)&y1r)[1]; + stream0_out[j + 8] = ((short *)&y2r)[1]; + stream0_out[j + 9] = ((short *)&y0i)[1]; + stream0_out[j + 10] = ((short *)&y1i)[1]; + stream0_out[j + 11] = ((short *)&y2i)[1]; + // RE 3 + stream0_out[j + 12] = ((short *)&y0r)[2]; + stream0_out[j + 13] = ((short *)&y1r)[2]; + stream0_out[j + 14] = ((short *)&y2r)[2]; + stream0_out[j + 15] = ((short *)&y0i)[2]; + stream0_out[j + 16] = ((short *)&y1i)[2]; + stream0_out[j + 17] = ((short *)&y2i)[2]; + // RE 4 + stream0_out[j + 18] = ((short *)&y0r)[3]; + stream0_out[j + 19] = ((short *)&y1r)[3]; + stream0_out[j + 20] = ((short *)&y2r)[3]; + stream0_out[j + 21] = ((short *)&y0i)[3]; + stream0_out[j + 22] = ((short *)&y1i)[3]; + stream0_out[j + 23] = ((short *)&y2i)[3]; + // RE 5 + stream0_out[j + 24] = ((short *)&y0r)[4]; + stream0_out[j + 25] = ((short *)&y1r)[4]; + stream0_out[j + 26] = ((short *)&y2r)[4]; + stream0_out[j + 27] = ((short *)&y0i)[4]; + stream0_out[j + 28] = ((short *)&y1i)[4]; + stream0_out[j + 29] = ((short *)&y2i)[4]; + // RE 6 + stream0_out[j + 30] = ((short *)&y0r)[5]; + stream0_out[j + 31] = ((short *)&y1r)[5]; + stream0_out[j + 32] = ((short *)&y2r)[5]; + stream0_out[j + 33] = ((short *)&y0i)[5]; + stream0_out[j + 34] = ((short *)&y1i)[5]; + stream0_out[j + 35] = ((short *)&y2i)[5]; + // RE 7 + stream0_out[j + 36] = ((short *)&y0r)[6]; + stream0_out[j + 37] = ((short *)&y1r)[6]; + stream0_out[j + 38] = ((short *)&y2r)[6]; + stream0_out[j + 39] = ((short *)&y0i)[6]; + stream0_out[j + 40] = ((short *)&y1i)[6]; + stream0_out[j + 41] = ((short *)&y2i)[6]; + // RE 8 + stream0_out[j + 42] = ((short *)&y0r)[7]; + stream0_out[j + 43] = ((short *)&y1r)[7]; + stream0_out[j + 44] = ((short *)&y2r)[7]; + stream0_out[j + 45] = ((short *)&y0i)[7]; + stream0_out[j + 46] = ((short *)&y1i)[7]; + stream0_out[j + 47] = ((short *)&y2i)[7]; +#elif defined(__arm__) + +#endif + } + +#if defined(__x86_64__) || defined(__i386__) + _mm_empty(); + _m_empty(); +#endif +} + + +int dlsch_64qam_qpsk_llr(LTE_DL_FRAME_PARMS *frame_parms, + int32_t **rxdataF_comp, + int32_t **rxdataF_comp_i, + int32_t **dl_ch_mag, + int32_t **rho_i, + int16_t *dlsch_llr, + uint8_t symbol, + uint8_t first_symbol_flag, + uint16_t nb_rb, + uint16_t pbch_pss_sss_adjust, + int16_t **llr16p) +{ + + int16_t *rxF = (int16_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *rxF_i = (int16_t*)&rxdataF_comp_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *ch_mag = (int16_t*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *rho = (int16_t*)&rho_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *llr16; + int len; + uint8_t symbol_mod = (symbol >= (7-frame_parms->Ncp))? (symbol-(7-frame_parms->Ncp)) : symbol; + + //first symbol has different structure due to more pilots + if (first_symbol_flag == 1) { + llr16 = (int16_t*)dlsch_llr; + } else { + llr16 = (int16_t*)(*llr16p); + } + + AssertFatal(llr16!=NULL,"dlsch_16qam_64qam_llr:llr is null, symbol %d\n",symbol); + + if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { + // if symbol has pilots + if (frame_parms->nb_antenna_ports_eNB!=1) + // in 2 antenna ports we have 8 REs per symbol per RB + len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); + else + // for 1 antenna port we have 10 REs per symbol per RB + len = (nb_rb*10) - (5*pbch_pss_sss_adjust/6); + } else { + // symbol has no pilots + len = (nb_rb*12) - pbch_pss_sss_adjust; + } + + qam64_qpsk((short *)rxF, + (short *)rxF_i, + (short *)ch_mag, + (short *)llr16, + (short *)rho, + len); + + llr16 += (6*len); + *llr16p = (short *)llr16; + return(0); +} + + + +void qam64_qam16(short *stream0_in, + short *stream1_in, + short *ch_mag, + short *ch_mag_i, + short *stream0_out, + short *rho01, + int length + ) +{ + + /* + Author: S. Wagner + Date: 31-07-12 + + Input: + stream0_in: MF filter for 1st stream, i.e., y0=h0'*y + stream1_in: MF filter for 2nd stream, i.e., y1=h1'*y + ch_mag: 4*h0/sqrt(42), [Re0 Im0 Re1 Im1] s.t. Im0=Re0, Im1=Re1, etc + ch_mag_i: 4*h1/sqrt(42), [Re0 Im0 Re1 Im1] s.t. Im0=Re0, Im1=Re1, etc + rho01: Channel cross correlation, i.e., h1'*h0 + + Output: + stream0_out: output LLRs for 1st stream + */ + +#if defined(__x86_64__) || defined(__i386__) + + __m128i *rho01_128i = (__m128i *)rho01; + __m128i *stream0_128i_in = (__m128i *)stream0_in; + __m128i *stream1_128i_in = (__m128i *)stream1_in; + __m128i *ch_mag_128i = (__m128i *)ch_mag; + __m128i *ch_mag_128i_i = (__m128i *)ch_mag_i; + + __m128i ONE_OVER_SQRT_42 = _mm_set1_epi16(10112); // round(1/sqrt(42)*2^16) + __m128i THREE_OVER_SQRT_42 = _mm_set1_epi16(30337); // round(3/sqrt(42)*2^16) + __m128i FIVE_OVER_SQRT_42 = _mm_set1_epi16(25281); // round(5/sqrt(42)*2^15) + __m128i SEVEN_OVER_SQRT_42 = _mm_set1_epi16(17697); // round(5/sqrt(42)*2^15) + __m128i FORTYNINE_OVER_FOUR_SQRT_42 = _mm_set1_epi16(30969); // round(49/(4*sqrt(42))*2^14), Q2.14 + __m128i THIRTYSEVEN_OVER_FOUR_SQRT_42 = _mm_set1_epi16(23385); // round(37/(4*sqrt(42))*2^14), Q2.14 + __m128i TWENTYFIVE_OVER_FOUR_SQRT_42 = _mm_set1_epi16(31601); // round(25/(4*sqrt(42))*2^15) + __m128i TWENTYNINE_OVER_FOUR_SQRT_42 = _mm_set1_epi16(18329); // round(29/(4*sqrt(42))*2^15), Q2.14 + __m128i SEVENTEEN_OVER_FOUR_SQRT_42 = _mm_set1_epi16(21489); // round(17/(4*sqrt(42))*2^15) + __m128i NINE_OVER_FOUR_SQRT_42 = _mm_set1_epi16(11376); // round(9/(4*sqrt(42))*2^15) + __m128i THIRTEEN_OVER_FOUR_SQRT_42 = _mm_set1_epi16(16433); // round(13/(4*sqrt(42))*2^15) + __m128i FIVE_OVER_FOUR_SQRT_42 = _mm_set1_epi16(6320); // round(5/(4*sqrt(42))*2^15) + __m128i ONE_OVER_FOUR_SQRT_42 = _mm_set1_epi16(1264); // round(1/(4*sqrt(42))*2^15) + __m128i ONE_OVER_SQRT_10_Q15 = _mm_set1_epi16(10362); // round(1/sqrt(10)*2^15) + __m128i THREE_OVER_SQRT_10 = _mm_set1_epi16(31086); // round(3/sqrt(10)*2^15) + __m128i SQRT_10_OVER_FOUR = _mm_set1_epi16(25905); // round(sqrt(10)/4*2^15) + + + __m128i ch_mag_int; + __m128i ch_mag_des; + __m128i ch_mag_98_over_42_with_sigma2; + __m128i ch_mag_74_over_42_with_sigma2; + __m128i ch_mag_58_over_42_with_sigma2; + __m128i ch_mag_50_over_42_with_sigma2; + __m128i ch_mag_34_over_42_with_sigma2; + __m128i ch_mag_18_over_42_with_sigma2; + __m128i ch_mag_26_over_42_with_sigma2; + __m128i ch_mag_10_over_42_with_sigma2; + __m128i ch_mag_2_over_42_with_sigma2; + __m128i y0r_one_over_sqrt_21; + __m128i y0r_three_over_sqrt_21; + __m128i y0r_five_over_sqrt_21; + __m128i y0r_seven_over_sqrt_21; + __m128i y0i_one_over_sqrt_21; + __m128i y0i_three_over_sqrt_21; + __m128i y0i_five_over_sqrt_21; + __m128i y0i_seven_over_sqrt_21; + +#elif defined(__arm__) + +#endif + int i,j; + + + + for (i=0; i>2; i+=2) { + +#if defined(__x86_64__) || defined(__i386__) + // Get rho + xmm0 = rho01_128i[i]; + xmm1 = rho01_128i[i+1]; + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + xmm2 = _mm_unpacklo_epi64(xmm0,xmm1); // Re(rho) + xmm3 = _mm_unpackhi_epi64(xmm0,xmm1); // Im(rho) + rho_rpi = _mm_adds_epi16(xmm2,xmm3); // rho = Re(rho) + Im(rho) + rho_rmi = _mm_subs_epi16(xmm2,xmm3); // rho* = Re(rho) - Im(rho) + + // Compute the different rhos + rho_rpi_1_1 = _mm_mulhi_epi16(rho_rpi, ONE_OVER_SQRT_42); + rho_rmi_1_1 = _mm_mulhi_epi16(rho_rmi, ONE_OVER_SQRT_42); + rho_rpi_3_3 = _mm_mulhi_epi16(rho_rpi, THREE_OVER_SQRT_42); + rho_rmi_3_3 = _mm_mulhi_epi16(rho_rmi, THREE_OVER_SQRT_42); + rho_rpi_5_5 = _mm_mulhi_epi16(rho_rpi, FIVE_OVER_SQRT_42); + rho_rmi_5_5 = _mm_mulhi_epi16(rho_rmi, FIVE_OVER_SQRT_42); + rho_rpi_7_7 = _mm_mulhi_epi16(rho_rpi, SEVEN_OVER_SQRT_42); + rho_rmi_7_7 = _mm_mulhi_epi16(rho_rmi, SEVEN_OVER_SQRT_42); + + rho_rpi_5_5 = _mm_slli_epi16(rho_rpi_5_5, 1); + rho_rmi_5_5 = _mm_slli_epi16(rho_rmi_5_5, 1); + rho_rpi_7_7 = _mm_slli_epi16(rho_rpi_7_7, 2); + rho_rmi_7_7 = _mm_slli_epi16(rho_rmi_7_7, 2); + + xmm4 = _mm_mulhi_epi16(xmm2, ONE_OVER_SQRT_42); + xmm5 = _mm_mulhi_epi16(xmm3, ONE_OVER_SQRT_42); + xmm6 = _mm_mulhi_epi16(xmm3, THREE_OVER_SQRT_42); + xmm7 = _mm_mulhi_epi16(xmm3, FIVE_OVER_SQRT_42); + xmm8 = _mm_mulhi_epi16(xmm3, SEVEN_OVER_SQRT_42); + xmm7 = _mm_slli_epi16(xmm7, 1); + xmm8 = _mm_slli_epi16(xmm8, 2); + + rho_rpi_1_3 = _mm_adds_epi16(xmm4, xmm6); + rho_rmi_1_3 = _mm_subs_epi16(xmm4, xmm6); + rho_rpi_1_5 = _mm_adds_epi16(xmm4, xmm7); + rho_rmi_1_5 = _mm_subs_epi16(xmm4, xmm7); + rho_rpi_1_7 = _mm_adds_epi16(xmm4, xmm8); + rho_rmi_1_7 = _mm_subs_epi16(xmm4, xmm8); + + xmm4 = _mm_mulhi_epi16(xmm2, THREE_OVER_SQRT_42); + rho_rpi_3_1 = _mm_adds_epi16(xmm4, xmm5); + rho_rmi_3_1 = _mm_subs_epi16(xmm4, xmm5); + rho_rpi_3_5 = _mm_adds_epi16(xmm4, xmm7); + rho_rmi_3_5 = _mm_subs_epi16(xmm4, xmm7); + rho_rpi_3_7 = _mm_adds_epi16(xmm4, xmm8); + rho_rmi_3_7 = _mm_subs_epi16(xmm4, xmm8); + + xmm4 = _mm_mulhi_epi16(xmm2, FIVE_OVER_SQRT_42); + xmm4 = _mm_slli_epi16(xmm4, 1); + rho_rpi_5_1 = _mm_adds_epi16(xmm4, xmm5); + rho_rmi_5_1 = _mm_subs_epi16(xmm4, xmm5); + rho_rpi_5_3 = _mm_adds_epi16(xmm4, xmm6); + rho_rmi_5_3 = _mm_subs_epi16(xmm4, xmm6); + rho_rpi_5_7 = _mm_adds_epi16(xmm4, xmm8); + rho_rmi_5_7 = _mm_subs_epi16(xmm4, xmm8); + + xmm4 = _mm_mulhi_epi16(xmm2, SEVEN_OVER_SQRT_42); + xmm4 = _mm_slli_epi16(xmm4, 2); + rho_rpi_7_1 = _mm_adds_epi16(xmm4, xmm5); + rho_rmi_7_1 = _mm_subs_epi16(xmm4, xmm5); + rho_rpi_7_3 = _mm_adds_epi16(xmm4, xmm6); + rho_rmi_7_3 = _mm_subs_epi16(xmm4, xmm6); + rho_rpi_7_5 = _mm_adds_epi16(xmm4, xmm7); + rho_rmi_7_5 = _mm_subs_epi16(xmm4, xmm7); + + // Rearrange interfering MF output + xmm0 = stream1_128i_in[i]; + xmm1 = stream1_128i_in[i+1]; + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + y1r = _mm_unpacklo_epi64(xmm0,xmm1); //[y1r(1),y1r(2),y1r(3),y1r(4)] + y1i = _mm_unpackhi_epi64(xmm0,xmm1); //[y1i(1),y1i(2),y1i(3),y1i(4)] + + // Psi_r calculation from rho_rpi or rho_rmi + xmm0 = _mm_setzero_si128(); // ZERO for abs_pi16 + xmm2 = _mm_subs_epi16(rho_rpi_7_7, y1r); + psi_r_p7_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_7_5, y1r); + psi_r_p7_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_7_3, y1r); + psi_r_p7_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_7_1, y1r); + psi_r_p7_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_7_1, y1r); + psi_r_p7_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_7_3, y1r); + psi_r_p7_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_7_5, y1r); + psi_r_p7_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_7_7, y1r); + psi_r_p7_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_7, y1r); + psi_r_p5_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_5, y1r); + psi_r_p5_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_3, y1r); + psi_r_p5_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_1, y1r); + psi_r_p5_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_1, y1r); + psi_r_p5_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_3, y1r); + psi_r_p5_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_5, y1r); + psi_r_p5_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_7, y1r); + psi_r_p5_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_7, y1r); + psi_r_p3_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_5, y1r); + psi_r_p3_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_3, y1r); + psi_r_p3_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_1, y1r); + psi_r_p3_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_1, y1r); + psi_r_p3_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_3, y1r); + psi_r_p3_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_5, y1r); + psi_r_p3_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_7, y1r); + psi_r_p3_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_7, y1r); + psi_r_p1_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_5, y1r); + psi_r_p1_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_3, y1r); + psi_r_p1_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_1, y1r); + psi_r_p1_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_1, y1r); + psi_r_p1_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_3, y1r); + psi_r_p1_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_5, y1r); + psi_r_p1_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_7, y1r); + psi_r_p1_m7 = _mm_abs_epi16(xmm2); + + xmm2 = _mm_adds_epi16(rho_rmi_1_7, y1r); + psi_r_m1_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_1_5, y1r); + psi_r_m1_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_1_3, y1r); + psi_r_m1_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_1_1, y1r); + psi_r_m1_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_1, y1r); + psi_r_m1_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_3, y1r); + psi_r_m1_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_5, y1r); + psi_r_m1_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_7, y1r); + psi_r_m1_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_7, y1r); + psi_r_m3_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_5, y1r); + psi_r_m3_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_3, y1r); + psi_r_m3_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_1, y1r); + psi_r_m3_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_1, y1r); + psi_r_m3_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_3, y1r); + psi_r_m3_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_5, y1r); + psi_r_m3_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_7, y1r); + psi_r_m3_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_7, y1r); + psi_r_m5_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_5, y1r); + psi_r_m5_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_3, y1r); + psi_r_m5_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_1, y1r); + psi_r_m5_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_1, y1r); + psi_r_m5_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_3, y1r); + psi_r_m5_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_5, y1r); + psi_r_m5_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_7, y1r); + psi_r_m5_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_7, y1r); + psi_r_m7_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_5, y1r); + psi_r_m7_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_3, y1r); + psi_r_m7_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_1, y1r); + psi_r_m7_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_1, y1r); + psi_r_m7_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_3, y1r); + psi_r_m7_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_5, y1r); + psi_r_m7_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_7, y1r); + psi_r_m7_m7 = _mm_abs_epi16(xmm2); + + // Psi_i calculation from rho_rpi or rho_rmi + xmm2 = _mm_subs_epi16(rho_rmi_7_7, y1i); + psi_i_p7_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_7, y1i); + psi_i_p7_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_7, y1i); + psi_i_p7_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_7, y1i); + psi_i_p7_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_7, y1i); + psi_i_p7_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_7, y1i); + psi_i_p7_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_7, y1i); + psi_i_p7_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_7, y1i); + psi_i_p7_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_7_5, y1i); + psi_i_p5_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_5, y1i); + psi_i_p5_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_5, y1i); + psi_i_p5_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_5, y1i); + psi_i_p5_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_5, y1i); + psi_i_p5_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_5, y1i); + psi_i_p5_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_5, y1i); + psi_i_p5_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_5, y1i); + psi_i_p5_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_7_3, y1i); + psi_i_p3_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_3, y1i); + psi_i_p3_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_3, y1i); + psi_i_p3_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_3, y1i); + psi_i_p3_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_3, y1i); + psi_i_p3_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_3, y1i); + psi_i_p3_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_3, y1i); + psi_i_p3_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_3, y1i); + psi_i_p3_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_7_1, y1i); + psi_i_p1_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_1, y1i); + psi_i_p1_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_1, y1i); + psi_i_p1_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_1, y1i); + psi_i_p1_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_1, y1i); + psi_i_p1_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_1, y1i); + psi_i_p1_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_1, y1i); + psi_i_p1_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_1, y1i); + psi_i_p1_m7 = _mm_abs_epi16(xmm2); + + xmm2 = _mm_subs_epi16(rho_rpi_7_1, y1i); + psi_i_m1_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_1, y1i); + psi_i_m1_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_1, y1i); + psi_i_m1_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_1, y1i); + psi_i_m1_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_1_1, y1i); + psi_i_m1_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_1, y1i); + psi_i_m1_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_1, y1i); + psi_i_m1_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_1, y1i); + psi_i_m1_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_7_3, y1i); + psi_i_m3_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_3, y1i); + psi_i_m3_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_3, y1i); + psi_i_m3_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_3, y1i); + psi_i_m3_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_1_3, y1i); + psi_i_m3_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_3, y1i); + psi_i_m3_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_3, y1i); + psi_i_m3_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_3, y1i); + psi_i_m3_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_7_5, y1i); + psi_i_m5_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_5, y1i); + psi_i_m5_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_5, y1i); + psi_i_m5_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_5, y1i); + psi_i_m5_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_1_5, y1i); + psi_i_m5_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_5, y1i); + psi_i_m5_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_5, y1i); + psi_i_m5_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_5, y1i); + psi_i_m5_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_7_7, y1i); + psi_i_m7_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_7, y1i); + psi_i_m7_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_7, y1i); + psi_i_m7_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_7, y1i); + psi_i_m7_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_1_7, y1i); + psi_i_m7_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_7, y1i); + psi_i_m7_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_7, y1i); + psi_i_m7_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_7, y1i); + psi_i_m7_m7 = _mm_abs_epi16(xmm2); + + + // Rearrange desired MF output + xmm0 = stream0_128i_in[i]; + xmm1 = stream0_128i_in[i+1]; + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + y0r = _mm_unpacklo_epi64(xmm0,xmm1); // = [y0r(1),y0r(2),y0r(3),y0r(4)] + y0i = _mm_unpackhi_epi64(xmm0,xmm1); + + // Rearrange desired channel magnitudes + xmm2 = ch_mag_128i[i]; // = [|h|^2(1),|h|^2(1),|h|^2(2),|h|^2(2)]*(2/sqrt(10)) + xmm3 = ch_mag_128i[i+1]; // = [|h|^2(3),|h|^2(3),|h|^2(4),|h|^2(4)]*(2/sqrt(10)) + xmm2 = _mm_shufflelo_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shufflehi_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shuffle_epi32(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflelo_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflehi_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shuffle_epi32(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + ch_mag_des = _mm_unpacklo_epi64(xmm2,xmm3); + + // Rearrange interfering channel magnitudes + xmm2 = ch_mag_128i_i[i]; + xmm3 = ch_mag_128i_i[i+1]; + xmm2 = _mm_shufflelo_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shufflehi_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shuffle_epi32(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflelo_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflehi_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shuffle_epi32(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + ch_mag_int = _mm_unpacklo_epi64(xmm2,xmm3); + + y0r_one_over_sqrt_21 = _mm_mulhi_epi16(y0r, ONE_OVER_SQRT_42); + y0r_three_over_sqrt_21 = _mm_mulhi_epi16(y0r, THREE_OVER_SQRT_42); + y0r_five_over_sqrt_21 = _mm_mulhi_epi16(y0r, FIVE_OVER_SQRT_42); + y0r_five_over_sqrt_21 = _mm_slli_epi16(y0r_five_over_sqrt_21, 1); + y0r_seven_over_sqrt_21 = _mm_mulhi_epi16(y0r, SEVEN_OVER_SQRT_42); + y0r_seven_over_sqrt_21 = _mm_slli_epi16(y0r_seven_over_sqrt_21, 2); // Q2.14 + + y0i_one_over_sqrt_21 = _mm_mulhi_epi16(y0i, ONE_OVER_SQRT_42); + y0i_three_over_sqrt_21 = _mm_mulhi_epi16(y0i, THREE_OVER_SQRT_42); + y0i_five_over_sqrt_21 = _mm_mulhi_epi16(y0i, FIVE_OVER_SQRT_42); + y0i_five_over_sqrt_21 = _mm_slli_epi16(y0i_five_over_sqrt_21, 1); + y0i_seven_over_sqrt_21 = _mm_mulhi_epi16(y0i, SEVEN_OVER_SQRT_42); + y0i_seven_over_sqrt_21 = _mm_slli_epi16(y0i_seven_over_sqrt_21, 2); // Q2.14 + + y0_p_7_1 = _mm_adds_epi16(y0r_seven_over_sqrt_21, y0i_one_over_sqrt_21); + y0_p_7_3 = _mm_adds_epi16(y0r_seven_over_sqrt_21, y0i_three_over_sqrt_21); + y0_p_7_5 = _mm_adds_epi16(y0r_seven_over_sqrt_21, y0i_five_over_sqrt_21); + y0_p_7_7 = _mm_adds_epi16(y0r_seven_over_sqrt_21, y0i_seven_over_sqrt_21); + y0_p_5_1 = _mm_adds_epi16(y0r_five_over_sqrt_21, y0i_one_over_sqrt_21); + y0_p_5_3 = _mm_adds_epi16(y0r_five_over_sqrt_21, y0i_three_over_sqrt_21); + y0_p_5_5 = _mm_adds_epi16(y0r_five_over_sqrt_21, y0i_five_over_sqrt_21); + y0_p_5_7 = _mm_adds_epi16(y0r_five_over_sqrt_21, y0i_seven_over_sqrt_21); + y0_p_3_1 = _mm_adds_epi16(y0r_three_over_sqrt_21, y0i_one_over_sqrt_21); + y0_p_3_3 = _mm_adds_epi16(y0r_three_over_sqrt_21, y0i_three_over_sqrt_21); + y0_p_3_5 = _mm_adds_epi16(y0r_three_over_sqrt_21, y0i_five_over_sqrt_21); + y0_p_3_7 = _mm_adds_epi16(y0r_three_over_sqrt_21, y0i_seven_over_sqrt_21); + y0_p_1_1 = _mm_adds_epi16(y0r_one_over_sqrt_21, y0i_one_over_sqrt_21); + y0_p_1_3 = _mm_adds_epi16(y0r_one_over_sqrt_21, y0i_three_over_sqrt_21); + y0_p_1_5 = _mm_adds_epi16(y0r_one_over_sqrt_21, y0i_five_over_sqrt_21); + y0_p_1_7 = _mm_adds_epi16(y0r_one_over_sqrt_21, y0i_seven_over_sqrt_21); + + y0_m_1_1 = _mm_subs_epi16(y0r_one_over_sqrt_21, y0i_one_over_sqrt_21); + y0_m_1_3 = _mm_subs_epi16(y0r_one_over_sqrt_21, y0i_three_over_sqrt_21); + y0_m_1_5 = _mm_subs_epi16(y0r_one_over_sqrt_21, y0i_five_over_sqrt_21); + y0_m_1_7 = _mm_subs_epi16(y0r_one_over_sqrt_21, y0i_seven_over_sqrt_21); + y0_m_3_1 = _mm_subs_epi16(y0r_three_over_sqrt_21, y0i_one_over_sqrt_21); + y0_m_3_3 = _mm_subs_epi16(y0r_three_over_sqrt_21, y0i_three_over_sqrt_21); + y0_m_3_5 = _mm_subs_epi16(y0r_three_over_sqrt_21, y0i_five_over_sqrt_21); + y0_m_3_7 = _mm_subs_epi16(y0r_three_over_sqrt_21, y0i_seven_over_sqrt_21); + y0_m_5_1 = _mm_subs_epi16(y0r_five_over_sqrt_21, y0i_one_over_sqrt_21); + y0_m_5_3 = _mm_subs_epi16(y0r_five_over_sqrt_21, y0i_three_over_sqrt_21); + y0_m_5_5 = _mm_subs_epi16(y0r_five_over_sqrt_21, y0i_five_over_sqrt_21); + y0_m_5_7 = _mm_subs_epi16(y0r_five_over_sqrt_21, y0i_seven_over_sqrt_21); + y0_m_7_1 = _mm_subs_epi16(y0r_seven_over_sqrt_21, y0i_one_over_sqrt_21); + y0_m_7_3 = _mm_subs_epi16(y0r_seven_over_sqrt_21, y0i_three_over_sqrt_21); + y0_m_7_5 = _mm_subs_epi16(y0r_seven_over_sqrt_21, y0i_five_over_sqrt_21); + y0_m_7_7 = _mm_subs_epi16(y0r_seven_over_sqrt_21, y0i_seven_over_sqrt_21); + + interference_abs_epi16(psi_r_p7_p7, ch_mag_int, a_r_p7_p7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p7_p5, ch_mag_int, a_r_p7_p5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p7_p3, ch_mag_int, a_r_p7_p3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p7_p1, ch_mag_int, a_r_p7_p1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p7_m1, ch_mag_int, a_r_p7_m1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p7_m3, ch_mag_int, a_r_p7_m3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p7_m5, ch_mag_int, a_r_p7_m5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p7_m7, ch_mag_int, a_r_p7_m7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p5_p7, ch_mag_int, a_r_p5_p7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p5_p5, ch_mag_int, a_r_p5_p5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p5_p3, ch_mag_int, a_r_p5_p3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p5_p1, ch_mag_int, a_r_p5_p1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p5_m1, ch_mag_int, a_r_p5_m1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p5_m3, ch_mag_int, a_r_p5_m3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p5_m5, ch_mag_int, a_r_p5_m5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p5_m7, ch_mag_int, a_r_p5_m7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p3_p7, ch_mag_int, a_r_p3_p7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p3_p5, ch_mag_int, a_r_p3_p5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p3_p3, ch_mag_int, a_r_p3_p3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p3_p1, ch_mag_int, a_r_p3_p1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p3_m1, ch_mag_int, a_r_p3_m1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p3_m3, ch_mag_int, a_r_p3_m3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p3_m5, ch_mag_int, a_r_p3_m5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p3_m7, ch_mag_int, a_r_p3_m7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p1_p7, ch_mag_int, a_r_p1_p7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p1_p5, ch_mag_int, a_r_p1_p5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p1_p3, ch_mag_int, a_r_p1_p3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p1_p1, ch_mag_int, a_r_p1_p1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p1_m1, ch_mag_int, a_r_p1_m1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p1_m3, ch_mag_int, a_r_p1_m3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p1_m5, ch_mag_int, a_r_p1_m5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_p1_m7, ch_mag_int, a_r_p1_m7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m1_p7, ch_mag_int, a_r_m1_p7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m1_p5, ch_mag_int, a_r_m1_p5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m1_p3, ch_mag_int, a_r_m1_p3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m1_p1, ch_mag_int, a_r_m1_p1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m1_m1, ch_mag_int, a_r_m1_m1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m1_m3, ch_mag_int, a_r_m1_m3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m1_m5, ch_mag_int, a_r_m1_m5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m1_m7, ch_mag_int, a_r_m1_m7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m3_p7, ch_mag_int, a_r_m3_p7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m3_p5, ch_mag_int, a_r_m3_p5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m3_p3, ch_mag_int, a_r_m3_p3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m3_p1, ch_mag_int, a_r_m3_p1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m3_m1, ch_mag_int, a_r_m3_m1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m3_m3, ch_mag_int, a_r_m3_m3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m3_m5, ch_mag_int, a_r_m3_m5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m3_m7, ch_mag_int, a_r_m3_m7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m5_p7, ch_mag_int, a_r_m5_p7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m5_p5, ch_mag_int, a_r_m5_p5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m5_p3, ch_mag_int, a_r_m5_p3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m5_p1, ch_mag_int, a_r_m5_p1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m5_m1, ch_mag_int, a_r_m5_m1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m5_m3, ch_mag_int, a_r_m5_m3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m5_m5, ch_mag_int, a_r_m5_m5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m5_m7, ch_mag_int, a_r_m5_m7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m7_p7, ch_mag_int, a_r_m7_p7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m7_p5, ch_mag_int, a_r_m7_p5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m7_p3, ch_mag_int, a_r_m7_p3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m7_p1, ch_mag_int, a_r_m7_p1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m7_m1, ch_mag_int, a_r_m7_m1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m7_m3, ch_mag_int, a_r_m7_m3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m7_m5, ch_mag_int, a_r_m7_m5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_r_m7_m7, ch_mag_int, a_r_m7_m7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + + interference_abs_epi16(psi_i_p7_p7, ch_mag_int, a_i_p7_p7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p7_p5, ch_mag_int, a_i_p7_p5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p7_p3, ch_mag_int, a_i_p7_p3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p7_p1, ch_mag_int, a_i_p7_p1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p7_m1, ch_mag_int, a_i_p7_m1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p7_m3, ch_mag_int, a_i_p7_m3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p7_m5, ch_mag_int, a_i_p7_m5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p7_m7, ch_mag_int, a_i_p7_m7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p5_p7, ch_mag_int, a_i_p5_p7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p5_p5, ch_mag_int, a_i_p5_p5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p5_p3, ch_mag_int, a_i_p5_p3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p5_p1, ch_mag_int, a_i_p5_p1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p5_m1, ch_mag_int, a_i_p5_m1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p5_m3, ch_mag_int, a_i_p5_m3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p5_m5, ch_mag_int, a_i_p5_m5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p5_m7, ch_mag_int, a_i_p5_m7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p3_p7, ch_mag_int, a_i_p3_p7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p3_p5, ch_mag_int, a_i_p3_p5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p3_p3, ch_mag_int, a_i_p3_p3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p3_p1, ch_mag_int, a_i_p3_p1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p3_m1, ch_mag_int, a_i_p3_m1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p3_m3, ch_mag_int, a_i_p3_m3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p3_m5, ch_mag_int, a_i_p3_m5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p3_m7, ch_mag_int, a_i_p3_m7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p1_p7, ch_mag_int, a_i_p1_p7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p1_p5, ch_mag_int, a_i_p1_p5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p1_p3, ch_mag_int, a_i_p1_p3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p1_p1, ch_mag_int, a_i_p1_p1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p1_m1, ch_mag_int, a_i_p1_m1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p1_m3, ch_mag_int, a_i_p1_m3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p1_m5, ch_mag_int, a_i_p1_m5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_p1_m7, ch_mag_int, a_i_p1_m7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m1_p7, ch_mag_int, a_i_m1_p7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m1_p5, ch_mag_int, a_i_m1_p5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m1_p3, ch_mag_int, a_i_m1_p3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m1_p1, ch_mag_int, a_i_m1_p1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m1_m1, ch_mag_int, a_i_m1_m1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m1_m3, ch_mag_int, a_i_m1_m3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m1_m5, ch_mag_int, a_i_m1_m5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m1_m7, ch_mag_int, a_i_m1_m7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m3_p7, ch_mag_int, a_i_m3_p7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m3_p5, ch_mag_int, a_i_m3_p5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m3_p3, ch_mag_int, a_i_m3_p3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m3_p1, ch_mag_int, a_i_m3_p1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m3_m1, ch_mag_int, a_i_m3_m1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m3_m3, ch_mag_int, a_i_m3_m3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m3_m5, ch_mag_int, a_i_m3_m5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m3_m7, ch_mag_int, a_i_m3_m7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m5_p7, ch_mag_int, a_i_m5_p7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m5_p5, ch_mag_int, a_i_m5_p5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m5_p3, ch_mag_int, a_i_m5_p3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m5_p1, ch_mag_int, a_i_m5_p1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m5_m1, ch_mag_int, a_i_m5_m1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m5_m3, ch_mag_int, a_i_m5_m3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m5_m5, ch_mag_int, a_i_m5_m5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m5_m7, ch_mag_int, a_i_m5_m7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m7_p7, ch_mag_int, a_i_m7_p7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m7_p5, ch_mag_int, a_i_m7_p5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m7_p3, ch_mag_int, a_i_m7_p3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m7_p1, ch_mag_int, a_i_m7_p1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m7_m1, ch_mag_int, a_i_m7_m1, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m7_m3, ch_mag_int, a_i_m7_m3, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m7_m5, ch_mag_int, a_i_m7_m5, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + interference_abs_epi16(psi_i_m7_m7, ch_mag_int, a_i_m7_m7, ONE_OVER_SQRT_10_Q15, THREE_OVER_SQRT_10); + + // Calculation of a group of two terms in the bit metric involving product of psi and interference + prodsum_psi_a_epi16(psi_r_p7_p7, a_r_p7_p7, psi_i_p7_p7, a_i_p7_p7, psi_a_p7_p7); + prodsum_psi_a_epi16(psi_r_p7_p5, a_r_p7_p5, psi_i_p7_p5, a_i_p7_p5, psi_a_p7_p5); + prodsum_psi_a_epi16(psi_r_p7_p3, a_r_p7_p3, psi_i_p7_p3, a_i_p7_p3, psi_a_p7_p3); + prodsum_psi_a_epi16(psi_r_p7_p1, a_r_p7_p1, psi_i_p7_p1, a_i_p7_p1, psi_a_p7_p1); + prodsum_psi_a_epi16(psi_r_p7_m1, a_r_p7_m1, psi_i_p7_m1, a_i_p7_m1, psi_a_p7_m1); + prodsum_psi_a_epi16(psi_r_p7_m3, a_r_p7_m3, psi_i_p7_m3, a_i_p7_m3, psi_a_p7_m3); + prodsum_psi_a_epi16(psi_r_p7_m5, a_r_p7_m5, psi_i_p7_m5, a_i_p7_m5, psi_a_p7_m5); + prodsum_psi_a_epi16(psi_r_p7_m7, a_r_p7_m7, psi_i_p7_m7, a_i_p7_m7, psi_a_p7_m7); + prodsum_psi_a_epi16(psi_r_p5_p7, a_r_p5_p7, psi_i_p5_p7, a_i_p5_p7, psi_a_p5_p7); + prodsum_psi_a_epi16(psi_r_p5_p5, a_r_p5_p5, psi_i_p5_p5, a_i_p5_p5, psi_a_p5_p5); + prodsum_psi_a_epi16(psi_r_p5_p3, a_r_p5_p3, psi_i_p5_p3, a_i_p5_p3, psi_a_p5_p3); + prodsum_psi_a_epi16(psi_r_p5_p1, a_r_p5_p1, psi_i_p5_p1, a_i_p5_p1, psi_a_p5_p1); + prodsum_psi_a_epi16(psi_r_p5_m1, a_r_p5_m1, psi_i_p5_m1, a_i_p5_m1, psi_a_p5_m1); + prodsum_psi_a_epi16(psi_r_p5_m3, a_r_p5_m3, psi_i_p5_m3, a_i_p5_m3, psi_a_p5_m3); + prodsum_psi_a_epi16(psi_r_p5_m5, a_r_p5_m5, psi_i_p5_m5, a_i_p5_m5, psi_a_p5_m5); + prodsum_psi_a_epi16(psi_r_p5_m7, a_r_p5_m7, psi_i_p5_m7, a_i_p5_m7, psi_a_p5_m7); + prodsum_psi_a_epi16(psi_r_p3_p7, a_r_p3_p7, psi_i_p3_p7, a_i_p3_p7, psi_a_p3_p7); + prodsum_psi_a_epi16(psi_r_p3_p5, a_r_p3_p5, psi_i_p3_p5, a_i_p3_p5, psi_a_p3_p5); + prodsum_psi_a_epi16(psi_r_p3_p3, a_r_p3_p3, psi_i_p3_p3, a_i_p3_p3, psi_a_p3_p3); + prodsum_psi_a_epi16(psi_r_p3_p1, a_r_p3_p1, psi_i_p3_p1, a_i_p3_p1, psi_a_p3_p1); + prodsum_psi_a_epi16(psi_r_p3_m1, a_r_p3_m1, psi_i_p3_m1, a_i_p3_m1, psi_a_p3_m1); + prodsum_psi_a_epi16(psi_r_p3_m3, a_r_p3_m3, psi_i_p3_m3, a_i_p3_m3, psi_a_p3_m3); + prodsum_psi_a_epi16(psi_r_p3_m5, a_r_p3_m5, psi_i_p3_m5, a_i_p3_m5, psi_a_p3_m5); + prodsum_psi_a_epi16(psi_r_p3_m7, a_r_p3_m7, psi_i_p3_m7, a_i_p3_m7, psi_a_p3_m7); + prodsum_psi_a_epi16(psi_r_p1_p7, a_r_p1_p7, psi_i_p1_p7, a_i_p1_p7, psi_a_p1_p7); + prodsum_psi_a_epi16(psi_r_p1_p5, a_r_p1_p5, psi_i_p1_p5, a_i_p1_p5, psi_a_p1_p5); + prodsum_psi_a_epi16(psi_r_p1_p3, a_r_p1_p3, psi_i_p1_p3, a_i_p1_p3, psi_a_p1_p3); + prodsum_psi_a_epi16(psi_r_p1_p1, a_r_p1_p1, psi_i_p1_p1, a_i_p1_p1, psi_a_p1_p1); + prodsum_psi_a_epi16(psi_r_p1_m1, a_r_p1_m1, psi_i_p1_m1, a_i_p1_m1, psi_a_p1_m1); + prodsum_psi_a_epi16(psi_r_p1_m3, a_r_p1_m3, psi_i_p1_m3, a_i_p1_m3, psi_a_p1_m3); + prodsum_psi_a_epi16(psi_r_p1_m5, a_r_p1_m5, psi_i_p1_m5, a_i_p1_m5, psi_a_p1_m5); + prodsum_psi_a_epi16(psi_r_p1_m7, a_r_p1_m7, psi_i_p1_m7, a_i_p1_m7, psi_a_p1_m7); + prodsum_psi_a_epi16(psi_r_m1_p7, a_r_m1_p7, psi_i_m1_p7, a_i_m1_p7, psi_a_m1_p7); + prodsum_psi_a_epi16(psi_r_m1_p5, a_r_m1_p5, psi_i_m1_p5, a_i_m1_p5, psi_a_m1_p5); + prodsum_psi_a_epi16(psi_r_m1_p3, a_r_m1_p3, psi_i_m1_p3, a_i_m1_p3, psi_a_m1_p3); + prodsum_psi_a_epi16(psi_r_m1_p1, a_r_m1_p1, psi_i_m1_p1, a_i_m1_p1, psi_a_m1_p1); + prodsum_psi_a_epi16(psi_r_m1_m1, a_r_m1_m1, psi_i_m1_m1, a_i_m1_m1, psi_a_m1_m1); + prodsum_psi_a_epi16(psi_r_m1_m3, a_r_m1_m3, psi_i_m1_m3, a_i_m1_m3, psi_a_m1_m3); + prodsum_psi_a_epi16(psi_r_m1_m5, a_r_m1_m5, psi_i_m1_m5, a_i_m1_m5, psi_a_m1_m5); + prodsum_psi_a_epi16(psi_r_m1_m7, a_r_m1_m7, psi_i_m1_m7, a_i_m1_m7, psi_a_m1_m7); + prodsum_psi_a_epi16(psi_r_m3_p7, a_r_m3_p7, psi_i_m3_p7, a_i_m3_p7, psi_a_m3_p7); + prodsum_psi_a_epi16(psi_r_m3_p5, a_r_m3_p5, psi_i_m3_p5, a_i_m3_p5, psi_a_m3_p5); + prodsum_psi_a_epi16(psi_r_m3_p3, a_r_m3_p3, psi_i_m3_p3, a_i_m3_p3, psi_a_m3_p3); + prodsum_psi_a_epi16(psi_r_m3_p1, a_r_m3_p1, psi_i_m3_p1, a_i_m3_p1, psi_a_m3_p1); + prodsum_psi_a_epi16(psi_r_m3_m1, a_r_m3_m1, psi_i_m3_m1, a_i_m3_m1, psi_a_m3_m1); + prodsum_psi_a_epi16(psi_r_m3_m3, a_r_m3_m3, psi_i_m3_m3, a_i_m3_m3, psi_a_m3_m3); + prodsum_psi_a_epi16(psi_r_m3_m5, a_r_m3_m5, psi_i_m3_m5, a_i_m3_m5, psi_a_m3_m5); + prodsum_psi_a_epi16(psi_r_m3_m7, a_r_m3_m7, psi_i_m3_m7, a_i_m3_m7, psi_a_m3_m7); + prodsum_psi_a_epi16(psi_r_m5_p7, a_r_m5_p7, psi_i_m5_p7, a_i_m5_p7, psi_a_m5_p7); + prodsum_psi_a_epi16(psi_r_m5_p5, a_r_m5_p5, psi_i_m5_p5, a_i_m5_p5, psi_a_m5_p5); + prodsum_psi_a_epi16(psi_r_m5_p3, a_r_m5_p3, psi_i_m5_p3, a_i_m5_p3, psi_a_m5_p3); + prodsum_psi_a_epi16(psi_r_m5_p1, a_r_m5_p1, psi_i_m5_p1, a_i_m5_p1, psi_a_m5_p1); + prodsum_psi_a_epi16(psi_r_m5_m1, a_r_m5_m1, psi_i_m5_m1, a_i_m5_m1, psi_a_m5_m1); + prodsum_psi_a_epi16(psi_r_m5_m3, a_r_m5_m3, psi_i_m5_m3, a_i_m5_m3, psi_a_m5_m3); + prodsum_psi_a_epi16(psi_r_m5_m5, a_r_m5_m5, psi_i_m5_m5, a_i_m5_m5, psi_a_m5_m5); + prodsum_psi_a_epi16(psi_r_m5_m7, a_r_m5_m7, psi_i_m5_m7, a_i_m5_m7, psi_a_m5_m7); + prodsum_psi_a_epi16(psi_r_m7_p7, a_r_m7_p7, psi_i_m7_p7, a_i_m7_p7, psi_a_m7_p7); + prodsum_psi_a_epi16(psi_r_m7_p5, a_r_m7_p5, psi_i_m7_p5, a_i_m7_p5, psi_a_m7_p5); + prodsum_psi_a_epi16(psi_r_m7_p3, a_r_m7_p3, psi_i_m7_p3, a_i_m7_p3, psi_a_m7_p3); + prodsum_psi_a_epi16(psi_r_m7_p1, a_r_m7_p1, psi_i_m7_p1, a_i_m7_p1, psi_a_m7_p1); + prodsum_psi_a_epi16(psi_r_m7_m1, a_r_m7_m1, psi_i_m7_m1, a_i_m7_m1, psi_a_m7_m1); + prodsum_psi_a_epi16(psi_r_m7_m3, a_r_m7_m3, psi_i_m7_m3, a_i_m7_m3, psi_a_m7_m3); + prodsum_psi_a_epi16(psi_r_m7_m5, a_r_m7_m5, psi_i_m7_m5, a_i_m7_m5, psi_a_m7_m5); + prodsum_psi_a_epi16(psi_r_m7_m7, a_r_m7_m7, psi_i_m7_m7, a_i_m7_m7, psi_a_m7_m7); + + // Calculation of a group of two terms in the bit metric involving squares of interference + square_a_epi16(a_r_p7_p7, a_i_p7_p7, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p7_p7); + square_a_epi16(a_r_p7_p5, a_i_p7_p5, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p7_p5); + square_a_epi16(a_r_p7_p3, a_i_p7_p3, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p7_p3); + square_a_epi16(a_r_p7_p1, a_i_p7_p1, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p7_p1); + square_a_epi16(a_r_p7_m1, a_i_p7_m1, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p7_m1); + square_a_epi16(a_r_p7_m3, a_i_p7_m3, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p7_m3); + square_a_epi16(a_r_p7_m5, a_i_p7_m5, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p7_m5); + square_a_epi16(a_r_p7_m7, a_i_p7_m7, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p7_m7); + square_a_epi16(a_r_p5_p7, a_i_p5_p7, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p5_p7); + square_a_epi16(a_r_p5_p5, a_i_p5_p5, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p5_p5); + square_a_epi16(a_r_p5_p3, a_i_p5_p3, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p5_p3); + square_a_epi16(a_r_p5_p1, a_i_p5_p1, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p5_p1); + square_a_epi16(a_r_p5_m1, a_i_p5_m1, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p5_m1); + square_a_epi16(a_r_p5_m3, a_i_p5_m3, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p5_m3); + square_a_epi16(a_r_p5_m5, a_i_p5_m5, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p5_m5); + square_a_epi16(a_r_p5_m7, a_i_p5_m7, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p5_m7); + square_a_epi16(a_r_p3_p7, a_i_p3_p7, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p3_p7); + square_a_epi16(a_r_p3_p5, a_i_p3_p5, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p3_p5); + square_a_epi16(a_r_p3_p3, a_i_p3_p3, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p3_p3); + square_a_epi16(a_r_p3_p1, a_i_p3_p1, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p3_p1); + square_a_epi16(a_r_p3_m1, a_i_p3_m1, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p3_m1); + square_a_epi16(a_r_p3_m3, a_i_p3_m3, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p3_m3); + square_a_epi16(a_r_p3_m5, a_i_p3_m5, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p3_m5); + square_a_epi16(a_r_p3_m7, a_i_p3_m7, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p3_m7); + square_a_epi16(a_r_p1_p7, a_i_p1_p7, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p1_p7); + square_a_epi16(a_r_p1_p5, a_i_p1_p5, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p1_p5); + square_a_epi16(a_r_p1_p3, a_i_p1_p3, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p1_p3); + square_a_epi16(a_r_p1_p1, a_i_p1_p1, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p1_p1); + square_a_epi16(a_r_p1_m1, a_i_p1_m1, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p1_m1); + square_a_epi16(a_r_p1_m3, a_i_p1_m3, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p1_m3); + square_a_epi16(a_r_p1_m5, a_i_p1_m5, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p1_m5); + square_a_epi16(a_r_p1_m7, a_i_p1_m7, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_p1_m7); + square_a_epi16(a_r_m1_p7, a_i_m1_p7, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m1_p7); + square_a_epi16(a_r_m1_p5, a_i_m1_p5, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m1_p5); + square_a_epi16(a_r_m1_p3, a_i_m1_p3, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m1_p3); + square_a_epi16(a_r_m1_p1, a_i_m1_p1, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m1_p1); + square_a_epi16(a_r_m1_m1, a_i_m1_m1, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m1_m1); + square_a_epi16(a_r_m1_m3, a_i_m1_m3, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m1_m3); + square_a_epi16(a_r_m1_m5, a_i_m1_m5, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m1_m5); + square_a_epi16(a_r_m1_m7, a_i_m1_m7, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m1_m7); + square_a_epi16(a_r_m3_p7, a_i_m3_p7, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m3_p7); + square_a_epi16(a_r_m3_p5, a_i_m3_p5, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m3_p5); + square_a_epi16(a_r_m3_p3, a_i_m3_p3, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m3_p3); + square_a_epi16(a_r_m3_p1, a_i_m3_p1, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m3_p1); + square_a_epi16(a_r_m3_m1, a_i_m3_m1, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m3_m1); + square_a_epi16(a_r_m3_m3, a_i_m3_m3, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m3_m3); + square_a_epi16(a_r_m3_m5, a_i_m3_m5, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m3_m5); + square_a_epi16(a_r_m3_m7, a_i_m3_m7, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m3_m7); + square_a_epi16(a_r_m5_p7, a_i_m5_p7, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m5_p7); + square_a_epi16(a_r_m5_p5, a_i_m5_p5, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m5_p5); + square_a_epi16(a_r_m5_p3, a_i_m5_p3, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m5_p3); + square_a_epi16(a_r_m5_p1, a_i_m5_p1, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m5_p1); + square_a_epi16(a_r_m5_m1, a_i_m5_m1, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m5_m1); + square_a_epi16(a_r_m5_m3, a_i_m5_m3, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m5_m3); + square_a_epi16(a_r_m5_m5, a_i_m5_m5, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m5_m5); + square_a_epi16(a_r_m5_m7, a_i_m5_m7, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m5_m7); + square_a_epi16(a_r_m7_p7, a_i_m7_p7, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m7_p7); + square_a_epi16(a_r_m7_p5, a_i_m7_p5, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m7_p5); + square_a_epi16(a_r_m7_p3, a_i_m7_p3, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m7_p3); + square_a_epi16(a_r_m7_p1, a_i_m7_p1, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m7_p1); + square_a_epi16(a_r_m7_m1, a_i_m7_m1, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m7_m1); + square_a_epi16(a_r_m7_m3, a_i_m7_m3, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m7_m3); + square_a_epi16(a_r_m7_m5, a_i_m7_m5, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m7_m5); + square_a_epi16(a_r_m7_m7, a_i_m7_m7, ch_mag_int, SQRT_10_OVER_FOUR, a_sq_m7_m7); + + // Computing different multiples of ||h0||^2 + // x=1, y=1 + ch_mag_2_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,ONE_OVER_FOUR_SQRT_42); + ch_mag_2_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_2_over_42_with_sigma2,1); + // x=1, y=3 + ch_mag_10_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,FIVE_OVER_FOUR_SQRT_42); + ch_mag_10_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_10_over_42_with_sigma2,1); + // x=1, x=5 + ch_mag_26_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,THIRTEEN_OVER_FOUR_SQRT_42); + ch_mag_26_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_26_over_42_with_sigma2,1); + // x=1, y=7 + ch_mag_50_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,TWENTYFIVE_OVER_FOUR_SQRT_42); + ch_mag_50_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_50_over_42_with_sigma2,1); + // x=3, y=3 + ch_mag_18_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,NINE_OVER_FOUR_SQRT_42); + ch_mag_18_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_18_over_42_with_sigma2,1); + // x=3, y=5 + ch_mag_34_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,SEVENTEEN_OVER_FOUR_SQRT_42); + ch_mag_34_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_34_over_42_with_sigma2,1); + // x=3, y=7 + ch_mag_58_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,TWENTYNINE_OVER_FOUR_SQRT_42); + ch_mag_58_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_58_over_42_with_sigma2,2); + // x=5, y=5 + ch_mag_50_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,TWENTYFIVE_OVER_FOUR_SQRT_42); + ch_mag_50_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_50_over_42_with_sigma2,1); + // x=5, y=7 + ch_mag_74_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,THIRTYSEVEN_OVER_FOUR_SQRT_42); + ch_mag_74_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_74_over_42_with_sigma2,2); + // x=7, y=7 + ch_mag_98_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,FORTYNINE_OVER_FOUR_SQRT_42); + ch_mag_98_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_98_over_42_with_sigma2,2); + + // Computing Metrics + xmm0 = _mm_subs_epi16(psi_a_p7_p7, a_sq_p7_p7); + xmm1 = _mm_adds_epi16(xmm0, y0_p_7_7); + bit_met_p7_p7 = _mm_subs_epi16(xmm1, ch_mag_98_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p7_p5, a_sq_p7_p5); + xmm1 = _mm_adds_epi16(xmm0, y0_p_7_5); + bit_met_p7_p5 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p7_p3, a_sq_p7_p3); + xmm1 = _mm_adds_epi16(xmm0, y0_p_7_3); + bit_met_p7_p3 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p7_p1, a_sq_p7_p1); + xmm1 = _mm_adds_epi16(xmm0, y0_p_7_1); + bit_met_p7_p1 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p7_m1, a_sq_p7_m1); + xmm1 = _mm_adds_epi16(xmm0, y0_m_7_1); + bit_met_p7_m1 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p7_m3, a_sq_p7_m3); + xmm1 = _mm_adds_epi16(xmm0, y0_m_7_3); + bit_met_p7_m3 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p7_m5, a_sq_p7_m5); + xmm1 = _mm_adds_epi16(xmm0, y0_m_7_5); + bit_met_p7_m5 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p7_m7, a_sq_p7_m7); + xmm1 = _mm_adds_epi16(xmm0, y0_m_7_7); + bit_met_p7_m7 = _mm_subs_epi16(xmm1, ch_mag_98_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p5_p7, a_sq_p5_p7); + xmm1 = _mm_adds_epi16(xmm0, y0_p_5_7); + bit_met_p5_p7 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p5_p5, a_sq_p5_p5); + xmm1 = _mm_adds_epi16(xmm0, y0_p_5_5); + bit_met_p5_p5 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p5_p3, a_sq_p5_p3); + xmm1 = _mm_adds_epi16(xmm0, y0_p_5_3); + bit_met_p5_p3 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p5_p1, a_sq_p5_p1); + xmm1 = _mm_adds_epi16(xmm0, y0_p_5_1); + bit_met_p5_p1 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p5_m1, a_sq_p5_m1); + xmm1 = _mm_adds_epi16(xmm0, y0_m_5_1); + bit_met_p5_m1 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p5_m3, a_sq_p5_m3); + xmm1 = _mm_adds_epi16(xmm0, y0_m_5_3); + bit_met_p5_m3 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p5_m5, a_sq_p5_m5); + xmm1 = _mm_adds_epi16(xmm0, y0_m_5_5); + bit_met_p5_m5 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p5_m7, a_sq_p5_m7); + xmm1 = _mm_adds_epi16(xmm0, y0_m_5_7); + bit_met_p5_m7 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p3_p7, a_sq_p3_p7); + xmm1 = _mm_adds_epi16(xmm0, y0_p_3_7); + bit_met_p3_p7 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p3_p5, a_sq_p3_p5); + xmm1 = _mm_adds_epi16(xmm0, y0_p_3_5); + bit_met_p3_p5 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p3_p3, a_sq_p3_p3); + xmm1 = _mm_adds_epi16(xmm0, y0_p_3_3); + bit_met_p3_p3 = _mm_subs_epi16(xmm1, ch_mag_18_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p3_p1, a_sq_p3_p1); + xmm1 = _mm_adds_epi16(xmm0, y0_p_3_1); + bit_met_p3_p1 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p3_m1, a_sq_p3_m1); + xmm1 = _mm_adds_epi16(xmm0, y0_m_3_1); + bit_met_p3_m1 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p3_m3, a_sq_p3_m3); + xmm1 = _mm_adds_epi16(xmm0, y0_m_3_3); + bit_met_p3_m3 = _mm_subs_epi16(xmm1, ch_mag_18_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p3_m5, a_sq_p3_m5); + xmm1 = _mm_adds_epi16(xmm0, y0_m_3_5); + bit_met_p3_m5 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p3_m7, a_sq_p3_m7); + xmm1 = _mm_adds_epi16(xmm0, y0_m_3_7); + bit_met_p3_m7 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p1_p7, a_sq_p1_p7); + xmm1 = _mm_adds_epi16(xmm0, y0_p_1_7); + bit_met_p1_p7 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p1_p5, a_sq_p1_p5); + xmm1 = _mm_adds_epi16(xmm0, y0_p_1_5); + bit_met_p1_p5 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p1_p3, a_sq_p1_p3); + xmm1 = _mm_adds_epi16(xmm0, y0_p_1_3); + bit_met_p1_p3 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p1_p1, a_sq_p1_p1); + xmm1 = _mm_adds_epi16(xmm0, y0_p_1_1); + bit_met_p1_p1 = _mm_subs_epi16(xmm1, ch_mag_2_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p1_m1, a_sq_p1_m1); + xmm1 = _mm_adds_epi16(xmm0, y0_m_1_1); + bit_met_p1_m1 = _mm_subs_epi16(xmm1, ch_mag_2_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p1_m3, a_sq_p1_m3); + xmm1 = _mm_adds_epi16(xmm0, y0_m_1_3); + bit_met_p1_m3 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p1_m5, a_sq_p1_m5); + xmm1 = _mm_adds_epi16(xmm0, y0_m_1_5); + bit_met_p1_m5 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p1_m7, a_sq_p1_m7); + xmm1 = _mm_adds_epi16(xmm0, y0_m_1_7); + bit_met_p1_m7 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + + xmm0 = _mm_subs_epi16(psi_a_m1_p7, a_sq_m1_p7); + xmm1 = _mm_subs_epi16(xmm0, y0_m_1_7); + bit_met_m1_p7 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m1_p5, a_sq_m1_p5); + xmm1 = _mm_subs_epi16(xmm0, y0_m_1_5); + bit_met_m1_p5 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m1_p3, a_sq_m1_p3); + xmm1 = _mm_subs_epi16(xmm0, y0_m_1_3); + bit_met_m1_p3 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m1_p1, a_sq_m1_p1); + xmm1 = _mm_subs_epi16(xmm0, y0_m_1_1); + bit_met_m1_p1 = _mm_subs_epi16(xmm1, ch_mag_2_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m1_m1, a_sq_m1_m1); + xmm1 = _mm_subs_epi16(xmm0, y0_p_1_1); + bit_met_m1_m1 = _mm_subs_epi16(xmm1, ch_mag_2_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m1_m3, a_sq_m1_m3); + xmm1 = _mm_subs_epi16(xmm0, y0_p_1_3); + bit_met_m1_m3 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m1_m5, a_sq_m1_m5); + xmm1 = _mm_subs_epi16(xmm0, y0_p_1_5); + bit_met_m1_m5 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m1_m7, a_sq_m1_m7); + xmm1 = _mm_subs_epi16(xmm0, y0_p_1_7); + bit_met_m1_m7 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m3_p7, a_sq_m3_p7); + xmm1 = _mm_subs_epi16(xmm0, y0_m_3_7); + bit_met_m3_p7 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m3_p5, a_sq_m3_p5); + xmm1 = _mm_subs_epi16(xmm0, y0_m_3_5); + bit_met_m3_p5 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m3_p3, a_sq_m3_p3); + xmm1 = _mm_subs_epi16(xmm0, y0_m_3_3); + bit_met_m3_p3 = _mm_subs_epi16(xmm1, ch_mag_18_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m3_p1, a_sq_m3_p1); + xmm1 = _mm_subs_epi16(xmm0, y0_m_3_1); + bit_met_m3_p1 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m3_m1, a_sq_m3_m1); + xmm1 = _mm_subs_epi16(xmm0, y0_p_3_1); + bit_met_m3_m1 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m3_m3, a_sq_m3_m3); + xmm1 = _mm_subs_epi16(xmm0, y0_p_3_3); + bit_met_m3_m3 = _mm_subs_epi16(xmm1, ch_mag_18_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m3_m5, a_sq_m3_m5); + xmm1 = _mm_subs_epi16(xmm0, y0_p_3_5); + bit_met_m3_m5 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m3_m7, a_sq_m3_m7); + xmm1 = _mm_subs_epi16(xmm0, y0_p_3_7); + bit_met_m3_m7 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m5_p7, a_sq_m5_p7); + xmm1 = _mm_subs_epi16(xmm0, y0_m_5_7); + bit_met_m5_p7 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m5_p5, a_sq_m5_p5); + xmm1 = _mm_subs_epi16(xmm0, y0_m_5_5); + bit_met_m5_p5 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m5_p3, a_sq_m5_p3); + xmm1 = _mm_subs_epi16(xmm0, y0_m_5_3); + bit_met_m5_p3 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m5_p1, a_sq_m5_p1); + xmm1 = _mm_subs_epi16(xmm0, y0_m_5_1); + bit_met_m5_p1 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m5_m1, a_sq_m5_m1); + xmm1 = _mm_subs_epi16(xmm0, y0_p_5_1); + bit_met_m5_m1 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m5_m3, a_sq_m5_m3); + xmm1 = _mm_subs_epi16(xmm0, y0_p_5_3); + bit_met_m5_m3 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m5_m5, a_sq_m5_m5); + xmm1 = _mm_subs_epi16(xmm0, y0_p_5_5); + bit_met_m5_m5 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m5_m7, a_sq_m5_m7); + xmm1 = _mm_subs_epi16(xmm0, y0_p_5_7); + bit_met_m5_m7 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m7_p7, a_sq_m7_p7); + xmm1 = _mm_subs_epi16(xmm0, y0_m_7_7); + bit_met_m7_p7 = _mm_subs_epi16(xmm1, ch_mag_98_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m7_p5, a_sq_m7_p5); + xmm1 = _mm_subs_epi16(xmm0, y0_m_7_5); + bit_met_m7_p5 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m7_p3, a_sq_m7_p3); + xmm1 = _mm_subs_epi16(xmm0, y0_m_7_3); + bit_met_m7_p3 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m7_p1, a_sq_m7_p1); + xmm1 = _mm_subs_epi16(xmm0, y0_m_7_1); + bit_met_m7_p1 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m7_m1, a_sq_m7_m1); + xmm1 = _mm_subs_epi16(xmm0, y0_p_7_1); + bit_met_m7_m1 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m7_m3, a_sq_m7_m3); + xmm1 = _mm_subs_epi16(xmm0, y0_p_7_3); + bit_met_m7_m3 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m7_m5, a_sq_m7_m5); + xmm1 = _mm_subs_epi16(xmm0, y0_p_7_5); + bit_met_m7_m5 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m7_m7, a_sq_m7_m7); + xmm1 = _mm_subs_epi16(xmm0, y0_p_7_7); + bit_met_m7_m7 = _mm_subs_epi16(xmm1, ch_mag_98_over_42_with_sigma2); + + // Detection for 1st bit (LTE mapping) + // bit = 1 + xmm0 = _mm_max_epi16(bit_met_m7_p7, bit_met_m7_p5); + xmm1 = _mm_max_epi16(bit_met_m7_p3, bit_met_m7_p1); + xmm2 = _mm_max_epi16(bit_met_m7_m1, bit_met_m7_m3); + xmm3 = _mm_max_epi16(bit_met_m7_m5, bit_met_m7_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_m5_p7, bit_met_m5_p5); + xmm1 = _mm_max_epi16(bit_met_m5_p3, bit_met_m5_p1); + xmm2 = _mm_max_epi16(bit_met_m5_m1, bit_met_m5_m3); + xmm3 = _mm_max_epi16(bit_met_m5_m5, bit_met_m5_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_m3_p7, bit_met_m3_p5); + xmm1 = _mm_max_epi16(bit_met_m3_p3, bit_met_m3_p1); + xmm2 = _mm_max_epi16(bit_met_m3_m1, bit_met_m3_m3); + xmm3 = _mm_max_epi16(bit_met_m3_m5, bit_met_m3_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_m1_p7, bit_met_m1_p5); + xmm1 = _mm_max_epi16(bit_met_m1_p3, bit_met_m1_p1); + xmm2 = _mm_max_epi16(bit_met_m1_m1, bit_met_m1_m3); + xmm3 = _mm_max_epi16(bit_met_m1_m5, bit_met_m1_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + + // bit = 0 + xmm0 = _mm_max_epi16(bit_met_p7_p7, bit_met_p7_p5); + xmm1 = _mm_max_epi16(bit_met_p7_p3, bit_met_p7_p1); + xmm2 = _mm_max_epi16(bit_met_p7_m1, bit_met_p7_m3); + xmm3 = _mm_max_epi16(bit_met_p7_m5, bit_met_p7_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_p5_p7, bit_met_p5_p5); + xmm1 = _mm_max_epi16(bit_met_p5_p3, bit_met_p5_p1); + xmm2 = _mm_max_epi16(bit_met_p5_m1, bit_met_p5_m3); + xmm3 = _mm_max_epi16(bit_met_p5_m5, bit_met_p5_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p3_p7, bit_met_p3_p5); + xmm1 = _mm_max_epi16(bit_met_p3_p3, bit_met_p3_p1); + xmm2 = _mm_max_epi16(bit_met_p3_m1, bit_met_p3_m3); + xmm3 = _mm_max_epi16(bit_met_p3_m5, bit_met_p3_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p1_p7, bit_met_p1_p5); + xmm1 = _mm_max_epi16(bit_met_p1_p3, bit_met_p1_p1); + xmm2 = _mm_max_epi16(bit_met_p1_m1, bit_met_p1_m3); + xmm3 = _mm_max_epi16(bit_met_p1_m5, bit_met_p1_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + + y0r = _mm_subs_epi16(logmax_num_re0, logmax_den_re0); + + // Detection for 2nd bit (LTE mapping) + // bit = 1 + xmm0 = _mm_max_epi16(bit_met_p7_m1, bit_met_p5_m1); + xmm1 = _mm_max_epi16(bit_met_p3_m1, bit_met_p1_m1); + xmm2 = _mm_max_epi16(bit_met_m1_m1, bit_met_m3_m1); + xmm3 = _mm_max_epi16(bit_met_m5_m1, bit_met_m7_m1); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m3, bit_met_p5_m3); + xmm1 = _mm_max_epi16(bit_met_p3_m3, bit_met_p1_m3); + xmm2 = _mm_max_epi16(bit_met_m1_m3, bit_met_m3_m3); + xmm3 = _mm_max_epi16(bit_met_m5_m3, bit_met_m7_m3); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m5, bit_met_p5_m5); + xmm1 = _mm_max_epi16(bit_met_p3_m5, bit_met_p1_m5); + xmm2 = _mm_max_epi16(bit_met_m1_m5, bit_met_m3_m5); + xmm3 = _mm_max_epi16(bit_met_m5_m5, bit_met_m7_m5); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m7, bit_met_p5_m7); + xmm1 = _mm_max_epi16(bit_met_p3_m7, bit_met_p1_m7); + xmm2 = _mm_max_epi16(bit_met_m1_m7, bit_met_m3_m7); + xmm3 = _mm_max_epi16(bit_met_m5_m7, bit_met_m7_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + + // bit = 0 + xmm0 = _mm_max_epi16(bit_met_p7_p1, bit_met_p5_p1); + xmm1 = _mm_max_epi16(bit_met_p3_p1, bit_met_p1_p1); + xmm2 = _mm_max_epi16(bit_met_m1_p1, bit_met_m3_p1); + xmm3 = _mm_max_epi16(bit_met_m5_p1, bit_met_m7_p1); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p3, bit_met_p5_p3); + xmm1 = _mm_max_epi16(bit_met_p3_p3, bit_met_p1_p3); + xmm2 = _mm_max_epi16(bit_met_m1_p3, bit_met_m3_p3); + xmm3 = _mm_max_epi16(bit_met_m5_p3, bit_met_m7_p3); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p5, bit_met_p5_p5); + xmm1 = _mm_max_epi16(bit_met_p3_p5, bit_met_p1_p5); + xmm2 = _mm_max_epi16(bit_met_m1_p5, bit_met_m3_p5); + xmm3 = _mm_max_epi16(bit_met_m5_p5, bit_met_m7_p5); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p7, bit_met_p5_p7); + xmm1 = _mm_max_epi16(bit_met_p3_p7, bit_met_p1_p7); + xmm2 = _mm_max_epi16(bit_met_m1_p7, bit_met_m3_p7); + xmm3 = _mm_max_epi16(bit_met_m5_p7, bit_met_m7_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + + y1r = _mm_subs_epi16(logmax_num_re0, logmax_den_re0); + + // Detection for 3rd bit (LTE mapping) + xmm0 = _mm_max_epi16(bit_met_m7_m7, bit_met_m7_m5); + xmm1 = _mm_max_epi16(bit_met_m7_m3, bit_met_m7_m1); + xmm2 = _mm_max_epi16(bit_met_m7_p1, bit_met_m7_p3); + xmm3 = _mm_max_epi16(bit_met_m7_p5, bit_met_m7_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_m5_m7, bit_met_m5_m5); + xmm1 = _mm_max_epi16(bit_met_m5_m3, bit_met_m5_m1); + xmm2 = _mm_max_epi16(bit_met_m5_p1, bit_met_m5_p3); + xmm3 = _mm_max_epi16(bit_met_m5_p5, bit_met_m5_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p5_m7, bit_met_p5_m5); + xmm1 = _mm_max_epi16(bit_met_p5_m3, bit_met_p5_m1); + xmm2 = _mm_max_epi16(bit_met_p5_p1, bit_met_p5_p3); + xmm3 = _mm_max_epi16(bit_met_p5_p5, bit_met_p5_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m7, bit_met_p7_m5); + xmm1 = _mm_max_epi16(bit_met_p7_m3, bit_met_p7_m1); + xmm2 = _mm_max_epi16(bit_met_p7_p1, bit_met_p7_p3); + xmm3 = _mm_max_epi16(bit_met_p7_p5, bit_met_p7_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + + xmm0 = _mm_max_epi16(bit_met_m3_m7, bit_met_m3_m5); + xmm1 = _mm_max_epi16(bit_met_m3_m3, bit_met_m3_m1); + xmm2 = _mm_max_epi16(bit_met_m3_p1, bit_met_m3_p3); + xmm3 = _mm_max_epi16(bit_met_m3_p5, bit_met_m3_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_m1_m7, bit_met_m1_m5); + xmm1 = _mm_max_epi16(bit_met_m1_m3, bit_met_m1_m1); + xmm2 = _mm_max_epi16(bit_met_m1_p1, bit_met_m1_p3); + xmm3 = _mm_max_epi16(bit_met_m1_p5, bit_met_m1_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p1_m7, bit_met_p1_m5); + xmm1 = _mm_max_epi16(bit_met_p1_m3, bit_met_p1_m1); + xmm2 = _mm_max_epi16(bit_met_p1_p1, bit_met_p1_p3); + xmm3 = _mm_max_epi16(bit_met_p1_p5, bit_met_p1_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p3_m7, bit_met_p3_m5); + xmm1 = _mm_max_epi16(bit_met_p3_m3, bit_met_p3_m1); + xmm2 = _mm_max_epi16(bit_met_p3_p1, bit_met_p3_p3); + xmm3 = _mm_max_epi16(bit_met_p3_p5, bit_met_p3_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + + y2r = _mm_subs_epi16(logmax_num_re0, logmax_den_re0); + + // Detection for 4th bit (LTE mapping) + xmm0 = _mm_max_epi16(bit_met_p7_p7, bit_met_p5_p7); + xmm1 = _mm_max_epi16(bit_met_p3_p7, bit_met_p1_p7); + xmm2 = _mm_max_epi16(bit_met_m1_p7, bit_met_m3_p7); + xmm3 = _mm_max_epi16(bit_met_m5_p7, bit_met_m7_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p5, bit_met_p5_p5); + xmm1 = _mm_max_epi16(bit_met_p3_p5, bit_met_p1_p5); + xmm2 = _mm_max_epi16(bit_met_m1_p5, bit_met_m3_p5); + xmm3 = _mm_max_epi16(bit_met_m5_p5, bit_met_m5_p5); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m5, bit_met_p5_m5); + xmm1 = _mm_max_epi16(bit_met_p3_m5, bit_met_p1_m5); + xmm2 = _mm_max_epi16(bit_met_m1_m5, bit_met_m3_m5); + xmm3 = _mm_max_epi16(bit_met_m5_m5, bit_met_m7_m5); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m7, bit_met_p5_m7); + xmm1 = _mm_max_epi16(bit_met_p3_m7, bit_met_p1_m7); + xmm2 = _mm_max_epi16(bit_met_m1_m7, bit_met_m3_m7); + xmm3 = _mm_max_epi16(bit_met_m5_m7, bit_met_m7_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + + xmm0 = _mm_max_epi16(bit_met_p7_m1, bit_met_p5_m1); + xmm1 = _mm_max_epi16(bit_met_p3_m1, bit_met_p1_m1); + xmm2 = _mm_max_epi16(bit_met_m1_m1, bit_met_m3_m1); + xmm3 = _mm_max_epi16(bit_met_m5_m1, bit_met_m7_m1); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m3, bit_met_p5_m3); + xmm1 = _mm_max_epi16(bit_met_p3_m3, bit_met_p1_m3); + xmm2 = _mm_max_epi16(bit_met_m1_m3, bit_met_m3_m3); + xmm3 = _mm_max_epi16(bit_met_m5_m3, bit_met_m7_m3); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p1, bit_met_p5_p1); + xmm1 = _mm_max_epi16(bit_met_p3_p1, bit_met_p1_p1); + xmm2 = _mm_max_epi16(bit_met_m1_p1, bit_met_m3_p1); + xmm3 = _mm_max_epi16(bit_met_m5_p1, bit_met_m7_p1); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p3, bit_met_p5_p3); + xmm1 = _mm_max_epi16(bit_met_p3_p3, bit_met_p1_p3); + xmm2 = _mm_max_epi16(bit_met_m1_p3, bit_met_m3_p3); + xmm3 = _mm_max_epi16(bit_met_m5_p3, bit_met_m7_p3); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + + y0i = _mm_subs_epi16(logmax_num_re0, logmax_den_re0); + + + // Detection for 5th bit (LTE mapping) + xmm0 = _mm_max_epi16(bit_met_m7_m7, bit_met_m7_m5); + xmm1 = _mm_max_epi16(bit_met_m7_m3, bit_met_m7_m1); + xmm2 = _mm_max_epi16(bit_met_m7_p1, bit_met_m7_p3); + xmm3 = _mm_max_epi16(bit_met_m7_p5, bit_met_m7_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_m1_m7, bit_met_m1_m5); + xmm1 = _mm_max_epi16(bit_met_m1_m3, bit_met_m1_m1); + xmm2 = _mm_max_epi16(bit_met_m1_p1, bit_met_m1_p3); + xmm3 = _mm_max_epi16(bit_met_m1_p5, bit_met_m1_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p1_m7, bit_met_p1_m5); + xmm1 = _mm_max_epi16(bit_met_p1_m3, bit_met_p1_m1); + xmm2 = _mm_max_epi16(bit_met_p1_p1, bit_met_p1_p3); + xmm3 = _mm_max_epi16(bit_met_p1_p5, bit_met_p1_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m7, bit_met_p7_m5); + xmm1 = _mm_max_epi16(bit_met_p7_m3, bit_met_p7_m1); + xmm2 = _mm_max_epi16(bit_met_p7_p1, bit_met_p7_p3); + xmm3 = _mm_max_epi16(bit_met_p7_p5, bit_met_p7_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + + xmm0 = _mm_max_epi16(bit_met_m5_m7, bit_met_m5_m5); + xmm1 = _mm_max_epi16(bit_met_m5_m3, bit_met_m5_m1); + xmm2 = _mm_max_epi16(bit_met_m5_p1, bit_met_m5_p3); + xmm3 = _mm_max_epi16(bit_met_m5_p5, bit_met_m5_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_m3_m7, bit_met_m3_m5); + xmm1 = _mm_max_epi16(bit_met_m3_m3, bit_met_m3_m1); + xmm2 = _mm_max_epi16(bit_met_m3_p1, bit_met_m3_p3); + xmm3 = _mm_max_epi16(bit_met_m3_p5, bit_met_m3_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p3_m7, bit_met_p3_m5); + xmm1 = _mm_max_epi16(bit_met_p3_m3, bit_met_p3_m1); + xmm2 = _mm_max_epi16(bit_met_p3_p1, bit_met_p3_p3); + xmm3 = _mm_max_epi16(bit_met_p3_p5, bit_met_p3_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p5_m7, bit_met_p5_m5); + xmm1 = _mm_max_epi16(bit_met_p5_m3, bit_met_p5_m1); + xmm2 = _mm_max_epi16(bit_met_p5_p1, bit_met_p5_p3); + xmm3 = _mm_max_epi16(bit_met_p5_p5, bit_met_p5_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + + y1i = _mm_subs_epi16(logmax_num_re0, logmax_den_re0); + + // Detection for 6th bit (LTE mapping) + xmm0 = _mm_max_epi16(bit_met_p7_p7, bit_met_p5_p7); + xmm1 = _mm_max_epi16(bit_met_p3_p7, bit_met_p1_p7); + xmm2 = _mm_max_epi16(bit_met_m1_p7, bit_met_m3_p7); + xmm3 = _mm_max_epi16(bit_met_m5_p7, bit_met_m7_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p1, bit_met_p5_p1); + xmm1 = _mm_max_epi16(bit_met_p3_p1, bit_met_p1_p1); + xmm2 = _mm_max_epi16(bit_met_m1_p1, bit_met_m3_p1); + xmm3 = _mm_max_epi16(bit_met_m5_p1, bit_met_m5_p1); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m1, bit_met_p5_m1); + xmm1 = _mm_max_epi16(bit_met_p3_m1, bit_met_p1_m1); + xmm2 = _mm_max_epi16(bit_met_m1_m1, bit_met_m3_m1); + xmm3 = _mm_max_epi16(bit_met_m5_m1, bit_met_m7_m1); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m7, bit_met_p5_m7); + xmm1 = _mm_max_epi16(bit_met_p3_m7, bit_met_p1_m7); + xmm2 = _mm_max_epi16(bit_met_m1_m7, bit_met_m3_m7); + xmm3 = _mm_max_epi16(bit_met_m5_m7, bit_met_m7_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + + xmm0 = _mm_max_epi16(bit_met_p7_m5, bit_met_p5_m5); + xmm1 = _mm_max_epi16(bit_met_p3_m5, bit_met_p1_m5); + xmm2 = _mm_max_epi16(bit_met_m1_m5, bit_met_m3_m5); + xmm3 = _mm_max_epi16(bit_met_m5_m5, bit_met_m7_m5); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m3, bit_met_p5_m3); + xmm1 = _mm_max_epi16(bit_met_p3_m3, bit_met_p1_m3); + xmm2 = _mm_max_epi16(bit_met_m1_m3, bit_met_m3_m3); + xmm3 = _mm_max_epi16(bit_met_m5_m3, bit_met_m7_m3); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p3, bit_met_p5_p3); + xmm1 = _mm_max_epi16(bit_met_p3_p3, bit_met_p1_p3); + xmm2 = _mm_max_epi16(bit_met_m1_p3, bit_met_m3_p3); + xmm3 = _mm_max_epi16(bit_met_m5_p3, bit_met_m7_p3); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p5, bit_met_p5_p5); + xmm1 = _mm_max_epi16(bit_met_p3_p5, bit_met_p1_p5); + xmm2 = _mm_max_epi16(bit_met_m1_p5, bit_met_m3_p5); + xmm3 = _mm_max_epi16(bit_met_m5_p5, bit_met_m7_p5); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + + y2i = _mm_subs_epi16(logmax_num_re0, logmax_den_re0); + + + // map to output stream, difficult to do in SIMD since we have 6 16bit LLRs + // RE 1 + j = 24*i; + stream0_out[j + 0] = ((short *)&y0r)[0]; + stream0_out[j + 1] = ((short *)&y1r)[0]; + stream0_out[j + 2] = ((short *)&y2r)[0]; + stream0_out[j + 3] = ((short *)&y0i)[0]; + stream0_out[j + 4] = ((short *)&y1i)[0]; + stream0_out[j + 5] = ((short *)&y2i)[0]; + // RE 2 + stream0_out[j + 6] = ((short *)&y0r)[1]; + stream0_out[j + 7] = ((short *)&y1r)[1]; + stream0_out[j + 8] = ((short *)&y2r)[1]; + stream0_out[j + 9] = ((short *)&y0i)[1]; + stream0_out[j + 10] = ((short *)&y1i)[1]; + stream0_out[j + 11] = ((short *)&y2i)[1]; + // RE 3 + stream0_out[j + 12] = ((short *)&y0r)[2]; + stream0_out[j + 13] = ((short *)&y1r)[2]; + stream0_out[j + 14] = ((short *)&y2r)[2]; + stream0_out[j + 15] = ((short *)&y0i)[2]; + stream0_out[j + 16] = ((short *)&y1i)[2]; + stream0_out[j + 17] = ((short *)&y2i)[2]; + // RE 4 + stream0_out[j + 18] = ((short *)&y0r)[3]; + stream0_out[j + 19] = ((short *)&y1r)[3]; + stream0_out[j + 20] = ((short *)&y2r)[3]; + stream0_out[j + 21] = ((short *)&y0i)[3]; + stream0_out[j + 22] = ((short *)&y1i)[3]; + stream0_out[j + 23] = ((short *)&y2i)[3]; + // RE 5 + stream0_out[j + 24] = ((short *)&y0r)[4]; + stream0_out[j + 25] = ((short *)&y1r)[4]; + stream0_out[j + 26] = ((short *)&y2r)[4]; + stream0_out[j + 27] = ((short *)&y0i)[4]; + stream0_out[j + 28] = ((short *)&y1i)[4]; + stream0_out[j + 29] = ((short *)&y2i)[4]; + // RE 6 + stream0_out[j + 30] = ((short *)&y0r)[5]; + stream0_out[j + 31] = ((short *)&y1r)[5]; + stream0_out[j + 32] = ((short *)&y2r)[5]; + stream0_out[j + 33] = ((short *)&y0i)[5]; + stream0_out[j + 34] = ((short *)&y1i)[5]; + stream0_out[j + 35] = ((short *)&y2i)[5]; + // RE 7 + stream0_out[j + 36] = ((short *)&y0r)[6]; + stream0_out[j + 37] = ((short *)&y1r)[6]; + stream0_out[j + 38] = ((short *)&y2r)[6]; + stream0_out[j + 39] = ((short *)&y0i)[6]; + stream0_out[j + 40] = ((short *)&y1i)[6]; + stream0_out[j + 41] = ((short *)&y2i)[6]; + // RE 8 + stream0_out[j + 42] = ((short *)&y0r)[7]; + stream0_out[j + 43] = ((short *)&y1r)[7]; + stream0_out[j + 44] = ((short *)&y2r)[7]; + stream0_out[j + 45] = ((short *)&y0i)[7]; + stream0_out[j + 46] = ((short *)&y1i)[7]; + stream0_out[j + 47] = ((short *)&y2i)[7]; + +#elif defined(__arm__) + +#endif + } + +#if defined(__x86_64__) || defined(__i386__) + _mm_empty(); + _m_empty(); +#endif + +} + + +int dlsch_64qam_16qam_llr(LTE_DL_FRAME_PARMS *frame_parms, + int32_t **rxdataF_comp, + int32_t **rxdataF_comp_i, + int32_t **dl_ch_mag, + int32_t **dl_ch_mag_i, + int32_t **rho_i, + int16_t *dlsch_llr, + uint8_t symbol, + uint8_t first_symbol_flag, + uint16_t nb_rb, + uint16_t pbch_pss_sss_adjust, + int16_t **llr16p) +{ + + int16_t *rxF = (int16_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *rxF_i = (int16_t*)&rxdataF_comp_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *ch_mag = (int16_t*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *ch_mag_i = (int16_t*)&dl_ch_mag_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *rho = (int16_t*)&rho_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *llr16; + int len; + uint8_t symbol_mod = (symbol >= (7-frame_parms->Ncp))? (symbol-(7-frame_parms->Ncp)) : symbol; + + //first symbol has different structure due to more pilots + if (first_symbol_flag == 1) { + llr16 = (int16_t*)dlsch_llr; + } else { + llr16 = (int16_t*)(*llr16p); + } + + AssertFatal(llr16!=NULL,"dlsch_16qam_64qam_llr:llr is null, symbol %d\n",symbol); + + if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { + // if symbol has pilots + if (frame_parms->nb_antenna_ports_eNB!=1) + // in 2 antenna ports we have 8 REs per symbol per RB + len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); + else + // for 1 antenna port we have 10 REs per symbol per RB + len = (nb_rb*10) - (5*pbch_pss_sss_adjust/6); + } else { + // symbol has no pilots + len = (nb_rb*12) - pbch_pss_sss_adjust; + } + + qam64_qam16((short *)rxF, + (short *)rxF_i, + (short *)ch_mag, + (short *)ch_mag_i, + (short *)llr16, + (short *)rho, + len); + + llr16 += (6*len); + *llr16p = (short *)llr16; + return(0); +} + +void qam64_qam64(short *stream0_in, + short *stream1_in, + short *ch_mag, + short *ch_mag_i, + short *stream0_out, + short *rho01, + int length + ) +{ + + /* + Author: S. Wagner + Date: 31-07-12 + + Input: + stream0_in: MF filter for 1st stream, i.e., y0=h0'*y + stream1_in: MF filter for 2nd stream, i.e., y1=h1'*y + ch_mag: 4*h0/sqrt(42), [Re0 Im0 Re1 Im1] s.t. Im0=Re0, Im1=Re1, etc + ch_mag_i: 4*h1/sqrt(42), [Re0 Im0 Re1 Im1] s.t. Im0=Re0, Im1=Re1, etc + rho01: Channel cross correlation, i.e., h1'*h0 + + Output: + stream0_out: output LLRs for 1st stream + */ + +#if defined(__x86_64__) || defined(__i386__) + + __m128i *rho01_128i = (__m128i *)rho01; + __m128i *stream0_128i_in = (__m128i *)stream0_in; + __m128i *stream1_128i_in = (__m128i *)stream1_in; + __m128i *ch_mag_128i = (__m128i *)ch_mag; + __m128i *ch_mag_128i_i = (__m128i *)ch_mag_i; + + __m128i ONE_OVER_SQRT_42 = _mm_set1_epi16(10112); // round(1/sqrt(42)*2^16) + __m128i THREE_OVER_SQRT_42 = _mm_set1_epi16(30337); // round(3/sqrt(42)*2^16) + __m128i FIVE_OVER_SQRT_42 = _mm_set1_epi16(25281); // round(5/sqrt(42)*2^15) + __m128i SEVEN_OVER_SQRT_42 = _mm_set1_epi16(17697); // round(7/sqrt(42)*2^14) Q2.14 + __m128i ONE_OVER_SQRT_2 = _mm_set1_epi16(23170); // round(1/sqrt(2)*2^15) + __m128i ONE_OVER_SQRT_2_42 = _mm_set1_epi16(3575); // round(1/sqrt(2*42)*2^15) + __m128i THREE_OVER_SQRT_2_42 = _mm_set1_epi16(10726); // round(3/sqrt(2*42)*2^15) + __m128i FIVE_OVER_SQRT_2_42 = _mm_set1_epi16(17876); // round(5/sqrt(2*42)*2^15) + __m128i SEVEN_OVER_SQRT_2_42 = _mm_set1_epi16(25027); // round(7/sqrt(2*42)*2^15) + __m128i FORTYNINE_OVER_FOUR_SQRT_42 = _mm_set1_epi16(30969); // round(49/(4*sqrt(42))*2^14), Q2.14 + __m128i THIRTYSEVEN_OVER_FOUR_SQRT_42 = _mm_set1_epi16(23385); // round(37/(4*sqrt(42))*2^14), Q2.14 + __m128i TWENTYFIVE_OVER_FOUR_SQRT_42 = _mm_set1_epi16(31601); // round(25/(4*sqrt(42))*2^15) + __m128i TWENTYNINE_OVER_FOUR_SQRT_42 = _mm_set1_epi16(18329); // round(29/(4*sqrt(42))*2^15), Q2.14 + __m128i SEVENTEEN_OVER_FOUR_SQRT_42 = _mm_set1_epi16(21489); // round(17/(4*sqrt(42))*2^15) + __m128i NINE_OVER_FOUR_SQRT_42 = _mm_set1_epi16(11376); // round(9/(4*sqrt(42))*2^15) + __m128i THIRTEEN_OVER_FOUR_SQRT_42 = _mm_set1_epi16(16433); // round(13/(4*sqrt(42))*2^15) + __m128i FIVE_OVER_FOUR_SQRT_42 = _mm_set1_epi16(6320); // round(5/(4*sqrt(42))*2^15) + __m128i ONE_OVER_FOUR_SQRT_42 = _mm_set1_epi16(1264); // round(1/(4*sqrt(42))*2^15) + __m128i SQRT_42_OVER_FOUR = _mm_set1_epi16(13272); // round(sqrt(42)/4*2^13), Q3.12 + + __m128i ch_mag_des; + __m128i ch_mag_int; + __m128i ch_mag_98_over_42_with_sigma2; + __m128i ch_mag_74_over_42_with_sigma2; + __m128i ch_mag_58_over_42_with_sigma2; + __m128i ch_mag_50_over_42_with_sigma2; + __m128i ch_mag_34_over_42_with_sigma2; + __m128i ch_mag_18_over_42_with_sigma2; + __m128i ch_mag_26_over_42_with_sigma2; + __m128i ch_mag_10_over_42_with_sigma2; + __m128i ch_mag_2_over_42_with_sigma2; + __m128i y0r_one_over_sqrt_21; + __m128i y0r_three_over_sqrt_21; + __m128i y0r_five_over_sqrt_21; + __m128i y0r_seven_over_sqrt_21; + __m128i y0i_one_over_sqrt_21; + __m128i y0i_three_over_sqrt_21; + __m128i y0i_five_over_sqrt_21; + __m128i y0i_seven_over_sqrt_21; + __m128i ch_mag_int_with_sigma2; + __m128i two_ch_mag_int_with_sigma2; + __m128i three_ch_mag_int_with_sigma2; +#elif defined(__arm__) + +#endif + + int i,j; + + + for (i=0; i>2; i+=2) { + +#if defined(__x86_64__) || defined(__i386__) + + // Get rho + xmm0 = rho01_128i[i]; + xmm1 = rho01_128i[i+1]; + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + xmm2 = _mm_unpacklo_epi64(xmm0,xmm1); // Re(rho) + xmm3 = _mm_unpackhi_epi64(xmm0,xmm1); // Im(rho) + rho_rpi = _mm_adds_epi16(xmm2,xmm3); // rho = Re(rho) + Im(rho) + rho_rmi = _mm_subs_epi16(xmm2,xmm3); // rho* = Re(rho) - Im(rho) + + // Compute the different rhos + rho_rpi_1_1 = _mm_mulhi_epi16(rho_rpi, ONE_OVER_SQRT_42); + rho_rmi_1_1 = _mm_mulhi_epi16(rho_rmi, ONE_OVER_SQRT_42); + rho_rpi_3_3 = _mm_mulhi_epi16(rho_rpi, THREE_OVER_SQRT_42); + rho_rmi_3_3 = _mm_mulhi_epi16(rho_rmi, THREE_OVER_SQRT_42); + rho_rpi_5_5 = _mm_mulhi_epi16(rho_rpi, FIVE_OVER_SQRT_42); + rho_rmi_5_5 = _mm_mulhi_epi16(rho_rmi, FIVE_OVER_SQRT_42); + rho_rpi_7_7 = _mm_mulhi_epi16(rho_rpi, SEVEN_OVER_SQRT_42); + rho_rmi_7_7 = _mm_mulhi_epi16(rho_rmi, SEVEN_OVER_SQRT_42); + + rho_rpi_5_5 = _mm_slli_epi16(rho_rpi_5_5, 1); + rho_rmi_5_5 = _mm_slli_epi16(rho_rmi_5_5, 1); + rho_rpi_7_7 = _mm_slli_epi16(rho_rpi_7_7, 2); + rho_rmi_7_7 = _mm_slli_epi16(rho_rmi_7_7, 2); + + xmm4 = _mm_mulhi_epi16(xmm2, ONE_OVER_SQRT_42); + xmm5 = _mm_mulhi_epi16(xmm3, ONE_OVER_SQRT_42); + xmm6 = _mm_mulhi_epi16(xmm3, THREE_OVER_SQRT_42); + xmm7 = _mm_mulhi_epi16(xmm3, FIVE_OVER_SQRT_42); + xmm8 = _mm_mulhi_epi16(xmm3, SEVEN_OVER_SQRT_42); + xmm7 = _mm_slli_epi16(xmm7, 1); + xmm8 = _mm_slli_epi16(xmm8, 2); + + rho_rpi_1_3 = _mm_adds_epi16(xmm4, xmm6); + rho_rmi_1_3 = _mm_subs_epi16(xmm4, xmm6); + rho_rpi_1_5 = _mm_adds_epi16(xmm4, xmm7); + rho_rmi_1_5 = _mm_subs_epi16(xmm4, xmm7); + rho_rpi_1_7 = _mm_adds_epi16(xmm4, xmm8); + rho_rmi_1_7 = _mm_subs_epi16(xmm4, xmm8); + + xmm4 = _mm_mulhi_epi16(xmm2, THREE_OVER_SQRT_42); + rho_rpi_3_1 = _mm_adds_epi16(xmm4, xmm5); + rho_rmi_3_1 = _mm_subs_epi16(xmm4, xmm5); + rho_rpi_3_5 = _mm_adds_epi16(xmm4, xmm7); + rho_rmi_3_5 = _mm_subs_epi16(xmm4, xmm7); + rho_rpi_3_7 = _mm_adds_epi16(xmm4, xmm8); + rho_rmi_3_7 = _mm_subs_epi16(xmm4, xmm8); + + xmm4 = _mm_mulhi_epi16(xmm2, FIVE_OVER_SQRT_42); + xmm4 = _mm_slli_epi16(xmm4, 1); + rho_rpi_5_1 = _mm_adds_epi16(xmm4, xmm5); + rho_rmi_5_1 = _mm_subs_epi16(xmm4, xmm5); + rho_rpi_5_3 = _mm_adds_epi16(xmm4, xmm6); + rho_rmi_5_3 = _mm_subs_epi16(xmm4, xmm6); + rho_rpi_5_7 = _mm_adds_epi16(xmm4, xmm8); + rho_rmi_5_7 = _mm_subs_epi16(xmm4, xmm8); + + xmm4 = _mm_mulhi_epi16(xmm2, SEVEN_OVER_SQRT_42); + xmm4 = _mm_slli_epi16(xmm4, 2); + rho_rpi_7_1 = _mm_adds_epi16(xmm4, xmm5); + rho_rmi_7_1 = _mm_subs_epi16(xmm4, xmm5); + rho_rpi_7_3 = _mm_adds_epi16(xmm4, xmm6); + rho_rmi_7_3 = _mm_subs_epi16(xmm4, xmm6); + rho_rpi_7_5 = _mm_adds_epi16(xmm4, xmm7); + rho_rmi_7_5 = _mm_subs_epi16(xmm4, xmm7); + + // Rearrange interfering MF output + xmm0 = stream1_128i_in[i]; + xmm1 = stream1_128i_in[i+1]; + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + y1r = _mm_unpacklo_epi64(xmm0,xmm1); //[y1r(1),y1r(2),y1r(3),y1r(4)] + y1i = _mm_unpackhi_epi64(xmm0,xmm1); //[y1i(1),y1i(2),y1i(3),y1i(4)] + + // Psi_r calculation from rho_rpi or rho_rmi + xmm0 = _mm_setzero_si128(); // ZERO for abs_pi16 + xmm2 = _mm_subs_epi16(rho_rpi_7_7, y1r); + psi_r_p7_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_7_5, y1r); + psi_r_p7_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_7_3, y1r); + psi_r_p7_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_7_1, y1r); + psi_r_p7_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_7_1, y1r); + psi_r_p7_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_7_3, y1r); + psi_r_p7_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_7_5, y1r); + psi_r_p7_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_7_7, y1r); + psi_r_p7_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_7, y1r); + psi_r_p5_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_5, y1r); + psi_r_p5_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_3, y1r); + psi_r_p5_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_1, y1r); + psi_r_p5_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_1, y1r); + psi_r_p5_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_3, y1r); + psi_r_p5_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_5, y1r); + psi_r_p5_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_7, y1r); + psi_r_p5_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_7, y1r); + psi_r_p3_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_5, y1r); + psi_r_p3_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_3, y1r); + psi_r_p3_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_1, y1r); + psi_r_p3_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_1, y1r); + psi_r_p3_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_3, y1r); + psi_r_p3_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_5, y1r); + psi_r_p3_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_7, y1r); + psi_r_p3_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_7, y1r); + psi_r_p1_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_5, y1r); + psi_r_p1_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_3, y1r); + psi_r_p1_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_1, y1r); + psi_r_p1_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_1, y1r); + psi_r_p1_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_3, y1r); + psi_r_p1_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_5, y1r); + psi_r_p1_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_7, y1r); + psi_r_p1_m7 = _mm_abs_epi16(xmm2); + + xmm2 = _mm_adds_epi16(rho_rmi_1_7, y1r); + psi_r_m1_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_1_5, y1r); + psi_r_m1_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_1_3, y1r); + psi_r_m1_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_1_1, y1r); + psi_r_m1_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_1, y1r); + psi_r_m1_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_3, y1r); + psi_r_m1_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_5, y1r); + psi_r_m1_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_7, y1r); + psi_r_m1_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_7, y1r); + psi_r_m3_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_5, y1r); + psi_r_m3_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_3, y1r); + psi_r_m3_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_1, y1r); + psi_r_m3_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_1, y1r); + psi_r_m3_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_3, y1r); + psi_r_m3_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_5, y1r); + psi_r_m3_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_7, y1r); + psi_r_m3_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_7, y1r); + psi_r_m5_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_5, y1r); + psi_r_m5_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_3, y1r); + psi_r_m5_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_1, y1r); + psi_r_m5_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_1, y1r); + psi_r_m5_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_3, y1r); + psi_r_m5_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_5, y1r); + psi_r_m5_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_7, y1r); + psi_r_m5_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_7, y1r); + psi_r_m7_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_5, y1r); + psi_r_m7_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_3, y1r); + psi_r_m7_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_1, y1r); + psi_r_m7_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_1, y1r); + psi_r_m7_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_3, y1r); + psi_r_m7_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_5, y1r); + psi_r_m7_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_7, y1r); + psi_r_m7_m7 = _mm_abs_epi16(xmm2); + + // Psi_i calculation from rho_rpi or rho_rmi + xmm2 = _mm_subs_epi16(rho_rmi_7_7, y1i); + psi_i_p7_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_7, y1i); + psi_i_p7_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_7, y1i); + psi_i_p7_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_7, y1i); + psi_i_p7_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_7, y1i); + psi_i_p7_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_7, y1i); + psi_i_p7_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_7, y1i); + psi_i_p7_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_7, y1i); + psi_i_p7_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_7_5, y1i); + psi_i_p5_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_5, y1i); + psi_i_p5_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_5, y1i); + psi_i_p5_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_5, y1i); + psi_i_p5_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_5, y1i); + psi_i_p5_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_5, y1i); + psi_i_p5_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_5, y1i); + psi_i_p5_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_5, y1i); + psi_i_p5_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_7_3, y1i); + psi_i_p3_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_3, y1i); + psi_i_p3_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_3, y1i); + psi_i_p3_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_3, y1i); + psi_i_p3_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_3, y1i); + psi_i_p3_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_3, y1i); + psi_i_p3_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_3, y1i); + psi_i_p3_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_3, y1i); + psi_i_p3_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_7_1, y1i); + psi_i_p1_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_5_1, y1i); + psi_i_p1_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_3_1, y1i); + psi_i_p1_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rmi_1_1, y1i); + psi_i_p1_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_1_1, y1i); + psi_i_p1_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_3_1, y1i); + psi_i_p1_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_5_1, y1i); + psi_i_p1_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rpi_7_1, y1i); + psi_i_p1_m7 = _mm_abs_epi16(xmm2); + + xmm2 = _mm_subs_epi16(rho_rpi_7_1, y1i); + psi_i_m1_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_1, y1i); + psi_i_m1_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_1, y1i); + psi_i_m1_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_1, y1i); + psi_i_m1_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_1_1, y1i); + psi_i_m1_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_1, y1i); + psi_i_m1_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_1, y1i); + psi_i_m1_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_1, y1i); + psi_i_m1_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_7_3, y1i); + psi_i_m3_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_3, y1i); + psi_i_m3_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_3, y1i); + psi_i_m3_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_3, y1i); + psi_i_m3_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_1_3, y1i); + psi_i_m3_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_3, y1i); + psi_i_m3_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_3, y1i); + psi_i_m3_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_3, y1i); + psi_i_m3_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_7_5, y1i); + psi_i_m5_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_5, y1i); + psi_i_m5_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_5, y1i); + psi_i_m5_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_5, y1i); + psi_i_m5_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_1_5, y1i); + psi_i_m5_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_5, y1i); + psi_i_m5_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_5, y1i); + psi_i_m5_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_5, y1i); + psi_i_m5_m7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_7_7, y1i); + psi_i_m7_p7 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_5_7, y1i); + psi_i_m7_p5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_3_7, y1i); + psi_i_m7_p3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_subs_epi16(rho_rpi_1_7, y1i); + psi_i_m7_p1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_1_7, y1i); + psi_i_m7_m1 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_3_7, y1i); + psi_i_m7_m3 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_5_7, y1i); + psi_i_m7_m5 = _mm_abs_epi16(xmm2); + xmm2 = _mm_adds_epi16(rho_rmi_7_7, y1i); + psi_i_m7_m7 = _mm_abs_epi16(xmm2); + + + // Rearrange desired MF output + xmm0 = stream0_128i_in[i]; + xmm1 = stream0_128i_in[i+1]; + xmm0 = _mm_shufflelo_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shufflehi_epi16(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm0 = _mm_shuffle_epi32(xmm0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflelo_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shufflehi_epi16(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm1 = _mm_shuffle_epi32(xmm1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + //xmm0 = [Re(0,1) Re(2,3) Im(0,1) Im(2,3)] + //xmm1 = [Re(4,5) Re(6,7) Im(4,5) Im(6,7)] + y0r = _mm_unpacklo_epi64(xmm0,xmm1); // = [y0r(1),y0r(2),y0r(3),y0r(4)] + y0i = _mm_unpackhi_epi64(xmm0,xmm1); + + // Rearrange desired channel magnitudes + xmm2 = ch_mag_128i[i]; // = [|h|^2(1),|h|^2(1),|h|^2(2),|h|^2(2)]*(2/sqrt(10)) + xmm3 = ch_mag_128i[i+1]; // = [|h|^2(3),|h|^2(3),|h|^2(4),|h|^2(4)]*(2/sqrt(10)) + xmm2 = _mm_shufflelo_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shufflehi_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shuffle_epi32(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflelo_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflehi_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shuffle_epi32(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + ch_mag_des = _mm_unpacklo_epi64(xmm2,xmm3); + + // Rearrange interfering channel magnitudes + xmm2 = ch_mag_128i_i[i]; + xmm3 = ch_mag_128i_i[i+1]; + xmm2 = _mm_shufflelo_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shufflehi_epi16(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm2 = _mm_shuffle_epi32(xmm2,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflelo_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shufflehi_epi16(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + xmm3 = _mm_shuffle_epi32(xmm3,0xd8); //_MM_SHUFFLE(0,2,1,3)); + ch_mag_int = _mm_unpacklo_epi64(xmm2,xmm3); + + y0r_one_over_sqrt_21 = _mm_mulhi_epi16(y0r, ONE_OVER_SQRT_42); + y0r_three_over_sqrt_21 = _mm_mulhi_epi16(y0r, THREE_OVER_SQRT_42); + y0r_five_over_sqrt_21 = _mm_mulhi_epi16(y0r, FIVE_OVER_SQRT_42); + y0r_five_over_sqrt_21 = _mm_slli_epi16(y0r_five_over_sqrt_21, 1); + y0r_seven_over_sqrt_21 = _mm_mulhi_epi16(y0r, SEVEN_OVER_SQRT_42); + y0r_seven_over_sqrt_21 = _mm_slli_epi16(y0r_seven_over_sqrt_21, 2); // Q2.14 + + y0i_one_over_sqrt_21 = _mm_mulhi_epi16(y0i, ONE_OVER_SQRT_42); + y0i_three_over_sqrt_21 = _mm_mulhi_epi16(y0i, THREE_OVER_SQRT_42); + y0i_five_over_sqrt_21 = _mm_mulhi_epi16(y0i, FIVE_OVER_SQRT_42); + y0i_five_over_sqrt_21 = _mm_slli_epi16(y0i_five_over_sqrt_21, 1); + y0i_seven_over_sqrt_21 = _mm_mulhi_epi16(y0i, SEVEN_OVER_SQRT_42); + y0i_seven_over_sqrt_21 = _mm_slli_epi16(y0i_seven_over_sqrt_21, 2); // Q2.14 + + y0_p_7_1 = _mm_adds_epi16(y0r_seven_over_sqrt_21, y0i_one_over_sqrt_21); + y0_p_7_3 = _mm_adds_epi16(y0r_seven_over_sqrt_21, y0i_three_over_sqrt_21); + y0_p_7_5 = _mm_adds_epi16(y0r_seven_over_sqrt_21, y0i_five_over_sqrt_21); + y0_p_7_7 = _mm_adds_epi16(y0r_seven_over_sqrt_21, y0i_seven_over_sqrt_21); + y0_p_5_1 = _mm_adds_epi16(y0r_five_over_sqrt_21, y0i_one_over_sqrt_21); + y0_p_5_3 = _mm_adds_epi16(y0r_five_over_sqrt_21, y0i_three_over_sqrt_21); + y0_p_5_5 = _mm_adds_epi16(y0r_five_over_sqrt_21, y0i_five_over_sqrt_21); + y0_p_5_7 = _mm_adds_epi16(y0r_five_over_sqrt_21, y0i_seven_over_sqrt_21); + y0_p_3_1 = _mm_adds_epi16(y0r_three_over_sqrt_21, y0i_one_over_sqrt_21); + y0_p_3_3 = _mm_adds_epi16(y0r_three_over_sqrt_21, y0i_three_over_sqrt_21); + y0_p_3_5 = _mm_adds_epi16(y0r_three_over_sqrt_21, y0i_five_over_sqrt_21); + y0_p_3_7 = _mm_adds_epi16(y0r_three_over_sqrt_21, y0i_seven_over_sqrt_21); + y0_p_1_1 = _mm_adds_epi16(y0r_one_over_sqrt_21, y0i_one_over_sqrt_21); + y0_p_1_3 = _mm_adds_epi16(y0r_one_over_sqrt_21, y0i_three_over_sqrt_21); + y0_p_1_5 = _mm_adds_epi16(y0r_one_over_sqrt_21, y0i_five_over_sqrt_21); + y0_p_1_7 = _mm_adds_epi16(y0r_one_over_sqrt_21, y0i_seven_over_sqrt_21); + + y0_m_1_1 = _mm_subs_epi16(y0r_one_over_sqrt_21, y0i_one_over_sqrt_21); + y0_m_1_3 = _mm_subs_epi16(y0r_one_over_sqrt_21, y0i_three_over_sqrt_21); + y0_m_1_5 = _mm_subs_epi16(y0r_one_over_sqrt_21, y0i_five_over_sqrt_21); + y0_m_1_7 = _mm_subs_epi16(y0r_one_over_sqrt_21, y0i_seven_over_sqrt_21); + y0_m_3_1 = _mm_subs_epi16(y0r_three_over_sqrt_21, y0i_one_over_sqrt_21); + y0_m_3_3 = _mm_subs_epi16(y0r_three_over_sqrt_21, y0i_three_over_sqrt_21); + y0_m_3_5 = _mm_subs_epi16(y0r_three_over_sqrt_21, y0i_five_over_sqrt_21); + y0_m_3_7 = _mm_subs_epi16(y0r_three_over_sqrt_21, y0i_seven_over_sqrt_21); + y0_m_5_1 = _mm_subs_epi16(y0r_five_over_sqrt_21, y0i_one_over_sqrt_21); + y0_m_5_3 = _mm_subs_epi16(y0r_five_over_sqrt_21, y0i_three_over_sqrt_21); + y0_m_5_5 = _mm_subs_epi16(y0r_five_over_sqrt_21, y0i_five_over_sqrt_21); + y0_m_5_7 = _mm_subs_epi16(y0r_five_over_sqrt_21, y0i_seven_over_sqrt_21); + y0_m_7_1 = _mm_subs_epi16(y0r_seven_over_sqrt_21, y0i_one_over_sqrt_21); + y0_m_7_3 = _mm_subs_epi16(y0r_seven_over_sqrt_21, y0i_three_over_sqrt_21); + y0_m_7_5 = _mm_subs_epi16(y0r_seven_over_sqrt_21, y0i_five_over_sqrt_21); + y0_m_7_7 = _mm_subs_epi16(y0r_seven_over_sqrt_21, y0i_seven_over_sqrt_21); + + // Detection of interference term + ch_mag_int_with_sigma2 = _mm_srai_epi16(ch_mag_int, 1); // *2 + two_ch_mag_int_with_sigma2 = ch_mag_int; // *4 + three_ch_mag_int_with_sigma2 = _mm_adds_epi16(ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2); // *6 + + interference_abs_64qam_epi16(psi_r_p7_p7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p7_p7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p7_p5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p7_p5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p7_p3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p7_p3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p7_p1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p7_p1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p7_m1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p7_m1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p7_m3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p7_m3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p7_m5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p7_m5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p7_m7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p7_m7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p5_p7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p5_p7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p5_p5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p5_p5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p5_p3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p5_p3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p5_p1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p5_p1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p5_m1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p5_m1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p5_m3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p5_m3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p5_m5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p5_m5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p5_m7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p5_m7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p3_p7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p3_p7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p3_p5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p3_p5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p3_p3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p3_p3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p3_p1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p3_p1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p3_m1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p3_m1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p3_m3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p3_m3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p3_m5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p3_m5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p3_m7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p3_m7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p1_p7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p1_p7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p1_p5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p1_p5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p1_p3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p1_p3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p1_p1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p1_p1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p1_m1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p1_m1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p1_m3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p1_m3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p1_m5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p1_m5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_p1_m7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_p1_m7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m1_p7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m1_p7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m1_p5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m1_p5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m1_p3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m1_p3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m1_p1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m1_p1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m1_m1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m1_m1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m1_m3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m1_m3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m1_m5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m1_m5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m1_m7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m1_m7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m3_p7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m3_p7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m3_p5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m3_p5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m3_p3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m3_p3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m3_p1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m3_p1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m3_m1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m3_m1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m3_m3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m3_m3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m3_m5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m3_m5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m3_m7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m3_m7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m5_p7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m5_p7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m5_p5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m5_p5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m5_p3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m5_p3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m5_p1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m5_p1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m5_m1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m5_m1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m5_m3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m5_m3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m5_m5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m5_m5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m5_m7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m5_m7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m7_p7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m7_p7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m7_p5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m7_p5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m7_p3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m7_p3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m7_p1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m7_p1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m7_m1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m7_m1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m7_m3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m7_m3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m7_m5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m7_m5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_r_m7_m7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_r_m7_m7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + + interference_abs_64qam_epi16(psi_i_p7_p7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p7_p7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p7_p5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p7_p5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p7_p3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p7_p3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p7_p1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p7_p1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p7_m1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p7_m1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p7_m3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p7_m3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p7_m5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p7_m5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p7_m7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p7_m7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p5_p7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p5_p7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p5_p5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p5_p5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p5_p3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p5_p3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p5_p1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p5_p1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p5_m1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p5_m1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p5_m3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p5_m3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p5_m5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p5_m5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p5_m7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p5_m7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p3_p7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p3_p7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p3_p5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p3_p5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p3_p3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p3_p3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p3_p1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p3_p1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p3_m1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p3_m1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p3_m3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p3_m3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p3_m5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p3_m5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p3_m7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p3_m7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p1_p7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p1_p7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p1_p5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p1_p5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p1_p3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p1_p3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p1_p1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p1_p1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p1_m1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p1_m1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p1_m3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p1_m3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p1_m5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p1_m5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_p1_m7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_p1_m7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m1_p7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m1_p7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m1_p5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m1_p5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m1_p3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m1_p3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m1_p1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m1_p1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m1_m1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m1_m1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m1_m3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m1_m3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m1_m5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m1_m5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m1_m7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m1_m7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m3_p7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m3_p7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m3_p5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m3_p5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m3_p3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m3_p3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m3_p1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m3_p1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m3_m1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m3_m1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m3_m3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m3_m3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m3_m5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m3_m5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m3_m7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m3_m7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m5_p7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m5_p7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m5_p5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m5_p5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m5_p3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m5_p3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m5_p1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m5_p1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m5_m1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m5_m1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m5_m3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m5_m3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m5_m5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m5_m5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m5_m7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m5_m7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m7_p7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m7_p7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m7_p5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m7_p5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m7_p3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m7_p3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m7_p1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m7_p1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m7_m1, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m7_m1, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m7_m3, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m7_m3, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m7_m5, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m7_m5, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + interference_abs_64qam_epi16(psi_i_m7_m7, ch_mag_int_with_sigma2, two_ch_mag_int_with_sigma2, three_ch_mag_int_with_sigma2, a_i_m7_m7, ONE_OVER_SQRT_2_42, THREE_OVER_SQRT_2_42, FIVE_OVER_SQRT_2_42, + SEVEN_OVER_SQRT_2_42); + + // Calculation of a group of two terms in the bit metric involving product of psi and interference + prodsum_psi_a_epi16(psi_r_p7_p7, a_r_p7_p7, psi_i_p7_p7, a_i_p7_p7, psi_a_p7_p7); + prodsum_psi_a_epi16(psi_r_p7_p5, a_r_p7_p5, psi_i_p7_p5, a_i_p7_p5, psi_a_p7_p5); + prodsum_psi_a_epi16(psi_r_p7_p3, a_r_p7_p3, psi_i_p7_p3, a_i_p7_p3, psi_a_p7_p3); + prodsum_psi_a_epi16(psi_r_p7_p1, a_r_p7_p1, psi_i_p7_p1, a_i_p7_p1, psi_a_p7_p1); + prodsum_psi_a_epi16(psi_r_p7_m1, a_r_p7_m1, psi_i_p7_m1, a_i_p7_m1, psi_a_p7_m1); + prodsum_psi_a_epi16(psi_r_p7_m3, a_r_p7_m3, psi_i_p7_m3, a_i_p7_m3, psi_a_p7_m3); + prodsum_psi_a_epi16(psi_r_p7_m5, a_r_p7_m5, psi_i_p7_m5, a_i_p7_m5, psi_a_p7_m5); + prodsum_psi_a_epi16(psi_r_p7_m7, a_r_p7_m7, psi_i_p7_m7, a_i_p7_m7, psi_a_p7_m7); + prodsum_psi_a_epi16(psi_r_p5_p7, a_r_p5_p7, psi_i_p5_p7, a_i_p5_p7, psi_a_p5_p7); + prodsum_psi_a_epi16(psi_r_p5_p5, a_r_p5_p5, psi_i_p5_p5, a_i_p5_p5, psi_a_p5_p5); + prodsum_psi_a_epi16(psi_r_p5_p3, a_r_p5_p3, psi_i_p5_p3, a_i_p5_p3, psi_a_p5_p3); + prodsum_psi_a_epi16(psi_r_p5_p1, a_r_p5_p1, psi_i_p5_p1, a_i_p5_p1, psi_a_p5_p1); + prodsum_psi_a_epi16(psi_r_p5_m1, a_r_p5_m1, psi_i_p5_m1, a_i_p5_m1, psi_a_p5_m1); + prodsum_psi_a_epi16(psi_r_p5_m3, a_r_p5_m3, psi_i_p5_m3, a_i_p5_m3, psi_a_p5_m3); + prodsum_psi_a_epi16(psi_r_p5_m5, a_r_p5_m5, psi_i_p5_m5, a_i_p5_m5, psi_a_p5_m5); + prodsum_psi_a_epi16(psi_r_p5_m7, a_r_p5_m7, psi_i_p5_m7, a_i_p5_m7, psi_a_p5_m7); + prodsum_psi_a_epi16(psi_r_p3_p7, a_r_p3_p7, psi_i_p3_p7, a_i_p3_p7, psi_a_p3_p7); + prodsum_psi_a_epi16(psi_r_p3_p5, a_r_p3_p5, psi_i_p3_p5, a_i_p3_p5, psi_a_p3_p5); + prodsum_psi_a_epi16(psi_r_p3_p3, a_r_p3_p3, psi_i_p3_p3, a_i_p3_p3, psi_a_p3_p3); + prodsum_psi_a_epi16(psi_r_p3_p1, a_r_p3_p1, psi_i_p3_p1, a_i_p3_p1, psi_a_p3_p1); + prodsum_psi_a_epi16(psi_r_p3_m1, a_r_p3_m1, psi_i_p3_m1, a_i_p3_m1, psi_a_p3_m1); + prodsum_psi_a_epi16(psi_r_p3_m3, a_r_p3_m3, psi_i_p3_m3, a_i_p3_m3, psi_a_p3_m3); + prodsum_psi_a_epi16(psi_r_p3_m5, a_r_p3_m5, psi_i_p3_m5, a_i_p3_m5, psi_a_p3_m5); + prodsum_psi_a_epi16(psi_r_p3_m7, a_r_p3_m7, psi_i_p3_m7, a_i_p3_m7, psi_a_p3_m7); + prodsum_psi_a_epi16(psi_r_p1_p7, a_r_p1_p7, psi_i_p1_p7, a_i_p1_p7, psi_a_p1_p7); + prodsum_psi_a_epi16(psi_r_p1_p5, a_r_p1_p5, psi_i_p1_p5, a_i_p1_p5, psi_a_p1_p5); + prodsum_psi_a_epi16(psi_r_p1_p3, a_r_p1_p3, psi_i_p1_p3, a_i_p1_p3, psi_a_p1_p3); + prodsum_psi_a_epi16(psi_r_p1_p1, a_r_p1_p1, psi_i_p1_p1, a_i_p1_p1, psi_a_p1_p1); + prodsum_psi_a_epi16(psi_r_p1_m1, a_r_p1_m1, psi_i_p1_m1, a_i_p1_m1, psi_a_p1_m1); + prodsum_psi_a_epi16(psi_r_p1_m3, a_r_p1_m3, psi_i_p1_m3, a_i_p1_m3, psi_a_p1_m3); + prodsum_psi_a_epi16(psi_r_p1_m5, a_r_p1_m5, psi_i_p1_m5, a_i_p1_m5, psi_a_p1_m5); + prodsum_psi_a_epi16(psi_r_p1_m7, a_r_p1_m7, psi_i_p1_m7, a_i_p1_m7, psi_a_p1_m7); + prodsum_psi_a_epi16(psi_r_m1_p7, a_r_m1_p7, psi_i_m1_p7, a_i_m1_p7, psi_a_m1_p7); + prodsum_psi_a_epi16(psi_r_m1_p5, a_r_m1_p5, psi_i_m1_p5, a_i_m1_p5, psi_a_m1_p5); + prodsum_psi_a_epi16(psi_r_m1_p3, a_r_m1_p3, psi_i_m1_p3, a_i_m1_p3, psi_a_m1_p3); + prodsum_psi_a_epi16(psi_r_m1_p1, a_r_m1_p1, psi_i_m1_p1, a_i_m1_p1, psi_a_m1_p1); + prodsum_psi_a_epi16(psi_r_m1_m1, a_r_m1_m1, psi_i_m1_m1, a_i_m1_m1, psi_a_m1_m1); + prodsum_psi_a_epi16(psi_r_m1_m3, a_r_m1_m3, psi_i_m1_m3, a_i_m1_m3, psi_a_m1_m3); + prodsum_psi_a_epi16(psi_r_m1_m5, a_r_m1_m5, psi_i_m1_m5, a_i_m1_m5, psi_a_m1_m5); + prodsum_psi_a_epi16(psi_r_m1_m7, a_r_m1_m7, psi_i_m1_m7, a_i_m1_m7, psi_a_m1_m7); + prodsum_psi_a_epi16(psi_r_m3_p7, a_r_m3_p7, psi_i_m3_p7, a_i_m3_p7, psi_a_m3_p7); + prodsum_psi_a_epi16(psi_r_m3_p5, a_r_m3_p5, psi_i_m3_p5, a_i_m3_p5, psi_a_m3_p5); + prodsum_psi_a_epi16(psi_r_m3_p3, a_r_m3_p3, psi_i_m3_p3, a_i_m3_p3, psi_a_m3_p3); + prodsum_psi_a_epi16(psi_r_m3_p1, a_r_m3_p1, psi_i_m3_p1, a_i_m3_p1, psi_a_m3_p1); + prodsum_psi_a_epi16(psi_r_m3_m1, a_r_m3_m1, psi_i_m3_m1, a_i_m3_m1, psi_a_m3_m1); + prodsum_psi_a_epi16(psi_r_m3_m3, a_r_m3_m3, psi_i_m3_m3, a_i_m3_m3, psi_a_m3_m3); + prodsum_psi_a_epi16(psi_r_m3_m5, a_r_m3_m5, psi_i_m3_m5, a_i_m3_m5, psi_a_m3_m5); + prodsum_psi_a_epi16(psi_r_m3_m7, a_r_m3_m7, psi_i_m3_m7, a_i_m3_m7, psi_a_m3_m7); + prodsum_psi_a_epi16(psi_r_m5_p7, a_r_m5_p7, psi_i_m5_p7, a_i_m5_p7, psi_a_m5_p7); + prodsum_psi_a_epi16(psi_r_m5_p5, a_r_m5_p5, psi_i_m5_p5, a_i_m5_p5, psi_a_m5_p5); + prodsum_psi_a_epi16(psi_r_m5_p3, a_r_m5_p3, psi_i_m5_p3, a_i_m5_p3, psi_a_m5_p3); + prodsum_psi_a_epi16(psi_r_m5_p1, a_r_m5_p1, psi_i_m5_p1, a_i_m5_p1, psi_a_m5_p1); + prodsum_psi_a_epi16(psi_r_m5_m1, a_r_m5_m1, psi_i_m5_m1, a_i_m5_m1, psi_a_m5_m1); + prodsum_psi_a_epi16(psi_r_m5_m3, a_r_m5_m3, psi_i_m5_m3, a_i_m5_m3, psi_a_m5_m3); + prodsum_psi_a_epi16(psi_r_m5_m5, a_r_m5_m5, psi_i_m5_m5, a_i_m5_m5, psi_a_m5_m5); + prodsum_psi_a_epi16(psi_r_m5_m7, a_r_m5_m7, psi_i_m5_m7, a_i_m5_m7, psi_a_m5_m7); + prodsum_psi_a_epi16(psi_r_m7_p7, a_r_m7_p7, psi_i_m7_p7, a_i_m7_p7, psi_a_m7_p7); + prodsum_psi_a_epi16(psi_r_m7_p5, a_r_m7_p5, psi_i_m7_p5, a_i_m7_p5, psi_a_m7_p5); + prodsum_psi_a_epi16(psi_r_m7_p3, a_r_m7_p3, psi_i_m7_p3, a_i_m7_p3, psi_a_m7_p3); + prodsum_psi_a_epi16(psi_r_m7_p1, a_r_m7_p1, psi_i_m7_p1, a_i_m7_p1, psi_a_m7_p1); + prodsum_psi_a_epi16(psi_r_m7_m1, a_r_m7_m1, psi_i_m7_m1, a_i_m7_m1, psi_a_m7_m1); + prodsum_psi_a_epi16(psi_r_m7_m3, a_r_m7_m3, psi_i_m7_m3, a_i_m7_m3, psi_a_m7_m3); + prodsum_psi_a_epi16(psi_r_m7_m5, a_r_m7_m5, psi_i_m7_m5, a_i_m7_m5, psi_a_m7_m5); + prodsum_psi_a_epi16(psi_r_m7_m7, a_r_m7_m7, psi_i_m7_m7, a_i_m7_m7, psi_a_m7_m7); + + // Multiply by sqrt(2) + psi_a_p7_p7 = _mm_mulhi_epi16(psi_a_p7_p7, ONE_OVER_SQRT_2); + psi_a_p7_p7 = _mm_slli_epi16(psi_a_p7_p7, 2); + psi_a_p7_p5 = _mm_mulhi_epi16(psi_a_p7_p5, ONE_OVER_SQRT_2); + psi_a_p7_p5 = _mm_slli_epi16(psi_a_p7_p5, 2); + psi_a_p7_p3 = _mm_mulhi_epi16(psi_a_p7_p3, ONE_OVER_SQRT_2); + psi_a_p7_p3 = _mm_slli_epi16(psi_a_p7_p3, 2); + psi_a_p7_p1 = _mm_mulhi_epi16(psi_a_p7_p1, ONE_OVER_SQRT_2); + psi_a_p7_p1 = _mm_slli_epi16(psi_a_p7_p1, 2); + psi_a_p7_m1 = _mm_mulhi_epi16(psi_a_p7_m1, ONE_OVER_SQRT_2); + psi_a_p7_m1 = _mm_slli_epi16(psi_a_p7_m1, 2); + psi_a_p7_m3 = _mm_mulhi_epi16(psi_a_p7_m3, ONE_OVER_SQRT_2); + psi_a_p7_m3 = _mm_slli_epi16(psi_a_p7_m3, 2); + psi_a_p7_m5 = _mm_mulhi_epi16(psi_a_p7_m5, ONE_OVER_SQRT_2); + psi_a_p7_m5 = _mm_slli_epi16(psi_a_p7_m5, 2); + psi_a_p7_m7 = _mm_mulhi_epi16(psi_a_p7_m7, ONE_OVER_SQRT_2); + psi_a_p7_m7 = _mm_slli_epi16(psi_a_p7_m7, 2); + psi_a_p5_p7 = _mm_mulhi_epi16(psi_a_p5_p7, ONE_OVER_SQRT_2); + psi_a_p5_p7 = _mm_slli_epi16(psi_a_p5_p7, 2); + psi_a_p5_p5 = _mm_mulhi_epi16(psi_a_p5_p5, ONE_OVER_SQRT_2); + psi_a_p5_p5 = _mm_slli_epi16(psi_a_p5_p5, 2); + psi_a_p5_p3 = _mm_mulhi_epi16(psi_a_p5_p3, ONE_OVER_SQRT_2); + psi_a_p5_p3 = _mm_slli_epi16(psi_a_p5_p3, 2); + psi_a_p5_p1 = _mm_mulhi_epi16(psi_a_p5_p1, ONE_OVER_SQRT_2); + psi_a_p5_p1 = _mm_slli_epi16(psi_a_p5_p1, 2); + psi_a_p5_m1 = _mm_mulhi_epi16(psi_a_p5_m1, ONE_OVER_SQRT_2); + psi_a_p5_m1 = _mm_slli_epi16(psi_a_p5_m1, 2); + psi_a_p5_m3 = _mm_mulhi_epi16(psi_a_p5_m3, ONE_OVER_SQRT_2); + psi_a_p5_m3 = _mm_slli_epi16(psi_a_p5_m3, 2); + psi_a_p5_m5 = _mm_mulhi_epi16(psi_a_p5_m5, ONE_OVER_SQRT_2); + psi_a_p5_m5 = _mm_slli_epi16(psi_a_p5_m5, 2); + psi_a_p5_m7 = _mm_mulhi_epi16(psi_a_p5_m7, ONE_OVER_SQRT_2); + psi_a_p5_m7 = _mm_slli_epi16(psi_a_p5_m7, 2); + psi_a_p3_p7 = _mm_mulhi_epi16(psi_a_p3_p7, ONE_OVER_SQRT_2); + psi_a_p3_p7 = _mm_slli_epi16(psi_a_p3_p7, 2); + psi_a_p3_p5 = _mm_mulhi_epi16(psi_a_p3_p5, ONE_OVER_SQRT_2); + psi_a_p3_p5 = _mm_slli_epi16(psi_a_p3_p5, 2); + psi_a_p3_p3 = _mm_mulhi_epi16(psi_a_p3_p3, ONE_OVER_SQRT_2); + psi_a_p3_p3 = _mm_slli_epi16(psi_a_p3_p3, 2); + psi_a_p3_p1 = _mm_mulhi_epi16(psi_a_p3_p1, ONE_OVER_SQRT_2); + psi_a_p3_p1 = _mm_slli_epi16(psi_a_p3_p1, 2); + psi_a_p3_m1 = _mm_mulhi_epi16(psi_a_p3_m1, ONE_OVER_SQRT_2); + psi_a_p3_m1 = _mm_slli_epi16(psi_a_p3_m1, 2); + psi_a_p3_m3 = _mm_mulhi_epi16(psi_a_p3_m3, ONE_OVER_SQRT_2); + psi_a_p3_m3 = _mm_slli_epi16(psi_a_p3_m3, 2); + psi_a_p3_m5 = _mm_mulhi_epi16(psi_a_p3_m5, ONE_OVER_SQRT_2); + psi_a_p3_m5 = _mm_slli_epi16(psi_a_p3_m5, 2); + psi_a_p3_m7 = _mm_mulhi_epi16(psi_a_p3_m7, ONE_OVER_SQRT_2); + psi_a_p3_m7 = _mm_slli_epi16(psi_a_p3_m7, 2); + psi_a_p1_p7 = _mm_mulhi_epi16(psi_a_p1_p7, ONE_OVER_SQRT_2); + psi_a_p1_p7 = _mm_slli_epi16(psi_a_p1_p7, 2); + psi_a_p1_p5 = _mm_mulhi_epi16(psi_a_p1_p5, ONE_OVER_SQRT_2); + psi_a_p1_p5 = _mm_slli_epi16(psi_a_p1_p5, 2); + psi_a_p1_p3 = _mm_mulhi_epi16(psi_a_p1_p3, ONE_OVER_SQRT_2); + psi_a_p1_p3 = _mm_slli_epi16(psi_a_p1_p3, 2); + psi_a_p1_p1 = _mm_mulhi_epi16(psi_a_p1_p1, ONE_OVER_SQRT_2); + psi_a_p1_p1 = _mm_slli_epi16(psi_a_p1_p1, 2); + psi_a_p1_m1 = _mm_mulhi_epi16(psi_a_p1_m1, ONE_OVER_SQRT_2); + psi_a_p1_m1 = _mm_slli_epi16(psi_a_p1_m1, 2); + psi_a_p1_m3 = _mm_mulhi_epi16(psi_a_p1_m3, ONE_OVER_SQRT_2); + psi_a_p1_m3 = _mm_slli_epi16(psi_a_p1_m3, 2); + psi_a_p1_m5 = _mm_mulhi_epi16(psi_a_p1_m5, ONE_OVER_SQRT_2); + psi_a_p1_m5 = _mm_slli_epi16(psi_a_p1_m5, 2); + psi_a_p1_m7 = _mm_mulhi_epi16(psi_a_p1_m7, ONE_OVER_SQRT_2); + psi_a_p1_m7 = _mm_slli_epi16(psi_a_p1_m7, 2); + psi_a_m1_p7 = _mm_mulhi_epi16(psi_a_m1_p7, ONE_OVER_SQRT_2); + psi_a_m1_p7 = _mm_slli_epi16(psi_a_m1_p7, 2); + psi_a_m1_p5 = _mm_mulhi_epi16(psi_a_m1_p5, ONE_OVER_SQRT_2); + psi_a_m1_p5 = _mm_slli_epi16(psi_a_m1_p5, 2); + psi_a_m1_p3 = _mm_mulhi_epi16(psi_a_m1_p3, ONE_OVER_SQRT_2); + psi_a_m1_p3 = _mm_slli_epi16(psi_a_m1_p3, 2); + psi_a_m1_p1 = _mm_mulhi_epi16(psi_a_m1_p1, ONE_OVER_SQRT_2); + psi_a_m1_p1 = _mm_slli_epi16(psi_a_m1_p1, 2); + psi_a_m1_m1 = _mm_mulhi_epi16(psi_a_m1_m1, ONE_OVER_SQRT_2); + psi_a_m1_m1 = _mm_slli_epi16(psi_a_m1_m1, 2); + psi_a_m1_m3 = _mm_mulhi_epi16(psi_a_m1_m3, ONE_OVER_SQRT_2); + psi_a_m1_m3 = _mm_slli_epi16(psi_a_m1_m3, 2); + psi_a_m1_m5 = _mm_mulhi_epi16(psi_a_m1_m5, ONE_OVER_SQRT_2); + psi_a_m1_m5 = _mm_slli_epi16(psi_a_m1_m5, 2); + psi_a_m1_m7 = _mm_mulhi_epi16(psi_a_m1_m7, ONE_OVER_SQRT_2); + psi_a_m1_m7 = _mm_slli_epi16(psi_a_m1_m7, 2); + psi_a_m3_p7 = _mm_mulhi_epi16(psi_a_m3_p7, ONE_OVER_SQRT_2); + psi_a_m3_p7 = _mm_slli_epi16(psi_a_m3_p7, 2); + psi_a_m3_p5 = _mm_mulhi_epi16(psi_a_m3_p5, ONE_OVER_SQRT_2); + psi_a_m3_p5 = _mm_slli_epi16(psi_a_m3_p5, 2); + psi_a_m3_p3 = _mm_mulhi_epi16(psi_a_m3_p3, ONE_OVER_SQRT_2); + psi_a_m3_p3 = _mm_slli_epi16(psi_a_m3_p3, 2); + psi_a_m3_p1 = _mm_mulhi_epi16(psi_a_m3_p1, ONE_OVER_SQRT_2); + psi_a_m3_p1 = _mm_slli_epi16(psi_a_m3_p1, 2); + psi_a_m3_m1 = _mm_mulhi_epi16(psi_a_m3_m1, ONE_OVER_SQRT_2); + psi_a_m3_m1 = _mm_slli_epi16(psi_a_m3_m1, 2); + psi_a_m3_m3 = _mm_mulhi_epi16(psi_a_m3_m3, ONE_OVER_SQRT_2); + psi_a_m3_m3 = _mm_slli_epi16(psi_a_m3_m3, 2); + psi_a_m3_m5 = _mm_mulhi_epi16(psi_a_m3_m5, ONE_OVER_SQRT_2); + psi_a_m3_m5 = _mm_slli_epi16(psi_a_m3_m5, 2); + psi_a_m3_m7 = _mm_mulhi_epi16(psi_a_m3_m7, ONE_OVER_SQRT_2); + psi_a_m3_m7 = _mm_slli_epi16(psi_a_m3_m7, 2); + psi_a_m5_p7 = _mm_mulhi_epi16(psi_a_m5_p7, ONE_OVER_SQRT_2); + psi_a_m5_p7 = _mm_slli_epi16(psi_a_m5_p7, 2); + psi_a_m5_p5 = _mm_mulhi_epi16(psi_a_m5_p5, ONE_OVER_SQRT_2); + psi_a_m5_p5 = _mm_slli_epi16(psi_a_m5_p5, 2); + psi_a_m5_p3 = _mm_mulhi_epi16(psi_a_m5_p3, ONE_OVER_SQRT_2); + psi_a_m5_p3 = _mm_slli_epi16(psi_a_m5_p3, 2); + psi_a_m5_p1 = _mm_mulhi_epi16(psi_a_m5_p1, ONE_OVER_SQRT_2); + psi_a_m5_p1 = _mm_slli_epi16(psi_a_m5_p1, 2); + psi_a_m5_m1 = _mm_mulhi_epi16(psi_a_m5_m1, ONE_OVER_SQRT_2); + psi_a_m5_m1 = _mm_slli_epi16(psi_a_m5_m1, 2); + psi_a_m5_m3 = _mm_mulhi_epi16(psi_a_m5_m3, ONE_OVER_SQRT_2); + psi_a_m5_m3 = _mm_slli_epi16(psi_a_m5_m3, 2); + psi_a_m5_m5 = _mm_mulhi_epi16(psi_a_m5_m5, ONE_OVER_SQRT_2); + psi_a_m5_m5 = _mm_slli_epi16(psi_a_m5_m5, 2); + psi_a_m5_m7 = _mm_mulhi_epi16(psi_a_m5_m7, ONE_OVER_SQRT_2); + psi_a_m5_m7 = _mm_slli_epi16(psi_a_m5_m7, 2); + psi_a_m7_p7 = _mm_mulhi_epi16(psi_a_m7_p7, ONE_OVER_SQRT_2); + psi_a_m7_p7 = _mm_slli_epi16(psi_a_m7_p7, 2); + psi_a_m7_p5 = _mm_mulhi_epi16(psi_a_m7_p5, ONE_OVER_SQRT_2); + psi_a_m7_p5 = _mm_slli_epi16(psi_a_m7_p5, 2); + psi_a_m7_p3 = _mm_mulhi_epi16(psi_a_m7_p3, ONE_OVER_SQRT_2); + psi_a_m7_p3 = _mm_slli_epi16(psi_a_m7_p3, 2); + psi_a_m7_p1 = _mm_mulhi_epi16(psi_a_m7_p1, ONE_OVER_SQRT_2); + psi_a_m7_p1 = _mm_slli_epi16(psi_a_m7_p1, 2); + psi_a_m7_m1 = _mm_mulhi_epi16(psi_a_m7_m1, ONE_OVER_SQRT_2); + psi_a_m7_m1 = _mm_slli_epi16(psi_a_m7_m1, 2); + psi_a_m7_m3 = _mm_mulhi_epi16(psi_a_m7_m3, ONE_OVER_SQRT_2); + psi_a_m7_m3 = _mm_slli_epi16(psi_a_m7_m3, 2); + psi_a_m7_m5 = _mm_mulhi_epi16(psi_a_m7_m5, ONE_OVER_SQRT_2); + psi_a_m7_m5 = _mm_slli_epi16(psi_a_m7_m5, 2); + psi_a_m7_m7 = _mm_mulhi_epi16(psi_a_m7_m7, ONE_OVER_SQRT_2); + psi_a_m7_m7 = _mm_slli_epi16(psi_a_m7_m7, 2); + + // Calculation of a group of two terms in the bit metric involving squares of interference + square_a_64qam_epi16(a_r_p7_p7, a_i_p7_p7, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p7_p7); + square_a_64qam_epi16(a_r_p7_p5, a_i_p7_p5, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p7_p5); + square_a_64qam_epi16(a_r_p7_p3, a_i_p7_p3, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p7_p3); + square_a_64qam_epi16(a_r_p7_p1, a_i_p7_p1, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p7_p1); + square_a_64qam_epi16(a_r_p7_m1, a_i_p7_m1, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p7_m1); + square_a_64qam_epi16(a_r_p7_m3, a_i_p7_m3, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p7_m3); + square_a_64qam_epi16(a_r_p7_m5, a_i_p7_m5, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p7_m5); + square_a_64qam_epi16(a_r_p7_m7, a_i_p7_m7, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p7_m7); + square_a_64qam_epi16(a_r_p5_p7, a_i_p5_p7, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p5_p7); + square_a_64qam_epi16(a_r_p5_p5, a_i_p5_p5, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p5_p5); + square_a_64qam_epi16(a_r_p5_p3, a_i_p5_p3, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p5_p3); + square_a_64qam_epi16(a_r_p5_p1, a_i_p5_p1, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p5_p1); + square_a_64qam_epi16(a_r_p5_m1, a_i_p5_m1, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p5_m1); + square_a_64qam_epi16(a_r_p5_m3, a_i_p5_m3, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p5_m3); + square_a_64qam_epi16(a_r_p5_m5, a_i_p5_m5, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p5_m5); + square_a_64qam_epi16(a_r_p5_m7, a_i_p5_m7, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p5_m7); + square_a_64qam_epi16(a_r_p3_p7, a_i_p3_p7, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p3_p7); + square_a_64qam_epi16(a_r_p3_p5, a_i_p3_p5, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p3_p5); + square_a_64qam_epi16(a_r_p3_p3, a_i_p3_p3, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p3_p3); + square_a_64qam_epi16(a_r_p3_p1, a_i_p3_p1, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p3_p1); + square_a_64qam_epi16(a_r_p3_m1, a_i_p3_m1, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p3_m1); + square_a_64qam_epi16(a_r_p3_m3, a_i_p3_m3, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p3_m3); + square_a_64qam_epi16(a_r_p3_m5, a_i_p3_m5, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p3_m5); + square_a_64qam_epi16(a_r_p3_m7, a_i_p3_m7, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p3_m7); + square_a_64qam_epi16(a_r_p1_p7, a_i_p1_p7, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p1_p7); + square_a_64qam_epi16(a_r_p1_p5, a_i_p1_p5, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p1_p5); + square_a_64qam_epi16(a_r_p1_p3, a_i_p1_p3, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p1_p3); + square_a_64qam_epi16(a_r_p1_p1, a_i_p1_p1, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p1_p1); + square_a_64qam_epi16(a_r_p1_m1, a_i_p1_m1, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p1_m1); + square_a_64qam_epi16(a_r_p1_m3, a_i_p1_m3, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p1_m3); + square_a_64qam_epi16(a_r_p1_m5, a_i_p1_m5, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p1_m5); + square_a_64qam_epi16(a_r_p1_m7, a_i_p1_m7, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_p1_m7); + square_a_64qam_epi16(a_r_m1_p7, a_i_m1_p7, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m1_p7); + square_a_64qam_epi16(a_r_m1_p5, a_i_m1_p5, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m1_p5); + square_a_64qam_epi16(a_r_m1_p3, a_i_m1_p3, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m1_p3); + square_a_64qam_epi16(a_r_m1_p1, a_i_m1_p1, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m1_p1); + square_a_64qam_epi16(a_r_m1_m1, a_i_m1_m1, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m1_m1); + square_a_64qam_epi16(a_r_m1_m3, a_i_m1_m3, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m1_m3); + square_a_64qam_epi16(a_r_m1_m5, a_i_m1_m5, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m1_m5); + square_a_64qam_epi16(a_r_m1_m7, a_i_m1_m7, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m1_m7); + square_a_64qam_epi16(a_r_m3_p7, a_i_m3_p7, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m3_p7); + square_a_64qam_epi16(a_r_m3_p5, a_i_m3_p5, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m3_p5); + square_a_64qam_epi16(a_r_m3_p3, a_i_m3_p3, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m3_p3); + square_a_64qam_epi16(a_r_m3_p1, a_i_m3_p1, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m3_p1); + square_a_64qam_epi16(a_r_m3_m1, a_i_m3_m1, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m3_m1); + square_a_64qam_epi16(a_r_m3_m3, a_i_m3_m3, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m3_m3); + square_a_64qam_epi16(a_r_m3_m5, a_i_m3_m5, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m3_m5); + square_a_64qam_epi16(a_r_m3_m7, a_i_m3_m7, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m3_m7); + square_a_64qam_epi16(a_r_m5_p7, a_i_m5_p7, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m5_p7); + square_a_64qam_epi16(a_r_m5_p5, a_i_m5_p5, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m5_p5); + square_a_64qam_epi16(a_r_m5_p3, a_i_m5_p3, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m5_p3); + square_a_64qam_epi16(a_r_m5_p1, a_i_m5_p1, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m5_p1); + square_a_64qam_epi16(a_r_m5_m1, a_i_m5_m1, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m5_m1); + square_a_64qam_epi16(a_r_m5_m3, a_i_m5_m3, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m5_m3); + square_a_64qam_epi16(a_r_m5_m5, a_i_m5_m5, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m5_m5); + square_a_64qam_epi16(a_r_m5_m7, a_i_m5_m7, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m5_m7); + square_a_64qam_epi16(a_r_m7_p7, a_i_m7_p7, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m7_p7); + square_a_64qam_epi16(a_r_m7_p5, a_i_m7_p5, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m7_p5); + square_a_64qam_epi16(a_r_m7_p3, a_i_m7_p3, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m7_p3); + square_a_64qam_epi16(a_r_m7_p1, a_i_m7_p1, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m7_p1); + square_a_64qam_epi16(a_r_m7_m1, a_i_m7_m1, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m7_m1); + square_a_64qam_epi16(a_r_m7_m3, a_i_m7_m3, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m7_m3); + square_a_64qam_epi16(a_r_m7_m5, a_i_m7_m5, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m7_m5); + square_a_64qam_epi16(a_r_m7_m7, a_i_m7_m7, ch_mag_int, SQRT_42_OVER_FOUR, a_sq_m7_m7); + + // Computing different multiples of ||h0||^2 + // x=1, y=1 + ch_mag_2_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,ONE_OVER_FOUR_SQRT_42); + ch_mag_2_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_2_over_42_with_sigma2,1); + // x=1, y=3 + ch_mag_10_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,FIVE_OVER_FOUR_SQRT_42); + ch_mag_10_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_10_over_42_with_sigma2,1); + // x=1, x=5 + ch_mag_26_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,THIRTEEN_OVER_FOUR_SQRT_42); + ch_mag_26_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_26_over_42_with_sigma2,1); + // x=1, y=7 + ch_mag_50_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,TWENTYFIVE_OVER_FOUR_SQRT_42); + ch_mag_50_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_50_over_42_with_sigma2,1); + // x=3, y=3 + ch_mag_18_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,NINE_OVER_FOUR_SQRT_42); + ch_mag_18_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_18_over_42_with_sigma2,1); + // x=3, y=5 + ch_mag_34_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,SEVENTEEN_OVER_FOUR_SQRT_42); + ch_mag_34_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_34_over_42_with_sigma2,1); + // x=3, y=7 + ch_mag_58_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,TWENTYNINE_OVER_FOUR_SQRT_42); + ch_mag_58_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_58_over_42_with_sigma2,2); + // x=5, y=5 + ch_mag_50_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,TWENTYFIVE_OVER_FOUR_SQRT_42); + ch_mag_50_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_50_over_42_with_sigma2,1); + // x=5, y=7 + ch_mag_74_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,THIRTYSEVEN_OVER_FOUR_SQRT_42); + ch_mag_74_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_74_over_42_with_sigma2,2); + // x=7, y=7 + ch_mag_98_over_42_with_sigma2 = _mm_mulhi_epi16(ch_mag_des,FORTYNINE_OVER_FOUR_SQRT_42); + ch_mag_98_over_42_with_sigma2 = _mm_slli_epi16(ch_mag_98_over_42_with_sigma2,2); + + // Computing Metrics + xmm0 = _mm_subs_epi16(psi_a_p7_p7, a_sq_p7_p7); + xmm1 = _mm_adds_epi16(xmm0, y0_p_7_7); + bit_met_p7_p7 = _mm_subs_epi16(xmm1, ch_mag_98_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p7_p5, a_sq_p7_p5); + xmm1 = _mm_adds_epi16(xmm0, y0_p_7_5); + bit_met_p7_p5 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p7_p3, a_sq_p7_p3); + xmm1 = _mm_adds_epi16(xmm0, y0_p_7_3); + bit_met_p7_p3 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p7_p1, a_sq_p7_p1); + xmm1 = _mm_adds_epi16(xmm0, y0_p_7_1); + bit_met_p7_p1 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p7_m1, a_sq_p7_m1); + xmm1 = _mm_adds_epi16(xmm0, y0_m_7_1); + bit_met_p7_m1 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p7_m3, a_sq_p7_m3); + xmm1 = _mm_adds_epi16(xmm0, y0_m_7_3); + bit_met_p7_m3 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p7_m5, a_sq_p7_m5); + xmm1 = _mm_adds_epi16(xmm0, y0_m_7_5); + bit_met_p7_m5 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p7_m7, a_sq_p7_m7); + xmm1 = _mm_adds_epi16(xmm0, y0_m_7_7); + bit_met_p7_m7 = _mm_subs_epi16(xmm1, ch_mag_98_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p5_p7, a_sq_p5_p7); + xmm1 = _mm_adds_epi16(xmm0, y0_p_5_7); + bit_met_p5_p7 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p5_p5, a_sq_p5_p5); + xmm1 = _mm_adds_epi16(xmm0, y0_p_5_5); + bit_met_p5_p5 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p5_p3, a_sq_p5_p3); + xmm1 = _mm_adds_epi16(xmm0, y0_p_5_3); + bit_met_p5_p3 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p5_p1, a_sq_p5_p1); + xmm1 = _mm_adds_epi16(xmm0, y0_p_5_1); + bit_met_p5_p1 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p5_m1, a_sq_p5_m1); + xmm1 = _mm_adds_epi16(xmm0, y0_m_5_1); + bit_met_p5_m1 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p5_m3, a_sq_p5_m3); + xmm1 = _mm_adds_epi16(xmm0, y0_m_5_3); + bit_met_p5_m3 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p5_m5, a_sq_p5_m5); + xmm1 = _mm_adds_epi16(xmm0, y0_m_5_5); + bit_met_p5_m5 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p5_m7, a_sq_p5_m7); + xmm1 = _mm_adds_epi16(xmm0, y0_m_5_7); + bit_met_p5_m7 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p3_p7, a_sq_p3_p7); + xmm1 = _mm_adds_epi16(xmm0, y0_p_3_7); + bit_met_p3_p7 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p3_p5, a_sq_p3_p5); + xmm1 = _mm_adds_epi16(xmm0, y0_p_3_5); + bit_met_p3_p5 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p3_p3, a_sq_p3_p3); + xmm1 = _mm_adds_epi16(xmm0, y0_p_3_3); + bit_met_p3_p3 = _mm_subs_epi16(xmm1, ch_mag_18_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p3_p1, a_sq_p3_p1); + xmm1 = _mm_adds_epi16(xmm0, y0_p_3_1); + bit_met_p3_p1 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p3_m1, a_sq_p3_m1); + xmm1 = _mm_adds_epi16(xmm0, y0_m_3_1); + bit_met_p3_m1 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p3_m3, a_sq_p3_m3); + xmm1 = _mm_adds_epi16(xmm0, y0_m_3_3); + bit_met_p3_m3 = _mm_subs_epi16(xmm1, ch_mag_18_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p3_m5, a_sq_p3_m5); + xmm1 = _mm_adds_epi16(xmm0, y0_m_3_5); + bit_met_p3_m5 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p3_m7, a_sq_p3_m7); + xmm1 = _mm_adds_epi16(xmm0, y0_m_3_7); + bit_met_p3_m7 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p1_p7, a_sq_p1_p7); + xmm1 = _mm_adds_epi16(xmm0, y0_p_1_7); + bit_met_p1_p7 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p1_p5, a_sq_p1_p5); + xmm1 = _mm_adds_epi16(xmm0, y0_p_1_5); + bit_met_p1_p5 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p1_p3, a_sq_p1_p3); + xmm1 = _mm_adds_epi16(xmm0, y0_p_1_3); + bit_met_p1_p3 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p1_p1, a_sq_p1_p1); + xmm1 = _mm_adds_epi16(xmm0, y0_p_1_1); + bit_met_p1_p1 = _mm_subs_epi16(xmm1, ch_mag_2_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p1_m1, a_sq_p1_m1); + xmm1 = _mm_adds_epi16(xmm0, y0_m_1_1); + bit_met_p1_m1 = _mm_subs_epi16(xmm1, ch_mag_2_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p1_m3, a_sq_p1_m3); + xmm1 = _mm_adds_epi16(xmm0, y0_m_1_3); + bit_met_p1_m3 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p1_m5, a_sq_p1_m5); + xmm1 = _mm_adds_epi16(xmm0, y0_m_1_5); + bit_met_p1_m5 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_p1_m7, a_sq_p1_m7); + xmm1 = _mm_adds_epi16(xmm0, y0_m_1_7); + bit_met_p1_m7 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + + xmm0 = _mm_subs_epi16(psi_a_m1_p7, a_sq_m1_p7); + xmm1 = _mm_subs_epi16(xmm0, y0_m_1_7); + bit_met_m1_p7 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m1_p5, a_sq_m1_p5); + xmm1 = _mm_subs_epi16(xmm0, y0_m_1_5); + bit_met_m1_p5 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m1_p3, a_sq_m1_p3); + xmm1 = _mm_subs_epi16(xmm0, y0_m_1_3); + bit_met_m1_p3 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m1_p1, a_sq_m1_p1); + xmm1 = _mm_subs_epi16(xmm0, y0_m_1_1); + bit_met_m1_p1 = _mm_subs_epi16(xmm1, ch_mag_2_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m1_m1, a_sq_m1_m1); + xmm1 = _mm_subs_epi16(xmm0, y0_p_1_1); + bit_met_m1_m1 = _mm_subs_epi16(xmm1, ch_mag_2_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m1_m3, a_sq_m1_m3); + xmm1 = _mm_subs_epi16(xmm0, y0_p_1_3); + bit_met_m1_m3 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m1_m5, a_sq_m1_m5); + xmm1 = _mm_subs_epi16(xmm0, y0_p_1_5); + bit_met_m1_m5 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m1_m7, a_sq_m1_m7); + xmm1 = _mm_subs_epi16(xmm0, y0_p_1_7); + bit_met_m1_m7 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m3_p7, a_sq_m3_p7); + xmm1 = _mm_subs_epi16(xmm0, y0_m_3_7); + bit_met_m3_p7 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m3_p5, a_sq_m3_p5); + xmm1 = _mm_subs_epi16(xmm0, y0_m_3_5); + bit_met_m3_p5 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m3_p3, a_sq_m3_p3); + xmm1 = _mm_subs_epi16(xmm0, y0_m_3_3); + bit_met_m3_p3 = _mm_subs_epi16(xmm1, ch_mag_18_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m3_p1, a_sq_m3_p1); + xmm1 = _mm_subs_epi16(xmm0, y0_m_3_1); + bit_met_m3_p1 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m3_m1, a_sq_m3_m1); + xmm1 = _mm_subs_epi16(xmm0, y0_p_3_1); + bit_met_m3_m1 = _mm_subs_epi16(xmm1, ch_mag_10_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m3_m3, a_sq_m3_m3); + xmm1 = _mm_subs_epi16(xmm0, y0_p_3_3); + bit_met_m3_m3 = _mm_subs_epi16(xmm1, ch_mag_18_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m3_m5, a_sq_m3_m5); + xmm1 = _mm_subs_epi16(xmm0, y0_p_3_5); + bit_met_m3_m5 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m3_m7, a_sq_m3_m7); + xmm1 = _mm_subs_epi16(xmm0, y0_p_3_7); + bit_met_m3_m7 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m5_p7, a_sq_m5_p7); + xmm1 = _mm_subs_epi16(xmm0, y0_m_5_7); + bit_met_m5_p7 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m5_p5, a_sq_m5_p5); + xmm1 = _mm_subs_epi16(xmm0, y0_m_5_5); + bit_met_m5_p5 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m5_p3, a_sq_m5_p3); + xmm1 = _mm_subs_epi16(xmm0, y0_m_5_3); + bit_met_m5_p3 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m5_p1, a_sq_m5_p1); + xmm1 = _mm_subs_epi16(xmm0, y0_m_5_1); + bit_met_m5_p1 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m5_m1, a_sq_m5_m1); + xmm1 = _mm_subs_epi16(xmm0, y0_p_5_1); + bit_met_m5_m1 = _mm_subs_epi16(xmm1, ch_mag_26_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m5_m3, a_sq_m5_m3); + xmm1 = _mm_subs_epi16(xmm0, y0_p_5_3); + bit_met_m5_m3 = _mm_subs_epi16(xmm1, ch_mag_34_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m5_m5, a_sq_m5_m5); + xmm1 = _mm_subs_epi16(xmm0, y0_p_5_5); + bit_met_m5_m5 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m5_m7, a_sq_m5_m7); + xmm1 = _mm_subs_epi16(xmm0, y0_p_5_7); + bit_met_m5_m7 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m7_p7, a_sq_m7_p7); + xmm1 = _mm_subs_epi16(xmm0, y0_m_7_7); + bit_met_m7_p7 = _mm_subs_epi16(xmm1, ch_mag_98_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m7_p5, a_sq_m7_p5); + xmm1 = _mm_subs_epi16(xmm0, y0_m_7_5); + bit_met_m7_p5 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m7_p3, a_sq_m7_p3); + xmm1 = _mm_subs_epi16(xmm0, y0_m_7_3); + bit_met_m7_p3 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m7_p1, a_sq_m7_p1); + xmm1 = _mm_subs_epi16(xmm0, y0_m_7_1); + bit_met_m7_p1 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m7_m1, a_sq_m7_m1); + xmm1 = _mm_subs_epi16(xmm0, y0_p_7_1); + bit_met_m7_m1 = _mm_subs_epi16(xmm1, ch_mag_50_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m7_m3, a_sq_m7_m3); + xmm1 = _mm_subs_epi16(xmm0, y0_p_7_3); + bit_met_m7_m3 = _mm_subs_epi16(xmm1, ch_mag_58_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m7_m5, a_sq_m7_m5); + xmm1 = _mm_subs_epi16(xmm0, y0_p_7_5); + bit_met_m7_m5 = _mm_subs_epi16(xmm1, ch_mag_74_over_42_with_sigma2); + xmm0 = _mm_subs_epi16(psi_a_m7_m7, a_sq_m7_m7); + xmm1 = _mm_subs_epi16(xmm0, y0_p_7_7); + bit_met_m7_m7 = _mm_subs_epi16(xmm1, ch_mag_98_over_42_with_sigma2); + + // Detection for 1st bit (LTE mapping) + // bit = 1 + xmm0 = _mm_max_epi16(bit_met_m7_p7, bit_met_m7_p5); + xmm1 = _mm_max_epi16(bit_met_m7_p3, bit_met_m7_p1); + xmm2 = _mm_max_epi16(bit_met_m7_m1, bit_met_m7_m3); + xmm3 = _mm_max_epi16(bit_met_m7_m5, bit_met_m7_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_m5_p7, bit_met_m5_p5); + xmm1 = _mm_max_epi16(bit_met_m5_p3, bit_met_m5_p1); + xmm2 = _mm_max_epi16(bit_met_m5_m1, bit_met_m5_m3); + xmm3 = _mm_max_epi16(bit_met_m5_m5, bit_met_m5_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_m3_p7, bit_met_m3_p5); + xmm1 = _mm_max_epi16(bit_met_m3_p3, bit_met_m3_p1); + xmm2 = _mm_max_epi16(bit_met_m3_m1, bit_met_m3_m3); + xmm3 = _mm_max_epi16(bit_met_m3_m5, bit_met_m3_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_m1_p7, bit_met_m1_p5); + xmm1 = _mm_max_epi16(bit_met_m1_p3, bit_met_m1_p1); + xmm2 = _mm_max_epi16(bit_met_m1_m1, bit_met_m1_m3); + xmm3 = _mm_max_epi16(bit_met_m1_m5, bit_met_m1_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + + // bit = 0 + xmm0 = _mm_max_epi16(bit_met_p7_p7, bit_met_p7_p5); + xmm1 = _mm_max_epi16(bit_met_p7_p3, bit_met_p7_p1); + xmm2 = _mm_max_epi16(bit_met_p7_m1, bit_met_p7_m3); + xmm3 = _mm_max_epi16(bit_met_p7_m5, bit_met_p7_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_p5_p7, bit_met_p5_p5); + xmm1 = _mm_max_epi16(bit_met_p5_p3, bit_met_p5_p1); + xmm2 = _mm_max_epi16(bit_met_p5_m1, bit_met_p5_m3); + xmm3 = _mm_max_epi16(bit_met_p5_m5, bit_met_p5_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p3_p7, bit_met_p3_p5); + xmm1 = _mm_max_epi16(bit_met_p3_p3, bit_met_p3_p1); + xmm2 = _mm_max_epi16(bit_met_p3_m1, bit_met_p3_m3); + xmm3 = _mm_max_epi16(bit_met_p3_m5, bit_met_p3_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p1_p7, bit_met_p1_p5); + xmm1 = _mm_max_epi16(bit_met_p1_p3, bit_met_p1_p1); + xmm2 = _mm_max_epi16(bit_met_p1_m1, bit_met_p1_m3); + xmm3 = _mm_max_epi16(bit_met_p1_m5, bit_met_p1_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + + y0r = _mm_subs_epi16(logmax_num_re0, logmax_den_re0); + + // Detection for 2nd bit (LTE mapping) + // bit = 1 + xmm0 = _mm_max_epi16(bit_met_p7_m1, bit_met_p5_m1); + xmm1 = _mm_max_epi16(bit_met_p3_m1, bit_met_p1_m1); + xmm2 = _mm_max_epi16(bit_met_m1_m1, bit_met_m3_m1); + xmm3 = _mm_max_epi16(bit_met_m5_m1, bit_met_m7_m1); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m3, bit_met_p5_m3); + xmm1 = _mm_max_epi16(bit_met_p3_m3, bit_met_p1_m3); + xmm2 = _mm_max_epi16(bit_met_m1_m3, bit_met_m3_m3); + xmm3 = _mm_max_epi16(bit_met_m5_m3, bit_met_m7_m3); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m5, bit_met_p5_m5); + xmm1 = _mm_max_epi16(bit_met_p3_m5, bit_met_p1_m5); + xmm2 = _mm_max_epi16(bit_met_m1_m5, bit_met_m3_m5); + xmm3 = _mm_max_epi16(bit_met_m5_m5, bit_met_m7_m5); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m7, bit_met_p5_m7); + xmm1 = _mm_max_epi16(bit_met_p3_m7, bit_met_p1_m7); + xmm2 = _mm_max_epi16(bit_met_m1_m7, bit_met_m3_m7); + xmm3 = _mm_max_epi16(bit_met_m5_m7, bit_met_m7_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + + // bit = 0 + xmm0 = _mm_max_epi16(bit_met_p7_p1, bit_met_p5_p1); + xmm1 = _mm_max_epi16(bit_met_p3_p1, bit_met_p1_p1); + xmm2 = _mm_max_epi16(bit_met_m1_p1, bit_met_m3_p1); + xmm3 = _mm_max_epi16(bit_met_m5_p1, bit_met_m7_p1); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p3, bit_met_p5_p3); + xmm1 = _mm_max_epi16(bit_met_p3_p3, bit_met_p1_p3); + xmm2 = _mm_max_epi16(bit_met_m1_p3, bit_met_m3_p3); + xmm3 = _mm_max_epi16(bit_met_m5_p3, bit_met_m7_p3); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p5, bit_met_p5_p5); + xmm1 = _mm_max_epi16(bit_met_p3_p5, bit_met_p1_p5); + xmm2 = _mm_max_epi16(bit_met_m1_p5, bit_met_m3_p5); + xmm3 = _mm_max_epi16(bit_met_m5_p5, bit_met_m7_p5); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p7, bit_met_p5_p7); + xmm1 = _mm_max_epi16(bit_met_p3_p7, bit_met_p1_p7); + xmm2 = _mm_max_epi16(bit_met_m1_p7, bit_met_m3_p7); + xmm3 = _mm_max_epi16(bit_met_m5_p7, bit_met_m7_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + + y1r = _mm_subs_epi16(logmax_num_re0, logmax_den_re0); + + // Detection for 3rd bit (LTE mapping) + xmm0 = _mm_max_epi16(bit_met_m7_m7, bit_met_m7_m5); + xmm1 = _mm_max_epi16(bit_met_m7_m3, bit_met_m7_m1); + xmm2 = _mm_max_epi16(bit_met_m7_p1, bit_met_m7_p3); + xmm3 = _mm_max_epi16(bit_met_m7_p5, bit_met_m7_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_m5_m7, bit_met_m5_m5); + xmm1 = _mm_max_epi16(bit_met_m5_m3, bit_met_m5_m1); + xmm2 = _mm_max_epi16(bit_met_m5_p1, bit_met_m5_p3); + xmm3 = _mm_max_epi16(bit_met_m5_p5, bit_met_m5_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p5_m7, bit_met_p5_m5); + xmm1 = _mm_max_epi16(bit_met_p5_m3, bit_met_p5_m1); + xmm2 = _mm_max_epi16(bit_met_p5_p1, bit_met_p5_p3); + xmm3 = _mm_max_epi16(bit_met_p5_p5, bit_met_p5_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m7, bit_met_p7_m5); + xmm1 = _mm_max_epi16(bit_met_p7_m3, bit_met_p7_m1); + xmm2 = _mm_max_epi16(bit_met_p7_p1, bit_met_p7_p3); + xmm3 = _mm_max_epi16(bit_met_p7_p5, bit_met_p7_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + + xmm0 = _mm_max_epi16(bit_met_m3_m7, bit_met_m3_m5); + xmm1 = _mm_max_epi16(bit_met_m3_m3, bit_met_m3_m1); + xmm2 = _mm_max_epi16(bit_met_m3_p1, bit_met_m3_p3); + xmm3 = _mm_max_epi16(bit_met_m3_p5, bit_met_m3_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_m1_m7, bit_met_m1_m5); + xmm1 = _mm_max_epi16(bit_met_m1_m3, bit_met_m1_m1); + xmm2 = _mm_max_epi16(bit_met_m1_p1, bit_met_m1_p3); + xmm3 = _mm_max_epi16(bit_met_m1_p5, bit_met_m1_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p1_m7, bit_met_p1_m5); + xmm1 = _mm_max_epi16(bit_met_p1_m3, bit_met_p1_m1); + xmm2 = _mm_max_epi16(bit_met_p1_p1, bit_met_p1_p3); + xmm3 = _mm_max_epi16(bit_met_p1_p5, bit_met_p1_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p3_m7, bit_met_p3_m5); + xmm1 = _mm_max_epi16(bit_met_p3_m3, bit_met_p3_m1); + xmm2 = _mm_max_epi16(bit_met_p3_p1, bit_met_p3_p3); + xmm3 = _mm_max_epi16(bit_met_p3_p5, bit_met_p3_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + + y2r = _mm_subs_epi16(logmax_num_re0, logmax_den_re0); + + // Detection for 4th bit (LTE mapping) + xmm0 = _mm_max_epi16(bit_met_p7_p7, bit_met_p5_p7); + xmm1 = _mm_max_epi16(bit_met_p3_p7, bit_met_p1_p7); + xmm2 = _mm_max_epi16(bit_met_m1_p7, bit_met_m3_p7); + xmm3 = _mm_max_epi16(bit_met_m5_p7, bit_met_m7_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p5, bit_met_p5_p5); + xmm1 = _mm_max_epi16(bit_met_p3_p5, bit_met_p1_p5); + xmm2 = _mm_max_epi16(bit_met_m1_p5, bit_met_m3_p5); + xmm3 = _mm_max_epi16(bit_met_m5_p5, bit_met_m5_p5); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m5, bit_met_p5_m5); + xmm1 = _mm_max_epi16(bit_met_p3_m5, bit_met_p1_m5); + xmm2 = _mm_max_epi16(bit_met_m1_m5, bit_met_m3_m5); + xmm3 = _mm_max_epi16(bit_met_m5_m5, bit_met_m7_m5); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m7, bit_met_p5_m7); + xmm1 = _mm_max_epi16(bit_met_p3_m7, bit_met_p1_m7); + xmm2 = _mm_max_epi16(bit_met_m1_m7, bit_met_m3_m7); + xmm3 = _mm_max_epi16(bit_met_m5_m7, bit_met_m7_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + + xmm0 = _mm_max_epi16(bit_met_p7_m1, bit_met_p5_m1); + xmm1 = _mm_max_epi16(bit_met_p3_m1, bit_met_p1_m1); + xmm2 = _mm_max_epi16(bit_met_m1_m1, bit_met_m3_m1); + xmm3 = _mm_max_epi16(bit_met_m5_m1, bit_met_m7_m1); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m3, bit_met_p5_m3); + xmm1 = _mm_max_epi16(bit_met_p3_m3, bit_met_p1_m3); + xmm2 = _mm_max_epi16(bit_met_m1_m3, bit_met_m3_m3); + xmm3 = _mm_max_epi16(bit_met_m5_m3, bit_met_m7_m3); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p1, bit_met_p5_p1); + xmm1 = _mm_max_epi16(bit_met_p3_p1, bit_met_p1_p1); + xmm2 = _mm_max_epi16(bit_met_m1_p1, bit_met_m3_p1); + xmm3 = _mm_max_epi16(bit_met_m5_p1, bit_met_m7_p1); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p3, bit_met_p5_p3); + xmm1 = _mm_max_epi16(bit_met_p3_p3, bit_met_p1_p3); + xmm2 = _mm_max_epi16(bit_met_m1_p3, bit_met_m3_p3); + xmm3 = _mm_max_epi16(bit_met_m5_p3, bit_met_m7_p3); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + + y0i = _mm_subs_epi16(logmax_num_re0, logmax_den_re0); + + + // Detection for 5th bit (LTE mapping) + xmm0 = _mm_max_epi16(bit_met_m7_m7, bit_met_m7_m5); + xmm1 = _mm_max_epi16(bit_met_m7_m3, bit_met_m7_m1); + xmm2 = _mm_max_epi16(bit_met_m7_p1, bit_met_m7_p3); + xmm3 = _mm_max_epi16(bit_met_m7_p5, bit_met_m7_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_m1_m7, bit_met_m1_m5); + xmm1 = _mm_max_epi16(bit_met_m1_m3, bit_met_m1_m1); + xmm2 = _mm_max_epi16(bit_met_m1_p1, bit_met_m1_p3); + xmm3 = _mm_max_epi16(bit_met_m1_p5, bit_met_m1_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p1_m7, bit_met_p1_m5); + xmm1 = _mm_max_epi16(bit_met_p1_m3, bit_met_p1_m1); + xmm2 = _mm_max_epi16(bit_met_p1_p1, bit_met_p1_p3); + xmm3 = _mm_max_epi16(bit_met_p1_p5, bit_met_p1_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m7, bit_met_p7_m5); + xmm1 = _mm_max_epi16(bit_met_p7_m3, bit_met_p7_m1); + xmm2 = _mm_max_epi16(bit_met_p7_p1, bit_met_p7_p3); + xmm3 = _mm_max_epi16(bit_met_p7_p5, bit_met_p7_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + + xmm0 = _mm_max_epi16(bit_met_m5_m7, bit_met_m5_m5); + xmm1 = _mm_max_epi16(bit_met_m5_m3, bit_met_m5_m1); + xmm2 = _mm_max_epi16(bit_met_m5_p1, bit_met_m5_p3); + xmm3 = _mm_max_epi16(bit_met_m5_p5, bit_met_m5_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_m3_m7, bit_met_m3_m5); + xmm1 = _mm_max_epi16(bit_met_m3_m3, bit_met_m3_m1); + xmm2 = _mm_max_epi16(bit_met_m3_p1, bit_met_m3_p3); + xmm3 = _mm_max_epi16(bit_met_m3_p5, bit_met_m3_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p3_m7, bit_met_p3_m5); + xmm1 = _mm_max_epi16(bit_met_p3_m3, bit_met_p3_m1); + xmm2 = _mm_max_epi16(bit_met_p3_p1, bit_met_p3_p3); + xmm3 = _mm_max_epi16(bit_met_p3_p5, bit_met_p3_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p5_m7, bit_met_p5_m5); + xmm1 = _mm_max_epi16(bit_met_p5_m3, bit_met_p5_m1); + xmm2 = _mm_max_epi16(bit_met_p5_p1, bit_met_p5_p3); + xmm3 = _mm_max_epi16(bit_met_p5_p5, bit_met_p5_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + + y1i = _mm_subs_epi16(logmax_num_re0, logmax_den_re0); + + // Detection for 6th bit (LTE mapping) + xmm0 = _mm_max_epi16(bit_met_p7_p7, bit_met_p5_p7); + xmm1 = _mm_max_epi16(bit_met_p3_p7, bit_met_p1_p7); + xmm2 = _mm_max_epi16(bit_met_m1_p7, bit_met_m3_p7); + xmm3 = _mm_max_epi16(bit_met_m5_p7, bit_met_m7_p7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p1, bit_met_p5_p1); + xmm1 = _mm_max_epi16(bit_met_p3_p1, bit_met_p1_p1); + xmm2 = _mm_max_epi16(bit_met_m1_p1, bit_met_m3_p1); + xmm3 = _mm_max_epi16(bit_met_m5_p1, bit_met_m5_p1); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m1, bit_met_p5_m1); + xmm1 = _mm_max_epi16(bit_met_p3_m1, bit_met_p1_m1); + xmm2 = _mm_max_epi16(bit_met_m1_m1, bit_met_m3_m1); + xmm3 = _mm_max_epi16(bit_met_m5_m1, bit_met_m7_m1); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m7, bit_met_p5_m7); + xmm1 = _mm_max_epi16(bit_met_p3_m7, bit_met_p1_m7); + xmm2 = _mm_max_epi16(bit_met_m1_m7, bit_met_m3_m7); + xmm3 = _mm_max_epi16(bit_met_m5_m7, bit_met_m7_m7); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm4); + logmax_den_re0 = _mm_max_epi16(logmax_den_re0, xmm5); + + xmm0 = _mm_max_epi16(bit_met_p7_m5, bit_met_p5_m5); + xmm1 = _mm_max_epi16(bit_met_p3_m5, bit_met_p1_m5); + xmm2 = _mm_max_epi16(bit_met_m1_m5, bit_met_m3_m5); + xmm3 = _mm_max_epi16(bit_met_m5_m5, bit_met_m7_m5); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(xmm4, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_m3, bit_met_p5_m3); + xmm1 = _mm_max_epi16(bit_met_p3_m3, bit_met_p1_m3); + xmm2 = _mm_max_epi16(bit_met_m1_m3, bit_met_m3_m3); + xmm3 = _mm_max_epi16(bit_met_m5_m3, bit_met_m7_m3); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p3, bit_met_p5_p3); + xmm1 = _mm_max_epi16(bit_met_p3_p3, bit_met_p1_p3); + xmm2 = _mm_max_epi16(bit_met_m1_p3, bit_met_m3_p3); + xmm3 = _mm_max_epi16(bit_met_m5_p3, bit_met_m7_p3); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + xmm0 = _mm_max_epi16(bit_met_p7_p5, bit_met_p5_p5); + xmm1 = _mm_max_epi16(bit_met_p3_p5, bit_met_p1_p5); + xmm2 = _mm_max_epi16(bit_met_m1_p5, bit_met_m3_p5); + xmm3 = _mm_max_epi16(bit_met_m5_p5, bit_met_m7_p5); + xmm4 = _mm_max_epi16(xmm0, xmm1); + xmm5 = _mm_max_epi16(xmm2, xmm3); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm4); + logmax_num_re0 = _mm_max_epi16(logmax_num_re0, xmm5); + + y2i = _mm_subs_epi16(logmax_num_re0, logmax_den_re0); + + + // map to output stream, difficult to do in SIMD since we have 6 16bit LLRs + // RE 1 + j = 24*i; + stream0_out[j + 0] = ((short *)&y0r)[0]; + stream0_out[j + 1] = ((short *)&y1r)[0]; + stream0_out[j + 2] = ((short *)&y2r)[0]; + stream0_out[j + 3] = ((short *)&y0i)[0]; + stream0_out[j + 4] = ((short *)&y1i)[0]; + stream0_out[j + 5] = ((short *)&y2i)[0]; + // RE 2 + stream0_out[j + 6] = ((short *)&y0r)[1]; + stream0_out[j + 7] = ((short *)&y1r)[1]; + stream0_out[j + 8] = ((short *)&y2r)[1]; + stream0_out[j + 9] = ((short *)&y0i)[1]; + stream0_out[j + 10] = ((short *)&y1i)[1]; + stream0_out[j + 11] = ((short *)&y2i)[1]; + // RE 3 + stream0_out[j + 12] = ((short *)&y0r)[2]; + stream0_out[j + 13] = ((short *)&y1r)[2]; + stream0_out[j + 14] = ((short *)&y2r)[2]; + stream0_out[j + 15] = ((short *)&y0i)[2]; + stream0_out[j + 16] = ((short *)&y1i)[2]; + stream0_out[j + 17] = ((short *)&y2i)[2]; + // RE 4 + stream0_out[j + 18] = ((short *)&y0r)[3]; + stream0_out[j + 19] = ((short *)&y1r)[3]; + stream0_out[j + 20] = ((short *)&y2r)[3]; + stream0_out[j + 21] = ((short *)&y0i)[3]; + stream0_out[j + 22] = ((short *)&y1i)[3]; + stream0_out[j + 23] = ((short *)&y2i)[3]; + // RE 5 + stream0_out[j + 24] = ((short *)&y0r)[4]; + stream0_out[j + 25] = ((short *)&y1r)[4]; + stream0_out[j + 26] = ((short *)&y2r)[4]; + stream0_out[j + 27] = ((short *)&y0i)[4]; + stream0_out[j + 28] = ((short *)&y1i)[4]; + stream0_out[j + 29] = ((short *)&y2i)[4]; + // RE 6 + stream0_out[j + 30] = ((short *)&y0r)[5]; + stream0_out[j + 31] = ((short *)&y1r)[5]; + stream0_out[j + 32] = ((short *)&y2r)[5]; + stream0_out[j + 33] = ((short *)&y0i)[5]; + stream0_out[j + 34] = ((short *)&y1i)[5]; + stream0_out[j + 35] = ((short *)&y2i)[5]; + // RE 7 + stream0_out[j + 36] = ((short *)&y0r)[6]; + stream0_out[j + 37] = ((short *)&y1r)[6]; + stream0_out[j + 38] = ((short *)&y2r)[6]; + stream0_out[j + 39] = ((short *)&y0i)[6]; + stream0_out[j + 40] = ((short *)&y1i)[6]; + stream0_out[j + 41] = ((short *)&y2i)[6]; + // RE 8 + stream0_out[j + 42] = ((short *)&y0r)[7]; + stream0_out[j + 43] = ((short *)&y1r)[7]; + stream0_out[j + 44] = ((short *)&y2r)[7]; + stream0_out[j + 45] = ((short *)&y0i)[7]; + stream0_out[j + 46] = ((short *)&y1i)[7]; + stream0_out[j + 47] = ((short *)&y2i)[7]; + +#elif defined(__arm__) + +#endif + + } + +#if defined(__x86_64__) || defined(__i386__) + _mm_empty(); + _m_empty(); +#endif +} + + +int dlsch_64qam_64qam_llr(LTE_DL_FRAME_PARMS *frame_parms, + int32_t **rxdataF_comp, + int32_t **rxdataF_comp_i, + int32_t **dl_ch_mag, + int32_t **dl_ch_mag_i, + int32_t **rho_i, + int16_t *dlsch_llr, + uint8_t symbol, + uint8_t first_symbol_flag, + uint16_t nb_rb, + uint16_t pbch_pss_sss_adjust, + //int16_t **llr16p, + uint32_t llr_offset) +{ + + int16_t *rxF = (int16_t*)&rxdataF_comp[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *rxF_i = (int16_t*)&rxdataF_comp_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *ch_mag = (int16_t*)&dl_ch_mag[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *ch_mag_i = (int16_t*)&dl_ch_mag_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *rho = (int16_t*)&rho_i[0][(symbol*frame_parms->N_RB_DL*12)]; + int16_t *llr16; + int8_t *pllr_symbol; // pointer where llrs should filled for this ofdm symbol + int len; + uint8_t symbol_mod = (symbol >= (7-frame_parms->Ncp))? (symbol-(7-frame_parms->Ncp)) : symbol; + + //first symbol has different structure due to more pilots + /*if (first_symbol_flag == 1) { + llr16 = (int16_t*)dlsch_llr; + } else { + llr16 = (int16_t*)(*llr16p); + }*/ + + llr16 = (int16_t*)dlsch_llr; + + AssertFatal(llr16!=NULL,"dlsch_16qam_64qam_llr:llr is null, symbol %d\n",symbol); + + + if ((symbol_mod==0) || (symbol_mod==(4-frame_parms->Ncp))) { + // if symbol has pilots + if (frame_parms->nb_antenna_ports_eNB!=1) + // in 2 antenna ports we have 8 REs per symbol per RB + len = (nb_rb*8) - (2*pbch_pss_sss_adjust/3); + else + // for 1 antenna port we have 10 REs per symbol per RB + len = (nb_rb*10) - (5*pbch_pss_sss_adjust/6); + } else { + // symbol has no pilots + len = (nb_rb*12) - pbch_pss_sss_adjust; + } + + pllr_symbol = (int8_t*)dlsch_llr; + pllr_symbol += llr_offset; + //printf("dlsch_64qam_64qam_llr: symbol %d,nb_rb %d, len %d,pbch_pss_sss_adjust %d\n",symbol,nb_rb,len,pbch_pss_sss_adjust); + /*LOG_I(PHY,"dlsch_64qam_64qam_llr [symb %d / FirstSym %d / Length %d / LLR Offset %d]: @LLR Buff %x, @LLR Buff(symb) %x, , @Compute LLR Buff(symb) %x \n", + symbol, + first_symbol_flag, + len, + llr_offset, + (int16_t*)dlsch_llr, + llr16, + pllr_symbol);*/ + +#ifdef __AVX2__ + + // Round length up to multiple of 16 words + uint32_t len256i = ((len+16)>>4)*16; + int32_t *rxF_256i = (int32_t*) malloc16_clear(len256i*4); + int32_t *rxF_i_256i = (int32_t*) malloc16_clear(len256i*4); + int32_t *ch_mag_256i = (int32_t*) malloc16_clear(len256i*4); + int32_t *ch_mag_i_256i = (int32_t*) malloc16_clear(len256i*4); + int32_t *rho_256i = (int32_t*) malloc16_clear(len256i*4); + + memcpy(rxF_256i, rxF, len*4); + memcpy(rxF_i_256i, rxF_i, len*4); + memcpy(ch_mag_256i, ch_mag, len*4); + memcpy(ch_mag_i_256i, ch_mag_i, len*4); + memcpy(rho_256i, rho, len*4); + +#if 0 + qam64_qam16_avx2((short *)rxF_256i, + (short *)rxF_i_256i, + (short *)ch_mag_256i, + (short *)ch_mag_i_256i, + (short *)llr16, + (short *) rho_256i, + len); +#else + qam64_qam64_avx2((int32_t *)rxF_256i, + (int32_t *)rxF_i_256i, + (int32_t *)ch_mag_256i, + (int32_t *)ch_mag_i_256i, + (int16_t *)llr16, + (int32_t *) rho_256i, + len); +#endif + + free16(rxF_256i, sizeof(rxF_256i)); + free16(rxF_i_256i, sizeof(rxF_i_256i)); + free16(ch_mag_256i, sizeof(ch_mag_256i)); + free16(ch_mag_i_256i, sizeof(ch_mag_i_256i)); + free16(rho_256i, sizeof(rho_256i)); + +#else + qam64_qam64((short *)rxF, + (short *)rxF_i, + (short *)ch_mag, + (short *)ch_mag_i, + (short *)llr16, + (short *)rho, + len); +#endif + + llr16 += (6*len); + //*llr16p = (short *)llr16; + + return(0); +} diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation_avx2.c b/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation_avx2.c new file mode 100644 index 0000000000..588adfbc55 --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_llr_computation_avx2.c @@ -0,0 +1,4034 @@ + /* + * 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 + */ + +/*! \file PHY/LTE_TRANSPORT/dlsch_llr_computation.c + * \brief Top-level routines for LLR computation of the PDSCH physical channel from 36-211, V8.6 2009-03 + * \author R. Knopp, F. Kaltenberger,A. Bhamri, S. Aubert, S. Wagner, X Jiang + * \date 2011 + * \version 0.1 + * \company Eurecom + * \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr,ankit.bhamri@eurecom.fr,sebastien.aubert@eurecom.fr, sebastian.wagner@eurecom.fr + * \note + * \warning + */ + +#include "PHY/defs.h" +#include "PHY/TOOLS/defs.h" +#include "PHY/extern.h" +#include "defs.h" +#include "extern.h" +#include "PHY/sse_intrin.h" + +int16_t ones256[16] __attribute__ ((aligned(32))) = {0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff,0xffff}; + +static __m256i rho_rpi __attribute__ ((aligned(32))); +static __m256i rho_rmi __attribute__ ((aligned(32))); +static __m256i rho_rpi_1_1 __attribute__ ((aligned(32))); +static __m256i rho_rpi_1_3 __attribute__ ((aligned(32))); +static __m256i rho_rpi_1_5 __attribute__ ((aligned(32))); +static __m256i rho_rpi_1_7 __attribute__ ((aligned(32))); +static __m256i rho_rpi_3_1 __attribute__ ((aligned(32))); +static __m256i rho_rpi_3_3 __attribute__ ((aligned(32))); +static __m256i rho_rpi_3_5 __attribute__ ((aligned(32))); +static __m256i rho_rpi_3_7 __attribute__ ((aligned(32))); +static __m256i rho_rpi_5_1 __attribute__ ((aligned(32))); +static __m256i rho_rpi_5_3 __attribute__ ((aligned(32))); +static __m256i rho_rpi_5_5 __attribute__ ((aligned(32))); +static __m256i rho_rpi_5_7 __attribute__ ((aligned(32))); +static __m256i rho_rpi_7_1 __attribute__ ((aligned(32))); +static __m256i rho_rpi_7_3 __attribute__ ((aligned(32))); +static __m256i rho_rpi_7_5 __attribute__ ((aligned(32))); +static __m256i rho_rpi_7_7 __attribute__ ((aligned(32))); +static __m256i rho_rmi_1_1 __attribute__ ((aligned(32))); +static __m256i rho_rmi_1_3 __attribute__ ((aligned(32))); +static __m256i rho_rmi_1_5 __attribute__ ((aligned(32))); +static __m256i rho_rmi_1_7 __attribute__ ((aligned(32))); +static __m256i rho_rmi_3_1 __attribute__ ((aligned(32))); +static __m256i rho_rmi_3_3 __attribute__ ((aligned(32))); +static __m256i rho_rmi_3_5 __attribute__ ((aligned(32))); +static __m256i rho_rmi_3_7 __attribute__ ((aligned(32))); +static __m256i rho_rmi_5_1 __attribute__ ((aligned(32))); +static __m256i rho_rmi_5_3 __attribute__ ((aligned(32))); +static __m256i rho_rmi_5_5 __attribute__ ((aligned(32))); +static __m256i rho_rmi_5_7 __attribute__ ((aligned(32))); +static __m256i rho_rmi_7_1 __attribute__ ((aligned(32))); +static __m256i rho_rmi_7_3 __attribute__ ((aligned(32))); +static __m256i rho_rmi_7_5 __attribute__ ((aligned(32))); +static __m256i rho_rmi_7_7 __attribute__ ((aligned(32))); + +static __m256i psi_r_m7_m7 __attribute__ ((aligned(32))); +static __m256i psi_r_m7_m5 __attribute__ ((aligned(32))); +static __m256i psi_r_m7_m3 __attribute__ ((aligned(32))); +static __m256i psi_r_m7_m1 __attribute__ ((aligned(32))); +static __m256i psi_r_m7_p1 __attribute__ ((aligned(32))); +static __m256i psi_r_m7_p3 __attribute__ ((aligned(32))); +static __m256i psi_r_m7_p5 __attribute__ ((aligned(32))); +static __m256i psi_r_m7_p7 __attribute__ ((aligned(32))); +static __m256i psi_r_m5_m7 __attribute__ ((aligned(32))); +static __m256i psi_r_m5_m5 __attribute__ ((aligned(32))); +static __m256i psi_r_m5_m3 __attribute__ ((aligned(32))); +static __m256i psi_r_m5_m1 __attribute__ ((aligned(32))); +static __m256i psi_r_m5_p1 __attribute__ ((aligned(32))); +static __m256i psi_r_m5_p3 __attribute__ ((aligned(32))); +static __m256i psi_r_m5_p5 __attribute__ ((aligned(32))); +static __m256i psi_r_m5_p7 __attribute__ ((aligned(32))); +static __m256i psi_r_m3_m7 __attribute__ ((aligned(32))); +static __m256i psi_r_m3_m5 __attribute__ ((aligned(32))); +static __m256i psi_r_m3_m3 __attribute__ ((aligned(32))); +static __m256i psi_r_m3_m1 __attribute__ ((aligned(32))); +static __m256i psi_r_m3_p1 __attribute__ ((aligned(32))); +static __m256i psi_r_m3_p3 __attribute__ ((aligned(32))); +static __m256i psi_r_m3_p5 __attribute__ ((aligned(32))); +static __m256i psi_r_m3_p7 __attribute__ ((aligned(32))); +static __m256i psi_r_m1_m7 __attribute__ ((aligned(32))); +static __m256i psi_r_m1_m5 __attribute__ ((aligned(32))); +static __m256i psi_r_m1_m3 __attribute__ ((aligned(32))); +static __m256i psi_r_m1_m1 __attribute__ ((aligned(32))); +static __m256i psi_r_m1_p1 __attribute__ ((aligned(32))); +static __m256i psi_r_m1_p3 __attribute__ ((aligned(32))); +static __m256i psi_r_m1_p5 __attribute__ ((aligned(32))); +static __m256i psi_r_m1_p7 __attribute__ ((aligned(32))); +static __m256i psi_r_p1_m7 __attribute__ ((aligned(32))); +static __m256i psi_r_p1_m5 __attribute__ ((aligned(32))); +static __m256i psi_r_p1_m3 __attribute__ ((aligned(32))); +static __m256i psi_r_p1_m1 __attribute__ ((aligned(32))); +static __m256i psi_r_p1_p1 __attribute__ ((aligned(32))); +static __m256i psi_r_p1_p3 __attribute__ ((aligned(32))); +static __m256i psi_r_p1_p5 __attribute__ ((aligned(32))); +static __m256i psi_r_p1_p7 __attribute__ ((aligned(32))); +static __m256i psi_r_p3_m7 __attribute__ ((aligned(32))); +static __m256i psi_r_p3_m5 __attribute__ ((aligned(32))); +static __m256i psi_r_p3_m3 __attribute__ ((aligned(32))); +static __m256i psi_r_p3_m1 __attribute__ ((aligned(32))); +static __m256i psi_r_p3_p1 __attribute__ ((aligned(32))); +static __m256i psi_r_p3_p3 __attribute__ ((aligned(32))); +static __m256i psi_r_p3_p5 __attribute__ ((aligned(32))); +static __m256i psi_r_p3_p7 __attribute__ ((aligned(32))); +static __m256i psi_r_p5_m7 __attribute__ ((aligned(32))); +static __m256i psi_r_p5_m5 __attribute__ ((aligned(32))); +static __m256i psi_r_p5_m3 __attribute__ ((aligned(32))); +static __m256i psi_r_p5_m1 __attribute__ ((aligned(32))); +static __m256i psi_r_p5_p1 __attribute__ ((aligned(32))); +static __m256i psi_r_p5_p3 __attribute__ ((aligned(32))); +static __m256i psi_r_p5_p5 __attribute__ ((aligned(32))); +static __m256i psi_r_p5_p7 __attribute__ ((aligned(32))); +static __m256i psi_r_p7_m7 __attribute__ ((aligned(32))); +static __m256i psi_r_p7_m5 __attribute__ ((aligned(32))); +static __m256i psi_r_p7_m3 __attribute__ ((aligned(32))); +static __m256i psi_r_p7_m1 __attribute__ ((aligned(32))); +static __m256i psi_r_p7_p1 __attribute__ ((aligned(32))); +static __m256i psi_r_p7_p3 __attribute__ ((aligned(32))); +static __m256i psi_r_p7_p5 __attribute__ ((aligned(32))); +static __m256i psi_r_p7_p7 __attribute__ ((aligned(32))); + +static __m256i psi_i_m7_m7 __attribute__ ((aligned(32))); +static __m256i psi_i_m7_m5 __attribute__ ((aligned(32))); +static __m256i psi_i_m7_m3 __attribute__ ((aligned(32))); +static __m256i psi_i_m7_m1 __attribute__ ((aligned(32))); +static __m256i psi_i_m7_p1 __attribute__ ((aligned(32))); +static __m256i psi_i_m7_p3 __attribute__ ((aligned(32))); +static __m256i psi_i_m7_p5 __attribute__ ((aligned(32))); +static __m256i psi_i_m7_p7 __attribute__ ((aligned(32))); +static __m256i psi_i_m5_m7 __attribute__ ((aligned(32))); +static __m256i psi_i_m5_m5 __attribute__ ((aligned(32))); +static __m256i psi_i_m5_m3 __attribute__ ((aligned(32))); +static __m256i psi_i_m5_m1 __attribute__ ((aligned(32))); +static __m256i psi_i_m5_p1 __attribute__ ((aligned(32))); +static __m256i psi_i_m5_p3 __attribute__ ((aligned(32))); +static __m256i psi_i_m5_p5 __attribute__ ((aligned(32))); +static __m256i psi_i_m5_p7 __attribute__ ((aligned(32))); +static __m256i psi_i_m3_m7 __attribute__ ((aligned(32))); +static __m256i psi_i_m3_m5 __attribute__ ((aligned(32))); +static __m256i psi_i_m3_m3 __attribute__ ((aligned(32))); +static __m256i psi_i_m3_m1 __attribute__ ((aligned(32))); +static __m256i psi_i_m3_p1 __attribute__ ((aligned(32))); +static __m256i psi_i_m3_p3 __attribute__ ((aligned(32))); +static __m256i psi_i_m3_p5 __attribute__ ((aligned(32))); +static __m256i psi_i_m3_p7 __attribute__ ((aligned(32))); +static __m256i psi_i_m1_m7 __attribute__ ((aligned(32))); +static __m256i psi_i_m1_m5 __attribute__ ((aligned(32))); +static __m256i psi_i_m1_m3 __attribute__ ((aligned(32))); +static __m256i psi_i_m1_m1 __attribute__ ((aligned(32))); +static __m256i psi_i_m1_p1 __attribute__ ((aligned(32))); +static __m256i psi_i_m1_p3 __attribute__ ((aligned(32))); +static __m256i psi_i_m1_p5 __attribute__ ((aligned(32))); +static __m256i psi_i_m1_p7 __attribute__ ((aligned(32))); +static __m256i psi_i_p1_m7 __attribute__ ((aligned(32))); +static __m256i psi_i_p1_m5 __attribute__ ((aligned(32))); +static __m256i psi_i_p1_m3 __attribute__ ((aligned(32))); +static __m256i psi_i_p1_m1 __attribute__ ((aligned(32))); +static __m256i psi_i_p1_p1 __attribute__ ((aligned(32))); +static __m256i psi_i_p1_p3 __attribute__ ((aligned(32))); +static __m256i psi_i_p1_p5 __attribute__ ((aligned(32))); +static __m256i psi_i_p1_p7 __attribute__ ((aligned(32))); +static __m256i psi_i_p3_m7 __attribute__ ((aligned(32))); +static __m256i psi_i_p3_m5 __attribute__ ((aligned(32))); +static __m256i psi_i_p3_m3 __attribute__ ((aligned(32))); +static __m256i psi_i_p3_m1 __attribute__ ((aligned(32))); +static __m256i psi_i_p3_p1 __attribute__ ((aligned(32))); +static __m256i psi_i_p3_p3 __attribute__ ((aligned(32))); +static __m256i psi_i_p3_p5 __attribute__ ((aligned(32))); +static __m256i psi_i_p3_p7 __attribute__ ((aligned(32))); +static __m256i psi_i_p5_m7 __attribute__ ((aligned(32))); +static __m256i psi_i_p5_m5 __attribute__ ((aligned(32))); +static __m256i psi_i_p5_m3 __attribute__ ((aligned(32))); +static __m256i psi_i_p5_m1 __attribute__ ((aligned(32))); +static __m256i psi_i_p5_p1 __attribute__ ((aligned(32))); +static __m256i psi_i_p5_p3 __attribute__ ((aligned(32))); +static __m256i psi_i_p5_p5 __attribute__ ((aligned(32))); +static __m256i psi_i_p5_p7 __attribute__ ((aligned(32))); +static __m256i psi_i_p7_m7 __attribute__ ((aligned(32))); +static __m256i psi_i_p7_m5 __attribute__ ((aligned(32))); +static __m256i psi_i_p7_m3 __attribute__ ((aligned(32))); +static __m256i psi_i_p7_m1 __attribute__ ((aligned(32))); +static __m256i psi_i_p7_p1 __attribute__ ((aligned(32))); +static __m256i psi_i_p7_p3 __attribute__ ((aligned(32))); +static __m256i psi_i_p7_p5 __attribute__ ((aligned(32))); +static __m256i psi_i_p7_p7 __attribute__ ((aligned(32))); + +static __m256i a_r_m7_m7 __attribute__ ((aligned(32))); +static __m256i a_r_m7_m5 __attribute__ ((aligned(32))); +static __m256i a_r_m7_m3 __attribute__ ((aligned(32))); +static __m256i a_r_m7_m1 __attribute__ ((aligned(32))); +static __m256i a_r_m7_p1 __attribute__ ((aligned(32))); +static __m256i a_r_m7_p3 __attribute__ ((aligned(32))); +static __m256i a_r_m7_p5 __attribute__ ((aligned(32))); +static __m256i a_r_m7_p7 __attribute__ ((aligned(32))); +static __m256i a_r_m5_m7 __attribute__ ((aligned(32))); +static __m256i a_r_m5_m5 __attribute__ ((aligned(32))); +static __m256i a_r_m5_m3 __attribute__ ((aligned(32))); +static __m256i a_r_m5_m1 __attribute__ ((aligned(32))); +static __m256i a_r_m5_p1 __attribute__ ((aligned(32))); +static __m256i a_r_m5_p3 __attribute__ ((aligned(32))); +static __m256i a_r_m5_p5 __attribute__ ((aligned(32))); +static __m256i a_r_m5_p7 __attribute__ ((aligned(32))); +static __m256i a_r_m3_m7 __attribute__ ((aligned(32))); +static __m256i a_r_m3_m5 __attribute__ ((aligned(32))); +static __m256i a_r_m3_m3 __attribute__ ((aligned(32))); +static __m256i a_r_m3_m1 __attribute__ ((aligned(32))); +static __m256i a_r_m3_p1 __attribute__ ((aligned(32))); +static __m256i a_r_m3_p3 __attribute__ ((aligned(32))); +static __m256i a_r_m3_p5 __attribute__ ((aligned(32))); +static __m256i a_r_m3_p7 __attribute__ ((aligned(32))); +static __m256i a_r_m1_m7 __attribute__ ((aligned(32))); +static __m256i a_r_m1_m5 __attribute__ ((aligned(32))); +static __m256i a_r_m1_m3 __attribute__ ((aligned(32))); +static __m256i a_r_m1_m1 __attribute__ ((aligned(32))); +static __m256i a_r_m1_p1 __attribute__ ((aligned(32))); +static __m256i a_r_m1_p3 __attribute__ ((aligned(32))); +static __m256i a_r_m1_p5 __attribute__ ((aligned(32))); +static __m256i a_r_m1_p7 __attribute__ ((aligned(32))); +static __m256i a_r_p1_m7 __attribute__ ((aligned(32))); +static __m256i a_r_p1_m5 __attribute__ ((aligned(32))); +static __m256i a_r_p1_m3 __attribute__ ((aligned(32))); +static __m256i a_r_p1_m1 __attribute__ ((aligned(32))); +static __m256i a_r_p1_p1 __attribute__ ((aligned(32))); +static __m256i a_r_p1_p3 __attribute__ ((aligned(32))); +static __m256i a_r_p1_p5 __attribute__ ((aligned(32))); +static __m256i a_r_p1_p7 __attribute__ ((aligned(32))); +static __m256i a_r_p3_m7 __attribute__ ((aligned(32))); +static __m256i a_r_p3_m5 __attribute__ ((aligned(32))); +static __m256i a_r_p3_m3 __attribute__ ((aligned(32))); +static __m256i a_r_p3_m1 __attribute__ ((aligned(32))); +static __m256i a_r_p3_p1 __attribute__ ((aligned(32))); +static __m256i a_r_p3_p3 __attribute__ ((aligned(32))); +static __m256i a_r_p3_p5 __attribute__ ((aligned(32))); +static __m256i a_r_p3_p7 __attribute__ ((aligned(32))); +static __m256i a_r_p5_m7 __attribute__ ((aligned(32))); +static __m256i a_r_p5_m5 __attribute__ ((aligned(32))); +static __m256i a_r_p5_m3 __attribute__ ((aligned(32))); +static __m256i a_r_p5_m1 __attribute__ ((aligned(32))); +static __m256i a_r_p5_p1 __attribute__ ((aligned(32))); +static __m256i a_r_p5_p3 __attribute__ ((aligned(32))); +static __m256i a_r_p5_p5 __attribute__ ((aligned(32))); +static __m256i a_r_p5_p7 __attribute__ ((aligned(32))); +static __m256i a_r_p7_m7 __attribute__ ((aligned(32))); +static __m256i a_r_p7_m5 __attribute__ ((aligned(32))); +static __m256i a_r_p7_m3 __attribute__ ((aligned(32))); +static __m256i a_r_p7_m1 __attribute__ ((aligned(32))); +static __m256i a_r_p7_p1 __attribute__ ((aligned(32))); +static __m256i a_r_p7_p3 __attribute__ ((aligned(32))); +static __m256i a_r_p7_p5 __attribute__ ((aligned(32))); +static __m256i a_r_p7_p7 __attribute__ ((aligned(32))); + +static __m256i a_i_m7_m7 __attribute__ ((aligned(32))); +static __m256i a_i_m7_m5 __attribute__ ((aligned(32))); +static __m256i a_i_m7_m3 __attribute__ ((aligned(32))); +static __m256i a_i_m7_m1 __attribute__ ((aligned(32))); +static __m256i a_i_m7_p1 __attribute__ ((aligned(32))); +static __m256i a_i_m7_p3 __attribute__ ((aligned(32))); +static __m256i a_i_m7_p5 __attribute__ ((aligned(32))); +static __m256i a_i_m7_p7 __attribute__ ((aligned(32))); +static __m256i a_i_m5_m7 __attribute__ ((aligned(32))); +static __m256i a_i_m5_m5 __attribute__ ((aligned(32))); +static __m256i a_i_m5_m3 __attribute__ ((aligned(32))); +static __m256i a_i_m5_m1 __attribute__ ((aligned(32))); +static __m256i a_i_m5_p1 __attribute__ ((aligned(32))); +static __m256i a_i_m5_p3 __attribute__ ((aligned(32))); +static __m256i a_i_m5_p5 __attribute__ ((aligned(32))); +static __m256i a_i_m5_p7 __attribute__ ((aligned(32))); +static __m256i a_i_m3_m7 __attribute__ ((aligned(32))); +static __m256i a_i_m3_m5 __attribute__ ((aligned(32))); +static __m256i a_i_m3_m3 __attribute__ ((aligned(32))); +static __m256i a_i_m3_m1 __attribute__ ((aligned(32))); +static __m256i a_i_m3_p1 __attribute__ ((aligned(32))); +static __m256i a_i_m3_p3 __attribute__ ((aligned(32))); +static __m256i a_i_m3_p5 __attribute__ ((aligned(32))); +static __m256i a_i_m3_p7 __attribute__ ((aligned(32))); +static __m256i a_i_m1_m7 __attribute__ ((aligned(32))); +static __m256i a_i_m1_m5 __attribute__ ((aligned(32))); +static __m256i a_i_m1_m3 __attribute__ ((aligned(32))); +static __m256i a_i_m1_m1 __attribute__ ((aligned(32))); +static __m256i a_i_m1_p1 __attribute__ ((aligned(32))); +static __m256i a_i_m1_p3 __attribute__ ((aligned(32))); +static __m256i a_i_m1_p5 __attribute__ ((aligned(32))); +static __m256i a_i_m1_p7 __attribute__ ((aligned(32))); +static __m256i a_i_p1_m7 __attribute__ ((aligned(32))); +static __m256i a_i_p1_m5 __attribute__ ((aligned(32))); +static __m256i a_i_p1_m3 __attribute__ ((aligned(32))); +static __m256i a_i_p1_m1 __attribute__ ((aligned(32))); +static __m256i a_i_p1_p1 __attribute__ ((aligned(32))); +static __m256i a_i_p1_p3 __attribute__ ((aligned(32))); +static __m256i a_i_p1_p5 __attribute__ ((aligned(32))); +static __m256i a_i_p1_p7 __attribute__ ((aligned(32))); +static __m256i a_i_p3_m7 __attribute__ ((aligned(32))); +static __m256i a_i_p3_m5 __attribute__ ((aligned(32))); +static __m256i a_i_p3_m3 __attribute__ ((aligned(32))); +static __m256i a_i_p3_m1 __attribute__ ((aligned(32))); +static __m256i a_i_p3_p1 __attribute__ ((aligned(32))); +static __m256i a_i_p3_p3 __attribute__ ((aligned(32))); +static __m256i a_i_p3_p5 __attribute__ ((aligned(32))); +static __m256i a_i_p3_p7 __attribute__ ((aligned(32))); +static __m256i a_i_p5_m7 __attribute__ ((aligned(32))); +static __m256i a_i_p5_m5 __attribute__ ((aligned(32))); +static __m256i a_i_p5_m3 __attribute__ ((aligned(32))); +static __m256i a_i_p5_m1 __attribute__ ((aligned(32))); +static __m256i a_i_p5_p1 __attribute__ ((aligned(32))); +static __m256i a_i_p5_p3 __attribute__ ((aligned(32))); +static __m256i a_i_p5_p5 __attribute__ ((aligned(32))); +static __m256i a_i_p5_p7 __attribute__ ((aligned(32))); +static __m256i a_i_p7_m7 __attribute__ ((aligned(32))); +static __m256i a_i_p7_m5 __attribute__ ((aligned(32))); +static __m256i a_i_p7_m3 __attribute__ ((aligned(32))); +static __m256i a_i_p7_m1 __attribute__ ((aligned(32))); +static __m256i a_i_p7_p1 __attribute__ ((aligned(32))); +static __m256i a_i_p7_p3 __attribute__ ((aligned(32))); +static __m256i a_i_p7_p5 __attribute__ ((aligned(32))); +static __m256i a_i_p7_p7 __attribute__ ((aligned(32))); + +static __m256i psi_a_m7_m7 __attribute__ ((aligned(32))); +static __m256i psi_a_m7_m5 __attribute__ ((aligned(32))); +static __m256i psi_a_m7_m3 __attribute__ ((aligned(32))); +static __m256i psi_a_m7_m1 __attribute__ ((aligned(32))); +static __m256i psi_a_m7_p1 __attribute__ ((aligned(32))); +static __m256i psi_a_m7_p3 __attribute__ ((aligned(32))); +static __m256i psi_a_m7_p5 __attribute__ ((aligned(32))); +static __m256i psi_a_m7_p7 __attribute__ ((aligned(32))); +static __m256i psi_a_m5_m7 __attribute__ ((aligned(32))); +static __m256i psi_a_m5_m5 __attribute__ ((aligned(32))); +static __m256i psi_a_m5_m3 __attribute__ ((aligned(32))); +static __m256i psi_a_m5_m1 __attribute__ ((aligned(32))); +static __m256i psi_a_m5_p1 __attribute__ ((aligned(32))); +static __m256i psi_a_m5_p3 __attribute__ ((aligned(32))); +static __m256i psi_a_m5_p5 __attribute__ ((aligned(32))); +static __m256i psi_a_m5_p7 __attribute__ ((aligned(32))); +static __m256i psi_a_m3_m7 __attribute__ ((aligned(32))); +static __m256i psi_a_m3_m5 __attribute__ ((aligned(32))); +static __m256i psi_a_m3_m3 __attribute__ ((aligned(32))); +static __m256i psi_a_m3_m1 __attribute__ ((aligned(32))); +static __m256i psi_a_m3_p1 __attribute__ ((aligned(32))); +static __m256i psi_a_m3_p3 __attribute__ ((aligned(32))); +static __m256i psi_a_m3_p5 __attribute__ ((aligned(32))); +static __m256i psi_a_m3_p7 __attribute__ ((aligned(32))); +static __m256i psi_a_m1_m7 __attribute__ ((aligned(32))); +static __m256i psi_a_m1_m5 __attribute__ ((aligned(32))); +static __m256i psi_a_m1_m3 __attribute__ ((aligned(32))); +static __m256i psi_a_m1_m1 __attribute__ ((aligned(32))); +static __m256i psi_a_m1_p1 __attribute__ ((aligned(32))); +static __m256i psi_a_m1_p3 __attribute__ ((aligned(32))); +static __m256i psi_a_m1_p5 __attribute__ ((aligned(32))); +static __m256i psi_a_m1_p7 __attribute__ ((aligned(32))); +static __m256i psi_a_p1_m7 __attribute__ ((aligned(32))); +static __m256i psi_a_p1_m5 __attribute__ ((aligned(32))); +static __m256i psi_a_p1_m3 __attribute__ ((aligned(32))); +static __m256i psi_a_p1_m1 __attribute__ ((aligned(32))); +static __m256i psi_a_p1_p1 __attribute__ ((aligned(32))); +static __m256i psi_a_p1_p3 __attribute__ ((aligned(32))); +static __m256i psi_a_p1_p5 __attribute__ ((aligned(32))); +static __m256i psi_a_p1_p7 __attribute__ ((aligned(32))); +static __m256i psi_a_p3_m7 __attribute__ ((aligned(32))); +static __m256i psi_a_p3_m5 __attribute__ ((aligned(32))); +static __m256i psi_a_p3_m3 __attribute__ ((aligned(32))); +static __m256i psi_a_p3_m1 __attribute__ ((aligned(32))); +static __m256i psi_a_p3_p1 __attribute__ ((aligned(32))); +static __m256i psi_a_p3_p3 __attribute__ ((aligned(32))); +static __m256i psi_a_p3_p5 __attribute__ ((aligned(32))); +static __m256i psi_a_p3_p7 __attribute__ ((aligned(32))); +static __m256i psi_a_p5_m7 __attribute__ ((aligned(32))); +static __m256i psi_a_p5_m5 __attribute__ ((aligned(32))); +static __m256i psi_a_p5_m3 __attribute__ ((aligned(32))); +static __m256i psi_a_p5_m1 __attribute__ ((aligned(32))); +static __m256i psi_a_p5_p1 __attribute__ ((aligned(32))); +static __m256i psi_a_p5_p3 __attribute__ ((aligned(32))); +static __m256i psi_a_p5_p5 __attribute__ ((aligned(32))); +static __m256i psi_a_p5_p7 __attribute__ ((aligned(32))); +static __m256i psi_a_p7_m7 __attribute__ ((aligned(32))); +static __m256i psi_a_p7_m5 __attribute__ ((aligned(32))); +static __m256i psi_a_p7_m3 __attribute__ ((aligned(32))); +static __m256i psi_a_p7_m1 __attribute__ ((aligned(32))); +static __m256i psi_a_p7_p1 __attribute__ ((aligned(32))); +static __m256i psi_a_p7_p3 __attribute__ ((aligned(32))); +static __m256i psi_a_p7_p5 __attribute__ ((aligned(32))); +static __m256i psi_a_p7_p7 __attribute__ ((aligned(32))); + +static __m256i a_sq_m7_m7 __attribute__ ((aligned(32))); +static __m256i a_sq_m7_m5 __attribute__ ((aligned(32))); +static __m256i a_sq_m7_m3 __attribute__ ((aligned(32))); +static __m256i a_sq_m7_m1 __attribute__ ((aligned(32))); +static __m256i a_sq_m7_p1 __attribute__ ((aligned(32))); +static __m256i a_sq_m7_p3 __attribute__ ((aligned(32))); +static __m256i a_sq_m7_p5 __attribute__ ((aligned(32))); +static __m256i a_sq_m7_p7 __attribute__ ((aligned(32))); +static __m256i a_sq_m5_m7 __attribute__ ((aligned(32))); +static __m256i a_sq_m5_m5 __attribute__ ((aligned(32))); +static __m256i a_sq_m5_m3 __attribute__ ((aligned(32))); +static __m256i a_sq_m5_m1 __attribute__ ((aligned(32))); +static __m256i a_sq_m5_p1 __attribute__ ((aligned(32))); +static __m256i a_sq_m5_p3 __attribute__ ((aligned(32))); +static __m256i a_sq_m5_p5 __attribute__ ((aligned(32))); +static __m256i a_sq_m5_p7 __attribute__ ((aligned(32))); +static __m256i a_sq_m3_m7 __attribute__ ((aligned(32))); +static __m256i a_sq_m3_m5 __attribute__ ((aligned(32))); +static __m256i a_sq_m3_m3 __attribute__ ((aligned(32))); +static __m256i a_sq_m3_m1 __attribute__ ((aligned(32))); +static __m256i a_sq_m3_p1 __attribute__ ((aligned(32))); +static __m256i a_sq_m3_p3 __attribute__ ((aligned(32))); +static __m256i a_sq_m3_p5 __attribute__ ((aligned(32))); +static __m256i a_sq_m3_p7 __attribute__ ((aligned(32))); +static __m256i a_sq_m1_m7 __attribute__ ((aligned(32))); +static __m256i a_sq_m1_m5 __attribute__ ((aligned(32))); +static __m256i a_sq_m1_m3 __attribute__ ((aligned(32))); +static __m256i a_sq_m1_m1 __attribute__ ((aligned(32))); +static __m256i a_sq_m1_p1 __attribute__ ((aligned(32))); +static __m256i a_sq_m1_p3 __attribute__ ((aligned(32))); +static __m256i a_sq_m1_p5 __attribute__ ((aligned(32))); +static __m256i a_sq_m1_p7 __attribute__ ((aligned(32))); +static __m256i a_sq_p1_m7 __attribute__ ((aligned(32))); +static __m256i a_sq_p1_m5 __attribute__ ((aligned(32))); +static __m256i a_sq_p1_m3 __attribute__ ((aligned(32))); +static __m256i a_sq_p1_m1 __attribute__ ((aligned(32))); +static __m256i a_sq_p1_p1 __attribute__ ((aligned(32))); +static __m256i a_sq_p1_p3 __attribute__ ((aligned(32))); +static __m256i a_sq_p1_p5 __attribute__ ((aligned(32))); +static __m256i a_sq_p1_p7 __attribute__ ((aligned(32))); +static __m256i a_sq_p3_m7 __attribute__ ((aligned(32))); +static __m256i a_sq_p3_m5 __attribute__ ((aligned(32))); +static __m256i a_sq_p3_m3 __attribute__ ((aligned(32))); +static __m256i a_sq_p3_m1 __attribute__ ((aligned(32))); +static __m256i a_sq_p3_p1 __attribute__ ((aligned(32))); +static __m256i a_sq_p3_p3 __attribute__ ((aligned(32))); +static __m256i a_sq_p3_p5 __attribute__ ((aligned(32))); +static __m256i a_sq_p3_p7 __attribute__ ((aligned(32))); +static __m256i a_sq_p5_m7 __attribute__ ((aligned(32))); +static __m256i a_sq_p5_m5 __attribute__ ((aligned(32))); +static __m256i a_sq_p5_m3 __attribute__ ((aligned(32))); +static __m256i a_sq_p5_m1 __attribute__ ((aligned(32))); +static __m256i a_sq_p5_p1 __attribute__ ((aligned(32))); +static __m256i a_sq_p5_p3 __attribute__ ((aligned(32))); +static __m256i a_sq_p5_p5 __attribute__ ((aligned(32))); +static __m256i a_sq_p5_p7 __attribute__ ((aligned(32))); +static __m256i a_sq_p7_m7 __attribute__ ((aligned(32))); +static __m256i a_sq_p7_m5 __attribute__ ((aligned(32))); +static __m256i a_sq_p7_m3 __attribute__ ((aligned(32))); +static __m256i a_sq_p7_m1 __attribute__ ((aligned(32))); +static __m256i a_sq_p7_p1 __attribute__ ((aligned(32))); +static __m256i a_sq_p7_p3 __attribute__ ((aligned(32))); +static __m256i a_sq_p7_p5 __attribute__ ((aligned(32))); +static __m256i a_sq_p7_p7 __attribute__ ((aligned(32))); + +static __m256i bit_met_m7_m7 __attribute__ ((aligned(32))); +static __m256i bit_met_m7_m5 __attribute__ ((aligned(32))); +static __m256i bit_met_m7_m3 __attribute__ ((aligned(32))); +static __m256i bit_met_m7_m1 __attribute__ ((aligned(32))); +static __m256i bit_met_m7_p1 __attribute__ ((aligned(32))); +static __m256i bit_met_m7_p3 __attribute__ ((aligned(32))); +static __m256i bit_met_m7_p5 __attribute__ ((aligned(32))); +static __m256i bit_met_m7_p7 __attribute__ ((aligned(32))); +static __m256i bit_met_m5_m7 __attribute__ ((aligned(32))); +static __m256i bit_met_m5_m5 __attribute__ ((aligned(32))); +static __m256i bit_met_m5_m3 __attribute__ ((aligned(32))); +static __m256i bit_met_m5_m1 __attribute__ ((aligned(32))); +static __m256i bit_met_m5_p1 __attribute__ ((aligned(32))); +static __m256i bit_met_m5_p3 __attribute__ ((aligned(32))); +static __m256i bit_met_m5_p5 __attribute__ ((aligned(32))); +static __m256i bit_met_m5_p7 __attribute__ ((aligned(32))); +static __m256i bit_met_m3_m7 __attribute__ ((aligned(32))); +static __m256i bit_met_m3_m5 __attribute__ ((aligned(32))); +static __m256i bit_met_m3_m3 __attribute__ ((aligned(32))); +static __m256i bit_met_m3_m1 __attribute__ ((aligned(32))); +static __m256i bit_met_m3_p1 __attribute__ ((aligned(32))); +static __m256i bit_met_m3_p3 __attribute__ ((aligned(32))); +static __m256i bit_met_m3_p5 __attribute__ ((aligned(32))); +static __m256i bit_met_m3_p7 __attribute__ ((aligned(32))); +static __m256i bit_met_m1_m7 __attribute__ ((aligned(32))); +static __m256i bit_met_m1_m5 __attribute__ ((aligned(32))); +static __m256i bit_met_m1_m3 __attribute__ ((aligned(32))); +static __m256i bit_met_m1_m1 __attribute__ ((aligned(32))); +static __m256i bit_met_m1_p1 __attribute__ ((aligned(32))); +static __m256i bit_met_m1_p3 __attribute__ ((aligned(32))); +static __m256i bit_met_m1_p5 __attribute__ ((aligned(32))); +static __m256i bit_met_m1_p7 __attribute__ ((aligned(32))); +static __m256i bit_met_p1_m7 __attribute__ ((aligned(32))); +static __m256i bit_met_p1_m5 __attribute__ ((aligned(32))); +static __m256i bit_met_p1_m3 __attribute__ ((aligned(32))); +static __m256i bit_met_p1_m1 __attribute__ ((aligned(32))); +static __m256i bit_met_p1_p1 __attribute__ ((aligned(32))); +static __m256i bit_met_p1_p3 __attribute__ ((aligned(32))); +static __m256i bit_met_p1_p5 __attribute__ ((aligned(32))); +static __m256i bit_met_p1_p7 __attribute__ ((aligned(32))); +static __m256i bit_met_p3_m7 __attribute__ ((aligned(32))); +static __m256i bit_met_p3_m5 __attribute__ ((aligned(32))); +static __m256i bit_met_p3_m3 __attribute__ ((aligned(32))); +static __m256i bit_met_p3_m1 __attribute__ ((aligned(32))); +static __m256i bit_met_p3_p1 __attribute__ ((aligned(32))); +static __m256i bit_met_p3_p3 __attribute__ ((aligned(32))); +static __m256i bit_met_p3_p5 __attribute__ ((aligned(32))); +static __m256i bit_met_p3_p7 __attribute__ ((aligned(32))); +static __m256i bit_met_p5_m7 __attribute__ ((aligned(32))); +static __m256i bit_met_p5_m5 __attribute__ ((aligned(32))); +static __m256i bit_met_p5_m3 __attribute__ ((aligned(32))); +static __m256i bit_met_p5_m1 __attribute__ ((aligned(32))); +static __m256i bit_met_p5_p1 __attribute__ ((aligned(32))); +static __m256i bit_met_p5_p3 __attribute__ ((aligned(32))); +static __m256i bit_met_p5_p5 __attribute__ ((aligned(32))); +static __m256i bit_met_p5_p7 __attribute__ ((aligned(32))); +static __m256i bit_met_p7_m7 __attribute__ ((aligned(32))); +static __m256i bit_met_p7_m5 __attribute__ ((aligned(32))); +static __m256i bit_met_p7_m3 __attribute__ ((aligned(32))); +static __m256i bit_met_p7_m1 __attribute__ ((aligned(32))); +static __m256i bit_met_p7_p1 __attribute__ ((aligned(32))); +static __m256i bit_met_p7_p3 __attribute__ ((aligned(32))); +static __m256i bit_met_p7_p5 __attribute__ ((aligned(32))); +static __m256i bit_met_p7_p7 __attribute__ ((aligned(32))); + +static __m256i y0_p_1_1 __attribute__ ((aligned(32))); +static __m256i y0_p_1_3 __attribute__ ((aligned(32))); +static __m256i y0_p_1_5 __attribute__ ((aligned(32))); +static __m256i y0_p_1_7 __attribute__ ((aligned(32))); +static __m256i y0_p_3_1 __attribute__ ((aligned(32))); +static __m256i y0_p_3_3 __attribute__ ((aligned(32))); +static __m256i y0_p_3_5 __attribute__ ((aligned(32))); +static __m256i y0_p_3_7 __attribute__ ((aligned(32))); +static __m256i y0_p_5_1 __attribute__ ((aligned(32))); +static __m256i y0_p_5_3 __attribute__ ((aligned(32))); +static __m256i y0_p_5_5 __attribute__ ((aligned(32))); +static __m256i y0_p_5_7 __attribute__ ((aligned(32))); +static __m256i y0_p_7_1 __attribute__ ((aligned(32))); +static __m256i y0_p_7_3 __attribute__ ((aligned(32))); +static __m256i y0_p_7_5 __attribute__ ((aligned(32))); +static __m256i y0_p_7_7 __attribute__ ((aligned(32))); +static __m256i y0_m_1_1 __attribute__ ((aligned(32))); +static __m256i y0_m_1_3 __attribute__ ((aligned(32))); +static __m256i y0_m_1_5 __attribute__ ((aligned(32))); +static __m256i y0_m_1_7 __attribute__ ((aligned(32))); +static __m256i y0_m_3_1 __attribute__ ((aligned(32))); +static __m256i y0_m_3_3 __attribute__ ((aligned(32))); +static __m256i y0_m_3_5 __attribute__ ((aligned(32))); +static __m256i y0_m_3_7 __attribute__ ((aligned(32))); +static __m256i y0_m_5_1 __attribute__ ((aligned(32))); +static __m256i y0_m_5_3 __attribute__ ((aligned(32))); +static __m256i y0_m_5_5 __attribute__ ((aligned(32))); +static __m256i y0_m_5_7 __attribute__ ((aligned(32))); +static __m256i y0_m_7_1 __attribute__ ((aligned(32))); +static __m256i y0_m_7_3 __attribute__ ((aligned(32))); +static __m256i y0_m_7_5 __attribute__ ((aligned(32))); +static __m256i y0_m_7_7 __attribute__ ((aligned(32))); + +static __m256i xmm0 __attribute__ ((aligned(32))); +static __m256i xmm1 __attribute__ ((aligned(32))); +static __m256i xmm2 __attribute__ ((aligned(32))); +static __m256i xmm3 __attribute__ ((aligned(32))); +static __m256i xmm4 __attribute__ ((aligned(32))); +static __m256i xmm5 __attribute__ ((aligned(32))); +static __m256i xmm6 __attribute__ ((aligned(32))); +static __m256i xmm7 __attribute__ ((aligned(32))); +static __m256i xmm8 __attribute__ ((aligned(32))); + +static __m256i y0r __attribute__ ((aligned(32))); +static __m256i y0i __attribute__ ((aligned(32))); +static __m256i y1r __attribute__ ((aligned(32))); +static __m256i y1i __attribute__ ((aligned(32))); +static __m256i y2r __attribute__ ((aligned(32))); +static __m256i y2i __attribute__ ((aligned(32))); + +static __m256i logmax_num_re0 __attribute__ ((aligned(32))); +static __m256i logmax_den_re0 __attribute__ ((aligned(32))); + +static __m256i tmp_result __attribute__ ((aligned(32))); +static __m256i tmp_result2 __attribute__ ((aligned(32))); +static __m256i tmp_result3 __attribute__ ((aligned(32))); +static __m256i tmp_result4 __attribute__ ((aligned(32))); + +//============================================================================================== +// Auxiliary Makros + +// calculate interference magnitude +#define interference_abs_epi16(psi,int_ch_mag,int_mag,c1,c2) tmp_result = _mm256_cmpgt_epi16(int_ch_mag,psi); tmp_result2 = _mm256_xor_si256(tmp_result,(*(__m256i*)&ones256[0])); tmp_result = _mm256_and_si256(tmp_result,c1); tmp_result2 = _mm256_and_si256(tmp_result2,c2); int_mag = _mm256_or_si256(tmp_result,tmp_result2); + +// calculate interference magnitude +// tmp_result = ones in shorts corr. to interval 2<=x<=4, tmp_result2 interval < 2, tmp_result3 interval 46 +#define interference_abs_64qam_epi16(psi,int_ch_mag,int_two_ch_mag,int_three_ch_mag,a,c1,c3,c5,c7) tmp_result = _mm256_cmpgt_epi16(int_two_ch_mag,psi); tmp_result3 = _mm256_xor_si256(tmp_result,(*(__m256i*)&ones256[0])); tmp_result2 = _mm256_cmpgt_epi16(int_ch_mag,psi); tmp_result = _mm256_xor_si256(tmp_result,tmp_result2); tmp_result4 = _mm256_cmpgt_epi16(psi,int_three_ch_mag); tmp_result3 = _mm256_xor_si256(tmp_result3,tmp_result4); tmp_result = _mm256_and_si256(tmp_result,c3); tmp_result2 = _mm256_and_si256(tmp_result2,c1); tmp_result3 = _mm256_and_si256(tmp_result3,c5); tmp_result4 = _mm256_and_si256(tmp_result4,c7); tmp_result = _mm256_or_si256(tmp_result,tmp_result2); tmp_result3 = _mm256_or_si256(tmp_result3,tmp_result4); a = _mm256_or_si256(tmp_result,tmp_result3); + +// calculates psi_a = psi_r*a_r + psi_i*a_i +#define prodsum_psi_a_epi16(psi_r,a_r,psi_i,a_i,psi_a) tmp_result = _mm256_mulhi_epi16(psi_r,a_r); tmp_result = _mm256_slli_epi16(tmp_result,1); tmp_result2 = _mm256_mulhi_epi16(psi_i,a_i); tmp_result2 = _mm256_slli_epi16(tmp_result2,1); psi_a = _mm256_adds_epi16(tmp_result,tmp_result2); + +// calculates a_sq = int_ch_mag*(a_r^2 + a_i^2)*scale_factor +#define square_a_epi16(a_r,a_i,int_ch_mag,scale_factor,a_sq) tmp_result = _mm256_mulhi_epi16(a_r,a_r); tmp_result = _mm256_slli_epi16(tmp_result,1); tmp_result = _mm256_mulhi_epi16(tmp_result,scale_factor); tmp_result = _mm256_slli_epi16(tmp_result,1); tmp_result = _mm256_mulhi_epi16(tmp_result,int_ch_mag); tmp_result = _mm256_slli_epi16(tmp_result,1); tmp_result2 = _mm256_mulhi_epi16(a_i,a_i); tmp_result2 = _mm256_slli_epi16(tmp_result2,1); tmp_result2 = _mm256_mulhi_epi16(tmp_result2,scale_factor); tmp_result2 = _mm256_slli_epi16(tmp_result2,1); tmp_result2 = _mm256_mulhi_epi16(tmp_result2,int_ch_mag); tmp_result2 = _mm256_slli_epi16(tmp_result2,1); a_sq = _mm256_adds_epi16(tmp_result,tmp_result2); + +// calculates a_sq = int_ch_mag*(a_r^2 + a_i^2)*scale_factor for 64-QAM +#define square_a_64qam_epi16(a_r,a_i,int_ch_mag,scale_factor,a_sq) tmp_result = _mm256_mulhi_epi16(a_r,a_r); tmp_result = _mm256_slli_epi16(tmp_result,1); tmp_result = _mm256_mulhi_epi16(tmp_result,scale_factor); tmp_result = _mm256_slli_epi16(tmp_result,3); tmp_result = _mm256_mulhi_epi16(tmp_result,int_ch_mag); tmp_result = _mm256_slli_epi16(tmp_result,1); tmp_result2 = _mm256_mulhi_epi16(a_i,a_i); tmp_result2 = _mm256_slli_epi16(tmp_result2,1); tmp_result2 = _mm256_mulhi_epi16(tmp_result2,scale_factor); tmp_result2 = _mm256_slli_epi16(tmp_result2,3); tmp_result2 = _mm256_mulhi_epi16(tmp_result2,int_ch_mag); tmp_result2 = _mm256_slli_epi16(tmp_result2,1); a_sq = _mm256_adds_epi16(tmp_result,tmp_result2); + +void seperate_real_imag_parts(__m256i *out_re, + __m256i *out_im, + __m256i in0, + __m256i in1) +{ + __m256i tmp0; + __m256i tmp1; + + in0 = _mm256_shufflelo_epi16(in0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + in0 = _mm256_shufflehi_epi16(in0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + in0 = _mm256_shuffle_epi32(in0,0xd8); //_MM_SHUFFLE(0,2,1,3)); + + in1 = _mm256_shufflelo_epi16(in1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + in1 = _mm256_shufflehi_epi16(in1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + in1 = _mm256_shuffle_epi32(in1,0xd8); //_MM_SHUFFLE(0,2,1,3)); + + //in0 = [Re(0,1,2,3) Im(0,1,2,3) Re(4,5,6,7) Im(4,5,6,7)] + //in0 = [Re(8,9,10,11) Im(8,9,10,11) Re(12,13,14,15) Im(12,13,14,15)] + + tmp0 = _mm256_unpacklo_epi64(in0, in1); + //axmm2 = [Re(0,1,2,3) Re(8,9,10,11) Re(4,5,6,7) Re(12,13,14,15)] + tmp0 = _mm256_permute4x64_epi64(tmp0,0xd8); // Re(rho) + + tmp1 = _mm256_unpackhi_epi64(in0, in1); + //axmm3 = [Im(0,1,2,3) Im(8,9,10,11) Im(4,5,6,7) Im(12,13,14,15)] + tmp1 = _mm256_permute4x64_epi64(tmp1,0xd8); // Im(rho) + + *out_re = tmp0; + *out_im = tmp1; +} + +void qam64_qam16_avx2(short *stream0_in, + short *stream1_in, + short *ch_mag, + short *ch_mag_i, + short *stream0_out, + short *rho01, + int length + ) +{ + + /* + Author: S. Wagner + Date: 31-07-12 + + Input: + stream0_in: MF filter for 1st stream, i.e., y0=h0'*y + stream1_in: MF filter for 2nd stream, i.e., y1=h1'*y + ch_mag: 4*h0/sqrt(42), [Re0 Im0 Re1 Im1] s.t. Im0=Re0, Im1=Re1, etc + ch_mag_i: 4*h1/sqrt(42), [Re0 Im0 Re1 Im1] s.t. Im0=Re0, Im1=Re1, etc + rho01: Channel cross correlation, i.e., h1'*h0 + + Output: + stream0_out: output LLRs for 1st stream + */ + +#if defined(__x86_64__) || defined(__i386__) + + __m256i *rho01_256i = (__m256i *)rho01; + __m256i *stream0_256i_in = (__m256i *)stream0_in; + __m256i *stream1_256i_in = (__m256i *)stream1_in; + __m256i *ch_mag_256i = (__m256i *)ch_mag; + __m256i *ch_mag_256i_i = (__m256i *)ch_mag_i; + + __m256i ONE_OVER_SQRT_42 = _mm256_broadcastw_epi16(_mm_set1_epi16(10112)); // round(1/sqrt(42)*2^16) + __m256i THREE_OVER_SQRT_42 = _mm256_broadcastw_epi16(_mm_set1_epi16(30337)); // round(3/sqrt(42)*2^16) + __m256i FIVE_OVER_SQRT_42 = _mm256_broadcastw_epi16(_mm_set1_epi16(25281)); // round(5/sqrt(42)*2^15) + __m256i SEVEN_OVER_SQRT_42 = _mm256_broadcastw_epi16(_mm_set1_epi16(17697)); // round(5/sqrt(42)*2^15) + __m256i FORTYNINE_OVER_FOUR_SQRT_42 = _mm256_broadcastw_epi16(_mm_set1_epi16(30969)); // round(49/(4*sqrt(42))*2^14), Q2.14 + __m256i THIRTYSEVEN_OVER_FOUR_SQRT_42 = _mm256_broadcastw_epi16(_mm_set1_epi16(23385)); // round(37/(4*sqrt(42))*2^14), Q2.14 + __m256i TWENTYFIVE_OVER_FOUR_SQRT_42 = _mm256_broadcastw_epi16(_mm_set1_epi16(31601)); // round(25/(4*sqrt(42))*2^15) + __m256i TWENTYNINE_OVER_FOUR_SQRT_42 = _mm256_broadcastw_epi16(_mm_set1_epi16(18329)); // round(29/(4*sqrt(42))*2^15), Q2.14 + __m256i SEVENTEEN_OVER_FOUR_SQRT_42 = _mm256_broadcastw_epi16(_mm_set1_epi16(21489)); // round(17/(4*sqrt(42))*2^15) + __m256i NINE_OVER_FOUR_SQRT_42 = _mm256_broadcastw_epi16(_mm_set1_epi16(11376)); // round(9/(4*sqrt(42))*2^15) + __m256i THIRTEEN_OVER_FOUR_SQRT_42 = _mm256_broadcastw_epi16(_mm_set1_epi16(16433)); // round(13/(4*sqrt(42))*2^15) + __m256i FIVE_OVER_FOUR_SQRT_42 = _mm256_broadcastw_epi16(_mm_set1_epi16(6320)); // round(5/(4*sqrt(42))*2^15) + __m256i ONE_OVER_FOUR_SQRT_42 = _mm256_broadcastw_epi16(_mm_set1_epi16(1264)); // round(1/(4*sqrt(42))*2^15) + __m256i ONE_OVER_SQRT_10_Q15 = _mm256_broadcastw_epi16(_mm_set1_epi16(10362)); // round(1/sqrt(10)*2^15) + __m256i THREE_OVER_SQRT_10 = _mm256_broadcastw_epi16(_mm_set1_epi16(31086)); // round(3/sqrt(10)*2^15) + __m256i SQRT_10_OVER_FOUR = _mm256_broadcastw_epi16(_mm_set1_epi16(25905)); // round(sqrt(10)/4*2^15) + + + __m256i ch_mag_int; + __m256i ch_mag_des; + __m256i ch_mag_98_over_42_with_sigma2; + __m256i ch_mag_74_over_42_with_sigma2; + __m256i ch_mag_58_over_42_with_sigma2; + __m256i ch_mag_50_over_42_with_sigma2; + __m256i ch_mag_34_over_42_with_sigma2; + __m256i ch_mag_18_over_42_with_sigma2; + __m256i ch_mag_26_over_42_with_sigma2; + __m256i ch_mag_10_over_42_with_sigma2; + __m256i ch_mag_2_over_42_with_sigma2; + __m256i y0r_one_over_sqrt_21; + __m256i y0r_three_over_sqrt_21; + __m256i y0r_five_over_sqrt_21; + __m256i y0r_seven_over_sqrt_21; + __m256i y0i_one_over_sqrt_21; + __m256i y0i_three_over_sqrt_21; + __m256i y0i_five_over_sqrt_21; + __m256i y0i_seven_over_sqrt_21; + +#elif defined(__arm__) + +#endif + int i,j; + uint32_t len256 = (length)>>3; + + for (i=0; i>3; + + for (i=0; iframe_parms; + int32_t *txdataF = ue->common_vars.txdataF[ant]; + uint32_t u,v,alpha_ind; + uint32_t u0=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[subframe<<1]; + uint32_t u1=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.grouphop[1+(subframe<<1)]; + uint32_t v0=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[subframe<<1]; + uint32_t v1=frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.seqhop[1+(subframe<<1)]; + int32_t ref_re,ref_im; + uint8_t harq_pid = subframe2harq_pid(frame_parms,proc->frame_tx,subframe); + + cyclic_shift0 = (frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift + + ue->ulsch[eNB_id]->harq_processes[harq_pid]->n_DMRS2 + + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[subframe<<1]+ + ((ue->ulsch[0]->cooperation_flag==2)?10:0)+ + ant*6) % 12; + // printf("PUSCH.cyclicShift %d, n_DMRS2 %d, nPRS %d\n",frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift,ue->ulsch[eNB_id]->n_DMRS2,ue->lte_frame_parms.pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[subframe<<1]); + cyclic_shift1 = (frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift + + ue->ulsch[eNB_id]->harq_processes[harq_pid]->n_DMRS2 + + frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.nPRS[(subframe<<1)+1]+ + ((ue->ulsch[0]->cooperation_flag==2)?10:0)+ + ant*6) % 12; + + // cyclic_shift0 = 0; + // cyclic_shift1 = 0; + Msc_RS = 12*nb_rb; + + Msc_idx_ptr = (uint16_t*) bsearch(&Msc_RS, dftsizes, 33, sizeof(uint16_t), compareints); + + if (Msc_idx_ptr) + Msc_RS_idx = Msc_idx_ptr - dftsizes; + else { + LOG_I(PHY,"generate_drs_pusch: index for Msc_RS=%d not found\n",Msc_RS); + return(-1); + } + + for (l = (3 - frame_parms->Ncp),u=u0,v=v0,cyclic_shift=cyclic_shift0; + lsymbols_per_tti; + l += (7 - frame_parms->Ncp),u=u1,v=v1,cyclic_shift=cyclic_shift1) { + + drs_offset = 0; +#ifdef DEBUG_DRS + printf("drs_modulation: Msc_RS = %d, Msc_RS_idx = %d, u=%d,v=%d\n",Msc_RS, Msc_RS_idx,u,v); +#endif + + + re_offset = frame_parms->first_carrier_offset; + subframe_offset = subframe*frame_parms->symbols_per_tti*frame_parms->ofdm_symbol_size; + symbol_offset = subframe_offset + frame_parms->ofdm_symbol_size*l; + + +#ifdef DEBUG_DRS + printf("generate_drs_pusch: symbol_offset %d, subframe offset %d, cyclic shift %d\n",symbol_offset,subframe_offset,cyclic_shift); +#endif + alpha_ind = 0; + + for (rb=0; rbN_RB_UL; rb++) { + + if ((rb >= first_rb) && (rb<(first_rb+nb_rb))) { + +#ifdef DEBUG_DRS + printf("generate_drs_pusch: doing RB %d, re_offset=%d, drs_offset=%d,cyclic shift %d\n",rb,re_offset,drs_offset,cyclic_shift); +#endif + + for (k=0; k<12; k++) { + ref_re = (int32_t) ul_ref_sigs[u][v][Msc_RS_idx][drs_offset<<1]; + ref_im = (int32_t) ul_ref_sigs[u][v][Msc_RS_idx][(drs_offset<<1)+1]; + + ((int16_t*) txdataF)[2*(symbol_offset + re_offset)] = (int16_t) (((ref_re*alpha_re[alpha_ind]) - + (ref_im*alpha_im[alpha_ind]))>>15); + ((int16_t*) txdataF)[2*(symbol_offset + re_offset)+1] = (int16_t) (((ref_re*alpha_im[alpha_ind]) + + (ref_im*alpha_re[alpha_ind]))>>15); + ((short*) txdataF)[2*(symbol_offset + re_offset)] = (short) ((((short*) txdataF)[2*(symbol_offset + re_offset)]*(int32_t)amp)>>15); + ((short*) txdataF)[2*(symbol_offset + re_offset)+1] = (short) ((((short*) txdataF)[2*(symbol_offset + re_offset)+1]*(int32_t)amp)>>15); + + + alpha_ind = (alpha_ind + cyclic_shift); + + if (alpha_ind > 11) + alpha_ind-=12; + +#ifdef DEBUG_DRS + printf("symbol_offset %d, alpha_ind %d , re_offset %d : (%d,%d)\n", + symbol_offset, + alpha_ind, + re_offset, + ((short*) txdataF)[2*(symbol_offset + re_offset)], + ((short*) txdataF)[2*(symbol_offset + re_offset)+1]); + +#endif // DEBUG_DRS + re_offset++; + drs_offset++; + + if (re_offset >= frame_parms->ofdm_symbol_size) + re_offset = 0; + } + + } else { + re_offset+=12; // go to next RB + + // check if we crossed the symbol boundary and skip DC + + if (re_offset >= frame_parms->ofdm_symbol_size) { + if (frame_parms->N_RB_DL&1) // odd number of RBs + re_offset=6; + else // even number of RBs (doesn't straddle DC) + re_offset=0; + } + + + } + } + } + + return(0); +} + diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c b/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c new file mode 100644 index 0000000000..09420f48ab --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_coding.c @@ -0,0 +1,933 @@ +/* + * 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 + */ + +/*! \file PHY/LTE_TRANSPORT/ulsch_coding.c +* \brief Top-level routines for coding the ULSCH transport channel as described in 36.212 V8.6 2009-03 +* \author R. Knopp +* \date 2011 +* \version 0.1 +* \company Eurecom +* \email: knopp@eurecom.fr +* \note +* \warning +*/ + +#include "PHY/defs.h" +#include "PHY/extern.h" + +#include "PHY/CODING/defs.h" +#include "PHY/CODING/extern.h" +#include "PHY/CODING/lte_interleaver_inline.h" +#include "PHY/LTE_TRANSPORT/defs.h" +#include "defs.h" +#include "extern.h" +#include "SIMULATION/ETH_TRANSPORT/extern.h" +#include "UTIL/LOG/vcd_signal_dumper.h" + +//#define DEBUG_ULSCH_CODING +//#define DEBUG_ULSCH_FREE 1 + +/* +#define is_not_pilot(pilots,first_pilot,re) (pilots==0) || \ + ((pilots==1)&&(first_pilot==1)&&(((re>2)&&(re<6))||((re>8)&&(re<12)))) || \ + ((pilots==1)&&(first_pilot==0)&&(((re<3))||((re>5)&&(re<9)))) \ +*/ +#define is_not_pilot(pilots,first_pilot,re) (1) + + + + +void free_ue_ulsch(LTE_UE_ULSCH_t *ulsch) +{ + int i; + int r; + + if (ulsch) { +#ifdef DEBUG_ULSCH_FREE + printf("Freeing ulsch %p\n",ulsch); +#endif + + for (i=0; i<8; i++) { + if (ulsch->harq_processes[i]) { + if (ulsch->harq_processes[i]->b) { + free16(ulsch->harq_processes[i]->b,MAX_ULSCH_PAYLOAD_BYTES); + ulsch->harq_processes[i]->b = NULL; + } + for (r=0; rharq_processes[i]->c[r]) { + free16(ulsch->harq_processes[i]->c[r],((r==0)?8:0) + 3+768); + ulsch->harq_processes[i]->c[r] = NULL; + } + } + + free16(ulsch->harq_processes[i],sizeof(LTE_UL_UE_HARQ_t)); + ulsch->harq_processes[i] = NULL; + } + } + free16(ulsch,sizeof(LTE_UE_ULSCH_t)); + ulsch = NULL; + } + +} + +LTE_UE_ULSCH_t *new_ue_ulsch(unsigned char N_RB_UL, uint8_t abstraction_flag) +{ + + LTE_UE_ULSCH_t *ulsch; + unsigned char exit_flag = 0,i,j,r; + unsigned char bw_scaling =1; + + switch (N_RB_UL) { + case 6: + bw_scaling =16; + break; + + case 25: + bw_scaling =4; + break; + + case 50: + bw_scaling =2; + break; + + default: + bw_scaling =1; + break; + } + + ulsch = (LTE_UE_ULSCH_t *)malloc16(sizeof(LTE_UE_ULSCH_t)); + + if (ulsch) { + memset(ulsch,0,sizeof(LTE_UE_ULSCH_t)); + + ulsch->Mlimit = 4; + + for (i=0; i<8; i++) { + + ulsch->harq_processes[i] = (LTE_UL_UE_HARQ_t *)malloc16(sizeof(LTE_UL_UE_HARQ_t)); + + // printf("ulsch->harq_processes[%d] %p\n",i,ulsch->harq_processes[i]); + if (ulsch->harq_processes[i]) { + memset(ulsch->harq_processes[i], 0, sizeof(LTE_UL_UE_HARQ_t)); + ulsch->harq_processes[i]->b = (unsigned char*)malloc16(MAX_ULSCH_PAYLOAD_BYTES/bw_scaling); + + if (ulsch->harq_processes[i]->b) + memset(ulsch->harq_processes[i]->b,0,MAX_ULSCH_PAYLOAD_BYTES/bw_scaling); + else { + LOG_E(PHY,"Can't get b\n"); + exit_flag=1; + } + + if (abstraction_flag==0) { + for (r=0; rharq_processes[i]->c[r] = (unsigned char*)malloc16(((r==0)?8:0) + 3+768); // account for filler in first segment and CRCs for multiple segment case + + if (ulsch->harq_processes[i]->c[r]) + memset(ulsch->harq_processes[i]->c[r],0,((r==0)?8:0) + 3+768); + else { + LOG_E(PHY,"Can't get c\n"); + exit_flag=2; + } + } + } + + ulsch->harq_processes[i]->subframe_scheduling_flag = 0; + ulsch->harq_processes[i]->first_tx = 1; + } else { + LOG_E(PHY,"Can't get harq_p %d\n",i); + exit_flag=3; + } + } + + if ((abstraction_flag == 0) && (exit_flag==0)) { + for (i=0; i<8; i++) + for (j=0; j<96; j++) + for (r=0; rharq_processes[i]->d[r][j] = LTE_NULL; + + return(ulsch); + } else if (abstraction_flag==1) + return(ulsch); + } + + LOG_E(PHY,"new_ue_ulsch exit flag, size of %d , %zu\n",exit_flag, sizeof(LTE_UE_ULSCH_t)); + free_ue_ulsch(ulsch); + return(NULL); + + +} + + +uint32_t ulsch_encoding(uint8_t *a, + PHY_VARS_UE *ue, + uint8_t harq_pid, + uint8_t eNB_id, + uint8_t subframe_rx, + uint8_t tmode, + uint8_t control_only_flag, + uint8_t Nbundled) +{ + + time_stats_t *seg_stats=&ue->ulsch_segmentation_stats; + time_stats_t *rm_stats=&ue->ulsch_rate_matching_stats; + time_stats_t *te_stats=&ue->ulsch_turbo_encoding_stats; + time_stats_t *i_stats=&ue->ulsch_interleaving_stats; + time_stats_t *m_stats=&ue->ulsch_multiplexing_stats; + + // uint16_t offset; + uint32_t crc=1; + uint16_t iind; + uint32_t A; + uint8_t Q_m=0; + uint32_t Kr=0,Kr_bytes,r,r_offset=0; + uint8_t y[6*14*1200],*yptr;; + uint8_t *columnset; + uint32_t sumKr=0; + uint32_t Qprime,L,G,Q_CQI=0,Q_RI=0,Q_ACK=0,H=0,Hprime=0,Hpp=0,Cmux=0,Rmux=0,Rmux_prime=0; + uint32_t Qprime_ACK=0,Qprime_CQI=0,Qprime_RI=0,len_ACK=0,len_RI=0; + // uint32_t E; + uint8_t ack_parity; + uint32_t i,q,j,iprime,j2; + uint16_t o_RCC; + uint8_t o_flip[8]; + uint32_t wACK_idx; + LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms; + PHY_MEASUREMENTS *meas = &ue->measurements; + LTE_UE_ULSCH_t *ulsch=ue->ulsch[eNB_id]; + LTE_UE_DLSCH_t **dlsch = ue->dlsch[0][eNB_id]; + uint16_t rnti = 0xffff; + + if (!ulsch) { + LOG_E(PHY,"Null ulsch ptr %p\n",ulsch); + return(-1); + } + + if (harq_pid >= 8) { + LOG_E(PHY,"Illegal harq_pid %d\n",harq_pid); + return(-1); + } + + if (ulsch->harq_processes[harq_pid]->O_ACK > 2) { + LOG_E(PHY,"Illegal O_ACK %d\n",ulsch->harq_processes[harq_pid]->O_ACK); + return(-1); + } + + if (ulsch->O_RI > 1) { + LOG_E(PHY,"Illegal O_RI %d\n",ulsch->O_RI); + return(-1); + } + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_IN); + + // fill CQI/PMI information + if (ulsch->O>0) { + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING_FILL_CQI, VCD_FUNCTION_IN); + rnti = ue->pdcch_vars[ue->current_thread_id[subframe_rx]][eNB_id]->crnti; + fill_CQI(ulsch,meas,0,harq_pid,ue->frame_parms.N_RB_DL,rnti, tmode,ue->sinr_eff); + + LOG_D(PHY,"ULSCH Encoding rnti %x \n", rnti); + print_CQI(ulsch->o,ulsch->uci_format,0,ue->frame_parms.N_RB_DL); + + // save PUSCH pmi for later (transmission modes 4,5,6) + if (dlsch[0]) { + //LOG_I(PHY,"XXX saving pmi for DL %x\n",pmi2hex_2Ar1(((wideband_cqi_rank1_2A_5MHz *)ulsch->o)->pmi)); + dlsch[0]->pmi_alloc = ((wideband_cqi_rank1_2A_5MHz *)ulsch->o)->pmi; + } + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING_FILL_CQI, VCD_FUNCTION_OUT); + } + + if (ulsch->O<=32) { + o_flip[0] = ulsch->o[3]; + o_flip[1] = ulsch->o[2]; + o_flip[2] = ulsch->o[1]; + o_flip[3] = ulsch->o[0]; + } else { + o_flip[0] = ulsch->o[7]; + o_flip[1] = ulsch->o[6]; + o_flip[2] = ulsch->o[5]; + o_flip[3] = ulsch->o[4]; + o_flip[4] = ulsch->o[3]; + o_flip[5] = ulsch->o[2]; + o_flip[6] = ulsch->o[1]; + o_flip[7] = ulsch->o[0]; + } + + if (control_only_flag == 0) { + A=ulsch->harq_processes[harq_pid]->TBS; + Q_m = get_Qm_ul(ulsch->harq_processes[harq_pid]->mcs); + + ulsch->harq_processes[harq_pid]->control_only = 0; + +#ifdef DEBUG_ULSCH_CODING + printf("[PHY][UE] ULSCH coding : A %d, Qm %d, mcs %d, harq_pid %d, round %d, RV %d\n", + ulsch->harq_processes[harq_pid]->TBS, + Q_m, + ulsch->harq_processes[harq_pid]->mcs, + harq_pid, + ulsch->harq_processes[harq_pid]->round, + ulsch->harq_processes[harq_pid]->rvidx); + + for (i=0; iharq_processes[harq_pid]->O_ACK; i++) + printf("ulsch_coding: o_ACK[%d] %d\n",i,ulsch->o_ACK[i]); + + for (i=0; iO_RI; i++) + printf("ulsch_coding: o_RI[%d] %d\n",i,ulsch->o_RI[i]); + + printf("ulsch_coding: O=%d\n",ulsch->O); + + for (i=0; i<1+((8+ulsch->O)/8); i++) { + // ulsch->o[i] = i; + printf("ulsch_coding: O[%d] %d\n",i,ulsch->o[i]); + } + + if ((tmode != 4)) + print_CQI(ulsch->o,wideband_cqi_rank1_2A,0,ue->frame_parms.N_RB_DL); + else + print_CQI(ulsch->o,HLC_subband_cqi_rank1_2A,0,ue->frame_parms.N_RB_DL); + +#endif + + if (ulsch->harq_processes[harq_pid]->round == 0) { // this is a new packet + + start_meas(seg_stats); + // Add 24-bit crc (polynomial A) to payload + crc = crc24a(a, + A)>>8; + + a[A>>3] = ((uint8_t*)&crc)[2]; + a[1+(A>>3)] = ((uint8_t*)&crc)[1]; + a[2+(A>>3)] = ((uint8_t*)&crc)[0]; + + ulsch->harq_processes[harq_pid]->B = A+24; + ulsch->harq_processes[harq_pid]->b = a; + lte_segmentation(ulsch->harq_processes[harq_pid]->b, + ulsch->harq_processes[harq_pid]->c, + ulsch->harq_processes[harq_pid]->B, + &ulsch->harq_processes[harq_pid]->C, + &ulsch->harq_processes[harq_pid]->Cplus, + &ulsch->harq_processes[harq_pid]->Cminus, + &ulsch->harq_processes[harq_pid]->Kplus, + &ulsch->harq_processes[harq_pid]->Kminus, + &ulsch->harq_processes[harq_pid]->F); + + stop_meas(seg_stats); + + for (r=0; rharq_processes[harq_pid]->C; r++) { + if (rharq_processes[harq_pid]->Cminus) + Kr = ulsch->harq_processes[harq_pid]->Kminus; + else + Kr = ulsch->harq_processes[harq_pid]->Kplus; + + Kr_bytes = Kr>>3; + + // get interleaver index for Turbo code (lookup in Table 5.1.3-3 36-212, V8.6 2009-03, p. 13-14) + if (Kr_bytes<=64) + iind = (Kr_bytes-5); + else if (Kr_bytes <=128) + iind = 59 + ((Kr_bytes-64)>>1); + else if (Kr_bytes <= 256) + iind = 91 + ((Kr_bytes-128)>>2); + else if (Kr_bytes <= 768) + iind = 123 + ((Kr_bytes-256)>>3); + else { + LOG_E(PHY,"ulsch_coding: Illegal codeword size %d!!!\n",Kr_bytes); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT); + return(-1); + } + + +#ifdef DEBUG_ULSCH_CODING + printf("Generating Code Segment %d (%d bits)\n",r,Kr); + // generate codewords + + printf("bits_per_codeword (Kr)= %d\n",Kr); + printf("N_RB = %d\n",ulsch->harq_processes[harq_pid]->nb_rb); + printf("Ncp %d\n",frame_parms->Ncp); + printf("Qm %d\n",Q_m); +#endif + + // offset=0; + + +#ifdef DEBUG_ULSCH_CODING + printf("Encoding ... iind %d f1 %d, f2 %d\n",iind,f1f2mat_old[iind*2],f1f2mat_old[(iind*2)+1]); +#endif + start_meas(te_stats); + encoder(ulsch->harq_processes[harq_pid]->c[r], + Kr>>3, + &ulsch->harq_processes[harq_pid]->d[r][96], + (r==0) ? ulsch->harq_processes[harq_pid]->F : 0, + f1f2mat_old[iind*2], // f1 (see 36212-820, page 14) + f1f2mat_old[(iind*2)+1] // f2 (see 36212-820, page 14) + ); + stop_meas(te_stats); +#ifdef DEBUG_ULSCH_CODING + + if (r==0) + write_output("enc_output0.m","enc0",&ulsch->harq_processes[harq_pid]->d[r][96],(3*8*Kr_bytes)+12,1,4); + +#endif + start_meas(i_stats); + ulsch->harq_processes[harq_pid]->RTC[r] = + sub_block_interleaving_turbo(4+(Kr_bytes*8), + &ulsch->harq_processes[harq_pid]->d[r][96], + ulsch->harq_processes[harq_pid]->w[r]); + stop_meas(i_stats); + } + + } + + if (ulsch->harq_processes[harq_pid]->C == 0) { + LOG_E(PHY,"null segment\n"); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT); + return(-1); + } + + sumKr = 0; + + for (r=0; rharq_processes[harq_pid]->C; r++) { + if (rharq_processes[harq_pid]->Cminus) + Kr = ulsch->harq_processes[harq_pid]->Kminus; + else + Kr = ulsch->harq_processes[harq_pid]->Kplus; + + sumKr += Kr; + } + } else { // This is a control-only PUSCH, set sumKr to O_CQI-MIN + ulsch->harq_processes[harq_pid]->control_only = 1; + sumKr = ulsch->O_CQI_MIN; + } + + ulsch->harq_processes[harq_pid]->sumKr = sumKr; + // Compute Q_ri (p. 23 36-212) + + Qprime = ulsch->O_RI*ulsch->harq_processes[harq_pid]->Msc_initial*ulsch->harq_processes[harq_pid]->Nsymb_initial * ulsch->beta_offset_ri_times8; + + if (Qprime > 0) { + if ((Qprime % (8*sumKr)) > 0) + Qprime = 1+(Qprime/(8*sumKr)); + else + Qprime = Qprime/(8*sumKr); + + if (Qprime > 4*ulsch->harq_processes[harq_pid]->nb_rb * 12) + Qprime = 4*ulsch->harq_processes[harq_pid]->nb_rb * 12; + } + + Q_RI = Q_m*Qprime; + Qprime_RI = Qprime; + + // Compute Q_ack (p. 23 36-212) + Qprime = ulsch->harq_processes[harq_pid]->O_ACK*ulsch->harq_processes[harq_pid]->Msc_initial*ulsch->harq_processes[harq_pid]->Nsymb_initial * ulsch->beta_offset_harqack_times8; + + if (Qprime > 0) { + if ((Qprime % (8*sumKr)) > 0) + Qprime = 1+(Qprime/(8*sumKr)); + else + Qprime = Qprime/(8*sumKr); + + if (Qprime > 4*ulsch->harq_processes[harq_pid]->nb_rb * 12) + Qprime = 4*ulsch->harq_processes[harq_pid]->nb_rb * 12; + } + + Q_ACK = Qprime * Q_m; + Qprime_ACK = Qprime; + + LOG_D(PHY,"UE (%x/%d) O_ACK %d, Mcs_initial %d, Nsymb_initial %d, beta_offset_harqack*8 %d, sum Kr %d, Qprime_ACK %d, Q_ACK %d\n", + rnti, harq_pid, + ulsch->harq_processes[harq_pid]->O_ACK, + ulsch->harq_processes[harq_pid]->Msc_initial, + ulsch->harq_processes[harq_pid]->Nsymb_initial, + ulsch->beta_offset_harqack_times8, + sumKr, + Qprime_ACK, + Q_ACK); + + // Compute Q_cqi, assume O>11, p. 26 36-212 + if (control_only_flag == 0) { + + if (ulsch->O < 12) + L=0; + else + L=8; + + if (ulsch->O > 0) + Qprime = (ulsch->O + L) * ulsch->harq_processes[harq_pid]->Msc_initial*ulsch->harq_processes[harq_pid]->Nsymb_initial * ulsch->beta_offset_cqi_times8; + else + Qprime = 0; + + if (Qprime > 0) { + if ((Qprime % (8*sumKr)) > 0) + Qprime = 1+(Qprime/(8*sumKr)); + else + Qprime = Qprime/(8*sumKr); + } + + G = ulsch->harq_processes[harq_pid]->nb_rb * (12 * Q_m) * (ulsch->Nsymb_pusch); + + if (Qprime > (G - ulsch->O_RI)) + Qprime = G - ulsch->O_RI; + + Q_CQI = Q_m * Qprime; + Qprime_CQI = Qprime; + + + + G = G - Q_RI - Q_CQI; + ulsch->harq_processes[harq_pid]->G = G; + +/* + LOG_I(PHY,"ULSCH Encoding G %d, Q_RI %d (O_RI%d, Msc_initial %d, Nsymb_initial%d, beta_offset_ri_times8 %d), Q_CQI %d, Q_ACK %d \n",G,Q_RI,ulsch->O_RI,ulsch->harq_processes[harq_pid]->Msc_initial,ulsch->harq_processes[harq_pid]->Nsymb_initial,ulsch->beta_offset_ri_times8,Q_CQI,Q_ACK); + + LOG_I(PHY,"ULSCH Encoding (Nid_cell %d, rnti %x): harq_pid %d round %d, RV %d, mcs %d, O_RI %d, O_ACK %d, G %d\n", + frame_parms->Nid_cell,ulsch->rnti, + harq_pid, + ulsch->harq_processes[harq_pid]->round, + ulsch->harq_processes[harq_pid]->rvidx, + ulsch->harq_processes[harq_pid]->mcs, + ulsch->O_RI, + ulsch->harq_processes[harq_pid]->O_ACK, + G); +*/ + + if ((int)G < 0) { + LOG_E(PHY,"FATAL: ulsch_coding.c G < 0 (%d) : Q_RI %d, Q_CQI %d, O %d, betaCQI_times8 %d)\n",G,Q_RI,Q_CQI,ulsch->O,ulsch->beta_offset_cqi_times8); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT); + return(-1); + } + + + // Data and control multiplexing (5.2.2.7 36-212) + + H = G + Q_CQI; + Hprime = H/Q_m; + + + + // Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the + // outputs for each code segment, see Section 5.1.5 p.20 + + for (r=0; rharq_processes[harq_pid]->C; r++) { +#ifdef DEBUG_ULSCH_CODING + printf("Rate Matching, Code segment %d (coded bits (G) %d,unpunctured/repeated bits per code segment %d,mod_order %d, nb_rb %d)...\n", + r, + G, + Kr*3, + Q_m,ulsch->harq_processes[harq_pid]->nb_rb); +#endif + + start_meas(rm_stats); + r_offset += lte_rate_matching_turbo(ulsch->harq_processes[harq_pid]->RTC[r], + G, + ulsch->harq_processes[harq_pid]->w[r], + ulsch->e+r_offset, + ulsch->harq_processes[harq_pid]->C, // C + NSOFT, // Nsoft, + 0, // this means UL + 1, + ulsch->harq_processes[harq_pid]->rvidx, + get_Qm_ul(ulsch->harq_processes[harq_pid]->mcs), + 1, + r, + ulsch->harq_processes[harq_pid]->nb_rb); + //ulsch->harq_processes[harq_pid]->mcs); // r + stop_meas(rm_stats); +#ifdef DEBUG_ULSCH_CODING + + if (r==ulsch->harq_processes[harq_pid]->C-1) + write_output("enc_output.m","enc",ulsch->e,r_offset,1,4); + +#endif + } + } else { //control-only PUSCH + Q_CQI = (ulsch->harq_processes[harq_pid]->nb_rb * (12 * Q_m) * (ulsch->Nsymb_pusch)) - Q_RI; + H = Q_CQI; + Hprime = H/Q_m; + } + + + // Do CQI coding + if ((ulsch->O>1) && (ulsch->O < 12)) { + LOG_E(PHY,"short CQI sizes not supported yet\n"); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT); + return(-1); + } else { + // add 8-bit CRC + crc = crc8(o_flip, + ulsch->O)>>24; +#ifdef DEBUG_ULSCH_CODING + printf("crc(cqi) tx : %x\n",crc); +#endif + memset((void *)&ulsch->o_d[0],LTE_NULL,96); + + ccodelte_encode(ulsch->O, + 1, + o_flip, + &ulsch->o_d[96], + 0); + + + o_RCC = sub_block_interleaving_cc(8+ulsch->O, + &ulsch->o_d[96], + ulsch->o_w); + + lte_rate_matching_cc(o_RCC, + Q_CQI, + ulsch->o_w, + ulsch->q); + + } + + i=0; + + // Do RI coding + if (ulsch->O_RI == 1) { + switch (Q_m) { + case 2: + ulsch->q_RI[0] = ulsch->o_RI[0]; + ulsch->q_RI[1] = PUSCH_y;//ulsch->o_RI[0]; + len_RI=2; + break; + + case 4: + ulsch->q_RI[0] = ulsch->o_RI[0]; + ulsch->q_RI[1] = PUSCH_y;//1; + ulsch->q_RI[2] = PUSCH_x;//ulsch->o_RI[0]; + ulsch->q_RI[3] = PUSCH_x;//1; + len_RI=4; + break; + + case 6: + ulsch->q_RI[0] = ulsch->o_RI[0]; + ulsch->q_RI[1] = PUSCH_y;//1; + ulsch->q_RI[2] = PUSCH_x;//1; + ulsch->q_RI[3] = PUSCH_x;//ulsch->o_RI[0]; + ulsch->q_RI[4] = PUSCH_x;//1; + ulsch->q_RI[5] = PUSCH_x;//1; + len_RI=6; + break; + } + } else if (ulsch->O_RI>1) { + LOG_E(PHY,"RI cannot be more than 1 bit yet\n"); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT); + return(-1); + } + + // Do ACK coding, Section 5.2.2.6 36.213 (p.23-24 in v8.6) + wACK_idx = (ulsch->bundling==0) ? 4 : ((Nbundled-1)&3); +#ifdef DEBUG_ULSCH_CODING + printf("ulsch_coding.c: Bundling %d, Nbundled %d, wACK_idx %d\n", + ulsch->bundling,Nbundled,wACK_idx); +#endif + + // 1-bit ACK/NAK + if (ulsch->harq_processes[harq_pid]->O_ACK == 1) { + switch (Q_m) { + case 2: + ulsch->q_ACK[0] = (ulsch->o_ACK[0]+wACK[wACK_idx][0])&1; + ulsch->q_ACK[1] = (ulsch->bundling==0)? PUSCH_y : ((ulsch->o_ACK[0]+wACK[wACK_idx][1])&1);//ulsch->o_ACK[0]; + len_ACK = 2; + break; + + case 4: + ulsch->q_ACK[0] = (ulsch->o_ACK[0]+wACK[wACK_idx][0])&1; + ulsch->q_ACK[1] = (ulsch->bundling==0)? PUSCH_y : ((ulsch->o_ACK[0]+wACK[wACK_idx][1])&1); + ulsch->q_ACK[2] = PUSCH_x; + ulsch->q_ACK[3] = PUSCH_x; + len_ACK = 4; + break; + + case 6: + ulsch->q_ACK[0] = (ulsch->o_ACK[0]+wACK[wACK_idx][0])&1; + ulsch->q_ACK[1] = (ulsch->bundling==0)? PUSCH_y : ((ulsch->o_ACK[0]+wACK[wACK_idx][1])&1); + ulsch->q_ACK[2] = PUSCH_x; + ulsch->q_ACK[3] = PUSCH_x; + ulsch->q_ACK[4] = PUSCH_x; + ulsch->q_ACK[6] = PUSCH_x; + len_ACK = 6; + break; + } + } + + // two-bit ACK/NAK + if (ulsch->harq_processes[harq_pid]->O_ACK == 2) { + ack_parity = (ulsch->o_ACK[0]+ulsch->o_ACK[1])&1; + + switch (Q_m) { + case 2: + ulsch->q_ACK[0] = (ulsch->o_ACK[0]+wACK[wACK_idx][0])&1; + ulsch->q_ACK[1] = (ulsch->o_ACK[1]+wACK[wACK_idx][0])&1; + ulsch->q_ACK[2] = (ack_parity+wACK[wACK_idx][0])&1; + ulsch->q_ACK[3] = (ulsch->o_ACK[0]+wACK[wACK_idx][1])&1; + ulsch->q_ACK[4] = (ulsch->o_ACK[1]+wACK[wACK_idx][1])&1; + ulsch->q_ACK[5] = (ack_parity+wACK[wACK_idx][1])&1; + len_ACK = 6; + break; + + case 4: + ulsch->q_ACK[0] = (ulsch->o_ACK[0]+wACK[wACK_idx][0])&1; + ulsch->q_ACK[1] = (ulsch->o_ACK[1]+wACK[wACK_idx][0])&1; + ulsch->q_ACK[2] = PUSCH_x; + ulsch->q_ACK[3] = PUSCH_x;//1; + ulsch->q_ACK[4] = (ack_parity+wACK[wACK_idx][0])&1; + ulsch->q_ACK[5] = (ulsch->o_ACK[0]+wACK[wACK_idx][1])&1; + ulsch->q_ACK[6] = PUSCH_x; + ulsch->q_ACK[7] = PUSCH_x;//1; + ulsch->q_ACK[8] = (ulsch->o_ACK[1]+wACK[wACK_idx][1])&1; + ulsch->q_ACK[9] = (ack_parity+wACK[wACK_idx][1])&1; + ulsch->q_ACK[10] = PUSCH_x; + ulsch->q_ACK[11] = PUSCH_x;//1; + len_ACK = 12; + break; + + case 6: + ulsch->q_ACK[0] = (ulsch->o_ACK[0]+wACK[wACK_idx][0])&1; + ulsch->q_ACK[1] = (ulsch->o_ACK[1]+wACK[wACK_idx][0])&1; + ulsch->q_ACK[2] = PUSCH_x; + ulsch->q_ACK[3] = PUSCH_x; + ulsch->q_ACK[4] = PUSCH_x; + ulsch->q_ACK[5] = PUSCH_x; + + ulsch->q_ACK[6] = (ack_parity+wACK[wACK_idx][0])&1; + ulsch->q_ACK[7] = (ulsch->o_ACK[0]+wACK[wACK_idx][1])&1; + ulsch->q_ACK[8] = PUSCH_x; + ulsch->q_ACK[9] = PUSCH_x; + ulsch->q_ACK[10] = PUSCH_x; + ulsch->q_ACK[11] = PUSCH_x; + + ulsch->q_ACK[12] = (ulsch->o_ACK[1]+wACK[wACK_idx][1])&1; + ulsch->q_ACK[13] = (ack_parity+wACK[wACK_idx][1])&1; + ulsch->q_ACK[14] = PUSCH_x; + ulsch->q_ACK[15] = PUSCH_x; + ulsch->q_ACK[16] = PUSCH_x; + ulsch->q_ACK[17] = PUSCH_x; + len_ACK = 18; + + break; + } + } + + if (ulsch->harq_processes[harq_pid]->O_ACK > 2) { + LOG_E(PHY,"ACK cannot be more than 2 bits yet\n"); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT); + return(-1); + } + + + // channel multiplexing/interleaving + + start_meas(m_stats); + Hpp = Hprime + Q_RI; + + Cmux = ulsch->Nsymb_pusch; + Rmux = Hpp*Q_m/Cmux; + Rmux_prime = Rmux/Q_m; + + Qprime_RI = Q_RI / Q_m; + Qprime_ACK = Q_ACK / Q_m; + Qprime_CQI = Q_CQI / Q_m; + + // printf("Qprime_CQI = %d\n",Qprime_CQI); + // RI BITS + + memset(y,LTE_NULL,Q_m*Hpp); + + if (frame_parms->Ncp == 0) + columnset = cs_ri_normal; + else + columnset = cs_ri_extended; + + j=0; + + for (i=0; i>2); + + for (q=0; qq_RI[(q+(Q_m*i))%len_RI]; + // printf("ri[%d] %d => y[%d]\n",q+(Q_m*i)%len_RI,ulsch->q_RI[(q+(Q_m*i))%len_RI],q+(Q_m*((r*Cmux) + columnset[j])),y[q+(Q_m*((r*Cmux) + columnset[j]))]); + } + + j=(j+3)&3; + + } + + + // CQI and Data bits + j=0; + /* + for (i=0,iprime=-Qprime_CQI;iq[q+(Q_m*i)]; + //printf("cqi[%d] %d => y[%d]\n",q+(Q_m*i),ulsch->q[q+(Q_m*i)],q+(Q_m*j)); + } + } + else { + for (q=0;qe[q+(Q_m*iprime)]; + // printf("e[%d] %d => y[%d]\n",q+(Q_m*iprime),ulsch->e[q+(Q_m*iprime)],q+(Q_m*j)); + } + } + j++; + } + */ + + for (i=0; iq[q+(Q_m*i)]; + // printf("cqi[%d] %d => y[%d] (j %d)\n",q+(Q_m*i),ulsch->q[q+(Q_m*i)],q+(Q_m*j),j); + } + + j++; + } + + j2 = j*Q_m; + + switch (Q_m) { + + case 2: + + for (iprime=0; iprime<(Hprime-Qprime_CQI)<<1; iprime+=2) { + while (y[j2] != LTE_NULL) j2+=2; + + y[j2] = ulsch->e[iprime]; + y[1+j2] = ulsch->e[1+iprime]; + j2+=2; + } + + break; + + case 4: + for (iprime=0; iprime<(Hprime-Qprime_CQI)<<2; iprime+=4) { + while (y[j2] != LTE_NULL) j2+=4; + + y[j2] = ulsch->e[iprime]; + y[1+j2] = ulsch->e[1+iprime]; + y[2+j2] = ulsch->e[2+iprime]; + y[3+j2] = ulsch->e[3+iprime]; + j2+=4; + } + + break; + + case 6: + for (iprime=0; iprime<(Hprime-Qprime_CQI)*6; iprime+=6) { + while (y[j2] != LTE_NULL) j2+=6; + + y[j2] = ulsch->e[iprime]; + y[1+j2] = ulsch->e[1+iprime]; + y[2+j2] = ulsch->e[2+iprime]; + y[3+j2] = ulsch->e[3+iprime]; + y[4+j2] = ulsch->e[4+iprime]; + y[5+j2] = ulsch->e[5+iprime]; + j2+=6; + } + + break; + + } + + // HARQ-ACK Bits (Note these overwrite some bits) + + if (frame_parms->Ncp == 0) + columnset = cs_ack_normal; + else + columnset = cs_ack_extended; + + j=0; + + for (i=0; i>2); + + for (q=0; qq_ACK[(q+(Q_m*i))%len_ACK]; +#ifdef DEBUG_ULSCH_CODING + printf("ulsch_coding.c: ACK %d => y[%d]=%d (i %d, r*Cmux %d, columnset %d)\n",q+(Q_m*i), + q+(Q_m*((r*Cmux) + columnset[j])),ulsch->q_ACK[(q+(Q_m*i))%len_ACK], + i,r*Cmux,columnset[j]); +#endif + } + + j=(j+3)&3; + + } + + // write out buffer + j=0; + + switch (Q_m) { + case 2: + for (i=0; ih[j++] = *yptr++; + ulsch->h[j++] = *yptr++; + } + + break; + + case 4: + for (i=0; ih[j++] = *yptr++; + ulsch->h[j++] = *yptr++; + ulsch->h[j++] = *yptr++; + ulsch->h[j++] = *yptr++; + } + + break; + + case 6: + for (i=0; ih[j++] = *yptr++; + ulsch->h[j++] = *yptr++; + ulsch->h[j++] = *yptr++; + ulsch->h[j++] = *yptr++; + ulsch->h[j++] = *yptr++; + ulsch->h[j++] = *yptr++; + } + + break; + + default: + break; + } + + stop_meas(m_stats); + + if (j!=(H+Q_RI)) { + LOG_E(PHY,"Error in output buffer length (j %d, H+Q_RI %d)\n",j,H+Q_RI); + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT); + return(-1); + } + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_ENCODING, VCD_FUNCTION_OUT); + return(0); +} + diff --git a/openair1/PHY/LTE_TRANSPORT/ulsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/ulsch_modulation.c new file mode 100644 index 0000000000..d1718f6e90 --- /dev/null +++ b/openair1/PHY/LTE_TRANSPORT/ulsch_modulation.c @@ -0,0 +1,777 @@ +/* + * 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 + */ + +/*! \file PHY/LTE_TRANSPORT/ulsch_modulation.c +* \brief Top-level routines for generating PUSCH physical channel from 36.211 V8.6 2009-03 +* \author R. Knopp, F. Kaltenberger, A. Bhamri +* \date 2011 +* \version 0.1 +* \company Eurecom +* \email: knopp@eurecom.fr,florian.kaltenberger@eurecom.fr,ankit.bhamri@eurecom.fr +* \note +* \warning +*/ +#include "PHY/defs.h" +#include "PHY/extern.h" +#include "PHY/CODING/defs.h" +#include "PHY/CODING/extern.h" +#include "PHY/LTE_TRANSPORT/defs.h" +#include "defs.h" +#include "UTIL/LOG/vcd_signal_dumper.h" + + + +//#define DEBUG_ULSCH_MODULATION + +#ifndef OFDMA_ULSCH +void dft_lte(int32_t *z,int32_t *d, int32_t Msc_PUSCH, uint8_t Nsymb) +{ + +#if defined(__x86_64__) || defined(__i386__) + __m128i dft_in128[4][1200],dft_out128[4][1200]; +#elif defined(__arm__) + int16x8_t dft_in128[4][1200],dft_out128[4][1200]; +#endif + uint32_t *dft_in0=(uint32_t*)dft_in128[0],*dft_out0=(uint32_t*)dft_out128[0]; + uint32_t *dft_in1=(uint32_t*)dft_in128[1],*dft_out1=(uint32_t*)dft_out128[1]; + uint32_t *dft_in2=(uint32_t*)dft_in128[2],*dft_out2=(uint32_t*)dft_out128[2]; + // uint32_t *dft_in3=(uint32_t*)dft_in128[3],*dft_out3=(uint32_t*)dft_out128[3]; + + uint32_t *d0,*d1,*d2,*d3,*d4,*d5,*d6,*d7,*d8,*d9,*d10,*d11; + + uint32_t *z0,*z1,*z2,*z3,*z4,*z5,*z6,*z7,*z8,*z9,*z10,*z11; + uint32_t i,ip; +#if defined(__x86_64__) || defined(__i386__) + __m128i norm128; +#elif defined(__arm__) + int16x8_t norm128; +#endif + // printf("Doing lte_dft for Msc_PUSCH %d\n",Msc_PUSCH); + + d0 = (uint32_t *)d; + d1 = d0+Msc_PUSCH; + d2 = d1+Msc_PUSCH; + d3 = d2+Msc_PUSCH; + d4 = d3+Msc_PUSCH; + d5 = d4+Msc_PUSCH; + d6 = d5+Msc_PUSCH; + d7 = d6+Msc_PUSCH; + d8 = d7+Msc_PUSCH; + d9 = d8+Msc_PUSCH; + d10 = d9+Msc_PUSCH; + d11 = d10+Msc_PUSCH; + + // printf("symbol 0 (d0 %p, d %p)\n",d0,d); + for (i=0,ip=0; itdd_config,subframe); + uint8_t harq_pid = subframe2harq_pid(frame_parms,frame,subframe); + uint8_t Q_m; + int32_t *txptr; + uint32_t symbol_offset; + uint16_t first_rb; + uint16_t nb_rb; + int G; + + uint32_t x1, x2, s=0; + uint8_t c; + + if (!ulsch) { + printf("ulsch_modulation.c: Null ulsch\n"); + return; + } + + // x1 is set in lte_gold_generic + x2 = (ulsch->rnti<<14) + (subframe<<9) + frame_parms->Nid_cell; //this is c_init in 36.211 Sec 6.3.1 + + if (harq_pid>=8) { + printf("ulsch_modulation.c: Illegal harq_pid %d\n",harq_pid); + return; + } + + first_rb = ulsch->harq_processes[harq_pid]->first_rb; + nb_rb = ulsch->harq_processes[harq_pid]->nb_rb; + + if (nb_rb == 0) { + printf("ulsch_modulation.c: Frame %d, Subframe %d Illegal nb_rb %d\n",frame,subframe,nb_rb); + return; + } + + if (first_rb > frame_parms->N_RB_UL) { + printf("ulsch_modulation.c: Frame %d, Subframe %d Illegal first_rb %d\n",frame,subframe,first_rb); + return; + } + + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_MODULATION, VCD_FUNCTION_IN); + + Q_m = get_Qm_ul(ulsch->harq_processes[harq_pid]->mcs); + + G = (int)ulsch->harq_processes[harq_pid]->nb_rb * (12 * Q_m) * (ulsch->Nsymb_pusch); + + + // Mapping + nsymb = (frame_parms->Ncp==0) ? 14:12; + Msc_PUSCH = ulsch->harq_processes[harq_pid]->nb_rb*12; + +#ifdef DEBUG_ULSCH_MODULATION + LOG_D(PHY,"ulsch_modulation.c: Doing modulation (rnti %x,x2 %x) for G=%d bits, harq_pid %d , nb_rb %d, Q_m %d, Nsymb_pusch %d (nsymb %d), subframe %d\n", + ulsch->rnti,x2,G,harq_pid,ulsch->harq_processes[harq_pid]->nb_rb,Q_m, ulsch->Nsymb_pusch,nsymb,subframe); +#endif + + // scrambling (Note the placeholding bits are handled in ulsch_coding.c directly!) + //printf("ulsch bits: "); + s = lte_gold_generic(&x1, &x2, 1); + k=0; + + //printf("G %d\n",G); + for (i=0; i<(1+(G>>5)); i++) { + for (j=0; j<32; j++,k++) { + c = (uint8_t)((s>>j)&1); + + if (ulsch->h[k] == PUSCH_x) { + // printf("i %d: PUSCH_x\n",i); + ulsch->b_tilde[k] = 1; + } else if (ulsch->h[k] == PUSCH_y) { + // printf("i %d: PUSCH_y\n",i); + ulsch->b_tilde[k] = ulsch->b_tilde[k-1]; + } else { + ulsch->b_tilde[k] = (ulsch->h[k]+c)&1; + // printf("i %d : %d (h %d c %d)\n", (i<<5)+j,ulsch->b_tilde[k],ulsch->h[k],c); + } + + } + + s = lte_gold_generic(&x1, &x2, 0); + } + + //printf("\n"); + + + gain_lin_QPSK = (short)((amp*ONE_OVER_SQRT2_Q15)>>15); + + + // Modulation + + Msymb = G/Q_m; + + if(ulsch->cooperation_flag == 2) + // For Distributed Alamouti Scheme in Collabrative Communication + { + for (i=0,j=Q_m; id[i])[0] = (ulsch->b_tilde[j] == 1) ? (gain_lin_QPSK) : -gain_lin_QPSK; + ((int16_t*)&ulsch->d[i])[1] = (ulsch->b_tilde[j+1] == 1)? (-gain_lin_QPSK) : gain_lin_QPSK; + // if (id[i],((int16_t*)&ulsch->d[i])[0],((int16_t*)&ulsch->d[i])[1]); + + // UE1, x0* + ((int16_t*)&ulsch->d[i+1])[0] = (ulsch->b_tilde[j-2] == 1) ? (-gain_lin_QPSK) : gain_lin_QPSK; + ((int16_t*)&ulsch->d[i+1])[1] = (ulsch->b_tilde[j-1] == 1)? (gain_lin_QPSK) : -gain_lin_QPSK; + + break; + + case 4: + + + //UE1,-x1* + qam16_table_offset_re = 0; + qam16_table_offset_im = 0; + + if (ulsch->b_tilde[j] == 1) + qam16_table_offset_re+=2; + + if (ulsch->b_tilde[j+1] == 1) + qam16_table_offset_im+=2; + + + + if (ulsch->b_tilde[j+2] == 1) + qam16_table_offset_re+=1; + + if (ulsch->b_tilde[j+3] == 1) + qam16_table_offset_im+=1; + + + ((int16_t*)&ulsch->d[i])[0]=-(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); + ((int16_t*)&ulsch->d[i])[1]=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); + + //UE1,x0* + qam16_table_offset_re = 0; + qam16_table_offset_im = 0; + + if (ulsch->b_tilde[j-4] == 1) + qam16_table_offset_re+=2; + + if (ulsch->b_tilde[j-3] == 1) + qam16_table_offset_im+=2; + + + if (ulsch->b_tilde[j-2] == 1) + qam16_table_offset_re+=1; + + if (ulsch->b_tilde[j-1] == 1) + qam16_table_offset_im+=1; + + + // ((int16_t*)&ulsch->d[i+1])[0]=-(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); + // ((int16_t*)&ulsch->d[i+1])[1]=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); + ((int16_t*)&ulsch->d[i+1])[0]=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); + ((int16_t*)&ulsch->d[i+1])[1]=-(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); + + + break; + + case 6: + + + + //UE1,-x1*FPGA_UE + qam64_table_offset_re = 0; + qam64_table_offset_im = 0; + + if (ulsch->b_tilde[j] == 1) + qam64_table_offset_re+=4; + + if (ulsch->b_tilde[j+1] == 1) + qam64_table_offset_im+=4; + + if (ulsch->b_tilde[j+2] == 1) + qam64_table_offset_re+=2; + + + if (ulsch->b_tilde[j+3] == 1) + qam64_table_offset_im+=2; + + if (ulsch->b_tilde[j+4] == 1) + qam64_table_offset_re+=1; + + if (ulsch->b_tilde[j+5] == 1) + qam64_table_offset_im+=1; + + + ((int16_t*)&ulsch->d[i])[0]=-(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); + ((int16_t*)&ulsch->d[i])[1]=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); + + //UE1,x0* + qam64_table_offset_re = 0; + qam64_table_offset_im = 0; + + if (ulsch->b_tilde[j-6] == 1) + qam64_table_offset_re+=4; + + if (ulsch->b_tilde[j-5] == 1) + qam64_table_offset_im+=4; + + if (ulsch->b_tilde[j-4] == 1) + qam64_table_offset_re+=2; + + + if (ulsch->b_tilde[j-3] == 1) + qam64_table_offset_im+=2; + + if (ulsch->b_tilde[j-2] == 1) + qam64_table_offset_re+=1; + + if (ulsch->b_tilde[j-1] == 1) + qam64_table_offset_im+=1; + + + ((int16_t*)&ulsch->d[i+1])[0]=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); + ((int16_t*)&ulsch->d[i+1])[1]=-(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); + + break; + + }//switch + }//for + }//cooperation_flag == 2 + else { + for (i=0,j=0; id[i])[0] = (ulsch->b_tilde[j] == 1) ? (-gain_lin_QPSK) : gain_lin_QPSK; + ((int16_t*)&ulsch->d[i])[1] = (ulsch->b_tilde[j+1] == 1)? (-gain_lin_QPSK) : gain_lin_QPSK; + // if (id[i],((int16_t*)&ulsch->d[i])[0],((int16_t*)&ulsch->d[i])[1]); + + break; + + case 4: + + qam16_table_offset_re = 0; + qam16_table_offset_im = 0; + + if (ulsch->b_tilde[j] == 1) + qam16_table_offset_re+=2; + + if (ulsch->b_tilde[j+1] == 1) + qam16_table_offset_im+=2; + + if (ulsch->b_tilde[j+2] == 1) + qam16_table_offset_re+=1; + + if (ulsch->b_tilde[j+3] == 1) + qam16_table_offset_im+=1; + + + ((int16_t*)&ulsch->d[i])[0]=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_re])>>15); + ((int16_t*)&ulsch->d[i])[1]=(int16_t)(((int32_t)amp*qam16_table[qam16_table_offset_im])>>15); + // printf("input(16qam) %d (%p): %d,%d\n", i,&ulsch->d[i],((int16_t*)&ulsch->d[i])[0],((int16_t*)&ulsch->d[i])[1]); + break; + + case 6: + + + qam64_table_offset_re = 0; + qam64_table_offset_im = 0; + + if (ulsch->b_tilde[j] == 1) + qam64_table_offset_re+=4; + + if (ulsch->b_tilde[j+1] == 1) + qam64_table_offset_im+=4; + + if (ulsch->b_tilde[j+2] == 1) + qam64_table_offset_re+=2; + + if (ulsch->b_tilde[j+3] == 1) + qam64_table_offset_im+=2; + + if (ulsch->b_tilde[j+4] == 1) + qam64_table_offset_re+=1; + + if (ulsch->b_tilde[j+5] == 1) + qam64_table_offset_im+=1; + + + ((int16_t*)&ulsch->d[i])[0]=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_re])>>15); + ((int16_t*)&ulsch->d[i])[1]=(int16_t)(((int32_t)amp*qam64_table[qam64_table_offset_im])>>15); + + break; + + } + } + }// normal symbols + + + // Transform Precoding + +#ifdef OFDMA_ULSCH + + for (i=0; iz[i] = ulsch->d[i]; + } + +#else + dft_lte(ulsch->z,ulsch->d,Msc_PUSCH,ulsch->Nsymb_pusch); +#endif + + DevAssert(txdataF); + +#ifdef OFDMA_ULSCH + re_offset0 = frame_parms->first_carrier_offset + (ulsch->harq_processes[harq_pid]->first_rb*12); + + if (re_offset0>frame_parms->ofdm_symbol_size) { + re_offset0 -= frame_parms->ofdm_symbol_size; + // re_offset0++; + } + + // printf("re_offset0 %d\n",re_offset0); + + + for (j=0,l=0; l<(nsymb-ulsch->srs_active); l++) { + re_offset = re_offset0; + symbol_offset = (int)frame_parms->ofdm_symbol_size*(l+(subframe*nsymb)); +#ifdef DEBUG_ULSCH_MODULATION + printf("symbol %d (subframe %d): symbol_offset %d\n",l,subframe,symbol_offset); +#endif + txptr = &txdataF[0][symbol_offset]; + + if (((frame_parms->Ncp == 0) && ((l==3) || (l==10)))|| + ((frame_parms->Ncp == 1) && ((l==2) || (l==8)))) { + } + // Skip reference symbols + else { + + // printf("copying %d REs\n",Msc_PUSCH); + for (i=0; iz[j],((int16_t*)&ulsch->z[j])[0],((int16_t*)&ulsch->z[j])[1]); +#endif + txptr[re_offset++] = ulsch->z[j]; + + if (re_offset==frame_parms->ofdm_symbol_size) + re_offset = 0; + } + } + } + +# else // OFDMA_ULSCH = 0 + re_offset0 = frame_parms->first_carrier_offset + (ulsch->harq_processes[harq_pid]->first_rb*12); + + if (re_offset0>frame_parms->ofdm_symbol_size) { + re_offset0 -= frame_parms->ofdm_symbol_size; + // re_offset0++; + } + + // printf("re_offset0 %d\n",re_offset0); + // printf("txdataF %p\n",&txdataF[0][0]); + for (j=0,l=0; l<(nsymb-ulsch->srs_active); l++) { + re_offset = re_offset0; + symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(l+(subframe*nsymb)); +#ifdef DEBUG_ULSCH_MODULATION + printf("ulsch_mod (SC-FDMA) symbol %d (subframe %d): symbol_offset %d\n",l,subframe,symbol_offset); +#endif + txptr = &txdataF[0][symbol_offset]; + + if (((frame_parms->Ncp == 0) && ((l==3) || (l==10)))|| + ((frame_parms->Ncp == 1) && ((l==2) || (l==8)))) { + } + // Skip reference symbols + else { + // printf("copying %d REs\n",Msc_PUSCH); + for (i=0; i %p\n", re_offset,&ulsch->z[j],((int16_t*)&ulsch->z[j])[0],((int16_t*)&ulsch->z[j])[1],&txptr[re_offset]); +#endif //DEBUG_ULSCH_MODULATION + txptr[re_offset++] = ulsch->z[j]; + + if (re_offset==frame_parms->ofdm_symbol_size) + re_offset = 0; + } + } + } + +#endif + VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_ULSCH_MODULATION, VCD_FUNCTION_OUT); + +} + diff --git a/openair2/LAYER2/NR_MAC_gNB/config.c b/openair2/LAYER2/NR_MAC_gNB/config.c new file mode 100644 index 0000000000..e69de29bb2 diff --git a/openair2/NR_PHY_INTERFACE/IF_Module.h b/openair2/NR_PHY_INTERFACE/IF_Module.h new file mode 100644 index 0000000000..e69de29bb2 diff --git a/openair2/RRC/LITE/rrc_UE.c b/openair2/RRC/LITE/rrc_UE.c index 0e3a70765d..f578e76dcd 100644 --- a/openair2/RRC/LITE/rrc_UE.c +++ b/openair2/RRC/LITE/rrc_UE.c @@ -1815,8 +1815,8 @@ rrc_ue_process_rrcConnectionReconfiguration( rrc_ue_process_radioResourceConfigDedicated(ctxt_pP,eNB_index, rrcConnectionReconfiguration_r8->radioResourceConfigDedicated); } - - void *non_criticical_ext_iterator = rrcConnectionReconfiguration_r8; + +/* void *non_criticical_ext_iterator = rrcConnectionReconfiguration_r8; RCCConnectionReconfiguration_v1510_IEs_t *rrc_connection_reconfiguration_v1510_IEs = (RRCConnectionReconfiguration_v1510_IEs_t *)0; // fetch EN-DC for NR_RRC here // r8 @@ -1869,7 +1869,7 @@ rrc_ue_process_rrcConnectionReconfiguration( break; } } - } + }*/ #if defined(ENABLE_ITTI) diff --git a/openair2/RRC/NR/proto_NR.h b/openair2/RRC/NR/proto_NR.h new file mode 100644 index 0000000000..e69de29bb2