Commit 9d4479fb authored by vettel's avatar vettel

sync

parent 83b3d708
......@@ -522,6 +522,7 @@ set(HWLIB_EXMIMO_SOURCE
add_library(oai_exmimodevif MODULE ${HWLIB_EXMIMO_SOURCE} )
include_directories("${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/")
#set (option_HWUSRPLIB_lib "-l uhd -lboost_thread -lboost_filesystem -lboost_system")
set(HWLIB_USRP_SOURCE
${OPENAIR_TARGETS}/ARCH/USRP/USERSPACE/LIB/usrp_lib.cpp
)
......@@ -1744,7 +1745,7 @@ add_executable(lte-softmodem
target_link_libraries (lte-softmodem -ldl
-Wl,--start-group
RRC_LIB S1AP_LIB S1AP_ENB ${X2AP_LIB} ${X2AP_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} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
RRC_LIB S1AP_LIB S1AP_ENB ${X2AP_LIB} ${X2AP_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} ${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7 -lboost_thread -lboost_filesystem -lboost_system
-Wl,--end-group )
target_link_libraries (lte-softmodem ${LIBXML2_LIBRARIES})
......
......@@ -1826,7 +1826,7 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
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 = 3150; //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;
......@@ -1842,14 +1842,15 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
CellsToAddModList = MeasObj->measObject.choice.measObjectEUTRA.cellsToAddModList;
// Add adjacent cell lists (6 per eNB)
for (i = 0; i < 6; i++) {
// 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->cellIndex = i + 1;
CellToAdd->cellIndex = 1;
CellToAdd->physCellId = 1;//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;
......@@ -1902,7 +1903,7 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
ASN_SEQUENCE_ADD(&ReportConfig_list->list, ReportConfig_A1);
if (ho_state == 1 /*HO_MEASURMENT */ ) {
// 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;
......@@ -1932,7 +1933,7 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
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.a3_Offset = 0; //10;
ReportConfig_A3->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.
eventA3.reportOnLeave = 1;
......@@ -1943,7 +1944,7 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
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.hysteresis = 0; // 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);
......@@ -2005,20 +2006,22 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
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;
// 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 0
// if (ho_state == 1 /*HO_MEASUREMENT */ ) {
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);
......@@ -2041,7 +2044,25 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
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));
}
// }
#endif
// Add quantity configuration
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 */
......@@ -2089,14 +2110,14 @@ rrc_eNB_generate_defaultRRCConnectionReconfiguration(const protocol_ctxt_t* cons
(DRB_ToReleaseList_t*)NULL, // DRB2_list,
(struct SPS_Config*)NULL, // *sps_Config,
(struct PhysicalConfigDedicated*)*physicalConfigDedicated,
#ifdef EXMIMO_IOT
NULL, NULL, NULL,NULL,
#else
//#ifdef EXMIMO_IOT
// NULL, NULL, NULL,NULL,
//#else
(MeasObjectToAddModList_t*)MeasObj_list,
(ReportConfigToAddModList_t*)ReportConfig_list,
(QuantityConfig_t*)quantityConfig,
(MeasIdToAddModList_t*)MeasId_list,
#endif
//#endif
(MAC_MainConfig_t*)mac_MainConfig,
(MeasGapConfig_t*)NULL,
(MobilityControlInfo_t*)NULL,
......@@ -2361,7 +2382,28 @@ rrc_eNB_process_MeasurementReport(
LOG_I(RRC, "[eNB %d] Frame %d: Process Measurement Report From UE %x (Measurement Id %d)\n",
ctxt_pP->module_id, ctxt_pP->frame, ctxt_pP->rnti, (int)measResults2->measId);
if (measResults2->measResultNeighCells==NULL) {
LOG_I(RRC, "Cells are not discovered\n");
}
else {
if(measResults2->measId == 1){
LOG_I(RRC, "Cells are discovered\n");
if (measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count > 0) {
LOG_I(RRC, "Physical Cell Id %d\n",
(int)measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId);
LOG_I(RRC, "RSRP of Target %d\n",
(int)*(measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->
measResult.rsrpResult));
LOG_I(RRC, "RSRQ of Target %d\n",
(int)*(measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->
measResult.rsrqResult));
}
}
else if (measResults2->measId == 4) {
LOG_I(RRC, "A3 event happened...\n");
if (measResults2->measResultNeighCells->choice.measResultListEUTRA.list.count > 0) {
LOG_I(RRC, "RSRP of Source %ld\n", measResults2->measResultPCell.rsrpResult);
LOG_I(RRC, "RSRQ of Source %ld\n", measResults2->measResultPCell.rsrqResult);
LOG_I(RRC, "Physical Cell Id %d\n",
(int)measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->physCellId);
LOG_I(RRC, "RSRP of Target %d\n",
......@@ -2371,6 +2413,12 @@ rrc_eNB_process_MeasurementReport(
(int)*(measResults2->measResultNeighCells->choice.measResultListEUTRA.list.array[0]->
measResult.rsrqResult));
}
exit(0);
}
else {
LOG_I(RRC, "Other events happened...\n");
}
}
#if defined(Rel10) || defined(Rel14)
LOG_I(RRC, "RSRP of Source %ld\n", measResults2->measResultPCell.rsrpResult);
......@@ -2424,7 +2472,7 @@ rrc_eNB_process_MeasurementReport(
// X2AP_HANDOVER_REQ(msg).e_rabs_tobesetu=;
/* TODO: don't do that, X2AP should find the target by itself */
X2AP_HANDOVER_REQ(msg).target_mod_id = get_adjacent_cell_mod_id(X2AP_HANDOVER_REQ(msg).target_physCellId);
X2AP_HANDOVER_REQ(msg).target_mod_id = 0;//get_adjacent_cell_mod_id(X2AP_HANDOVER_REQ(msg).target_physCellId);
LOG_I(RRC,
"[eNB %d] Frame %d: potential handover preparation: store the information in an intermediate structure in case of failure\n",
......@@ -2538,45 +2586,45 @@ rrc_eNB_generate_HandoverPreparationInformation(
/* simulation related logic */
if (mod_id_target != 0xFF) {
//UE_id_target = rrc_find_free_ue_index(modid_target);
ue_context_target_p =
rrc_eNB_get_ue_context(
&eNB_rrc_inst[mod_id_target],
ue_context_pP->ue_context.rnti);
// ue_context_target_p =
// rrc_eNB_get_ue_context(
// &eNB_rrc_inst[mod_id_target],
// ue_context_pP->ue_context.rnti);
/*UE_id_target = rrc_eNB_get_next_free_UE_index(
mod_id_target,
eNB_rrc_inst[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(&eNB_rrc_inst[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,
eNB_rrc_inst[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_target_p = rrc_eNB_allocate_new_UE_context(&eNB_rrc_inst[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,
// eNB_rrc_inst[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;
// 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);
......@@ -2780,9 +2828,9 @@ check_handovers(
ue_context_p->ue_context.handover_info->state = HO_CONFIGURED;
/* HACK HACK!! "works" only for one UE */
memcpy(UE_rrc_inst[0].sib1[0]->cellAccessRelatedInfo.cellIdentity.buf,
eNB_rrc_inst[ctxt_pP->module_id].carrier[0].sib1->cellAccessRelatedInfo.cellIdentity.buf,
4);
// memcpy(UE_rrc_inst[0].sib1[0]->cellAccessRelatedInfo.cellIdentity.buf,
// eNB_rrc_inst[ctxt_pP->module_id].carrier[0].sib1->cellAccessRelatedInfo.cellIdentity.buf,
// 4);
msg = itti_alloc_new_message(TASK_RRC_ENB, X2AP_HANDOVER_REQ_ACK);
/* TODO: remove this hack */
X2AP_HANDOVER_REQ_ACK(msg).target_mod_id = 1 - ctxt_pP->module_id;
......@@ -2822,6 +2870,8 @@ rrc_eNB_configure_rbs_handover(struct rrc_eNB_ue_context_s* ue_context_p, protoc
struct rrc_eNB_ue_context_s* ue_source_context;
uint16_t Idx;
return;
ue_source_context =
rrc_eNB_get_ue_context(
&eNB_rrc_inst[ue_context_p->ue_context.handover_info->modid_s],
......@@ -4976,7 +5026,7 @@ rrc_eNB_decode_dcch(
break;
case UL_DCCH_MessageType__c1_PR_measurementReport:
LOG_D(RRC,
LOG_I(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),
......@@ -5307,10 +5357,9 @@ rrc_eNB_decode_dcch(
}
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,
eNB_rrc_inst[ctxt_pP->module_id].HO_flag);
0); //eNB_rrc_inst[ctxt_pP->module_id].HO_flag
break;
case UL_DCCH_MessageType__c1_PR_ulHandoverPreparationTransfer:
......
......@@ -407,7 +407,7 @@ void x2ap_eNB_handle_handover_req(instance_t instance,
x2ap_eNB_instance_t *instance_p;
x2ap_eNB_data_t *target;
const Enb_properties_array_t *enb_properties = enb_config_get();
int target_enb_id = enb_properties->properties[x2ap_handover_req->target_mod_id]->eNB_id;
int target_enb_id = 0xe00 + x2ap_handover_req->target_physCellId;//enb_properties->properties[x2ap_handover_req->target_mod_id]->eNB_id;
instance_p = x2ap_eNB_get_instance(instance);
DevAssert(instance_p != NULL);
......@@ -434,7 +434,7 @@ void x2ap_eNB_handle_handover_req_ack(instance_t instance,
x2ap_eNB_instance_t *instance_p;
x2ap_eNB_data_t *target;
const Enb_properties_array_t *enb_properties = enb_config_get();
int target_enb_id = enb_properties->properties[x2ap_handover_req_ack->target_mod_id]->eNB_id;
int target_enb_id = 3584; //enb_properties->properties[x2ap_handover_req_ack->target_mod_id]->eNB_id;
instance_p = x2ap_eNB_get_instance(instance);
DevAssert(instance_p != NULL);
......
......@@ -235,7 +235,7 @@ x2ap_eNB_handle_handover_preparation(uint32_t assoc_id,
X2AP_HANDOVER_REQ(m).source_x2id = x2HandoverRequest->old_eNB_UE_X2AP_ID;
X2AP_HANDOVER_REQ(m).source_rnti = x2id_to_source_rnti[x2HandoverRequest->old_eNB_UE_X2AP_ID];
if ((x2HandoverRequest->uE_ContextInformation.aS_SecurityInformation.key_eNodeB_star.buf) &&
(x2HandoverRequest->uE_ContextInformation.aS_SecurityInformation.key_eNodeB_star.size == 256)) {
(x2HandoverRequest->uE_ContextInformation.aS_SecurityInformation.key_eNodeB_star.size == 32)) {
memcpy(X2AP_HANDOVER_REQ(m).kenb, x2HandoverRequest->uE_ContextInformation.aS_SecurityInformation.key_eNodeB_star.buf, 32);
X2AP_HANDOVER_REQ(m).kenb_ncc = x2HandoverRequest->uE_ContextInformation.aS_SecurityInformation.nextHopChainingCount;
itti_send_msg_to_task(TASK_RRC_ENB, x2ap_eNB_data->x2ap_eNB_instance->instance, m);
......
......@@ -33,6 +33,8 @@
#include <uhd/version.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/thread.hpp>
#include <boost/format.hpp>
#include <iostream>
#include <complex>
#include <fstream>
......@@ -92,12 +94,181 @@ typedef struct {
int num_seq_errors;
int64_t tx_count;
int64_t rx_count;
int wait_for_first_pps;
int use_gps;
//! timestamp of RX packet
openair0_timestamp rx_timestamp;
} usrp_state_t;
//void print_notes(void)
//{
// Helpful notes
// std::cout << boost::format("**************************************Helpful Notes on Clock/PPS Selection**************************************\n");
// std::cout << boost::format("As you can see, the default 10 MHz Reference and 1 PPS signals are now from the GPSDO.\n");
// std::cout << boost::format("If you would like to use the internal reference(TCXO) in other applications, you must configure that explicitly.\n");
// std::cout << boost::format("You can no longer select the external SMAs for 10 MHz or 1 PPS signaling.\n");
// std::cout << boost::format("****************************************************************************************************************\n");
//}
static int sync_to_gps(openair0_device *device)
{
uhd::set_thread_priority_safe();
//std::string args;
//Set up program options
//po::options_description desc("Allowed options");
//desc.add_options()
//("help", "help message")
//("args", po::value<std::string>(&args)->default_value(""), "USRP device arguments")
//;
//po::variables_map vm;
//po::store(po::parse_command_line(argc, argv, desc), vm);
//po::notify(vm);
//Print the help message
//if (vm.count("help"))
//{
// std::cout << boost::format("Synchronize USRP to GPS %s") % desc << std::endl;
// return EXIT_FAILURE;
//}
//Create a USRP device
//std::cout << boost::format("\nCreating the USRP device with: %s...\n") % args;
//uhd::usrp::multi_usrp::sptr usrp = uhd::usrp::multi_usrp::make(args);
//std::cout << boost::format("Using Device: %s\n") % usrp->get_pp_string();
usrp_state_t *s = (usrp_state_t*)device->priv;
try
{
size_t num_mboards = s->usrp->get_num_mboards();
size_t num_gps_locked = 0;
for (size_t mboard = 0; mboard < num_mboards; mboard++)
{
std::cout << "Synchronizing mboard " << mboard << ": " << s->usrp->get_mboard_name(mboard) << std::endl;
//Set references to GPSDO
s->usrp->set_clock_source("gpsdo", mboard);
s->usrp->set_time_source("gpsdo", mboard);
//std::cout << std::endl;
//print_notes();
//std::cout << std::endl;
//Check for 10 MHz lock
std::vector<std::string> sensor_names = s->usrp->get_mboard_sensor_names(mboard);
if(std::find(sensor_names.begin(), sensor_names.end(), "ref_locked") != sensor_names.end())
{
std::cout << "Waiting for reference lock..." << std::flush;
bool ref_locked = false;
for (int i = 0; i < 30 and not ref_locked; i++)
{
ref_locked = s->usrp->get_mboard_sensor("ref_locked", mboard).to_bool();
if (not ref_locked)
{
std::cout << "." << std::flush;
boost::this_thread::sleep(boost::posix_time::seconds(1));
}
}
if(ref_locked)
{
std::cout << "LOCKED" << std::endl;
} else {
std::cout << "FAILED" << std::endl;
std::cout << "Failed to lock to GPSDO 10 MHz Reference. Exiting." << std::endl;
exit(EXIT_FAILURE);
}
}
else
{
std::cout << boost::format("ref_locked sensor not present on this board.\n");
}
//Wait for GPS lock
bool gps_locked = s->usrp->get_mboard_sensor("gps_locked", mboard).to_bool();
if(gps_locked)
{
num_gps_locked++;
std::cout << boost::format("GPS Locked\n");
}
else
{
std::cerr << "WARNING: GPS not locked - time will not be accurate until locked" << std::endl;
}
//Set to GPS time
uhd::time_spec_t gps_time = uhd::time_spec_t(time_t(s->usrp->get_mboard_sensor("gps_time", mboard).to_int()));
//s->usrp->set_time_next_pps(gps_time+1.0, mboard);
s->usrp->set_time_next_pps(uhd::time_spec_t(0.0));
//Wait for it to apply
//The wait is 2 seconds because N-Series has a known issue where
//the time at the last PPS does not properly update at the PPS edge
//when the time is actually set.
boost::this_thread::sleep(boost::posix_time::seconds(2));
//Check times
gps_time = uhd::time_spec_t(time_t(s->usrp->get_mboard_sensor("gps_time", mboard).to_int()));
uhd::time_spec_t time_last_pps = s->usrp->get_time_last_pps(mboard);
std::cout << "USRP time: " << (boost::format("%0.9f") % time_last_pps.get_real_secs()) << std::endl;
std::cout << "GPSDO time: " << (boost::format("%0.9f") % gps_time.get_real_secs()) << std::endl;
//if (gps_time.get_real_secs() == time_last_pps.get_real_secs())
// std::cout << std::endl << "SUCCESS: USRP time synchronized to GPS time" << std::endl << std::endl;
//else
// std::cerr << std::endl << "ERROR: Failed to synchronize USRP time to GPS time" << std::endl << std::endl;
}
if (num_gps_locked == num_mboards and num_mboards > 1)
{
//Check to see if all USRP times are aligned
//First, wait for PPS.
uhd::time_spec_t time_last_pps = s->usrp->get_time_last_pps();
while (time_last_pps == s->usrp->get_time_last_pps())
{
boost::this_thread::sleep(boost::posix_time::milliseconds(1));
}
//Sleep a little to make sure all devices have seen a PPS edge
boost::this_thread::sleep(boost::posix_time::milliseconds(200));
//Compare times across all mboards
bool all_matched = true;
uhd::time_spec_t mboard0_time = s->usrp->get_time_last_pps(0);
for (size_t mboard = 1; mboard < num_mboards; mboard++)
{
uhd::time_spec_t mboard_time = s->usrp->get_time_last_pps(mboard);
if (mboard_time != mboard0_time)
{
all_matched = false;
std::cerr << (boost::format("ERROR: Times are not aligned: USRP 0=%0.9f, USRP %d=%0.9f")
% mboard0_time.get_real_secs()
% mboard
% mboard_time.get_real_secs()) << std::endl;
}
}
if (all_matched)
{
std::cout << "SUCCESS: USRP times aligned" << std::endl << std::endl;
} else {
std::cout << "ERROR: USRP times are not aligned" << std::endl << std::endl;
}
}
}
catch (std::exception& e)
{
std::cout << boost::format("\nError: %s") % e.what();
std::cout << boost::format("This could mean that you have not installed the GPSDO correctly.\n\n");
std::cout << boost::format("Visit one of these pages if the problem persists:\n");
std::cout << boost::format(" * N2X0/E1X0: http://files.ettus.com/manual/page_gpsdo.html");
std::cout << boost::format(" * X3X0: http://files.ettus.com/manual/page_gpsdo_x3x0.html\n\n");
std::cout << boost::format(" * E3X0: http://files.ettus.com/manual/page_usrp_e3x0.html#e3x0_hw_gps\n\n");
exit(EXIT_FAILURE);
}
return EXIT_SUCCESS;
}
/*! \brief Called to start the USRP transceiver. Return 0 if OK, < 0 if error
@param device pointer to the device structure specific to the RF hardware target
......@@ -108,10 +279,17 @@ static int trx_usrp_start(openair0_device *device) {
// init recv and send streaming
uhd::stream_cmd_t cmd(uhd::stream_cmd_t::STREAM_MODE_START_CONTINUOUS);
cmd.time_spec = s->usrp->get_time_now() + uhd::time_spec_t(0.05);
// should be s->usrp->get_time_next_pps(&cmd.time_spec);
//cmd.time_spec = s->usrp->get_time_now() + uhd::time_spec_t(0.05);
LOG_I(PHY,"Time in secs now: %llu \n", s->usrp->get_time_now().to_ticks(s->sample_rate));
LOG_I(PHY,"Time in secs last pps: %llu \n", s->usrp->get_time_last_pps().to_ticks(s->sample_rate));
cmd.time_spec = s->usrp->get_time_last_pps() + uhd::time_spec_t(1.0);
cmd.stream_now = false; // start at constant delay
s->rx_stream->issue_stream_cmd(cmd);
if (s->use_gps == 1) s->wait_for_first_pps = 1;
else s->wait_for_first_pps = 0;
s->tx_md.time_spec = cmd.time_spec + uhd::time_spec_t(1-(double)s->tx_forward_nsamps/s->sample_rate);
s->tx_md.has_time_spec = true;
s->tx_md.start_of_burst = true;
......@@ -227,9 +405,11 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
while (samples_received != nsamps) {
samples_received += s->rx_stream->recv(buff_tmp[0]+samples_received,
nsamps-samples_received, s->rx_md);
if (s->rx_md.error_code!=uhd::rx_metadata_t::ERROR_CODE_NONE)
if ((s->wait_for_first_pps == 0) && (s->rx_md.error_code!=uhd::rx_metadata_t::ERROR_CODE_NONE))
break;
if ((s->wait_for_first_pps == 1) && (samples_received != nsamps)) { printf("sleep...\n");} //usleep(100);
}
if (samples_received == nsamps) s->wait_for_first_pps=0;
}
// bring RX data into 12 LSBs for softmodem RX
for (int i=0; i<cc; i++) {
......@@ -468,6 +648,8 @@ extern "C" {
int device_init(openair0_device* device, openair0_config_t *openair0_cfg) {
uhd::set_thread_priority_safe(1.0);
usrp_state_t *s = (usrp_state_t*)calloc(sizeof(usrp_state_t),1);
s->use_gps =1;
// Initialize USRP device
device->openair0_cfg = openair0_cfg;
......@@ -561,10 +743,13 @@ extern "C" {
// set master clock rate and sample rate for tx & rx for streaming
// lock mboard clocks
if (openair0_cfg[0].clock_source == internal)
s->usrp->set_clock_source("internal");
else
if (openair0_cfg[0].clock_source == internal){
//s->usrp->set_clock_source("internal");
}
else{
s->usrp->set_clock_source("external");
s->usrp->set_time_source("external");
}
device->type = USRP_B200_DEV;
if ((vers == 3) && (subvers == 9) && (subsubvers>=2)) {
......@@ -683,8 +868,6 @@ extern "C" {
for(int i=0; i<s->usrp->get_rx_num_channels() && i<openair0_cfg[0].rx_num_channels; i++)
s->usrp->set_rx_bandwidth(openair0_cfg[0].rx_bw,i);
s->usrp->set_time_now(uhd::time_spec_t(0.0));
for (int i=0; i<openair0_cfg[0].rx_num_channels; i++) {
LOG_I(PHY,"RX Channel %d\n",i);
LOG_I(PHY," Actual RX sample rate: %fMSps...\n",s->usrp->get_rx_rate(i)/1e6);
......@@ -726,6 +909,14 @@ extern "C" {
s->tx_forward_nsamps = 90;
if(is_equal(s->sample_rate, (double)7.68e6))
s->tx_forward_nsamps = 50;
if (s->use_gps == 1) {
if (sync_to_gps(device)) {
LOG_I(PHY,"USRP fails to sync with GPS...\n");
exit(0);
}
}
return 0;
}
}
......
Active_eNBs = ( "eNB_Eurecom_LTEBox");
Active_eNBs = ( "eNB_Eurecom_X2HO_LTEBox");
# Asn1_verbosity, choice in: none, info, annoying
Asn1_verbosity = "none";
......@@ -6,7 +6,7 @@ eNBs =
(
{
////////// Identification parameters:
eNB_ID = 0xe00;
eNB_ID = 0xe01;
cell_type = "CELL_MACRO_ENB";
......@@ -33,7 +33,7 @@ eNBs =
eutra_band = 7;
downlink_frequency = 2660000000L;
uplink_frequency_offset = -120000000;
Nid_cell = 0;
Nid_cell = 1;
N_RB_DL = 25;
Nid_cell_mbsfn = 0;
nb_antenna_ports = 1;
......@@ -137,14 +137,14 @@ eNBs =
////////// MME parameters:
mme_ip_address = ( { ipv4 = "192.168.12.26";
mme_ip_address = ( { ipv4 = "192.168.117.104";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
}
);
///X2
target_enb_x2_ip_address = ( { ipv4 = "127.0.0.10";
target_enb_x2_ip_address = ( { ipv4 = "192.168.117.103";
ipv6 = "192:168:30::17";
active = "yes";
preference = "ipv4";
......@@ -154,14 +154,14 @@ eNBs =
NETWORK_INTERFACES :
{
ENB_INTERFACE_NAME_FOR_S1_MME = "eth6";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.12.82/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth6";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.12.82/24";
ENB_INTERFACE_NAME_FOR_S1_MME = "eth3";
ENB_IPV4_ADDRESS_FOR_S1_MME = "192.168.117.107/24";
ENB_INTERFACE_NAME_FOR_S1U = "eth3";
ENB_IPV4_ADDRESS_FOR_S1U = "192.168.117.107/24";
ENB_PORT_FOR_S1U = 2152; # Spec 2152
ENB_INTERFACE_NAME_FOR_X2C = "lo";
ENB_IPV4_ADDRESS_FOR_X2C = "127.0.0.11/24";
ENB_INTERFACE_NAME_FOR_X2C = "eth3";
ENB_IPV4_ADDRESS_FOR_X2C = "192.168.117.107/24";
ENB_PORT_FOR_X2C = 36422; # Spec ?
ENB_INTERFACE_NAME_FOR_X2U = "eth0";
......
......@@ -1047,6 +1047,7 @@ void rx_rf(PHY_VARS_eNB *eNB,int *frame,int *subframe) {
exit_fun("Exiting");
}
} else {
LOG_I(PHY,"First Frame: %d , First Subframe: %d Timestamp: %"PRId64" \n",proc->frame_rx, proc->subframe_rx, proc->timestamp_rx);
proc->first_rx--;
*frame = proc->frame_rx;
*subframe = proc->subframe_rx;
......
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