From af993318dde2d697cdef0f5cca761d6cbee10a47 Mon Sep 17 00:00:00 2001 From: winckel <winckel@eurecom.fr> Date: Fri, 13 Dec 2013 14:22:36 +0000 Subject: [PATCH] Fixed a build issue for RTAI. Added handling of RRC_CONFIGURATION_REQ in eNB RRC (some SIB1 fields will be configured by eNB app settings). git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4721 818b1a75-f10b-46b9-bf7c-635c3b92a50f --- openair2/ENB_APP/enb_app.c | 3 +- openair2/RRC/LITE/MESSAGES/asn1_msg.c | 108 +++++++++++++++++++------- openair2/RRC/LITE/MESSAGES/asn1_msg.h | 8 +- openair2/RRC/LITE/rrc_eNB.c | 39 ++++++++-- 4 files changed, 121 insertions(+), 37 deletions(-) diff --git a/openair2/ENB_APP/enb_app.c b/openair2/ENB_APP/enb_app.c index e2fd716f841..abd0fe36f58 100644 --- a/openair2/ENB_APP/enb_app.c +++ b/openair2/ENB_APP/enb_app.c @@ -246,9 +246,9 @@ static uint32_t eNB_app_register() # if defined(OAI_EMU) eNB_id_start = oai_emulation.info.first_enb_local; eNB_id_end = oai_emulation.info.first_enb_local + oai_emulation.info.nb_enb_local; -# endif DevCheck(eNB_id_end <= NUMBER_OF_eNB_MAX, eNB_id_end, NUMBER_OF_eNB_MAX, 0); +# endif DevCheck(eNB_id_end <= (sizeof(enb_properties) / sizeof(enb_properties[0])), eNB_id_end, (sizeof(enb_properties) / sizeof(enb_properties[0])), 0); for (eNB_id = eNB_id_start; (eNB_id < eNB_id_end) ; eNB_id++) @@ -278,6 +278,7 @@ static uint32_t eNB_app_register() /* Some default/random parameters */ s1ap_register_eNB->eNB_id = enb_properties[eNB_id]->eNB_id; s1ap_register_eNB->cell_type = enb_properties[eNB_id]->cell_type; + s1ap_register_eNB->eNB_name = enb_properties[eNB_id]->eNB_name; s1ap_register_eNB->tac = enb_properties[eNB_id]->tac; s1ap_register_eNB->mcc = enb_properties[eNB_id]->mcc; s1ap_register_eNB->mnc = enb_properties[eNB_id]->mnc; diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.c b/openair2/RRC/LITE/MESSAGES/asn1_msg.c index db00fe2b0fc..05e1273d35c 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.c +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.c @@ -357,12 +357,16 @@ uint8_t do_MIB(LTE_DL_FRAME_PARMS *frame_parms, uint32_t frame, uint8_t *buffer) } uint8_t do_SIB1(LTE_DL_FRAME_PARMS *frame_parms, uint8_t *buffer, - BCCH_DL_SCH_Message_t *bcch_message, - SystemInformationBlockType1_t **sib1) { + BCCH_DL_SCH_Message_t *bcch_message, + SystemInformationBlockType1_t **sib1 +#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[2]; + MCC_MNC_Digit_t dummy_mcc[3],dummy_mnc[3]; asn_enc_rval_t enc_rval; SchedulingInfo_t schedulingInfo; SIB_Type_t sib_type; @@ -385,14 +389,42 @@ uint8_t do_SIB1(LTE_DL_FRAME_PARMS *frame_parms, uint8_t *buffer, asn_set_empty(&PLMN_identity_info.plmn_Identity.mcc->list);//.size=0; - dummy_mcc[0]=0;ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mcc->list,&dummy_mcc[0]); - dummy_mcc[1]=0;ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mcc->list,&dummy_mcc[1]); - dummy_mcc[2]=1;ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mcc->list,&dummy_mcc[2]); +#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; - dummy_mnc[0]=0;ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mnc.list,&dummy_mnc[0]); - dummy_mnc[1]=1;ASN_SEQUENCE_ADD(&PLMN_identity_info.plmn_Identity.mnc.list,&dummy_mnc[1]); +#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 { + dummy_mnc[0] = (configuration->mnc / 10) % 10; + dummy_mnc[1] = (configuration->mnc / 1) % 10; + dummy_mnc[2] = 0xf; + } +#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; @@ -401,17 +433,29 @@ uint8_t do_SIB1(LTE_DL_FRAME_PARMS *frame_parms, uint8_t *buffer, // 16 bits (*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf = MALLOC(2); - (*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf[0]=0x00; - (*sib1)->cellAccessRelatedInfo.trackingAreaCode.buf[1]=0x01; +#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); - (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[3]=0x10; - (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[2]=0x00; - (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[1]=0x00; - (*sib1)->cellAccessRelatedInfo.cellIdentity.buf[0]=0x00; +#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; @@ -436,22 +480,12 @@ uint8_t do_SIB1(LTE_DL_FRAME_PARMS *frame_parms, uint8_t *buffer, // ASN_SEQUENCE_ADD(&schedulingInfo.sib_MappingInfo.list,NULL); - - - - - - - (*sib1)->tdd_Config = CALLOC(1,sizeof(struct TDD_Config)); - (*sib1)->tdd_Config->subframeAssignment=frame_parms->tdd_config; //TDD_Config__subframeAssignment_sa3; - (*sib1)->tdd_Config->specialSubframePatterns=0;//frame_parms->tdd_config_S;//TDD_Config__specialSubframePatterns_ssp0; - (*sib1)->si_WindowLength=SystemInformationBlockType1__si_WindowLength_ms20; (*sib1)->systemInfoValueTag=0; // (*sib1).nonCriticalExtension = calloc(1,sizeof(*(*sib1).nonCriticalExtension)); @@ -460,9 +494,29 @@ uint8_t do_SIB1(LTE_DL_FRAME_PARMS *frame_parms, uint8_t *buffer, 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); + (void*)bcch_message, + buffer, + 100); + +#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 *message_p; + + message_p = itti_alloc_new_message_sized (TASK_RRC_UE, GENERIC_LOG, message_string_size); + memcpy(&message_p->ittiMsg.generic_log, message_string, message_string_size); + + itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p); + } + } +# endif +#endif + #ifdef USER_MODE LOG_D(RRC,"[eNB] SystemInformationBlockType1 Encoded %d bits (%d bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8); #endif diff --git a/openair2/RRC/LITE/MESSAGES/asn1_msg.h b/openair2/RRC/LITE/MESSAGES/asn1_msg.h index 37391c20697..9571cc9d7f8 100644 --- a/openair2/RRC/LITE/MESSAGES/asn1_msg.h +++ b/openair2/RRC/LITE/MESSAGES/asn1_msg.h @@ -75,8 +75,12 @@ u8 get_adjacent_cell_mod_id(uint16_t phyCellId); @return size of encoded bit stream in bytes*/ uint8_t do_SIB1(LTE_DL_FRAME_PARMS *frame_parms, uint8_t *buffer, - BCCH_DL_SCH_Message_t *bcch_message, - SystemInformationBlockType1_t **sib1); + BCCH_DL_SCH_Message_t *bcch_message, + SystemInformationBlockType1_t **sib1 +#if defined(ENABLE_ITTI) + , RrcConfigurationReq *configuration +#endif + ); /** \brief Generate a default configuration for SIB2/SIB3 in one System Information PDU (eNB). diff --git a/openair2/RRC/LITE/rrc_eNB.c b/openair2/RRC/LITE/rrc_eNB.c index 7147c307b8e..05c55bfac0b 100644 --- a/openair2/RRC/LITE/rrc_eNB.c +++ b/openair2/RRC/LITE/rrc_eNB.c @@ -105,8 +105,11 @@ static const uint8_t RRC_TRANSACTION_IDENTIFIER_NUMBER = 4; mui_t rrc_eNB_mui = 0; /*------------------------------------------------------------------------------*/ -static void init_SI (u8 Mod_id) { - +static void init_SI (u8 Mod_id +#if defined(ENABLE_ITTI) + , RrcConfigurationReq *configuration +#endif + ) { u8 SIwindowsize = 1; u16 SIperiod = 8; #ifdef Rel10 @@ -176,7 +179,11 @@ static void init_SI (u8 Mod_id) { eNB_rrc_inst[Mod_id].SIB1, &eNB_rrc_inst[Mod_id]. siblock1, - &eNB_rrc_inst[Mod_id].sib1); + &eNB_rrc_inst[Mod_id].sib1 +#if defined(ENABLE_ITTI) + , configuration +#endif + ); else { LOG_E (RRC, "[eNB] init_SI: FATAL, no memory for SIB1 allocated\n"); @@ -2397,10 +2404,18 @@ void rrc_eNB_generate_RRCConnectionSetup (u8 Mod_id, u32 frame, u16 UE_index) { } /*------------------------------------------------------------------------------*/ +#if defined(ENABLE_ITTI) +char openair_rrc_lite_eNB_init (u8 Mod_id) +{ + /* Dummy function, initialization will be done through ITTI messaging */ + return 0; +} +char openair_rrc_lite_eNB_configuration (u8 Mod_id, RrcConfigurationReq *configuration) +#else char openair_rrc_lite_eNB_init (u8 Mod_id) +#endif { /*-----------------------------------------------------------------------------*/ - unsigned char j; LOG_I (RRC, "[eNB %d] Init (UE State = RRC_IDLE)...\n", Mod_id); LOG_D (RRC, "[MSC_NEW][FRAME 00000][RRC_eNB][MOD %02d][]\n", Mod_id); @@ -2470,7 +2485,11 @@ char openair_rrc_lite_eNB_init (u8 Mod_id) eNB_rrc_inst[Mod_id].num_active_cba_groups); #endif - init_SI (Mod_id); + init_SI (Mod_id +#if defined(ENABLE_ITTI) + , configuration +#endif + ); #ifdef Rel10 switch (eNB_rrc_inst[Mod_id].MBMS_flag) { @@ -3035,7 +3054,7 @@ void *rrc_enb_task(void *args_p) { /* Messages from MAC */ case RRC_MAC_CCCH_DATA_IND: - LOG_I(RRC, "[eNB %d] Received %s: instance %d, frame %d,\n", instance, msg_name, + LOG_I(RRC, "[eNB %d] Received %s: frame %d,\n", instance, msg_name, RRC_MAC_CCCH_DATA_IND (msg_p).frame); srb_info_p = &eNB_rrc_inst[instance].Srb0; @@ -3048,7 +3067,7 @@ void *rrc_enb_task(void *args_p) { /* Messages from PDCP */ case RRC_DCCH_DATA_IND: - LOG_I(RRC, "[eNB %d][UE %d] Received %s: instance %d, frame %d, DCCH %d\n", instance, RRC_DCCH_DATA_IND (msg_p).ue_index, msg_name, + LOG_I(RRC, "[eNB %d][UE %d] Received %s: frame %d, DCCH %d\n", instance, RRC_DCCH_DATA_IND (msg_p).ue_index, msg_name, RRC_DCCH_DATA_IND (msg_p).frame, RRC_DCCH_DATA_IND (msg_p).dcch_index); rrc_eNB_decode_dcch (instance, RRC_DCCH_DATA_IND (msg_p).frame, RRC_DCCH_DATA_IND (msg_p).dcch_index, @@ -3082,6 +3101,12 @@ void *rrc_enb_task(void *args_p) { break; #endif + /* Messages from eNB app */ + case RRC_CONFIGURATION_REQ: + LOG_I(RRC, "[eNB %d] Received %s\n", instance, msg_name); + openair_rrc_lite_eNB_configuration(instance, &RRC_CONFIGURATION_REQ (msg_p)); + break; + default: LOG_E(RRC, "[eNB %d] Received unexpected message %s\n", instance, msg_name); break; -- GitLab