Commit 58610853 authored by nikaeinn's avatar nikaeinn

* Add relay node types and its eNB/UE procedures

* update the L2 interface
* update eMBMS MAC/PHY to support more than one MBSFN sync area
* update OTG to support different multicast traffic for eMBMS
* pre-ci test passed (100%)
 


git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4170 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 51bdba77
......@@ -315,6 +315,7 @@ void phy_config_sib13_ue(u8 Mod_id,u8 CH_index,int 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);
......@@ -332,6 +333,7 @@ void phy_config_sib13_eNB(u8 Mod_id,int 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);
......
......@@ -74,37 +74,37 @@ void dump_mch(PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u16 coded_bits_per_codeword,int
int is_pmch_subframe(uint32_t frame, int subframe, LTE_DL_FRAME_PARMS *frame_parms) {
uint32_t period;
uint8_t i;
if (frame_parms->num_MBSFN_config > 0) { // we have at least one MBSFN configuration
period = 1<<frame_parms->MBSFN_config[0].radioframeAllocationPeriod;
if ((frame % period) == frame_parms->MBSFN_config[0].radioframeAllocationOffset) {
if (frame_parms->MBSFN_config[0].fourFrames_flag == 0) {
for (i=0; i<frame_parms->num_MBSFN_config; i++) { // we have at least one MBSFN configuration
period = 1<<frame_parms->MBSFN_config[i].radioframeAllocationPeriod;
if ((frame % period) == frame_parms->MBSFN_config[i].radioframeAllocationOffset) {
if (frame_parms->MBSFN_config[i].fourFrames_flag == 0) {
if (frame_parms->frame_type == FDD) {
switch (subframe) {
case 1:
if ((frame_parms->MBSFN_config[0].mbsfn_SubframeConfig & MBSFN_FDD_SF1) > 0)
if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF1) > 0)
return(1);
break;
case 2:
if ((frame_parms->MBSFN_config[0].mbsfn_SubframeConfig & MBSFN_FDD_SF2) > 0)
if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF2) > 0)
return(1);
break;
case 3:
if ((frame_parms->MBSFN_config[0].mbsfn_SubframeConfig & MBSFN_FDD_SF3) > 0)
if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF3) > 0)
return(1);
break;
case 6:
if ((frame_parms->MBSFN_config[0].mbsfn_SubframeConfig & MBSFN_FDD_SF6) > 0)
if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF6) > 0)
return(1);
break;
case 7:
if ((frame_parms->MBSFN_config[0].mbsfn_SubframeConfig & MBSFN_FDD_SF7) > 0)
if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF7) > 0)
return(1);
break;
case 8:
if ((frame_parms->MBSFN_config[0].mbsfn_SubframeConfig & MBSFN_FDD_SF8) > 0)
if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_FDD_SF8) > 0)
return(1);
break;
}
......@@ -112,23 +112,23 @@ int is_pmch_subframe(uint32_t frame, int subframe, LTE_DL_FRAME_PARMS *frame_par
else {
switch (subframe) {
case 3:
if ((frame_parms->MBSFN_config[0].mbsfn_SubframeConfig & MBSFN_TDD_SF3) > 0)
if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_TDD_SF3) > 0)
return(1);
break;
case 4:
if ((frame_parms->MBSFN_config[0].mbsfn_SubframeConfig & MBSFN_TDD_SF4) > 0)
if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_TDD_SF4) > 0)
return(1);
break;
case 7:
if ((frame_parms->MBSFN_config[0].mbsfn_SubframeConfig & MBSFN_TDD_SF7) > 0)
if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_TDD_SF7) > 0)
return(1);
break;
case 8:
if ((frame_parms->MBSFN_config[0].mbsfn_SubframeConfig & MBSFN_TDD_SF8) > 0)
if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_TDD_SF8) > 0)
return(1);
break;
case 9:
if ((frame_parms->MBSFN_config[0].mbsfn_SubframeConfig & MBSFN_TDD_SF9) > 0)
if ((frame_parms->MBSFN_config[i].mbsfn_SubframeConfig & MBSFN_TDD_SF9) > 0)
return(1);
break;
}
......
......@@ -210,6 +210,16 @@ int dump_ue_stats(PHY_VARS_UE *phy_vars_ue, char* buffer, int length, runmode_t
len += sprintf(&buffer[len], "[UE PROC] DLSCH Total %d, Error %d, FER %d\n",phy_vars_ue->dlsch_received[0],phy_vars_ue->dlsch_errors[0],phy_vars_ue->dlsch_fer[0]);
len += sprintf(&buffer[len], "[UE PROC] DLSCH (SI) Total %d, Error %d\n",phy_vars_ue->dlsch_SI_received[0],phy_vars_ue->dlsch_SI_errors[0]);
len += sprintf(&buffer[len], "[UE PROC] DLSCH (RA) Total %d, Error %d\n",phy_vars_ue->dlsch_ra_received[0],phy_vars_ue->dlsch_ra_errors[0]);
#ifdef Rel10
int i=0;
//len += sprintf(&buffer[len], "[UE PROC] MCH Total %d\n", phy_vars_ue->dlsch_mch_received[0]);
for(i=0; i <phy_vars_ue->lte_frame_parms.num_MBSFN_config; i++ ){
len += sprintf(&buffer[len], "[UE PROC] MCH (MCCH MBSFN %d) Total %d, Error %d, Trials %d\n",
i, phy_vars_ue->dlsch_mcch_received[i][0],phy_vars_ue->dlsch_mcch_errors[i][0],phy_vars_ue->dlsch_mcch_trials[i][0]);
len += sprintf(&buffer[len], "[UE PROC] MCH (MTCH MBSFN %d) Total %d, Error %d, Trials %d\n",
i, phy_vars_ue->dlsch_mtch_received[i][0],phy_vars_ue->dlsch_mtch_errors[i][0],phy_vars_ue->dlsch_mtch_trials[i][0]);
}
#endif
len += sprintf(&buffer[len], "[UE PROC] DLSCH Bitrate %dkbps\n",(phy_vars_ue->bitrate[0]/1000));
len += sprintf(&buffer[len], "[UE PROC] Total Received Bits %dkbits\n",(phy_vars_ue->total_received_bits[0]/1000));
......
......@@ -135,7 +135,6 @@
#include "PHY/CODING/defs.h"
#include "PHY/TOOLS/defs.h"
#ifdef OPENAIR_LTE
//#include "PHY/LTE_ESTIMATION/defs.h"
......@@ -159,8 +158,7 @@ enum transmission_access_mode{
};
/// Top-level PHY Data Structure for eNB
typedef struct
{
typedef struct {
/// Module ID indicator for this instance
u8 Mod_id;
u8 local_flag;
......@@ -388,7 +386,14 @@ typedef struct
int dlsch_SI_errors[NUMBER_OF_CONNECTED_eNB_MAX];
int dlsch_ra_received[NUMBER_OF_CONNECTED_eNB_MAX];
int dlsch_ra_errors[NUMBER_OF_CONNECTED_eNB_MAX];
int dlsch_mch_errors[NUMBER_OF_CONNECTED_eNB_MAX];
int dlsch_mch_received_sf[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
int dlsch_mch_received[NUMBER_OF_CONNECTED_eNB_MAX];
int dlsch_mcch_received[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
int dlsch_mtch_received[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
int dlsch_mcch_errors[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
int dlsch_mtch_errors[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
int dlsch_mcch_trials[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
int dlsch_mtch_trials[MAX_MBSFN_AREA][NUMBER_OF_CONNECTED_eNB_MAX];
int current_dlsch_cqi[NUMBER_OF_CONNECTED_eNB_MAX];
unsigned char first_run_timing_advance[NUMBER_OF_CONNECTED_eNB_MAX];
u8 generate_prach;
......@@ -480,7 +485,19 @@ typedef struct
time_stats_t dlsch_tc_intl2_stats;
} PHY_VARS_UE;
/// Top-level PHY Data Structure for RN
typedef struct {
/// Module ID indicator for this instance
u8 Mod_id;
u32 frame;
// phy_vars_eNB
// phy_vars ue
// cuurently only used to store and forward the PMCH
u8 mch_avtive[10];
u8 sync_area[10]; // num SF
LTE_UE_DLSCH_t *dlsch_rn_MCH[10];
} PHY_VARS_RN;
#include "PHY/INIT/defs.h"
#include "PHY/LTE_REFSIG/defs.h"
......
......@@ -27,6 +27,7 @@ extern unsigned int DAQ_MBOX;
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;
......
......@@ -36,6 +36,7 @@ s16 *primary_synch2_time;
//PHY_VARS *PHY_vars;
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;
short *twiddle_ifft,*twiddle_fft,*twiddle_fft_times4,*twiddle_ifft_times4,*twiddle_fft_half,*twiddle_ifft_half;
......
......@@ -126,8 +126,9 @@ void cleanup_dlsch_threads(void);
@param phy_vars_eNB Pointer to eNB variables on which to act
@param abstraction_flag Indicator of PHY abstraction
@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(u8 last_slot, u8 next_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag, relaying_type_t r_type);
void phy_procedures_eNB_lte(u8 last_slot, u8 next_slot,PHY_VARS_eNB *phy_vars_eNB,u8 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)
......@@ -137,8 +138,9 @@ void phy_procedures_eNB_lte(u8 last_slot, u8 next_slot,PHY_VARS_eNB *phy_vars_eN
@param abstraction_flag Indicator of PHY abstraction
@param mode calibration/debug mode
@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_UE_lte(u8 last_slot, u8 next_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag,runmode_t mode, relaying_type_t r_type);
void phy_procedures_UE_lte(u8 last_slot, u8 next_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag,runmode_t mode,relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn);
#ifdef Rel10
/*!
......@@ -175,8 +177,9 @@ void phy_procedures_UE_TX(u8 next_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abs
@param abstraction_flag Indicator of PHY abstraction
@param mode calibration/debug mode
@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
*/
int phy_procedures_UE_RX(u8 last_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag,runmode_t mode,relaying_type_t r_type);
int phy_procedures_UE_RX(u8 last_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag,runmode_t mode,relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn);
/*!
\brief Scheduling for UE TX procedures in TDD S-subframes.
......@@ -204,8 +207,9 @@ void phy_procedures_UE_S_RX(u8 last_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 a
@param phy_vars_eNB Pointer to eNB variables on which to act
@param abstraction_flag Indicator of PHY abstraction
@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 the RN variables
*/
void phy_procedures_eNB_TX(u8 next_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag,relaying_type_t r_type);
void phy_procedures_eNB_TX(u8 next_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag,relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn);
/*!
\brief Scheduling for eNB RX procedures in normal subframes.
......
......@@ -888,7 +888,8 @@ void fill_dci_emos(DCI_PDU *DCI_pdu, u8 subframe, PHY_VARS_eNB *phy_vars_eNB) {
int QPSK[4]={AMP_OVER_SQRT2|(AMP_OVER_SQRT2<<16),AMP_OVER_SQRT2|((65536-AMP_OVER_SQRT2)<<16),((65536-AMP_OVER_SQRT2)<<16)|AMP_OVER_SQRT2,((65536-AMP_OVER_SQRT2)<<16)|(65536-AMP_OVER_SQRT2)};
int QPSK2[4]={AMP_OVER_2|(AMP_OVER_2<<16),AMP_OVER_2|((65536-AMP_OVER_2)<<16),((65536-AMP_OVER_2)<<16)|AMP_OVER_2,((65536-AMP_OVER_2)<<16)|(65536-AMP_OVER_2)};
void phy_procedures_eNB_TX(unsigned char next_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag,relaying_type_t r_type) {
void phy_procedures_eNB_TX(unsigned char next_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag,
relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn) {
u8 *pbch_pdu=&phy_vars_eNB->pbch_pdu[0];
// unsigned int nb_dci_ue_spec = 0, nb_dci_common = 0;
u16 input_buffer_length, re_allocated=0;
......@@ -911,7 +912,9 @@ void phy_procedures_eNB_TX(unsigned char next_slot,PHY_VARS_eNB *phy_vars_eNB,u8
int re_offset;
uint32_t *txptr;
#ifdef Rel10
MCH_PDU *mch_pdu;
MCH_PDU *mch_pduP;
MCH_PDU mch_pdu;
u8 sync_area=255;
#endif
#if defined(SMBV) && !defined(EXMIMO)
// counts number of allocations in subframe
......@@ -970,17 +973,66 @@ void phy_procedures_eNB_TX(unsigned char next_slot,PHY_VARS_eNB *phy_vars_eNB,u8
next_slot,1);
#ifdef Rel10
// get MCH from MAC
mch_pdu = mac_xface->get_mch_sdu(phy_vars_eNB->Mod_id,phy_vars_eNB->frame,next_slot>>1);
fill_eNB_dlsch_MCH(phy_vars_eNB,mch_pdu->mcs,1,0);
LOG_D(PHY,"[eNB%d][MCH] Frame %d: Got MCH pdu for MBSFN Subframe %d : MCS %d, TBS %d\n",phy_vars_eNB->Mod_id,phy_vars_eNB->frame,next_slot>>1,mch_pdu->mcs,phy_vars_eNB->dlsch_eNB_MCH->harq_processes[0]->TBS>>3);
// Generate PMCH
generate_mch(phy_vars_eNB,next_slot>>1,(uint8_t*)mch_pdu->payload);
/*for (i=0;i<phy_vars_eNB->dlsch_eNB_MCH->harq_processes[0]->TBS>>3;i++)
printf("%2x.",(uint8_t)mch_pdu->payload[i]);
printf("\n");*/
// 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->frame,next_slot>>1);
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
//if ((mch_pduP->sync_area == 0)) // TEST: only transmit mcch for sync area 0
LOG_I(PHY,"[eNB%d] Frame %d subframe %d : Got MCH pdu for MBSFN (MCS %d, TBS %d) \n",
phy_vars_eNB->Mod_id,phy_vars_eNB->frame,next_slot>>1,mch_pduP->mcs,
phy_vars_eNB->dlsch_eNB_MCH->harq_processes[0]->TBS>>3);
else {
LOG_D(PHY,"[DeNB %d] Frame %d subframe %d : Do not transmit MCH pdu for MBSFN sync area %d (%s)\n",
phy_vars_eNB->Mod_id,phy_vars_eNB->frame,next_slot>>1,mch_pduP->sync_area,
(mch_pduP->Pdu_size == 0)? "Empty MCH PDU":"Let RN transmit for the moment");
mch_pduP = NULL;
}
break;
case multicast_relay:
if ((mch_pduP->Pdu_size > 0) && ((mch_pduP->mcch_active == 1) || mch_pduP->msi_active==1)){
//if (((mch_pduP->mcch_active == 1) || mch_pduP->msi_active==1)){
LOG_I(PHY,"[RN %d] Frame %d subframe %d: Got the MCH PDU for MBSFN sync area %d (MCS %d, TBS %d)\n",
phy_vars_rn->Mod_id,phy_vars_rn->frame, next_slot>>1,
mch_pduP->sync_area,mch_pduP->mcs,mch_pduP->Pdu_size);
} else if (phy_vars_rn->mch_avtive[(next_slot>>1)%5] == 1){ // SF2 -> SF7, SF3 -> SF8
mch_pduP= &mch_pdu;
memcpy(&mch_pduP->payload, // could be a simple copy
phy_vars_rn->dlsch_rn_MCH[(next_slot>>1)%5]->harq_processes[0]->b,
phy_vars_rn->dlsch_rn_MCH[(next_slot>>1)%5]->harq_processes[0]->TBS>>3);
mch_pduP->Pdu_size = (uint16_t) (phy_vars_rn->dlsch_rn_MCH[(next_slot>>1)%5]->harq_processes[0]->TBS>>3);
mch_pduP->mcs = phy_vars_rn->dlsch_rn_MCH[(next_slot>>1)%5]->harq_processes[0]->mcs;
LOG_I(PHY,"[RN %d] Frame %d subframe %d: Forward the MCH PDU for MBSFN received on SF %d sync area %d (MCS %d, TBS %d)\n",
phy_vars_rn->Mod_id,phy_vars_rn->frame, next_slot>>1,(next_slot>>1)%5,
phy_vars_rn->sync_area[(next_slot>>1)%5],mch_pduP->mcs,mch_pduP->Pdu_size);
} else {
/* LOG_I(PHY,"[RN %d] Frame %d subframe %d: do not forward MCH pdu for MBSFN sync area %d (MCS %d, TBS %d)\n",
phy_vars_rn->Mod_id,phy_vars_rn->frame, next_slot>>1,
mch_pduP->sync_area,mch_pduP->mcs,mch_pduP->Pdu_size);*/
mch_pduP=NULL;
}
phy_vars_rn->mch_avtive[next_slot>>1]=0;
break;
default:
LOG_W(PHY,"[eNB %d] Frame %d subframe %d: unknown relaying type %d \n",
phy_vars_eNB->Mod_id,phy_vars_eNB->frame,next_slot>>1,r_type);
mch_pduP=NULL;
break;
}// switch
if (mch_pduP){
fill_eNB_dlsch_MCH(phy_vars_eNB,mch_pduP->mcs,1,0);
// Generate PMCH
generate_mch(phy_vars_eNB,next_slot>>1,(uint8_t*)mch_pduP->payload);
#ifdef DEBUG_PHY
for (i=0;i<mch_pduP->Pdu_size;i++)
msg("%2x.",(uint8_t)mch_pduP->payload[i]);
msg("\n");
#endif
} else {
LOG_D(PHY,"[eNB/RN] Frame %d subframe %d: MCH not generated \n",phy_vars_eNB->frame,next_slot>>1);
}
#endif
}
}
......@@ -3377,7 +3429,7 @@ int phy_procedures_RN_eNB_TX(unsigned char last_slot, unsigned char next_slot, r
do_proc= no_relay; // perform the normal eNB operation
break;
case multicast_relay:
if ( ((next_slot >>1) < 6) || ((next_slot >>1) > 8))
if (((next_slot >>1) < 6) || ((next_slot >>1) > 8))
do_proc = 0; // do nothing
else // SF#6, SF#7 and SF#8
do_proc = multicast_relay; // do PHY procedures eNB TX
......@@ -3390,7 +3442,8 @@ 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 last_slot, unsigned char next_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag, relaying_type_t r_type) {
void phy_procedures_eNB_lte(unsigned char last_slot, unsigned char next_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag,
relaying_type_t r_type, PHY_VARS_RN *phy_vars_rn) {
/*
if (phy_vars_eNB->frame >= 1000)
mac_xface->macphy_exit("Exiting after 1000 Frames\n");
......@@ -3404,7 +3457,7 @@ void phy_procedures_eNB_lte(unsigned char last_slot, unsigned char next_slot,PHY
#ifdef Rel10
if (phy_procedures_RN_eNB_TX(last_slot, next_slot, r_type) != 0 )
#endif
phy_procedures_eNB_TX(next_slot,phy_vars_eNB,abstraction_flag,r_type);
phy_procedures_eNB_TX(next_slot,phy_vars_eNB,abstraction_flag,r_type,phy_vars_rn);
}
if (((phy_vars_eNB->lte_frame_parms.frame_type == 1 )&&(subframe_select(&phy_vars_eNB->lte_frame_parms,last_slot>>1)==SF_UL))||
(phy_vars_eNB->lte_frame_parms.frame_type == 0)){
......@@ -3415,7 +3468,7 @@ void phy_procedures_eNB_lte(unsigned char last_slot, unsigned char next_slot,PHY
#ifdef Rel10
if (phy_procedures_RN_eNB_TX(last_slot, next_slot, r_type) != 0 )
#endif
phy_procedures_eNB_TX(next_slot,phy_vars_eNB,abstraction_flag,r_type);
phy_procedures_eNB_TX(next_slot,phy_vars_eNB,abstraction_flag,r_type,phy_vars_rn);
}
if ((subframe_select(&phy_vars_eNB->lte_frame_parms,last_slot>>1)==SF_S) &&
((last_slot&1)==0)){
......
......@@ -1279,7 +1279,8 @@ void phy_procedures_UE_TX(u8 next_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abs
}
}
LOG_D(PHY,"[UE %p] frame %d subframe %d : generate_prach %d, prach_cnt %d\n",phy_vars_ue,phy_vars_ue->frame,next_slot>>1,phy_vars_ue->generate_prach,phy_vars_ue->prach_cnt);
LOG_D(PHY,"[UE %d] frame %d subframe %d : generate_prach %d, prach_cnt %d\n",
phy_vars_ue->Mod_id,phy_vars_ue->frame,next_slot>>1,phy_vars_ue->generate_prach,phy_vars_ue->prach_cnt);
phy_vars_ue->prach_cnt++;
if (phy_vars_ue->prach_cnt==3)
......@@ -1542,7 +1543,7 @@ void phy_procedures_emos_UE_RX(PHY_VARS_UE *phy_vars_ue,u8 last_slot,u8 eNB_id)
void restart_phy(PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag) {
// u8 last_slot;
u8 i;
LOG_D(PHY,"[UE %d] frame %d, slot %d, restarting PHY!\n",phy_vars_ue->Mod_id,phy_vars_ue->frame);
mac_xface->macphy_exit("");
// first_run = 1;
......@@ -1580,7 +1581,17 @@ void restart_phy(PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag) {
phy_vars_ue->dlsch_ra_received[eNB_id] = 0;
phy_vars_ue->dlsch_SI_errors[eNB_id] = 0;
phy_vars_ue->dlsch_ra_errors[eNB_id] = 0;
phy_vars_ue->dlsch_mch_errors[eNB_id] = 0;
phy_vars_ue->dlsch_mch_received[eNB_id] = 0;
for (i=0; i < MAX_MBSFN_AREA ; i ++){
phy_vars_ue->dlsch_mch_received_sf[i][eNB_id] = 0;
phy_vars_ue->dlsch_mcch_received[i][eNB_id] = 0;
phy_vars_ue->dlsch_mtch_received[i][eNB_id] = 0;
phy_vars_ue->dlsch_mcch_errors[i][eNB_id] = 0;
phy_vars_ue->dlsch_mtch_errors[i][eNB_id] = 0;
phy_vars_ue->dlsch_mcch_trials[i][eNB_id] = 0;
phy_vars_ue->dlsch_mtch_trials[i][eNB_id] = 0;
}
//phy_vars_ue->total_TBS[eNB_id] = 0;
//phy_vars_ue->total_TBS_last[eNB_id] = 0;
//phy_vars_ue->bitrate[eNB_id] = 0;
......@@ -2163,7 +2174,8 @@ int lte_ue_pdcch_procedures(u8 eNB_id,u8 last_slot, PHY_VARS_UE *phy_vars_ue,u8
}
int phy_procedures_UE_RX(u8 last_slot, PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag,runmode_t mode,relaying_type_t r_type) {
int phy_procedures_UE_RX(u8 last_slot, PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag,runmode_t mode,
relaying_type_t r_type,PHY_VARS_RN *phy_vars_rn) {
u16 l,m,n_symb;
// int eNB_id = 0,
......@@ -2179,16 +2191,16 @@ int phy_procedures_UE_RX(u8 last_slot, PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abs
u8 *rar;
#endif
int pmch_flag=0;
u8 sync_area=255;
int pmch_mcs=-1;
u8 mcch_active=0;
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_IN);
//msg("UE_RX 1 last_slot %d \n",last_slot);
#ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[%s %d] Frame %d subframe %d: Doing phy_procedures_UE_RX(%d)\n",
(r_type == multicast_relay) ? "RN/UE" : "UE",
phy_vars_ue->Mod_id,phy_vars_ue->frame, last_slot>>1, last_slot);
#endif
if (phy_vars_ue->lte_frame_parms.Ncp == 0) { // normal prefix
pilot1 = 4;
pilot2 = 7;
......@@ -2937,11 +2949,14 @@ int phy_procedures_UE_RX(u8 last_slot, PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abs
}// l loop
if (is_pmch_subframe(((last_slot>>1)==9?-1:0)+phy_vars_ue->frame,last_slot>>1,&phy_vars_ue->lte_frame_parms)) {
if ((last_slot%2)==1) {
LOG_D(PHY,"[UE %d] Frame %d, subframe %d: Querying for PMCH demodulation\n",
phy_vars_ue->Mod_id,((last_slot>>1)==9?-1:0)+phy_vars_ue->frame,last_slot>>1);
LOG_D(PHY,"[UE %d] Frame %d, subframe %d: Querying for PMCH demodulation(%d)\n",
phy_vars_ue->Mod_id,((last_slot>>1)==9?-1:0)+phy_vars_ue->frame,last_slot>>1,last_slot);
#ifdef Rel10
pmch_mcs = mac_xface->ue_query_mch(phy_vars_ue->Mod_id,((last_slot>>1)==9?-1:0)+phy_vars_ue->frame,last_slot>>1);
pmch_mcs = mac_xface->ue_query_mch(phy_vars_ue->Mod_id,((last_slot>>1)==9?-1:0)+phy_vars_ue->frame,last_slot>>1,eNB_id,&sync_area,&mcch_active);
if (phy_vars_rn)
phy_vars_rn->mch_avtive[last_slot>>1]=0;
#else
pmch_mcs=-1;
#endif
......@@ -2990,11 +3005,24 @@ int phy_procedures_UE_RX(u8 last_slot, PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abs
last_slot>>1,
0,
0,0);
if (mcch_active == 1)
phy_vars_ue->dlsch_mcch_trials[sync_area][0]++;
else
phy_vars_ue->dlsch_mtch_trials[sync_area][0]++;
if (ret == (1+phy_vars_ue->dlsch_ue_MCH[0]->max_turbo_iterations)) {
phy_vars_ue->dlsch_mch_errors[0]++;
LOG_D(PHY,"number of errors: %d\n",phy_vars_ue->dlsch_mch_errors[0]);
LOG_D(PHY,"[UE %d] Frame %d, subframe %d: PMCH in error, not passing to L2 (TBS %d, iter %d,G %d)\n",phy_vars_ue->Mod_id,((last_slot>>1)==9?-1:0)+phy_vars_ue->frame,last_slot>>1,phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->TBS>>3,phy_vars_ue->dlsch_ue_MCH[0]->max_turbo_iterations,phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->G);
if (mcch_active == 1)
phy_vars_ue->dlsch_mcch_errors[sync_area][0]++;
else
phy_vars_ue->dlsch_mtch_errors[sync_area][0]++;
LOG_D(PHY,"[%s %d] Frame %d, subframe %d: PMCH in error (%d,%d), not passing to L2 (TBS %d, iter %d,G %d)\n",
(r_type == no_relay)? "UE": "RN/UE", phy_vars_ue->Mod_id,
((last_slot>>1)==9?-1:0)+phy_vars_ue->frame,last_slot>>1,
phy_vars_ue->dlsch_mcch_errors[sync_area][0],
phy_vars_ue->dlsch_mtch_errors[sync_area][0],
phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->TBS>>3,
phy_vars_ue->dlsch_ue_MCH[0]->max_turbo_iterations,
phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->G);
dump_mch(phy_vars_ue,0,phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->G,(last_slot>>1));
#ifdef DEBUG_DLSCH
for (i=0;i<phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->TBS>>3;i++){
......@@ -3006,11 +3034,53 @@ int phy_procedures_UE_RX(u8 last_slot, PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abs
}
else {
#ifdef Rel10
mac_xface->ue_send_mch_sdu(phy_vars_ue->Mod_id,
((last_slot>>1)==9?-1:0)+phy_vars_ue->frame,
phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->b,
phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->TBS>>3,
0);
if ((r_type == no_relay) || (mcch_active == 1)) {
mac_xface->ue_send_mch_sdu(phy_vars_ue->Mod_id,
((last_slot>>1)==9?-1:0)+phy_vars_ue->frame,
phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->b,
phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->TBS>>3,
eNB_id,// not relevant in eMBMS context
sync_area);
/* for (i=0;i<phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->TBS>>3;i++)
msg("%2x.",phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->b[i]);
msg("\n");
*/
if (mcch_active == 1)
phy_vars_ue->dlsch_mcch_received[sync_area][0]++;
else
phy_vars_ue->dlsch_mtch_received[sync_area][0]++;
if (phy_vars_ue->dlsch_mch_received_sf[(last_slot>>1)%5][0] == 1 ){
phy_vars_ue->dlsch_mch_received_sf[(last_slot>>1)%5][0]=0;
} else {
phy_vars_ue->dlsch_mch_received[0]+=1;
phy_vars_ue->dlsch_mch_received_sf[last_slot>>1][0]=1;
}
} else if (r_type == multicast_relay) { // mcch is not active here
// only 1 harq process exists
// Fix me: this could be a pointer copy
memcpy (phy_vars_rn->dlsch_rn_MCH[last_slot>>1]->harq_processes[0]->b,
phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->b,
phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->TBS>>3);
// keep the tbs
phy_vars_rn->mch_avtive[last_slot>>1] = 1;
phy_vars_rn->sync_area[last_slot>>1] = sync_area; // this could also go the harq data struct
phy_vars_rn->dlsch_rn_MCH[last_slot>>1]->harq_processes[0]->TBS = phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->TBS;
phy_vars_rn->dlsch_rn_MCH[last_slot>>1]->harq_processes[0]->mcs = phy_vars_ue->dlsch_ue_MCH[0]->harq_processes[0]->mcs;
LOG_I(PHY,"[RN/UE %d] Frame %d subframe %d: store the MCH PDU for MBSFN sync area %d (MCS %d, TBS %d)\n",
phy_vars_ue->Mod_id,frame,last_slot>>1,sync_area,
phy_vars_rn->dlsch_rn_MCH[last_slot>>1]->harq_processes[0]->mcs,
phy_vars_rn->dlsch_rn_MCH[last_slot>>1]->harq_processes[0]->TBS>>3);
#ifdef DEBUG_PHY
for (i=0;i<phy_vars_rn->dlsch_rn_MCH[last_slot>>1]->harq_processes[0]->TBS>>3;i++)
msg("%2x.",phy_vars_rn->dlsch_rn_MCH[last_slot>>1]->harq_processes[0]->b[i]);
msg("\n");
#endif
} else
LOG_W(PHY,"[UE %d] Frame %d: not supported option\n",phy_vars_ue->Mod_id,frame);
#endif
}
}
......@@ -3018,7 +3088,7 @@ int phy_procedures_UE_RX(u8 last_slot, PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abs
}
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_RX, VCD_FUNCTION_OUT);
return (0);
}
}
#ifdef Rel10
int phy_procedures_RN_UE_RX(u8 last_slot, u8 next_slot, relaying_type_t r_type) {
......@@ -3032,7 +3102,7 @@ int phy_procedures_RN_UE_RX(u8 last_slot, u8 next_slot, relaying_type_t r_type)
if (last_slot > 12)
do_proc = 0; // do nothing
else // SF#1, SF#2, SF3, SF#3, SF#4, SF#5, SF#6(do rx slot 12)
do_proc =multicast_relay ; // do PHY procedures UE RX
do_proc = multicast_relay ; // do PHY procedures UE RX
break;
default: // should'not be here
LOG_W(PHY,"Not supported relay type %d, do nothing \n", r_type);
......@@ -3042,7 +3112,8 @@ int phy_procedures_RN_UE_RX(u8 last_slot, u8 next_slot, relaying_type_t r_type)
return do_proc;
}
#endif
void phy_procedures_UE_lte(u8 last_slot, u8 next_slot, PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag,runmode_t mode, relaying_type_t r_type) {
void phy_procedures_UE_lte(u8 last_slot, u8 next_slot, PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag,runmode_t mode,
relaying_type_t r_type, PHY_VARS_RN *phy_vars_rn) {
#undef DEBUG_PHY_PROC
......@@ -3073,7 +3144,7 @@ int phy_procedures_RN_UE_RX(u8 last_slot, u8 next_slot, relaying_type_t r_type)
#ifdef Rel10
if (phy_procedures_RN_UE_RX(last_slot, next_slot, r_type) != 0 )
#endif
phy_procedures_UE_RX(last_slot,phy_vars_ue,eNB_id,abstraction_flag,mode,r_type);
phy_procedures_UE_RX(last_slot,phy_vars_ue,eNB_id,abstraction_flag,mode,r_type,phy_vars_rn);
#ifdef EMOS
phy_procedures_emos_UE_RX(phy_vars_ue,last_slot,eNB_id);
#endif
......@@ -3087,7 +3158,7 @@ int phy_procedures_RN_UE_RX(u8 last_slot, u8 next_slot, relaying_type_t r_type)
#ifdef Rel10
if (phy_procedures_RN_UE_RX(last_slot, next_slot, r_type) != 0 )
#endif
phy_procedures_UE_RX(last_slot,phy_vars_ue,eNB_id,abstraction_flag,mode, r_type);
phy_procedures_UE_RX(last_slot,phy_vars_ue,eNB_id,abstraction_flag,mode,r_type,phy_vars_rn);
}