Commit 000a07f2 authored by Ting-An Lin's avatar Ting-An Lin

Merge branch 'develop-nb-iot-ntust' of...

Merge branch 'develop-nb-iot-ntust' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop-nb-iot-ntust
parents 828f97be 7d8daa37
......@@ -424,7 +424,10 @@ typedef struct eNB_proc_NB_IoT_t_s {
/// set of scheduling variables RXn-TXnp4 threads
// newly added for NB_IoT
eNB_rxtx_proc_NB_IoT_t proc_rxtx[2];
//samuel
uint16_t HFN;
pthread_mutex_t mutex_rxtx;
int instance_cnt_rxtx;
} eNB_proc_NB_IoT_t;
......
......@@ -1402,4 +1402,49 @@ void prach_procedures_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB) {
0,subframe,0);*/
}
}
\ No newline at end of file
}
//samuel
void do_prach_NB_IoT(PHY_VARS_eNB *eNB,int frame,int subframe) {
eNB_proc_t *proc = &eNB->proc;
// LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
if(frame%2==0 && subframe==9)
{
// check if we have to detect PRACH first
//if (is_prach_subframe(fp,frame,subframe)>0) {
/* accept some delay in processing - up to 5ms */
int i;
for (i = 0; i < 10 && proc->instance_cnt_prach == 0; i++) {
LOG_W(PHY,"[eNB] Frame %d Subframe %d, eNB PRACH thread busy (IC %d)!!\n", frame,subframe,proc->instance_cnt_prach);
usleep(500);
}
if (proc->instance_cnt_prach == 0) {
exit_fun( "PRACH thread busy" );
return;
}
// wake up thread for PRACH RX
if (pthread_mutex_lock(&proc->mutex_prach) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_mutex_lock for eNB PRACH thread %d (IC %d)\n", proc->thread_index, proc->instance_cnt_prach);
exit_fun( "error locking mutex_prach" );
return;
}
++proc->instance_cnt_prach;
// set timing for prach thread
proc->frame_prach = frame;
proc->subframe_prach = subframe;
// the thread can now be woken up
if (pthread_cond_signal(&proc->cond_prach) != 0) {
LOG_E( PHY, "[eNB] ERROR pthread_cond_signal for eNB PRACH thread %d\n", proc->thread_index);
exit_fun( "ERROR pthread_cond_signal" );
return;
}
pthread_mutex_unlock( &proc->mutex_prach );
//}
}
}
......@@ -157,11 +157,64 @@ void wakeup_prach_eNB(PHY_VARS_eNB *eNB,RU_t *ru,int frame,int subframe);
extern void oai_subframe_ind(uint16_t sfn, uint16_t sf);
extern void add_subframe(uint16_t *frameP, uint16_t *subframeP, int offset);
//samuel
extern void do_prach_NB_IoT(PHY_VARS_eNB *eNB,int frame,int subframe);
//#define TICK_TO_US(ts) (ts.diff)
#define TICK_TO_US(ts) (ts.trials==0?0:ts.diff/ts.trials)
eNBs_t eNBs;//Ann and samuel
static inline int rxtx_NB_IoT(PHY_VARS_eNB_NB_IoT *eNB,eNB_proc_NB_IoT_t *proc, char *thread_name) {
///start_meas(&softmodem_stats_rxtx_sf);
// ****************************************
// Common RX procedures subframe n
if ((eNB->do_prach)&&((eNB->node_function != NGFI_RCC_IF4p5_NB_IoT)))
eNB->do_prach(eNB,proc->frame_rx,proc->subframe_rx);
//phy_procedures_eNB_common_RX(eNB,proc);//samuel
// UE-specific RX processing for subframe n
///////////////////////////////////// for NB-IoT testing ////////////////////////
// for NB-IoT testing // activating only TX part
//if (eNB->proc_uespec_rx) eNB->proc_uespec_rx(eNB, proc );//samuel
////////////////////////////////////END///////////////////////
//npusch_procedures(eNB,proc,data_or_control);
//fill_rx_indication(eNB,i,frame,subframe);
//////////////////////////////////// for IF Module/scheduler testing
pthread_mutex_lock(&eNB->UL_INFO_mutex);
eNB->UL_INFO.frame = proc->frame_rx;
eNB->UL_INFO.subframe = proc->subframe_rx;
eNB->UL_INFO.module_id = eNB->Mod_id;
eNB->UL_INFO.CC_id = eNB->CC_id;
eNB->UL_INFO.hypersfn = proc->HFN;
eNB->if_inst_NB_IoT->UL_indication(&eNB->UL_INFO);
pthread_mutex_unlock(&eNB->UL_INFO_mutex);
//LOG_I(PHY,"After UL_indication\n");
// *****************************************
// TX processing for subframe n+4
// run PHY TX procedures the one after the other for all CCs to avoid race conditions
// (may be relaxed in the future for performance reasons)
// *****************************************
//if (wait_CCs(proc)<0) return(-1);
if (oai_exit) return(-1);
//if (eNB->proc_tx) eNB->proc_tx(eNB, proc, no_relay, NULL );//samuel
if (release_thread(&proc->mutex_rxtx,&proc->instance_cnt_rxtx,thread_name)<0) return(-1);
/// stop_meas( &softmodem_stats_rxtx_sf );
return(0);
}
static inline int rxtx(PHY_VARS_eNB *eNB,L1_rxtx_proc_t *proc, char *thread_name) {
int ret;
start_meas(&softmodem_stats_rxtx_sf);
......@@ -431,6 +484,7 @@ static void *L1_thread( void *param ) {
if (eNB->CC_id==0) {
if (rxtx(eNB,proc,thread_name) < 0) break;
if (rxtx_NB_IoT(eNBs.eNB_NB_IoT,&(eNBs.eNB_NB_IoT->proc),thread_name));
}
LOG_D(PHY,"L1 RX %d.%d done\n",proc->frame_rx,proc->subframe_rx);
......
......@@ -627,6 +627,7 @@ int main( int argc, char **argv ) {
itti_send_msg_to_task (TASK_RRC_ENB, ENB_MODULE_ID_TO_INSTANCE(enb_id), msg_p);
}
node_type = RC.rrc[0]->node_type;
RCconfig_NbIoTL1();//samuel
} else {
printf("RC.nb_inst = 0, Initializing L1\n");
RCconfig_L1();
......
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