Commit 2f889b42 authored by nikaeinn's avatar nikaeinn

add the relay node for a dual stack operation for eMBMS (experimental)

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4146 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 20a4013b
...@@ -334,6 +334,9 @@ typedef struct { ...@@ -334,6 +334,9 @@ typedef struct {
#endif #endif
#endif #endif
#define NUMBER_OF_RN_MAX 3
typedef enum {no_relay=0,unicast_relay=1,multicast_relay=2} relaying_mode_t;
typedef struct typedef struct
{ {
......
...@@ -61,6 +61,7 @@ char mode_string[4][20] = {"NOT SYNCHED","PRACH","RAR","PUSCH"}; ...@@ -61,6 +61,7 @@ char mode_string[4][20] = {"NOT SYNCHED","PRACH","RAR","PUSCH"};
#ifndef OPENAIR2 #ifndef OPENAIR2
unsigned char NB_eNB_INST=0; unsigned char NB_eNB_INST=0;
unsigned char NB_UE_INST=0; unsigned char NB_UE_INST=0;
unsigned char NB_RN_INST=0;
unsigned char NB_INST=0; unsigned char NB_INST=0;
#endif #endif
......
...@@ -125,8 +125,9 @@ void cleanup_dlsch_threads(void); ...@@ -125,8 +125,9 @@ void cleanup_dlsch_threads(void);
@param next_slot Index of next_slot (0-19) @param next_slot Index of next_slot (0-19)
@param phy_vars_eNB Pointer to eNB variables on which to act @param phy_vars_eNB Pointer to eNB variables on which to act
@param abstraction_flag Indicator of PHY abstraction @param abstraction_flag Indicator of PHY abstraction
@param r_mode indicates the relaying operation: 0: no_relaying, 1: unicast relaying, 2: multicast relaying
*/ */
void phy_procedures_eNB_lte(u8 last_slot, u8 next_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag); void phy_procedures_eNB_lte(u8 last_slot, u8 next_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag, relaying_mode_t r_mode);
/*! /*!
\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. \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) @param last_slot Index of last slot (0-19)
...@@ -135,8 +136,9 @@ void phy_procedures_eNB_lte(u8 last_slot, u8 next_slot,PHY_VARS_eNB *phy_vars_eN ...@@ -135,8 +136,9 @@ void phy_procedures_eNB_lte(u8 last_slot, u8 next_slot,PHY_VARS_eNB *phy_vars_eN
@param eNB_id ID of eNB on which to act @param eNB_id ID of eNB on which to act
@param abstraction_flag Indicator of PHY abstraction @param abstraction_flag Indicator of PHY abstraction
@param mode calibration/debug mode @param mode calibration/debug mode
@param relaying_mode indicates the relaying operation: 0: no_relaying, 1: unicast relaying, 2: multicast relaying
*/ */
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); 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_mode_t r_mode);
/*! /*!
\brief Scheduling for UE TX procedures in normal subframes. \brief Scheduling for UE TX procedures in normal subframes.
...@@ -146,7 +148,7 @@ void phy_procedures_UE_lte(u8 last_slot, u8 next_slot,PHY_VARS_UE *phy_vars_ue,u ...@@ -146,7 +148,7 @@ void phy_procedures_UE_lte(u8 last_slot, u8 next_slot,PHY_VARS_UE *phy_vars_ue,u
@param abstraction_flag Indicator of PHY abstraction @param abstraction_flag Indicator of PHY abstraction
@param mode calib/normal mode @param mode calib/normal mode
*/ */
void phy_procedures_UE_TX(u8 next_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag,runmode_t mode); void phy_procedures_UE_TX(u8 next_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag,runmode_t mode,relaying_mode_t r_mode);
/*! /*!
\brief Scheduling for UE RX procedures in normal subframes. \brief Scheduling for UE RX procedures in normal subframes.
@param last_slot Index of last slot (0-19) @param last_slot Index of last slot (0-19)
...@@ -154,8 +156,9 @@ void phy_procedures_UE_TX(u8 next_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abs ...@@ -154,8 +156,9 @@ void phy_procedures_UE_TX(u8 next_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abs
@param eNB_id Local id of eNB on which to act @param eNB_id Local id of eNB on which to act
@param abstraction_flag Indicator of PHY abstraction @param abstraction_flag Indicator of PHY abstraction
@param mode calibration/debug mode @param mode calibration/debug mode
@param r_mode instruct PHY to operate as normal (0), unicast relay (1), or multicast relay (2)
*/ */
int phy_procedures_UE_RX(u8 last_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag,runmode_t mode); int phy_procedures_UE_RX(u8 last_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag,runmode_t mode,relaying_mode_t r_mode);
/*! /*!
\brief Scheduling for UE TX procedures in TDD S-subframes. \brief Scheduling for UE TX procedures in TDD S-subframes.
...@@ -164,7 +167,7 @@ int phy_procedures_UE_RX(u8 last_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abst ...@@ -164,7 +167,7 @@ int phy_procedures_UE_RX(u8 last_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abst
@param eNB_id Local id of eNB on which to act @param eNB_id Local id of eNB on which to act
@param abstraction_flag Indicator of PHY abstraction @param abstraction_flag Indicator of PHY abstraction
*/ */
void phy_procedures_UE_S_TX(u8 next_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag); void phy_procedures_UE_S_TX(u8 next_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag,relaying_mode_t r_mode);
/*! /*!
\brief Scheduling for UE RX procedures in TDD S-subframes. \brief Scheduling for UE RX procedures in TDD S-subframes.
...@@ -173,15 +176,17 @@ void phy_procedures_UE_S_TX(u8 next_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 a ...@@ -173,15 +176,17 @@ void phy_procedures_UE_S_TX(u8 next_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 a
@param eNB_id Local id of eNB on which to act @param eNB_id Local id of eNB on which to act
@param abstraction_flag Indicator of PHY abstraction @param abstraction_flag Indicator of PHY abstraction
*/ */
void phy_procedures_UE_S_RX(u8 last_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag); void phy_procedures_UE_S_RX(u8 last_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag, relaying_mode_t r_mode);
/*! /*!
\brief Scheduling for eNB TX procedures in normal subframes. \brief Scheduling for eNB TX procedures in normal subframes.
@param next_slot Index of next slot (0-19) @param next_slot Index of next slot (0-19)
@param phy_vars_eNB Pointer to eNB variables on which to act @param phy_vars_eNB Pointer to eNB variables on which to act
@param abstraction_flag Indicator of PHY abstraction @param abstraction_flag Indicator of PHY abstraction
@param r_mode instruct PHY to operate as normal (0), unicast relay (1), or multicast relay (2),
@note: r_mode could be extended to support other values to indicate the type of relaying AF,DF,QF, and QMF
*/ */
void phy_procedures_eNB_TX(u8 next_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag); void phy_procedures_eNB_TX(u8 next_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag,relaying_mode_t r_mode);
/*! /*!
\brief Scheduling for eNB RX procedures in normal subframes. \brief Scheduling for eNB RX procedures in normal subframes.
...@@ -189,7 +194,7 @@ void phy_procedures_eNB_TX(u8 next_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstractio ...@@ -189,7 +194,7 @@ void phy_procedures_eNB_TX(u8 next_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstractio
@param phy_vars_eNB Pointer to eNB variables on which to act @param phy_vars_eNB Pointer to eNB variables on which to act
@param abstraction_flag Indicator of PHY abstraction @param abstraction_flag Indicator of PHY abstraction
*/ */
void phy_procedures_eNB_RX(u8 last_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag); void phy_procedures_eNB_RX(u8 last_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag,relaying_mode_t r_mode);
/*! /*!
\brief Scheduling for eNB TX procedures in TDD S-subframes. \brief Scheduling for eNB TX procedures in TDD S-subframes.
...@@ -197,7 +202,7 @@ void phy_procedures_eNB_RX(u8 last_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstractio ...@@ -197,7 +202,7 @@ void phy_procedures_eNB_RX(u8 last_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstractio
@param phy_vars_eNB Pointer to eNB variables on which to act @param phy_vars_eNB Pointer to eNB variables on which to act
@param abstraction_flag Indicator of PHY abstraction @param abstraction_flag Indicator of PHY abstraction
*/ */
void phy_procedures_eNB_S_TX(u8 next_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag); void phy_procedures_eNB_S_TX(u8 next_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag,relaying_mode_t r_mode);
/*! /*!
\brief Scheduling for eNB RX procedures in TDD S-subframes. \brief Scheduling for eNB RX procedures in TDD S-subframes.
...@@ -205,7 +210,7 @@ void phy_procedures_eNB_S_TX(u8 next_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstract ...@@ -205,7 +210,7 @@ void phy_procedures_eNB_S_TX(u8 next_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstract
@param phy_vars_eNB Pointer to eNB variables on which to act @param phy_vars_eNB Pointer to eNB variables on which to act
@param abstraction_flag Indicator of PHY abstraction @param abstraction_flag Indicator of PHY abstraction
*/ */
void phy_procedures_eNB_S_RX(u8 last_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag); void phy_procedures_eNB_S_RX(u8 last_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag,relaying_mode_t r_mode);
/*! /*!
\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. \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.
......
...@@ -410,7 +410,7 @@ void phy_procedures_emos_eNB_TX(unsigned char next_slot, PHY_VARS_eNB *phy_vars_ ...@@ -410,7 +410,7 @@ void phy_procedures_emos_eNB_TX(unsigned char next_slot, PHY_VARS_eNB *phy_vars_
} }
*/ */
void phy_procedures_eNB_S_RX(unsigned char last_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag) { void phy_procedures_eNB_S_RX(unsigned char last_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag,relaying_mode_t r_mode) {
unsigned char sect_id=0; unsigned char sect_id=0;
...@@ -885,7 +885,7 @@ void fill_dci_emos(DCI_PDU *DCI_pdu, u8 subframe, PHY_VARS_eNB *phy_vars_eNB) { ...@@ -885,7 +885,7 @@ 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 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)}; 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) { void phy_procedures_eNB_TX(unsigned char next_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag,relaying_mode_t r_mode) {
u8 *pbch_pdu=&phy_vars_eNB->pbch_pdu[0]; u8 *pbch_pdu=&phy_vars_eNB->pbch_pdu[0];
// unsigned int nb_dci_ue_spec = 0, nb_dci_common = 0; // unsigned int nb_dci_ue_spec = 0, nb_dci_common = 0;
u16 input_buffer_length, re_allocated=0; u16 input_buffer_length, re_allocated=0;
...@@ -2397,7 +2397,7 @@ void ulsch_decoding_procedures(unsigned char last_slot, unsigned int i, PHY_VARS ...@@ -2397,7 +2397,7 @@ void ulsch_decoding_procedures(unsigned char last_slot, unsigned int i, PHY_VARS
} }
void phy_procedures_eNB_RX(unsigned char last_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag) { void phy_procedures_eNB_RX(unsigned char last_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag,relaying_mode_t r_mode) {
//RX processing //RX processing
u32 l, ret,i,j; u32 l, ret,i,j;
u32 sect_id=0; u32 sect_id=0;
...@@ -3357,7 +3357,7 @@ void phy_procedures_eNB_RX(unsigned char last_slot,PHY_VARS_eNB *phy_vars_eNB,u8 ...@@ -3357,7 +3357,7 @@ void phy_procedures_eNB_RX(unsigned char last_slot,PHY_VARS_eNB *phy_vars_eNB,u8
#undef DEBUG_PHY_PROC #undef DEBUG_PHY_PROC
void phy_procedures_eNB_lte(unsigned char last_slot, unsigned char next_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag) { void phy_procedures_eNB_lte(unsigned char last_slot, unsigned char next_slot,PHY_VARS_eNB *phy_vars_eNB,u8 abstraction_flag, relaying_mode_t r_mode) {
/* /*
if (phy_vars_eNB->frame >= 1000) if (phy_vars_eNB->frame >= 1000)
mac_xface->macphy_exit("Exiting after 1000 Frames\n"); mac_xface->macphy_exit("Exiting after 1000 Frames\n");
...@@ -3372,28 +3372,29 @@ void phy_procedures_eNB_lte(unsigned char last_slot, unsigned char next_slot,PHY ...@@ -3372,28 +3372,29 @@ void phy_procedures_eNB_lte(unsigned char last_slot, unsigned char next_slot,PHY
#ifdef DEBUG_PHY_PROC #ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[eNB %d] Frame %d: Calling phy_procedures_eNB_TX(%d)\n", phy_vars_eNB->Mod_id,phy_vars_eNB->frame, next_slot); LOG_D(PHY,"[eNB %d] Frame %d: Calling phy_procedures_eNB_TX(%d)\n", phy_vars_eNB->Mod_id,phy_vars_eNB->frame, next_slot);
#endif #endif
phy_procedures_eNB_TX(next_slot,phy_vars_eNB,abstraction_flag);
phy_procedures_eNB_TX(next_slot,phy_vars_eNB,abstraction_flag,r_mode);
} }
if (((phy_vars_eNB->lte_frame_parms.frame_type == 1 )&&(subframe_select(&phy_vars_eNB->lte_frame_parms,last_slot>>1)==SF_UL))|| 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)){ (phy_vars_eNB->lte_frame_parms.frame_type == 0)){
#ifdef DEBUG_PHY_PROC #ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[eNB %d] Frame %d: Calling phy_procedures_eNB_RX(%d)\n",phy_vars_eNB->Mod_id,phy_vars_eNB->frame, last_slot); LOG_D(PHY,"[eNB %d] Frame %d: Calling phy_procedures_eNB_RX(%d)\n",phy_vars_eNB->Mod_id,phy_vars_eNB->frame, last_slot);
#endif #endif
phy_procedures_eNB_RX(last_slot,phy_vars_eNB,abstraction_flag); phy_procedures_eNB_RX(last_slot,phy_vars_eNB,abstraction_flag,r_mode);
} }
if ((subframe_select(&phy_vars_eNB->lte_frame_parms,next_slot>>1)==SF_S) && if ((subframe_select(&phy_vars_eNB->lte_frame_parms,next_slot>>1)==SF_S) &&
((next_slot&1)==0)) { ((next_slot&1)==0)) {
#ifdef DEBUG_PHY_PROC #ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[eNB %d] Frame %d: Calling phy_procedures_eNB_S_TX(%d)\n",phy_vars_eNB->Mod_id,phy_vars_eNB->frame, next_slot); LOG_D(PHY,"[eNB %d] Frame %d: Calling phy_procedures_eNB_S_TX(%d)\n",phy_vars_eNB->Mod_id,phy_vars_eNB->frame, next_slot);
#endif #endif
phy_procedures_eNB_TX(next_slot,phy_vars_eNB,abstraction_flag); phy_procedures_eNB_TX(next_slot,phy_vars_eNB,abstraction_flag,r_mode);
} }
if ((subframe_select(&phy_vars_eNB->lte_frame_parms,last_slot>>1)==SF_S) && if ((subframe_select(&phy_vars_eNB->lte_frame_parms,last_slot>>1)==SF_S) &&
((last_slot&1)==0)){ ((last_slot&1)==0)){
#ifdef DEBUG_PHY_PROC #ifdef DEBUG_PHY_PROC
LOG_D(PHY,"[eNB %d] Frame %d: Calling phy_procedures_eNB_S_RX(%d)\n", phy_vars_eNB->Mod_id,phy_vars_eNB->frame, last_slot); LOG_D(PHY,"[eNB %d] Frame %d: Calling phy_procedures_eNB_S_RX(%d)\n", phy_vars_eNB->Mod_id,phy_vars_eNB->frame, last_slot);
#endif #endif
phy_procedures_eNB_S_RX(last_slot,phy_vars_eNB,abstraction_flag); phy_procedures_eNB_S_RX(last_slot,phy_vars_eNB,abstraction_flag,r_mode);
} }
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_LTE,0); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_ENB_LTE,0);
......
...@@ -557,7 +557,7 @@ int dummy_tx_buffer[3840*4] __attribute__((aligned(16))); ...@@ -557,7 +557,7 @@ int dummy_tx_buffer[3840*4] __attribute__((aligned(16)));
PRACH_RESOURCES_t prach_resources_local; PRACH_RESOURCES_t prach_resources_local;
#endif #endif
void phy_procedures_UE_TX(u8 next_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag,runmode_t mode) { void phy_procedures_UE_TX(u8 next_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag,runmode_t mode,relaying_mode_t r_mode) {
// int i_d; // int i_d;
u16 first_rb, nb_rb; u16 first_rb, nb_rb;
...@@ -1292,7 +1292,7 @@ void phy_procedures_UE_TX(u8 next_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abs ...@@ -1292,7 +1292,7 @@ void phy_procedures_UE_TX(u8 next_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_TX, VCD_FUNCTION_OUT); vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_UE_TX, VCD_FUNCTION_OUT);
} }
void phy_procedures_UE_S_TX(u8 next_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag) { void phy_procedures_UE_S_TX(u8 next_slot,PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag,relaying_mode_t r_mode) {
int aa;//i,aa; int aa;//i,aa;
LTE_DL_FRAME_PARMS *frame_parms=&phy_vars_ue->lte_frame_parms; LTE_DL_FRAME_PARMS *frame_parms=&phy_vars_ue->lte_frame_parms;
...@@ -2163,7 +2163,7 @@ int lte_ue_pdcch_procedures(u8 eNB_id,u8 last_slot, PHY_VARS_UE *phy_vars_ue,u8 ...@@ -2163,7 +2163,7 @@ 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) { int phy_procedures_UE_RX(u8 last_slot, PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abstraction_flag,runmode_t mode,relaying_mode_t r_mode) {
u16 l,m,n_symb; u16 l,m,n_symb;
// int eNB_id = 0, // int eNB_id = 0,
...@@ -3015,7 +3015,7 @@ int phy_procedures_UE_RX(u8 last_slot, PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abs ...@@ -3015,7 +3015,7 @@ int phy_procedures_UE_RX(u8 last_slot, PHY_VARS_UE *phy_vars_ue,u8 eNB_id,u8 abs
return (0); return (0);
} }
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) { 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_mode_t r_mode) {
#undef DEBUG_PHY_PROC #undef DEBUG_PHY_PROC
...@@ -3039,22 +3039,22 @@ void phy_procedures_UE_lte(u8 last_slot, u8 next_slot, PHY_VARS_UE *phy_vars_ue, ...@@ -3039,22 +3039,22 @@ void phy_procedures_UE_lte(u8 last_slot, u8 next_slot, PHY_VARS_UE *phy_vars_ue,
if ((subframe_select(&phy_vars_ue->lte_frame_parms,next_slot>>1)==SF_UL)|| if ((subframe_select(&phy_vars_ue->lte_frame_parms,next_slot>>1)==SF_UL)||
(phy_vars_ue->lte_frame_parms.frame_type == 0)){ (phy_vars_ue->lte_frame_parms.frame_type == 0)){
phy_procedures_UE_TX(next_slot,phy_vars_ue,eNB_id,abstraction_flag,mode); phy_procedures_UE_TX(next_slot,phy_vars_ue,eNB_id,abstraction_flag,mode,r_mode);
} }
if ((subframe_select(&phy_vars_ue->lte_frame_parms,last_slot>>1)==SF_DL) || if ((subframe_select(&phy_vars_ue->lte_frame_parms,last_slot>>1)==SF_DL) ||
(phy_vars_ue->lte_frame_parms.frame_type == 0)){ (phy_vars_ue->lte_frame_parms.frame_type == 0)){
phy_procedures_UE_RX(last_slot,phy_vars_ue,eNB_id,abstraction_flag,mode); phy_procedures_UE_RX(last_slot,phy_vars_ue,eNB_id,abstraction_flag,mode,r_mode);
#ifdef EMOS #ifdef EMOS
phy_procedures_emos_UE_RX(phy_vars_ue,last_slot,eNB_id); phy_procedures_emos_UE_RX(phy_vars_ue,last_slot,eNB_id);
#endif #endif
} }
if ((subframe_select(&phy_vars_ue->lte_frame_parms,next_slot>>1)==SF_S) && if ((subframe_select(&phy_vars_ue->lte_frame_parms,next_slot>>1)==SF_S) &&
((next_slot&1)==1)) { ((next_slot&1)==1)) {
phy_procedures_UE_S_TX(next_slot,phy_vars_ue,eNB_id,abstraction_flag); phy_procedures_UE_S_TX(next_slot,phy_vars_ue,eNB_id,abstraction_flag,r_mode);
} }
if ((subframe_select(&phy_vars_ue->lte_frame_parms,last_slot>>1)==SF_S) && if ((subframe_select(&phy_vars_ue->lte_frame_parms,last_slot>>1)==SF_S) &&
((last_slot&1)==0)) { ((last_slot&1)==0)) {
phy_procedures_UE_RX(last_slot,phy_vars_ue,eNB_id,abstraction_flag,mode); phy_procedures_UE_RX(last_slot,phy_vars_ue,eNB_id,abstraction_flag,mode, r_mode);
} }
#ifdef OPENAIR2 #ifdef OPENAIR2
......
...@@ -48,6 +48,7 @@ extern unsigned char NB_INST; ...@@ -48,6 +48,7 @@ extern unsigned char NB_INST;
#endif #endif
extern unsigned char NB_eNB_INST; extern unsigned char NB_eNB_INST;
extern unsigned char NB_UE_INST; extern unsigned char NB_UE_INST;
extern unsigned char NB_RN_INST;
extern unsigned short NODE_ID[1]; extern unsigned short NODE_ID[1];
extern void* bigphys_malloc(int); extern void* bigphys_malloc(int);
#else #else
......
...@@ -330,7 +330,7 @@ int mac_top_init(int eMBMS_active, u8 cba_group_active){ ...@@ -330,7 +330,7 @@ int mac_top_init(int eMBMS_active, u8 cba_group_active){
int mac_init_global_param(void){ int mac_init_global_param(void){
/***********************************************************************/ /***********************************************************************/
Is_rrc_registered=0;
Mac_rlc_xface = NULL; Mac_rlc_xface = NULL;
LOG_I(MAC,"[MAIN] CALLING RLC_MODULE_INIT...\n"); LOG_I(MAC,"[MAIN] CALLING RLC_MODULE_INIT...\n");
...@@ -376,7 +376,7 @@ int mac_init_global_param(void){ ...@@ -376,7 +376,7 @@ int mac_init_global_param(void){
LOG_I(MAC,"[MAIN] RLC interface setup and init\n"); LOG_I(MAC,"[MAIN] RLC interface setup and init\n");
rrc_init_global_param(); rrc_init_global_param();
Is_rrc_registered=1;
#ifdef USER_MODE #ifdef USER_MODE
pdcp_layer_init (); pdcp_layer_init ();
#else #else
...@@ -410,9 +410,9 @@ int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, u8 cba_group_activ ...@@ -410,9 +410,9 @@ int l2_init(LTE_DL_FRAME_PARMS *frame_parms,int eMBMS_active, u8 cba_group_activ
// NB_NODE=2; // NB_NODE=2;
// NB_INST=2; // NB_INST=2;
Is_rrc_registered=0;
mac_init_global_param(); mac_init_global_param();
Is_rrc_registered=1;
mac_xface->macphy_init = mac_top_init; mac_xface->macphy_init = mac_top_init;
#ifndef USER_MODE #ifndef USER_MODE
......
...@@ -247,7 +247,7 @@ u32 ue_get_SR(u8 Mod_id,u32 frame,u8 eNB_id,u16 rnti, u8 subframe) { ...@@ -247,7 +247,7 @@ u32 ue_get_SR(u8 Mod_id,u32 frame,u8 eNB_id,u16 rnti, u8 subframe) {
(1<<(2+UE_mac_inst[Mod_id].physicalConfigDedicated->schedulingRequestConfig->choice.setup.dsr_TransMax)), (1<<(2+UE_mac_inst[Mod_id].physicalConfigDedicated->schedulingRequestConfig->choice.setup.dsr_TransMax)),
UE_mac_inst[Mod_id].scheduling_info.SR_pending); UE_mac_inst[Mod_id].scheduling_info.SR_pending);
UE_mac_inst[Mod_id].ul_active =1; //UE_mac_inst[Mod_id].ul_active =1;
return(1); //instruct phy to signal SR return(1); //instruct phy to signal SR
} }
...@@ -1393,31 +1393,35 @@ int use_cba_access(u8 Mod_id,u32 frame,u8 subframe, u8 eNB_index){ ...@@ -1393,31 +1393,35 @@ int use_cba_access(u8 Mod_id,u32 frame,u8 subframe, u8 eNB_index){
if (( ((UE_mac_inst[Mod_id].scheduling_info.BSR[LCGID1]>0)&&(UE_mac_inst[Mod_id].scheduling_info.BSR[LCGID1]<64)) || if (( ((UE_mac_inst[Mod_id].scheduling_info.BSR[LCGID1]>0)&&(UE_mac_inst[Mod_id].scheduling_info.BSR[LCGID1]<64)) ||
((UE_mac_inst[Mod_id].scheduling_info.BSR[LCGID2]>0)&&(UE_mac_inst[Mod_id].scheduling_info.BSR[LCGID2]<64)) || ((UE_mac_inst[Mod_id].scheduling_info.BSR[LCGID2]>0)&&(UE_mac_inst[Mod_id].scheduling_info.BSR[LCGID2]<64)) ||
((UE_mac_inst[Mod_id].scheduling_info.BSR[LCGID3]>0)&&(UE_mac_inst[Mod_id].scheduling_info.BSR[LCGID3]<64)) ) ((UE_mac_inst[Mod_id].scheduling_info.BSR[LCGID3]>0)&&(UE_mac_inst[Mod_id].scheduling_info.BSR[LCGID3]<64)) )
// && (UE_mac_inst[Mod_id].ul_active == 0) // check if the ul is acrtive // && (UE_mac_inst[Mod_id].ul_active == 0) // check if the ul is acrtive
&& (UE_mac_inst[Mod_id].cba_last_access[0] <= 0) ) { // backoff && (UE_mac_inst[Mod_id].cba_last_access[0] <= 0) ) { // backoff
// LOG_D(MAC,"[UE %d] Frame %d Subframe %d: the current CBA backoff is %d \n", Mod_id, frame, subframe, // LOG_D(MAC,"[UE %d] Frame %d Subframe %d: the current CBA backoff is %d \n", Mod_id, frame, subframe,
// UE_mac_inst[Mod_id].cba_last_access[0] ); // UE_mac_inst[Mod_id].cba_last_access[0] );
UE_mac_inst[Mod_id].cba_last_access[0]= round(uniform_rngen(1,30)); UE_mac_inst[Mod_id].cba_last_access[0]= round(uniform_rngen(1,10));
LOG_D(MAC,"[UE %d] Frame %d Subframe %d: start a new CBA backoff %d UL active state %d \n", Mod_id, frame, subframe, LOG_D(MAC,"[UE %d] Frame %d Subframe %d: start a new CBA backoff %d UL active state %d \n", Mod_id, frame, subframe,
UE_mac_inst[Mod_id].cba_last_access[0], UE_mac_inst[Mod_id].ul_active); UE_mac_inst[Mod_id].cba_last_access[0], UE_mac_inst[Mod_id].ul_active);
return 1; return 1;
} else { } else if (( ((UE_mac_inst[Mod_id].scheduling_info.BSR[LCGID1]> 0 )) ||
((UE_mac_inst[Mod_id].scheduling_info.BSR[LCGID2]> 0 )) ||
if (( ((UE_mac_inst[Mod_id].scheduling_info.BSR[LCGID1]> 0 )) || ((UE_mac_inst[Mod_id].scheduling_info.BSR[LCGID3]> 0 )) )
((UE_mac_inst[Mod_id].scheduling_info.BSR[LCGID2]> 0 )) || // && (UE_mac_inst[Mod_id].ul_active == 0) // check if the ul is acrtive
((UE_mac_inst[Mod_id].scheduling_info.BSR[LCGID3]> 0 )) ) && (UE_mac_inst[Mod_id].cba_last_access[0]> 0) ){
// && (UE_mac_inst[Mod_id].ul_active == 0) // check if the ul is acrtive
&& (UE_mac_inst[Mod_id].cba_last_access[0]> 0) ){
UE_mac_inst[Mod_id].cba_last_access[0]-=1; UE_mac_inst[Mod_id].cba_last_access[0]-=1;
LOG_D(MAC,"[UE %d] Frame %d Subframe %d: CBA backoff is decreased by one to %d UL active state %d \n", LOG_D(MAC,"[UE %d] Frame %d Subframe %d: CBA backoff is decreased by one to %d UL active state %d \n",
Mod_id, frame, subframe, Mod_id, frame, subframe,
UE_mac_inst[Mod_id].cba_last_access[0], UE_mac_inst[Mod_id].ul_active); UE_mac_inst[Mod_id].cba_last_access[0], UE_mac_inst[Mod_id].ul_active);
}
return 0; } /*else if (( ((UE_mac_inst[Mod_id].scheduling_info.BSR[LCGID1] == 0 )) &&
} ((UE_mac_inst[Mod_id].scheduling_info.BSR[LCGID2] == 0 )) &&
((UE_mac_inst[Mod_id].scheduling_info.BSR[LCGID3] == 0 )) )
&& (UE_mac_inst[Mod_id].cba_last_access[0]> 0) ){
UE_mac_inst[Mod_id].cba_last_access[0]-=1;
}*/
return 0;
} }
#endif #endif
......
...@@ -78,6 +78,7 @@ u8 Is_rrc_registered; ...@@ -78,6 +78,7 @@ u8 Is_rrc_registered;
#ifdef OPENAIR2 #ifdef OPENAIR2
unsigned char NB_eNB_INST=0; unsigned char NB_eNB_INST=0;
unsigned char NB_UE_INST=0; unsigned char NB_UE_INST=0;
unsigned char NB_RN_INST=0;
unsigned char NB_INST=0; unsigned char NB_INST=0;
#endif #endif
......
...@@ -274,7 +274,9 @@ typedef struct{ ...@@ -274,7 +274,9 @@ typedef struct{
SystemInformationBlockType9_t *sib9[NB_CNX_UE]; SystemInformationBlockType9_t *sib9[NB_CNX_UE];
SystemInformationBlockType10_t *sib10[NB_CNX_UE]; SystemInformationBlockType10_t *sib10[NB_CNX_UE];
SystemInformationBlockType11_t *sib11[NB_CNX_UE]; SystemInformationBlockType11_t *sib11[NB_CNX_UE];
#ifdef Rel10 #ifdef Rel10
uint8_t MBMS_flag;
u8 *MCCH_MESSAGE[NB_CNX_UE]; u8 *MCCH_MESSAGE[NB_CNX_UE];
u8 sizeof_MCCH_MESSAGE[NB_CNX_UE]; u8 sizeof_MCCH_MESSAGE[NB_CNX_UE];
u8 MCCH_MESSAGEStatus[NB_CNX_UE]; u8 MCCH_MESSAGEStatus[NB_CNX_UE];
......
...@@ -156,7 +156,7 @@ void rrc_ue_generate_RRCConnectionRequest(u8 Mod_id, u32 frame, u8 eNB_index){ ...@@ -156,7 +156,7 @@ void rrc_ue_generate_RRCConnectionRequest(u8 Mod_id, u32 frame, u8 eNB_index){
/*------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------*/
u8 i=0,rv[6]; u8 i=0,rv[6];
if(UE_rrc_inst[Mod_id].Srb0[eNB_index].Tx_buffer.payload_size ==0){ if(UE_rrc_inst[Mod_id].Srb0[eNB_index].Tx_buffer.payload_size ==0){
// Get RRCConnectionRequest, fill random for now // Get RRCConnectionRequest, fill random for now
...@@ -1468,7 +1468,10 @@ int decode_SI(u8 Mod_id,u32 frame,u8 eNB_index,u8 si_window) { ...@@ -1468,7 +1468,10 @@ int decode_SI(u8 Mod_id,u32 frame,u8 eNB_index,u8 si_window) {
); );
UE_rrc_inst[Mod_id].Info[eNB_index].SIStatus = 1; UE_rrc_inst[Mod_id].Info[eNB_index].SIStatus = 1;
// After SI is received, prepare RRCConnectionRequest // After SI is received, prepare RRCConnectionRequest
rrc_ue_generate_RRCConnectionRequest(Mod_id,frame,eNB_index); #ifdef Rel10
if (UE_rrc_inst[Mod_id].MBMS_flag < 3) // see -Q option
#endif
rrc_ue_generate_RRCConnectionRequest(Mod_id,frame,eNB_index);
if (UE_rrc_inst[Mod_id].Info[eNB_index].State == RRC_IDLE) { if (UE_rrc_inst[Mod_id].Info[eNB_index].State == RRC_IDLE) {
LOG_I(RRC,"[UE %d] Received SIB1/SIB2/SIB3 Switching to RRC_SI_RECEIVED\n",Mod_id); LOG_I(RRC,"[UE %d] Received SIB1/SIB2/SIB3 Switching to RRC_SI_RECEIVED\n",Mod_id);
......
...@@ -232,6 +232,12 @@ void openair_rrc_top_init(int eMBMS_active, u8 cba_group_active){ ...@@ -232,6 +232,12 @@ void openair_rrc_top_init(int eMBMS_active, u8 cba_group_active){
dummy_buffer, dummy_buffer,
0, 0,
0);*/ 0);*/
#ifdef Rel10
LOG_I(RRC,"[UE] eMBMS active state is %d \n", eMBMS_active);
for (i=0;i<NB_eNB_INST;i++) {
UE_rrc_inst[i].MBMS_flag = (uint8_t)eMBMS_active;
}
#endif
} else } else
UE_rrc_inst=NULL; UE_rrc_inst=NULL;
...@@ -240,10 +246,15 @@ void openair_rrc_top_init(int eMBMS_active, u8 cba_group_active){ ...@@ -240,10 +246,15 @@ void openair_rrc_top_init(int eMBMS_active, u8 cba_group_active){
eNB_rrc_inst = (eNB_RRC_INST*)malloc16(NB_eNB_INST*sizeof(eNB_RRC_INST)); eNB_rrc_inst = (eNB_RRC_INST*)malloc16(NB_eNB_INST*sizeof(eNB_RRC_INST));
memset(eNB_rrc_inst,0,NB_eNB_INST*sizeof(eNB_RRC_INST)); memset(eNB_rrc_inst,0,NB_eNB_INST*sizeof(eNB_RRC_INST));
#ifdef Rel10 #ifdef Rel10
eNB_rrc_inst->MBMS_flag = (uint8_t)eMBMS_active; LOG_I(RRC,"[eNB] eMBMS active state is %d \n", eMBMS_active);
for (i=0;i<NB_eNB_INST;i++) {
eNB_rrc_inst[i].MBMS_flag = (uint8_t)eMBMS_active;
}
#endif #endif
#ifdef CBA #ifdef CBA
eNB_rrc_inst->num_active_cba_groups = cba_group_active; for (i=0;i<NB_eNB_INST;i++) {
eNB_rrc_inst[i].num_active_cba_groups = cba_group_active;
}
#endif #endif
LOG_D(RRC,"ALLOCATE %d Bytes for eNB_RRC_INST @ %p\n",(unsigned int)(NB_eNB_INST*sizeof(eNB_RRC_INST)),eNB_rrc_inst); LOG_D(RRC,"ALLOCATE %d Bytes for eNB_RRC_INST @ %p\n",(unsigned int)(NB_eNB_INST*sizeof(eNB_RRC_INST)),eNB_rrc_inst);
}else }else
......
...@@ -636,7 +636,10 @@ The following diagram is based on graphviz (http://www.graphviz.org/), you need ...@@ -636,7 +636,10 @@ The following diagram is based on graphviz (http://www.graphviz.org/), you need
unsigned char nb_ue_remote; unsigned char nb_ue_remote;
unsigned char nb_enb_local; unsigned char nb_enb_local;
unsigned char nb_enb_remote; unsigned char nb_enb_remote;
unsigned char nb_rn_local;
unsigned char nb_rn_remote;
unsigned char first_enb_local; unsigned char first_enb_local;
unsigned char first_rn_local;
unsigned char first_ue_local; unsigned char first_ue_local;
unsigned short master_id; unsigned short master_id;
unsigned char nb_master; unsigned char nb_master;
...@@ -655,6 +658,7 @@ The following diagram is based on graphviz (http://www.graphviz.org/), you need ...@@ -655,6 +658,7 @@ The following diagram is based on graphviz (http://www.graphviz.org/), you need
unsigned char otg_enabled; unsigned char otg_enabled;
unsigned char omv_enabled; unsigned char omv_enabled;
unsigned char vcd_enabled; unsigned char vcd_enabled;
unsigned char eMBMS_active_state;
unsigned char cba_group_active; unsigned char cba_group_active;
char * otg_traffic; char * otg_traffic;
unsigned char otg_bg_traffic_enabled; unsigned char otg_bg_traffic_enabled;
......
...@@ -111,14 +111,14 @@ char *str_sub (const char *s, unsigned int start, unsigned int end) { ...@@ -111,14 +111,14 @@ char *str_sub (const char *s, unsigned int start, unsigned int end) {
// set the simulation time // set the simulation time
void set_ctime(int ctime){ void set_ctime(int ctime){
otg_info->ctime=ctime; otg_info->ctime=ctime;
} }
// get the simulation time // get the simulation time
int get_ctime(void){ int get_ctime(void){
return otg_info->ctime; return otg_info->ctime;
} }
......
...@@ -200,7 +200,7 @@ int adjust_size(int size){ ...@@ -200,7 +200,7 @@ int adjust_size(int size){
unsigned char *packet_gen(int src, int dst, int ctime, int * pkt_size){ // when pdcp, ctime = frame cnt unsigned char *packet_gen(int src, int dst, int app, int ctime, int * pkt_size){ // when pdcp, ctime = frame cnt
//unsigned char *packet=NULL; //unsigned char *packet=NULL;
unsigned int size=0; unsigned int size=0;
...@@ -213,12 +213,16 @@ unsigned char *packet_gen(int src, int dst, int ctime, int * pkt_size){ // when ...@@ -213,12 +213,16 @@ unsigned char *packet_gen(int src, int dst, int ctime, int * pkt_size){ // when
char *header=NULL; char *header=NULL;
int header_size; int header_size;
LOG_T(OTG,"[src %d] [dst %d ]MY_CTIME %d, MAX_FRAME %d\n",src, dst, ctime, g_otg->max_nb_frames);
// check if the app is configured
if (app >= g_otg->application_idx[src][dst]){
return NULL;
}