Commit 93c5cb89 authored by Nick Ho's avatar Nick Ho

debug to the rrc_mac_data_req_eNB_NB_IoT()

parent 6a95995f
...@@ -42,6 +42,12 @@ NB_IoT_DL_FRAME_PARMS *get_NB_IoT_frame_parms(module_id_t Mod_id, uint8_t CC_id) ...@@ -42,6 +42,12 @@ NB_IoT_DL_FRAME_PARMS *get_NB_IoT_frame_parms(module_id_t Mod_id, uint8_t CC_id)
int16_t get_hundred_times_delta_IF_eNB_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,uint8_t UE_id,uint8_t harq_pid, uint8_t bw_factor); int16_t get_hundred_times_delta_IF_eNB_NB_IoT(PHY_VARS_eNB_NB_IoT *phy_vars_eNB,uint8_t UE_id,uint8_t harq_pid, uint8_t bw_factor);
uint32_t is_SIB1_NB_IoT(const frame_t frameP,
long schedulingInfoSIB1, //from the mib
int physCellId, //by configuration
NB_IoT_eNB_NDLSCH_t *ndlsch_SIB1
);
#endif #endif
...@@ -88,18 +88,123 @@ ...@@ -88,18 +88,123 @@
///fifo_dump_emos_eNB emos_dump_eNB; ///fifo_dump_emos_eNB emos_dump_eNB;
///#endif ///#endif
/* int npdsch_rep_to_array[3] = {4,8,16}; //TS 36.213 Table 16.4.1.3-3
#if defined(SMBV) int sib1_startFrame_to_array[4] = {0,16,32,48};//TS 36.213 Table 16.4.1.3-4
extern const char smbv_fname[];
extern unsigned short config_frames[4]; //New----------------------------------------------------
extern uint8_t smbv_frame_cnt; //return -1 whenever no SIB1-NB transmission occur.
#endif //return sib1_startFrame when transmission occur in the current frame
uint32_t is_SIB1_NB_IoT(const frame_t frameP,
long schedulingInfoSIB1, //from the mib
int physCellId, //by configuration
NB_IoT_eNB_NDLSCH_t *ndlsch_SIB1
)
{
uint8_t nb_rep=0; // number of sib1-nb repetitions within the 256 radio frames
uint32_t sib1_startFrame;
uint32_t sib1_period_NB_IoT = 256;//from specs TS 36.331 (rf)
uint8_t index;
int offset;
int period_nb; // the number of the actual period over the 1024 frames
if(schedulingInfoSIB1 > 11 || schedulingInfoSIB1 < 0){
LOG_E(RRC, "is_SIB1_NB_IoT: schedulingInfoSIB1 value not allowed");
return 0;
}
//SIB1-NB period number
period_nb = (int) frameP/sib1_period_NB_IoT;
//number of repetitions
nb_rep = npdsch_rep_to_array[schedulingInfoSIB1%3];
//based on number of rep. and the physical cell id we derive the starting radio frame (TS 36.213 Table 16.4.1.3-3/4)
switch(nb_rep)
{
case 4:
//physCellId%4 possible value are 0,1,2,3
sib1_startFrame = sib1_startFrame_to_array[physCellId%4];
break;
case 8:
//physCellId%2possible value are 0,1
sib1_startFrame = sib1_startFrame_to_array[physCellId%2];
break;
case 16:
//physCellId%2 possible value are 0,1
if(physCellId%2 == 0)
sib1_startFrame = 0;
else
sib1_startFrame = 1; // the only case in which the starting frame is odd
break;
default:
LOG_E(RRC, "Number of repetitions %d not allowed", nb_rep);
return -1;
}
//check the actual frame w.r.t SIB1-NB starting frame
if(frameP < sib1_startFrame + period_nb*256){
LOG_T(RRC, "the actual frame %d is before the SIB1-NB starting frame %d of the period--> bcch_sdu_legnth = 0", frameP, sib1_startFrame + period_nb*256);
return -1;
}
//calculate offset between SIB1-NB repetitions (repetitions are equally spaced)
offset = (sib1_period_NB_IoT-(16*nb_rep))/nb_rep;
//loop over the SIB1-NB period
for( int i = 0; i < nb_rep; i++)
{
//find the correct sib1-nb repetition interval in which the actual frame is
//this is the start frame of a repetition
index = sib1_startFrame+ i*(16+offset) + period_nb*256;
//the actual frame is in a gap between two consecutive repetitions
if(frameP < index)
{
ndlsch_SIB1->sib1_rep_start = 0;
ndlsch_SIB1->relative_sib1_frame = 0;
return -1;
}
//this is needed for ndlsch_procedure
else if(frameP == index)
{
//the actual frame is the start of a new repetition (SIB1-NB should be retransmitted)
ndlsch_SIB1->sib1_rep_start = 1;
ndlsch_SIB1->relative_sib1_frame = 1;
return sib1_startFrame;
}
else
ndlsch_SIB1->sib1_rep_start = 0;
//check in the current SIB1_NB repetition
if(frameP>= index && frameP <= (index+15))
{
//find if the actual frame is one of the "every other frame in 16 continuous frame" in which SIB1-NB is transmitted
for(int y = 0; y < 16; y += 2) //every other frame (increment by 2)
{
if(frameP == index + y)
{
//this flag tell which is the number of the current frame w.r.t the 8th (over the continuous 16) in a repetition
ndlsch_SIB1->relative_sib1_frame = y/2 + 1; //1st, 2nd, 3rd,...
return sib1_startFrame;
}
}
//if we are here means that the frame was inside the repetition interval but not considered for SIB1-NB transmission
ndlsch_SIB1->relative_sib1_frame = 0;
return -1;
}
}
return -1;
}
#ifdef DIAG_PHY
extern int rx_sig_fifo;
#endif
*/
......
This diff is collapsed.
...@@ -64,63 +64,7 @@ RRC_status_t rrc_rx_tx_NB_IoT(protocol_ctxt_t* const ctxt_pP, const uint8_t enb ...@@ -64,63 +64,7 @@ RRC_status_t rrc_rx_tx_NB_IoT(protocol_ctxt_t* const ctxt_pP, const uint8_t enb
//long binary_search_float(float elements[], long numElem, float value);--> used only at UE side //long binary_search_float(float elements[], long numElem, float value);--> used only at UE side
//----------------------------------------
//New
/**\brief function for evaluate if the SIB1-NB transmission occur
* return the SIB1 starting frame
* called by phy_procedure_eNB_Tx before calling the npdsch_procedure
*/
uint32_t is_SIB1_NB_IoT(
const frame_t frameP,
long schedulingInfoSIB1,//from the mib
int physCellId, //by configuration
NB_IoT_eNB_NDLSCH_t *ndlsch_SIB1
);
//--------------------------------------
//New
/**\brief function for evaluate if the SIB1-NB period start
* return 0 = TRUE
* return -1 = FALSE
* called by the NB_mac_rrc_data_req
*/
uint8_t is_SIB1_start_NB_IoT(
const frame_t frameP,
long schedulingInfoSIB1,//from the mib
int physCellId //by configuration
);
//New
/**\brief function for evaluate if the SIB23-NB transmission occurr
* called by the NB_mac_rrc_data_req
*
*/
boolean_t is_SIB23_NB_IoT(
const frame_t frameP,
const frame_t h_frameP, // the HSFN (increased by 1 every SFN wrap around) (10 bits)
long si_period, //SI-periodicity (rf)
long si_windowLength_ms, //Si-windowlength (ms) XXX received as an enumerative (see the IE of SIB1-NB)
long* si_RadioFrameOffset, //Optional
long si_RepetitionPattern // is given as an Enumerated
);
//-----------------------------------
//defined in L2_interface
int8_t mac_rrc_data_req_eNB_NB_IoT(
const module_id_t Mod_idP,
const int CC_id,
const frame_t frameP,
const frame_t h_frameP,
const sub_frame_t subframeP,
const rb_id_t Srb_id,
uint8_t* const buffer_pP,
long schedulingInfoSIB1,//from the mib
int physCellId, //from the MAC instance-> common_channel
mib_flag_t mib_flag
);
//--------------------------------------- //---------------------------------------
...@@ -550,16 +494,15 @@ uint8_t rrc_eNB_get_next_transaction_identifier_NB_IoT(module_id_t module_idP); ...@@ -550,16 +494,15 @@ uint8_t rrc_eNB_get_next_transaction_identifier_NB_IoT(module_id_t module_idP);
int rrc_init_global_param_NB_IoT(void); int rrc_init_global_param_NB_IoT(void);
//L2_interface.c //L2_interface.c
int8_t mac_rrc_data_req_NB_IoT( int8_t mac_rrc_data_req_eNB_NB_IoT(
const module_id_t Mod_idP, const module_id_t Mod_idP,
const int CC_id, const int CC_id,
const frame_t frameP, const frame_t frameP,
const frame_t h_frameP,
const sub_frame_t subframeP, //need for the case in which both SIB1-NB_IoT and SIB23-NB_IoT will be scheduled in the same frame
const rb_id_t Srb_id, const rb_id_t Srb_id,
const uint8_t Nb_tb,
uint8_t* const buffer_pP, uint8_t* const buffer_pP,
const eNB_flag_t enb_flagP, uint8_t flag
const uint8_t eNB_index,
const uint8_t mbsfn_sync_area
); );
......
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