Commit 4082f549 authored by Lionel Gauthier's avatar Lionel Gauthier

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6414 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent ad9fa37d
...@@ -25,16 +25,16 @@ ...@@ -25,16 +25,16 @@
Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE Address : Eurecom, Campus SophiaTech, 450 Route des Chappes, CS 50193 - 06904 Biot Sophia Antipolis cedex, FRANCE
*******************************************************************************/ *******************************************************************************/
/*! \file l2_interface.c /*! \file l2_interface.c
* \brief layer 2 interface, used to support different RRC sublayer * \brief layer 2 interface, used to support different RRC sublayer
* \author Raymond Knopp and Navid Nikaein * \author Raymond Knopp and Navid Nikaein
* \date 2010-2014 * \date 2010-2014
* \version 1.0 * \version 1.0
* \company Eurecom * \company Eurecom
* \email: raymond.knopp@eurecom.fr * \email: raymond.knopp@eurecom.fr
*/ */
#include "platform_types.h" #include "platform_types.h"
//#include "openair_defs.h" //#include "openair_defs.h"
...@@ -65,278 +65,278 @@ mui_t mui=0; ...@@ -65,278 +65,278 @@ mui_t mui=0;
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
int8_t mac_rrc_lite_data_req(module_id_t Mod_idP, frame_t frameP, uint16_t Srb_id, uint8_t Nb_tb, uint8_t *buffer_pP, eNB_flag_t enb_flagP, uint8_t eNB_index, int8_t mac_rrc_lite_data_req(module_id_t Mod_idP, frame_t frameP, uint16_t Srb_id, uint8_t Nb_tb, uint8_t *buffer_pP, eNB_flag_t enb_flagP, uint8_t eNB_index,
uint8_t mbsfn_sync_area) { uint8_t mbsfn_sync_area) {
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
SRB_INFO *Srb_info; SRB_INFO *Srb_info;
uint8_t Sdu_size=0; uint8_t Sdu_size=0;
#ifdef DEBUG_RRC #ifdef DEBUG_RRC
int i; int i;
LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_idP,Srb_id); LOG_D(RRC,"[eNB %d] mac_rrc_data_req to SRB ID=%d\n",Mod_idP,Srb_id);
#endif #endif
if( enb_flagP == ENB_FLAG_YES){ if( enb_flagP == ENB_FLAG_YES){
if((Srb_id & RAB_OFFSET) == BCCH){ if((Srb_id & RAB_OFFSET) == BCCH){
if(eNB_rrc_inst[Mod_idP].SI.Active==0) return 0; if(eNB_rrc_inst[Mod_idP].SI.Active==0) return 0;
// All even frames transmit SIB in SF 5 // All even frames transmit SIB in SF 5
if (eNB_rrc_inst[Mod_idP].sizeof_SIB1 == 255) { if (eNB_rrc_inst[Mod_idP].sizeof_SIB1 == 255) {
LOG_E(RRC,"[eNB %d] MAC Request for SIB1 and SIB1 not initialized\n",Mod_idP); LOG_E(RRC,"[eNB %d] MAC Request for SIB1 and SIB1 not initialized\n",Mod_idP);
mac_xface->macphy_exit(""); mac_xface->macphy_exit("");
} }
if ((frameP%2) == 0) { if ((frameP%2) == 0) {
memcpy(&buffer_pP[0],eNB_rrc_inst[Mod_idP].SIB1,eNB_rrc_inst[Mod_idP].sizeof_SIB1); memcpy(&buffer_pP[0],eNB_rrc_inst[Mod_idP].SIB1,eNB_rrc_inst[Mod_idP].sizeof_SIB1);
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
{ {
MessageDef *message_p; MessageDef *message_p;
int sib1_size = eNB_rrc_inst[Mod_idP].sizeof_SIB1; int sib1_size = eNB_rrc_inst[Mod_idP].sizeof_SIB1;
int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu); int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu);
if (sib1_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); LOG_E(RRC, "SIB1 SDU larger than BCCH SDU buffer size (%d, %d)", sib1_size, sdu_size);
sib1_size = sdu_size; sib1_size = sdu_size;
} }
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ); 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).frame = frameP;
RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib1_size; RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib1_size;
memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu)); memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu));
memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, eNB_rrc_inst[Mod_idP].SIB1, sib1_size); memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, eNB_rrc_inst[Mod_idP].SIB1, sib1_size);
RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index; RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, Mod_idP, message_p); itti_send_msg_to_task (TASK_MAC_ENB, Mod_idP, message_p);
} }
#endif #endif
#ifdef DEBUG_RRC #ifdef DEBUG_RRC
LOG_D(RRC,"[eNB %d] Frame %d : BCCH request => SIB 1\n",Mod_idP,frameP); LOG_D(RRC,"[eNB %d] Frame %d : BCCH request => SIB 1\n",Mod_idP,frameP);
for (i=0;i<eNB_rrc_inst[Mod_idP].sizeof_SIB1;i++) for (i=0;i<eNB_rrc_inst[Mod_idP].sizeof_SIB1;i++)
LOG_T(RRC,"%x.",buffer_pP[i]); LOG_T(RRC,"%x.",buffer_pP[i]);
LOG_T(RRC,"\n"); LOG_T(RRC,"\n");
#endif #endif
return (eNB_rrc_inst[Mod_idP].sizeof_SIB1); return (eNB_rrc_inst[Mod_idP].sizeof_SIB1);
} // All RFN mod 8 transmit SIB2-3 in SF 5 } // All RFN mod 8 transmit SIB2-3 in SF 5
else if ((frameP%8) == 1){ else if ((frameP%8) == 1){
memcpy(&buffer_pP[0],eNB_rrc_inst[Mod_idP].SIB23,eNB_rrc_inst[Mod_idP].sizeof_SIB23); memcpy(&buffer_pP[0],eNB_rrc_inst[Mod_idP].SIB23,eNB_rrc_inst[Mod_idP].sizeof_SIB23);
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
{ {
MessageDef *message_p; MessageDef *message_p;
int sib23_size = eNB_rrc_inst[Mod_idP].sizeof_SIB23; int sib23_size = eNB_rrc_inst[Mod_idP].sizeof_SIB23;
int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu); int sdu_size = sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu);
if (sib23_size > sdu_size) if (sib23_size > sdu_size)
{ {
LOG_E(RRC, "SIB23 SDU larger than BCCH SDU buffer size (%d, %d)", 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; sib23_size = sdu_size;
} }
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_BCCH_DATA_REQ); 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).frame = frameP;
RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib23_size; RRC_MAC_BCCH_DATA_REQ (message_p).sdu_size = sib23_size;
memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu)); memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu));
memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, eNB_rrc_inst[Mod_idP].SIB23, sib23_size); memcpy (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, eNB_rrc_inst[Mod_idP].SIB23, sib23_size);
RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index; RRC_MAC_BCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, Mod_idP, message_p); itti_send_msg_to_task (TASK_MAC_ENB, Mod_idP, message_p);
} }
#endif #endif
#ifdef DEBUG_RRC #ifdef DEBUG_RRC
LOG_D(RRC,"[eNB %d] Frame %d BCCH request => SIB 2-3\n",Mod_idP,frameP); LOG_D(RRC,"[eNB %d] Frame %d BCCH request => SIB 2-3\n",Mod_idP,frameP);
for (i=0;i<eNB_rrc_inst[Mod_idP].sizeof_SIB23;i++) for (i=0;i<eNB_rrc_inst[Mod_idP].sizeof_SIB23;i++)
LOG_T(RRC,"%x.",buffer_pP[i]); LOG_T(RRC,"%x.",buffer_pP[i]);
LOG_T(RRC,"\n"); LOG_T(RRC,"\n");
#endif #endif
return(eNB_rrc_inst[Mod_idP].sizeof_SIB23); return(eNB_rrc_inst[Mod_idP].sizeof_SIB23);
} }
else else
return(0); return(0);
} }
if( (Srb_id & RAB_OFFSET ) == CCCH){ if( (Srb_id & RAB_OFFSET ) == CCCH){
LOG_D(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id); LOG_D(RRC,"[eNB %d] Frame %d CCCH request (Srb_id %d)\n",Mod_idP,frameP, Srb_id);
if(eNB_rrc_inst[Mod_idP].Srb0.Active==0) { if(eNB_rrc_inst[Mod_idP].Srb0.Active==0) {
LOG_E(RRC,"[eNB %d] CCCH Not active\n",Mod_idP); LOG_E(RRC,"[eNB %d] CCCH Not active\n",Mod_idP);
return -1; return -1;
} }
Srb_info=&eNB_rrc_inst[Mod_idP].Srb0; Srb_info=&eNB_rrc_inst[Mod_idP].Srb0;
// check if data is there for MAC // check if data is there for MAC
if(Srb_info->Tx_buffer.payload_size>0){//Fill buffer 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); 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 defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
{ {
MessageDef *message_p; MessageDef *message_p;
int ccch_size = Srb_info->Tx_buffer.payload_size; int ccch_size = Srb_info->Tx_buffer.payload_size;
int sdu_size = sizeof(RRC_MAC_CCCH_DATA_REQ (message_p).sdu); int sdu_size = sizeof(RRC_MAC_CCCH_DATA_REQ (message_p).sdu);
if (ccch_size > sdu_size) { if (ccch_size > sdu_size) {
LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", ccch_size, sdu_size); LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", ccch_size, sdu_size);
ccch_size = sdu_size; ccch_size = sdu_size;
} }
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_CCCH_DATA_REQ); 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).frame = frameP;
RRC_MAC_CCCH_DATA_REQ (message_p).sdu_size = ccch_size; RRC_MAC_CCCH_DATA_REQ (message_p).sdu_size = ccch_size;
memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu)); memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu));
memcpy (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, Srb_info->Tx_buffer.Payload, ccch_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; RRC_MAC_CCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_ENB, Mod_idP, message_p); itti_send_msg_to_task (TASK_MAC_ENB, Mod_idP, message_p);
} }
#endif #endif
memcpy(buffer_pP,Srb_info->Tx_buffer.Payload,Srb_info->Tx_buffer.payload_size); memcpy(buffer_pP,Srb_info->Tx_buffer.Payload,Srb_info->Tx_buffer.payload_size);
Sdu_size = Srb_info->Tx_buffer.payload_size; Sdu_size = Srb_info->Tx_buffer.payload_size;
Srb_info->Tx_buffer.payload_size=0; Srb_info->Tx_buffer.payload_size=0;
} }
return (Sdu_size); return (Sdu_size);
} }
#ifdef Rel10 #ifdef Rel10
if((Srb_id & RAB_OFFSET) == MCCH){ if((Srb_id & RAB_OFFSET) == MCCH){
if(eNB_rrc_inst[Mod_idP].MCCH_MESS[mbsfn_sync_area].Active==0) return 0; // this parameter is set in function init_mcch in rrc_eNB.c if(eNB_rrc_inst[Mod_idP].MCCH_MESS[mbsfn_sync_area].Active==0) return 0; // this parameter is set in function init_mcch in rrc_eNB.c
// this part not needed as it is done in init_mcch // this part not needed as it is done in init_mcch
/* if (eNB_rrc_inst[Mod_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area] == 255) { /* if (eNB_rrc_inst[Mod_id].sizeof_MCCH_MESSAGE[mbsfn_sync_area] == 255) {
LOG_E(RRC,"[eNB %d] MAC Request for MCCH MESSAGE and MCCH MESSAGE is not initialized\n",Mod_id); LOG_E(RRC,"[eNB %d] MAC Request for MCCH MESSAGE and MCCH MESSAGE is not initialized\n",Mod_id);
mac_xface->macphy_exit(""); mac_xface->macphy_exit("");
}*/ }*/
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
{ {
MessageDef *message_p; MessageDef *message_p;
int mcch_size = eNB_rrc_inst[Mod_idP].sizeof_MCCH_MESSAGE[mbsfn_sync_area]; int mcch_size = eNB_rrc_inst[Mod_idP].sizeof_MCCH_MESSAGE[mbsfn_sync_area];
int sdu_size = sizeof(RRC_MAC_MCCH_DATA_REQ (message_p).sdu); int sdu_size = sizeof(RRC_MAC_MCCH_DATA_REQ (message_p).sdu);
if (mcch_size > sdu_size) { if (mcch_size > sdu_size) {
LOG_E(RRC, "SDU larger than MCCH SDU buffer size (%d, %d)", mcch_size, sdu_size); LOG_E(RRC, "SDU larger than MCCH SDU buffer size (%d, %d)", mcch_size, sdu_size);
mcch_size = sdu_size; mcch_size = sdu_size;
} }
message_p = itti_alloc_new_message (TASK_RRC_ENB, RRC_MAC_MCCH_DATA_REQ); 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).frame = frameP;
RRC_MAC_MCCH_DATA_REQ (message_p).sdu_size = mcch_size; RRC_MAC_MCCH_DATA_REQ (message_p).sdu_size = mcch_size;
memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu)); memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu));
memcpy (RRC_MAC_MCCH_DATA_REQ (message_p).sdu, eNB_rrc_inst[Mod_idP].MCCH_MESSAGE[mbsfn_sync_area], mcch_size); memcpy (RRC_MAC_MCCH_DATA_REQ (message_p).sdu, eNB_rrc_inst[Mod_idP].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).enb_index = eNB_index;
RRC_MAC_MCCH_DATA_REQ (message_p).mbsfn_sync_area = mbsfn_sync_area; RRC_MAC_MCCH_DATA_REQ (message_p).mbsfn_sync_area = mbsfn_sync_area;
itti_send_msg_to_task (TASK_MAC_ENB, Mod_idP, message_p); itti_send_msg_to_task (TASK_MAC_ENB, Mod_idP, message_p);
} }
#endif #endif
memcpy(&buffer_pP[0], memcpy(&buffer_pP[0],
eNB_rrc_inst[Mod_idP].MCCH_MESSAGE[mbsfn_sync_area], eNB_rrc_inst[Mod_idP].MCCH_MESSAGE[mbsfn_sync_area],
eNB_rrc_inst[Mod_idP].sizeof_MCCH_MESSAGE[mbsfn_sync_area]); eNB_rrc_inst[Mod_idP].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
#ifdef DEBUG_RRC #ifdef DEBUG_RRC
LOG_D(RRC,"[eNB %d] Frame %d : MCCH request => MCCH_MESSAGE \n",Mod_idP,frameP); LOG_D(RRC,"[eNB %d] Frame %d : MCCH request => MCCH_MESSAGE \n",Mod_idP,frameP);
for (i=0;i<eNB_rrc_inst[Mod_idP].sizeof_MCCH_MESSAGE[mbsfn_sync_area];i++) for (i=0;i<eNB_rrc_inst[Mod_idP].sizeof_MCCH_MESSAGE[mbsfn_sync_area];i++)
LOG_T(RRC,"%x.",buffer_pP[i]); LOG_T(RRC,"%x.",buffer_pP[i]);
LOG_T(RRC,"\n"); LOG_T(RRC,"\n");
#endif #endif
return (eNB_rrc_inst[Mod_idP].sizeof_MCCH_MESSAGE[mbsfn_sync_area]); return (eNB_rrc_inst[Mod_idP].sizeof_MCCH_MESSAGE[mbsfn_sync_area]);
// } // }
//else //else
//return(0); //return(0);
}
#endif //Rel10
} }
#endif //Rel10
}
else{ //This is an UE else{ //This is an UE
#ifdef DEBUG_RRC #ifdef DEBUG_RRC
LOG_D(RRC,"[UE %d] Frame %d Filling CCCH SRB_ID %d\n",Mod_idP,frameP,Srb_id); LOG_D(RRC,"[UE %d] Frame %d Filling CCCH SRB_ID %d\n",Mod_idP,frameP,Srb_id);
LOG_D(RRC,"[UE %d] Frame %d buffer_pP status %d,\n",Mod_idP,frameP, UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size); LOG_D(RRC,"[UE %d] Frame %d buffer_pP status %d,\n",Mod_idP,frameP, UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size);
#endif #endif
if( (UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size > 0) ) { if( (UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size > 0) ) {
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
{ {
MessageDef *message_p; MessageDef *message_p;
int ccch_size = UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size; int ccch_size = UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size;
int sdu_size = sizeof(RRC_MAC_CCCH_DATA_REQ (message_p).sdu); int sdu_size = sizeof(RRC_MAC_CCCH_DATA_REQ (message_p).sdu);
if (ccch_size > sdu_size) { if (ccch_size > sdu_size) {
LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", ccch_size, sdu_size); LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", ccch_size, sdu_size);
ccch_size = sdu_size; ccch_size = sdu_size;
} }
message_p = itti_alloc_new_message (TASK_RRC_UE, RRC_MAC_CCCH_DATA_REQ); message_p = itti_alloc_new_message (TASK_RRC_UE, RRC_MAC_CCCH_DATA_REQ);
RRC_MAC_CCCH_DATA_REQ (message_p).frame = frameP; RRC_MAC_CCCH_DATA_REQ (message_p).frame = frameP;
RRC_MAC_CCCH_DATA_REQ (message_p).sdu_size = ccch_size; RRC_MAC_CCCH_DATA_REQ (message_p).sdu_size = ccch_size;
memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu)); memset (RRC_MAC_BCCH_DATA_REQ (message_p).sdu, 0, sizeof(RRC_MAC_BCCH_DATA_REQ (message_p).sdu));
memcpy (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.Payload, ccch_size); memcpy (RRC_MAC_CCCH_DATA_REQ (message_p).sdu, UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.Payload, ccch_size);
RRC_MAC_CCCH_DATA_REQ (message_p).enb_index = eNB_index; RRC_MAC_CCCH_DATA_REQ (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_MAC_UE, Mod_idP + NB_eNB_INST, message_p); itti_send_msg_to_task (TASK_MAC_UE, Mod_idP + NB_eNB_INST, message_p);
} }
#endif #endif
memcpy(&buffer_pP[0],&UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.Payload[0],UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size); memcpy(&buffer_pP[0],&UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.Payload[0],UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size);
uint8_t Ret_size=UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size; uint8_t Ret_size=UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size;
// UE_rrc_inst[Mod_id].Srb0[eNB_index].Tx_buffer.payload_size=0; // UE_rrc_inst[Mod_id].Srb0[eNB_index].Tx_buffer.payload_size=0;
UE_rrc_inst[Mod_idP].Info[eNB_index].T300_active = 1; UE_rrc_inst[Mod_idP].Info[eNB_index].T300_active = 1;
UE_rrc_inst[Mod_idP].Info[eNB_index].T300_cnt = 0; UE_rrc_inst[Mod_idP].Info[eNB_index].T300_cnt = 0;
// msg("[RRC][UE %d] Sending rach\n",Mod_id); // msg("[RRC][UE %d] Sending rach\n",Mod_id);
return(Ret_size); return(Ret_size);
} }
else{ else{
return 0; return 0;
}
} }
} return(0);
return(0);
} }
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
int8_t mac_rrc_lite_data_ind(module_id_t Mod_idP, frame_t frameP, rb_id_t Srb_id, uint8_t *Sdu, sdu_size_t sdu_size,eNB_flag_t enb_flagP,uint8_t eNB_index,uint8_t mbsfn_sync_area){ int8_t mac_rrc_lite_data_ind(module_id_t Mod_idP, frame_t frameP, rb_id_t Srb_id, uint8_t *Sdu, sdu_size_t sdu_size,eNB_flag_t enb_flagP,uint8_t eNB_index,uint8_t mbsfn_sync_area){
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
SRB_INFO *Srb_info; SRB_INFO *Srb_info;
/* /*
int si_window; int si_window;
*/ */
if(enb_flagP == ENB_FLAG_NO){ if(enb_flagP == ENB_FLAG_NO){
if(Srb_id == BCCH){ if(Srb_id == BCCH){
LOG_T(RRC,"[UE %d] Received SDU for BCCH on SRB %d from eNB %d\n",Mod_idP,Srb_id,eNB_index);
#if defined(ENABLE_ITTI) LOG_T(RRC,"[UE %d] Received SDU for BCCH on SRB %d from eNB %d\n",Mod_idP,Srb_id,eNB_index);
{
MessageDef *message_p;
int msg_sdu_size = sizeof(RRC_MAC_BCCH_DATA_IND (message_p).sdu);
if (sdu_size > msg_sdu_size) #if defined(ENABLE_ITTI)
{ {
LOG_E(RRC, "SDU larger than BCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size); MessageDef *message_p;
sdu_size = msg_sdu_size; int msg_sdu_size = sizeof(RRC_MAC_BCCH_DATA_IND (message_p).sdu);
}
if (sdu_size > msg_sdu_size)
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_BCCH_DATA_IND); {
RRC_MAC_BCCH_DATA_IND (message_p).frame = frameP; LOG_E(RRC, "SDU larger than BCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size);
RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = sdu_size; sdu_size = msg_sdu_size;
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu)); }
memcpy (RRC_MAC_BCCH_DATA_IND (message_p).sdu, Sdu, sdu_size);
RRC_MAC_BCCH_DATA_IND (message_p).enb_index = eNB_index; message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_BCCH_DATA_IND);
RRC_MAC_BCCH_DATA_IND (message_p).rsrq = 30 /* TODO change phy to report rspq */; RRC_MAC_BCCH_DATA_IND (message_p).frame = frameP;
RRC_MAC_BCCH_DATA_IND (message_p).rsrp = 45 /* TODO change phy to report rspp */; RRC_MAC_BCCH_DATA_IND (message_p).sdu_size = sdu_size;
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu));
itti_send_msg_to_task (TASK_RRC_UE, Mod_idP + NB_eNB_INST, message_p); memcpy (RRC_MAC_BCCH_DATA_IND (message_p).sdu, Sdu, sdu_size);
} RRC_MAC_BCCH_DATA_IND (message_p).enb_index = eNB_index;
RRC_MAC_BCCH_DATA_IND (message_p).rsrq = 30 /* TODO change phy to report rspq */;
RRC_MAC_BCCH_DATA_IND (message_p).rsrp = 45 /* TODO change phy to report rspp */;
itti_send_msg_to_task (TASK_RRC_UE, Mod_idP + NB_eNB_INST, message_p);
}
#else #else
decode_BCCH_DLSCH_Message(Mod_idP,frameP,eNB_index,Sdu,sdu_size, 0, 0); decode_BCCH_DLSCH_Message(Mod_idP,frameP,eNB_index,Sdu,sdu_size, 0, 0);
/* /*
if ((frameP %2) == 0) { if ((frameP %2) == 0) {
if (UE_rrc_inst[Mod_id].Info[eNB_index].SIB1Status == 0) { if (UE_rrc_inst[Mod_id].Info[eNB_index].SIB1Status == 0) {
LOG_D(RRC,"[UE %d] Frame %d : Received SIB1 from eNB %d (%d bytes)\n",Mod_id,frameP,eNB_index,sdu_size); LOG_D(RRC,"[UE %d] Frame %d : Received SIB1 from eNB %d (%d bytes)\n",Mod_id,frameP,eNB_index,sdu_size);
...@@ -364,7 +364,7 @@ int8_t mac_rrc_lite_data_ind(module_id_t Mod_idP, frame_t frameP, rb_id_t Srb_id ...@@ -364,7 +364,7 @@ int8_t mac_rrc_lite_data_ind(module_id_t Mod_idP, frame_t frameP, rb_id_t Srb_id
} }
} }
...@@ -375,280 +375,280 @@ int8_t mac_rrc_lite_data_ind(module_id_t Mod_idP, frame_t frameP, rb_id_t Srb_id ...@@ -375,280 +375,280 @@ int8_t mac_rrc_lite_data_ind(module_id_t Mod_idP, frame_t frameP, rb_id_t Srb_id
UE_rrc_inst[Mod_id].Info[eNB_index].State = RRC_SI_RECEIVED; UE_rrc_inst[Mod_id].Info[eNB_index].State = RRC_SI_RECEIVED;
} }
} }
*/ */
#endif #endif
} }
if((Srb_id & RAB_OFFSET) == CCCH){ if((Srb_id & RAB_OFFSET) == CCCH){
if (sdu_size>0) { if (sdu_size>0) {
LOG_T(RRC,"[UE %d] Received SDU for CCCH on SRB %d from eNB %d\n",Mod_idP,Srb_id & RAB_OFFSET,eNB_index); LOG_T(RRC,"[UE %d] Received SDU for CCCH on SRB %d from eNB %d\n",Mod_idP,Srb_id & RAB_OFFSET,eNB_index);
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
{ {
MessageDef *message_p; MessageDef *message_p;
int msg_sdu_size = sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu); int msg_sdu_size = sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu);
if (sdu_size > msg_sdu_size) if (sdu_size > msg_sdu_size)
{ {
LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size); LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size);
sdu_size = msg_sdu_size; sdu_size = msg_sdu_size;
} }
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_CCCH_DATA_IND); message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_CCCH_DATA_IND);
RRC_MAC_CCCH_DATA_IND (message_p).frame = frameP; RRC_MAC_CCCH_DATA_IND (message_p).frame = frameP;
RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size; RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size;
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu)); memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu));
memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, Sdu, sdu_size); memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, Sdu, sdu_size);
RRC_MAC_CCCH_DATA_IND (message_p).enb_index = eNB_index; RRC_MAC_CCCH_DATA_IND (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_RRC_UE, Mod_idP + NB_eNB_INST, message_p); itti_send_msg_to_task (TASK_RRC_UE, Mod_idP + NB_eNB_INST, message_p);
} }
#else #else
Srb_info = &UE_rrc_inst[Mod_idP].Srb0[eNB_index]; Srb_info = &UE_rrc_inst[Mod_idP].Srb0[eNB_index];
memcpy(Srb_info->Rx_buffer.Payload,Sdu,sdu_size); memcpy(Srb_info->Rx_buffer.Payload,Sdu,sdu_size);
Srb_info->Rx_buffer.payload_size = sdu_size; Srb_info->Rx_buffer.payload_size = sdu_size;
rrc_ue_decode_ccch(Mod_idP, frameP, Srb_info, eNB_index); rrc_ue_decode_ccch(Mod_idP, frameP, Srb_info, eNB_index);
#endif #endif
} }
}
#ifdef Rel10
if ((Srb_id & RAB_OFFSET) == MCCH) {
LOG_T(RRC,"[UE %d] Frame %d: Received SDU on MBSFN sync area %d for MCCH on SRB %d from eNB %d\n",
Mod_idP,frameP, mbsfn_sync_area, Srb_id & RAB_OFFSET,eNB_index);
#if defined(ENABLE_ITTI)
{
MessageDef *message_p;
int msg_sdu_size = sizeof(RRC_MAC_MCCH_DATA_IND (message_p).sdu);
if (sdu_size > msg_sdu_size)
{
LOG_E(RRC, "SDU larger than MCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size);
sdu_size = msg_sdu_size;
} }
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_MCCH_DATA_IND); #ifdef Rel10
RRC_MAC_MCCH_DATA_IND (message_p).frame = frameP; if ((Srb_id & RAB_OFFSET) == MCCH) {
RRC_MAC_MCCH_DATA_IND (message_p).sdu_size = sdu_size; LOG_T(RRC,"[UE %d] Frame %d: Received SDU on MBSFN sync area %d for MCCH on SRB %d from eNB %d\n",
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu)); Mod_idP,frameP, mbsfn_sync_area, Srb_id & RAB_OFFSET,eNB_index);
memcpy (RRC_MAC_MCCH_DATA_IND (message_p).sdu, Sdu, sdu_size);
RRC_MAC_MCCH_DATA_IND (message_p).enb_index = eNB_index;
RRC_MAC_MCCH_DATA_IND (message_p).mbsfn_sync_area = mbsfn_sync_area;
itti_send_msg_to_task (TASK_RRC_UE, Mod_idP + NB_eNB_INST, message_p); #if defined(ENABLE_ITTI)
} {
MessageDef *message_p;
int msg_sdu_size = sizeof(RRC_MAC_MCCH_DATA_IND (message_p).sdu);
if (sdu_size > msg_sdu_size)
{
LOG_E(RRC, "SDU larger than MCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size);
sdu_size = msg_sdu_size;
}
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_MCCH_DATA_IND);
RRC_MAC_MCCH_DATA_IND (message_p).frame = frameP;
RRC_MAC_MCCH_DATA_IND (message_p).sdu_size = sdu_size;
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu));
memcpy (RRC_MAC_MCCH_DATA_IND (message_p).sdu, Sdu, sdu_size);
RRC_MAC_MCCH_DATA_IND (message_p).enb_index = eNB_index;
RRC_MAC_MCCH_DATA_IND (message_p).mbsfn_sync_area = mbsfn_sync_area;
itti_send_msg_to_task (TASK_RRC_UE, Mod_idP + NB_eNB_INST, message_p);
}
#else #else
decode_MCCH_Message(Mod_idP, frameP, eNB_index, Sdu, sdu_size, mbsfn_sync_area); decode_MCCH_Message(Mod_idP, frameP, eNB_index, Sdu, sdu_size, mbsfn_sync_area);
#endif #endif
} }
#endif // Rel10 #endif // Rel10
} }
else{ // This is an eNB
Srb_info = &eNB_rrc_inst[Mod_idP].Srb0;
LOG_T(RRC,"[eNB %d] Received SDU for CCCH on SRB %d\n",Mod_idP,Srb_info->Srb_id);
else{ // This is an eNB
Srb_info = &eNB_rrc_inst[Mod_idP].Srb0;
LOG_T(RRC,"[eNB %d] Received SDU for CCCH on SRB %d\n",Mod_idP,Srb_info->Srb_id);
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
{ {
MessageDef *message_p; MessageDef *message_p;
int msg_sdu_size = sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu); int msg_sdu_size = sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu);
if (sdu_size > msg_sdu_size) if (sdu_size > msg_sdu_size)
{ {
LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size); LOG_E(RRC, "SDU larger than CCCH SDU buffer size (%d, %d)", sdu_size, msg_sdu_size);
sdu_size = msg_sdu_size; sdu_size = msg_sdu_size;
} }
message_p = itti_alloc_new_message (TASK_MAC_ENB, RRC_MAC_CCCH_DATA_IND); 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).frame = frameP;
RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size; RRC_MAC_CCCH_DATA_IND (message_p).sdu_size = sdu_size;
memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu)); memset (RRC_MAC_CCCH_DATA_IND (message_p).sdu, 0, sizeof(RRC_MAC_CCCH_DATA_IND (message_p).sdu));
memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, Sdu, sdu_size); memcpy (RRC_MAC_CCCH_DATA_IND (message_p).sdu, Sdu, sdu_size);
itti_send_msg_to_task (TASK_RRC_ENB, Mod_idP, message_p); itti_send_msg_to_task (TASK_RRC_ENB, Mod_idP, message_p);
} }
#else #else
// msg("\n******INST %d Srb_info %p, Srb_id=%d****\n\n",Mod_id,Srb_info,Srb_info->Srb_id); // msg("\n******INST %d Srb_info %p, Srb_id=%d****\n\n",Mod_id,Srb_info,Srb_info->Srb_id);
if (sdu_size > 0) { if (sdu_size > 0) {
memcpy(Srb_info->Rx_buffer.Payload,Sdu,sdu_size); memcpy(Srb_info->Rx_buffer.Payload,Sdu,sdu_size);
Srb_info->Rx_buffer.payload_size = sdu_size; Srb_info->Rx_buffer.payload_size = sdu_size;
rrc_eNB_decode_ccch(Mod_idP,frameP,Srb_info); rrc_eNB_decode_ccch(Mod_idP,frameP,Srb_info);
} }
#endif #endif
} }
return(0); return(0);
} }
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
// this function is Not USED anymore // this function is Not USED anymore
void mac_lite_sync_ind(module_id_t Mod_idP,uint8_t Status){ void mac_lite_sync_ind(module_id_t Mod_idP,uint8_t Status){
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
} }
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
uint8_t rrc_lite_data_req(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, rb_id_t rb_idP, mui_t muiP, uint32_t confirmP, uint8_t rrc_lite_data_req(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP, rb_id_t rb_idP, mui_t muiP, uint32_t confirmP,
sdu_size_t sdu_size, uint8_t* buffer_pP, pdcp_transmission_mode_t mode) { sdu_size_t sdu_size, uint8_t* buffer_pP, pdcp_transmission_mode_t mode) {
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
{ {
MessageDef *message_p; MessageDef *message_p;
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
uint8_t *message_buffer; uint8_t *message_buffer;
message_buffer = itti_malloc (enb_flagP ? TASK_RRC_ENB : TASK_RRC_UE, enb_flagP ? TASK_PDCP_ENB : TASK_PDCP_UE, sdu_size); message_buffer = itti_malloc (enb_flagP ? TASK_RRC_ENB : TASK_RRC_UE, enb_flagP ? TASK_PDCP_ENB : TASK_PDCP_UE, sdu_size);
memcpy (message_buffer, buffer_pP, sdu_size); memcpy (message_buffer, buffer_pP, sdu_size);
message_p = itti_alloc_new_message (enb_flagP ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ); message_p = itti_alloc_new_message (enb_flagP ? TASK_RRC_ENB : TASK_RRC_UE, RRC_DCCH_DATA_REQ);
RRC_DCCH_DATA_REQ (message_p).frame = frameP; RRC_DCCH_DATA_REQ (message_p).frame = frameP;
RRC_DCCH_DATA_REQ (message_p).enb_flag = enb_flagP; RRC_DCCH_DATA_REQ (message_p).enb_flag = enb_flagP;
RRC_DCCH_DATA_REQ (message_p).rb_id = rb_idP; RRC_DCCH_DATA_REQ (message_p).rb_id = rb_idP;
RRC_DCCH_DATA_REQ (message_p).muip = muiP; RRC_DCCH_DATA_REQ (message_p).muip = muiP;
RRC_DCCH_DATA_REQ (message_p).confirmp = confirmP; RRC_DCCH_DATA_REQ (message_p).confirmp = confirmP;
RRC_DCCH_DATA_REQ (message_p).sdu_size = sdu_size; RRC_DCCH_DATA_REQ (message_p).sdu_size = sdu_size;
RRC_DCCH_DATA_REQ (message_p).sdu_p = message_buffer; RRC_DCCH_DATA_REQ (message_p).sdu_p = message_buffer;
RRC_DCCH_DATA_REQ (message_p).mode = mode; RRC_DCCH_DATA_REQ (message_p).mode = mode;
RRC_DCCH_DATA_REQ (message_p).eNB_index = enb_mod_idP; RRC_DCCH_DATA_REQ (message_p).eNB_index = enb_mod_idP;
RRC_DCCH_DATA_REQ (message_p).ue_index = ue_mod_idP; RRC_DCCH_DATA_REQ (message_p).ue_index = ue_mod_idP;
itti_send_msg_to_task (enb_flagP ? TASK_PDCP_ENB : TASK_PDCP_UE, enb_flagP ? enb_mod_idP : NB_eNB_INST + ue_mod_idP, message_p); itti_send_msg_to_task (enb_flagP ? TASK_PDCP_ENB : TASK_PDCP_UE, enb_flagP ? enb_mod_idP : NB_eNB_INST + ue_mod_idP, message_p);
return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway. return TRUE; // TODO should be changed to a CNF message later, currently RRC lite does not used the returned value anyway.
} }
#else #else
protocol_ctxt_t ctxt; protocol_ctxt_t ctxt;
ctxt.enb_module_id = enb_mod_idP; ctxt.enb_module_id = enb_mod_idP;
ctxt.ue_module_id = ue_mod_idP; ctxt.ue_module_id = ue_mod_idP;
ctxt.frame = frameP; ctxt.frame = frameP;
ctxt.enb_flag = enb_flagP; ctxt.enb_flag = enb_flagP;
return pdcp_data_req (&ctxt, SRB_FLAG_YES, rb_idP, muiP, confirmP, sdu_size, buffer_pP, mode); return pdcp_data_req (&ctxt, SRB_FLAG_YES, rb_idP, muiP, confirmP, sdu_size, buffer_pP, mode);
#endif #endif
} }
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
void rrc_lite_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP,rb_id_t Srb_id, sdu_size_t sdu_sizeP,uint8_t *buffer_pP){ void rrc_lite_data_ind(module_id_t enb_mod_idP, module_id_t ue_mod_idP, frame_t frameP, eNB_flag_t enb_flagP,rb_id_t Srb_id, sdu_size_t sdu_sizeP,uint8_t *buffer_pP){
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
rb_id_t DCCH_index = Srb_id; rb_id_t DCCH_index = Srb_id;
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
instance_t instance; instance_t instance;
#endif #endif
if (enb_flagP == ENB_FLAG_NO) { if (enb_flagP == ENB_FLAG_NO) {
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
instance = ue_mod_idP + NB_eNB_INST; instance = ue_mod_idP + NB_eNB_INST;
#endif #endif
LOG_N(RRC, "[UE %d] Frame %d: received a DCCH %d message on SRB %d with Size %d from eNB %d\n", LOG_N(RRC, "[UE %d] Frame %d: received a DCCH %d message on SRB %d with Size %d from eNB %d\n",
ue_mod_idP, frameP, DCCH_index,Srb_id-1,sdu_sizeP, enb_mod_idP); ue_mod_idP, frameP, DCCH_index,Srb_id-1,sdu_sizeP, enb_mod_idP);
} else { } else {
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
instance = enb_mod_idP; instance = enb_mod_idP;
#endif #endif
LOG_N(RRC, "[eNB %d] Frame %d: received a DCCH %d message on SRB %d with Size %d from UE %d\n", LOG_N(RRC, "[eNB %d] Frame %d: received a DCCH %d message on SRB %d with Size %d from UE %d\n",
enb_mod_idP, frameP, DCCH_index,Srb_id-1,sdu_sizeP, ue_mod_idP); enb_mod_idP, frameP, DCCH_index,Srb_id-1,sdu_sizeP, ue_mod_idP);
} }
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
{ {
MessageDef *message_p; MessageDef *message_p;
// Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling). // Uses a new buffer to avoid issue with PDCP buffer content that could be changed by PDCP (asynchronous message handling).
uint8_t *message_buffer; uint8_t *message_buffer;
message_buffer = itti_malloc (enb_flagP ? TASK_PDCP_ENB : TASK_PDCP_UE, enb_flagP ? TASK_RRC_ENB : TASK_RRC_UE, sdu_sizeP); message_buffer = itti_malloc (enb_flagP ? TASK_PDCP_ENB : TASK_PDCP_UE, enb_flagP ? TASK_RRC_ENB : TASK_RRC_UE, sdu_sizeP);
memcpy (message_buffer, buffer_pP, sdu_sizeP); memcpy (message_buffer, buffer_pP, sdu_sizeP);
message_p = itti_alloc_new_message (enb_flagP ? TASK_PDCP_ENB : TASK_PDCP_UE, RRC_DCCH_DATA_IND); message_p = itti_alloc_new_message (enb_flagP ? TASK_PDCP_ENB : TASK_PDCP_UE, RRC_DCCH_DATA_IND);
RRC_DCCH_DATA_IND (message_p).frame = frameP; RRC_DCCH_DATA_IND (message_p).frame = frameP;
RRC_DCCH_DATA_IND (message_p).dcch_index = DCCH_index; RRC_DCCH_DATA_IND (message_p).dcch_index = DCCH_index;
RRC_DCCH_DATA_IND (message_p).sdu_size = sdu_sizeP; RRC_DCCH_DATA_IND (message_p).sdu_size = sdu_sizeP;
RRC_DCCH_DATA_IND (message_p).sdu_p = message_buffer; RRC_DCCH_DATA_IND (message_p).sdu_p = message_buffer;
RRC_DCCH_DATA_IND (message_p).ue_index = ue_mod_idP; RRC_DCCH_DATA_IND (message_p).ue_index = ue_mod_idP;
RRC_DCCH_DATA_IND (message_p).eNB_index = enb_mod_idP; RRC_DCCH_DATA_IND (message_p).eNB_index = enb_mod_idP;
itti_send_msg_to_task (enb_flagP ? TASK_RRC_ENB : TASK_RRC_UE, instance, message_p); itti_send_msg_to_task (enb_flagP ? TASK_RRC_ENB : TASK_RRC_UE, instance, message_p);
} }
#else #else
if (enb_flagP == ENB_FLAG_YES) { if (enb_flagP == ENB_FLAG_YES) {
rrc_eNB_decode_dcch(enb_mod_idP,frameP,DCCH_index,ue_mod_idP,buffer_pP,sdu_sizeP); rrc_eNB_decode_dcch(enb_mod_idP,frameP,DCCH_index,ue_mod_idP,buffer_pP,sdu_sizeP);
} }
else { else {
rrc_ue_decode_dcch(ue_mod_idP,frameP,DCCH_index,buffer_pP,enb_mod_idP); rrc_ue_decode_dcch(ue_mod_idP,frameP,DCCH_index,buffer_pP,enb_mod_idP);
} }
#endif #endif
} }
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
void rrc_lite_in_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index) { void rrc_lite_in_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index) {
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
{ {
MessageDef *message_p; MessageDef *message_p;
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_IN_SYNC_IND); message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_IN_SYNC_IND);
RRC_MAC_IN_SYNC_IND (message_p).frame = frameP; RRC_MAC_IN_SYNC_IND (message_p).frame = frameP;
RRC_MAC_IN_SYNC_IND (message_p).enb_index = eNB_index; RRC_MAC_IN_SYNC_IND (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_RRC_UE, Mod_idP + NB_eNB_INST, message_p); itti_send_msg_to_task (TASK_RRC_UE, Mod_idP + NB_eNB_INST, message_p);
} }
#else #else
UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt=0; UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt=0;
if (UE_rrc_inst[Mod_idP].Info[eNB_index].T310_active==1) if (UE_rrc_inst[Mod_idP].Info[eNB_index].T310_active==1)
UE_rrc_inst[Mod_idP].Info[eNB_index].N311_cnt++; UE_rrc_inst[Mod_idP].Info[eNB_index].N311_cnt++;
#endif #endif
} }
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
void rrc_lite_out_of_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index){ void rrc_lite_out_of_sync_ind(module_id_t Mod_idP, frame_t frameP, uint16_t eNB_index){
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
LOG_I(RRC,"[UE %d] Frame %d: OUT OF SYNC FROM eNB %d (T310 %d, N310 %d, N311 %d)\n ", LOG_I(RRC,"[UE %d] Frame %d: OUT OF SYNC FROM eNB %d (T310 %d, N310 %d, N311 %d)\n ",
Mod_idP,frameP,eNB_index, Mod_idP,frameP,eNB_index,
UE_rrc_inst[Mod_idP].Info[eNB_index].T310_cnt, UE_rrc_inst[Mod_idP].Info[eNB_index].T310_cnt,
UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt, UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt,
UE_rrc_inst[Mod_idP].Info[eNB_index].N311_cnt); UE_rrc_inst[Mod_idP].Info[eNB_index].N311_cnt);
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
{ {
MessageDef *message_p; MessageDef *message_p;
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_OUT_OF_SYNC_IND); message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_OUT_OF_SYNC_IND);
RRC_MAC_OUT_OF_SYNC_IND (message_p).frame = frameP; RRC_MAC_OUT_OF_SYNC_IND (message_p).frame = frameP;
RRC_MAC_OUT_OF_SYNC_IND (message_p).enb_index = eNB_index; RRC_MAC_OUT_OF_SYNC_IND (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_RRC_UE, Mod_idP + NB_eNB_INST, message_p); itti_send_msg_to_task (TASK_RRC_UE, Mod_idP + NB_eNB_INST, message_p);
} }
#else #else
UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt++; UE_rrc_inst[Mod_idP].Info[eNB_index].N310_cnt++;
#endif #endif
} }
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
int mac_get_rrc_lite_status(module_id_t Mod_idP,eNB_flag_t enb_flagP,uint8_t index){ int mac_get_rrc_lite_status(module_id_t Mod_idP,eNB_flag_t enb_flagP,uint8_t index){
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
if(enb_flagP == ENB_FLAG_YES) if(enb_flagP == ENB_FLAG_YES)
return(eNB_rrc_inst[Mod_idP].Info.UE[index].Status); return(eNB_rrc_inst[Mod_idP].Info.UE[index].Status);
else else
return(UE_rrc_inst[Mod_idP].Info[index].State); return(UE_rrc_inst[Mod_idP].Info[index].State);
} }
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
int mac_ue_ccch_success_ind(module_id_t Mod_idP, uint8_t eNB_index) { int mac_ue_ccch_success_ind(module_id_t Mod_idP, uint8_t eNB_index) {
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
{ {
MessageDef *message_p; MessageDef *message_p;
message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_CCCH_DATA_CNF); message_p = itti_alloc_new_message (TASK_MAC_UE, RRC_MAC_CCCH_DATA_CNF);
RRC_MAC_CCCH_DATA_CNF (message_p).enb_index = eNB_index; RRC_MAC_CCCH_DATA_CNF (message_p).enb_index = eNB_index;
itti_send_msg_to_task (TASK_RRC_UE, Mod_idP + NB_eNB_INST, message_p); itti_send_msg_to_task (TASK_RRC_UE, Mod_idP + NB_eNB_INST, message_p);
} }
#else #else
// reset the tx buffer to indicate RRC that ccch was successfully transmitted (for example if contention resolution succeeds) // reset the tx buffer to indicate RRC that ccch was successfully transmitted (for example if contention resolution succeeds)
UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size=0; UE_rrc_inst[Mod_idP].Srb0[eNB_index].Tx_buffer.payload_size=0;
#endif #endif
return 0; return 0;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment