Commit f18e4009 authored by Navid Nikaein's avatar Navid Nikaein

* merge/add handover procedure for the access stratum (enabled with the -H), status: experimental.

* fix a bug in BSR computation
* add a python script to launch meld if the diff3 in subvsersion/config file is set to the targets/SCRIPTS/svn-merge-meld.py
* pre-ci passed (100%) 


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4309 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 84fb51d8
......@@ -9,6 +9,7 @@
#include "RadioResourceConfigDedicated.h"
#include "TDD-Config.h"
#include "MBSFN-SubframeConfigList.h"
#include "MobilityControlInfo.h"
#else
/**
......@@ -121,6 +122,17 @@ void phy_config_sib2_ue(u8 Mod_id,u8 CH_index,
AdditionalSpectrumEmission_t *additionalSpectrumEmission,
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList);
/*!
\fn phy_config_afterHO_ue
\brief Configure Common PHY parameters from mobilityControlInfo
@param Mod_id
@param eNB_index
@param mobilityControlInfo pointer to the mobility control information for handover
@param ho_failed flag to indicated whether the ho was successful or not
*/
void phy_config_afterHO_ue(u8 Mod_id,u8 eNB_index,
MobilityControlInfo_t *mobilityControlInfo,u8 ho_failed);
/*!
\fn void phy_config_sib2_eNB(u8 Mod_id,
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
......
......@@ -428,6 +428,118 @@ void phy_config_dedicated_eNB_step2(PHY_VARS_eNB *phy_vars_eNB) {
}
}
/*
* Configures UE MAC and PHY with radioResourceCommon received in mobilityControlInfo IE during Handover
*/
void phy_config_afterHO_ue(u8 Mod_id,u8 eNB_id, MobilityControlInfo_t *mobilityControlInfo, u8 ho_failed) {
if(mobilityControlInfo!=NULL) {
RadioResourceConfigCommon_t *radioResourceConfigCommon = &mobilityControlInfo->radioResourceConfigCommon;
LOG_I(PHY,"radioResourceConfigCommon %p\n", radioResourceConfigCommon);
memcpy((void *)&PHY_vars_UE_g[Mod_id]->lte_frame_parms_before_ho,
(void *)&PHY_vars_UE_g[Mod_id]->lte_frame_parms,
sizeof(LTE_DL_FRAME_PARMS));
PHY_vars_UE_g[Mod_id]->ho_triggered = 1;
//PHY_vars_UE_g[UE_id]->UE_mode[0] = PRACH;
LTE_DL_FRAME_PARMS *lte_frame_parms = &PHY_vars_UE_g[Mod_id]->lte_frame_parms;
int N_ZC;
u8 prach_fmt;
int u;
LOG_I(PHY,"[UE%d] Frame %d: Handover triggered: Applying radioResourceConfigCommon from eNB %d\n",
Mod_id,PHY_vars_UE_g[Mod_id]->frame,eNB_id);
lte_frame_parms->prach_config_common.rootSequenceIndex =radioResourceConfigCommon->prach_Config.rootSequenceIndex;
lte_frame_parms->prach_config_common.prach_Config_enabled=1;
lte_frame_parms->prach_config_common.prach_ConfigInfo.prach_ConfigIndex =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->prach_ConfigIndex;
lte_frame_parms->prach_config_common.prach_ConfigInfo.highSpeedFlag =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->highSpeedFlag;
lte_frame_parms->prach_config_common.prach_ConfigInfo.zeroCorrelationZoneConfig =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->zeroCorrelationZoneConfig;
lte_frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset =radioResourceConfigCommon->prach_Config.prach_ConfigInfo->prach_FreqOffset;
prach_fmt = get_prach_fmt(radioResourceConfigCommon->prach_Config.prach_ConfigInfo->prach_ConfigIndex,lte_frame_parms->frame_type);
N_ZC = (prach_fmt <4)?839:139;
u = (prach_fmt < 4) ? prach_root_sequence_map0_3[lte_frame_parms->prach_config_common.rootSequenceIndex] :
prach_root_sequence_map4[lte_frame_parms->prach_config_common.rootSequenceIndex];
//compute_prach_seq(u,N_ZC, PHY_vars_UE_g[Mod_id]->X_u);
compute_prach_seq(&PHY_vars_UE_g[Mod_id]->lte_frame_parms.prach_config_common,
lte_frame_parms->frame_type,
PHY_vars_UE_g[Mod_id]->X_u);
lte_frame_parms->pucch_config_common.deltaPUCCH_Shift = 1+radioResourceConfigCommon->pucch_ConfigCommon->deltaPUCCH_Shift;
lte_frame_parms->pucch_config_common.nRB_CQI = radioResourceConfigCommon->pucch_ConfigCommon->nRB_CQI;
lte_frame_parms->pucch_config_common.nCS_AN = radioResourceConfigCommon->pucch_ConfigCommon->nCS_AN;
lte_frame_parms->pucch_config_common.n1PUCCH_AN = radioResourceConfigCommon->pucch_ConfigCommon->n1PUCCH_AN;
lte_frame_parms->pdsch_config_common.referenceSignalPower = radioResourceConfigCommon->pdsch_ConfigCommon->referenceSignalPower;
lte_frame_parms->pdsch_config_common.p_b = radioResourceConfigCommon->pdsch_ConfigCommon->p_b;
lte_frame_parms->pusch_config_common.n_SB = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.n_SB;
lte_frame_parms->pusch_config_common.hoppingMode = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode;
lte_frame_parms->pusch_config_common.pusch_HoppingOffset = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset;
lte_frame_parms->pusch_config_common.enable64QAM = radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM;
lte_frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.groupHoppingEnabled = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled;
lte_frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH;
lte_frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled;
lte_frame_parms->pusch_config_common.ul_ReferenceSignalsPUSCH.cyclicShift = radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift;
init_ul_hopping(lte_frame_parms);
lte_frame_parms->soundingrs_ul_config_common.enabled_flag = 0;
if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon->present==SoundingRS_UL_ConfigCommon_PR_setup) {
lte_frame_parms->soundingrs_ul_config_common.enabled_flag = 1;
lte_frame_parms->soundingrs_ul_config_common.srs_BandwidthConfig = radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.srs_BandwidthConfig;
lte_frame_parms->soundingrs_ul_config_common.srs_SubframeConfig = radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.srs_SubframeConfig;
lte_frame_parms->soundingrs_ul_config_common.ackNackSRS_SimultaneousTransmission = radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.ackNackSRS_SimultaneousTransmission;
if (radioResourceConfigCommon->soundingRS_UL_ConfigCommon->choice.setup.srs_MaxUpPts)
lte_frame_parms->soundingrs_ul_config_common.srs_MaxUpPts = 1;
else
lte_frame_parms->soundingrs_ul_config_common.srs_MaxUpPts = 0;
}
lte_frame_parms->ul_power_control_config_common.p0_NominalPUSCH = radioResourceConfigCommon->uplinkPowerControlCommon->p0_NominalPUSCH;
lte_frame_parms->ul_power_control_config_common.alpha = radioResourceConfigCommon->uplinkPowerControlCommon->alpha;
lte_frame_parms->ul_power_control_config_common.p0_NominalPUCCH = radioResourceConfigCommon->uplinkPowerControlCommon->p0_NominalPUCCH;
lte_frame_parms->ul_power_control_config_common.deltaPreambleMsg3 = radioResourceConfigCommon->uplinkPowerControlCommon->deltaPreambleMsg3;
lte_frame_parms->ul_power_control_config_common.deltaF_PUCCH_Format1 = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format1;
lte_frame_parms->ul_power_control_config_common.deltaF_PUCCH_Format1b = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format1b;
lte_frame_parms->ul_power_control_config_common.deltaF_PUCCH_Format2 = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format2;
lte_frame_parms->ul_power_control_config_common.deltaF_PUCCH_Format2a = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format2a;
lte_frame_parms->ul_power_control_config_common.deltaF_PUCCH_Format2b = radioResourceConfigCommon->uplinkPowerControlCommon->deltaFList_PUCCH.deltaF_PUCCH_Format2b;
lte_frame_parms->maxHARQ_Msg3Tx = radioResourceConfigCommon->rach_ConfigCommon->maxHARQ_Msg3Tx;
// Now configure some of the Physical Channels
if (radioResourceConfigCommon->antennaInfoCommon)
lte_frame_parms->nb_antennas_tx = (1<<radioResourceConfigCommon->antennaInfoCommon->antennaPortsCount);
else
lte_frame_parms->nb_antennas_tx = 1;
//PHICH
if (radioResourceConfigCommon->antennaInfoCommon) {
lte_frame_parms->phich_config_common.phich_resource = radioResourceConfigCommon->phich_Config->phich_Resource;
lte_frame_parms->phich_config_common.phich_duration = radioResourceConfigCommon->phich_Config->phich_Duration;
}
//Target CellId
lte_frame_parms->Nid_cell = mobilityControlInfo->targetPhysCellId;
lte_frame_parms->nushift = lte_frame_parms->Nid_cell%6;
// PUCCH
init_ncs_cell(lte_frame_parms,PHY_vars_UE_g[Mod_id]->ncs_cell);
init_ul_hopping(lte_frame_parms);
// RNTI
PHY_vars_UE_g[Mod_id]->lte_ue_pdcch_vars[eNB_id]->crnti = mobilityControlInfo->newUE_Identity.buf[0]|(mobilityControlInfo->newUE_Identity.buf[1]<<8);
}
if(ho_failed) {
LOG_D(PHY,"[UE%d] Handover failed, triggering RACH procedure\n",Mod_id);
memcpy((void *)&PHY_vars_UE_g[Mod_id]->lte_frame_parms,(void *)&PHY_vars_UE_g[Mod_id]->lte_frame_parms_before_ho, sizeof(LTE_DL_FRAME_PARMS));
PHY_vars_UE_g[Mod_id]->UE_mode[eNB_id] = PRACH;
}
}
void phy_config_meas_ue(u8 Mod_id,u8 eNB_index,u8 n_adj_cells,unsigned int *adj_cell_id) {
......
......@@ -151,6 +151,13 @@ void lte_ue_measurements_emul(PHY_VARS_UE *phy_vars_ue,u8 last_slot,u8 eNB_id);
@returns Path loss in dB
*/
s16 get_PL(u8 Mod_id,u8 eNB_index);
u8 get_RSRP(u8 Mod_id,u8 eNB_index);
u8 get_RSRQ(u8 Mod_id,u8 eNB_index);
u8 get_n_adj_cells(u8 Mod_id);
s8 get_rx_total_gain_dB(u8 Mod_id);
s8 get_RSSI(u8 Mod_id);
s8 set_RSRP_filtered(u8 Mod_id,u8 eNB_index,float rsrp);
s8 set_RSRQ_filtered(u8 Mod_id,u8 eNB_index,float rstq);
//! Automatic gain control
void phy_adjust_gain (PHY_VARS_UE *phy_vars_ue,
......
......@@ -68,6 +68,70 @@ s16 get_PL(u8 Mod_id,u8 eNB_index) {
phy_vars_ue->lte_frame_parms.pdsch_config_common.referenceSignalPower));
}
u8 get_n_adj_cells (u8 Mod_id){
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id];
if (phy_vars_ue)
return phy_vars_ue->PHY_measurements.n_adj_cells;
else
return 0;
}
s8 get_rx_total_gain_dB (u8 Mod_id){
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id];
if (phy_vars_ue)
return phy_vars_ue->rx_total_gain_dB;
else
return -1;
}
s8 get_RSSI (u8 Mod_id){
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id];
if (phy_vars_ue)
return phy_vars_ue->PHY_measurements.rssi;
else
return -1;
}
u8 get_RSRP(u8 Mod_id,u8 eNB_index) {
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id];
if (phy_vars_ue)
return phy_vars_ue->PHY_measurements.rsrp[eNB_index];
return 0;
}
u8 get_RSRQ(u8 Mod_id,u8 eNB_index) {
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id];
if (phy_vars_ue)
return phy_vars_ue->PHY_measurements.rsrq[eNB_index];
return 0;
}
s8 set_RSRP_filtered(u8 Mod_id,u8 eNB_index,float rsrp) {
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id];
if (phy_vars_ue){
phy_vars_ue->PHY_measurements.rsrp_filtered[eNB_index]=rsrp;
return 0;
}
LOG_W(PHY,"[UE%d] could not set the rsrp\n",Mod_id);
return -1;
}
s8 set_RSRQ_filtered(u8 Mod_id,u8 eNB_index,float rsrq) {
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id];
if (phy_vars_ue){
phy_vars_ue->PHY_measurements.rsrq_filtered[eNB_index]=rsrq;
return 0;
}
LOG_W(PHY,"[UE%d] could not set the rsrq\n",Mod_id);
return -1;
}
void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue,
u8 slot,
......@@ -202,21 +266,24 @@ void ue_rrc_measurements(PHY_VARS_UE *phy_vars_ue,
}
else { // Do abstraction of RSRP and RSRQ
phy_vars_ue->PHY_measurements.rssi = phy_vars_ue->PHY_measurements.rx_power_avg[0];
// dummay value for the moment
phy_vars_ue->PHY_measurements.rsrp[eNB_offset] = -93 ;
phy_vars_ue->PHY_measurements.rsrq[eNB_offset] = 3;
}
if (((phy_vars_ue->frame %10) == 0) && (slot == 1)) {
#ifdef DEBUG_MEAS
if (eNB_offset == 0)
if (eNB_offset == 0)
LOG_D(PHY,"[UE %d] Frame %d, slot %d RRC Measurements => rssi %3.1f dBm (digital: %3.1f dB)\n",phy_vars_ue->Mod_id,
phy_vars_ue->frame,slot,10*log10(phy_vars_ue->PHY_measurements.rssi)-phy_vars_ue->rx_total_gain_dB,
10*log10(phy_vars_ue->PHY_measurements.rssi));
LOG_D(PHY,"[UE %d] Frame %d, slot %d RRC Measurements (idx %d, Cell id %d) => rsrp: %3.1f (%3.1f) dBm, rsrq: %3.1f dB\n",
phy_vars_ue->Mod_id,
phy_vars_ue->frame,slot,eNB_offset,
(eNB_offset>0) ? phy_vars_ue->PHY_measurements.adj_cell_id[eNB_offset-1] : phy_vars_ue->lte_frame_parms.Nid_cell,
(dB_fixed_times10(phy_vars_ue->PHY_measurements.rsrp[eNB_offset])/10.0)-phy_vars_ue->rx_total_gain_dB-dB_fixed(phy_vars_ue->lte_frame_parms.N_RB_DL*12),
(10*log10(phy_vars_ue->PHY_measurements.rx_power_avg[0])/10.0)-phy_vars_ue->rx_total_gain_dB-dB_fixed(phy_vars_ue->lte_frame_parms.N_RB_DL*12),
(10*log10(phy_vars_ue->PHY_measurements.rsrq[eNB_offset]))-20);
LOG_D(PHY,"[UE %d] Frame %d, slot %d RRC Measurements (idx %d, Cell id %d) => rsrp: %3.1f (%3.1f) dBm, rsrq: %3.1f dB\n",
phy_vars_ue->Mod_id,
phy_vars_ue->frame,slot,eNB_offset,
(eNB_offset>0) ? phy_vars_ue->PHY_measurements.adj_cell_id[eNB_offset-1] : phy_vars_ue->lte_frame_parms.Nid_cell,
(dB_fixed_times10(phy_vars_ue->PHY_measurements.rsrp[eNB_offset])/10.0)-phy_vars_ue->rx_total_gain_dB-dB_fixed(phy_vars_ue->lte_frame_parms.N_RB_DL*12),
(10*log10(phy_vars_ue->PHY_measurements.rx_power_avg[0])/10.0)-phy_vars_ue->rx_total_gain_dB-dB_fixed(phy_vars_ue->lte_frame_parms.N_RB_DL*12),
(10*log10(phy_vars_ue->PHY_measurements.rsrq[eNB_offset]))-20);
#endif
......
......@@ -331,8 +331,11 @@ typedef struct
s8 tx_power_max_dBm;
u32 frame;
u8 n_connected_eNB;
u8 ho_initiated;
u8 ho_triggered;
PHY_MEASUREMENTS PHY_measurements; /// Measurement variables
LTE_DL_FRAME_PARMS lte_frame_parms;
LTE_DL_FRAME_PARMS lte_frame_parms_before_ho; // frame parame before ho used to recover if ho fails
LTE_UE_COMMON lte_ue_common_vars;
LTE_UE_PDSCH *lte_ue_pdsch_vars[NUMBER_OF_CONNECTED_eNB_MAX+1];
......
......@@ -350,6 +350,8 @@ typedef struct
unsigned int adj_cell_id[6];
int rsrq[7];
int rsrp[7];
float rsrp_filtered[7]; // after layer 3 filtering
float rsrq_filtered[7];
// common measurements
//! estimated noise power (linear)
unsigned int n0_power[NB_ANTENNAS_RX];
......
......@@ -401,6 +401,9 @@ s32 remove_ue(u16 rnti, PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag);
void process_timing_advance(u8 Mod_id,s16 timing_advance);
void process_timing_advance_rar(PHY_VARS_UE *phy_vars_ue,u16 timing_advance);
unsigned int get_tx_amp(int gain_dBm, int gain_max_dBm);
void phy_reset_ue(u8 Mod_id,u8 eNB_index);
/** \brief This function retrives the resource (n1_pucch) corresponding to a PDSCH transmission in
subframe n-4 which is acknowledged in subframe n (for FDD) according to n1_pucch = Ncce + N1_pucch. For
......
......@@ -2829,9 +2829,11 @@ void phy_procedures_eNB_RX(unsigned char last_slot,PHY_VARS_eNB *phy_vars_eNB,u8
LOG_I(PHY,"[eNB] Frame %d, Subframe %d : ULSCH SDU (RX harq_pid %d) %d bytes:\n",phy_vars_eNB->frame,last_slot>>1,
harq_pid,phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->TBS>>3);
for (j=0;j<phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->TBS>>3;j++)
LOG_T(PHY,"%x.",phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->c[0][j]);
LOG_T(PHY,"\n");
if (phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->c[0]!=NULL){
for (j=0;j<phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->TBS>>3;j++)
LOG_T(PHY,"%x.",phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->c[0][j]);
LOG_T(PHY,"\n");
}
//dump_ulsch(phy_vars_eNB, last_slot>>1, i);
......
......@@ -248,6 +248,39 @@ void dump_dlsch_ra(PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 subframe) {
}
#endif
void phy_reset_ue(u8 Mod_id,u8 eNB_index) {
// This flushes ALL DLSCH and ULSCH harq buffers of ALL connected eNBs...add the eNB_index later
// for more flexibility
u8 i,j,k;
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id];
//[NUMBER_OF_CONNECTED_eNB_MAX][2];
for(i=0;i<NUMBER_OF_CONNECTED_eNB_MAX;i++) {
for(j=0;j<2;j++) {
//DL HARQ
if(phy_vars_ue->dlsch_ue[i][j]) {
for(k=0;k<NUMBER_OF_HARQ_PID_MAX && phy_vars_ue->dlsch_ue[i][j]->harq_processes[k];k++) {
phy_vars_ue->dlsch_ue[i][j]->harq_processes[k]->status = SCH_IDLE;
}
}
}
//UL HARQ
if(phy_vars_ue->ulsch_ue[i]) {
for(k=0;k<NUMBER_OF_HARQ_PID_MAX && phy_vars_ue->ulsch_ue[i]->harq_processes[k];k++) {
phy_vars_ue->ulsch_ue[i]->harq_processes[k]->status = SCH_IDLE;
//Set NDIs for all UL HARQs to 0
phy_vars_ue->ulsch_ue[i]->harq_processes[k]->Ndi = 0;
}
}
// flush Msg3 buffer
phy_vars_ue->ulsch_ue_Msg3_active[i] = 0;
}
}
void ra_failed(u8 Mod_id,u8 eNB_index) {
// if contention resolution fails, go back to PRACH
......@@ -3194,6 +3227,10 @@ int phy_procedures_RN_UE_RX(u8 last_slot, u8 next_slot, relaying_type_t r_type)
phy_vars_ue->UE_mode[eNB_id] = RESYNCH;
mac_xface->macphy_exit("Connection lost");
//exit(-1);
} else if (ret == PHY_HO_PRACH) {
LOG_I(PHY,"[UE %d] Frame %d, subframe %d, return to PRACH and perform a contention-free access\n",
phy_vars_ue->Mod_id,phy_vars_ue->frame,next_slot>>1);
phy_vars_ue->UE_mode[eNB_id] = PRACH;
}
}
#endif
......
......@@ -81,7 +81,9 @@ result could be based on an event-driven measurement report.
typedef enum {
RRC_OK=0,
RRC_ConnSetup_failed,
RRC_PHY_RESYNCH
RRC_PHY_RESYNCH,
RRC_Handover_failed,
RRC_HO_STARTED
} RRC_status_t;
......
/*******************************************************************************
Eurecom OpenAirInterface
Copyright(c) 1999 - 2013 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*******************************************************************************/
/*! \file config.c
* \brief UE and eNB configuration
* \author Raymond Knopp, Navid Nikaein
* \date 2013
* \version 0.1
* \email: navid.nikaein@eurecom.fr
* @ingroup _mac
*/
#include "COMMON/platform_types.h"
#include "COMMON/platform_constants.h"
#include "SystemInformationBlockType2.h"
......@@ -16,6 +54,36 @@
#include "MBSFN-SubframeConfigList.h"
#include "PMCH-InfoList-r9.h"
#endif
/* sec 5.9, 36.321: MAC Reset Procedure */
void ue_mac_reset(u8 Mod_id,u8 eNB_index) {
//Resetting Bj
UE_mac_inst[Mod_id].scheduling_info.Bj[0] = 0;
UE_mac_inst[Mod_id].scheduling_info.Bj[1] = 0;
UE_mac_inst[Mod_id].scheduling_info.Bj[2] = 0;
//Stopping all timers
//timeAlignmentTimer expires
// PHY changes for UE MAC reset
mac_xface->phy_reset_ue(Mod_id,eNB_index);
// notify RRC to relase PUCCH/SRS
// cancel all pending SRs
UE_mac_inst[Mod_id].scheduling_info.SR_pending=0;
UE_mac_inst[Mod_id].scheduling_info.SR_COUNTER=0;
// stop ongoing RACH procedure
// discard explicitly signaled ra_PreambleIndex and ra_RACH_MaskIndex, if any
UE_mac_inst[Mod_id].RA_prach_resources.ra_PreambleIndex = 0; // check!
UE_mac_inst[Mod_id].RA_prach_resources.ra_RACH_MaskIndex = 0;
ue_init_mac(Mod_id); //This will hopefully do the rest of the MAC reset procedure
}
int rrc_mac_config_req(u8 Mod_id,u8 eNB_flag,u8 UE_id,u8 eNB_index,
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
struct PhysicalConfigDedicated *physicalConfigDedicated,
......@@ -25,6 +93,7 @@ int rrc_mac_config_req(u8 Mod_id,u8 eNB_flag,u8 UE_id,u8 eNB_index,
LogicalChannelConfig_t *logicalChannelConfig,
MeasGapConfig_t *measGapConfig,
TDD_Config_t *tdd_Config,
MobilityControlInfo_t *mobilityControlInfo,
u8 *SIwindowsize,
u16 *SIperiod,
ARFCN_ValueEUTRA_t *ul_CarrierFreq,
......@@ -32,14 +101,12 @@ int rrc_mac_config_req(u8 Mod_id,u8 eNB_flag,u8 UE_id,u8 eNB_index,
AdditionalSpectrumEmission_t *additionalSpectrumEmission,
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList
#ifdef Rel10
,
u8 MBMS_Flag,
,u8 MBMS_Flag,
MBSFN_AreaInfoList_r9_t *mbsfn_AreaInfoList,
PMCH_InfoList_r9_t *pmch_InfoList
#endif
#ifdef CBA
,
u8 num_active_cba_groups,
,u8 num_active_cba_groups,
u16 cba_rnti
#endif
) {
......@@ -60,10 +127,7 @@ int rrc_mac_config_req(u8 Mod_id,u8 eNB_flag,u8 UE_id,u8 eNB_index,
}
}
if ((tdd_Config!=NULL)||
(SIwindowsize!=NULL)||
(SIperiod!=NULL)){
if ((tdd_Config!=NULL)||(SIwindowsize!=NULL)||(SIperiod!=NULL)){
if (eNB_flag==1)
mac_xface->phy_config_sib1_eNB(Mod_id,tdd_Config,*SIwindowsize,*SIperiod);
else
......@@ -73,27 +137,14 @@ int rrc_mac_config_req(u8 Mod_id,u8 eNB_flag,u8 UE_id,u8 eNB_index,
if (radioResourceConfigCommon!=NULL) {
if (eNB_flag==1) {
LOG_I(MAC,"[CONFIG]SIB2/3 Contents (partial)\n");
LOG_I(MAC,"[CONFIG]pusch_config_common.n_SB = %ld\n",radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.n_SB);
LOG_I(MAC,"[CONFIG]pusch_config_common.hoppingMode = %ld\n",radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.hoppingMode);
LOG_I(MAC,"[CONFIG]pusch_config_common.pusch_HoppingOffset = %ld\n", radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.pusch_HoppingOffset);
LOG_I(MAC,"[CONFIG]pusch_config_common.enable64QAM = %d\n",radioResourceConfigCommon->pusch_ConfigCommon.pusch_ConfigBasic.enable64QAM);
LOG_I(MAC,"[CONFIG]pusch_config_common.groupHoppingEnabled = %d\n",radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupHoppingEnabled);
LOG_I(MAC,"[CONFIG]pusch_config_common.groupAssignmentPUSCH = %ld\n",radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.groupAssignmentPUSCH);
LOG_I(MAC,"[CONFIG]pusch_config_common.sequenceHoppingEnabled = %d\n",radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.sequenceHoppingEnabled);
LOG_I(MAC,"[CONFIG]pusch_config_common.cyclicShift = %ld\n",radioResourceConfigCommon->pusch_ConfigCommon.ul_ReferenceSignalsPUSCH.cyclicShift);
mac_xface->phy_config_sib2_eNB(Mod_id,radioResourceConfigCommon,ul_CarrierFreq,ul_Bandwidth,additionalSpectrumEmission,mbsfn_SubframeConfigList);
}
else {
......@@ -167,8 +218,8 @@ int rrc_mac_config_req(u8 Mod_id,u8 eNB_flag,u8 UE_id,u8 eNB_index,
UE_mac_inst[Mod_id].scheduling_info.periodicPHR_SF = get_sf_perioidicPHR_Timer(UE_mac_inst[Mod_id].scheduling_info.periodicPHR_Timer);
UE_mac_inst[Mod_id].scheduling_info.prohibitPHR_SF = get_sf_prohibitPHR_Timer(UE_mac_inst[Mod_id].scheduling_info.prohibitPHR_Timer);
UE_mac_inst[Mod_id].scheduling_info.PathlossChange_db = get_db_dl_PathlossChange(UE_mac_inst[Mod_id].scheduling_info.PathlossChange);
LOG_D(MAC,"[UE %d] config PHR : periodic %d (SF) prohibit %d (SF) pathlosschange %d (db) \n",
Mod_id,
LOG_D(MAC,"[UE %d] config PHR (%d): periodic %d (SF) prohibit %d (SF) pathlosschange %d (db) \n",
Mod_id,mac_MainConfig->phr_Config->present,
UE_mac_inst[Mod_id].scheduling_info.periodicPHR_SF,
UE_mac_inst[Mod_id].scheduling_info.prohibitPHR_SF,
UE_mac_inst[Mod_id].scheduling_info.PathlossChange_db);
......@@ -195,10 +246,89 @@ int rrc_mac_config_req(u8 Mod_id,u8 eNB_flag,u8 UE_id,u8 eNB_index,
}
mac_xface->phy_config_meas_ue(Mod_id,eNB_index,UE_mac_inst[Mod_id].n_adj_cells,UE_mac_inst[Mod_id].adj_cell_id);
}
/*
if (quantityConfig != NULL) {
if (quantityConfig[0] != NULL) {
UE_mac_inst[Mod_id].quantityConfig = quantityConfig[0];
LOG_I(MAC,"UE %d configured filterCoeff.",UE_mac_inst[Mod_id].crnti);
mac_xface->phy_config_meas_ue
}
}
*/
}
}
if (eNB_flag==0) {
if(mobilityControlInfo != NULL) {
LOG_D(MAC,"[UE%d] MAC Reset procedure triggered by RRC eNB %d \n",Mod_id,eNB_index);
ue_mac_reset(Mod_id,eNB_index);
if(mobilityControlInfo->radioResourceConfigCommon.rach_ConfigCommon) {
memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->rach_ConfigCommon,
(void *)mobilityControlInfo->radioResourceConfigCommon.rach_ConfigCommon,
sizeof(RACH_ConfigCommon_t));
}
memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->prach_Config.prach_ConfigInfo,
(void *)mobilityControlInfo->radioResourceConfigCommon.prach_Config.prach_ConfigInfo,
sizeof(PRACH_ConfigInfo_t));
UE_mac_inst[Mod_id].radioResourceConfigCommon->prach_Config.rootSequenceIndex = mobilityControlInfo->radioResourceConfigCommon.prach_Config.rootSequenceIndex;
if(mobilityControlInfo->radioResourceConfigCommon.pdsch_ConfigCommon) {
memcpy((void *)&UE_mac_inst[Mod_id].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_id].radioResourceConfigCommon->pusch_ConfigCommon,
(void *)&mobilityControlInfo->radioResourceConfigCommon.pusch_ConfigCommon,
sizeof(PUSCH_ConfigCommon_t));
if(mobilityControlInfo->radioResourceConfigCommon.phich_Config) {
/* memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->phich_Config,
(void *)mobilityControlInfo->radioResourceConfigCommon.phich_Config,
sizeof(PHICH_Config_t)); */
}
if(mobilityControlInfo->radioResourceConfigCommon.pucch_ConfigCommon) {
memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->pucch_ConfigCommon,
(void *)mobilityControlInfo->radioResourceConfigCommon.pucch_ConfigCommon,
sizeof(PUCCH_ConfigCommon_t));
}
if(mobilityControlInfo->radioResourceConfigCommon.soundingRS_UL_ConfigCommon) {
memcpy((void *)&UE_mac_inst[Mod_id].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_id].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_id].tdd_Config = mobilityControlInfo->radioResourceConfigCommon.tdd_Config;
}
if(mobilityControlInfo->radioResourceConfigCommon.ul_CyclicPrefixLength) {
memcpy((void *)&UE_mac_inst[Mod_id].radioResourceConfigCommon->ul_CyclicPrefixLength,
(void *)mobilityControlInfo->radioResourceConfigCommon.ul_CyclicPrefixLength,
sizeof(UL_CyclicPrefixLength_t));
}
UE_mac_inst[Mod_id].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_id, UE_mac_inst[Mod_id].crnti, eNB_index);
UE_mac_inst[Mod_id].rach_ConfigDedicated = malloc(sizeof(*mobilityControlInfo->rach_ConfigDedicated));
if (mobilityControlInfo->rach_ConfigDedicated){
memcpy((void*)UE_mac_inst[Mod_id].rach_ConfigDedicated,
(void*)mobilityControlInfo->rach_ConfigDedicated,
sizeof(*mobilityControlInfo->rach_ConfigDedicated));
}
mac_xface->phy_config_afterHO_ue(Mod_id,eNB_index,mobilityControlInfo,0);
}
}
if (mbsfn_SubframeConfigList != NULL) {
if (eNB_flag == 1) {
LOG_I(MAC,"[eNB %d][CONFIG] Received %d subframe allocation pattern for MBSFN\n", Mod_id, mbsfn_SubframeConfigList->list.count);
......
......@@ -59,6 +59,7 @@
#include "TDD-Config.h"
#include "RACH-ConfigCommon.h"
#include "MeasObjectToAddModList.h"
#include "MobilityControlInfo.h"
#ifdef Rel10
#include "MBSFN-AreaInfoList-r9.h"
#include "MBSFN-SubframeConfigList.h"
......@@ -139,7 +140,8 @@
typedef enum {
CONNECTION_OK=0,
CONNECTION_LOST,
PHY_RESYNCH
PHY_RESYNCH,
PHY_HO_PRACH
} UE_L2_STATE_t;
typedef struct {
......@@ -713,6 +715,8 @@ typedef struct{
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;
/// pointer to TDD Configuration (NULL for FDD)
......@@ -839,6 +843,7 @@ unsigned char generate_dlsch_header(unsigned char *mac_header,
@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
......@@ -855,6 +860,7 @@ int rrc_mac_config_req(u8 Mod_id,u8 eNB_flag,u8 UE_id,u8 eNB_index,
LogicalChannelConfig_t *logicalChannelConfig,
MeasGapConfig_t *measGapConfig,
TDD_Config_t *tdd_Config,
MobilityControlInfo_t *mobilityControlInfo,
u8 *SIwindowsize,
u16 *SIperiod,
ARFCN_ValueEUTRA_t *ul_CarrierFreq,
......@@ -985,11 +991,11 @@ s8 get_deltaP_rampup(u8 Mod_id);
//main.c
void chbch_phy_sync_success(u8 Mod_id,u32 frame,u8 CH_index);
void chbch_phy_sync_success(u8 Mod_id,u32 frame,u8 eNB_index);
void mrbch_phy_sync_failure(u8 Mod_id, u32 frame,u8 free_eNB_index);
int mac_top_init(int eMBMS_active, u8 cba_group_active);
int mac_top_init(int eMBMS_active, u8 cba_group_active, u8 HO_active);
char layer2_init_UE(u8 Mod_id);
......@@ -1001,7 +1007,7 @@ int mac_init_global_param(void);
void mac_top_cleanup(void);
void mac_UE_out_of_sync_ind(u8 Mod_id,u32 frame, u16 CH_index);
void mac_UE_out_of_sync_ind(u8 Mod_id,u32 frame, u16 eNB_index);
// eNB functions
......@@ -1106,8 +1112,8 @@ void UpdateSBnumber(unsigned char Mod_id);
//end ALU's algo
void ue_mac_reset(u8 Mod_id,u8 eNB_index);
void ue_init_mac(u8 Mod_id);
void init_ue_sched_info(void);
void add_ue_ulsch_info(u8 Mod_id, u8 UE_id, u8 subframe,UE_ULSCH_STATUS status);
void add_ue_dlsch_info(u8 Mod_id, u8 UE_id, u8 subframe,UE_DLSCH_STATUS status);
......@@ -1270,9 +1276,8 @@ u8 *parse_ulsch_header(u8 *mac_header,
u16 tx_lenght);
int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, u8 cba_group_active);
int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, u8 cba_group_active, u8 HO_active);
int mac_init(void);
void ue_init_mac(void);
s8 add_new_ue(u8 Mod_id, u16 rnti);
s8 mac_remove_ue(u8 Mod_id, u8 UE_id);
......
......@@ -4296,6 +4296,12 @@ void eNB_dlsch_ulsch_scheduler(u8 Mod_id,u8 cooperation_flag, u32 frame, u8 subf
#endif
#ifdef CELLULAR
rrc_rx_tx(Mod_id, frame, 0, 0);
#else
// check HO
rrc_rx_tx(Mod_id,
frame,
1,
Mod_id);
#endif
#ifdef Rel10
......
......@@ -97,6 +97,9 @@ void mrbch_phy_sync_failure(u8 Mod_id, u32 frame, u8 free_eNB_index){//init as C
layer2_init_eNB(Mod_id, free_eNB_index);
openair_rrc_eNB_init(Mod_id);
}
char layer2_init_eNB(unsigned char Mod_id, unsigned char eNB_index){
......@@ -120,7 +123,7 @@ void mac_UE_out_of_sync_ind(u8 Mod_id, u32 frame, u16 eNB_index){
/***********************************************************************/
int mac_top_init(int eMBMS_active, u8 cba_group_active){
int mac_top_init(int eMBMS_active, u8 cba_group_active, u8 HO_active){
/***********************************************************************/
unsigned char Mod_id,i,j;
RA_TEMPLATE *RA_template;
......@@ -135,8 +138,11 @@ int mac_top_init(int eMBMS_active, u8 cba_group_active){
mac_xface->macphy_exit("[MAC][MAIN] not enough memory for UEs \n");
}
LOG_D(MAC,"[MAIN] ALLOCATE %d Bytes for %d UE_MAC_INST @ %p\n",NB_UE_INST*sizeof(UE_MAC_INST),NB_UE_INST,UE_mac_inst);
bzero(UE_mac_inst,NB_UE_INST*sizeof(UE_MAC_INST));
ue_init_mac();
for(i=0;i<NB_UE_INST; i++)
ue_init_mac(i);
}
else
UE_mac_inst = NULL;
......@@ -172,7 +178,7 @@ int mac_top_init(int eMBMS_active, u8 cba_group_active){
if (Is_rrc_registered == 1){
LOG_I(MAC,"[MAIN] calling RRC\n");
#ifndef CELLULAR //nothing to be done yet for cellular
openair_rrc_top_init(eMBMS_active, cba_group_active);
openair_rrc_top_init(eMBMS_active, cba_group_active,HO_active);
#endif
}
else {
......@@ -287,6 +293,7 @@ int mac_top_init(int eMBMS_active, u8 cba_group_active){
//ICIC init param
#ifdef ICIC
u8 SB_size;
SB_size=mac_xface->get_SB_size(mac_xface->lte_frame_parms->N_RB_DL);
srand (time(NULL));
......@@ -388,7 +395,7 @@ void mac_top_cleanup(void){
free( Mac_rlc_xface);
}
int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, u8 cba_group_active) {
int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, u8 cba_group_active, u8 HO_active) {
......@@ -447,6 +454,11 @@ int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, u8 cba_group_activ
mac_xface->get_ue_active_harq_pid = get_ue_active_harq_pid;
mac_xface->get_PL = get_PL;
mac_xface->get_RSRP = get_RSRP;
mac_xface->get_RSRQ = get_RSRQ;
mac_xface->get_RSSI = get_RSSI;
mac_xface->get_n_adj_cells = get_n_adj_cells;
mac_xface->get_rx_total_gain_dB = get_rx_total_gain_dB;
mac_xface->get_Po_NOMINAL_PUSCH = get_Po_NOMINAL_PUSCH;
mac_xface->get_num_prach_tdd = get_num_prach_tdd;
mac_xface->get_fid_prach_tdd = get_fid_prach_tdd;
......@@ -461,7 +473,7 @@ int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, u8 cba_group_activ
mac_xface->phy_config_sib2_eNB = phy_config_sib2_eNB;
mac_xface->phy_config_sib2_ue = phy_config_sib2_ue;
mac_xface->phy_config_afterHO_ue = phy_config_afterHO_ue;
#ifdef Rel10
mac_xface->phy_config_sib13_eNB = phy_config_sib13_eNB;
mac_xface->phy_config_sib13_ue = phy_config_sib13_ue;
......@@ -470,6 +482,7 @@ int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, u8 cba_group_activ
mac_xface->phy_config_cba_rnti = phy_config_cba_rnti ;
#endif
mac_xface->phy_config_meas_ue = phy_config_meas_ue;
mac_xface->phy_reset_ue = phy_reset_ue;
mac_xface->phy_config_dedicated_eNB = phy_config_dedicated_eNB;
mac_xface->phy_config_dedicated_ue = phy_config_dedicated_ue;
......@@ -481,7 +494,7 @@ int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, u8 cba_group_activ
mac_xface->get_PHR = get_PHR;
LOG_D(MAC,"[MAIN] ALL INIT OK\n");
mac_xface->macphy_init(eMBMS_active,cba_group_active);
mac_xface->macphy_init(eMBMS_active,cba_group_active,HO_active);
//Mac_rlc_xface->Is_cluster_head[0] = 1;
//Mac_rlc_xface->Is_cluster_head[1] = 0;
......
......@@ -89,43 +89,42 @@ mapping BSR_names[] = {
extern inline unsigned int taus(void);
void ue_init_mac(){
int i,j;
for (i=0 ; i < NB_UE_INST; i++){
// default values as deined in 36.331 sec 9.2.2
LOG_I(MAC,"[UE%d] Applying default macMainConfig\n",i);
LOG_D(MAC, "[MSC_NEW][FRAME 00000][MAC_UE][MOD %02d][]\n", i+NB_eNB_INST);
//UE_mac_inst[Mod_id].scheduling_info.macConfig=NULL;
UE_mac_inst[i].scheduling_info.retxBSR_Timer= MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560;
UE_mac_inst[i].scheduling_info.periodicBSR_Timer=MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity;
UE_mac_inst[i].scheduling_info.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20;
UE_mac_inst[i].scheduling_info.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20;
UE_mac_inst[i].scheduling_info.PathlossChange_db = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1;
UE_mac_inst[i].PHR_state = MAC_MainConfig__phr_Config_PR_setup;
UE_mac_inst[i].scheduling_info.SR_COUNTER=0;
UE_mac_inst[i].scheduling_info.sr_ProhibitTimer=0;
UE_mac_inst[i].scheduling_info.sr_ProhibitTimer_Running=0;
UE_mac_inst[i].scheduling_info.maxHARQ_Tx=MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5;
UE_mac_inst[i].scheduling_info.ttiBundling=0;
UE_mac_inst[i].scheduling_info.drx_config=NULL;
UE_mac_inst[i].scheduling_info.phr_config=NULL;
UE_mac_inst[i].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[i].scheduling_info.periodicBSR_Timer);
UE_mac_inst[i].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[i].scheduling_info.retxBSR_Timer);
UE_mac_inst[i].scheduling_info.periodicPHR_SF = get_sf_perioidicPHR_Timer(UE_mac_inst[i].scheduling_info.periodicPHR_Timer);
UE_mac_inst[i].scheduling_info.prohibitPHR_SF = get_sf_prohibitPHR_Timer(UE_mac_inst[i].scheduling_info.prohibitPHR_Timer);
UE_mac_inst[i].scheduling_info.PathlossChange_db = get_db_dl_PathlossChange(UE_mac_inst[i].scheduling_info.PathlossChange);
for (j=0; j < MAX_NUM_LCID; j++){
LOG_D(MAC,"[UE%d] Applying default logical channel config for LCGID %d\n",i,j);
UE_mac_inst[i].scheduling_info.Bj[j]=-1;
UE_mac_inst[i].scheduling_info.bucket_size[j]=-1;
if (j < DTCH) // initilize all control channels lcgid to 0
UE_mac_inst[i].scheduling_info.LCGID[j]=0;
else // initialize all the data channels lcgid to 1
UE_mac_inst[i].scheduling_info.LCGID[j]=1;
UE_mac_inst[i].scheduling_info.LCID_status[j]=0;
}
void ue_init_mac(u8 Mod_id){
int i;
// default values as deined in 36.331 sec 9.2.2
LOG_I(MAC,"[UE%d] Applying default macMainConfig\n",Mod_id);
LOG_D(MAC, "[MSC_NEW][FRAME 00000][MAC_UE][MOD %02d][]\n", Mod_id+NB_eNB_INST);
//UE_mac_inst[Mod_id].scheduling_info.macConfig=NULL;
UE_mac_inst[Mod_id].scheduling_info.retxBSR_Timer= MAC_MainConfig__ul_SCH_Config__retxBSR_Timer_sf2560;
UE_mac_inst[Mod_id].scheduling_info.periodicBSR_Timer=MAC_MainConfig__ul_SCH_Config__periodicBSR_Timer_infinity;
UE_mac_inst[Mod_id].scheduling_info.periodicPHR_Timer = MAC_MainConfig__phr_Config__setup__periodicPHR_Timer_sf20;
UE_mac_inst[Mod_id].scheduling_info.prohibitPHR_Timer = MAC_MainConfig__phr_Config__setup__prohibitPHR_Timer_sf20;
UE_mac_inst[Mod_id].scheduling_info.PathlossChange_db = MAC_MainConfig__phr_Config__setup__dl_PathlossChange_dB1;
UE_mac_inst[Mod_id].PHR_state = MAC_MainConfig__phr_Config_PR_setup;
UE_mac_inst[Mod_id].scheduling_info.SR_COUNTER=0;
UE_mac_inst[Mod_id].scheduling_info.sr_ProhibitTimer=0;
UE_mac_inst[Mod_id].scheduling_info.sr_ProhibitTimer_Running=0;
UE_mac_inst[Mod_id].scheduling_info.maxHARQ_Tx=MAC_MainConfig__ul_SCH_Config__maxHARQ_Tx_n5;
UE_mac_inst[Mod_id].scheduling_info.ttiBundling=0;
UE_mac_inst[Mod_id].scheduling_info.drx_config=NULL;
UE_mac_inst[Mod_id].scheduling_info.phr_config=NULL;
UE_mac_inst[Mod_id].scheduling_info.periodicBSR_SF = get_sf_periodicBSRTimer(UE_mac_inst[Mod_id].scheduling_info.periodicBSR_Timer);
UE_mac_inst[Mod_id].scheduling_info.retxBSR_SF = get_sf_retxBSRTimer(UE_mac_inst[Mod_id].scheduling_info.retxBSR_Timer);
UE_mac_inst[Mod_id].scheduling_info.periodicPHR_SF = get_sf_perioidicPHR_Timer(UE_mac_inst[Mod_id].scheduling_info.periodicPHR_Timer);
UE_mac_inst[Mod_id].scheduling_info.prohibitPHR_SF = get_sf_prohibitPHR_Timer(UE_mac_inst[Mod_id].scheduling_info.prohibitPHR_Timer);
UE_mac_inst[Mod_id].scheduling_info.PathlossChange_db = get_db_dl_PathlossChange(UE_mac_inst[Mod_id].scheduling_info.PathlossChange);
for (i=0; i < MAX_NUM_LCID; i++){
LOG_D(MAC,"[UE%d] Applying default logical channel config for LCGID %d\n",Mod_id,i);
UE_mac_inst[Mod_id].scheduling_info.Bj[i]=-1;
UE_mac_inst[Mod_id].scheduling_info.bucket_size[i]=-1;
if (i < DTCH) // initilize all control channels lcgid to 0
UE_mac_inst[Mod_id].scheduling_info.LCGID[i]=0;
else // initialize all the data channels lcgid to 1
UE_mac_inst[Mod_id].scheduling_info.LCGID[i]=1;
UE_mac_inst[Mod_id].scheduling_info.LCID_status[i]=0;
}
}
......@@ -1366,6 +1365,15 @@ UE_L2_STATE_t ue_scheduler(u8 Mod_id,u32 frame, u8 subframe, lte_subframe_t dire
case RRC_PHY_RESYNCH:
LOG_E(MAC,"RRC Loss of synch, returning PHY_RESYNCH\n");
return(PHY_RESYNCH);
case RRC_Handover_failed:
LOG_D(MAC,"Handover failure for UE %d eNB_index %d\n",Mod_id,eNB_index);
//Invalid...need to add another MAC UE state for re-connection procedure
mac_xface->phy_config_afterHO_ue(Mod_id,eNB_index,(MobilityControlInfo_t *)NULL,1);
//return(3);
break;
case RRC_HO_STARTED:
LOG_I(MAC,"RRC handover, Instruct PHY to start the contention-free PRACH and synchronization\n");
return(PHY_HO_PRACH);
default:
break;
}
......@@ -1402,7 +1410,7 @@ UE_L2_STATE_t ue_scheduler(u8 Mod_id,u32 frame, u8 subframe, lte_subframe_t dire
// Put this in another function
// Get RLC status info and update Bj for all lcids that are active
for (lcid=CCCH; lcid <= DTCH; lcid++ ) {
for (lcid=DCCH; lcid <= DTCH; lcid++ ) {
if ((lcid == 0) ||(UE_mac_inst[Mod_id].logicalChannelConfig[lcid])) {
// meausre the Bj
if ((direction == SF_UL)&& (UE_mac_inst[Mod_id].scheduling_info.Bj[lcid] >= 0)){
......@@ -1573,9 +1581,11 @@ int update_bsr(u8 Mod_id, u32 frame, u8 lcid, u8 lcg_id){
u8 sr_pending = 0;
if ((lcg_id < 0) || (lcg_id > MAX_NUM_LCGID) )
return sr_pending;
UE_mac_inst[Mod_id].scheduling_info.BSR[lcg_id]=0;
UE_mac_inst[Mod_id].scheduling_info.BSR_bytes[lcg_id]=0;
// fixme: need a better way to reset
if ((lcid == DCCH) || (lcid == DTCH)){
UE_mac_inst[Mod_id].scheduling_info.BSR[lcg_id]=0;
UE_mac_inst[Mod_id].scheduling_info.BSR_bytes[lcg_id]=0;
}
// for (lcid =0 ; lcid < MAX_NUM_LCID; lcid++) {
if (UE_mac_inst[Mod_id].scheduling_info.LCGID[lcid] == lcg_id) {
rlc_status = mac_rlc_status_ind(Mod_id+NB_eNB_INST,frame,0,RLC_MBMS_NO,
......@@ -1587,13 +1597,13 @@ int update_bsr(u8 Mod_id, u32 frame, u8 lcid, u8 lcg_id){
UE_mac_inst[Mod_id].scheduling_info.BSR[lcg_id] += locate (BSR_TABLE,BSR_TABLE_SIZE, rlc_status.bytes_in_buffer);
UE_mac_inst[Mod_id].scheduling_info.BSR_bytes[lcg_id] += rlc_status.bytes_in_buffer;
// UE_mac_inst[Mod_id].scheduling_info.BSR_short_lcid = lcid; // only applicable to short bsr
LOG_D(MAC,"[UE %d] BSR level %d (LCGID %d, rlc buffer %d byte)\n",
Mod_id, UE_mac_inst[Mod_id].scheduling_info.BSR[lcg_id],lcg_id, UE_mac_inst[Mod_id].scheduling_info.BSR_bytes[lcg_id]);
}
else
UE_mac_inst[Mod_id].scheduling_info.LCID_status[lcid]=LCID_EMPTY;
}
//}
//LOG_D(MAC,"[UE %d] BSR level %d (LCGID %d, rlc buffer %d byte)\n",
// Mod_id, UE_mac_inst[Mod_id].scheduling_info.BSR[lcg_id],lcg_id, UE_mac_inst[Mod_id].scheduling_info.BSR_bytes[lcg_id]);
return sr_pending;
}
......
......@@ -31,6 +31,7 @@
* \author Raymond Knopp, Navid Nikaein
* \date 2012
* \version 1.0
* \email navid.nikaein@eurecom.fr
* @ingroup _mac
*/
......@@ -91,6 +92,7 @@ DCI1A_5MHz_TDD_1_6_t BCCH_alloc_pdu;
DCI1A_5MHz_TDD_1_6_t CCCH_alloc_pdu;
DCI1_5MHz_TDD_t DLSCH_alloc_pdu;
#ifdef Rel10
DCI1C_5MHz_t MCCH_alloc_pdu;
#endif
......
......@@ -733,7 +733,7 @@ BOOL rrc_pdcp_config_asn1_req (module_id_t module_id, u32_t frame, u8_t eNB_flag
}
if (drb2release_list != NULL) {
for (cnt=0;cnt<drb2add_list->list.count;cnt++) {
for (cnt=0;cnt<drb2release_list->list.count;cnt++) {
pdrb_id = drb2release_list->list.array[cnt];
rb_id = (index * NB_RB_MAX) + *pdrb_id;
action = ACTION_REMOVE;
......
......@@ -256,10 +256,10 @@ rlc_op_status_t rrc_rlc_config_asn1_req (module_id_t module_idP, u32_t frameP, u
}
}
if (drb2release_listP != NULL) {
for (cnt=0;cnt<drb2add_listP->list.count;cnt++) {
pdrb_id = drb2release_listP->list.array[cnt];
rrc_rlc_remove_rlc(module_idP, (UE_index * NB_RB_MAX) + *pdrb_id, frameP);
}
for (cnt=0;cnt<drb2release_listP->list.count;cnt++) {
pdrb_id = drb2release_listP->list.array[cnt];
rrc_rlc_remove_rlc(module_idP, (UE_index * NB_RB_MAX) + *pdrb_id, frameP);
}
}
......
......@@ -31,6 +31,7 @@
* \author Raymond Knopp and Navid Nikaein
* \date 2011
* \version 0.5
* \mail navid.nikaein@eurecom.fr or openair_tech@eurecom.fr
* @ingroup _mac
*/
......@@ -57,7 +58,7 @@
typedef struct
{
/// Pointer function that initializes L2
int (*macphy_init)(int eMBMS_active, u8 CBA_enabled);
int (*macphy_init)(int eMBMS_active, u8 CBA_active,u8 HO_active);
/// Pointer function that stops the low-level scheduler due an exit condition
void (*macphy_exit)(const char *);
......@@ -112,7 +113,7 @@ typedef struct
void (*phy_config_sib13_eNB)(u8 Mod_id,int mbsfn_Area_idx,
long mbsfn_AreaId_r9);
#endif
/// PHY-Config-Dedicated eNB
void (*phy_config_dedicated_eNB)(u8 Mod_id,u16 rnti,
struct PhysicalConfigDedicated *physicalConfigDedicated);
......@@ -124,8 +125,11 @@ typedef struct
// configure the cba rnti at the physical layer
void (*phy_config_cba_rnti)(u8 Mod_id,u8 eNB_flag, u8 index, u16 cba_rnti, u8 cba_group_id, u8 num_active_cba_groups);
// UE functions
/// UE functions
/// reset the ue phy
void (*phy_reset_ue)(u8 Mod_id,u8 eNB_index);
/// Indicate loss of synchronization of PBCH for this eNB to MAC layer
void (*out_of_sync_ind)(u8 Mod_id,u32 frame,u16 eNB_index);
......@@ -185,6 +189,10 @@ typedef struct
void (*phy_config_sib13_ue)(u8 Mod_id,u8 CH_index,int mbsfn_Area_idx,
long mbsfn_AreaId_r9);
#endif
/// Configure Common PHY parameters from mobilityControlInfo
void (*phy_config_afterHO_ue)(u8 Mod_id,u8 CH_index,
MobilityControlInfo_t *mobilityControlInfo,
u8 ho_failed);
/// Function to indicate failure of contention resolution or RA procedure
void (*ra_failed)(u8 Mod_id,u8 eNB_index);
......@@ -233,11 +241,26 @@ typedef struct
/// Function for UE MAC to retrieve measured Path Loss
s16 (*get_PL)(u8 Mod_id,u8 eNB_index);
/// Function for UE MAC to retrieve the rssi
u8 (*get_RSSI)(u8 Mod_id);
/// Function for UE MAC to retrieve the total gain
u8 (*get_rx_total_gain_dB)(u8 Mod_id);
/// Function for UE MAC to retrieve the number of adjustent cells
u8 (*get_n_adj_cells)(u8 Mod_id);
/// Function for UE MAC to retrieve RSRP/RSRQ measurements
u8* (*get_RSRP)(u8 Mod_id,u8 eNB_index);
u8 (*get_RSRP)(u8 Mod_id,u8 eNB_index);
/// Function for UE MAC to retrieve RSRP/RSRQ measurements
u8* (*get_RSRQ)(u8 Mod_id,u8 eNB_index);
u8 (*get_RSRQ)(u8 Mod_id,u8 eNB_index);
/// Function for UE MAC to set the layer3 filtered RSRP/RSRQ measurements
u8 (*set_RSRP_filtered)(u8 Mod_id,u8 eNB_index,float rsrp);
/// Function for UE MAC to set the layer3 filtered RSRP/RSRQ measurements
u8 (*set_RSRQ_filtered)(u8 Mod_id,u8 eNB_index,float rsrq);
/// Function for UE/eNB MAC to retrieve number of PRACH in TDD
u8 (*get_num_prach_tdd)(LTE_DL_FRAME_PARMS *frame_parms);
......
......@@ -514,9 +514,9 @@ void rrc_lite_data_ind( u8 Mod_id, u32 frame, u8 eNB_flag,u32 Srb_id, u32 sdu_si
u8 DCCH_index = Srb_id % NB_RB_MAX;
LOG_N(RRC,"[%s %d] Frame %d: received a DCCH %d message on SRB %d with Size %d\n",
(eNB_flag == 1)? "eNB": "UE",
(eNB_flag == 1)? Mod_id : UE_index,
frame, DCCH_index,Srb_id-1,sdu_size);
(eNB_flag == 1)? "eNB": "UE",
(eNB_flag == 1)? Mod_id : UE_index,
frame, DCCH_index,Srb_id-1,sdu_size);
#if defined(ENABLE_ITTI)
{
......
/*******************************************************************************
Eurecom OpenAirInterface 2
Copyright(c) 1999 - 2010 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*******************************************************************************/
/*! \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 <stdio.h>
#include <sys/types.h>
......@@ -78,7 +116,16 @@ uint16_t two_tier_hexagonal_adjacent_cellIds[7][6] = {{1,2,4,5,7,8}, // CellI
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 */
u8 get_adjacent_cell_mod_id(uint16_t phyCellId) {
u8 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_SIB1(LTE_DL_FRAME_PARMS *frame_parms, uint8_t *buffer,
SystemInformationBlockType1_t *sib1) {
......@@ -1422,10 +1469,13 @@ uint8_t do_RRCConnectionReconfiguration(uint8_t Mod_id
struct PhysicalConfigDedicated *physicalConfigDedicated,
MeasObjectToAddModList_t *MeasObj_list,
ReportConfigToAddModList_t *ReportConfig_list,
QuantityConfig_t *QuantityConfig,
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,
uint8_t *nas_pdu,
uint32_t nas_length
......@@ -1436,8 +1486,7 @@ uint8_t do_RRCConnectionReconfiguration(uint8_t Mod_id
DL_DCCH_Message_t dl_dcch_msg;
RRCConnectionReconfiguration_t *rrcConnectionReconfiguration;
// int i;
memset(&dl_dcch_msg,0,sizeof(DL_DCCH_Message_t));
dl_dcch_msg.message.present = DL_DCCH_MessageType_PR_c1;
......@@ -1458,7 +1507,7 @@ uint8_t do_RRCConnectionReconfiguration(uint8_t Mod_id
#ifdef CBA
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->cba_RNTI_vlola= cba_rnti;
#endif
if (mac_MainConfig) {
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,
......@@ -1476,10 +1525,31 @@ uint8_t do_RRCConnectionReconfiguration(uint8_t Mod_id
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;
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig = quantityConfig;
/* 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;
// Note: RK, I'm not sure this is ok, we have to use ASN_SEQ_ADD
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo = 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;
if ((nas_pdu == NULL) || (nas_length == 0)) {
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.dedicatedInfoNASList = (DedicatedInfoNAS_t*)NULL;
} else {
......@@ -1489,13 +1559,14 @@ uint8_t do_RRCConnectionReconfiguration(uint8_t Mod_id
dedicatedInfoNAS->size = nas_length;
}
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.securityConfigHO = NULL;
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->s_Measure= rsrp;
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_DCCH_Message,
(void*)&dl_dcch_msg,
buffer,
100);
RRC_BUF_SIZE);
#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
//#ifdef USER_MODE
LOG_I(RRC,"RRCConnectionReconfiguration Encoded %d bits (%d bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
......@@ -1677,44 +1748,44 @@ uint8_t do_MeasurementReport(uint8_t *buffer,int measid,int phy_id,int rsrp_s,in
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;
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->measResult=meas2;
measresulteutra2->cgi_Info=measresult_cgi2;
struct MeasResultEUTRA__measResult meas2;
// int rsrp_va=10;
meas2.rsrpResult=&rsrp_t;
//&rsrp_va;
meas2.rsrqResult=&rsrq_t;
ASN_SEQUENCE_ADD(&measResultListEUTRA2->list,measresulteutra2);
measresulteutra2->measResult=meas2;
measurementReport->criticalExtensions.choice.c1.choice.measurementReport_r8.measResults.measResultNeighCells->choice.measResultListEUTRA=*(measResultListEUTRA2);
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,
......
/*******************************************************************************
Eurecom OpenAirInterface 2
Copyright(c) 1999 - 2010 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*******************************************************************************/
/*! \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 <stdio.h>
#include <sys/types.h>
......@@ -105,6 +143,8 @@ uint8_t do_RRCConnectionSetup(uint8_t *buffer,
@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
......@@ -121,11 +161,14 @@ uint8_t do_RRCConnectionReconfiguration(uint8_t Mod_id
struct PhysicalConfigDedicated *physicalConfigDedicated,
MeasObjectToAddModList_t *MeasObj_list,
ReportConfigToAddModList_t *ReportConfig_list,
QuantityConfig_t *QuantityConfig,
QuantityConfig_t *quantityConfig,
MeasIdToAddModList_t *MeasId_list,
MAC_MainConfig_t *mac_MainConfig,
MeasGapConfig_t *measGapConfig,
C_RNTI_t *cba_rnti,
MobilityControlInfo_t *mobilityInfo,
struct MeasConfig__speedStatePars *speedStatePars,
RSRP_Range_t *rsrp,
C_RNTI_t *cba_rnti,
uint8_t *nas_pdu,
uint32_t nas_length);
......
......@@ -71,6 +71,8 @@
#include "MCCH-Message.h"
#include "MBSFNAreaConfiguration-r9.h"
#endif
#include "AS-Config.h"
#include "AS-Context.h"
#include "UE-EUTRA-Capability.h"
#include "MeasResults.h"
......@@ -88,16 +90,23 @@
//#define NUM_PRECONFIGURED_LCHAN (NB_CH_CX*2) //BCCH, CCCH
#define CH_READY 0
typedef enum {
RRC_IDLE=0,
RRC_SI_RECEIVED,
RRC_CONNECTED,
RRC_RECONFIGURED
RRC_RECONFIGURED,
RRC_HO_EXECUTION
} UE_STATE_t;
typedef enum {
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 ; }
......@@ -105,12 +114,12 @@ typedef enum {
#define RRM_CALLOC(t,n) (t *) malloc16( sizeof(t) * n)
#define RRM_CALLOC2(t,s) (t *) malloc16( s )
#define MAX_MEAS_OBJ 3
#define MAX_MEAS_CONFIG 3
#define MAX_MEAS_ID 3
#define MAX_MEAS_OBJ 6
#define MAX_MEAS_CONFIG 6
#define MAX_MEAS_ID 6
#define PAYLOAD_SIZE_MAX 1024
#define RRC_BUF_SIZE 140
#define UNDEF_SECURITY_MODE 0xff
#define NO_SECURITY_MODE 0x33
......@@ -126,6 +135,8 @@ typedef struct{
u8 MCCHStatus[8]; // MAX_MBSFN_AREA
#endif
u8 SIwindowsize;
u8 handoverTarget;
HO_STATE_t ho_state;
u16 SIperiod;
unsigned short UE_index;
u32 T300_active;
......@@ -154,8 +165,19 @@ union{
}Info;
}RRC_INFO;
/* Intermediate structure for Hanodver management. Associated per-UE in eNB_RRC_INST */
typedef struct{
u8 ho_prepare;
u8 ho_complete;
u8 modid_s; //Mod_id of serving cell
u8 modid_t; //Mod_id of target cell
u8 ueid_s; //UE index in serving cell
u8 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
......@@ -192,10 +214,19 @@ typedef struct{
SRB_INFO Srb_info;
u8 Active;
u8 Status;
u32 Next_check_frame;
u32 Next_check_frame;
}SRB_INFO_TABLE_ENTRY;
typedef struct {
MeasId_t measId;
//CellsTriggeredList cellsTriggeredList;//OPTIONAL
u32 numberOfReportsSent;
} MEAS_REPORT_LIST;
typedef struct {
PhysCellId_t targetCellId;
u8 measFlag;
}HANDOVER_INFO_UE;
typedef struct{
......@@ -241,12 +272,13 @@ typedef struct{
SRB_INFO Srb0;
SRB_INFO_TABLE_ENTRY Srb1[NUMBER_OF_UE_MAX+1];
SRB_INFO_TABLE_ENTRY Srb2[NUMBER_OF_UE_MAX+1];
MeasConfig_t *measConfig[NUMBER_OF_UE_MAX];
HANDOVER_INFO *handover_info[NUMBER_OF_UE_MAX];
uint8_t HO_flag;
#if defined(ENABLE_SECURITY)
/* KeNB as derived from KASME received from EPC */
uint8_t kenb[NUMBER_OF_UE_MAX][32];
#endif
/* Used integrity/ciphering algorithms */
e_SecurityAlgorithmConfig__cipheringAlgorithm ciphering_algorithm[NUMBER_OF_UE_MAX];
e_SecurityAlgorithmConfig__integrityProtAlgorithm integrity_algorithm[NUMBER_OF_UE_MAX];
......@@ -266,6 +298,7 @@ typedef struct{
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;
u8 *SIB1[NB_CNX_UE];
u8 sizeof_SIB1[NB_CNX_UE];
u8 *SI[NB_CNX_UE];
......@@ -305,12 +338,20 @@ typedef struct{
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];
u32 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];
......@@ -324,7 +365,7 @@ typedef struct{
//main.c
int rrc_init_global_param(void);
int L3_xface_init(void);
void openair_rrc_top_init(int eMBMS_active, u8 cba_group_active);
void openair_rrc_top_init(int eMBMS_active, u8 cba_group_active,u8 HO_enabled);
char openair_rrc_lite_eNB_init(u8 Mod_id);
char openair_rrc_lite_ue_init(u8 Mod_id,u8 CH_IDX);
void rrc_config_buffer(SRB_INFO *srb_info, u8 Lchan_type, u8 Role);
......@@ -344,41 +385,41 @@ RRC_status_t rrc_rx_tx(u8 Mod_id,u32 frame, u8 eNB_flag,u8 index);
/** \brief Decodes DL-CCCH message and invokes appropriate routine to handle the message
\param Mod_id Instance ID of UE
\param Srb_info Pointer to SRB_INFO structure (SRB0)
\param CH_index Index of corresponding eNB/CH*/
int rrc_ue_decode_ccch(u8 Mod_id, u32 frame, SRB_INFO *Srb_info,u8 CH_index);
\param eNB_index Index of corresponding eNB/CH*/
int rrc_ue_decode_ccch(u8 Mod_id, u32 frame, SRB_INFO *Srb_info,u8 eNB_index);
/** \brief Decodes a DL-DCCH message and invokes appropriate routine to handle the message
\param Mod_id Instance ID of UE
\param frame Frame index
\param Srb_id Index of Srb (1,2)
\param Buffer Pointer to received SDU
\param CH_index Index of corresponding CH/eNB*/
void rrc_ue_decode_dcch(u8 Mod_id, u32 frame, u8 Srb_id, u8* Buffer,u8 CH_index);
\param eNB_index Index of corresponding CH/eNB*/
void rrc_ue_decode_dcch(u8 Mod_id, u32 frame, u8 Srb_id, u8* Buffer,u8 eNB_index);
/** \brief Generate/Encodes RRCConnnectionRequest message at UE
\param Mod_id Instance ID of UE
\param frame Frame index
\param Srb_id Index of Srb (1,2)
\param CH_index Index of corresponding eNB/CH*/
void rrc_ue_generate_RRCConnectionRequest(u8 Mod_id, u32 frame, u8 CH_index);
\param eNB_index Index of corresponding eNB/CH*/
void rrc_ue_generate_RRCConnectionRequest(u8 Mod_id, u32 frame, u8 eNB_index);
/** \brief Generates/Encodes RRCConnnectionSetupComplete message at UE
\param Mod_id Instance ID of UE
\param frame Frame index
\param CH_index Index of corresponding eNB/CH*/
void rrc_ue_generate_RRCConnectionSetupComplete(u8 Mod_id,u32 frame,u8 CH_index);\
\param eNB_index Index of corresponding eNB/CH*/
void rrc_ue_generate_RRCConnectionSetupComplete(u8 Mod_id,u32 frame,u8 eNB_index);
/** \brief process the received rrcConnectionReconfiguration message at UE
\param Mod_id Instance ID of UE
\param frame Frame index
\param *rrcConnectionReconfiguration pointer to the sturcture
\param CH_index Index of corresponding eNB/CH*/
\param eNB_index Index of corresponding eNB/CH*/
void rrc_ue_process_rrcConnectionReconfiguration(u8 Mod_id, u32 frame,RRCConnectionReconfiguration_t *rrcConnectionReconfiguration,u8 eNB_index);
/** \brief Generates/Encodes RRCConnectionReconfigurationComplete message at UE
\param Mod_id Instance ID of UE
\param frame Frame index
\param CH_index Index of corresponding eNB/CH*/
\param eNB_index Index of corresponding eNB/CH*/
void rrc_ue_generate_RRCConnectionReconfigurationComplete(u8 Mod_id, u32 frame, u8 eNB_index);
/** \brief Establish SRB1 based on configuration in SRB_ToAddMod structure. Configures RLC/PDCP accordingly
......@@ -399,22 +440,33 @@ s32 rrc_ue_establish_srb2(u8 Mod_id,u32 frame, u8 eNB_index,struct SRB_ToAddMod
/** \brief Establish a DRB according to DRB_ToAddMod structure
\param Mod_id Instance ID of UE
\param CH_index Index of corresponding CH/eNB
\param eNB_index Index of corresponding CH/eNB
\param DRB_config Pointer to DRB_ToAddMod IE from configuration
@returns 0 on success */
s32 rrc_ue_establish_drb(u8 Mod_id,u32 frame,u8 CH_index,struct DRB_ToAddMod *DRB_config);
s32 rrc_ue_establish_drb(u8 Mod_id,u32 frame,u8 eNB_index,struct DRB_ToAddMod *DRB_config);
/** \brief Process MobilityControlInfo Message to proceed with handover and configure PHY/MAC
\param Mod_id Instance of UE on which to act
\param frame frame time interval
\param eNB_index Index of corresponding CH/eNB
\param mobilityControlInfo Pointer to mobilityControlInfo
*/
void rrc_ue_process_mobilityControlInfo(u8 Mod_id,u32 frame, u8 eNB_index,struct MobilityControlInfo *mobilityControlInfo);
/** \brief Process a measConfig Message and configure PHY/MAC
\param Mod_id Instance of UE on which to act
\param CH_index Index of corresponding CH/eNB
\param frame frame time interval
\param eNB_index Index of corresponding CH/eNB
\param measConfig Pointer to MeasConfig IE from configuration*/
void rrc_ue_process_measConfig(u8 Mod_id,u8 eNB_index,MeasConfig_t *measConfig);
void rrc_ue_process_measConfig(u8 Mod_id,u32 frame, u8 eNB_index,MeasConfig_t *measConfig);
/** \brief Process a RadioResourceConfigDedicated Message and configure PHY/MAC
\param Mod_id Instance of UE on which to act
\param CH_index Index of corresponding CH/eNB
\param eNB_index Index of corresponding CH/eNB
\param radioResourceConfigDedicated Pointer to RadioResourceConfigDedicated IE from configuration*/
void rrc_ue_process_radioResourceConfigDedicated(u8 Mod_id,u32 frame, u8 CH_index,
void rrc_ue_process_radioResourceConfigDedicated(u8 Mod_id,u32 frame, u8 eNB_index,
RadioResourceConfigDedicated_t *radioResourceConfigDedicated);
// eNB/CH RRC Procedures
......@@ -457,7 +509,7 @@ void rrc_eNB_process_RRCConnectionReconfigurationComplete(u8 Mod_id,u32 frame,u8
\param Mod_id Instance ID for eNB/CH
\param frame Frame index
\param UE_index Index of UE transmitting the messages*/
void rrc_eNB_generate_defaultRRCConnectionReconfiguration(u8 Mod_id, u32 frame, u16 UE_index, u8 *nas_pdu, u32 nas_length);
void rrc_eNB_generate_defaultRRCConnectionReconfiguration(u8 Mod_id, u32 frame, u16 UE_index, u8 *nas_pdu, u32 nas_length, u8 ho_state);
#if defined(ENABLE_ITTI)
/**\brief RRC eNB task.
......@@ -469,6 +521,13 @@ void *rrc_enb_task(void *args_p);
void *rrc_ue_task(void *args_p);
#endif
/**\brief Generate/decode the handover RRCConnectionReconfiguration at eNB
\param Mod_id Instance ID for eNB/CH
\param frame Frame index
\param UE_index Index of UE transmitting the messages*/
void rrc_eNB_generate_RRCConnectionReconfiguration_handover(u8 Mod_id, u32 frame, u16 UE_index, u8 *nas_pdu, u32 nas_length);
//L2_interface.c
s8 mac_rrc_lite_data_req( u8 Mod_id, u32 frame, unsigned short Srb_id, u8 Nb_tb, u8 *Buffer,u8 eNB_flag, u8 eNB_index, u8 mbsfn_sync_area);
s8 mac_rrc_lite_data_ind( u8 Mod_id, u32 frame, unsigned short Srb_id, u8 *Sdu, unsigned short Sdu_len,u8 eNB_flag,u8 eNB_index, u8 mbsfn_sync_area);
......@@ -484,23 +543,28 @@ void decode_MBSFNAreaConfiguration(u8 Mod_id, u8 eNB_index, u32 frame,u8 mbsfn_s
int decode_BCCH_DLSCH_Message(u8 Mod_id,u32 frame,u8 eNB_index,u8 *Sdu,u8 Sdu_len);
int decode_SIB1(u8 Mod_id,u8 CH_index);
int decode_SIB1(u8 Mod_id,u8 eNB_index);
int decode_SI(u8 Mod_id,u32 frame,u8 CH_index,u8 si_window);
int decode_SI(u8 Mod_id,u32 frame,u8 eNB_index,u8 si_window);
int mac_get_rrc_lite_status(u8 Mod_id,u8 eNB_flag,u8 index);
void rrc_eNB_generate_UECapabilityEnquiry(u8 Mod_id, u32 frame, u16 UE_index);
void rrc_eNB_generate_SecurityModeCommand(u8 Mod_id, u32 frame, u16 UE_index);
void rrc_eNB_process_MeasurementReport(u8 Mod_id,u16 UE_index,MeasResults_t *measResults2) ;
void rrc_eNB_process_MeasurementReport(u8 Mod_id,u32 frame, u16 UE_index,MeasResults_t *measResults2) ;
void rrc_eNB_generate_HandoverPreparationInformation (u8 Mod_id, u32 frame, u8 UE_index, PhysCellId_t targetPhyId) ;
u8 check_trigger_meas_event(u8 Mod_id,u32 frame, u8 eNB_index, u8 ue_cnx_index, u8 meas_index,
Q_OffsetRange_t ofn, Q_OffsetRange_t ocn, Hysteresis_t hys,
Q_OffsetRange_t ofs, Q_OffsetRange_t ocs, long a3_offset, TimeToTrigger_t ttt);
//void rrc_ue_process_ueCapabilityEnquiry(uint8_t Mod_id,uint32_t frame,UECapabilityEnquiry_t *UECapabilityEnquiry,uint8_t eNB_index);
//void rrc_ue_process_securityModeCommand(uint8_t Mod_id,uint32_t frame,SecurityModeCommand_t *securityModeCommand,uint8_t eNB_index);
void rrc_remove_UE (u8 Mod_id, u8 UE_id);
long binary_search_int(int elements[], long numElem, int value);
long binary_search_float(float elements[], long numElem, float value);
#endif
......
/*________________________openair_rrc_extern.h________________________
/*******************************************************************************
Authors : Hicham Anouar
Company : EURECOM
Emails : anouar@eurecom.fr
________________________________________________________________*/
Eurecom OpenAirInterface 2
Copyright(c) 1999 - 2010 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*******************************************************************************/
/*! \file vars.hles
* \brief rrc variab
* \author Raymond Knopp and Navid Nikaein
* \date 2011
* \version 1.0
* \company Eurecom
* \email: navid.nikaein@eurecom.fr
*/
#ifndef __OPENAIR_RRC_EXTERN_H__
#define __OPENAIR_RRC_EXTERN_H__
......@@ -63,6 +94,16 @@ extern u16 RACH_FREQ_ALLOC;
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 u16 T300[8];
extern u16 T310[8];
extern u16 N310[8];
extern u16 N311[8];
extern u32 T304[8];
extern u32 timeToTrigger_ms[16];
extern float RSRP_meas_mapping[100];
extern float RSRQ_meas_mapping[33];
#endif
......@@ -93,6 +93,7 @@ extern void *bigphys_malloc(int);
//#define XER_PRINT
extern inline unsigned int taus(void);
extern s8 dB_fixed2(u32 x,u32 y);
void init_SI_UE(u8 Mod_id,u8 eNB_index) {
......@@ -163,6 +164,7 @@ char openair_rrc_lite_ue_init(u8 Mod_id, unsigned char eNB_index){
UE_rrc_inst[Mod_id].Srb0[eNB_index].Active=0;
UE_rrc_inst[Mod_id].Srb1[eNB_index].Active=0;
UE_rrc_inst[Mod_id].Srb2[eNB_index].Active=0;
UE_rrc_inst[Mod_id].HandoverInfoUe.measFlag=1;
UE_rrc_inst[Mod_id].ciphering_algorithm = SecurityAlgorithmConfig__cipheringAlgorithm_eea0;
#ifdef Rel10
......@@ -272,21 +274,6 @@ void rrc_ue_generate_RRCConnectionReconfigurationComplete(u8 Mod_id, u32 frame,
pdcp_rrc_data_req (Mod_id + NB_eNB_INST, frame, 0, DCCH, rrc_mui++, 0, size, buffer, 1);
}
void rrc_ue_generate_MeasurementReport(u8 Mod_id, u32 frame, u8 eNB_index) {
u8 buffer[32], size;
LOG_D(RRC,"[UE %d] Frame %d : Generating Measurement Report\n",Mod_id,Mac_rlc_xface->frame);
size = do_MeasurementReport(buffer,1,0,3,4,5,6);
LOG_D(RLC, "[MSC_MSG][FRAME %05d][RRC_UE][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (RRCConnectionReconfigurationComplete to eNB %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n",
Mac_rlc_xface->frame, Mod_id+NB_eNB_INST, size, eNB_index, rrc_mui, Mod_id+NB_eNB_INST, DCCH);
//rrc_rlc_data_req(Mod_id+NB_eNB_INST,DCCH,rrc_mui++,0,size,(char*)buffer);
pdcp_rrc_data_req (Mod_id + NB_eNB_INST, frame, 0, DCCH, rrc_mui++, 0, size, buffer, 1);
}
/*------------------------------------------------------------------------------*/
int rrc_ue_decode_ccch(u8 Mod_id, u32 frame, SRB_INFO *Srb_info, u8 eNB_index){
/*------------------------------------------------------------------------------*/
......@@ -487,7 +474,7 @@ s32 rrc_ue_establish_drb(u8 Mod_id,u32 frame,u8 eNB_index,
}
void rrc_ue_process_measConfig(u8 Mod_id,u8 eNB_index,MeasConfig_t *measConfig){
void rrc_ue_process_measConfig(u8 Mod_id,u32 frame, u8 eNB_index,MeasConfig_t *measConfig){
// This is the procedure described in 36.331 Section 5.5.2.1
int i;
......@@ -497,7 +484,7 @@ void rrc_ue_process_measConfig(u8 Mod_id,u8 eNB_index,MeasConfig_t *measConfig)
if (measConfig->measObjectToRemoveList != NULL) {
for (i=0;i<measConfig->measObjectToRemoveList->list.count;i++) {
ind = *measConfig->measObjectToRemoveList->list.array[i];
free(UE_rrc_inst[Mod_id].MeasObj[eNB_index][ind]);
free(UE_rrc_inst[Mod_id].MeasObj[eNB_index][ind-1]);
}
}
if (measConfig->measObjectToAddModList != NULL) {
......@@ -508,7 +495,7 @@ void rrc_ue_process_measConfig(u8 Mod_id,u8 eNB_index,MeasConfig_t *measConfig)
if (UE_rrc_inst[Mod_id].MeasObj[eNB_index][ind-1]) {
LOG_D(RRC,"Modifying measurement object %d\n",ind);
memcpy((char*)UE_rrc_inst[Mod_id].MeasObj[eNB_index][ind],
memcpy((char*)UE_rrc_inst[Mod_id].MeasObj[eNB_index][ind-1],
(char*)measObj,
sizeof(MeasObjectToAddMod_t));
}
......@@ -535,6 +522,7 @@ void rrc_ue_process_measConfig(u8 Mod_id,u8 eNB_index,MeasConfig_t *measConfig)
(struct LogicalChannelConfig *)NULL,
(MeasGapConfig_t *)NULL,
(TDD_Config_t *)NULL,
(MobilityControlInfo_t *)NULL,
NULL,
NULL,
NULL,
......@@ -557,22 +545,22 @@ void rrc_ue_process_measConfig(u8 Mod_id,u8 eNB_index,MeasConfig_t *measConfig)
if (measConfig->reportConfigToRemoveList != NULL) {
for (i=0;i<measConfig->reportConfigToRemoveList->list.count;i++) {
ind = *measConfig->reportConfigToRemoveList->list.array[i];
free(UE_rrc_inst[Mod_id].ReportConfig[eNB_index][ind]);
free(UE_rrc_inst[Mod_id].ReportConfig[eNB_index][ind-1]);
}
}
if (measConfig->reportConfigToAddModList != NULL) {
LOG_I(RRC,"Report Configuration List is present\n");
for (i=0;i<measConfig->reportConfigToAddModList->list.count;i++) {
ind = measConfig->reportConfigToAddModList->list.array[i]->reportConfigId;
if (UE_rrc_inst[Mod_id].ReportConfig[eNB_index][ind]) {
LOG_I(RRC,"Modifying Report Configuration %d\n",ind);
if (UE_rrc_inst[Mod_id].ReportConfig[eNB_index][ind-1]) {
LOG_I(RRC,"Modifying Report Configuration %d\n",ind-1);
memcpy((char*)UE_rrc_inst[Mod_id].ReportConfig[eNB_index][ind-1],
(char*)measConfig->reportConfigToAddModList->list.array[i],
sizeof(ReportConfigToAddMod_t));
}
else {
LOG_D(RRC,"Adding Report Configuration %d\n",ind);
UE_rrc_inst[Mod_id].ReportConfig[eNB_index][ind] = measConfig->reportConfigToAddModList->list.array[i];
LOG_D(RRC,"Adding Report Configuration %d %p \n",ind-1,measConfig->reportConfigToAddModList->list.array[i]);
UE_rrc_inst[Mod_id].ReportConfig[eNB_index][ind-1] = measConfig->reportConfigToAddModList->list.array[i];
}
}
}
......@@ -580,7 +568,8 @@ void rrc_ue_process_measConfig(u8 Mod_id,u8 eNB_index,MeasConfig_t *measConfig)
if (measConfig->quantityConfig != NULL) {
if (UE_rrc_inst[Mod_id].QuantityConfig[eNB_index]) {
LOG_D(RRC,"Modifying Quantity Configuration \n");
memcpy((char*)UE_rrc_inst[Mod_id].QuantityConfig[eNB_index],(char*)measConfig->quantityConfig,
memcpy((char*)UE_rrc_inst[Mod_id].QuantityConfig[eNB_index],
(char*)measConfig->quantityConfig,
sizeof(QuantityConfig_t));
}
else {
......@@ -592,29 +581,30 @@ void rrc_ue_process_measConfig(u8 Mod_id,u8 eNB_index,MeasConfig_t *measConfig)
if (measConfig->measIdToRemoveList != NULL) {
for (i=0;i<measConfig->measIdToRemoveList->list.count;i++) {
ind = *measConfig->measIdToRemoveList->list.array[i];
free(UE_rrc_inst[Mod_id].MeasId[eNB_index][ind]);
free(UE_rrc_inst[Mod_id].MeasId[eNB_index][ind-1]);
}
}
if (measConfig->measIdToAddModList != NULL) {
for (i=0;i<measConfig->measIdToAddModList->list.count;i++) {
ind = measConfig->measIdToAddModList->list.array[i]->measId;
if (UE_rrc_inst[Mod_id].MeasId[eNB_index][ind]) {
LOG_D(RRC,"Modifying Measurement ID %d\n",ind);
if (UE_rrc_inst[Mod_id].MeasId[eNB_index][ind-1]) {
LOG_D(RRC,"Modifying Measurement ID %d\n",ind-1);
memcpy((char*)UE_rrc_inst[Mod_id].MeasId[eNB_index][ind-1],
(char*)measConfig->measIdToAddModList->list.array[i],
sizeof(MeasIdToAddMod_t));
}
else {
LOG_D(RRC,"Adding Measurement ID %d\n",ind);
UE_rrc_inst[Mod_id].MeasId[eNB_index][ind] = measConfig->measIdToAddModList->list.array[i];
LOG_D(RRC,"Adding Measurement ID %d %p\n",ind-1,measConfig->measIdToAddModList->list.array[i]);
UE_rrc_inst[Mod_id].MeasId[eNB_index][ind-1] = measConfig->measIdToAddModList->list.array[i];
}
}
}
if (measConfig->measGapConfig !=NULL) {
if (UE_rrc_inst[Mod_id].measGapConfig[eNB_index]) {
memcpy((char*)UE_rrc_inst[Mod_id].measGapConfig[eNB_index],(char*)measConfig->measGapConfig,
memcpy((char*)UE_rrc_inst[Mod_id].measGapConfig[eNB_index],
(char*)measConfig->measGapConfig,
sizeof(MeasGapConfig_t));
}
else {
......@@ -622,15 +612,47 @@ void rrc_ue_process_measConfig(u8 Mod_id,u8 eNB_index,MeasConfig_t *measConfig)
}
}
if (measConfig->quantityConfig != NULL) {
if (UE_rrc_inst[Mod_id].QuantityConfig[eNB_index]) {
LOG_I(RRC,"Modifying Quantity Configuration \n");
memcpy((char*)UE_rrc_inst[Mod_id].QuantityConfig[eNB_index],
(char*)measConfig->quantityConfig,
sizeof(QuantityConfig_t));
}
else {
LOG_I(RRC,"Adding Quantity configuration\n");
UE_rrc_inst[Mod_id].QuantityConfig[eNB_index] = measConfig->quantityConfig;
}
UE_rrc_inst[Mod_id].filter_coeff_rsrp = 1./pow(2,(*UE_rrc_inst[Mod_id].QuantityConfig[eNB_index]->quantityConfigEUTRA->filterCoefficientRSRP)/4);
UE_rrc_inst[Mod_id].filter_coeff_rsrq = 1./pow(2,(*UE_rrc_inst[Mod_id].QuantityConfig[eNB_index]->quantityConfigEUTRA->filterCoefficientRSRQ)/4);
LOG_I(RRC,"[UE %d] set rsrp-coeff for eNB %d: %d rsrq-coeff: %d rsrp_factor: %f rsrq_factor: %f \n",
Mod_id, eNB_index, // UE_rrc_inst[Mod_id].Info[eNB_index].UE_index,
*UE_rrc_inst[Mod_id].QuantityConfig[eNB_index]->quantityConfigEUTRA->filterCoefficientRSRP,
*UE_rrc_inst[Mod_id].QuantityConfig[eNB_index]->quantityConfigEUTRA->filterCoefficientRSRQ,
UE_rrc_inst[Mod_id].filter_coeff_rsrp, UE_rrc_inst[Mod_id].filter_coeff_rsrp,
UE_rrc_inst[Mod_id].filter_coeff_rsrp, UE_rrc_inst[Mod_id].filter_coeff_rsrq);
}
if (measConfig->s_Measure != NULL) {
UE_rrc_inst[Mod_id].s_measure = *measConfig->s_Measure;
}
if (measConfig->speedStatePars != NULL) {
if (UE_rrc_inst[Mod_id].speedStatePars)
memcpy((char*)UE_rrc_inst[Mod_id].speedStatePars,(char*)measConfig->speedStatePars,sizeof(struct MeasConfig__speedStatePars));
else
UE_rrc_inst[Mod_id].speedStatePars = measConfig->speedStatePars;
LOG_I(RRC,"[UE %d] Configuring mobility optimization params for UE %d \n",
Mod_id,UE_rrc_inst[Mod_id].Info[0].UE_index);
}
}
void rrc_ue_process_radioResourceConfigDedicated(u8 Mod_id,u32 frame, u8 eNB_index,
RadioResourceConfigDedicated_t *radioResourceConfigDedicated) {
void
rrc_ue_process_radioResourceConfigDedicated(u8 Mod_id,u32 frame, u8 eNB_index,
RadioResourceConfigDedicated_t *radioResourceConfigDedicated) {
long SRB_id,DRB_id;
int i,cnt;
......@@ -721,7 +743,7 @@ void rrc_ue_process_radioResourceConfigDedicated(u8 Mod_id,u32 frame, u8 eNB_ind
);
// Refresh SRBs
rrc_rlc_config_asn1_req(NB_eNB_INST+Mod_id,frame,0,0,
rrc_rlc_config_asn1_req(NB_eNB_INST+Mod_id,frame,0,eNB_index,
radioResourceConfigDedicated->srb_ToAddModList,
(DRB_ToAddModList_t*)NULL,
(DRB_ToReleaseList_t*)NULL
......@@ -772,6 +794,7 @@ void rrc_ue_process_radioResourceConfigDedicated(u8 Mod_id,u32 frame, u8 eNB_ind
NULL,
NULL,
NULL,
NULL,
NULL
#ifdef Rel10
,
......@@ -822,8 +845,9 @@ void rrc_ue_process_radioResourceConfigDedicated(u8 Mod_id,u32 frame, u8 eNB_ind
SRB2_logicalChannelConfig,
UE_rrc_inst[Mod_id].measGapConfig[eNB_index],
(TDD_Config_t *)NULL,
(u8 *)NULL,
(u16 *)NULL,
(MobilityControlInfo_t *)NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
......@@ -870,7 +894,7 @@ void rrc_ue_process_radioResourceConfigDedicated(u8 Mod_id,u32 frame, u8 eNB_ind
);
// Refresh DRBs
rrc_rlc_config_asn1_req(NB_eNB_INST+Mod_id,frame,0,0,
rrc_rlc_config_asn1_req(NB_eNB_INST+Mod_id,frame,0,eNB_index,
(SRB_ToAddModList_t*)NULL,
radioResourceConfigDedicated->drb_ToAddModList,
(DRB_ToReleaseList_t*)NULL
......@@ -900,12 +924,13 @@ void rrc_ue_process_radioResourceConfigDedicated(u8 Mod_id,u32 frame, u8 eNB_ind
UE_rrc_inst[Mod_id].DRB_config[eNB_index][DRB_id]->logicalChannelConfig,
UE_rrc_inst[Mod_id].measGapConfig[eNB_index],
(TDD_Config_t*)NULL,
(u8 *)NULL,
(u16 *)NULL,
(MobilityControlInfo_t *)NULL,
NULL,
NULL,
NULL,
NULL,
(MBSFN_SubframeConfigList_t*)NULL
NULL,
NULL
#ifdef Rel10
,
0,
......@@ -1072,7 +1097,7 @@ void rrc_ue_process_ueCapabilityEnquiry(uint8_t Mod_id,uint32_t frame,UECapabili
#ifdef USER_MODE
LOG_D(RRC,"UECapabilityInformation Encoded %d bits (%d bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
#endif
#endif
for (i = 0; i < (enc_rval.encoded + 7) / 8; i++)
LOG_T(RRC, "%02x.", buffer[i]);
LOG_T(RRC, "\n");
......@@ -1083,10 +1108,6 @@ void rrc_ue_process_ueCapabilityEnquiry(uint8_t Mod_id,uint32_t frame,UECapabili
}
}
void rrc_ue_process_mobilityControlInfo(u8 Mod_id,u8 eNB_index,struct MobilityControlInfo *mobilityControlInfo) {
}
void rrc_ue_process_rrcConnectionReconfiguration(u8 Mod_id, u32 frame,
RRCConnectionReconfiguration_t *rrcConnectionReconfiguration,
......@@ -1099,13 +1120,13 @@ void rrc_ue_process_rrcConnectionReconfiguration(u8 Mod_id, u32 frame,
if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo) {
LOG_I(RRC,"Mobility Control Information is present\n");
rrc_ue_process_mobilityControlInfo(Mod_id,eNB_index,
rrc_ue_process_mobilityControlInfo(Mod_id,frame, eNB_index,
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo);
}
if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig != NULL) {
LOG_I(RRC,"Measurement Configuration is present\n");
rrc_ue_process_measConfig(Mod_id,eNB_index,
rrc_ue_process_measConfig(Mod_id,frame, eNB_index,
rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig);
}
if (rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated) {
......@@ -1117,6 +1138,125 @@ void rrc_ue_process_rrcConnectionReconfiguration(u8 Mod_id, u32 frame,
} // critical extensions present
}
/* 36.331, 5.3.5.4 Reception of an RRCConnectionReconfiguration including the mobilityControlInfo by the UE (handover) */
void rrc_ue_process_mobilityControlInfo(u8 Mod_id,u32 frame, u8 eNB_index,struct MobilityControlInfo *mobilityControlInfo) {
DRB_ToReleaseList_t* drb2release_list;
DRB_Identity_t *lcid;
u8 i;
LOG_N(RRC,"Note: This function needs some updates\n");
if(UE_rrc_inst[Mod_id].Info[eNB_index].T310_active == 1)
UE_rrc_inst[Mod_id].Info[eNB_index].T310_active = 0;
UE_rrc_inst[Mod_id].Info[eNB_index].T304_active = 1;
UE_rrc_inst[Mod_id].Info[eNB_index].T304_cnt = T304[mobilityControlInfo->t304];
drb2release_list = CALLOC (1, sizeof (*drb2release_list));
lcid= CALLOC (1, sizeof (DRB_Identity_t)); // long
for (*lcid=0;*lcid<NB_RB_MAX;*lcid++)
ASN_SEQUENCE_ADD (&(drb2release_list)->list,lcid);
//Removing SRB1 and SRB2 and DRB0
LOG_N(RRC,"[UE %d] : Update needed for rrc_pdcp_config_req (deprecated) and rrc_rlc_config_req commands(deprecated)\n",Mod_id);
rrc_pdcp_config_req (Mod_id+NB_eNB_INST, frame, 0, ACTION_REMOVE, Mod_id+DCCH,UNDEF_SECURITY_MODE);
rrc_rlc_config_req(Mod_id+NB_eNB_INST,frame,0,ACTION_REMOVE,Mod_id+DCCH,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
rrc_pdcp_config_req (Mod_id+NB_eNB_INST, frame, 0, ACTION_REMOVE, Mod_id+DCCH1,UNDEF_SECURITY_MODE);
rrc_rlc_config_req(Mod_id+NB_eNB_INST,frame,0,ACTION_REMOVE,Mod_id+DCCH1,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
rrc_pdcp_config_req (Mod_id+NB_eNB_INST, frame, 0, ACTION_REMOVE, Mod_id+DTCH,UNDEF_SECURITY_MODE);
rrc_rlc_config_req(Mod_id+NB_eNB_INST,frame,0,ACTION_REMOVE,Mod_id+DTCH,RADIO_ACCESS_BEARER,Rlc_info_um);
/*
rrc_pdcp_config_asn1_req(NB_eNB_INST+Mod_id,frame, 0,eNB_index,
NULL, // SRB_ToAddModList
NULL, // DRB_ToAddModList
drb2release_list,
0, // security mode
NULL, // key rrc encryption
NULL, // key rrc integrity
NULL // key encryption
#ifdef Rel10
,NULL
#endif
);
rrc_rlc_config_asn1_req(NB_eNB_INST+Mod_id, frame,0,eNB_index,
NULL,// SRB_ToAddModList
NULL,// DRB_ToAddModList
drb2release_list // DRB_ToReleaseList
#ifdef Rel10
,NULL
#endif
);
*/
//A little cleanup at RRC...
//Copying current queue config to free RRC index
/*
memcpy((void *)UE_rrc_inst[Mod_id].SRB1_config[~(7<<eNB_index)],(void *)UE_rrc_inst[Mod_id].SRB1_config[7<<eNB_index],sizeof(SRB_ToAddMod_t));
memcpy((void *)UE_rrc_inst[Mod_id].SRB2_config[~(7<<eNB_index)],(void *)UE_rrc_inst[Mod_id].SRB2_config[7<<eNB_index],sizeof(SRB_ToAddMod_t));
memcpy((void *)UE_rrc_inst[Mod_id].DRB_config[~(7<<eNB_index)][0],(void *)UE_rrc_inst[Mod_id].DRB_config[7<<eNB_index][0],sizeof(DRB_ToAddMod_t));
*/
/*
LOG_N(RRC,"Not sure if Freeing the current queue config works properly: Fix me\n");
free((void *)&UE_rrc_inst[Mod_id].SRB1_config[eNB_index]);
free((void *)&UE_rrc_inst[Mod_id].SRB2_config[eNB_index]);
free((void *)&UE_rrc_inst[Mod_id].DRB_config[eNB_index][0]);
UE_rrc_inst[Mod_id].SRB1_config[eNB_index] = NULL;
UE_rrc_inst[Mod_id].SRB2_config[eNB_index] = NULL;
UE_rrc_inst[Mod_id].DRB_config[eNB_index][0] = NULL;
*/
//Synchronisation to DL of target cell
LOG_D(RRC,"HO: Reset PDCP and RLC for configured RBs.. \n[MSC_MSG][FRAME %05d][RRC_UE][MOD %02d][][--- MAC_CONFIG_REQ (SRB2 eNB %d) --->][MAC_UE][MOD %02d][]\n",
frame, Mod_id, eNB_index, Mod_id);
// Reset MAC and configure PHY
rrc_mac_config_req(Mod_id,0,0,eNB_index,
(RadioResourceConfigCommonSIB_t *)NULL,
(struct PhysicalConfigDedicated *)NULL,
(MeasObjectToAddMod_t **)NULL,
(MAC_MainConfig_t *)NULL,
0,
(struct LogicalChannelConfig *)NULL,
(MeasGapConfig_t *)NULL,
(TDD_Config_t *)NULL,
mobilityControlInfo,
(u8 *)NULL,
(u16 *)NULL,
NULL,
NULL,
NULL,
NULL
#ifdef Rel10
,0,
(MBSFN_AreaInfoList_r9_t *)NULL,
(PMCH_InfoList_r9_t *)NULL
#endif
#ifdef CBA
,0,
0
#endif
);
// Re-establish PDCP for all RBs that are established
// rrc_pdcp_config_req (Mod_id+NB_eNB_INST, frame, 0, ACTION_ADD, Mod_id+DCCH);
// rrc_pdcp_config_req (Mod_id+NB_eNB_INST, frame, 0, ACTION_ADD, Mod_id+DCCH1);
// rrc_pdcp_config_req (Mod_id+NB_eNB_INST, frame, 0, ACTION_ADD, Mod_id+DTCH);
// Re-establish RLC for all RBs that are established
// rrc_rlc_config_req(Mod_id+NB_eNB_INST,frame,0,ACTION_ADD,Mod_id+DCCH,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
// rrc_rlc_config_req(Mod_id+NB_eNB_INST,frame,0,ACTION_ADD,Mod_id+DCCH1,SIGNALLING_RADIO_BEARER,Rlc_info_am_config);
// rrc_rlc_config_req(Mod_id+NB_eNB_INST,frame,0,ACTION_ADD,Mod_id+DTCH,RADIO_ACCESS_BEARER,Rlc_info_um);
UE_rrc_inst[Mod_id].Info[eNB_index].State = RRC_SI_RECEIVED;
}
void rrc_detach_from_eNB(u8 Mod_id,u8 eNB_index) {
//UE_rrc_inst[Mod_id].DRB_config[eNB_index]
}
/*------------------------------------------------------------------------------------------*/
void rrc_ue_decode_dcch(u8 Mod_id,u32 frame,u8 Srb_id, u8 *Buffer,u8 eNB_index){
/*------------------------------------------------------------------------------------------*/
......@@ -1125,7 +1265,7 @@ void rrc_ue_decode_dcch(u8 Mod_id,u32 frame,u8 Srb_id, u8 *Buffer,u8 eNB_index)
DL_DCCH_Message_t *dl_dcch_msg=NULL;//&dldcchmsg;
// asn_dec_rval_t dec_rval;
// int i;
u8 target_eNB_index=0xFF;
if (Srb_id != 1) {
LOG_E(RRC,"[UE %d] Frame %d: Received message on DL-DCCH (SRB1), should not have ...\n",Mod_id,frame);
return;
......@@ -1144,7 +1284,7 @@ void rrc_ue_decode_dcch(u8 Mod_id,u32 frame,u8 Srb_id, u8 *Buffer,u8 eNB_index)
&asn_DEF_DL_DCCH_Message,
(void**)&dl_dcch_msg,
(uint8_t*)Buffer,
100,0,0);
RRC_BUF_SIZE,0,0);
#ifdef XER_PRINT
xer_fprint(stdout,&asn_DEF_DL_DCCH_Message,(void*)dl_dcch_msg);
......@@ -1152,7 +1292,7 @@ void rrc_ue_decode_dcch(u8 Mod_id,u32 frame,u8 Srb_id, u8 *Buffer,u8 eNB_index)
if (dl_dcch_msg->message.present == DL_DCCH_MessageType_PR_c1) {
if (UE_rrc_inst[Mod_id].Info[eNB_index].State == RRC_CONNECTED) {
if (UE_rrc_inst[Mod_id].Info[eNB_index].State >= RRC_CONNECTED) {
switch (dl_dcch_msg->message.choice.c1.present) {
......@@ -1169,10 +1309,32 @@ void rrc_ue_decode_dcch(u8 Mod_id,u32 frame,u8 Srb_id, u8 *Buffer,u8 eNB_index)
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[Mod_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 (%d) is different from RSRP measured target (%d)..\n",Mod_id, frame,
dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration.criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo->targetPhysCellId,UE_rrc_inst[Mod_id].HandoverInfoUe.targetCellId);
return;
} else if ((target_eNB_index=get_adjacent_cell_mod_id(UE_rrc_inst[Mod_id].HandoverInfoUe.targetCellId)) == 0xFF ){
LOG_W(RRC,"[UE %d] Frame %d: Mod_id of the target eNB not found, check the network topology\n",Mod_id, frame);
return;
} else {
LOG_I(RRC,"[UE% d] Frame %d: Received rrcConnectionReconfiguration with mobilityControlInfo \n", Mod_id, frame);
UE_rrc_inst[Mod_id].HandoverInfoUe.measFlag = 1; // Ready to send more MeasReports if required
}
}
rrc_ue_process_rrcConnectionReconfiguration(Mod_id,frame,&dl_dcch_msg->message.choice.c1.choice.rrcConnectionReconfiguration,eNB_index);
rrc_ue_generate_RRCConnectionReconfigurationComplete(Mod_id,frame,eNB_index);
UE_rrc_inst[Mod_id].Info[eNB_index].State = RRC_RECONFIGURED;
LOG_I(RRC,"[UE %d] State = RRC_RECONFIGURED (eNB %d)\n",Mod_id,eNB_index);
if (target_eNB_index!=0xFF){
rrc_ue_generate_RRCConnectionReconfigurationComplete(Mod_id,frame,target_eNB_index);
UE_rrc_inst[Mod_id].Info[eNB_index].State = RRC_HO_EXECUTION;
UE_rrc_inst[Mod_id].Info[target_eNB_index].State = RRC_RECONFIGURED;
LOG_I(RRC,"[UE %d] State = RRC_RECONFIGURED during HO (eNB %d)\n",Mod_id,target_eNB_index);
}else {
rrc_ue_generate_RRCConnectionReconfigurationComplete(Mod_id,frame,eNB_index);
UE_rrc_inst[Mod_id].Info[eNB_index].State = RRC_RECONFIGURED;
LOG_I(RRC,"[UE %d] State = RRC_RECONFIGURED (eNB %d)\n",Mod_id,eNB_index);
}
break;
case DL_DCCH_MessageType__c1_PR_rrcConnectionRelease:
break;
......@@ -1355,7 +1517,8 @@ int decode_SIB1(u8 Mod_id,u8 eNB_index) {
0,
(struct LogicalChannelConfig *)NULL,
(MeasGapConfig_t *)NULL,
UE_rrc_inst[Mod_id].sib1[eNB_index]->tdd_Config,
UE_rrc_inst[Mod_id].sib1[eNB_index]->tdd_Config,
(MobilityControlInfo_t *) NULL,
&UE_rrc_inst[Mod_id].Info[eNB_index].SIwindowsize,
&UE_rrc_inst[Mod_id].Info[eNB_index].SIperiod,
NULL,
......@@ -1363,8 +1526,7 @@ int decode_SIB1(u8 Mod_id,u8 eNB_index) {
NULL,
(MBSFN_SubframeConfigList_t *)NULL
#ifdef Rel10
,
0,
,0,
(MBSFN_AreaInfoList_r9_t *)NULL,
(PMCH_InfoList_r9_t *)NULL
#endif
......@@ -1520,6 +1682,7 @@ int decode_SI(u8 Mod_id,u32 frame,u8 eNB_index,u8 si_window) {
(struct LogicalChannelConfig *)NULL,
(MeasGapConfig_t *)NULL,
(TDD_Config_t *)NULL,
(MobilityControlInfo_t *)NULL,
NULL,
NULL,
UE_rrc_inst[Mod_id].sib2[eNB_index]->freqInfo.ul_CarrierFreq,
......@@ -1527,14 +1690,12 @@ int decode_SI(u8 Mod_id,u32 frame,u8 eNB_index,u8 si_window) {
&UE_rrc_inst[Mod_id].sib2[eNB_index]->freqInfo.additionalSpectrumEmission,
UE_rrc_inst[Mod_id].sib2[eNB_index]->mbsfn_SubframeConfigList
#ifdef Rel10
,
0,
,0,
(MBSFN_AreaInfoList_r9_t *)NULL,
(PMCH_InfoList_r9_t *)NULL
#endif
#ifdef CBA
,
0,
,0,
0
#endif
);
......@@ -1611,6 +1772,7 @@ int decode_SI(u8 Mod_id,u32 frame,u8 eNB_index,u8 si_window) {
(struct LogicalChannelConfig *)NULL,
(MeasGapConfig_t *)NULL,
(TDD_Config_t *)NULL,
(MobilityControlInfo_t *)NULL,
NULL,
NULL,
NULL,
......@@ -1618,14 +1780,12 @@ int decode_SI(u8 Mod_id,u32 frame,u8 eNB_index,u8 si_window) {
NULL,
(MBSFN_SubframeConfigList_t *)NULL
#ifdef Rel10
,
0,
,0,
&UE_rrc_inst[Mod_id].sib13[eNB_index]->mbsfn_AreaInfoList_r9,
(PMCH_InfoList_r9_t *)NULL
#endif
#ifdef CBA
,
0,
,0,
0
#endif
);
......@@ -1642,6 +1802,248 @@ int decode_SI(u8 Mod_id,u32 frame,u8 eNB_index,u8 si_window) {
return 0;
}
// layer 3 filtering of RSRP (EUTRA) measurements: 36.331, Sec. 5.5.3.2
void ue_meas_filtering(u8 Mod_id,u32 frame,u8 eNB_index){
float a = UE_rrc_inst[Mod_id].filter_coeff_rsrp; // 'a' in 36.331 Sec. 5.5.3.2
float a1 = UE_rrc_inst[Mod_id].filter_coeff_rsrq;
//float rsrp_db, rsrq_db;
u8 eNB_offset;
if(UE_rrc_inst[Mod_id].QuantityConfig[0] != NULL) { // Only consider 1 serving cell (index: 0)
if (UE_rrc_inst[Mod_id].QuantityConfig[0]->quantityConfigEUTRA != NULL) {
if(UE_rrc_inst[Mod_id].QuantityConfig[0]->quantityConfigEUTRA->filterCoefficientRSRP != NULL) {
for (eNB_offset = 0;eNB_offset<1+mac_xface->get_n_adj_cells(Mod_id);eNB_offset++) {
//filter_factor = 1/power(2,*UE_rrc_inst[Mod_id].QuantityConfig[0]->quantityConfigEUTRA->filterCoefficientRSRP/4);
// LOG_N(RRC,"[UE %d] Frame %d : check proper operation in abstraction mode rsrp (%d), rx gain (%d) N_RB_DL (%d)\n",
// Mod_id,frame,mac_xface->get_RSRP(Mod_id,eNB_offset),mac_xface->get_rx_total_gain_dB(Mod_id),mac_xface->lte_frame_parms->N_RB_DL);
UE_rrc_inst[Mod_id].rsrp_db[eNB_offset] = (dB_fixed_times10(mac_xface->get_RSRP(Mod_id,eNB_offset))/10.0)-mac_xface->get_rx_total_gain_dB(Mod_id)-dB_fixed(mac_xface->lte_frame_parms->N_RB_DL*12);
UE_rrc_inst[Mod_id].rsrp_db_filtered[eNB_offset] = (1.0-a)*UE_rrc_inst[Mod_id].rsrp_db_filtered[eNB_offset] + a*UE_rrc_inst[Mod_id].rsrp_db[eNB_offset];
//mac_xface->set_RSRP_filtered(Mod_id,eNB_offset,UE_rrc_inst[Mod_id].rsrp_db_filtered[eNB_offset]);
LOG_D(RRC,"[UE %d] Frame %d: Meas RSRP: eNB_offset: %d rsrp_coef: %3.2f filter_coef: %d before L3 filtering: rsrp: %3.1f after L3 filtering: rsrp: %3.1f \n ",
Mod_id, frame, eNB_offset,a,
*UE_rrc_inst->QuantityConfig[0]->quantityConfigEUTRA->filterCoefficientRSRP,
UE_rrc_inst[Mod_id].rsrp_db[eNB_offset],
UE_rrc_inst[Mod_id].rsrp_db_filtered[eNB_offset]);
}
}
}
else {
for (eNB_offset = 0;eNB_offset<1+mac_xface->get_n_adj_cells(Mod_id);eNB_offset++) {
UE_rrc_inst[Mod_id].rsrp_db_filtered[eNB_offset]= mac_xface->get_RSRP(Mod_id,eNB_offset);
// phy_vars_ue->PHY_measurements.rsrp_filtered[eNB_offset]=UE_rrc_inst[Mod_id].rsrp_db_filtered[eNB_offset];
//mac_xface->set_RSRP_filtered(Mod_id,eNB_offset,UE_rrc_inst[Mod_id].rsrp_db_filtered[eNB_offset]);
}
}
if (UE_rrc_inst[Mod_id].QuantityConfig[0]->quantityConfigEUTRA != NULL) {
if(UE_rrc_inst[Mod_id].QuantityConfig[0]->quantityConfigEUTRA->filterCoefficientRSRQ != NULL) {
for (eNB_offset = 0;eNB_offset<1+mac_xface->get_n_adj_cells(Mod_id);eNB_offset++) {
// LOG_N(RRC,"[UE %d] Frame %d : check if this operation workes properly in abstraction mode\n",Mod_id,frame);
UE_rrc_inst[Mod_id].rsrq_db[eNB_offset] = (10*log10(mac_xface->get_RSRQ(Mod_id,eNB_offset)))-20;
UE_rrc_inst[Mod_id].rsrq_db_filtered[eNB_offset]=(1-a1)*UE_rrc_inst[Mod_id].rsrq_db_filtered[eNB_offset] + a1 *UE_rrc_inst[Mod_id].rsrq_db[eNB_offset];
//mac_xface->set_RSRP_filtered(Mod_id,eNB_offset,UE_rrc_inst[Mod_id].rsrp_db_filtered[eNB_offset]);
/*
LOG_D(RRC,"[UE %d] meas RSRQ: eNB_offset: %d rsrq_coef: %3.2f filter_coef: %d before L3 filtering: rsrq: %3.1f after L3 filtering: rsrq: %3.1f \n ",
Mod_id, eNB_offset,
a1,
*UE_rrc_inst->QuantityConfig[0]->quantityConfigEUTRA->filterCoefficientRSRQ,
mac_xface->get_RSRQ(Mod_id,eNB_offset),
UE_rrc_inst[Mod_id].rsrq_db[eNB_offset],
UE_rrc_inst[Mod_id].rsrq_db_filtered[eNB_offset]);
*/
}
}
}
else{
for (eNB_offset = 0;eNB_offset<1+mac_xface->get_n_adj_cells(Mod_id);eNB_offset++) {
UE_rrc_inst[Mod_id].rsrq_db_filtered[eNB_offset]= mac_xface->get_RSRQ(Mod_id,eNB_offset);
}
}
}
}
// Measurement report triggering, described in 36.331 Section 5.5.4.1: called periodically
void ue_measurement_report_triggering(u8 Mod_id, u32 frame,u8 eNB_index) {
u8 i,j;
Hysteresis_t hys;
TimeToTrigger_t ttt_ms;
Q_OffsetRange_t ofn;
Q_OffsetRange_t ocn;
Q_OffsetRange_t ofs;
Q_OffsetRange_t ocs;
long a3_offset;
MeasObjectToAddMod_t measObj;
//MeasId_t measId;
MeasObjectId_t measObjId;
ReportConfigId_t reportConfigId;
for(i=0 ; i<NB_CNX_UE ; i++) {
for(j=0 ; j<MAX_MEAS_ID ; j++) {
if(UE_rrc_inst[Mod_id].MeasId[i][j] != NULL) {
measObjId = UE_rrc_inst[Mod_id].MeasId[i][j]->measObjectId;
reportConfigId = UE_rrc_inst[Mod_id].MeasId[i][j]->reportConfigId;
if( /*UE_rrc_inst[Mod_id].MeasId[i][j] != NULL && */ UE_rrc_inst[Mod_id].MeasObj[i][measObjId-1] != NULL) {
if(UE_rrc_inst[Mod_id].MeasObj[i][measObjId-1]->measObject.present == MeasObjectToAddMod__measObject_PR_measObjectEUTRA) {
/* consider any neighboring cell detected on the associated frequency to be
* applicable when the concerned cell is not included in the blackCellsToAddModList
* defined within the VarMeasConfig for this measId */
// LOG_I(RRC,"event %d %d %p \n", measObjId,reportConfigId, UE_rrc_inst[Mod_id].ReportConfig[i][reportConfigId-1]);
if((UE_rrc_inst[Mod_id].ReportConfig[i][reportConfigId-1] != NULL) &&
(UE_rrc_inst[Mod_id].ReportConfig[i][reportConfigId-1]->reportConfig.present==ReportConfigToAddMod__reportConfig_PR_reportConfigEUTRA) &&
(UE_rrc_inst[Mod_id].ReportConfig[i][reportConfigId-1]->reportConfig.choice.reportConfigEUTRA.triggerType.present == ReportConfigEUTRA__triggerType_PR_event)) {
hys = UE_rrc_inst[Mod_id].ReportConfig[i][reportConfigId-1]->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.hysteresis;
//LOG_N(RRC,"[UE%d] Frame %d Check below lines for segfault :), Fix me \n",Mod_id, frame);
ttt_ms = timeToTrigger_ms[UE_rrc_inst[Mod_id].ReportConfig[i][reportConfigId-1]->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.timeToTrigger];
// Freq specific offset of neighbor cell freq
ofn = ((UE_rrc_inst[Mod_id].MeasObj[i][measObjId-1]->measObject.choice.measObjectEUTRA.offsetFreq != NULL) ?
*UE_rrc_inst[Mod_id].MeasObj[i][measObjId-1]->measObject.choice.measObjectEUTRA.offsetFreq : 15); // /* 15 is the Default */
// cellIndividualOffset of neighbor cell - not defined yet
ocn = 0;
a3_offset = UE_rrc_inst[Mod_id].ReportConfig[i][reportConfigId-1]->reportConfig.choice.reportConfigEUTRA.triggerType.choice.event.eventId.choice.eventA3.a3_Offset;
switch (UE_rrc_inst[Mod_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",Mod_id, 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",Mod_id, 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",Mod_id, frame);
if ((check_trigger_meas_event(Mod_id,frame,eNB_index,i,j,ofn,ocn,hys,ofs,ocs,a3_offset,ttt_ms)) &&
(UE_rrc_inst[Mod_id].Info[0].State >= RRC_CONNECTED) &&
(UE_rrc_inst[Mod_id].Info[0].T304_active == 0 ) &&
(UE_rrc_inst[Mod_id].HandoverInfoUe.measFlag == 1)) {
//trigger measurement reporting procedure (36.331, section 5.5.5)
if (UE_rrc_inst[Mod_id].measReportList[i][j] == NULL) {
UE_rrc_inst[Mod_id].measReportList[i][j] = malloc(sizeof(MEAS_REPORT_LIST));
}
UE_rrc_inst[Mod_id].measReportList[i][j]->measId = UE_rrc_inst[Mod_id].MeasId[i][j]->measId;
UE_rrc_inst[Mod_id].measReportList[i][j]->numberOfReportsSent = 0;
rrc_ue_generate_MeasurementReport(Mod_id,frame,eNB_index);
UE_rrc_inst[Mod_id].HandoverInfoUe.measFlag = 1;
LOG_I(RRC,"[UE %d] Frame %d: A3 event detected, state: %d \n", Mod_id, frame, UE_rrc_inst[Mod_id].Info[0].State);
}
else {
if(UE_rrc_inst[Mod_id].measReportList[i][j] != NULL){
free(UE_rrc_inst[Mod_id].measReportList[i][j]);
}
UE_rrc_inst[Mod_id].measReportList[i][j] = NULL;
}
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",Mod_id, 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",Mod_id, frame);
break;
default:
LOG_D(RRC,"Invalid ReportConfigEUTRA__triggerType__event__eventId: %d",
UE_rrc_inst[Mod_id].ReportConfig[i][j]->reportConfig.choice.reportConfigEUTRA.triggerType.present);
break;
}
}
}
}
}
}
}
}
//check_trigger_meas_event(Mod_id, frame, eNB_index, i,j,ofn,ocn,hys,ofs,ocs,a3_offset,ttt_ms)
u8 check_trigger_meas_event(u8 Mod_id,u32 frame, u8 eNB_index, u8 ue_cnx_index, u8 meas_index,
Q_OffsetRange_t ofn, Q_OffsetRange_t ocn, Hysteresis_t hys,
Q_OffsetRange_t ofs, Q_OffsetRange_t ocs, long a3_offset, TimeToTrigger_t ttt) {
u8 eNB_offset;
u8 currentCellIndex = mac_xface->lte_frame_parms->Nid_cell;
LOG_I(RRC,"ofn(%d) ocn(%d) hys(%d) ofs(%d) ocs(%d) a3_offset(%d) ttt(%d) rssi %3.1f\n", \
ofn,ocn,hys,ofs,ocs,a3_offset,ttt,10*log10(mac_xface->get_RSSI(Mod_id))-mac_xface->get_rx_total_gain_dB(Mod_id));
// for (eNB_offset = 0;(eNB_offset<1+mac_xface->get_n_adj_cells(Mod_id))&& (eNB_offset!=eNB_index);eNB_offset++) {
for (eNB_offset = 1;(eNB_offset<1+mac_xface->get_n_adj_cells(Mod_id));eNB_offset++) {
/* RHS: Verify that idx 0 corresponds to currentCellIndex in rsrp array */
if(UE_rrc_inst[Mod_id].rsrp_db_filtered[eNB_offset]+ofn+ocn-hys > UE_rrc_inst[Mod_id].rsrp_db_filtered[0/*eNB_index*/]+ofs+ocs - 1 /*+a3_offset*/) {
UE_rrc_inst->measTimer[ue_cnx_index][meas_index][eNB_offset-1] += 2; //Called every subframe = 2ms
LOG_D(RRC,"[UE %d] Frame %d: Entry measTimer[%d][%d]: %d currentCell: %d betterCell: %d \n",
Mod_id, frame, ue_cnx_index,meas_index,UE_rrc_inst->measTimer[ue_cnx_index][meas_index][eNB_offset-1],currentCellIndex,eNB_offset);
}
else {
UE_rrc_inst->measTimer[ue_cnx_index][meas_index][eNB_offset-1] = 0; //Exit condition: Resetting the measurement timer
LOG_D(RRC,"[UE %d] Frame %d: Exit measTimer[%d][%d]: %d currentCell: %d betterCell: %d \n",
Mod_id, frame, ue_cnx_index,meas_index,UE_rrc_inst->measTimer[ue_cnx_index][meas_index][eNB_offset-1],currentCellIndex,eNB_offset);
}
if (UE_rrc_inst->measTimer[ue_cnx_index][meas_index][eNB_offset-1] >= ttt) {
UE_rrc_inst->HandoverInfoUe.targetCellId = get_adjacent_cell_id(Mod_id,eNB_offset-1); //check this!
LOG_D(RRC,"[UE %d] Frame %d eNB %d: Handover triggered: targetCellId: %d currentCellId: %d eNB_offset: %d rsrp source: %3.1f rsrp target: %3.1f\n", \
Mod_id, frame, eNB_index,
UE_rrc_inst->HandoverInfoUe.targetCellId,ue_cnx_index,eNB_offset,
(dB_fixed_times10(UE_rrc_inst[Mod_id].rsrp_db[0])/10.0)-mac_xface->get_rx_total_gain_dB(Mod_id)-dB_fixed(mac_xface->lte_frame_parms->N_RB_DL*12),
(dB_fixed_times10(UE_rrc_inst[Mod_id].rsrp_db[eNB_offset])/10.0)-mac_xface->get_rx_total_gain_dB(Mod_id)-dB_fixed(mac_xface->lte_frame_parms->N_RB_DL*12));
UE_rrc_inst->Info[0].handoverTarget = eNB_offset;
return 1;
}
}
return 0;
}
//Below routine implements Measurement Reporting procedure from 36.331 Section 5.5.5
void rrc_ue_generate_MeasurementReport(u8 Mod_id, u32 frame,u8 eNB_index) {
u8 buffer[32], size;
u8 i,j;
u8 target_eNB_offset;
MeasId_t measId;
PhysCellId_t cellId, targetCellId;
long rsrq_s,rsrp_t,rsrq_t;
long rsrp_s, nElem, nElem1;
float rsrp_filtered, rsrq_filtered;
nElem = 100;
nElem1 = 33;
static u32 pframe=0;
int nid_cell = mac_xface->lte_frame_parms->Nid_cell;
target_eNB_offset = UE_rrc_inst[Mod_id].Info[0].handoverTarget; // eNB_offset of target eNB: used to obtain the mod_id of target eNB
for (i=0;i<MAX_MEAS_ID;i++) {
if (UE_rrc_inst[Mod_id].measReportList[0][i] != NULL) {
measId = UE_rrc_inst[Mod_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[Mod_id].rsrp_db_filtered[eNB_index];//nid_cell];
rsrp_s = binary_search_float(RSRP_meas_mapping,nElem, rsrp_filtered); //mapped RSRP of serving cell
rsrq_filtered = UE_rrc_inst[Mod_id].rsrq_db_filtered[eNB_index];//nid_cell]; //RSRQ of serving cell
rsrq_s = binary_search_float(RSRQ_meas_mapping,nElem1,rsrp_filtered);//mapped RSRQ of serving cell
LOG_D(RRC,"[UE %d] Frame %d: source eNB %d :rsrp_s: %d rsrq_s: %d tmp: %f tmp1: %f \n",
Mod_id,frame,eNB_index, rsrp_s,rsrq_s,rsrp_filtered,rsrq_filtered);
rsrp_t = binary_search_float(RSRP_meas_mapping,nElem,UE_rrc_inst[Mod_id].rsrp_db_filtered[target_eNB_offset]); //RSRP of target cell
rsrq_t = binary_search_float(RSRQ_meas_mapping,nElem1,UE_rrc_inst[Mod_id].rsrq_db_filtered[target_eNB_offset]); //RSRQ of target cell
// if (measFlag == 1) {
cellId = get_adjacent_cell_id(Mod_id,eNB_index); //PhycellId of serving cell
targetCellId = UE_rrc_inst[Mod_id].HandoverInfoUe.targetCellId ;//get_adjacent_cell_id(Mod_id,target_eNB_offset); //PhycellId of target cell
if (pframe!=frame){
pframe=frame;
size = do_MeasurementReport(buffer,measId,targetCellId,rsrp_s,rsrq_s,rsrp_t,rsrq_t);
LOG_D(RRC,"[UE %d] Frame %d: Sending MeasReport: servingCell(%d) targetCell(%d) rsrp_s(%d) rsrq_s(%d) rsrp_t(%d) rsrq_t(%d) \n",
Mod_id, frame, cellId,targetCellId,rsrp_s,rsrq_s,rsrp_t,rsrq_t);
LOG_I(RRC,"[UE %d] Frame %d : Generating Measurement Report for eNB %d\n",Mod_id,frame,eNB_index);
LOG_D(RLC,"[MSC_MSG][FRAME %05d][RRC_UE][MOD %02d][][--- PDCP_DATA_REQ/%d Bytes (MeasurementReport to eNB %d MUI %d) --->][PDCP][MOD %02d][RB %02d]\n",
frame, Mod_id+NB_eNB_INST, size, eNB_index, rrc_mui, Mod_id+NB_eNB_INST, DCCH);
pdcp_data_req(Mod_id+NB_eNB_INST,frame,0,DCCH,rrc_mui++,0,size,(char*)buffer,1);
//LOG_D(RRC, "[UE %d] Frame %d Sending MeasReport (%d bytes) through DCCH%d to PDCP \n",Mod_id,frame, size, DCCH);
}
// measFlag = 0; //re-setting measFlag so that no more MeasReports are sent in this frame
// }
}
}
}
#ifdef Rel10
int decode_MCCH_Message(u8 Mod_id, u32 frame, u8 eNB_index, u8 *Sdu, u8 Sdu_len,u8 mbsfn_sync_area) {
......@@ -1700,6 +2102,7 @@ void decode_MBSFNAreaConfiguration(u8 Mod_id, u8 eNB_index, u32 frame,u8 mbsfn_s
(struct LogicalChannelConfig *)NULL,
(MeasGapConfig_t *)NULL,
(TDD_Config_t *)NULL,
(MobilityControlInfo_t *)NULL,
NULL,
NULL,
NULL,
......@@ -1722,9 +2125,7 @@ void decode_MBSFNAreaConfiguration(u8 Mod_id, u8 eNB_index, u32 frame,u8 mbsfn_s
UE_rrc_inst[Mod_id].Info[eNB_index].MCCHStatus[mbsfn_sync_area] = 1;
// Config Radio Bearer for MBMS user data (similar way to configure for eNB side in init_MBMS function)
rrc_pdcp_config_asn1_req(NB_eNB_INST+Mod_id,frame,
0,// eNB_flag
eNB_index,// 0,// index
rrc_pdcp_config_asn1_req(NB_eNB_INST+Mod_id,frame,0,eNB_index,
NULL, // SRB_ToAddModList
NULL, // DRB_ToAddModList
(DRB_ToReleaseList_t*)NULL,
......@@ -1733,18 +2134,18 @@ void decode_MBSFNAreaConfiguration(u8 Mod_id, u8 eNB_index, u32 frame,u8 mbsfn_s
NULL, // key rrc integrity
NULL // key encryption
#ifdef Rel10
,
&(UE_rrc_inst[Mod_id].mcch_message[eNB_index]->pmch_InfoList_r9)
,&(UE_rrc_inst[Mod_id].mcch_message[eNB_index]->pmch_InfoList_r9)
#endif
);
rrc_rlc_config_asn1_req(NB_eNB_INST+Mod_id, frame,
0,// eNB_flag
0,
rrc_rlc_config_asn1_req(NB_eNB_INST+Mod_id, frame,0,eNB_index,
NULL,// SRB_ToAddModList
NULL,// DRB_ToAddModList
NULL,// DRB_ToReleaseList
&(UE_rrc_inst[Mod_id].mcch_message[eNB_index]->pmch_InfoList_r9));
#ifdef Rel10
&(UE_rrc_inst[Mod_id].mcch_message[eNB_index]->pmch_InfoList_r9)
#endif
);
// */
}
......
......@@ -51,6 +51,8 @@
extern eNB_MAC_INST *eNB_mac_inst;
extern UE_MAC_INST *UE_mac_inst;
extern mui_t rrc_eNB_mui;
//configure BCCH & CCCH Logical Channels and associated rrc_buffers, configure associated SRBs
void openair_rrc_on(u8 Mod_id, u8 eNB_flag) {
unsigned short i;
......@@ -203,7 +205,7 @@ void rrc_config_buffer(SRB_INFO *Srb_info, u8 Lchan_type, u8 Role) {
}
/*------------------------------------------------------------------------------*/
void openair_rrc_top_init(int eMBMS_active, u8 cba_group_active) {
void openair_rrc_top_init(int eMBMS_active, u8 cba_group_active,u8 HO_active){
/*-----------------------------------------------------------------------------*/
int i;
......@@ -241,6 +243,10 @@ void openair_rrc_top_init(int eMBMS_active, u8 cba_group_active) {
if (NB_eNB_INST > 0) {
eNB_rrc_inst = (eNB_RRC_INST*) malloc16(NB_eNB_INST*sizeof(eNB_RRC_INST));
memset (eNB_rrc_inst, 0, NB_eNB_INST * sizeof(eNB_RRC_INST));
LOG_I(RRC,"[eNB] handover active state is %d \n", HO_active);
for (i=0;i<NB_eNB_INST;i++) {
eNB_rrc_inst[i].HO_flag = (uint8_t)HO_active;
}
#ifdef Rel10
LOG_I(RRC,"[eNB] eMBMS active state is %d \n", eMBMS_active);
for (i=0;i<NB_eNB_INST;i++) {
......@@ -280,14 +286,6 @@ void rrc_top_cleanup(void) {
}
u16 T300[8] =
{100, 200, 300, 400, 600, 1000, 1500, 2000};
u16 T310[8] =
{0, 50, 100, 200, 500, 1000, 2000};
u16 N310[8] =
{1, 2, 3, 4, 6, 8, 10, 20};
u16 N311[8] =
{1, 2, 3, 4, 6, 8, 10, 20};
void rrc_t310_expiration(u32 frame, u8 Mod_id, u8 eNB_index) {
......@@ -319,9 +317,9 @@ void rrc_t310_expiration(u32 frame, u8 Mod_id, u8 eNB_index) {
}
}
RRC_status_t rrc_rx_tx(u8 Mod_id, u32 frame, u8 eNB_flag, u8 index) {
if (eNB_flag == 0) {
RRC_status_t rrc_rx_tx(u8 Mod_id,u32 frame, u8 eNB_flag,u8 index){
if(eNB_flag == 0) {
// check timers
if (UE_rrc_inst[Mod_id].Info[index].T300_active == 1) {
......@@ -350,7 +348,6 @@ RRC_status_t rrc_rx_tx(u8 Mod_id, u32 frame, u8 eNB_flag, u8 index) {
return RRC_PHY_RESYNCH;
}
}
if (UE_rrc_inst[Mod_id].Info[index].T310_active == 1) {
if (UE_rrc_inst[Mod_id].Info[index].N311_cnt
== N311[UE_rrc_inst[Mod_id].sib2[index]->ue_TimersAndConstants.n311]) {
......@@ -367,7 +364,93 @@ RRC_status_t rrc_rx_tx(u8 Mod_id, u32 frame, u8 eNB_flag, u8 index) {
}
UE_rrc_inst[Mod_id].Info[index].T310_cnt++;
}
}
if (UE_rrc_inst[Mod_id].Info[index].T304_active==1) {
if ((UE_rrc_inst[Mod_id].Info[index].T304_cnt % 10) == 0)
LOG_D(RRC,"[UE %d][RAPROC] Frame %d T304 Count %d ms\n",Mod_id,frame,
UE_rrc_inst[Mod_id].Info[index].T304_cnt);
if (UE_rrc_inst[Mod_id].Info[index].T304_cnt == 0) {
UE_rrc_inst[Mod_id].Info[index].T304_active = 0;
UE_rrc_inst[Mod_id].HandoverInfoUe.measFlag = 1;
LOG_E(RRC,"[UE %d] Handover failure..initiating connection re-establishment procedure... \n");
//Implement 36.331, section 5.3.5.6 here
return(RRC_Handover_failed);
}
UE_rrc_inst[Mod_id].Info[index].T304_cnt--;
}
// Layer 3 filtering of RRC measurements
if (UE_rrc_inst[Mod_id].QuantityConfig[0] != NULL) {
ue_meas_filtering(Mod_id,frame,index);
}
ue_measurement_report_triggering(Mod_id,frame,index);
if (UE_rrc_inst[Mod_id].Info[0].handoverTarget > 0)
LOG_I(RRC,"[UE %d] Frame %d : RRC handover initiated\n", Mod_id, frame);
if((UE_rrc_inst[Mod_id].Info[index].State == RRC_HO_EXECUTION) &&
(UE_rrc_inst[Mod_id].HandoverInfoUe.targetCellId != 0xFF)) {
UE_rrc_inst[Mod_id].Info[index].State= RRC_IDLE;
return(RRC_HO_STARTED);
}
}
else {
check_handovers(Mod_id,frame);
}
return (RRC_OK);
}
long binary_search_int(int elements[], long numElem, int value) {
long first, last, middle, search;
first = 0;
last = numElem-1;
middle = (first+last)/2;
if(value < elements[0])
return first;
if(value > elements[last])
return last;
while (first <= last) {
if (elements[middle] < value)
first = middle+1;
else if (elements[middle] == value) {
search = middle+1;
break;
}
else
last = middle -1;
middle = (first+last)/2;
}
if (first > last)
LOG_E(RRC,"Error in binary search!");
return search;
}
/* This is a binary search routine which operates on an array of floating
point numbers and returns the index of the range the value lies in
Used for RSRP and RSRQ measurement mapping. Can potentially be used for other things
*/
long binary_search_float(float elements[], long numElem, float value) {
long first, last, middle, search;
first = 0;
last = numElem-1;
middle = (first+last)/2;
if(value <= elements[0])
return first;
if(value >= elements[last])
return last;
while (last - first > 1) {
if (elements[middle] > value)
last = middle;
else
first = middle;
middle = (first+last)/2;
}
if (first < 0 || first >= numElem)
LOG_E(RRC,"\n Error in binary search float!");
return first;
}
This source diff could not be displayed because it is too large. You can view the blob instead.
/*________________________openair_rrc_vars.h________________________
/*******************************************************************************
Authors : Hicham Anouar
Company : EURECOM
Emails : anouar@eurecom.fr
________________________________________________________________*/
Eurecom OpenAirInterface 2
Copyright(c) 1999 - 2010 Eurecom
This program is free software; you can redistribute it and/or modify it
under the terms and conditions of the GNU General Public License,
version 2, as published by the Free Software Foundation.
This program is distributed in the hope it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
The full GNU General Public License is included in this distribution in
the file called "COPYING".
Contact Information
Openair Admin: openair_admin@eurecom.fr
Openair Tech : openair_tech@eurecom.fr
Forums : http://forums.eurecom.fsr/openairinterface
Address : Eurecom, 2229, route des crêtes, 06560 Valbonne Sophia Antipolis, France
*******************************************************************************/
/*! \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_RRC_VARS_H__
......@@ -38,6 +69,8 @@ unsigned short Header_read_idx,Data_read_idx,Header_size;
unsigned short Data_to_read;
#endif //NO_RRM
#define MAX_U32 0xFFFFFFFF
u8 DRB2LCHAN[8];
long logicalChannelGroup0 = 0;
......@@ -66,7 +99,7 @@ LogicalChannelConfig_t SRB2_logicalChannelConfig_defaultValue = {&LCSRB2
,
&logicalChannelSR_Mask_r9
#endif
};
};
//CONSTANTS
rlc_info_t Rlc_info_um,Rlc_info_am_config;
......@@ -75,4 +108,152 @@ u16 RACH_FREQ_ALLOC;
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
u16 T300[8] = {100,200,300,400,600,1000,1500,2000};
u16 T310[8] = {0,50,100,200,500,1000,2000};
u16 N310[8] = {1,2,3,4,6,8,10,20};
u16 N311[8] = {1,2,3,4,6,8,10,20};
u32 T304[8] = {50,100,150,200,500,1000,2000,MAX_U32};
// TimeToTrigger enum mapping table (36.331 TimeToTrigger IE)
u32 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[100] = {
-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
};
float RSRQ_meas_mapping[33] = {
-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
};
#endif
......@@ -661,6 +661,7 @@ The following diagram is based on graphviz (http://www.graphviz.org/), you need
unsigned char vcd_enabled;
unsigned char eMBMS_active_state;
unsigned char cba_group_active;
unsigned char handover_active;
char * otg_traffic;
unsigned char otg_bg_traffic_enabled;
unsigned char omg_model_rn;
......
......@@ -1109,7 +1109,8 @@ int main(int argc, char **argv)
//print [MAC][I]... messages
//l2_init(frame_parms,eMBMS_active);
l2_init(frame_parms,eMBMS_active,
0); // cba_group_active
0,// cba_group_active
0); // HO flag
if (UE_flag == 1)
mac_xface->dl_phy_sync_success (0, 0, 0, 1);
else
......
......@@ -63,6 +63,7 @@
#include "PHY/vars.h"
#include "MAC_INTERFACE/vars.h"
//#include "SCHED/defs.h"
#include "SCHED/vars.h"
#include "LAYER2/MAC/vars.h"
......@@ -1253,8 +1254,8 @@ int main(int argc, char **argv) {
}
PHY_vars_UE_g[0]->tx_power_max_dBm = tx_max_power;
printf("tx_max_power = %d -> amp %d\n",tx_max_power,get_tx_amp(tx_max_power,tx_max_power));
// printf("tx_max_power = %d -> amp %d\n",tx_max_power,get_tx_amp(tx_max_power,tx_max_power));
}
else { //this is eNB
g_log->log_component[HW].level = LOG_DEBUG;
......@@ -1394,7 +1395,8 @@ int main(int argc, char **argv) {
#ifdef OPENAIR2
int eMBMS_active=0;
l2_init(frame_parms,eMBMS_active,
0); // cba_group_active
0,// cba_group_active
0); // HO flag
if (UE_flag == 1)
mac_xface->dl_phy_sync_success (0, 0, 0, 1);
else
......
#!/usr/bin/env python
# svn merge-tool python wrapper for meld
# to use: edit ~/.subversion/config and uncomment the line merge-tool-cmd =
# and set the path to your command
# Note that when a conflict occurs, you will be prompted what to do with it. You need to type a single 'l' and for svn to run this script. When you've finished your merge, you need to type an 'r' to resolve the conflict and copy the merged version to the working copy.
import os, sys
import subprocess
import shutil
try:
# path to meld
meld = "/usr/bin/meld"
print "Set the file paths for mine, theirs, and merged\n"
print "When you've finished your merge, you need to type an 'r' to resolve the conflict and copy the merged version to the working copy\n"
# the base or "left" revision version of the file you're merging with
base = sys.argv[1]
# this is "later" or "right"revision version of the file you're merging with
theirs = sys.argv[2]
# this is my version, recommandations: sync your copy to the latest version
mine = sys.argv[3]
#this starts out as a copy of 'mine' (your working copy), and this is where you want the final results of the merge to end up.
merged = sys.argv[4]
print "Calling meld: the order of the files is (merged, theirs, and mine)"
# all 4 versions: worke right-to-left, reslut being stored in the left file
# cmd = [meld, mine, base, theirs, merged]
# only 3 versions
cmd = [meld, merged, theirs, mine]
# Call meld, making sure it exits correctly
subprocess.check_call(cmd)
except:
print "Oh, an error!\n"
sys.exit(-1)
......@@ -150,27 +150,28 @@ int otg_enabled;
#endif
// this should reflect the channel models in openair1/SIMULATION/TOOLS/defs.h
mapping small_scale_names[] =
{
{"custom", custom},
{"SCM_A", SCM_A},
{"SCM_B", SCM_B},
{"SCM_C", SCM_C},
{"SCM_D", SCM_D},
{"EPA", EPA},
{"EVA", EVA},
{"ETU", ETU},
{"Rayleigh8", Rayleigh8},
{"Rayleigh1", Rayleigh1},
{"Rayleigh1_800", Rayleigh1_800},
{"Rayleigh1_corr", Rayleigh1_corr},
{"Rayleigh1_anticorr", Rayleigh1_anticorr},
{"Rice8", Rice8},
{"Rice1", Rice1},
{"Rice1_corr", Rice1_corr},
{"Rice1_anticorr", Rice1_anticorr},
{"AWGN", AWGN},
{NULL, -1}};
mapping small_scale_names[] = {
{"custom", custom},
{"SCM_A", SCM_A},
{"SCM_B", SCM_B},
{"SCM_C", SCM_C},
{"SCM_D", SCM_D},
{"EPA", EPA},
{"EVA", EVA},
{"ETU", ETU},
{"MBSFN", MBSFN},
{"Rayleigh8", Rayleigh8},
{"Rayleigh1", Rayleigh1},
{"Rayleigh1_800", Rayleigh1_800},
{"Rayleigh1_corr", Rayleigh1_corr},
{"Rayleigh1_anticorr", Rayleigh1_anticorr},
{"Rice8", Rice8},
{"Rice1", Rice1},
{"Rice1_corr", Rice1_corr},
{"Rice1_anticorr", Rice1_anticorr},
{"AWGN", AWGN},
{NULL, -1}
};
//static void *sigh(void *arg);
void terminate(void);
......@@ -194,6 +195,7 @@ void help(void) {
printf ("-F Activates FDD transmission (TDD is default)\n");
printf ("-g Set multicast group ID (0,1,2,3) - valid if M is set\n");
printf ("-G Enable background traffic \n");
printf ("-H Enable handover operation (default disabled) \n");
printf ("-I Enable CLI interface (to connect use telnet localhost 1352)\n");
printf ("-k Set the Ricean factor (linear)\n");
printf ("-l Set the global log level (8:trace, 7:debug, 6:info, 4:warn, 3:error) \n");
......
......@@ -325,12 +325,15 @@ void init_oai_emulation() {
oai_emulation.info.vcd_enabled=0;
oai_emulation.info.cba_group_active=0;
oai_emulation.info.eMBMS_active_state=0;
oai_emulation.info.handover_active=0;
oai_emulation.info.omg_model_enb=STATIC; //default to static mobility model
oai_emulation.info.omg_model_rn=STATIC; //default to static mobility model
oai_emulation.info.omg_model_ue=STATIC; //default to static mobility model
oai_emulation.info.omg_model_ue_current=STATIC; //default to static mobility model
oai_emulation.info.otg_traffic="no_predefined_traffic";
oai_emulation.info.otg_bg_traffic_enabled = 0; // G flag
oai_emulation.info.max_predefined_traffic_config_index = 0;
oai_emulation.info.max_customized_traffic_config_index = 0;
oai_emulation.info.frame = 0; // frame counter of emulation
oai_emulation.info.time_s = 0; // time of emulation
oai_emulation.info.time_ms = 0; // time of emulation
......@@ -664,6 +667,7 @@ int ocg_config_app(){
init_seeds(g_otg->seed); // initialize all the nodes, then configure the nodes the user specifically did in the XML in the following
LOG_I(OTG,"oai_emulation.info.max_predefined_traffic_config_index = %d\n", oai_emulation.info.max_predefined_traffic_config_index);
LOG_I(OTG,"oai_emulation.info.max_customized_traffic_config_index = %d\n", oai_emulation.info.max_customized_traffic_config_index);
if (oai_emulation.info.ocg_ok) {
......@@ -964,7 +968,9 @@ g_otg->application_idx[source_id_index][destination_id_index]+=1;
}
}
}
if ( oai_emulation.info.otg_enabled==1){ // OCG not used, but -T option is used, so config here
if ((oai_emulation.info.max_predefined_traffic_config_index == 0) &&
(oai_emulation.info.max_customized_traffic_config_index == 0) &&
(oai_emulation.info.otg_enabled==1)){ // OCG not used to configure OTG, but -T option is used, so config here
LOG_I(OTG,"configure OTG through options %s\n", oai_emulation.info.otg_traffic);
for (i=0; i<g_otg->num_nodes; i++){
for (j=0; j<g_otg->num_nodes; j++){
......
......@@ -114,7 +114,7 @@ void get_simulation_options(int argc, char *argv[]) {
{NULL, 0, NULL, 0}
};
while ((c = getopt_long (argc, argv, "aA:b:B:c:C:D:d:eE:f:FGg:hi:IJ:j:k:K:L:l:m:M:n:N:oO:p:P:Q:rR:s:S:t:T:u:U:vVw:W:x:X:y:Y:z:Z:", long_options, &option_index)) != -1) {
while ((c = getopt_long (argc, argv, "aA:b:B:c:C:D:d:eE:f:FGg:hHi:IJ:j:k:l:L:m:M:n:N:oO:p:P:Q:rR:s:S:t:T:u:U:vVw:W:x:X:y:Y:z:Z:", long_options, &option_index)) != -1) {
switch (c) {
case 0:
if (! strcmp(long_options[option_index].name, "pdcp_period")) {
......@@ -139,7 +139,7 @@ void get_simulation_options(int argc, char *argv[]) {
case 'C':
oai_emulation.info.tdd_config = atoi (optarg);
if (oai_emulation.info.tdd_config > 6) {
LOG_E(EMU,"Illegal tdd_config %d (should be 0-6)\n", oai_emulation.info.tdd_config);
printf("Illegal tdd_config %d (should be 0-6)\n", oai_emulation.info.tdd_config);
exit (-1);
}
break;
......@@ -152,23 +152,28 @@ void get_simulation_options(int argc, char *argv[]) {
oai_emulation.info.N_RB_DL = atoi (optarg);
if ((oai_emulation.info.N_RB_DL != 6) && (oai_emulation.info.N_RB_DL != 15) && (oai_emulation.info.N_RB_DL != 25)
&& (oai_emulation.info.N_RB_DL != 50) && (oai_emulation.info.N_RB_DL != 75) && (oai_emulation.info.N_RB_DL != 100)) {
LOG_E(EMU,"Illegal N_RB_DL %d (should be one of 6,15,25,50,75,100)\n", oai_emulation.info.N_RB_DL);
printf("Illegal N_RB_DL %d (should be one of 6,15,25,50,75,100)\n", oai_emulation.info.N_RB_DL);
exit (-1);
}
case 'N':
Nid_cell = atoi (optarg);
if (Nid_cell > 503) {
LOG_E(EMU,"Illegal Nid_cell %d (should be 0 ... 503)\n", Nid_cell);
printf("Illegal Nid_cell %d (should be 0 ... 503)\n", Nid_cell);
exit(-1);
}
break;
case 'h':
help ();
exit (1);
break;
case 'H':
oai_emulation.info.handover_active=1;
printf("Activate the handover procedure at RRC\n");
break;
case 'x':
oai_emulation.info.transmission_mode = atoi (optarg);
if ((oai_emulation.info.transmission_mode != 1) && (oai_emulation.info.transmission_mode != 2) && (oai_emulation.info.transmission_mode != 5) && (oai_emulation.info.transmission_mode != 6)) {
LOG_E(EMU, "Unsupported transmission mode %d\n",oai_emulation.info.transmission_mode);
printf("Unsupported transmission mode %d\n",oai_emulation.info.transmission_mode);
exit(-1);
}
break;
......@@ -211,7 +216,7 @@ void get_simulation_options(int argc, char *argv[]) {
break;
case 'k':
//ricean_factor = atof (optarg);
LOG_E(EMU,"[SIM] Option k is no longer supported on the command line. Please specify your channel model in the xml template\n");
printf("[SIM] Option k is no longer supported on the command line. Please specify your channel model in the xml template\n");
exit(-1);
break;
case 'K':
......@@ -219,7 +224,7 @@ void get_simulation_options(int argc, char *argv[]) {
break;
case 't':
//Td = atof (optarg);
LOG_E(EMU,"[SIM] Option t is no longer supported on the command line. Please specify your channel model in the xml template\n");
printf("[SIM] Option t is no longer supported on the command line. Please specify your channel model in the xml template\n");
exit(-1);
break;
case 'f':
......@@ -575,7 +580,7 @@ void init_openair2() {
#ifdef OPENAIR2
s32 i;
s32 UE_id;
#if defined(ENABLE_ITTI)
if (NB_eNB_INST > 0) {
if (itti_create_task (TASK_RRC_ENB, rrc_enb_task, NULL) < 0) {
......@@ -594,13 +599,12 @@ void init_openair2() {
}
#endif
l2_init (&PHY_vars_eNB_g[0]->lte_frame_parms,oai_emulation.info.eMBMS_active_state, oai_emulation.info.cba_group_active);
printf ("after L2 init: Nid_cell %d\n", PHY_vars_eNB_g[0]->lte_frame_parms.Nid_cell);
printf ("after L2 init: frame_type %d,tdd_config %d\n",
PHY_vars_eNB_g[0]->lte_frame_parms.frame_type,
PHY_vars_eNB_g[0]->lte_frame_parms.tdd_config);
l2_init (&PHY_vars_eNB_g[0]->lte_frame_parms,
oai_emulation.info.eMBMS_active_state,
oai_emulation.info.cba_group_active,
oai_emulation.info.handover_active);
for (i = 0; i < NB_eNB_INST; i++)
for (i = 0; i < NB_eNB_INST; i++)
mac_xface->mrbch_phy_sync_failure (i, 0, i);
if (abstraction_flag == 1) {
......
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