Commit 1ae40bac authored by Raymond Knopp's avatar Raymond Knopp

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@5698 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 20df6d26
......@@ -79,29 +79,33 @@ void phy_config_mib(LTE_DL_FRAME_PARMS *lte_frame_parms,
/** \brief Configure LTE_DL_FRAME_PARMS with components derived after reception of SIB1. From a PHY perspective this allows configuration of TDD framing parameters and SI reception.
@param Mod_id Instance ID of eNB
@param CC_id Component Carrier index
@param tdd_Config TDD UL/DL and S-subframe configurations
@param SIwindowsize Size of a SI window in frames where repetitions of a unique System Information message block is repeated
@param SIperiod Periodicity of System Information Messages (in multiples of a frame)*/
void phy_config_sib1_eNB(module_id_t Mod_id,
TDD_Config_t *tdd_Config,
int CC_id,
TDD_Config_t *tdd_Config,
uint8_t SIwindowsize,
uint16_t SIperiod);
/** \brief Configure LTE_DL_FRAME_PARMS with components derived after reception of SIB1. From a PHY perspective this allows configuration of TDD framing parameters and SI reception.
@param Mod_id Instance ID of UE
@param CC_id Component Carrier index
@param CH_index Index of eNB for this configuration
@param tdd_Config TDD UL/DL and S-subframe configurations
@param SIwindowsize Size of a SI window in frames where repetitions of a unique System Information message block is repeated
@param SIperiod Periodicity of System Information Messages (in multiples of a frame)*/
void phy_config_sib1_ue(module_id_t Mod_id,
uint8_t CH_index,
int CC_id,
uint8_t CH_index,
TDD_Config_t *tdd_Config,
uint8_t SIwindowsize,
uint16_t SIperiod);
/*!
\fn void phy_config_sib2_ue(module_id_t Mod_id,uint8_t CH_index,
\fn void phy_config_sib2_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t CH_index,
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
ARFCN_ValueEUTRA_t *ul_CArrierFreq,
long *ul_Bandwidth,
......@@ -109,15 +113,18 @@ void phy_config_sib1_ue(module_id_t Mod_id,
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList)
\brief Configure LTE_DL_FRAME_PARMS with components derived after reception of SIB2 (at UE).
@param Mod_id Instance id
@param CC_id
@param CH_index Index of CH to which UE is connected
@param CC_id Component Carrier Index
@param radioResourceConfigCommon Radio Configuration from SIB2
@param ul_CarrierFreq UL carrier ARFCN, null if optional (i.e. implicit from DL)
@param ul_Bandwidth UL bandwidth, null if optional (i.e. same as DL)
@param additionalSpectrumEmission UL parameter (see 36.101)
@param mbsfn_SubframeConfigList MBSFN subframe configuration
*/
void phy_config_sib2_ue(module_id_t Mod_id,
uint8_t CH_index,
void phy_config_sib2_ue(module_id_t Mod_id,
int CC_id,
uint8_t CH_index,
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
ARFCN_ValueEUTRA_t *ul_CArrierFreq,
long *ul_Bandwidth,
......@@ -129,12 +136,14 @@ void phy_config_sib2_ue(module_id_t Mod_id,
\fn phy_config_afterHO_ue
\brief Configure Common PHY parameters from mobilityControlInfo
@param Mod_id
@param CC_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(module_id_t Mod_id,
uint8_t eNB_index,
int CC_id,
uint8_t eNB_index,
MobilityControlInfo_t *mobilityControlInfo,
uint8_t ho_failed);
/*!
......@@ -146,14 +155,16 @@ void phy_config_afterHO_ue(module_id_t Mod_id,
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList)
\brief Configure LTE_DL_FRAME_PARMS with components of SIB2 (at eNB).
@param Mod_id Instance id
@param Mod_id Component Carrier index
@param radioResourceConfigCommon Radio Configuration from SIB2
@param ul_CarrierFreq UL carrier ARFCN, null if optional (i.e. implicit from DL)
@param ul_Bandwidth UL bandwidth, null if optional (i.e. same as DL)
@param additionalSpectrumEmission UL parameter (see 36.101)
@param mbsfn_SubframeConfigList MBSFN subframe configuration
*/
void phy_config_sib2_eNB(module_id_t Mod_id,
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
void phy_config_sib2_eNB(module_id_t Mod_id,
int CC_id,
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
ARFCN_ValueEUTRA_t *ul_CArrierFreq,
long *ul_Bandwidth,
AdditionalSpectrumEmission_t *additionalSpectrumEmission,
......@@ -161,59 +172,67 @@ void phy_config_sib2_eNB(module_id_t Mod_id,
/*!
\fn void phy_config_dedicated_ue(module_id_t Mod_id,uint8_t CH_index,
\fn void phy_config_dedicated_ue(module_id_t Mod_id,uint8_t CC_id,uint8_t CH_index,
struct PhysicalConfigDedicated *physicalConfigDedicated)
\brief Configure UE dedicated parameters. Invoked upon reception of RRCConnectionSetup or RRCConnectionReconfiguration from eNB.
@param Mod_id Instance ID for eNB
@param CC_id Component Carrier index
@param CH_index Index of eNB for this configuration
@param physicalConfigDedicated PHY Configuration information
*/
void phy_config_dedicated_ue(module_id_t Mod_id,
int CC_id,
uint8_t CH_index,
struct PhysicalConfigDedicated *physicalConfigDedicated);
/**
\brief Configure UE MBSFN common parameters. Invoked upon reception of SIB13 from eNB.
@param Mod_id Instance ID for UE
@param CC_id Component Carrier Index
@param CH_index eNB id (for multiple eNB reception)
@param mbsfn_Area_idx Index of MBSFN-Area for which this command operates
@param mbsfn_AreaId_r9 MBSFN-Area Id
*/
void phy_config_sib13_ue(module_id_t Mod_id,
uint8_t CH_index,int mbsfn_Area_idx,
int CC_id,uint8_t CH_index,int mbsfn_Area_idx,
long mbsfn_AreaId_r9);
/**
\brief Configure eNB MBSFN common parameters. Invoked upon transmission of SIB13 from eNB.
@param Mod_id Instance ID for eNB
@param CC_id Component Carrier index
@param mbsfn_Area_idx Index of MBSFN-Area for which this command operates
@param mbsfn_AreaId_r9 MBSFN-Area Id
*/
void phy_config_sib13_eNB(module_id_t Mod_id,
int CC_id,
int mbsfn_Area_idx,
long mbsfn_AreaId_r9);
/**
\brief Configure cba rnti for .
@param Mod_id Instance ID for eNB
@param CC_id Component Carrier Index
@param eNB_flag flag indicating whether the nodeis eNB (1) or UE (0)
@param index index of the node
@param cba_rnti rnti for the cba transmission
@param num_active_cba_groups num active cba group
*/
void phy_config_cba_rnti (module_id_t Mod_id,eNB_flag_t eNB_flag, uint8_t index, rnti_t cba_rnti, uint8_t cba_group_id, uint8_t num_active_cba_groups);
void phy_config_dedicated_ue(module_id_t Mod_id,
uint8_t CH_index,
struct PhysicalConfigDedicated *physicalConfigDedicated);
void phy_config_cba_rnti (module_id_t Mod_id,int CC_id,eNB_flag_t eNB_flag, uint8_t index, rnti_t cba_rnti, uint8_t cba_group_id, uint8_t num_active_cba_groups);
/** \brief Configure RRC inter-cell measurements procedures
@param Mod_id Index of UE
@param CC_id
@param eNB_index Index of corresponding eNB
@param n_adj_cells Number of adjacent cells on which to perform the measuremnts
@param adj_cell_id Array of cell ids of adjacent cells
*/
void phy_config_meas_ue(module_id_t Mod_id,
uint8_t eNB_index,
int CC_id,
uint8_t eNB_index,
uint8_t n_adj_cells,
uint32_t *adj_cell_id);
......@@ -222,11 +241,13 @@ void phy_config_meas_ue(module_id_t Mod_id,
struct PhysicalConfigDedicated *physicalConfigDedicated)
\brief Prepare for configuration of PHY with dedicated parameters. Invoked just prior to transmission of RRCConnectionSetup or RRCConnectionReconfiguration at eNB.
@param Mod_id Instance ID for eNB
@param CC_id Component Carrier index
@param rnti rnti for UE context
@param physicalConfigDedicated PHY Configuration information
*/
void phy_config_dedicated_eNB(module_id_t Mod_id,
rnti_t rnti,
int CC_id,
rnti_t rnti,
struct PhysicalConfigDedicated *physicalConfigDedicated);
/*!
......
......@@ -44,11 +44,12 @@ void phy_config_mib(LTE_DL_FRAME_PARMS *lte_frame_parms,
}
void phy_config_sib1_eNB(uint8_t Mod_id,
int CC_id,
TDD_Config_t *tdd_Config,
uint8_t SIwindowsize,
uint16_t SIPeriod) {
LTE_DL_FRAME_PARMS *lte_frame_parms = &PHY_vars_eNB_g[Mod_id]->lte_frame_parms;
LTE_DL_FRAME_PARMS *lte_frame_parms = &PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms;
if (tdd_Config) {
lte_frame_parms->tdd_config = tdd_Config->subframeAssignment;
......@@ -58,12 +59,13 @@ void phy_config_sib1_eNB(uint8_t Mod_id,
lte_frame_parms->SIPeriod = SIPeriod;
}
void phy_config_sib1_ue(uint8_t Mod_id,uint8_t CH_index,
TDD_Config_t *tdd_Config,
uint8_t SIwindowsize,
uint16_t SIperiod) {
void phy_config_sib1_ue(uint8_t Mod_id,int CC_id,
uint8_t CH_index,
TDD_Config_t *tdd_Config,
uint8_t SIwindowsize,
uint16_t SIperiod) {
LTE_DL_FRAME_PARMS *lte_frame_parms = &PHY_vars_UE_g[Mod_id]->lte_frame_parms;
LTE_DL_FRAME_PARMS *lte_frame_parms = &PHY_vars_UE_g[Mod_id][CC_id]->lte_frame_parms;
if (tdd_Config) {
lte_frame_parms->tdd_config = tdd_Config->subframeAssignment;
lte_frame_parms->tdd_config_S = tdd_Config->specialSubframePatterns;
......@@ -73,16 +75,17 @@ void phy_config_sib1_ue(uint8_t Mod_id,uint8_t CH_index,
}
void phy_config_sib2_eNB(uint8_t Mod_id,
int CC_id,
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
ARFCN_ValueEUTRA_t *ul_CArrierFreq,
long *ul_Bandwidth,
AdditionalSpectrumEmission_t *additionalSpectrumEmission,
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList) {
LTE_DL_FRAME_PARMS *lte_frame_parms = &PHY_vars_eNB_g[Mod_id]->lte_frame_parms;
LTE_DL_FRAME_PARMS *lte_frame_parms = &PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms;
int i;
LOG_D(PHY,"[eNB%d] Frame %d: Applying radioResourceConfigCommon\n",Mod_id,PHY_vars_eNB_g[Mod_id]->proc[8].frame_tx);
LOG_D(PHY,"[eNB%d] Frame %d: Applying radioResourceConfigCommon\n",Mod_id,PHY_vars_eNB_g[Mod_id][CC_id]->proc[8].frame_tx);
lte_frame_parms->prach_config_common.rootSequenceIndex =radioResourceConfigCommon->prach_Config.rootSequenceIndex;
lte_frame_parms->prach_config_common.prach_Config_enabled=1;
......@@ -92,7 +95,7 @@ void phy_config_sib2_eNB(uint8_t Mod_id,
lte_frame_parms->prach_config_common.prach_ConfigInfo.prach_FreqOffset =radioResourceConfigCommon->prach_Config.prach_ConfigInfo.prach_FreqOffset;
compute_prach_seq(&lte_frame_parms->prach_config_common,lte_frame_parms->frame_type,
PHY_vars_eNB_g[Mod_id]->X_u);
PHY_vars_eNB_g[Mod_id][CC_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;
......@@ -163,7 +166,7 @@ void phy_config_sib2_eNB(uint8_t Mod_id,
// PUCCH
init_ncs_cell(lte_frame_parms,PHY_vars_eNB_g[Mod_id]->ncs_cell);
init_ncs_cell(lte_frame_parms,PHY_vars_eNB_g[Mod_id][CC_id]->ncs_cell);
init_ul_hopping(lte_frame_parms);
......@@ -198,19 +201,20 @@ void phy_config_sib2_eNB(uint8_t Mod_id,
}
void phy_config_sib2_ue(uint8_t Mod_id,uint8_t CH_index,
void phy_config_sib2_ue(uint8_t Mod_id,int CC_id,
uint8_t CH_index,
RadioResourceConfigCommonSIB_t *radioResourceConfigCommon,
ARFCN_ValueEUTRA_t *ul_CarrierFreq,
long *ul_Bandwidth,
AdditionalSpectrumEmission_t *additionalSpectrumEmission,
struct MBSFN_SubframeConfigList *mbsfn_SubframeConfigList) {
LTE_DL_FRAME_PARMS *lte_frame_parms = &PHY_vars_UE_g[Mod_id]->lte_frame_parms;
LTE_DL_FRAME_PARMS *lte_frame_parms = &PHY_vars_UE_g[Mod_id][CC_id]->lte_frame_parms;
int i;
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_UE_CONFIG_SIB2, VCD_FUNCTION_IN);
LOG_I(PHY,"[UE%d] Frame %d: Applying radioResourceConfigCommon from eNB%d\n",Mod_id,PHY_vars_UE_g[Mod_id]->frame,CH_index);
LOG_I(PHY,"[UE%d] Frame %d: Applying radioResourceConfigCommon from eNB%d\n",Mod_id,PHY_vars_UE_g[Mod_id][CC_id]->frame,CH_index);
lte_frame_parms->prach_config_common.rootSequenceIndex =radioResourceConfigCommon->prach_Config.rootSequenceIndex;
......@@ -220,7 +224,8 @@ void phy_config_sib2_ue(uint8_t Mod_id,uint8_t CH_index,
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;
compute_prach_seq(&lte_frame_parms->prach_config_common,lte_frame_parms->frame_type,PHY_vars_UE_g[Mod_id]->X_u);
compute_prach_seq(&lte_frame_parms->prach_config_common,lte_frame_parms->frame_type,PHY_vars_UE_g[Mod_id][CC_id]->X_u);
lte_frame_parms->pucch_config_common.deltaPUCCH_Shift = 1+radioResourceConfigCommon->pucch_ConfigCommon.deltaPUCCH_Shift;
......@@ -274,7 +279,7 @@ lte_frame_parms->ul_power_control_config_common.deltaF_PUCCH_Format1 = radioRes
// Now configure some of the Physical Channels
// PUCCH
init_ncs_cell(lte_frame_parms,PHY_vars_UE_g[Mod_id]->ncs_cell);
init_ncs_cell(lte_frame_parms,PHY_vars_UE_g[Mod_id][CC_id]->ncs_cell);
init_ul_hopping(lte_frame_parms);
......@@ -309,38 +314,38 @@ lte_frame_parms->ul_power_control_config_common.deltaF_PUCCH_Format1 = radioRes
}
void phy_config_sib13_ue(uint8_t Mod_id,uint8_t CH_index,int mbsfn_Area_idx,
void phy_config_sib13_ue(uint8_t Mod_id,int CC_id,uint8_t CH_index,int mbsfn_Area_idx,
long mbsfn_AreaId_r9) {
LTE_DL_FRAME_PARMS *lte_frame_parms = &PHY_vars_UE_g[Mod_id]->lte_frame_parms;
LTE_DL_FRAME_PARMS *lte_frame_parms = &PHY_vars_UE_g[Mod_id][CC_id]->lte_frame_parms;
LOG_I(PHY,"[UE%d] Frame %d: Applying MBSFN_Area_id %d for index %d\n",Mod_id,PHY_vars_UE_g[Mod_id]->frame,mbsfn_AreaId_r9,mbsfn_Area_idx);
LOG_I(PHY,"[UE%d] Frame %d: Applying MBSFN_Area_id %d for index %d\n",Mod_id,PHY_vars_UE_g[Mod_id][CC_id]->frame,mbsfn_AreaId_r9,mbsfn_Area_idx);
if (mbsfn_Area_idx == 0) {
lte_frame_parms->Nid_cell_mbsfn = (uint16_t)mbsfn_AreaId_r9;
LOG_N(PHY,"Fix me: only called when mbsfn_Area_idx == 0)\n");
}
lte_gold_mbsfn(lte_frame_parms,PHY_vars_UE_g[Mod_id]->lte_gold_mbsfn_table,lte_frame_parms->Nid_cell_mbsfn);
lte_gold_mbsfn(lte_frame_parms,PHY_vars_UE_g[Mod_id][CC_id]->lte_gold_mbsfn_table,lte_frame_parms->Nid_cell_mbsfn);
}
void phy_config_sib13_eNB(uint8_t Mod_id,int mbsfn_Area_idx,
void phy_config_sib13_eNB(uint8_t Mod_id,int CC_id,int mbsfn_Area_idx,
long mbsfn_AreaId_r9) {
LTE_DL_FRAME_PARMS *lte_frame_parms = &PHY_vars_eNB_g[Mod_id]->lte_frame_parms;
LTE_DL_FRAME_PARMS *lte_frame_parms = &PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms;
LOG_I(PHY,"[eNB%d] Frame %d: Applying MBSFN_Area_id %d for index %d\n",Mod_id,PHY_vars_eNB_g[Mod_id]->proc[8].frame_tx,mbsfn_AreaId_r9,mbsfn_Area_idx);
LOG_I(PHY,"[eNB%d] Frame %d: Applying MBSFN_Area_id %d for index %d\n",Mod_id,PHY_vars_eNB_g[Mod_id][CC_id]->proc[8].frame_tx,mbsfn_AreaId_r9,mbsfn_Area_idx);
if (mbsfn_Area_idx == 0) {
lte_frame_parms->Nid_cell_mbsfn = (uint16_t)mbsfn_AreaId_r9;
LOG_N(PHY,"Fix me: only called when mbsfn_Area_idx == 0)\n");
}
lte_gold_mbsfn(lte_frame_parms,PHY_vars_eNB_g[Mod_id]->lte_gold_mbsfn_table,lte_frame_parms->Nid_cell_mbsfn);
lte_gold_mbsfn(lte_frame_parms,PHY_vars_eNB_g[Mod_id][CC_id]->lte_gold_mbsfn_table,lte_frame_parms->Nid_cell_mbsfn);
}
......@@ -439,24 +444,24 @@ 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(uint8_t Mod_id,uint8_t eNB_id, MobilityControlInfo_t *mobilityControlInfo, uint8_t ho_failed) {
void phy_config_afterHO_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_id, MobilityControlInfo_t *mobilityControlInfo, uint8_t 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,
memcpy((void *)&PHY_vars_UE_g[Mod_id][CC_id]->lte_frame_parms_before_ho,
(void *)&PHY_vars_UE_g[Mod_id][CC_id]->lte_frame_parms,
sizeof(LTE_DL_FRAME_PARMS));
PHY_vars_UE_g[Mod_id]->ho_triggered = 1;
PHY_vars_UE_g[Mod_id][CC_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;
LTE_DL_FRAME_PARMS *lte_frame_parms = &PHY_vars_UE_g[Mod_id][CC_id]->lte_frame_parms;
// int N_ZC;
// uint8_t 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);
Mod_id,PHY_vars_UE_g[Mod_id][CC_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;
......@@ -471,9 +476,9 @@ void phy_config_afterHO_ue(uint8_t Mod_id,uint8_t eNB_id, MobilityControlInfo_t
// 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,
compute_prach_seq(&PHY_vars_UE_g[Mod_id][CC_id]->lte_frame_parms.prach_config_common,
lte_frame_parms->frame_type,
PHY_vars_UE_g[Mod_id]->X_u);
PHY_vars_UE_g[Mod_id][CC_id]->X_u);
lte_frame_parms->pucch_config_common.deltaPUCCH_Shift = 1+radioResourceConfigCommon->pucch_ConfigCommon->deltaPUCCH_Shift;
......@@ -533,41 +538,43 @@ void phy_config_afterHO_ue(uint8_t Mod_id,uint8_t eNB_id, MobilityControlInfo_t
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_ncs_cell(lte_frame_parms,PHY_vars_UE_g[Mod_id][CC_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);
PHY_vars_UE_g[Mod_id][CC_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;
memcpy((void *)&PHY_vars_UE_g[Mod_id][CC_id]->lte_frame_parms,(void *)&PHY_vars_UE_g[Mod_id][CC_id]->lte_frame_parms_before_ho, sizeof(LTE_DL_FRAME_PARMS));
PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_id] = PRACH;
}
}
void phy_config_meas_ue(uint8_t Mod_id,uint8_t eNB_index,uint8_t n_adj_cells,unsigned int *adj_cell_id) {
void phy_config_meas_ue(uint8_t Mod_id,int CC_id,uint8_t eNB_index,uint8_t n_adj_cells,unsigned int *adj_cell_id) {
PHY_MEASUREMENTS *phy_meas = &PHY_vars_UE_g[Mod_id]->PHY_measurements;
PHY_MEASUREMENTS *phy_meas = &PHY_vars_UE_g[Mod_id][CC_id]->PHY_measurements;
int i;
LOG_I(PHY,"Configuring inter-cell measurements for %d cells, ids: \n",n_adj_cells);
for (i=0;i<n_adj_cells;i++) {
LOG_I(PHY,"%d\n",adj_cell_id[i]);
lte_gold(&PHY_vars_UE_g[Mod_id]->lte_frame_parms,PHY_vars_UE_g[Mod_id]->lte_gold_table[i+1],adj_cell_id[i]);
lte_gold(&PHY_vars_UE_g[Mod_id][CC_id]->lte_frame_parms,PHY_vars_UE_g[Mod_id][CC_id]->lte_gold_table[i+1],adj_cell_id[i]);
}
phy_meas->n_adj_cells = n_adj_cells;
memcpy((void*)phy_meas->adj_cell_id,(void *)adj_cell_id,n_adj_cells*sizeof(unsigned int));
}
void phy_config_dedicated_eNB(uint8_t Mod_id,uint16_t rnti,
void phy_config_dedicated_eNB(uint8_t Mod_id,
int CC_id,
uint16_t rnti,
struct PhysicalConfigDedicated *physicalConfigDedicated) {
PHY_VARS_eNB *phy_vars_eNB = PHY_vars_eNB_g[Mod_id];
PHY_VARS_eNB *phy_vars_eNB = PHY_vars_eNB_g[Mod_id][CC_id];
uint8_t UE_id = find_ue(rnti,phy_vars_eNB);
......@@ -582,11 +589,79 @@ void phy_config_dedicated_eNB(uint8_t Mod_id,uint16_t rnti,
}
}
#ifdef Rel10
void phy_config_dedicated_scell_eNB(uint8_t Mod_id,
uint16_t rnti,
SCellToAddMod_r10_t *sCellToAddMod_r10,
int CC_id) {
PHY_VARS_eNB *phy_vars_eNB = PHY_vars_eNB_g[Mod_id][CC_id];
u8 UE_id = find_ue(rnti,PHY_vars_eNB_g[Mod_id][0]);
struct PhysicalConfigDedicatedSCell_r10 *physicalConfigDedicatedSCell_r10 = sCellToAddMod_r10->radioResourceConfigDedicatedSCell_r10->physicalConfigDedicatedSCell_r10;
//struct RadioResourceConfigCommonSCell_r10 *physicalConfigCommonSCell_r10 = sCellToAddMod_r10->radioResourceConfigCommonSCell_r10;
PhysCellId_t physCellId_r10 = sCellToAddMod_r10->cellIdentification_r10->physCellId_r10;
ARFCN_ValueEUTRA_t dl_CarrierFreq_r10 = sCellToAddMod_r10->cellIdentification_r10->dl_CarrierFreq_r10;
u32 carrier_freq_local;
#ifdef EXMIMO
#ifdef DRIVER2013
exmimo_config_t *p_exmimo_config = openair0_exmimo_pci[card].exmimo_config_ptr;
#endif
#endif
if ((dl_CarrierFreq_r10>=36000) && (dl_CarrierFreq_r10<=36199)) {
carrier_freq_local = 1900000000 + (dl_CarrierFreq_r10-36000)*100000; //band 33 from 3GPP 36.101 v 10.9 Table 5.7.3-1
LOG_I(PHY,"[eNB %d] Frame %d: Configured SCell %d to frequency %d (ARFCN %d) for UE %d\n",Mod_id,phy_vars_eNB->frame,CC_id,carrier_freq_local,dl_CarrierFreq_r10,UE_id);
#ifdef EXMIMO
#ifdef DRIVER2013
carrier_freq[CC_id] = carrier_freq_local;
openair_daq_vars.freq_offset = -6540;
p_exmimo_config->rf.rf_freq_rx[CC_id] = carrier_freq[CC_id]+openair_daq_vars.freq_offset2;
p_exmimo_config->rf.rf_freq_tx[CC_id] = carrier_freq[CC_id]+openair_daq_vars.freq_offset2;
p_exmimo_config->rf.tx_gain[CC_id][0] = 25;
p_exmimo_config->rf.rf_vcocal[CC_id] = 910;
p_exmimo_config->rf.rf_local[CC_id] = 8255063; //this should be taken form calibration file
p_exmimo_config->rf.rffe_band_mode[CC_id] = B19G_TDD;
#endif
#endif
}
else if ((dl_CarrierFreq_r10>=6150) && (dl_CarrierFreq_r10<=6449)) {
carrier_freq_local = 832000000 + (dl_CarrierFreq_r10-6150)*100000; //band 20 from 3GPP 36.101 v 10.9 Table 5.7.3-1
// this is actually for the UL only, but we use it for DL too, since there is no TDD mode for this band
LOG_I(PHY,"[eNB %d] Frame %d: Configured SCell %d to frequency %d (ARFCN %d) for UE %d\n",Mod_id,phy_vars_eNB->frame,CC_id,carrier_freq_local,dl_CarrierFreq_r10,UE_id);
#ifdef EXMIMO
#ifdef DRIVER2013
carrier_freq[CC_id] = carrier_freq_local;
openair_daq_vars.freq_offset = -2000;
p_exmimo_config->rf.rf_freq_rx[CC_id] = carrier_freq[CC_id]+openair_daq_vars.freq_offset2;
p_exmimo_config->rf.rf_freq_tx[CC_id] = carrier_freq[CC_id]+openair_daq_vars.freq_offset2;
p_exmimo_config->rf.tx_gain[CC_id][0] = 10;
p_exmimo_config->rf.rf_vcocal[CC_id] = 2015;
p_exmimo_config->rf.rf_local[CC_id] = 8254992; //this should be taken form calibration file
p_exmimo_config->rf.rffe_band_mode[CC_id] = DD_TDD;
#endif
#endif
}
else {
LOG_E(PHY,"[eNB %d] Frame %d: ARFCN %d of SCell %d for UE %d not supported\n",Mod_id,phy_vars_eNB->frame,dl_CarrierFreq_r10,CC_id,UE_id);
}
if (physicalConfigDedicatedSCell_r10) {
phy_vars_eNB->physicalConfigDedicatedSCell_r10[UE_id] = physicalConfigDedicatedSCell_r10;
LOG_I(PHY,"[eNB %d] Frame %d: Configured phyConfigDedicatedSCell with CC_id %d for UE %d\n",Mod_id,phy_vars_eNB->frame,CC_id,UE_id);
}
else {
LOG_E(PHY,"[eNB %d] Frame %d: Received NULL radioResourceConfigDedicated (CC_id %d, UE %d)\n",Mod_id, phy_vars_eNB->frame,CC_id,UE_id);
return;
}
}
#endif
void phy_config_dedicated_ue(uint8_t Mod_id,uint8_t CH_index,
void phy_config_dedicated_ue(uint8_t Mod_id,int CC_id,uint8_t CH_index,
struct PhysicalConfigDedicated *physicalConfigDedicated ) {
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id];
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
phy_vars_ue->total_TBS[CH_index]=0;
phy_vars_ue->total_TBS_last[CH_index]=0;
......@@ -692,18 +767,18 @@ void phy_config_dedicated_ue(uint8_t Mod_id,uint8_t CH_index,
}
void phy_config_cba_rnti (module_id_t Mod_id,eNB_flag_t eNB_flag, uint8_t index, rnti_t cba_rnti, uint8_t cba_group_id, uint8_t num_active_cba_groups){
void phy_config_cba_rnti (module_id_t Mod_id,int CC_id,eNB_flag_t eNB_flag, uint8_t index, rnti_t cba_rnti, uint8_t cba_group_id, uint8_t num_active_cba_groups){
// uint8_t i;
if (eNB_flag == 0 ) {
//LOG_D(PHY,"[UE %d] configure cba group %d with rnti %x, num active cba grp %d\n", index, index, cba_rnti, num_active_cba_groups);
PHY_vars_UE_g[Mod_id]->ulsch_ue[index]->num_active_cba_groups=num_active_cba_groups;
PHY_vars_UE_g[Mod_id]->ulsch_ue[index]->cba_rnti[cba_group_id]=cba_rnti;
PHY_vars_UE_g[Mod_id][CC_id]->ulsch_ue[index]->num_active_cba_groups=num_active_cba_groups;
PHY_vars_UE_g[Mod_id][CC_id]->ulsch_ue[index]->cba_rnti[cba_group_id]=cba_rnti;
}else {
//for (i=index; i < NUMBER_OF_UE_MAX; i+=num_active_cba_groups){
// LOG_D(PHY,"[eNB %d] configure cba group %d with rnti %x for UE %d, num active cba grp %d\n",Mod_id, i%num_active_cba_groups, cba_rnti, i, num_active_cba_groups);
PHY_vars_eNB_g[Mod_id]->ulsch_eNB[index]->num_active_cba_groups=num_active_cba_groups;
PHY_vars_eNB_g[Mod_id]->ulsch_eNB[index]->cba_rnti[cba_group_id] = cba_rnti;
PHY_vars_eNB_g[Mod_id][CC_id]->ulsch_eNB[index]->num_active_cba_groups=num_active_cba_groups;
PHY_vars_eNB_g[Mod_id][CC_id]->ulsch_eNB[index]->cba_rnti[cba_group_id] = cba_rnti;
//}
}
}
......
......@@ -155,14 +155,14 @@ void lte_ue_measurements_emul(PHY_VARS_UE *phy_vars_ue,uint8_t last_slot,uint8_t
@param eNB_index Index of eNB on which to act
@returns Path loss in dB
*/
int16_t get_PL(module_id_t Mod_id,uint8_t eNB_index);
uint8_t get_RSRP(module_id_t Mod_id,uint8_t eNB_index);
uint8_t get_RSRQ(module_id_t Mod_id,uint8_t eNB_index);
uint8_t get_n_adj_cells(module_id_t Mod_id);
int8_t get_rx_total_gain_dB(module_id_t Mod_id);
int8_t get_RSSI(module_id_t Mod_id);
int8_t set_RSRP_filtered(module_id_t Mod_id,uint8_t eNB_index,float rsrp);
int8_t set_RSRQ_filtered(module_id_t Mod_id,uint8_t eNB_index,float rstq);
int16_t get_PL(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
uint8_t get_RSRP(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
uint8_t get_RSRQ(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
uint8_t get_n_adj_cells(module_id_t Mod_id,uint8_t CC_id);
int8_t get_rx_total_gain_dB(module_id_t Mod_id,uint8_t CC_id);
int8_t get_RSSI(module_id_t Mod_id,uint8_t CC_id);
int8_t set_RSRP_filtered(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp);
int8_t set_RSRQ_filtered(module_id_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rstq);
//! Automatic gain control
void phy_adjust_gain (PHY_VARS_UE *phy_vars_ue,
......
......@@ -480,12 +480,13 @@ int lte_sync_time_eNB_emul(PHY_VARS_eNB *phy_vars_eNB,
int32_t *sync_val) {
uint8_t UE_id;
uint8_t CC_id = phy_vars_eNB->CC_id;
msg("[PHY] EMUL lte_sync_time_eNB_emul eNB %d, sect_id %d\n",phy_vars_eNB->Mod_id,sect_id);
*sync_val = 0;
for (UE_id=0;UE_id<NB_UE_INST;UE_id++) {
//msg("[PHY] EMUL : eNB %d checking UE %d (PRACH %d) PL %d dB\n",phy_vars_eNB->Mod_id,UE_id,PHY_vars_UE_g[UE_id]->generate_prach,UE2eNB[UE_id][phy_vars_eNB->Mod_id]->path_loss_dB);
if ((PHY_vars_UE_g[UE_id]->generate_prach == 1) && (phy_vars_eNB->Mod_id == (UE_id % NB_eNB_INST))) {
if ((PHY_vars_UE_g[UE_id][CC_id]->generate_prach == 1) && (phy_vars_eNB->Mod_id == (UE_id % NB_eNB_INST))) {
*sync_val = 1;
return(0);
}
......
......@@ -50,9 +50,9 @@ __m128i mmtmpPMI1 __attribute__ ((aligned(16)));
__m128i mmtmpPMI2 __attribute__ ((aligned(16)));
__m128i mmtmpPMI3 __attribute__ ((aligned(16)));
int16_t get_PL(uint8_t Mod_id,uint8_t eNB_index) {
int16_t get_PL(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) {
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id];
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
int RSoffset;
LOG_D(PHY,"get_PL : Frame %d : rssi %d, eNB power %d\n", phy_vars_ue->frame,
......@@ -69,50 +69,50 @@ int16_t get_PL(uint8_t Mod_id,uint8_t eNB_index) {
}
uint8_t get_n_adj_cells (uint8_t Mod_id){
uint8_t get_n_adj_cells (uint8_t Mod_id,uint8_t CC_id){
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id];
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
if (phy_vars_ue)
return phy_vars_ue->PHY_measurements.n_adj_cells;
else
return 0;
}
int8_t get_rx_total_gain_dB (uint8_t Mod_id){
int8_t get_rx_total_gain_dB (uint8_t Mod_id,uint8_t CC_id){
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id];
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
if (phy_vars_ue)
return phy_vars_ue->rx_total_gain_dB;
else
return -1;
}
int8_t get_RSSI (uint8_t Mod_id){
int8_t get_RSSI (uint8_t Mod_id,uint8_t CC_id){
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id];
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
if (phy_vars_ue)
return phy_vars_ue->PHY_measurements.rssi;
else
return -1;
}
uint8_t get_RSRP(uint8_t Mod_id,uint8_t eNB_index) {
uint8_t get_RSRP(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) {
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id];
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
if (phy_vars_ue)
return phy_vars_ue->PHY_measurements.rsrp[eNB_index];
return 0;
}
uint8_t get_RSRQ(uint8_t Mod_id,uint8_t eNB_index) {
uint8_t get_RSRQ(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) {
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id];
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
if (phy_vars_ue)
return phy_vars_ue->PHY_measurements.rsrq[eNB_index];
return 0;
}
int8_t set_RSRP_filtered(uint8_t Mod_id,uint8_t eNB_index,float rsrp) {
int8_t set_RSRP_filtered(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrp) {
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id];
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
if (phy_vars_ue){
phy_vars_ue->PHY_measurements.rsrp_filtered[eNB_index]=rsrp;
return 0;
......@@ -121,9 +121,9 @@ int8_t set_RSRP_filtered(uint8_t Mod_id,uint8_t eNB_index,float rsrp) {
return -1;
}
int8_t set_RSRQ_filtered(uint8_t Mod_id,uint8_t eNB_index,float rsrq) {
int8_t set_RSRQ_filtered(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index,float rsrq) {
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id];
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
if (phy_vars_ue){
phy_vars_ue->PHY_measurements.rsrq_filtered[eNB_index]=rsrq;
return 0;
......
......@@ -1769,7 +1769,8 @@ int32_t rx_pdcch(LTE_UE_COMMON *lte_ue_common_vars,
#ifdef DEBUG_PHY
write_output("rxF_comp_d.m","rxF_c_d",&lte_ue_pdcch_vars[eNB_id]->rxdataF_comp[0][s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);
if (subframe==5)
write_output("rxF_comp_d.m","rxF_c_d",&lte_ue_pdcch_vars[eNB_id]->rxdataF_comp[0][s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,1);
#endif
#ifdef MU_RECEIVER
......@@ -1833,8 +1834,10 @@ int32_t rx_pdcch(LTE_UE_COMMON *lte_ue_common_vars,
s);
#ifdef DEBUG_PHY
if (subframe==5) {
write_output("llr8_seq.m","llr8",&lte_ue_pdcch_vars[eNB_id]->llr[s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,4);
write_output("llr16_seq.m","llr16",&lte_ue_pdcch_vars[eNB_id]->llr16[s*frame_parms->N_RB_DL*12],frame_parms->N_RB_DL*12,1,4);
}
#endif
}
else {
......@@ -2303,58 +2306,58 @@ uint8_t generate_dci_top_emul(PHY_VARS_eNB *phy_vars_eNB,
dci_alloc,
&phy_vars_eNB->lte_frame_parms,
subframe);
eNB_transport_info[phy_vars_eNB->Mod_id].cntl.cfi=num_pdcch_symbols;
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].cntl.cfi=num_pdcch_symbols;
memcpy(phy_vars_eNB->dci_alloc[subframe&1],dci_alloc,sizeof(DCI_ALLOC_t)*(num_ue_spec_dci+num_common_dci));
phy_vars_eNB->num_ue_spec_dci[subframe&1]=num_ue_spec_dci;
phy_vars_eNB->num_common_dci[subframe&1]=num_common_dci;
eNB_transport_info[phy_vars_eNB->Mod_id].num_ue_spec_dci = num_ue_spec_dci;
eNB_transport_info[phy_vars_eNB->Mod_id].num_common_dci = num_common_dci;
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].num_ue_spec_dci = num_ue_spec_dci;
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].num_common_dci = num_common_dci;
LOG_D(PHY,"[eNB %d][DCI][EMUL] num spec dci %d num comm dci %d num PMCH %d \n", phy_vars_eNB->Mod_id, num_ue_spec_dci,num_common_dci,
eNB_transport_info[phy_vars_eNB->Mod_id].num_pmch);
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].num_pmch);
if (eNB_transport_info[phy_vars_eNB->Mod_id].cntl.pmch_flag == 1 )
n_dci_dl = eNB_transport_info[phy_vars_eNB->Mod_id].num_pmch;
if (eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].cntl.pmch_flag == 1 )
n_dci_dl = eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].num_pmch;
else
n_dci_dl = 0;
for (n_dci =0 ;
n_dci < (eNB_transport_info[phy_vars_eNB->Mod_id].num_ue_spec_dci+ eNB_transport_info[phy_vars_eNB->Mod_id].num_common_dci);
n_dci < (eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].num_ue_spec_dci+ eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].num_common_dci);
n_dci++) {
if (dci_alloc[n_dci].format > 0){ // exclude the uplink dci
if (dci_alloc[n_dci].rnti == SI_RNTI) {
dlsch_eNB = PHY_vars_eNB_g[phy_vars_eNB->Mod_id]->dlsch_eNB_SI;
eNB_transport_info[phy_vars_eNB->Mod_id].dlsch_type[n_dci_dl] = 0;//SI;
eNB_transport_info[phy_vars_eNB->Mod_id].harq_pid[n_dci_dl] = 0;
eNB_transport_info[phy_vars_eNB->Mod_id].tbs[n_dci_dl] = dlsch_eNB->harq_processes[0]->TBS>>3;
LOG_D(PHY,"[DCI][EMUL]SI tbs is %d and dci index %d harq pid is %d \n",eNB_transport_info[phy_vars_eNB->Mod_id].tbs[n_dci_dl],n_dci_dl, eNB_transport_info[phy_vars_eNB->Mod_id].harq_pid[n_dci_dl]);
dlsch_eNB = PHY_vars_eNB_g[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id]->dlsch_eNB_SI;
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].dlsch_type[n_dci_dl] = 0;//SI;
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].harq_pid[n_dci_dl] = 0;
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].tbs[n_dci_dl] = dlsch_eNB->harq_processes[0]->TBS>>3;
LOG_D(PHY,"[DCI][EMUL]SI tbs is %d and dci index %d harq pid is %d \n",eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].tbs[n_dci_dl],n_dci_dl, eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].harq_pid[n_dci_dl]);
}
else if (dci_alloc[n_dci_dl].ra_flag == 1) {
dlsch_eNB = PHY_vars_eNB_g[phy_vars_eNB->Mod_id]->dlsch_eNB_ra;
eNB_transport_info[phy_vars_eNB->Mod_id].dlsch_type[n_dci_dl] = 1;//RA;
eNB_transport_info[phy_vars_eNB->Mod_id].harq_pid[n_dci_dl] = 0;
eNB_transport_info[phy_vars_eNB->Mod_id].tbs[n_dci_dl] = dlsch_eNB->harq_processes[0]->TBS>>3;
LOG_D(PHY,"[DCI][EMUL] RA tbs is %d and dci index %d harq pid is %d \n",eNB_transport_info[phy_vars_eNB->Mod_id].tbs[n_dci_dl],n_dci_dl, eNB_transport_info[phy_vars_eNB->Mod_id].harq_pid[n_dci_dl]);
dlsch_eNB = PHY_vars_eNB_g[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id]->dlsch_eNB_ra;
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].dlsch_type[n_dci_dl] = 1;//RA;
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].harq_pid[n_dci_dl] = 0;
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].tbs[n_dci_dl] = dlsch_eNB->harq_processes[0]->TBS>>3;
LOG_D(PHY,"[DCI][EMUL] RA tbs is %d and dci index %d harq pid is %d \n",eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].tbs[n_dci_dl],n_dci_dl, eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].harq_pid[n_dci_dl]);
}
else {
ue_id = find_ue(dci_alloc[n_dci_dl].rnti,PHY_vars_eNB_g[phy_vars_eNB->Mod_id]);
dlsch_eNB = PHY_vars_eNB_g[phy_vars_eNB->Mod_id]->dlsch_eNB[ue_id][0];
ue_id = find_ue(dci_alloc[n_dci_dl].rnti,PHY_vars_eNB_g[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id]);
dlsch_eNB = PHY_vars_eNB_g[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id]->dlsch_eNB[ue_id][0];
eNB_transport_info[phy_vars_eNB->Mod_id].dlsch_type[n_dci_dl] = 2;//TB0;
eNB_transport_info[phy_vars_eNB->Mod_id].harq_pid[n_dci_dl] = dlsch_eNB->current_harq_pid;
eNB_transport_info[phy_vars_eNB->Mod_id].ue_id[n_dci_dl] = ue_id;
eNB_transport_info[phy_vars_eNB->Mod_id].tbs[n_dci_dl] = dlsch_eNB->harq_processes[dlsch_eNB->current_harq_pid]->TBS>>3;
LOG_D(PHY,"[DCI][EMUL] TB1 tbs is %d and dci index %d harq pid is %d \n",eNB_transport_info[phy_vars_eNB->Mod_id].tbs[n_dci_dl],n_dci_dl, eNB_transport_info[phy_vars_eNB->Mod_id].harq_pid[n_dci_dl]);
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].dlsch_type[n_dci_dl] = 2;//TB0;
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].harq_pid[n_dci_dl] = dlsch_eNB->current_harq_pid;
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].ue_id[n_dci_dl] = ue_id;
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].tbs[n_dci_dl] = dlsch_eNB->harq_processes[dlsch_eNB->current_harq_pid]->TBS>>3;
LOG_D(PHY,"[DCI][EMUL] TB1 tbs is %d and dci index %d harq pid is %d \n",eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].tbs[n_dci_dl],n_dci_dl, eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].harq_pid[n_dci_dl]);
// check for TB1 later
}
}
n_dci_dl++;
}
memcpy((void *)&eNB_transport_info[phy_vars_eNB->Mod_id].dci_alloc,
memcpy((void *)&eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].dci_alloc,
(void *)dci_alloc,
n_dci*sizeof(DCI_ALLOC_t));
......@@ -2464,10 +2467,10 @@ uint16_t get_nquad(uint8_t num_pdcch_symbols,LTE_DL_FRAME_PARMS *frame_parms,uin
return(Nreg - 4 - (3*Ngroup_PHICH));
}
uint16_t get_nCCE_max(uint8_t Mod_id) {
uint16_t get_nCCE_max(uint8_t Mod_id,uint8_t CC_id) {
// check for eNB only !
return(get_nCCE(3,&PHY_vars_eNB_g[Mod_id]->lte_frame_parms,1)); // 5, 15,21
return(get_nCCE(3,&PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms,1)); // 5, 15,21
}
void dci_decoding_procedure0(LTE_UE_PDCCH **lte_ue_pdcch_vars,int do_common,uint8_t subframe,
......
......@@ -529,9 +529,9 @@ uint8_t get_transmission_mode(uint16_t Mod_id, uint16_t rnti) {
unsigned char UE_id;
// find the UE_index corresponding to rnti
UE_id = find_ue(rnti,PHY_vars_eNB_g[Mod_id]);
UE_id = find_ue(rnti,PHY_vars_eNB_g[Mod_id][0]);
return(PHY_vars_eNB_g[Mod_id]->transmission_mode[UE_id]);
return(PHY_vars_eNB_g[Mod_id][0]->transmission_mode[UE_id]);
}
int generate_eNB_dlsch_params_from_dci(uint8_t subframe,
......
......@@ -398,12 +398,12 @@ void dlsch_encoding_emul(PHY_VARS_eNB *phy_vars_eNB,
LOG_T(PHY,"%x.",DLSCH_pdu[i]);
LOG_T(PHY,"\n");
memcpy(&eNB_transport_info[phy_vars_eNB->Mod_id].transport_blocks[eNB_transport_info_TB_index[phy_vars_eNB->Mod_id]],
memcpy(&eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].transport_blocks[eNB_transport_info_TB_index[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id]],
// memcpy(&eNB_transport_info[phy_vars_eNB->Mod_id].transport_blocks[payload_offset],
DLSCH_pdu,
dlsch->harq_processes[harq_pid]->TBS>>3);
}
eNB_transport_info_TB_index[phy_vars_eNB->Mod_id]+=dlsch->harq_processes[harq_pid]->TBS>>3;
eNB_transport_info_TB_index[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id]+=dlsch->harq_processes[harq_pid]->TBS>>3;
//payload_offset +=dlsch->harq_processes[harq_pid]->TBS>>3;
}
......
......@@ -617,10 +617,11 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
#ifdef DEBUG_DLSCH_DECODING
uint16_t i;
#endif
uint8_t CC_id = phy_vars_ue->CC_id;
// may not be necessary for PMCH??
for (eNB_id2=0;eNB_id2<NB_eNB_INST;eNB_id2++) {
if (PHY_vars_eNB_g[eNB_id2]->lte_frame_parms.Nid_cell == phy_vars_ue->lte_frame_parms.Nid_cell)
if (PHY_vars_eNB_g[eNB_id2][CC_id]->lte_frame_parms.Nid_cell == phy_vars_ue->lte_frame_parms.Nid_cell)
break;
}
if (eNB_id2==NB_eNB_INST) {
......@@ -636,7 +637,7 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
switch (dlsch_id) {
case 0: // SI
dlsch_ue = phy_vars_ue->dlsch_ue_SI[eNB_id];
dlsch_eNB = PHY_vars_eNB_g[eNB_id2]->dlsch_eNB_SI;
dlsch_eNB = PHY_vars_eNB_g[eNB_id2][CC_id]->dlsch_eNB_SI;
// msg("Doing SI: TBS %d\n",dlsch_ue->harq_processes[0]->TBS>>3);
memcpy(dlsch_ue->harq_processes[0]->b,dlsch_eNB->harq_processes[0]->b,dlsch_ue->harq_processes[0]->TBS>>3);
#ifdef DEBUG_DLSCH_DECODING
......@@ -649,7 +650,7 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
break;
case 1: // RA
dlsch_ue = phy_vars_ue->dlsch_ue_ra[eNB_id];
dlsch_eNB = PHY_vars_eNB_g[eNB_id2]->dlsch_eNB_ra;
dlsch_eNB = PHY_vars_eNB_g[eNB_id2][CC_id]->dlsch_eNB_ra;
memcpy(dlsch_ue->harq_processes[0]->b,dlsch_eNB->harq_processes[0]->b,dlsch_ue->harq_processes[0]->TBS>>3);
#ifdef DEBUG_DLSCH_DECODING
LOG_D(PHY,"RA Decoded\n");
......@@ -662,8 +663,8 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
case 2: // TB0
dlsch_ue = phy_vars_ue->dlsch_ue[eNB_id][0];
harq_pid = dlsch_ue->current_harq_pid;
ue_id= (uint32_t)find_ue((int16_t)phy_vars_ue->lte_ue_pdcch_vars[(uint32_t)eNB_id]->crnti,PHY_vars_eNB_g[eNB_id2]);
dlsch_eNB = PHY_vars_eNB_g[eNB_id2]->dlsch_eNB[ue_id][0];
ue_id= (uint32_t)find_ue((int16_t)phy_vars_ue->lte_ue_pdcch_vars[(uint32_t)eNB_id]->crnti,PHY_vars_eNB_g[eNB_id2][CC_id]);
dlsch_eNB = PHY_vars_eNB_g[eNB_id2][CC_id]->dlsch_eNB[ue_id][0];
#ifdef DEBUG_DLSCH_DECODING
for (i=0;i<dlsch_ue->harq_processes[harq_pid]->TBS>>3;i++)
......@@ -675,7 +676,7 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
phy_vars_ue->transmission_mode[eNB_id],
dlsch_eNB->rb_alloc,
dlsch_eNB->harq_processes[harq_pid]->mcs,
PHY_vars_eNB_g[eNB_id]->mu_mimo_mode[ue_id].dl_pow_off) == 1) {
PHY_vars_eNB_g[eNB_id][CC_id]->mu_mimo_mode[ue_id].dl_pow_off) == 1) {
// reset HARQ
dlsch_ue->harq_processes[harq_pid]->status = SCH_IDLE;
dlsch_ue->harq_processes[harq_pid]->round = 0;
......@@ -702,8 +703,8 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
case 3: // TB1
dlsch_ue = phy_vars_ue->dlsch_ue[eNB_id][1];
harq_pid = dlsch_ue->current_harq_pid;
dlsch_eNB = PHY_vars_eNB_g[eNB_id2]->dlsch_eNB[(uint32_t)find_ue((int16_t)phy_vars_ue->lte_ue_pdcch_vars[(uint32_t)eNB_id]->crnti,
PHY_vars_eNB_g[eNB_id2])][1];
dlsch_eNB = PHY_vars_eNB_g[eNB_id2][CC_id]->dlsch_eNB[(uint32_t)find_ue((int16_t)phy_vars_ue->lte_ue_pdcch_vars[(uint32_t)eNB_id]->crnti,
PHY_vars_eNB_g[eNB_id2][CC_id])][1];
// reset HARQ
dlsch_ue->harq_processes[harq_pid]->status = SCH_IDLE;
dlsch_ue->harq_processes[harq_pid]->round = 0;
......@@ -716,7 +717,7 @@ uint32_t dlsch_decoding_emul(PHY_VARS_UE *phy_vars_ue,
case 5: // PMCH
dlsch_ue = phy_vars_ue->dlsch_ue_MCH[eNB_id];
dlsch_eNB = PHY_vars_eNB_g[eNB_id2]->dlsch_eNB_MCH;
dlsch_eNB = PHY_vars_eNB_g[eNB_id2][CC_id]->dlsch_eNB_MCH;
LOG_D(PHY,"decoding pmch emul (size is %d, enb %d %d)\n", dlsch_ue->harq_processes[0]->TBS>>3, eNB_id, eNB_id2);
#ifdef DEBUG_DLSCH_DECODING
......
......@@ -48,7 +48,7 @@
#include "gain_control.h"
#endif
//#define DEBUG_INITIAL_SYNCH
#define DEBUG_INITIAL_SYNCH
int pbch_detection(PHY_VARS_UE *phy_vars_ue, runmode_t mode) {
......
......@@ -325,9 +325,9 @@ int generate_pbch(LTE_eNB_PBCH *eNB_pbch,
int32_t generate_pbch_emul(PHY_VARS_eNB *phy_vars_eNB,uint8_t *pbch_pdu) {
LOG_D(PHY,"[eNB %d] generate_pbch_emul \n",phy_vars_eNB->Mod_id);
eNB_transport_info[phy_vars_eNB->Mod_id].cntl.pbch_flag=1;
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].cntl.pbch_flag=1;
// Copy PBCH payload
eNB_transport_info[phy_vars_eNB->Mod_id].cntl.pbch_payload=*(uint32_t *)pbch_pdu;
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].cntl.pbch_payload=*(uint32_t *)pbch_pdu;
return(0);
}
......@@ -915,7 +915,8 @@ uint16_t rx_pbch_emul(PHY_VARS_UE *phy_vars_ue,
double sinr=0.0;
uint16_t nb_rb = phy_vars_ue->lte_frame_parms.N_RB_DL;
int16_t f;
uint8_t CC_id=phy_vars_ue->CC_id;
// compute effective sinr
// TODO: adapt this to varible bandwidth
for (f=(nb_rb*6-3*12);f<(nb_rb*6+3*12);f++) {
......@@ -934,8 +935,8 @@ uint16_t rx_pbch_emul(PHY_VARS_UE *phy_vars_ue,
if (pbch_phase == (phy_vars_ue->frame % 4)) {
if (uniformrandom() >= bler) {
memcpy(phy_vars_ue->lte_ue_pbch_vars[eNB_id]->decoded_output,PHY_vars_eNB_g[eNB_id]->pbch_pdu,PBCH_PDU_SIZE);
return(PHY_vars_eNB_g[eNB_id]->lte_frame_parms.nb_antennas_tx_eNB);
memcpy(phy_vars_ue->lte_ue_pbch_vars[eNB_id]->decoded_output,PHY_vars_eNB_g[eNB_id][CC_id]->pbch_pdu,PBCH_PDU_SIZE);
return(PHY_vars_eNB_g[eNB_id][CC_id]->lte_frame_parms.nb_antennas_tx_eNB);
}
else
return(-1);
......
......@@ -67,7 +67,7 @@ void dump_mch(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint16_t coded_bits_per_co
phy_vars_ue->lte_frame_parms.samples_per_tti,1,1);
if (PHY_vars_eNB_g)
write_output("txsig_mch.m","txs_mch",
&PHY_vars_eNB_g[0]->lte_eNB_common_vars.txdata[0][0][subframe*phy_vars_ue->lte_frame_parms.samples_per_tti],
&PHY_vars_eNB_g[0][0]->lte_eNB_common_vars.txdata[0][0][subframe*phy_vars_ue->lte_frame_parms.samples_per_tti],
phy_vars_ue->lte_frame_parms.samples_per_tti,1,1);
}
......@@ -178,14 +178,14 @@ void fill_eNB_dlsch_MCH(PHY_VARS_eNB *phy_vars_eNB,int mcs,int ndi,int rvidx, in
}
if (abstraction_flag){
eNB_transport_info[phy_vars_eNB->Mod_id].cntl.pmch_flag=1;
eNB_transport_info[phy_vars_eNB->Mod_id].num_pmch=1; // assumption: there is always one pmch in each SF
eNB_transport_info[phy_vars_eNB->Mod_id].num_common_dci=0;
eNB_transport_info[phy_vars_eNB->Mod_id].num_ue_spec_dci=0;
eNB_transport_info[phy_vars_eNB->Mod_id].dlsch_type[0]=5;// put at the reserved position for PMCH
eNB_transport_info[phy_vars_eNB->Mod_id].harq_pid[0]=0;
eNB_transport_info[phy_vars_eNB->Mod_id].ue_id[0]=255;//broadcast
eNB_transport_info[phy_vars_eNB->Mod_id].tbs[0]=dlsch->harq_processes[0]->TBS>>3;
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].cntl.pmch_flag=1;
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].num_pmch=1; // assumption: there is always one pmch in each SF
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].num_common_dci=0;
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].num_ue_spec_dci=0;
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].dlsch_type[0]=5;// put at the reserved position for PMCH
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].harq_pid[0]=0;
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].ue_id[0]=255;//broadcast
eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].tbs[0]=dlsch->harq_processes[0]->TBS>>3;
}
}
......@@ -230,8 +230,8 @@ void fill_UE_dlsch_MCH(PHY_VARS_UE *phy_vars_ue,int mcs,int ndi,int rvidx,int eN
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_tx;
if (abstraction_flag != 0) {
if (eNB_transport_info_TB_index[phy_vars_eNB->Mod_id]!=0)
printf("[PHY][EMU] PMCH transport block position is different than zero %d \n", eNB_transport_info_TB_index[phy_vars_eNB->Mod_id]);
if (eNB_transport_info_TB_index[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id]!=0)
printf("[PHY][EMU] PMCH transport block position is different than zero %d \n", eNB_transport_info_TB_index[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id]);
memcpy(phy_vars_eNB->dlsch_eNB_MCH->harq_processes[0]->b,
a,
......@@ -240,10 +240,10 @@ void fill_UE_dlsch_MCH(PHY_VARS_UE *phy_vars_ue,int mcs,int ndi,int rvidx,int eN
phy_vars_eNB->Mod_id,
phy_vars_eNB->dlsch_eNB_MCH->harq_processes[0]->TBS>>3);
memcpy(&eNB_transport_info[phy_vars_eNB->Mod_id].transport_blocks[eNB_transport_info_TB_index[phy_vars_eNB->Mod_id]],
memcpy(&eNB_transport_info[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id].transport_blocks[eNB_transport_info_TB_index[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id]],
a,
phy_vars_eNB->dlsch_eNB_MCH->harq_processes[0]->TBS>>3);
eNB_transport_info_TB_index[phy_vars_eNB->Mod_id]+= phy_vars_eNB->dlsch_eNB_MCH->harq_processes[0]->TBS>>3;//=eNB_transport_info[phy_vars_eNB->Mod_id].tbs[0];
eNB_transport_info_TB_index[phy_vars_eNB->Mod_id][phy_vars_eNB->CC_id]+= phy_vars_eNB->dlsch_eNB_MCH->harq_processes[0]->TBS>>3;//=eNB_transport_info[phy_vars_eNB->Mod_id].tbs[0];
}else {
G = get_G(&phy_vars_eNB->lte_frame_parms,
phy_vars_eNB->lte_frame_parms.N_RB_DL,
......
......@@ -105,7 +105,7 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
len += sprintf(&buffer[len], "[UE_PROC] Frequency offset %d Hz (%d)\n",phy_vars_ue->lte_ue_common_vars.freq_offset,openair_daq_vars.freq_offset);
len += sprintf(&buffer[len], "[UE PROC] UE mode = %s (%d)\n",mode_string[phy_vars_ue->UE_mode[0]],phy_vars_ue->UE_mode[0]);
len += sprintf(&buffer[len], "[UE PROC] timing_advance = %d\n",phy_vars_ue->timing_advance);
len += sprintf(&buffer[len], "[UE PROC] UE tx power = %d\n", PHY_vars_UE_g[0]->tx_power_dBm);
len += sprintf(&buffer[len], "[UE PROC] UE tx power = %d\n", PHY_vars_UE_g[0][0]->tx_power_dBm);
//for (eNB=0;eNB<NUMBER_OF_eNB_MAX;eNB++) {
for (eNB=0;eNB<1;eNB++) {
......
......@@ -1562,7 +1562,7 @@ uint16_t get_nquad(uint8_t num_pdcch_symbols,LTE_DL_FRAME_PARMS *frame_parms,uin
uint8_t get_mi(LTE_DL_FRAME_PARMS *frame,uint8_t subframe);
uint16_t get_nCCE_max(uint8_t Mod_id);
uint16_t get_nCCE_max(uint8_t Mod_id,uint8_t CC_id);
uint8_t get_num_pdcch_symbols(uint8_t num_dci,DCI_ALLOC_t *dci_alloc,LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe);
......
......@@ -135,6 +135,6 @@ int generate_pss(mod_sym_t **txdataF,
int generate_pss_emul(PHY_VARS_eNB *phy_vars_eNb,uint8_t sect_id) {
msg("[PHY] EMUL eNB generate_pss_emul eNB %d, sect_id %d\n",phy_vars_eNb->Mod_id,sect_id);
eNB_transport_info[phy_vars_eNb->Mod_id].cntl.pss=sect_id;
eNB_transport_info[phy_vars_eNb->Mod_id][phy_vars_eNb->CC_id].cntl.pss=sect_id;
return(0);
}
......@@ -402,24 +402,24 @@ void generate_pucch_emul(PHY_VARS_UE *phy_vars_ue,
uint8_t sr,
uint8_t subframe) {
UE_transport_info[phy_vars_ue->Mod_id].cntl.pucch_flag = format;
UE_transport_info[phy_vars_ue->Mod_id].cntl.pucch_Ncs1 = ncs1;
UE_transport_info[phy_vars_ue->Mod_id][phy_vars_ue->CC_id].cntl.pucch_flag = format;
UE_transport_info[phy_vars_ue->Mod_id][phy_vars_ue->CC_id].cntl.pucch_Ncs1 = ncs1;
UE_transport_info[phy_vars_ue->Mod_id].cntl.sr = sr;
UE_transport_info[phy_vars_ue->Mod_id][phy_vars_ue->CC_id].cntl.sr = sr;
// the value of phy_vars_ue->pucch_sel[subframe] is set by get_n1_pucch
UE_transport_info[phy_vars_ue->Mod_id].cntl.pucch_sel = phy_vars_ue->pucch_sel[subframe];
UE_transport_info[phy_vars_ue->Mod_id][phy_vars_ue->CC_id].cntl.pucch_sel = phy_vars_ue->pucch_sel[subframe];
// LOG_I(PHY,"subframe %d emu tx pucch_sel is %d sr is %d \n", subframe, UE_transport_info[phy_vars_ue->Mod_id].cntl.pucch_sel, sr);
if (format == pucch_format1a) {
phy_vars_ue->pucch_payload[0] = pucch_payload[0];
UE_transport_info[phy_vars_ue->Mod_id].cntl.pucch_payload = pucch_payload[0];
UE_transport_info[phy_vars_ue->Mod_id][phy_vars_ue->CC_id].cntl.pucch_payload = pucch_payload[0];
}
else if (format == pucch_format1b) {
phy_vars_ue->pucch_payload[0] = pucch_payload[0] + (pucch_payload[1]<<1);
UE_transport_info[phy_vars_ue->Mod_id].cntl.pucch_payload = pucch_payload[0] + (pucch_payload[1]<<1);
UE_transport_info[phy_vars_ue->Mod_id][phy_vars_ue->CC_id].cntl.pucch_payload = pucch_payload[0] + (pucch_payload[1]<<1);
}
else if (format == pucch_format1) {
LOG_D(PHY,"[UE %d] Frame %d subframe %d Generating PUCCH for SR %d\n",phy_vars_ue->Mod_id,phy_vars_ue->frame,subframe,sr);
......@@ -952,10 +952,11 @@ int32_t rx_pucch_emul(PHY_VARS_eNB *phy_vars_eNB,
uint8_t UE_id;
uint16_t rnti;
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_rx;
uint8_t CC_id = phy_vars_eNB->CC_id;
rnti = phy_vars_eNB->ulsch_eNB[UE_index]->rnti;
for (UE_id=0;UE_id<NB_UE_INST;UE_id++) {
if (rnti == PHY_vars_UE_g[UE_id]->lte_ue_pdcch_vars[0]->crnti)
if (rnti == PHY_vars_UE_g[UE_id][phy_vars_eNB->CC_id]->lte_ue_pdcch_vars[0]->crnti)
break;
}
if (UE_id==NB_UE_INST) {
......@@ -964,19 +965,19 @@ int32_t rx_pucch_emul(PHY_VARS_eNB *phy_vars_eNB,
}
if (fmt == pucch_format1) {
payload[0] = PHY_vars_UE_g[UE_id]->sr[subframe];
payload[0] = PHY_vars_UE_g[UE_id][phy_vars_eNB->CC_id]->sr[subframe];
}
else if (fmt == pucch_format1a) {
payload[0] = PHY_vars_UE_g[UE_id]->pucch_payload[0];
payload[0] = PHY_vars_UE_g[UE_id][phy_vars_eNB->CC_id]->pucch_payload[0];
}
else if (fmt == pucch_format1b) {
payload[0] = PHY_vars_UE_g[UE_id]->pucch_payload[0];
payload[1] = PHY_vars_UE_g[UE_id]->pucch_payload[1];
payload[0] = PHY_vars_UE_g[UE_id][phy_vars_eNB->CC_id]->pucch_payload[0];
payload[1] = PHY_vars_UE_g[UE_id][phy_vars_eNB->CC_id]->pucch_payload[1];
}
else
LOG_E(PHY,"[eNB] Frame %d: Can't handle formats 2/2a/2b\n",phy_vars_eNB->proc[sched_subframe].frame_rx);
if (PHY_vars_UE_g[UE_id]->pucch_sel[subframe] == n1_pucch_sel)
if (PHY_vars_UE_g[UE_id][phy_vars_eNB->CC_id]->pucch_sel[subframe] == n1_pucch_sel)
return(99);
else
return(0);
......
......@@ -300,12 +300,12 @@ int generate_ue_ulsch_params_from_rar(PHY_VARS_UE *phy_vars_ue,
}
// initialize power control based on PRACH power
ulsch->f_pusch = delta_PUSCH_msg2[ulsch->harq_processes[harq_pid]->TPC] +
mac_xface->get_deltaP_rampup(phy_vars_ue->Mod_id);
LOG_D(PHY,"[UE %d][PUSCH PC] Initializing f_pusch to %d dB, TPC %d (delta_PUSCH_msg2 %d dB), deltaP_rampup %d dB\n",
phy_vars_ue->Mod_id,ulsch->f_pusch,ulsch->harq_processes[harq_pid]->TPC,delta_PUSCH_msg2[ulsch->harq_processes[harq_pid]->TPC],
mac_xface->get_deltaP_rampup(phy_vars_ue->Mod_id));
ulsch->f_pusch = delta_PUSCH_msg2[ulsch->harq_processes[harq_pid]->TPC] +
mac_xface->get_deltaP_rampup(phy_vars_ue->Mod_id,phy_vars_ue->CC_id);
LOG_D(PHY,"[UE %d][PUSCH PC] Initializing f_pusch to %d dB, TPC %d (delta_PUSCH_msg2 %d dB), deltaP_rampup %d dB\n",
phy_vars_ue->Mod_id,ulsch->f_pusch,ulsch->harq_processes[harq_pid]->TPC,delta_PUSCH_msg2[ulsch->harq_processes[harq_pid]->TPC],
mac_xface->get_deltaP_rampup(phy_vars_ue->Mod_id,phy_vars_ue->CC_id));
//#ifdef DEBUG_RAR
msg("ulsch ra (UE): harq_pid %d\n",harq_pid);
......
......@@ -912,29 +912,29 @@ int ulsch_encoding_emul(uint8_t *ulsch_buffer,
//memcpy(&UE_transport_info[phy_vars_ue->Mod_id].transport_blocks[UE_transport_info_TB_index[phy_vars_ue->Mod_id]],
memcpy(&UE_transport_info[phy_vars_ue->Mod_id].transport_blocks,
memcpy(&UE_transport_info[phy_vars_ue->Mod_id][phy_vars_ue->CC_id].transport_blocks,
ulsch_buffer,
phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->TBS>>3);
//UE_transport_info_TB_index[phy_vars_ue->Mod_id]+=phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->TBS>>3;
// navid: currently more than one eNB is not supported in the code
UE_transport_info[phy_vars_ue->Mod_id].num_eNB = 1;
UE_transport_info[phy_vars_ue->Mod_id].rnti[0] = phy_vars_ue->lte_ue_pdcch_vars[0]->crnti;
UE_transport_info[phy_vars_ue->Mod_id].eNB_id[0] = eNB_id;
UE_transport_info[phy_vars_ue->Mod_id].harq_pid[0] = harq_pid;
UE_transport_info[phy_vars_ue->Mod_id].tbs[0] = phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->TBS>>3 ;
UE_transport_info[phy_vars_ue->Mod_id][phy_vars_ue->CC_id].num_eNB = 1;
UE_transport_info[phy_vars_ue->Mod_id][phy_vars_ue->CC_id].rnti[0] = phy_vars_ue->lte_ue_pdcch_vars[0]->crnti;
UE_transport_info[phy_vars_ue->Mod_id][phy_vars_ue->CC_id].eNB_id[0] = eNB_id;
UE_transport_info[phy_vars_ue->Mod_id][phy_vars_ue->CC_id].harq_pid[0] = harq_pid;
UE_transport_info[phy_vars_ue->Mod_id][phy_vars_ue->CC_id].tbs[0] = phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->TBS>>3 ;
// msg("\nphy_vars_ue->Mod_id%d\n",phy_vars_ue->Mod_id);
UE_transport_info[phy_vars_ue->Mod_id].cntl.pusch_flag = 1;
UE_transport_info[phy_vars_ue->Mod_id][phy_vars_ue->CC_id].cntl.pusch_flag = 1;
//UE_transport_info[phy_vars_ue->Mod_id].cntl.pusch_uci = *(uint32_t *)ulsch->o;
memcpy(UE_transport_info[phy_vars_ue->Mod_id].cntl.pusch_uci,
memcpy(UE_transport_info[phy_vars_ue->Mod_id][phy_vars_ue->CC_id].cntl.pusch_uci,
ulsch->o,
MAX_CQI_BYTES);
// msg("[UE]cqi is %d \n", ((HLC_subband_cqi_rank1_2A_5MHz *)ulsch->o)->cqi1);
UE_transport_info[phy_vars_ue->Mod_id].cntl.length_uci = ulsch->O;
UE_transport_info[phy_vars_ue->Mod_id].cntl.uci_format = ulsch->uci_format;
UE_transport_info[phy_vars_ue->Mod_id].cntl.pusch_ri = (ulsch->o_RI[0]&1)+((ulsch->o_RI[1]&1)<<1);
UE_transport_info[phy_vars_ue->Mod_id].cntl.pusch_ack = (ulsch->o_ACK[0]&1) + ((ulsch->o_ACK[1]&1)<<1);
UE_transport_info[phy_vars_ue->Mod_id][phy_vars_ue->CC_id].cntl.length_uci = ulsch->O;
UE_transport_info[phy_vars_ue->Mod_id][phy_vars_ue->CC_id].cntl.uci_format = ulsch->uci_format;
UE_transport_info[phy_vars_ue->Mod_id][phy_vars_ue->CC_id].cntl.pusch_ri = (ulsch->o_RI[0]&1)+((ulsch->o_RI[1]&1)<<1);
UE_transport_info[phy_vars_ue->Mod_id][phy_vars_ue->CC_id].cntl.pusch_ack = (ulsch->o_ACK[0]&1) + ((ulsch->o_ACK[1]&1)<<1);
//msg("ack is %d %d %d\n",UE_transport_info[phy_vars_ue->Mod_id].cntl.pusch_ack, (ulsch->o_ACK[1]&1)<<1, ulsch->o_ACK[0]&1);
return(0);
......
......@@ -1677,6 +1677,7 @@ uint32_t ulsch_decoding_emul(PHY_VARS_eNB *phy_vars_eNB,
uint16_t rnti;
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_rx;
uint8_t harq_pid;
uint8_t CC_id = phy_vars_eNB->CC_id;
harq_pid = subframe2harq_pid(&phy_vars_eNB->lte_frame_parms,phy_vars_eNB->proc[sched_subframe].frame_rx,subframe);
......@@ -1685,7 +1686,7 @@ uint32_t ulsch_decoding_emul(PHY_VARS_eNB *phy_vars_eNB,
LOG_D(PHY,"[eNB %d] ulsch_decoding_emul : subframe %d UE_index %d harq_pid %d rnti %x\n",phy_vars_eNB->Mod_id,subframe,UE_index,harq_pid,rnti);
#endif
for (UE_id=0;UE_id<NB_UE_INST;UE_id++) {
if (rnti == PHY_vars_UE_g[UE_id]->lte_ue_pdcch_vars[0]->crnti)
if (rnti == PHY_vars_UE_g[UE_id][CC_id]->lte_ue_pdcch_vars[0]->crnti)
break;
/*
msg("[PHY] EMUL eNB %d ulsch_decoding_emul : subframe ue id %d crnti %x nb ue %d\n",
......@@ -1705,9 +1706,9 @@ uint32_t ulsch_decoding_emul(PHY_VARS_eNB *phy_vars_eNB,
LOG_D(PHY,"[eNB %d] Found UE with rnti %x => UE_id %d\n",phy_vars_eNB->Mod_id, rnti, UE_id);
}
if (PHY_vars_UE_g[UE_id]->ulsch_ue[0]->harq_processes[harq_pid]->status == CBA_ACTIVE){
if (PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->harq_processes[harq_pid]->status == CBA_ACTIVE){
*crnti = rnti;
PHY_vars_UE_g[UE_id]->ulsch_ue[0]->harq_processes[harq_pid]->status=IDLE;
PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->harq_processes[harq_pid]->status=IDLE;
} else
*crnti = 0x0;
......@@ -1750,17 +1751,17 @@ uint32_t ulsch_decoding_emul(PHY_VARS_eNB *phy_vars_eNB,
LOG_D(PHY,"ulsch_decoding_emul abstraction successful\n");
memcpy(phy_vars_eNB->ulsch_eNB[UE_index]->harq_processes[harq_pid]->b,
PHY_vars_UE_g[UE_id]->ulsch_ue[0]->harq_processes[harq_pid]->b,
PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->harq_processes[harq_pid]->b,
phy_vars_eNB->ulsch_eNB[UE_index]->harq_processes[harq_pid]->TBS>>3);
// get local ue's ack
if ((UE_index >= oai_emulation.info.first_ue_local) ||(UE_index <(oai_emulation.info.first_ue_local+oai_emulation.info.nb_ue_local))){
get_ack(&phy_vars_eNB->lte_frame_parms,
PHY_vars_UE_g[UE_id]->dlsch_ue[0][0]->harq_ack,
PHY_vars_UE_g[UE_id][CC_id]->dlsch_ue[0][0]->harq_ack,
subframe,
phy_vars_eNB->ulsch_eNB[UE_index]->o_ACK);
}else { // get remote UEs' ack
phy_vars_eNB->ulsch_eNB[UE_index]->o_ACK[0] = PHY_vars_UE_g[UE_id]->ulsch_ue[0]->o_ACK[0];
phy_vars_eNB->ulsch_eNB[UE_index]->o_ACK[1] = PHY_vars_UE_g[UE_id]->ulsch_ue[0]->o_ACK[1];
phy_vars_eNB->ulsch_eNB[UE_index]->o_ACK[0] = PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->o_ACK[0];
phy_vars_eNB->ulsch_eNB[UE_index]->o_ACK[1] = PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->o_ACK[1];
}
// Do abstraction of PUSCH feedback
......@@ -1768,16 +1769,16 @@ uint32_t ulsch_decoding_emul(PHY_VARS_eNB *phy_vars_eNB,
LOG_D(PHY,"[eNB %d][EMUL] ue index %d UE_id %d: subframe %d : o_ACK (%d %d), cqi (val %d, len %d)\n",
phy_vars_eNB->Mod_id,UE_index, UE_id, subframe,phy_vars_eNB->ulsch_eNB[UE_index]->o_ACK[0],
phy_vars_eNB->ulsch_eNB[UE_index]->o_ACK[1],
((HLC_subband_cqi_rank1_2A_5MHz *)PHY_vars_UE_g[UE_id]->ulsch_ue[0]->o)->cqi1,
PHY_vars_UE_g[UE_id]->ulsch_ue[0]->O);
((HLC_subband_cqi_rank1_2A_5MHz *)PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->o)->cqi1,
PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->O);
#endif
phy_vars_eNB->ulsch_eNB[UE_index]->Or1 = PHY_vars_UE_g[UE_id]->ulsch_ue[0]->O;
phy_vars_eNB->ulsch_eNB[UE_index]->Or2 = PHY_vars_UE_g[UE_id]->ulsch_ue[0]->O;
phy_vars_eNB->ulsch_eNB[UE_index]->Or1 = PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->O;
phy_vars_eNB->ulsch_eNB[UE_index]->Or2 = PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->O;
phy_vars_eNB->ulsch_eNB[UE_index]->uci_format = PHY_vars_UE_g[UE_id]->ulsch_ue[0]->uci_format;
memcpy(phy_vars_eNB->ulsch_eNB[UE_index]->o,PHY_vars_UE_g[UE_id]->ulsch_ue[0]->o,MAX_CQI_BYTES);
memcpy(phy_vars_eNB->ulsch_eNB[UE_index]->o_RI,PHY_vars_UE_g[UE_id]->ulsch_ue[0]->o_RI,2);
phy_vars_eNB->ulsch_eNB[UE_index]->uci_format = PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->uci_format;
memcpy(phy_vars_eNB->ulsch_eNB[UE_index]->o,PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->o,MAX_CQI_BYTES);
memcpy(phy_vars_eNB->ulsch_eNB[UE_index]->o_RI,PHY_vars_UE_g[UE_id][CC_id]->ulsch_ue[0]->o_RI,2);
phy_vars_eNB->ulsch_eNB[UE_index]->cqi_crc_status = 1;
......
......@@ -171,10 +171,11 @@ typedef struct {
/// Top-level PHY Data Structure for eNB
typedef struct PHY_VARS_eNB_s{
/// Module ID indicator for this instance
module_id_t Mod_id;
eNB_proc_t proc[10];
uint8_t local_flag;
uint32_t rx_total_gain_eNB_dB;
module_id_t Mod_id;
uint8_t CC_id;
eNB_proc_t proc[10];
uint8_t local_flag;
uint32_t rx_total_gain_eNB_dB;
LTE_DL_FRAME_PARMS lte_frame_parms;
PHY_MEASUREMENTS_eNB PHY_measurements_eNB[NUMBER_OF_eNB_SECTORS_MAX]; /// Measurement variables
LTE_eNB_COMMON lte_eNB_common_vars;
......@@ -349,6 +350,7 @@ typedef struct
{
/// Module ID indicator for this instance
uint8_t Mod_id;
uint8_t CC_id;
uint8_t local_flag;
uint32_t tx_total_gain_dB;
uint32_t rx_total_gain_dB; ///this is a function of rx_gain_mode (and the corresponding gain) and the rx_gain of the card
......
......@@ -25,8 +25,8 @@ extern unsigned int DAQ_MBOX;
//extern PHY_CONFIG *PHY_config;
//extern PHY_VARS *PHY_vars;
extern PHY_VARS_UE **PHY_vars_UE_g;
extern PHY_VARS_eNB **PHY_vars_eNB_g;
extern PHY_VARS_UE ***PHY_vars_UE_g;
extern PHY_VARS_eNB ***PHY_vars_eNB_g;
extern PHY_VARS_RN **PHY_vars_RN_g;
extern LTE_DL_FRAME_PARMS *lte_frame_parms_g;
......
......@@ -34,8 +34,8 @@ int16_t *primary_synch2_time;
#include "PHY/CODING/vars.h"
//PHY_VARS *PHY_vars;
PHY_VARS_UE **PHY_vars_UE_g;
PHY_VARS_eNB **PHY_vars_eNB_g;
PHY_VARS_UE ***PHY_vars_UE_g;
PHY_VARS_eNB ***PHY_vars_eNB_g;
PHY_VARS_RN **PHY_vars_RN_g;
LTE_DL_FRAME_PARMS *lte_frame_parms_g;
......
......@@ -129,7 +129,7 @@ void cleanup_dlsch_threads(void);
@param r_type indicates the relaying operation: 0: no_relaying, 1: unicast relaying type 1, 2: unicast relaying type 2, 3: multicast relaying
@param *phy_vars_rn pointer to RN variables
*/
void phy_procedures_eNB_lte(uint8_t subframe,PHY_VARS_eNB *phy_vars_eNB,uint8_t abstraction_flag, relaying_type_t r_type, PHY_VARS_RN *phy_vars_rn);
void phy_procedures_eNB_lte(uint8_t subframe,PHY_VARS_eNB **phy_vars_eNB,uint8_t abstraction_flag, relaying_type_t r_type, PHY_VARS_RN *phy_vars_rn);
/*!
\brief Top-level entry routine for UE procedures. Called every slot by process scheduler. In even slots, it performs RX functions from previous subframe (if required). On odd slots, it generate TX waveform for the following subframe.
@param last_slot Index of last slot (0-19)
......@@ -250,10 +250,11 @@ lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe)
/*!
\brief Function to compute subframe type as a function of Frame type and TDD Configuration (implements Table 4.2.2 from 36.211, p.11 from version 8.6) and subframe index. Same as subframe_select, except that it uses the Mod_id and is provided as a service to the MAC scheduler.
@param Mod_id Index of eNB
@param CC_id Component Carrier Index
@param subframe Subframe index
@returns Subframe type (DL,UL,S)
*/
lte_subframe_t get_subframe_direction(uint8_t Mod_id, uint8_t subframe);
lte_subframe_t get_subframe_direction(uint8_t Mod_id, uint8_t CC_id,uint8_t subframe);
/*!
\brief Function to indicate PHICH transmission subframes. Implements Table 9.1.2-1 for TDD.
......@@ -307,15 +308,17 @@ uint8_t get_Msg3_harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t
/** \brief Function to indicate failure of contention resolution or RA procedure. It places the UE back in PRACH mode.
@param Mod_id Instance index of UE
@param CC_id Component Carrier Index
@param eNB_index Index of eNB
*/
void ra_failed(uint8_t Mod_id,uint8_t eNB_index);
void ra_failed(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
/** \brief Function to indicate success of contention resolution or RA procedure.
@param Mod_id Instance index of UE
@param CC_id Component Carrier Index
@param eNB_index Index of eNB
*/
void ra_succeeded(uint8_t Mod_id,uint8_t eNB_index);
void ra_succeeded(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
uint8_t phich_subframe_to_harq_pid(LTE_DL_FRAME_PARMS *frame_parms,uint32_t frame,uint8_t subframe);
......@@ -399,26 +402,26 @@ int8_t find_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
int32_t add_ue(int16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
int32_t remove_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB,uint8_t abstraction_flag);
void process_timing_advance(uint8_t Mod_id,int16_t timing_advance);
void process_timing_advance(uint8_t Mod_id,uint8_t CC_id,int16_t timing_advance);
void process_timing_advance_rar(PHY_VARS_UE *phy_vars_ue,uint16_t timing_advance);
unsigned int get_tx_amp(int gain_dBm, int gain_max_dBm);
void phy_reset_ue(uint8_t Mod_id,uint8_t eNB_index);
void phy_reset_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t 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
TDD, this routine computes the complex procedure described in Section 10.1 of 36.213 (through tables 10.1-1,10.1-2)
@param phy_vars_ue Pointer to UE variables
@param eNB_id Index of eNB
@param subframe Index of subframe
@param sched_subframe Index of subframe where procedures were scheduled
@param b Pointer to PUCCH payload (b[0],b[1])
@param SR 1 means there's a positive SR in parallel to ACK/NAK
@returns n1_pucch
*/
uint16_t get_n1_pucch(PHY_VARS_UE *phy_vars_ue,
uint8_t eNB_id,
uint8_t subframe,
uint8_t sched_subframe,
uint8_t *b,
uint8_t SR);
......@@ -464,10 +467,11 @@ void process_HARQ_feedback(uint8_t UE_id,
/*!
\brief This function retrieves the PHY UE mode. It is used as a helper function for the UE MAC.
@param Mod_id Local UE index on which to act
@param CC_id Component Carrier Index
@param eNB_index ID of eNB
@returns UE mode
*/
UE_MODE_t get_ue_mode(uint8_t Mod_id,uint8_t eNB_index);
UE_MODE_t get_ue_mode(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index);
/** \brief This function implements the power control mechanism for PUCCH from 36.213.
@param phy_vars_ue PHY variables
......@@ -489,8 +493,8 @@ void pusch_power_cntl(PHY_VARS_UE *phy_vars_ue,uint8_t subframe,uint8_t eNB_id,u
int8_t get_PHR(uint8_t Mod_id, uint8_t eNB_index);
LTE_eNB_UE_stats* get_eNB_UE_stats(uint8_t Mod_id, uint16_t rnti);
int get_ue_active_harq_pid(uint8_t Mod_id,uint16_t rnti,uint8_t subframe,uint8_t *harq_pid,uint8_t *round,uint8_t ul_flag);
LTE_eNB_UE_stats* get_eNB_UE_stats(uint8_t Mod_id, int CC_id,uint16_t rnti);
int get_ue_active_harq_pid(uint8_t Mod_id,uint8_t CC_id,uint16_t rnti,uint8_t subframe,uint8_t *harq_pid,uint8_t *round,uint8_t ul_flag);
void ulsch_decoding_procedures(unsigned char last_slot, unsigned int i, PHY_VARS_eNB *phy_vars_eNB, unsigned char abstraction_flag);
......
......@@ -498,9 +498,9 @@ lte_subframe_t subframe_select(LTE_DL_FRAME_PARMS *frame_parms,unsigned char sub
}
}
lte_subframe_t get_subframe_direction(uint8_t Mod_id,uint8_t subframe) {
lte_subframe_t get_subframe_direction(uint8_t Mod_id,uint8_t CC_id,uint8_t subframe) {
return(subframe_select(&PHY_vars_eNB_g[Mod_id]->lte_frame_parms,subframe));
return(subframe_select(&PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms,subframe));
}
......@@ -544,18 +544,18 @@ unsigned int is_phich_subframe(LTE_DL_FRAME_PARMS *frame_parms,unsigned char sub
}
LTE_eNB_UE_stats* get_eNB_UE_stats(uint8_t Mod_id, uint16_t rnti) {
LTE_eNB_UE_stats* get_eNB_UE_stats(uint8_t Mod_id, int CC_id,uint16_t rnti) {
int8_t UE_id;
if ((PHY_vars_eNB_g == NULL) || (PHY_vars_eNB_g[Mod_id] == NULL)) {
LOG_E(PHY,"get_eNB_UE_stats: No phy_vars_eNB found (or not allocated) for Mod_id %d\n",Mod_id);
if ((PHY_vars_eNB_g == NULL) || (PHY_vars_eNB_g[Mod_id] == NULL) || (PHY_vars_eNB_g[Mod_id][CC_id]==NULL)) {
LOG_E(PHY,"get_eNB_UE_stats: No phy_vars_eNB found (or not allocated) for Mod_id %d,CC_id %d\n",Mod_id,CC_id);
return NULL;
}
UE_id = find_ue(rnti, PHY_vars_eNB_g[Mod_id]);
UE_id = find_ue(rnti, PHY_vars_eNB_g[Mod_id][CC_id]);
if (UE_id == -1) {
LOG_E(PHY,"get_eNB_UE_stats: UE with rnti %x not found\n",rnti);
return NULL;
}
return(&PHY_vars_eNB_g[Mod_id]->eNB_UE_stats[(uint32_t)UE_id]);
return(&PHY_vars_eNB_g[Mod_id][CC_id]->eNB_UE_stats[(uint32_t)UE_id]);
}
int8_t find_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB) {
......
......@@ -112,10 +112,13 @@ extern int rx_sig_fifo;
#endif
static unsigned char I0_clear = 1;
uint8_t is_SR_subframe(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id,uint8_t subframe) {
uint8_t is_SR_subframe(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id,uint8_t sched_subframe) {
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_rx;
int frame = phy_vars_eNB->proc[sched_subframe].frame_rx;
LOG_D(PHY,"[eNB %d][SR %x] Frame %d subframe %d Checking for SR TXOp(sr_ConfigIndex %d)\n",
phy_vars_eNB->Mod_id,phy_vars_eNB->ulsch_eNB[UE_id]->rnti,phy_vars_eNB->proc[subframe].frame_rx,subframe,
phy_vars_eNB->Mod_id,phy_vars_eNB->ulsch_eNB[UE_id]->rnti,frame,subframe,
phy_vars_eNB->scheduling_request_config[UE_id].sr_ConfigIndex);
if (phy_vars_eNB->scheduling_request_config[UE_id].sr_ConfigIndex <= 4) { // 5 ms SR period
......@@ -127,15 +130,15 @@ uint8_t is_SR_subframe(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id,uint8_t subframe
return(1);
}
else if (phy_vars_eNB->scheduling_request_config[UE_id].sr_ConfigIndex <= 34) { // 20 ms SR period
if ((10*(phy_vars_eNB->proc[subframe].frame_rx&1)+subframe) == (phy_vars_eNB->scheduling_request_config[UE_id].sr_ConfigIndex-15))
if ((10*(frame&1)+subframe) == (phy_vars_eNB->scheduling_request_config[UE_id].sr_ConfigIndex-15))
return(1);
}
else if (phy_vars_eNB->scheduling_request_config[UE_id].sr_ConfigIndex <= 74) { // 40 ms SR period
if ((10*(phy_vars_eNB->proc[subframe].frame_rx&3)+subframe) == (phy_vars_eNB->scheduling_request_config[UE_id].sr_ConfigIndex-35))
if ((10*(frame&3)+subframe) == (phy_vars_eNB->scheduling_request_config[UE_id].sr_ConfigIndex-35))
return(1);
}
else if (phy_vars_eNB->scheduling_request_config[UE_id].sr_ConfigIndex <= 154) { // 80 ms SR period
if ((10*(phy_vars_eNB->proc[subframe].frame_rx&7)+subframe) == (phy_vars_eNB->scheduling_request_config[UE_id].sr_ConfigIndex-75))
if ((10*(frame&7)+subframe) == (phy_vars_eNB->scheduling_request_config[UE_id].sr_ConfigIndex-75))
return(1);
}
......@@ -208,18 +211,16 @@ int8_t find_next_ue_index(PHY_VARS_eNB *phy_vars_eNB) {
return(-1);
}
int get_ue_active_harq_pid(uint8_t Mod_id,uint16_t rnti,uint8_t subframe,uint8_t *harq_pid,uint8_t *round,uint8_t ul_flag) {
int get_ue_active_harq_pid(uint8_t Mod_id,uint8_t CC_id,uint16_t rnti,uint8_t sched_subframe,uint8_t *harq_pid,uint8_t *round,uint8_t ul_flag) {
LTE_eNB_DLSCH_t *DLSCH_ptr;
LTE_eNB_ULSCH_t *ULSCH_ptr;
// uint8_t subframe_m4;
uint8_t ulsch_subframe,ulsch_frame;
uint8_t i;
int8_t UE_id = find_ue(rnti,PHY_vars_eNB_g[Mod_id]);
int subframe_sched = (subframe == 9) ? 0 : (subframe+1);
uint32_t frame;
frame = PHY_vars_eNB_g[Mod_id]->proc[subframe_sched].frame_tx;
int8_t UE_id = find_ue(rnti,PHY_vars_eNB_g[Mod_id][CC_id]);
int frame = PHY_vars_eNB_g[Mod_id][CC_id]->proc[sched_subframe].frame_tx;
int subframe = PHY_vars_eNB_g[Mod_id][CC_id]->proc[sched_subframe].subframe_tx;
if (UE_id==-1) {
LOG_E(PHY,"Cannot find UE with rnti %x\n",rnti);
......@@ -228,7 +229,7 @@ int get_ue_active_harq_pid(uint8_t Mod_id,uint16_t rnti,uint8_t subframe,uint8_t
}
if (ul_flag == 0) {// this is a DL request
DLSCH_ptr = PHY_vars_eNB_g[Mod_id]->dlsch_eNB[(uint32_t)UE_id][0];
DLSCH_ptr = PHY_vars_eNB_g[Mod_id][CC_id]->dlsch_eNB[(uint32_t)UE_id][0];
/*
#ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[eNB %d] get_ue_active_harq_pid: Frame %d subframe %d, current harq_id %d\n",
......@@ -270,11 +271,11 @@ int get_ue_active_harq_pid(uint8_t Mod_id,uint16_t rnti,uint8_t subframe,uint8_t
}
else { // This is a UL request
ULSCH_ptr = PHY_vars_eNB_g[Mod_id]->ulsch_eNB[(uint32_t)UE_id];
ulsch_subframe = pdcch_alloc2ul_subframe(&PHY_vars_eNB_g[Mod_id]->lte_frame_parms,subframe);
ulsch_frame = pdcch_alloc2ul_frame(&PHY_vars_eNB_g[Mod_id]->lte_frame_parms,frame,subframe);
ULSCH_ptr = PHY_vars_eNB_g[Mod_id][CC_id]->ulsch_eNB[(uint32_t)UE_id];
ulsch_subframe = pdcch_alloc2ul_subframe(&PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms,subframe);
ulsch_frame = pdcch_alloc2ul_frame(&PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms,frame,subframe);
// Note this is for TDD configuration 3,4,5 only
*harq_pid = subframe2harq_pid(&PHY_vars_eNB_g[Mod_id]->lte_frame_parms,
*harq_pid = subframe2harq_pid(&PHY_vars_eNB_g[Mod_id][CC_id]->lte_frame_parms,
ulsch_frame,
ulsch_subframe);
*round = ULSCH_ptr->harq_processes[*harq_pid]->round;
......@@ -1048,8 +1049,9 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
phy_vars_eNB->Mod_id,phy_vars_eNB->proc[sched_subframe].frame_tx, subframe, subframe);
#endif
#ifdef OPENAIR2
// Get scheduling info for next subframe during odd slot of previous subframe (next_slot is even)
mac_xface->eNB_dlsch_ulsch_scheduler(phy_vars_eNB->Mod_id,0,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe);//,1);
// Get scheduling info for next subframe
if (phy_vars_eNB->CC_id == 0)
mac_xface->eNB_dlsch_ulsch_scheduler(phy_vars_eNB->Mod_id,0,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe);//,1);
#endif
// for (sect_id = 0 ; sect_id < number_of_cards; sect_id++) {
......@@ -1077,7 +1079,10 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
#ifdef Rel10
// if mcch is active, send regardless of the node type: eNB or RN
// when mcch is active, MAC sched does not allow MCCH and MTCH multiplexing
mch_pduP = mac_xface->get_mch_sdu(phy_vars_eNB->Mod_id,phy_vars_eNB->proc[sched_subframe].frame_tx,subframe);
mch_pduP = mac_xface->get_mch_sdu(phy_vars_eNB->Mod_id,
phy_vars_eNB->CC_id,
phy_vars_eNB->proc[sched_subframe].frame_tx,
subframe);
switch (r_type){
case no_relay:
if ((mch_pduP->Pdu_size > 0) && (mch_pduP->sync_area == 0)) // TEST: only transmit mcch for sync area 0
......@@ -1350,6 +1355,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
// Parse DCI received from MAC
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_ENB_PDCCH_TX,1);
DCI_pdu = mac_xface->get_dci_sdu(phy_vars_eNB->Mod_id,
phy_vars_eNB->CC_id,
phy_vars_eNB->proc[sched_subframe].frame_tx,
subframe);
#else
......@@ -1406,7 +1412,8 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
DCI_pdu->nCCE = get_nCCE(num_pdcch_symbols,
&phy_vars_eNB->lte_frame_parms,
get_mi(&phy_vars_eNB->lte_frame_parms,subframe));
LOG_T(PHY,"num_pdcch_symbols %d, nCCE %d\n",num_pdcch_symbols,DCI_pdu->nCCE);
LOG_D(PHY,"num_pdcch_symbols %d, nCCE %d (dci commond %d, dci uespec %d\n",num_pdcch_symbols,DCI_pdu->nCCE,
DCI_pdu->Num_common_dci,DCI_pdu->Num_ue_spec_dci);
#if defined(SMBV) && !defined(EXMIMO)
// Sets up PDCCH and DCI table
......@@ -1721,6 +1728,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
#ifdef OPENAIR2
DLSCH_pdu = mac_xface->get_dlsch_sdu(phy_vars_eNB->Mod_id,
phy_vars_eNB->CC_id,
phy_vars_eNB->proc[sched_subframe].frame_tx,
SI_RNTI,
0);
......@@ -1809,6 +1817,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
#ifdef OPENAIR2
crnti = mac_xface->fill_rar(phy_vars_eNB->Mod_id,
phy_vars_eNB->CC_id,
phy_vars_eNB->proc[sched_subframe].frame_tx,
dlsch_input_buffer,
phy_vars_eNB->lte_frame_parms.N_RB_UL,
......@@ -1823,6 +1832,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
LOG_W(PHY,"[eNB] Max user count reached.\n");
//mac_xface->macphy_exit("[PHY][eNB] Max user count reached.\n");
mac_xface->cancel_ra_proc(phy_vars_eNB->Mod_id,
phy_vars_eNB->CC_id,
phy_vars_eNB->proc[sched_subframe].frame_tx,
crnti);
}
......@@ -1954,6 +1964,7 @@ void phy_procedures_eNB_TX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
#ifdef OPENAIR2
DLSCH_pdu = mac_xface->get_dlsch_sdu(phy_vars_eNB->Mod_id,
phy_vars_eNB->CC_id,
phy_vars_eNB->proc[sched_subframe].frame_tx,
phy_vars_eNB->dlsch_eNB[(uint8_t)UE_id][0]->rnti,
0);
......@@ -2356,7 +2367,7 @@ void process_HARQ_feedback(uint8_t UE_id,
void get_n1_pucch_eNB(PHY_VARS_eNB *phy_vars_eNB,
uint8_t UE_id,
uint8_t subframe,
uint8_t sched_subframe,
int16_t *n1_pucch0,
int16_t *n1_pucch1,
int16_t *n1_pucch2,
......@@ -2365,7 +2376,8 @@ void get_n1_pucch_eNB(PHY_VARS_eNB *phy_vars_eNB,
LTE_DL_FRAME_PARMS *frame_parms=&phy_vars_eNB->lte_frame_parms;
uint8_t nCCE0,nCCE1;
int sf;
int frame = phy_vars_eNB->proc[subframe].frame_rx;
int frame = phy_vars_eNB->proc[sched_subframe].frame_rx;
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_rx;
if (frame_parms->frame_type == FDD ) {
sf = (subframe<4) ? (subframe+6) : (subframe-4);
......@@ -2517,6 +2529,7 @@ void prach_procedures(PHY_VARS_eNB *phy_vars_eNB,uint8_t sched_subframe,uint8_t
int8_t UE_id;
int subframe = phy_vars_eNB->proc[sched_subframe].subframe_rx;
int frame = phy_vars_eNB->proc[sched_subframe].frame_rx;
uint8_t CC_id = phy_vars_eNB->CC_id;
memset(&preamble_energy_list[0],0,64*sizeof(uint16_t));
memset(&preamble_delay_list[0],0,64*sizeof(uint16_t));
......@@ -2537,16 +2550,16 @@ void prach_procedures(PHY_VARS_eNB *phy_vars_eNB,uint8_t sched_subframe,uint8_t
for (UE_id=0;UE_id<NB_UE_INST;UE_id++) {
LOG_D(PHY,"[RAPROC] UE_id %d (%p), generate_prach %d, UE RSI %d, eNB RSI %d preamble index %d\n",
UE_id,PHY_vars_UE_g[UE_id],PHY_vars_UE_g[UE_id]->generate_prach,
PHY_vars_UE_g[UE_id]->lte_frame_parms.prach_config_common.rootSequenceIndex,
UE_id,PHY_vars_UE_g[UE_id][CC_id],PHY_vars_UE_g[UE_id][CC_id]->generate_prach,
PHY_vars_UE_g[UE_id][CC_id]->lte_frame_parms.prach_config_common.rootSequenceIndex,
phy_vars_eNB->lte_frame_parms.prach_config_common.rootSequenceIndex,
PHY_vars_UE_g[UE_id]->prach_PreambleIndex);
PHY_vars_UE_g[UE_id][CC_id]->prach_PreambleIndex);
if ((PHY_vars_UE_g[UE_id]->generate_prach==1) &&
(PHY_vars_UE_g[UE_id]->lte_frame_parms.prach_config_common.rootSequenceIndex ==
if ((PHY_vars_UE_g[UE_id][CC_id]->generate_prach==1) &&
(PHY_vars_UE_g[UE_id][CC_id]->lte_frame_parms.prach_config_common.rootSequenceIndex ==
phy_vars_eNB->lte_frame_parms.prach_config_common.rootSequenceIndex) ) {
preamble_energy_list[PHY_vars_UE_g[UE_id]->prach_PreambleIndex] = 80;
preamble_delay_list[PHY_vars_UE_g[UE_id]->prach_PreambleIndex] = 5;
preamble_energy_list[PHY_vars_UE_g[UE_id][CC_id]->prach_PreambleIndex] = 80;
preamble_delay_list[PHY_vars_UE_g[UE_id][CC_id]->prach_PreambleIndex] = 5;
}
}
......@@ -2581,6 +2594,7 @@ void prach_procedures(PHY_VARS_eNB *phy_vars_eNB,uint8_t sched_subframe,uint8_t
preamble_delay_list[preamble_max]);
#ifdef OPENAIR2
mac_xface->initiate_ra_proc(phy_vars_eNB->Mod_id,
phy_vars_eNB->CC_id,
frame,
preamble_max,
preamble_delay_list[preamble_max],
......@@ -2953,6 +2967,7 @@ void phy_procedures_eNB_RX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
phy_vars_eNB->eNB_UE_stats[i].mode = PRACH;
#ifdef OPENAIR2
mac_xface->cancel_ra_proc(phy_vars_eNB->Mod_id,
phy_vars_eNB->CC_id,
frame,
phy_vars_eNB->eNB_UE_stats[i].crnti);
#endif
......@@ -3051,6 +3066,7 @@ void phy_procedures_eNB_RX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
frame,harq_pid,i);
#endif
mac_xface->rx_sdu(phy_vars_eNB->Mod_id,
phy_vars_eNB->CC_id,
frame,
phy_vars_eNB->ulsch_eNB[i]->rnti,
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->b,
......@@ -3095,6 +3111,7 @@ void phy_procedures_eNB_RX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
#ifdef OPENAIR2
// if (phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->calibration_flag == 0) {
mac_xface->rx_sdu(phy_vars_eNB->Mod_id,
phy_vars_eNB->CC_id,
frame,
phy_vars_eNB->ulsch_eNB[i]->rnti,
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->b,
......@@ -3179,14 +3196,14 @@ void phy_procedures_eNB_RX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
(phy_vars_eNB->dlsch_eNB[i][0]->rnti>0)) { // check for PUCCH
// check SR availability
do_SR = is_SR_subframe(phy_vars_eNB,i,subframe);
do_SR = is_SR_subframe(phy_vars_eNB,i,sched_subframe);
// do_SR = 0;
// Now ACK/NAK
// First check subframe_tx flag for earlier subframes
get_n1_pucch_eNB(phy_vars_eNB,
i,
subframe,
sched_subframe,
&n1_pucch0,
&n1_pucch1,
&n1_pucch2,
......@@ -3242,6 +3259,7 @@ void phy_procedures_eNB_RX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
}
#ifdef OPENAIR2
mac_xface->SR_indication(phy_vars_eNB->Mod_id,
phy_vars_eNB->CC_id,
frame,
phy_vars_eNB->dlsch_eNB[i][0]->rnti,subframe);
#endif
......@@ -3544,6 +3562,7 @@ void phy_procedures_eNB_RX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
// detect if there is a CBA collision
if (phy_vars_eNB->cba_last_reception[i%num_active_cba_groups] == 0 ) {
mac_xface->rx_sdu(phy_vars_eNB->Mod_id,
phy_vars_eNB->CC_id,
frame,
phy_vars_eNB->ulsch_eNB[i]->rnti,
phy_vars_eNB->ulsch_eNB[i]->harq_processes[harq_pid]->b,
......@@ -3554,6 +3573,7 @@ void phy_procedures_eNB_RX(unsigned char sched_subframe,PHY_VARS_eNB *phy_vars_e
phy_vars_eNB->Mod_id,frame,subframe,
i,i%num_active_cba_groups );
mac_xface->SR_indication(phy_vars_eNB->Mod_id,
phy_vars_eNB->CC_id,
frame,
phy_vars_eNB->dlsch_eNB[i][0]->rnti,subframe);
}
......@@ -3617,7 +3637,7 @@ int phy_procedures_RN_eNB_TX(unsigned char last_slot, unsigned char next_slot, r
return do_proc;
}
#endif
void phy_procedures_eNB_lte(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,uint8_t abstraction_flag,
void phy_procedures_eNB_lte(unsigned char subframe,PHY_VARS_eNB **phy_vars_eNB,uint8_t abstraction_flag,
relaying_type_t r_type, PHY_VARS_RN *phy_vars_rn) {
#if defined(ENABLE_ITTI)
MessageDef *msg_p;
......@@ -3627,14 +3647,17 @@ void phy_procedures_eNB_lte(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,ui
int result;
#endif
int CC_id=0;
/*
if (phy_vars_eNB->proc[sched_subframe].frame_tx >= 1000)
mac_xface->macphy_exit("Exiting after 1000 Frames\n");
*/
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_SLOT_NUMBER_ENB, subframe*2);
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_ENB, phy_vars_eNB->proc[subframe].frame_tx);
vcd_signal_dumper_dump_variable_by_name(VCD_SIGNAL_DUMPER_VARIABLES_FRAME_NUMBER_ENB, phy_vars_eNB[0]->proc[subframe].frame_tx);
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_LTE,1);
start_meas(&phy_vars_eNB->phy_proc);
start_meas(&phy_vars_eNB[0]->phy_proc);
#if defined(ENABLE_ITTI)
do {
......@@ -3653,7 +3676,7 @@ void phy_procedures_eNB_lte(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,ui
{
hashtable_rc_t hashtable_rc;
hashtable_rc = hashtable_is_key_exists(PHY_vars_eNB_g[Mod_id]->ral_thresholds_timed, (uint64_t)(TIMER_HAS_EXPIRED(msg_p).timer_id));
hashtable_rc = hashtable_is_key_exists(PHY_vars_eNB_g[Mod_id][0]->ral_thresholds_timed, (uint64_t)(TIMER_HAS_EXPIRED(msg_p).timer_id));
if (hashtable_rc == HASH_TABLE_OK) {
phy_eNB_lte_check_measurement_thresholds(instance, (ral_threshold_phy_t*)TIMER_HAS_EXPIRED(msg_p).arg);
}
......@@ -3694,14 +3717,14 @@ void phy_procedures_eNB_lte(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,ui
switch (PHY_MEAS_THRESHOLD_REQ(msg_p).cfg_param.link_param_type.choice) {
case RAL_LINK_PARAM_TYPE_CHOICE_GEN:
SLIST_INSERT_HEAD(
&PHY_vars_eNB_g[Mod_id]->ral_thresholds_gen_polled[PHY_MEAS_THRESHOLD_REQ(msg_p).cfg_param.link_param_type._union.link_param_gen],
&PHY_vars_eNB_g[Mod_id][0]->ral_thresholds_gen_polled[PHY_MEAS_THRESHOLD_REQ(msg_p).cfg_param.link_param_type._union.link_param_gen],
threshold_phy_p,
ral_thresholds);
break;
case RAL_LINK_PARAM_TYPE_CHOICE_LTE:
SLIST_INSERT_HEAD(
&PHY_vars_eNB_g[Mod_id]->ral_thresholds_lte_polled[PHY_MEAS_THRESHOLD_REQ(msg_p).cfg_param.link_param_type._union.link_param_lte],
&PHY_vars_eNB_g[Mod_id][0]->ral_thresholds_lte_polled[PHY_MEAS_THRESHOLD_REQ(msg_p).cfg_param.link_param_type._union.link_param_lte],
threshold_phy_p,
ral_thresholds);
break;
......@@ -3723,7 +3746,7 @@ void phy_procedures_eNB_lte(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,ui
&timer_id);
if (res == 0) {
hashtable_rc = hashtable_insert(PHY_vars_eNB_g[Mod_id]->ral_thresholds_timed, (uint64_t )timer_id, (void*)threshold_phy_p);
hashtable_rc = hashtable_insert(PHY_vars_eNB_g[Mod_id][0]->ral_thresholds_timed, (uint64_t )timer_id, (void*)threshold_phy_p);
if (hashtable_rc == HASH_TABLE_OK) {
threshold_phy_p->timer_id = timer_id;
} else {
......@@ -3771,38 +3794,39 @@ void phy_procedures_eNB_lte(unsigned char subframe,PHY_VARS_eNB *phy_vars_eNB,ui
} while(msg_p != NULL);
#endif
if ((((phy_vars_eNB->lte_frame_parms.frame_type == TDD)&&
(subframe_select(&phy_vars_eNB->lte_frame_parms,phy_vars_eNB->proc[subframe].subframe_tx)==SF_DL))||
(phy_vars_eNB->lte_frame_parms.frame_type == FDD))) {
for (CC_id=0;CC_id<MAX_NUM_CCs; CC_id++) {
if ((((phy_vars_eNB[CC_id]->lte_frame_parms.frame_type == TDD)&&
(subframe_select(&phy_vars_eNB[CC_id]->lte_frame_parms,phy_vars_eNB[CC_id]->proc[subframe].subframe_tx)==SF_DL))||
(phy_vars_eNB[CC_id]->lte_frame_parms.frame_type == FDD))) {
#ifdef Rel10
if (phy_procedures_RN_eNB_TX(phy_vars_eNB->proc[subframe].subframe_rx, phy_vars_eNB->proc[subframe].subframe_tx, r_type) != 0 )
if (phy_procedures_RN_eNB_TX(phy_vars_eNB[CC_id]->proc[subframe].subframe_rx, phy_vars_eNB[CC_id]->proc[subframe].subframe_tx, r_type) != 0 )
#endif
phy_procedures_eNB_TX(subframe,phy_vars_eNB,abstraction_flag,r_type,phy_vars_rn);
}
if ((((phy_vars_eNB->lte_frame_parms.frame_type == TDD )&&
(subframe_select(&phy_vars_eNB->lte_frame_parms,phy_vars_eNB->proc[subframe].subframe_rx)==SF_UL)) ||
(phy_vars_eNB->lte_frame_parms.frame_type == FDD))){
phy_procedures_eNB_RX(subframe,phy_vars_eNB,abstraction_flag,r_type);
}
if (subframe_select(&phy_vars_eNB->lte_frame_parms,phy_vars_eNB->proc[subframe].subframe_tx)==SF_S) {
phy_procedures_eNB_TX(subframe,phy_vars_eNB[CC_id],abstraction_flag,r_type,phy_vars_rn);
}
if ((((phy_vars_eNB[CC_id]->lte_frame_parms.frame_type == TDD )&&
(subframe_select(&phy_vars_eNB[CC_id]->lte_frame_parms,phy_vars_eNB[CC_id]->proc[subframe].subframe_rx)==SF_UL)) ||
(phy_vars_eNB[CC_id]->lte_frame_parms.frame_type == FDD))){
phy_procedures_eNB_RX(subframe,phy_vars_eNB[CC_id],abstraction_flag,r_type);
}
if (subframe_select(&phy_vars_eNB[CC_id]->lte_frame_parms,phy_vars_eNB[CC_id]->proc[subframe].subframe_tx)==SF_S) {
#ifdef Rel10
if (phy_procedures_RN_eNB_TX(subframe, subframe, r_type) != 0 )
if (phy_procedures_RN_eNB_TX(subframe, subframe, r_type) != 0 )
#endif
phy_procedures_eNB_TX(subframe,phy_vars_eNB,abstraction_flag,r_type,phy_vars_rn);
}
if ((subframe_select(&phy_vars_eNB->lte_frame_parms,phy_vars_eNB->proc[subframe].subframe_rx)==SF_S)){
phy_procedures_eNB_S_RX(subframe,phy_vars_eNB,abstraction_flag,r_type);
}
phy_vars_eNB->proc[subframe].frame_tx++;
phy_vars_eNB->proc[subframe].frame_rx++;
if (phy_vars_eNB->proc[subframe].frame_tx==1024)
phy_vars_eNB->proc[subframe].frame_tx=0;
if (phy_vars_eNB->proc[subframe].frame_rx==1024)
phy_vars_eNB->proc[subframe].frame_rx=0;
phy_procedures_eNB_TX(subframe,phy_vars_eNB[CC_id],abstraction_flag,r_type,phy_vars_rn);
}
if ((subframe_select(&phy_vars_eNB[CC_id]->lte_frame_parms,phy_vars_eNB[CC_id]->proc[subframe].subframe_rx)==SF_S)){
phy_procedures_eNB_S_RX(subframe,phy_vars_eNB[CC_id],abstraction_flag,r_type);
}
phy_vars_eNB[CC_id]->proc[subframe].frame_tx++;
phy_vars_eNB[CC_id]->proc[subframe].frame_rx++;
if (phy_vars_eNB[CC_id]->proc[subframe].frame_tx==1024)
phy_vars_eNB[CC_id]->proc[subframe].frame_tx=0;
if (phy_vars_eNB[CC_id]->proc[subframe].frame_rx==1024)
phy_vars_eNB[CC_id]->proc[subframe].frame_rx=0;
}
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_LTE,0);
stop_meas(&phy_vars_eNB->phy_proc);
stop_meas(&phy_vars_eNB[0]->phy_proc);
}
......@@ -260,13 +260,13 @@ void dump_dlsch_ra(PHY_VARS_UE *phy_vars_ue,uint8_t eNB_id,uint8_t subframe) {
}
#endif
void phy_reset_ue(uint8_t Mod_id,uint8_t eNB_index) {
void phy_reset_ue(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) {
// This flushes ALL DLSCH and ULSCH harq buffers of ALL connected eNBs...add the eNB_index later
// for more flexibility
uint8_t i,j,k;
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id];
PHY_VARS_UE *phy_vars_ue = PHY_vars_UE_g[Mod_id][CC_id];
//[NUMBER_OF_CONNECTED_eNB_MAX][2];
for(i=0;i<NUMBER_OF_CONNECTED_eNB_MAX;i++) {
for(j=0;j<2;j++) {
......@@ -293,37 +293,37 @@ void phy_reset_ue(uint8_t Mod_id,uint8_t eNB_index) {
}
}
void ra_failed(uint8_t Mod_id,uint8_t eNB_index) {
void ra_failed(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) {
// if contention resolution fails, go back to PRACH
PHY_vars_UE_g[Mod_id]->UE_mode[eNB_index] = PRACH;
LOG_E(PHY,"[UE %d] Frame %d Random-access procedure fails, going back to PRACH, setting SIStatus = 0 and State RRC_IDLE\n",Mod_id,PHY_vars_UE_g[Mod_id]->frame);
PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_index] = PRACH;
LOG_E(PHY,"[UE %d] Frame %d Random-access procedure fails, going back to PRACH, setting SIStatus = 0 and State RRC_IDLE\n",Mod_id,PHY_vars_UE_g[Mod_id][CC_id]->frame);
//mac_xface->macphy_exit("");
// exit(-1);
}
void ra_succeeded(uint8_t Mod_id,uint8_t eNB_index) {
void ra_succeeded(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) {
int i;
LOG_I(PHY,"[UE %d][RAPROC] Frame %d Random-access procedure succeeded\n",Mod_id,PHY_vars_UE_g[Mod_id]->frame);
LOG_I(PHY,"[UE %d][RAPROC] Frame %d Random-access procedure succeeded\n",Mod_id,PHY_vars_UE_g[Mod_id][CC_id]->frame);
PHY_vars_UE_g[Mod_id]->ulsch_ue_Msg3_active[eNB_index] = 0;
PHY_vars_UE_g[Mod_id]->UE_mode[eNB_index] = PUSCH;
PHY_vars_UE_g[Mod_id][CC_id]->ulsch_ue_Msg3_active[eNB_index] = 0;
PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_index] = PUSCH;
for (i=0;i<8;i++) {
if (PHY_vars_UE_g[Mod_id]->ulsch_ue[eNB_index]->harq_processes[i]) {
PHY_vars_UE_g[Mod_id]->ulsch_ue[eNB_index]->harq_processes[i]->status=IDLE;
PHY_vars_UE_g[Mod_id]->dlsch_ue[eNB_index][0]->harq_processes[i]->round=0;
if (PHY_vars_UE_g[Mod_id][CC_id]->ulsch_ue[eNB_index]->harq_processes[i]) {
PHY_vars_UE_g[Mod_id][CC_id]->ulsch_ue[eNB_index]->harq_processes[i]->status=IDLE;
PHY_vars_UE_g[Mod_id][CC_id]->dlsch_ue[eNB_index][0]->harq_processes[i]->round=0;
}
}
}
UE_MODE_t get_ue_mode(uint8_t Mod_id,uint8_t eNB_index) {
UE_MODE_t get_ue_mode(uint8_t Mod_id,uint8_t CC_id,uint8_t eNB_index) {
return(PHY_vars_UE_g[Mod_id]->UE_mode[eNB_index]);
return(PHY_vars_UE_g[Mod_id][CC_id]->UE_mode[eNB_index]);
}
void process_timing_advance_rar(PHY_VARS_UE *phy_vars_ue,uint16_t timing_advance) {
......@@ -344,7 +344,7 @@ void process_timing_advance_rar(PHY_VARS_UE *phy_vars_ue,uint16_t timing_advance
}
void process_timing_advance(uint8_t Mod_id,int16_t timing_advance) {
void process_timing_advance(uint8_t Mod_id,uint8_t CC_id,int16_t timing_advance) {
// uint32_t frame = PHY_vars_UE_g[Mod_id]->frame;
......@@ -354,12 +354,12 @@ void process_timing_advance(uint8_t Mod_id,int16_t timing_advance) {
if (openair_daq_vars.manual_timing_advance == 0) {
//if ( (frame % 100) == 0) {
//if ((timing_advance > 3) || (timing_advance < -3) )
PHY_vars_UE_g[Mod_id]->timing_advance = cmax(0,(int)PHY_vars_UE_g[Mod_id]->timing_advance+timing_advance*4);
PHY_vars_UE_g[Mod_id][CC_id]->timing_advance = cmax(0,(int)PHY_vars_UE_g[Mod_id][CC_id]->timing_advance+timing_advance*4);
//}
}
LOG_I(PHY,"[UE %d] Got timing advance %d from MAC, new value %d\n",Mod_id, timing_advance, PHY_vars_UE_g[Mod_id]->timing_advance);
LOG_I(PHY,"[UE %d] Got timing advance %d from MAC, new value %d\n",Mod_id, timing_advance, PHY_vars_UE_g[Mod_id][CC_id]->timing_advance);
}
......@@ -628,7 +628,7 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB
int ulsch_end=0,overflow=0;
int k,l;
#endif
uint8_t CC_id=phy_vars_ue->CC_id;
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX,VCD_FUNCTION_IN);
......@@ -820,6 +820,7 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB
#ifdef OPENAIR2
// signal MAC that Msg3 was sent
mac_xface->Msg3_transmitted(phy_vars_ue->Mod_id,
phy_vars_ue->CC_id,
phy_vars_ue->frame,
eNB_id);
#endif
......@@ -833,6 +834,7 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB
//if (phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->calibration_flag == 0) {
access_mode=SCHEDULED_ACCESS;
mac_xface->ue_get_sdu(phy_vars_ue->Mod_id,
phy_vars_ue->CC_id,
phy_vars_ue->frame,
(next_slot>>1),
eNB_id,
......@@ -972,6 +974,7 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB
phy_vars_ue->ulsch_ue[eNB_id]->num_cba_dci[(next_slot>>1)]);
mac_xface->ue_get_sdu(phy_vars_ue->Mod_id,
phy_vars_ue->CC_id,
phy_vars_ue->frame,
(next_slot>>1),
eNB_id,
......@@ -1030,6 +1033,7 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB
phy_vars_ue->Mod_id,phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,phy_vars_ue->frame,next_slot>>1);
#ifdef OPENAIR2
SR_payload = mac_xface->ue_get_SR(phy_vars_ue->Mod_id,
phy_vars_ue->CC_id,
phy_vars_ue->frame,
eNB_id,
phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,
......@@ -1279,6 +1283,7 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB
// ask L2 for RACH transport
if ((mode != rx_calib_ue) && (mode != rx_calib_ue_med) && (mode != rx_calib_ue_byp) && (mode != no_L2_connect) ){
phy_vars_ue->prach_resources[eNB_id] = mac_xface->ue_get_rach(phy_vars_ue->Mod_id,
phy_vars_ue->CC_id,
phy_vars_ue->frame,
eNB_id,
next_slot>>1);
......@@ -1306,7 +1311,7 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB
phy_vars_ue->prach_resources[eNB_id]->ra_RNTI);
#ifdef OPENAIR2
phy_vars_ue->tx_power_dBm = phy_vars_ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER+get_PL(phy_vars_ue->Mod_id,eNB_id);
phy_vars_ue->tx_power_dBm = phy_vars_ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER+get_PL(phy_vars_ue->Mod_id,CC_id,eNB_id);
#else
phy_vars_ue->tx_power_dBm = UE_TX_POWER;
#endif
......@@ -1321,25 +1326,26 @@ void phy_procedures_UE_TX(uint8_t next_slot,PHY_VARS_UE *phy_vars_ue,uint8_t eNB
stop_meas(&phy_vars_ue->tx_prach);
LOG_D(PHY,"[UE %d][RAPROC] PRACH PL %d dB, power %d dBm, digital power %d dB (amp %d)\n",
phy_vars_ue->Mod_id,
get_PL(phy_vars_ue->Mod_id,eNB_id),
get_PL(phy_vars_ue->Mod_id,CC_id,eNB_id),
phy_vars_ue->tx_power_dBm,
dB_fixed(prach_power),
phy_vars_ue->lte_ue_prach_vars[eNB_id]->amp);
}
else {
UE_transport_info[phy_vars_ue->Mod_id].cntl.prach_flag=1;
UE_transport_info[phy_vars_ue->Mod_id].cntl.prach_id=phy_vars_ue->prach_resources[eNB_id]->ra_PreambleIndex;
UE_transport_info[phy_vars_ue->Mod_id][CC_id].cntl.prach_flag=1;
UE_transport_info[phy_vars_ue->Mod_id][CC_id].cntl.prach_id=phy_vars_ue->prach_resources[eNB_id]->ra_PreambleIndex;
#ifdef OPENAIR2
mac_xface->Msg1_transmitted(phy_vars_ue->Mod_id,
phy_vars_ue->frame,
eNB_id);
phy_vars_ue->CC_id,
phy_vars_ue->frame,
eNB_id);
#endif
}
LOG_D(PHY,"[UE %d][RAPROC] Frame %d, subframe %d: Generating PRACH (eNB %d) preamble index %d for UL, TX power %d dBm (PL %d dB), l3msg \n",
phy_vars_ue->Mod_id,phy_vars_ue->frame,next_slot>>1,eNB_id,
phy_vars_ue->prach_resources[eNB_id]->ra_PreambleIndex,
phy_vars_ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER+get_PL(phy_vars_ue->Mod_id,eNB_id),
get_PL(phy_vars_ue->Mod_id,eNB_id));
phy_vars_ue->prach_resources[eNB_id]->ra_PREAMBLE_RECEIVED_TARGET_POWER+get_PL(phy_vars_ue->Mod_id,CC_id,eNB_id),
get_PL(phy_vars_ue->Mod_id,CC_id,eNB_id));
}
}
......@@ -1848,6 +1854,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v
//uint16_t ra_RNTI;
uint8_t harq_pid;
int8_t UE_id;
uint8_t CC_id;
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PDCCH_PROCEDURES, VCD_FUNCTION_IN);
......@@ -1883,8 +1890,9 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v
}
#ifdef PHY_ABSTRACTION
else {
for (i=0;i<NB_eNB_INST;i++) {
if (PHY_vars_eNB_g[i]->lte_frame_parms.Nid_cell == phy_vars_ue->lte_frame_parms.Nid_cell)
for (i=0;i<NB_eNB_INST;i++)
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++){
if (PHY_vars_eNB_g[i][CC_id]->lte_frame_parms.Nid_cell == phy_vars_ue->lte_frame_parms.Nid_cell)
break;
}
if (i==NB_eNB_INST) {
......@@ -1895,13 +1903,13 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v
}
LOG_D(PHY,"Calling dci_decoding_proc_emul ...\n");
dci_cnt = dci_decoding_procedure_emul(phy_vars_ue->lte_ue_pdcch_vars,
PHY_vars_eNB_g[i]->num_ue_spec_dci[(last_slot>>1)&1],
PHY_vars_eNB_g[i]->num_common_dci[(last_slot>>1)&1],
PHY_vars_eNB_g[i]->dci_alloc[(last_slot>>1)&1],
PHY_vars_eNB_g[i][CC_id]->num_ue_spec_dci[(last_slot>>1)&1],
PHY_vars_eNB_g[i][CC_id]->num_common_dci[(last_slot>>1)&1],
PHY_vars_eNB_g[i][CC_id]->dci_alloc[(last_slot>>1)&1],
dci_alloc_rx,
eNB_id);
// printf("DCI: dci_cnt %d\n",dci_cnt);
UE_id = (uint32_t)find_ue((int16_t)phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,PHY_vars_eNB_g[i]);
UE_id = (uint32_t)find_ue((int16_t)phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,PHY_vars_eNB_g[i][CC_id]);
if (UE_id>=0) {
// msg("Checking PHICH for UE %d (eNB %d)\n",UE_id,i);
if (is_phich_subframe(&phy_vars_ue->lte_frame_parms,last_slot>>1)) {
......@@ -1914,7 +1922,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v
phy_vars_ue->ulsch_ue[eNB_id]->harq_processes[harq_pid]->round = 0;
LOG_D(PHY,"Msg3 inactive\n");
/* Phich is not abstracted for the moment
if (PHY_vars_eNB_g[i]->ulsch_eNB[(uint32_t)UE_id]->harq_processes[harq_pid]->phich_ACK==0) { // NAK
if (PHY_vars_eNB_g[i][CC_id]->ulsch_eNB[(uint32_t)UE_id]->harq_processes[harq_pid]->phich_ACK==0) { // NAK
if (phy_vars_ue->ulsch_ue_Msg3_active[eNB_id] == 1) {
#ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[UE %d][RAPROC] Frame %d, subframe %d: Msg3 PHICH, received NAK\n",
......@@ -1928,9 +1936,9 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v
&phy_vars_ue->ulsch_ue_Msg3_frame[eNB_id],
&phy_vars_ue->ulsch_ue_Msg3_subframe[eNB_id]);
}
// PHY_vars_eNB_g[i]->ulsch_eNB[UE_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 1;
// PHY_vars_eNB_g[i]->ulsch_eNB[UE_id]->harq_processes[harq_pid]->Ndi = 0;
// PHY_vars_eNB_g[i]->ulsch_eNB[UE_id]->harq_processes[harq_pid]->round++;
// PHY_vars_eNB_g[i][CC_id]->ulsch_eNB[UE_id]->harq_processes[harq_pid]->subframe_scheduling_flag = 1;
// PHY_vars_eNB_g[i][CC_id]->ulsch_eNB[UE_id]->harq_processes[harq_pid]->Ndi = 0;
// PHY_vars_eNB_g[i][CC_id]->ulsch_eNB[UE_id]->harq_processes[harq_pid]->round++;
}
else {
#ifdef DEBUG_PHY_PROC
......@@ -1940,8 +1948,8 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v
phy_vars_ue->frame,
last_slot>>1);
#endif
PHY_vars_eNB_g[i]->ulsch_eNB[UE_id]->harq_processes[harq_pid]->subframe_scheduling_flag =0;
PHY_vars_eNB_g[i]->ulsch_eNB[UE_id]->harq_processes[harq_pid]->status = IDLE;
PHY_vars_eNB_g[i][CC_id]->ulsch_eNB[UE_id]->harq_processes[harq_pid]->subframe_scheduling_flag =0;
PHY_vars_eNB_g[i][CC_id]->ulsch_eNB[UE_id]->harq_processes[harq_pid]->status = IDLE;
// inform MAC?
phy_vars_ue->ulsch_ue_Msg3_active[eNB_id] = 0;
} //phich_ACK */
......@@ -2535,6 +2543,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v
#endif
#ifdef OPENAIR2
mac_xface->ue_send_sdu(phy_vars_ue->Mod_id,
phy_vars_ue->CC_id,
phy_vars_ue->frame,
phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[phy_vars_ue->dlsch_ue[eNB_id][0]->current_harq_pid]->b,
phy_vars_ue->dlsch_ue[eNB_id][0]->harq_processes[phy_vars_ue->dlsch_ue[eNB_id][0]->current_harq_pid]->TBS>>3,
......@@ -2692,6 +2701,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v
printf("\n");
*/
mac_xface->ue_decode_si(phy_vars_ue->Mod_id,
phy_vars_ue->CC_id,
phy_vars_ue->frame,
eNB_id,
phy_vars_ue->dlsch_ue_SI[eNB_id]->harq_processes[0]->b,
......@@ -2820,6 +2830,7 @@ int lte_ue_pdcch_procedures(uint8_t eNB_id,uint8_t last_slot, PHY_VARS_UE *phy_v
phy_vars_ue->prach_resources[eNB_id]->ra_PreambleIndex);
timing_advance = mac_xface->ue_process_rar(phy_vars_ue->Mod_id,
phy_vars_ue->CC_id,
phy_vars_ue->frame-(((last_slot>>1)==0) ? 1 : 0),
phy_vars_ue->dlsch_ue_ra[eNB_id]->harq_processes[0]->b,
&phy_vars_ue->lte_ue_pdcch_vars[eNB_id]->crnti,
......
......@@ -57,7 +57,7 @@ int8_t pucch_power_cntl(PHY_VARS_UE *phy_vars_ue,uint8_t subframe,uint8_t eNB_id
phy_vars_ue->g_pucch[eNB_id] = 0;
Po_PUCCH = get_PL(phy_vars_ue->Mod_id,eNB_id)+
Po_PUCCH = get_PL(phy_vars_ue->Mod_id,phy_vars_ue->CC_id,eNB_id)+
phy_vars_ue->lte_frame_parms.ul_power_control_config_common.p0_NominalPUCCH+
phy_vars_ue->g_pucch[eNB_id];
switch (pucch_fmt) {
......@@ -93,7 +93,7 @@ int8_t pucch_power_cntl(PHY_VARS_UE *phy_vars_ue,uint8_t subframe,uint8_t eNB_id
phy_vars_ue->dlsch_ue[eNB_id][0]->rnti,phy_vars_ue->frame,subframe,
Po_PUCCH,
phy_vars_ue->lte_frame_parms.ul_power_control_config_common.p0_NominalPUCCH,
get_PL(phy_vars_ue->Mod_id,eNB_id),
get_PL(phy_vars_ue->Mod_id,phy_vars_ue->CC_id,eNB_id),
phy_vars_ue->g_pucch[eNB_id]);
}
else {
......@@ -102,7 +102,7 @@ int8_t pucch_power_cntl(PHY_VARS_UE *phy_vars_ue,uint8_t subframe,uint8_t eNB_id
phy_vars_ue->dlsch_ue[eNB_id][0]->rnti,phy_vars_ue->frame,subframe,
Po_PUCCH,
phy_vars_ue->lte_frame_parms.ul_power_control_config_common.p0_NominalPUCCH,
get_PL(phy_vars_ue->Mod_id,eNB_id),
get_PL(phy_vars_ue->Mod_id,phy_vars_ue->CC_id,eNB_id),
phy_vars_ue->g_pucch[eNB_id]);
}
return(Po_PUCCH);
......
......@@ -85,7 +85,7 @@ void pusch_power_cntl(PHY_VARS_UE *phy_vars_ue,uint8_t subframe,uint8_t eNB_id,u
// P_opusch(0) = P_oPTR + deltaP_Msg3 if PUSCH is transporting Msg3
// else
// P_opusch(0) = PO_NOMINAL_PUSCH(j) + P_O_UE_PUSCH(j)
PL = get_PL(phy_vars_ue->Mod_id,eNB_id);
PL = get_PL(phy_vars_ue->Mod_id,phy_vars_ue->CC_id,eNB_id);
phy_vars_ue->ulsch_ue[eNB_id]->Po_PUSCH = (hundred_times_log10_NPRB[nb_rb-1]+
get_hundred_times_delta_IF(phy_vars_ue,eNB_id,harq_pid) +
......@@ -93,11 +93,11 @@ void pusch_power_cntl(PHY_VARS_UE *phy_vars_ue,uint8_t subframe,uint8_t eNB_id,u
if( phy_vars_ue->ulsch_ue_Msg3_active[eNB_id] == 1) { // Msg3 PUSCH
phy_vars_ue->ulsch_ue[eNB_id]->Po_PUSCH += (mac_xface->get_Po_NOMINAL_PUSCH(phy_vars_ue->Mod_id) + PL);
phy_vars_ue->ulsch_ue[eNB_id]->Po_PUSCH += (mac_xface->get_Po_NOMINAL_PUSCH(phy_vars_ue->Mod_id,0) + PL);
LOG_D(PHY,"[UE %d][RAPROC] frame %d, subframe %d: Msg3 Po_PUSCH %d dBm (%d,%d,%d,%d,%d)\n",
phy_vars_ue->Mod_id,((subframe==0)?1:0)+phy_vars_ue->frame,subframe,phy_vars_ue->ulsch_ue[eNB_id]->Po_PUSCH,
100*mac_xface->get_Po_NOMINAL_PUSCH(phy_vars_ue->Mod_id),
100*mac_xface->get_Po_NOMINAL_PUSCH(phy_vars_ue->Mod_id,0),
hundred_times_log10_NPRB[nb_rb-1],
100*PL,
get_hundred_times_delta_IF(phy_vars_ue,eNB_id,harq_pid),
......@@ -130,8 +130,8 @@ void pusch_power_cntl(PHY_VARS_UE *phy_vars_ue,uint8_t subframe,uint8_t eNB_id,u
}
int8_t get_PHR(uint8_t Mod_id, uint8_t eNB_index){
int8_t get_PHR(uint8_t Mod_id, uint8_t CC_id,uint8_t eNB_index){
return PHY_vars_UE_g[Mod_id]->ulsch_ue[eNB_index]->PHR;
return PHY_vars_UE_g[Mod_id][CC_id]->ulsch_ue[eNB_index]->PHR;
}
......@@ -155,7 +155,7 @@ int emu_transport_handle_enb_info(bypass_msg_header_t *messg,
{
eNB_transport_info_t *eNB_info;
int total_header = 0, total_tbs = 0;
int n_dci, n_enb, enb_info_ix = 0;
int n_dci, n_enb, enb_info_ix = 0,CC_id;
DevAssert(bytes_read >= 0);
DevAssert(messg != NULL);
......@@ -196,9 +196,10 @@ int emu_transport_handle_enb_info(bypass_msg_header_t *messg,
for (n_enb = oai_emulation.info.master[messg->master_id].first_enb;
n_enb < oai_emulation.info.master[messg->master_id].first_enb +
oai_emulation.info.master[messg->master_id].nb_enb; n_enb ++) {
fill_phy_enb_vars(n_enb, next_slot);
}
oai_emulation.info.master[messg->master_id].nb_enb; n_enb ++)
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
fill_phy_enb_vars(n_enb, CC_id,next_slot);
}
} else {
LOG_T(EMU,"WAIT_ENB_TRANSPORT state: no enb transport info from master %d \n",
messg->master_id);
......@@ -217,7 +218,7 @@ int emu_transport_handle_ue_info(bypass_msg_header_t *messg,
int bytes_read)
{
UE_transport_info_t *UE_info;
int n_ue, n_enb;
int n_ue, n_enb,CC_id;
int total_tbs = 0, total_header = 0, ue_info_ix =0;
DevAssert(bytes_read >= 0);
......@@ -249,7 +250,7 @@ int emu_transport_handle_ue_info(bypass_msg_header_t *messg,
n_ue, total_header+total_tbs,total_header,total_tbs);
}
memcpy(&UE_transport_info[n_ue], UE_info, total_header + total_tbs);
memcpy(&UE_transport_info[n_ue][CC_id], UE_info, total_header + total_tbs);
/* Go to the next UE info */
UE_info = (UE_transport_info_t *)((uintptr_t)UE_info + total_header+
......@@ -260,9 +261,10 @@ int emu_transport_handle_ue_info(bypass_msg_header_t *messg,
for (n_ue = oai_emulation.info.master[messg->master_id].first_ue;
n_ue < oai_emulation.info.master[messg->master_id].first_ue +
oai_emulation.info.master[messg->master_id].nb_ue;
n_ue ++) {
fill_phy_ue_vars(n_ue, last_slot);
}
n_ue ++)
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
fill_phy_ue_vars(n_ue, CC_id,last_slot);
}
} else {
LOG_T(EMU,"WAIT_UE_TRANSPORT state: no UE transport info from master %d\n",
messg->master_id);
......@@ -510,7 +512,7 @@ void bypass_tx_data(emu_transport_info_t Type, unsigned int frame, unsigned int
LOG_D(EMU, "Entering bypass_tx [%s] for frame %d next_slot %d\n",
map_int_to_str(transport_names, Type), frame, next_slot);
int n_enb,n_ue, n_dci,total_tbs=0,total_size=0;
int n_enb,n_ue, CC_id,n_dci,total_tbs=0,total_size=0;
messg = (bypass_msg_header_t *) (
&bypass_tx_buffer[sizeof (bypass_proto2multicast_header_t)]);
num_flows = 0;
......@@ -565,13 +567,14 @@ void bypass_tx_data(emu_transport_info_t Type, unsigned int frame, unsigned int
total_tbs=0;
for (n_enb=oai_emulation.info.first_enb_local;
n_enb<(oai_emulation.info.first_enb_local+oai_emulation.info.nb_enb_local);
n_enb++) {
n_enb++)
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
total_tbs=0;
for (n_dci = 0; n_dci < (eNB_transport_info[n_enb].num_pmch +
eNB_transport_info[n_enb].num_ue_spec_dci +
eNB_transport_info[n_enb].num_common_dci);
for (n_dci = 0; n_dci < (eNB_transport_info[n_enb][CC_id].num_pmch +
eNB_transport_info[n_enb][CC_id].num_ue_spec_dci +
eNB_transport_info[n_enb][CC_id].num_common_dci);
n_dci++) {
total_tbs +=eNB_transport_info[n_enb].tbs[n_dci];
total_tbs +=eNB_transport_info[n_enb][CC_id].tbs[n_dci];
}
if (total_tbs <= MAX_TRANSPORT_BLOCKS_BUFFER_SIZE) {
total_size = sizeof(eNB_transport_info_t) + total_tbs -
......@@ -581,7 +584,7 @@ void bypass_tx_data(emu_transport_info_t Type, unsigned int frame, unsigned int
"[eNB]running out of memory for the eNB emulation transport buffer of size %d\n",
MAX_TRANSPORT_BLOCKS_BUFFER_SIZE);
}
memcpy(&bypass_tx_buffer[byte_tx_count], (char *)&eNB_transport_info[n_enb],
memcpy(&bypass_tx_buffer[byte_tx_count], (char *)&eNB_transport_info[n_enb][CC_id],
total_size);
byte_tx_count += total_size;
}
......@@ -593,8 +596,8 @@ void bypass_tx_data(emu_transport_info_t Type, unsigned int frame, unsigned int
for (n_ue = oai_emulation.info.first_ue_local;
n_ue < (oai_emulation.info.first_ue_local+oai_emulation.info.nb_ue_local);
n_ue++) {
for (n_enb=0; n_enb<UE_transport_info[n_ue].num_eNB; n_enb++) {
total_tbs+=UE_transport_info[n_ue].tbs[n_enb];
for (n_enb=0; n_enb<UE_transport_info[n_ue][CC_id].num_eNB; n_enb++) {
total_tbs+=UE_transport_info[n_ue][CC_id].tbs[n_enb];
}
if (total_tbs <= MAX_TRANSPORT_BLOCKS_BUFFER_SIZE) {
total_size = sizeof(UE_transport_info_t)+total_tbs-
......@@ -604,7 +607,7 @@ void bypass_tx_data(emu_transport_info_t Type, unsigned int frame, unsigned int
"[UE]running out of memory for the UE emulation transport buffer of size %d\n",
MAX_TRANSPORT_BLOCKS_BUFFER_SIZE);
}
memcpy(&bypass_tx_buffer[byte_tx_count], (char *)&UE_transport_info[n_ue],
memcpy(&bypass_tx_buffer[byte_tx_count], (char *)&UE_transport_info[n_ue][CC_id],
total_size);
byte_tx_count += total_size;
}
......
......@@ -215,28 +215,32 @@ unsigned int emul_rx_handler(unsigned char Mode,char *rx_buffer,
void clear_eNB_transport_info(uint8_t nb_eNB)
{
uint8_t eNB_id;
uint8_t CC_id;
for (eNB_id=0; eNB_id<nb_eNB; eNB_id++) {
eNB_transport_info_TB_index[eNB_id]=0;
memset((void *)&eNB_transport_info[eNB_id].cntl,0,sizeof(eNB_cntl));
eNB_transport_info[eNB_id].num_common_dci=0;
eNB_transport_info[eNB_id].num_ue_spec_dci=0;
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++) {
eNB_transport_info_TB_index[eNB_id][CC_id]=0;
memset((void *)&eNB_transport_info[eNB_id][CC_id].cntl,0,sizeof(eNB_cntl));
eNB_transport_info[eNB_id][CC_id].num_common_dci=0;
eNB_transport_info[eNB_id][CC_id].num_ue_spec_dci=0;
}
}
// LOG_T(EMU, "EMUL clear_eNB_transport_info\n");
}
void clear_UE_transport_info(uint8_t nb_UE)
{
uint8_t UE_id;
uint8_t UE_id,CC_id;
for (UE_id=0; UE_id<nb_UE; UE_id++) {
UE_transport_info_TB_index[UE_id]=0;
memset((void *)&UE_transport_info[UE_id].cntl,0,sizeof(UE_cntl));
for (UE_id=0; UE_id<nb_UE; UE_id++)
for (CC_id=0;CC_id<MAX_NUM_CCs;CC_id++){
UE_transport_info_TB_index[UE_id][CC_id]=0;
memset((void *)&UE_transport_info[UE_id][CC_id].cntl,0,sizeof(UE_cntl));
}
// LOG_T(EMU, "EMUL clear_UE_transport_info\n");
}
void fill_phy_enb_vars(unsigned int enb_id, unsigned int next_slot)
void fill_phy_enb_vars(unsigned int enb_id, uint8_t CC_id,unsigned int next_slot)
{
int n_dci = 0, n_dci_dl;
int payload_offset = 0;
......@@ -253,11 +257,11 @@ void fill_phy_enb_vars(unsigned int enb_id, unsigned int next_slot)
// eNB
// PBCH : copy payload
*(uint32_t *)PHY_vars_eNB_g[enb_id]->pbch_pdu =
eNB_transport_info[enb_id].cntl.pbch_payload;
*(uint32_t *)PHY_vars_eNB_g[enb_id][CC_id]->pbch_pdu =
eNB_transport_info[enb_id][CC_id].cntl.pbch_payload;
/* LOG_I(EMU," RX slot %d ENB TRANSPORT pbch payload %d pdu[0] %d pdu[0] %d \n",
next_slot ,
eNB_transport_info[enb_id].cntl.pbch_payload,
eNB_transport_info[enb_id][CC_id].cntl.pbch_payload,
((uint8_t*)PHY_vars_eNB_g[enb_id]->pbch_pdu)[0],
((uint8_t*)PHY_vars_eNB_g[enb_id]->pbch_pdu)[1]);
*/
......@@ -269,19 +273,19 @@ void fill_phy_enb_vars(unsigned int enb_id, unsigned int next_slot)
// to be added later
//DCI
nb_total_dci= eNB_transport_info[enb_id].num_pmch +
eNB_transport_info[enb_id].num_ue_spec_dci +
eNB_transport_info[enb_id].num_common_dci;
nb_total_dci= eNB_transport_info[enb_id][CC_id].num_pmch +
eNB_transport_info[enb_id][CC_id].num_ue_spec_dci +
eNB_transport_info[enb_id][CC_id].num_common_dci;
PHY_vars_eNB_g[enb_id]->num_ue_spec_dci[(next_slot>>1)&1] =
eNB_transport_info[enb_id].num_ue_spec_dci;
PHY_vars_eNB_g[enb_id]->num_common_dci[(next_slot>>1)&1] =
eNB_transport_info[enb_id].num_common_dci;
PHY_vars_eNB_g[enb_id][CC_id]->num_ue_spec_dci[(next_slot>>1)&1] =
eNB_transport_info[enb_id][CC_id].num_ue_spec_dci;
PHY_vars_eNB_g[enb_id][CC_id]->num_common_dci[(next_slot>>1)&1] =
eNB_transport_info[enb_id][CC_id].num_common_dci;
if (nb_total_dci >0) {
memcpy(PHY_vars_eNB_g[enb_id]->dci_alloc[(next_slot>>1)&1],
eNB_transport_info[enb_id].dci_alloc,
memcpy(PHY_vars_eNB_g[enb_id][CC_id]->dci_alloc[(next_slot>>1)&1],
eNB_transport_info[enb_id][CC_id].dci_alloc,
(nb_total_dci) * sizeof(DCI_ALLOC_t));
n_dci_dl=0;
......@@ -289,81 +293,81 @@ void fill_phy_enb_vars(unsigned int enb_id, unsigned int next_slot)
for (n_dci = 0; n_dci < nb_total_dci; n_dci++) {
//exclude ul dci
if ((eNB_transport_info[enb_id].dci_alloc[n_dci_dl].format > 0) || (eNB_transport_info[enb_id].num_pmch > 0 )) {
if ((eNB_transport_info[enb_id][CC_id].dci_alloc[n_dci_dl].format > 0) || (eNB_transport_info[enb_id][CC_id].num_pmch > 0 )) {
#ifdef DEBUG_EMU
LOG_D(EMU, "dci spec %d common %d pmch %d tbs is %d payload offset %d\n",
eNB_transport_info[enb_id].num_ue_spec_dci,
eNB_transport_info[enb_id].num_common_dci,
eNB_transport_info[enb_id].num_pmch,
eNB_transport_info[enb_id].tbs[n_dci_dl],
eNB_transport_info[enb_id][CC_id].num_ue_spec_dci,
eNB_transport_info[enb_id][CC_id].num_common_dci,
eNB_transport_info[enb_id][CC_id].num_pmch,
eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl],
payload_offset);
#endif
switch (eNB_transport_info[enb_id].dlsch_type[n_dci_dl]) {
switch (eNB_transport_info[enb_id][CC_id].dlsch_type[n_dci_dl]) {
case 0: //SI:
memcpy(PHY_vars_eNB_g[enb_id]->dlsch_eNB_SI->harq_processes[0]->b,
&eNB_transport_info[enb_id].transport_blocks[payload_offset],
eNB_transport_info[enb_id].tbs[n_dci_dl]);
memcpy(PHY_vars_eNB_g[enb_id][CC_id]->dlsch_eNB_SI->harq_processes[0]->b,
&eNB_transport_info[enb_id][CC_id].transport_blocks[payload_offset],
eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]);
#ifdef DEBUG_EMU
LOG_D(EMU, "SI eNB_transport_info[enb_id].tbs[n_dci_dl]%d \n",
eNB_transport_info[enb_id].tbs[n_dci_dl]);
LOG_D(EMU, "SI eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]%d \n",
eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]);
#endif
break;
case 1: //RA:
memcpy(PHY_vars_eNB_g[enb_id]->dlsch_eNB_ra->harq_processes[0]->b,
&eNB_transport_info[enb_id].transport_blocks[payload_offset],
eNB_transport_info[enb_id].tbs[n_dci_dl]);
memcpy(PHY_vars_eNB_g[enb_id][CC_id]->dlsch_eNB_ra->harq_processes[0]->b,
&eNB_transport_info[enb_id][CC_id].transport_blocks[payload_offset],
eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]);
#ifdef DEBUG_EMU
LOG_D(EMU, "RA eNB_transport_info[enb_id].tbs[n_dci_dl]%d \n",
eNB_transport_info[enb_id].tbs[n_dci_dl]);
LOG_D(EMU, "RA eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]%d \n",
eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]);
#endif
break;
case 2://TB0:
harq_pid = eNB_transport_info[enb_id].harq_pid[n_dci_dl];
ue_id = eNB_transport_info[enb_id].ue_id[n_dci_dl];
PHY_vars_eNB_g[enb_id]->dlsch_eNB[ue_id][0]->rnti=
eNB_transport_info[enb_id].dci_alloc[n_dci_dl].rnti;
dlsch_eNB = PHY_vars_eNB_g[enb_id]->dlsch_eNB[ue_id][0];
harq_pid = eNB_transport_info[enb_id][CC_id].harq_pid[n_dci_dl];
ue_id = eNB_transport_info[enb_id][CC_id].ue_id[n_dci_dl];
PHY_vars_eNB_g[enb_id][CC_id]->dlsch_eNB[ue_id][0]->rnti=
eNB_transport_info[enb_id][CC_id].dci_alloc[n_dci_dl].rnti;
dlsch_eNB = PHY_vars_eNB_g[enb_id][CC_id]->dlsch_eNB[ue_id][0];
#ifdef DEBUG_EMU
LOG_D(EMU,
" enb_id %d ue id is %d rnti is %x dci index %d, harq_pid %d tbs %d \n",
enb_id, ue_id, eNB_transport_info[enb_id].dci_alloc[n_dci_dl].rnti,
n_dci_dl, harq_pid, eNB_transport_info[enb_id].tbs[n_dci_dl]);
for (i=0; i<eNB_transport_info[enb_id].tbs[n_dci_dl]; i++) {
enb_id, ue_id, eNB_transport_info[enb_id][CC_id].dci_alloc[n_dci_dl].rnti,
n_dci_dl, harq_pid, eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]);
for (i=0; i<eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]; i++) {
LOG_T(EMU, "%x.",
(unsigned char) eNB_transport_info[enb_id].transport_blocks[payload_offset+i]);
(unsigned char) eNB_transport_info[enb_id][CC_id].transport_blocks[payload_offset+i]);
}
#endif
memcpy(dlsch_eNB->harq_processes[harq_pid]->b,
&eNB_transport_info[enb_id].transport_blocks[payload_offset],
eNB_transport_info[enb_id].tbs[n_dci_dl]);
&eNB_transport_info[enb_id][CC_id].transport_blocks[payload_offset],
eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]);
break;
case 3://TB1:
harq_pid = eNB_transport_info[enb_id].harq_pid[n_dci_dl];
ue_id = eNB_transport_info[enb_id].ue_id[n_dci_dl];
PHY_vars_eNB_g[enb_id]->dlsch_eNB[ue_id][1]->rnti=
eNB_transport_info[enb_id].dci_alloc[n_dci_dl].rnti;
dlsch_eNB = PHY_vars_eNB_g[enb_id]->dlsch_eNB[ue_id][1];
harq_pid = eNB_transport_info[enb_id][CC_id].harq_pid[n_dci_dl];
ue_id = eNB_transport_info[enb_id][CC_id].ue_id[n_dci_dl];
PHY_vars_eNB_g[enb_id][CC_id]->dlsch_eNB[ue_id][1]->rnti=
eNB_transport_info[enb_id][CC_id].dci_alloc[n_dci_dl].rnti;
dlsch_eNB = PHY_vars_eNB_g[enb_id][CC_id]->dlsch_eNB[ue_id][1];
memcpy(dlsch_eNB->harq_processes[harq_pid]->b,
&eNB_transport_info[enb_id].transport_blocks[payload_offset],
eNB_transport_info[enb_id].tbs[n_dci_dl]);
&eNB_transport_info[enb_id][CC_id].transport_blocks[payload_offset],
eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]);
break;
case 5:
memcpy(PHY_vars_eNB_g[enb_id]->dlsch_eNB_MCH->harq_processes[0]->b,
&eNB_transport_info[enb_id].transport_blocks[payload_offset],
eNB_transport_info[enb_id].tbs[n_dci_dl]);
memcpy(PHY_vars_eNB_g[enb_id][CC_id]->dlsch_eNB_MCH->harq_processes[0]->b,
&eNB_transport_info[enb_id][CC_id].transport_blocks[payload_offset],
eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]);
#ifdef DEBUG_EMU
LOG_D(EMU, "PMCH eNB_transport_info[enb_id].tbs[n_dci_dl] %d \n",
eNB_transport_info[enb_id].tbs[n_dci_dl]);
LOG_D(EMU, "PMCH eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl] %d \n",
eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl]);
#endif
break;
default:
LOG_W(EMU,"not supported dlsch type %d \n", eNB_transport_info[enb_id].dlsch_type[n_dci_dl]);
LOG_W(EMU,"not supported dlsch type %d \n", eNB_transport_info[enb_id][CC_id].dlsch_type[n_dci_dl]);
break;
}
payload_offset += eNB_transport_info[enb_id].tbs[n_dci_dl];
payload_offset += eNB_transport_info[enb_id][CC_id].tbs[n_dci_dl];
}
n_dci_dl++;
}
......@@ -373,7 +377,7 @@ void fill_phy_enb_vars(unsigned int enb_id, unsigned int next_slot)
}
}
void fill_phy_ue_vars(unsigned int ue_id, unsigned int last_slot)
void fill_phy_ue_vars(unsigned int ue_id, uint8_t CC_id,unsigned int last_slot)
{
int n_enb;//index
int enb_id;
......@@ -386,7 +390,7 @@ void fill_phy_ue_vars(unsigned int ue_id, unsigned int last_slot)
// uint8_t ue_transport_info_index[NUMBER_OF_eNB_MAX];
uint8_t subframe = (last_slot+1)>>1;
memcpy(&ue_cntl_delay[ue_id][(last_slot+1)%2], &UE_transport_info[ue_id].cntl,
memcpy(&ue_cntl_delay[ue_id][CC_id][(last_slot+1)%2], &UE_transport_info[ue_id][CC_id].cntl,
sizeof(UE_cntl));
#ifdef DEBUG_EMU
......@@ -394,93 +398,93 @@ void fill_phy_ue_vars(unsigned int ue_id, unsigned int last_slot)
"Last slot %d subframe %d Fill phy UE %d vars PRACH is (%d,%d) preamble (%d,%d) SR (%d,%d), pucch_sel (%d, %d)\n",
last_slot,subframe,ue_id,
UE_transport_info[ue_id].cntl.prach_flag,
ue_cntl_delay[ue_id][last_slot%2].prach_flag,
UE_transport_info[ue_id].cntl.prach_id,
ue_cntl_delay[ue_id][last_slot%2].prach_id,
UE_transport_info[ue_id].cntl.sr,
ue_cntl_delay[ue_id][last_slot%2].sr,
UE_transport_info[ue_id].cntl.pucch_sel,
ue_cntl_delay[ue_id][last_slot%2].pucch_sel);
UE_transport_info[ue_id][CC_id].cntl.prach_flag,
ue_cntl_delay[ue_id][CC_id][last_slot%2].prach_flag,
UE_transport_info[ue_id][CC_id].cntl.prach_id,
ue_cntl_delay[ue_id][CC_id][last_slot%2].prach_id,
UE_transport_info[ue_id][CC_id].cntl.sr,
ue_cntl_delay[ue_id][CC_id][last_slot%2].sr,
UE_transport_info[ue_id][CC_id].cntl.pucch_sel,
ue_cntl_delay[ue_id][CC_id][last_slot%2].pucch_sel);
#endif
//ue_cntl_delay[subframe%2].prach_flag ;
PHY_vars_UE_g[ue_id]->generate_prach = ue_cntl_delay[ue_id][last_slot%2].prach_flag;//UE_transport_info[ue_id].cntl.prach_flag;
if (PHY_vars_UE_g[ue_id]->generate_prach == 1) {
// if (PHY_vars_UE_g[ue_id]->prach_resources[enb_id] == NULL)
// PHY_vars_UE_g[ue_id]->prach_resources[enb_id] = malloc(sizeof(PRACH_RESOURCES_t));
PHY_vars_UE_g[ue_id][CC_id]->generate_prach = ue_cntl_delay[ue_id][CC_id][last_slot%2].prach_flag;//UE_transport_info[ue_id][CC_id].cntl.prach_flag;
if (PHY_vars_UE_g[ue_id][CC_id]->generate_prach == 1) {
// if (PHY_vars_UE_g[ue_id][CC_id]->prach_resources[enb_id] == NULL)
// PHY_vars_UE_g[ue_id][CC_id]->prach_resources[enb_id] = malloc(sizeof(PRACH_RESOURCES_t));
//ue_cntl_delay[subframe%2].prach_id;
PHY_vars_UE_g[ue_id]->prach_PreambleIndex =
ue_cntl_delay[ue_id][last_slot%2].prach_id;
PHY_vars_UE_g[ue_id][CC_id]->prach_PreambleIndex =
ue_cntl_delay[ue_id][CC_id][last_slot%2].prach_id;
}
pucch_format= ue_cntl_delay[ue_id][last_slot%2].pucch_flag;// UE_transport_info[ue_id].cntl.pucch_flag;
pucch_format= ue_cntl_delay[ue_id][CC_id][last_slot%2].pucch_flag;// UE_transport_info[ue_id][CC_id].cntl.pucch_flag;
if ((last_slot + 1) % 2 == 0) {
if (pucch_format == pucch_format1) { // UE_transport_info[ue_id].cntl.sr;
PHY_vars_UE_g[ue_id]->sr[subframe] = ue_cntl_delay[ue_id][last_slot%2].sr;
if (pucch_format == pucch_format1) { // UE_transport_info[ue_id][CC_id].cntl.sr;
PHY_vars_UE_g[ue_id][CC_id]->sr[subframe] = ue_cntl_delay[ue_id][CC_id][last_slot%2].sr;
} else if ((pucch_format == pucch_format1a) ||
(pucch_format == pucch_format1b)) {
PHY_vars_UE_g[ue_id]->pucch_payload[0] = ue_cntl_delay[ue_id][last_slot%2].pucch_payload;
//UE_transport_info[ue_id].cntl.pucch_payload;
PHY_vars_UE_g[ue_id][CC_id]->pucch_payload[0] = ue_cntl_delay[ue_id][CC_id][last_slot%2].pucch_payload;
//UE_transport_info[ue_id][CC_id].cntl.pucch_payload;
}
PHY_vars_UE_g[ue_id]->pucch_sel[subframe] =
ue_cntl_delay[ue_id][last_slot%2].pucch_sel;
PHY_vars_UE_g[ue_id][CC_id]->pucch_sel[subframe] =
ue_cntl_delay[ue_id][CC_id][last_slot%2].pucch_sel;
}
#ifdef DEBUG_EMU
LOG_D(EMU,"subframe %d trying to copy the payload from num eNB %d to UE %d \n",
subframe, UE_transport_info[ue_id].num_eNB, ue_id);
subframe, UE_transport_info[ue_id][CC_id].num_eNB, ue_id);
#endif
for (n_enb = 0; n_enb < UE_transport_info[ue_id].num_eNB; n_enb++) {
for (n_enb = 0; n_enb < UE_transport_info[ue_id][CC_id].num_eNB; n_enb++) {
#ifdef DEBUG_EMU
/* LOG_D(EMU,"Setting ulsch vars for ue %d rnti %x harq pid is %d \n",
ue_id, UE_transport_info[ue_id].rnti[n_enb],
PHY_vars_UE_g[ue_id]->ulsch_ue[enb_id]);
ue_id, UE_transport_info[ue_id][CC_id].rnti[n_enb],
PHY_vars_UE_g[ue_id][CC_id]->ulsch_ue[enb_id]);
*/
#endif
rnti = UE_transport_info[ue_id].rnti[n_enb];
enb_id = UE_transport_info[ue_id].eNB_id[n_enb];
rnti = UE_transport_info[ue_id][CC_id].rnti[n_enb];
enb_id = UE_transport_info[ue_id][CC_id].eNB_id[n_enb];
PHY_vars_UE_g[ue_id]->lte_ue_pdcch_vars[enb_id]->crnti=rnti;
PHY_vars_UE_g[ue_id][CC_id]->lte_ue_pdcch_vars[enb_id]->crnti=rnti;
harq_pid = UE_transport_info[ue_id].harq_pid[n_enb];
harq_pid = UE_transport_info[ue_id][CC_id].harq_pid[n_enb];
//ulsch = PHY_vars_UE_g[ue_id]->ulsch_ue[enb_id];
//ulsch = PHY_vars_UE_g[ue_id][CC_id]->ulsch_ue[enb_id];
PHY_vars_UE_g[ue_id]->ulsch_ue[enb_id]->o_RI[0] =
ue_cntl_delay[ue_id][last_slot%2].pusch_ri & 0x1;
PHY_vars_UE_g[ue_id]->ulsch_ue[enb_id]->o_RI[1] =
(ue_cntl_delay[ue_id][last_slot%2].pusch_ri>>1) & 0x1;
PHY_vars_UE_g[ue_id][CC_id]->ulsch_ue[enb_id]->o_RI[0] =
ue_cntl_delay[ue_id][CC_id][last_slot%2].pusch_ri & 0x1;
PHY_vars_UE_g[ue_id][CC_id]->ulsch_ue[enb_id]->o_RI[1] =
(ue_cntl_delay[ue_id][CC_id][last_slot%2].pusch_ri>>1) & 0x1;
PHY_vars_UE_g[ue_id]->ulsch_ue[enb_id]->o_ACK[0]=
ue_cntl_delay[ue_id][last_slot%2].pusch_ack & 0x1;
PHY_vars_UE_g[ue_id]->ulsch_ue[enb_id]->o_ACK[1]=
(ue_cntl_delay[ue_id][last_slot%2].pusch_ack>>1) & 0x1;
//*(uint32_t *)ulsch->o = ue_cntl_delay[ue_id][last_slot%2].pusch_uci;
PHY_vars_UE_g[ue_id][CC_id]->ulsch_ue[enb_id]->o_ACK[0]=
ue_cntl_delay[ue_id][CC_id][last_slot%2].pusch_ack & 0x1;
PHY_vars_UE_g[ue_id][CC_id]->ulsch_ue[enb_id]->o_ACK[1]=
(ue_cntl_delay[ue_id][CC_id][last_slot%2].pusch_ack>>1) & 0x1;
//*(uint32_t *)ulsch->o = ue_cntl_delay[ue_id][CC_id][last_slot%2].pusch_uci;
if ((last_slot % 2) == 1) {
PHY_vars_UE_g[ue_id]->ulsch_ue[enb_id]->O =
ue_cntl_delay[ue_id][last_slot%2].length_uci;
PHY_vars_UE_g[ue_id]->ulsch_ue[enb_id]->uci_format =
ue_cntl_delay[ue_id][last_slot%2].uci_format;
PHY_vars_UE_g[ue_id][CC_id]->ulsch_ue[enb_id]->O =
ue_cntl_delay[ue_id][CC_id][last_slot%2].length_uci;
PHY_vars_UE_g[ue_id][CC_id]->ulsch_ue[enb_id]->uci_format =
ue_cntl_delay[ue_id][CC_id][last_slot%2].uci_format;
memcpy(PHY_vars_UE_g[ue_id]->ulsch_ue[enb_id]->o,
ue_cntl_delay[ue_id][last_slot%2].pusch_uci,
memcpy(PHY_vars_UE_g[ue_id][CC_id]->ulsch_ue[enb_id]->o,
ue_cntl_delay[ue_id][CC_id][last_slot%2].pusch_uci,
MAX_CQI_BYTES);
ulsch = PHY_vars_UE_g[ue_id]->ulsch_ue[enb_id];
ulsch = PHY_vars_UE_g[ue_id][CC_id]->ulsch_ue[enb_id];
// if (((HLC_subband_cqi_rank1_2A_5MHz *)ulsch->o)->cqi1)
LOG_D(EMU,
"[UE %d] subframe %d last slot %d copy the payload from eNB %d to UE %d with harq id %d cqi (val %d, length %d) \n",
ue_id, subframe, last_slot, enb_id, ue_id, harq_pid,
((HLC_subband_cqi_rank1_2A_5MHz *)ulsch->o)->cqi1,
PHY_vars_UE_g[ue_id]->ulsch_ue[enb_id]->O);
PHY_vars_UE_g[ue_id][CC_id]->ulsch_ue[enb_id]->O);
}
memcpy(PHY_vars_UE_g[ue_id]->ulsch_ue[enb_id]->harq_processes[harq_pid]->b,
UE_transport_info[ue_id].transport_blocks,
UE_transport_info[ue_id].tbs[enb_id]);
memcpy(PHY_vars_UE_g[ue_id][CC_id]->ulsch_ue[enb_id]->harq_processes[harq_pid]->b,
UE_transport_info[ue_id][CC_id].transport_blocks,
UE_transport_info[ue_id][CC_id].tbs[enb_id]);
//ue_transport_info_index[enb_id]+=UE_transport_info[ue_id].tbs[enb_id];
//ue_transport_info_index[enb_id]+=UE_transport_info[ue_id][CC_id].tbs[enb_id];
//UE_transport_info[ue_id].transport_blocks+=ue_transport_info_index[enb_id];
//LOG_T(EMU,"ulsch tbs is %d\n", UE_transport_info[ue_id].tbs[enb_id]);
//UE_transport_info[ue_id][CC_id].transport_blocks+=ue_transport_info_index[enb_id];
//LOG_T(EMU,"ulsch tbs is %d\n", UE_transport_info[ue_id][CC_id].tbs[enb_id]);
}
}
......@@ -35,12 +35,12 @@ extern char Tx_mutex_var;
extern rx_handler_t rx_handler;
extern tx_handler_t tx_handler;
extern eNB_transport_info_t eNB_transport_info[NUMBER_OF_eNB_MAX];
extern uint16_t eNB_transport_info_TB_index[NUMBER_OF_eNB_MAX];
extern eNB_transport_info_t eNB_transport_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
extern uint16_t eNB_transport_info_TB_index[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
extern UE_transport_info_t UE_transport_info[NUMBER_OF_UE_MAX];
extern uint16_t UE_transport_info_TB_index[NUMBER_OF_UE_MAX];
extern UE_transport_info_t UE_transport_info[NUMBER_OF_UE_MAX][MAX_NUM_CCs];
extern uint16_t UE_transport_info_TB_index[NUMBER_OF_UE_MAX][MAX_NUM_CCs];
extern UE_cntl ue_cntl_delay[NUMBER_OF_UE_MAX][2];
extern UE_cntl ue_cntl_delay[NUMBER_OF_UE_MAX][MAX_NUM_CCs][2];
#endif
......@@ -36,8 +36,8 @@ unsigned int emul_rx_handler(unsigned char Mode,char *rx_buffer, unsigned int Nb
unsigned int emul_rx_data(void);
void emu_transport_info(unsigned int last_slot, unsigned int next_slot);
void fill_phy_enb_vars(unsigned int enb_id, unsigned int next_slot);
void fill_phy_ue_vars(unsigned int ue_id, unsigned int last_slot);
void fill_phy_enb_vars(unsigned int enb_id, uint8_t CC_id,unsigned int next_slot);
void fill_phy_ue_vars(unsigned int ue_id, uint8_t CC_id,unsigned int last_slot);
void emu_transport_sync(void);
void emu_transport(unsigned int frame, unsigned int last_slot,unsigned int next_slot, lte_subframe_t direction, unsigned char frame_type, int ethernet_flag );
void emu_transport_DL(unsigned int frame, unsigned int last_slot,unsigned int next_slot);
......
......@@ -37,12 +37,12 @@ char Tx_mutex_var;
rx_handler_t rx_handler;
tx_handler_t tx_handler;
eNB_transport_info_t eNB_transport_info[NUMBER_OF_eNB_MAX];
uint16_t eNB_transport_info_TB_index[NUMBER_OF_eNB_MAX];
eNB_transport_info_t eNB_transport_info[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
uint16_t eNB_transport_info_TB_index[NUMBER_OF_eNB_MAX][MAX_NUM_CCs];
UE_transport_info_t UE_transport_info[NUMBER_OF_UE_MAX];
uint16_t UE_transport_info_TB_index[NUMBER_OF_UE_MAX];
UE_transport_info_t UE_transport_info[NUMBER_OF_UE_MAX][MAX_NUM_CCs];
uint16_t UE_transport_info_TB_index[NUMBER_OF_UE_MAX][MAX_NUM_CCs];
UE_cntl ue_cntl_delay[NUMBER_OF_UE_MAX][2];
UE_cntl ue_cntl_delay[NUMBER_OF_UE_MAX][MAX_NUM_CCs][2];
#endif
......@@ -10,7 +10,7 @@ OPENAIR1_TOP = $(OPENAIR1_DIR)
OPENAIR2_TOP = $(OPENAIR2_DIR)
OPENAIR3 = $(OPENAIR3_DIR)
CFLAGS = -g -O3 -Wno-strict-aliasing -rdynamic -Wall -DPHYSIM -DNODE_RG -DUSER_MODE -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DPHY_CONTEXT=1 $(CPUFLAGS) -DMALLOC_CHECK_=1 -DENABLE_VCD_FIFO # -Wno-packed-bitfield-compat
CFLAGS = -g -O3 -Wno-strict-aliasing -rdynamic -DMAX_NUM_CCs=1 -Wall -DPHYSIM -DNODE_RG -DUSER_MODE -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TXRX=2 -DNB_ANTENNAS_TX=2 -DPHY_CONTEXT=1 $(CPUFLAGS) -DMALLOC_CHECK_=1 -DENABLE_VCD_FIFO # -Wno-packed-bitfield-compat
# DCI Debug
......
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