diff --git a/openair1/PHY/INIT/init_top.c b/openair1/PHY/INIT/init_top.c index 25f35ab0828c11b31c38c6d6b73700d4a53064d5..6f48f295d2e37adb54e095ab1428a8a01030faa7 100644 --- a/openair1/PHY/INIT/init_top.c +++ b/openair1/PHY/INIT/init_top.c @@ -86,6 +86,7 @@ void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms) generate_64qam_table(); generate_16qam_table(); + generate_qpsk_table(); generate_RIV_tables(); init_unscrambling_lut(); diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c index 0a5500f3b2aba7acf003ec99689436dcad26fba8..6a7bc467086d780507dd4212e2e6eeb717d67bca 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_coding.c @@ -511,16 +511,15 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB, proc->tep[i].total_worker = worker_num; proc->tep[i].current_worker = i; if (pthread_cond_signal(&proc->tep[i].cond_te) != 0) { - printf("[eNB] ERROR pthread_cond_signal for te thread exit\n"); - exit_fun( "ERROR pthread_cond_signal" ); - return (-1); + printf("[eNB] ERROR pthread_cond_signal for te thread exit\n"); + exit_fun( "ERROR pthread_cond_signal" ); + return (-1); } } } // Fill in the "e"-sequence from 36-212, V8.6 2009-03, p. 16-17 (for each "e") and concatenate the // outputs for each code segment, see Section 5.1.5 p.20 - for (r=0,r_offset=0; r<dlsch->harq_processes[harq_pid]->C; r++) { // get information for E for the segments that are handled by the worker thread diff --git a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c index 5bf6f073d86180cc41a5acdf6d025aa194c16c79..cb2450941b1c0b403f5a8795636dc1a62347c1b4 100644 --- a/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c +++ b/openair1/PHY/LTE_TRANSPORT/dlsch_modulation.c @@ -39,7 +39,7 @@ #include "PHY/LTE_TRANSPORT/transport_proto.h" #include "PHY/LTE_TRANSPORT/transport_common_proto.h" //#define DEBUG_DLSCH_MODULATION -#define NEW_ALLOC_RE +//#define NEW_ALLOC_RE //#define is_not_pilot(pilots,re,nushift,use2ndpilots) ((pilots==0) || ((re!=nushift) && (re!=nushift+6)&&((re!=nushift+3)||(use2ndpilots==1))&&((re!=nushift+9)||(use2ndpilots==1)))?1:0) @@ -706,6 +706,7 @@ int allocate_REs_in_RB(PHY_VARS_eNB* phy_vars_eNB, int *P2_SHIFT) { + uint8_t *x0 = NULL; MIMO_mode_t mimo_mode = -1; @@ -2099,10 +2100,33 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, uint8_t mod_order0 = 0; uint8_t mod_order1 = 0; int16_t amp_rho_a, amp_rho_b; - int16_t qam16_table_a0[4],qam64_table_a0[8],qam16_table_b0[4],qam64_table_b0[8];//qpsk_table_a0[2],qpsk_table_b0[2] - int16_t qam16_table_a1[4],qam64_table_a1[8],qam16_table_b1[4],qam64_table_b1[8];//qpsk_table_a1[2],qpsk_table_b1[2] + int16_t qam16_table_a0[4],qam64_table_a0[8],qam16_table_b0[4],qam64_table_b0[8],qpsk_table_a0[2],qpsk_table_b0[2]; + int16_t qam16_table_a1[4],qam64_table_a1[8],qam16_table_b1[4],qam64_table_b1[8],qpsk_table_a1[2],qpsk_table_b1[2]; int16_t *qam_table_s0=NULL,*qam_table_s1=NULL; + int (*allocate_REs)(PHY_VARS_eNB*, + int **, + uint32_t*, + uint32_t*, + uint16_t, + uint32_t, + LTE_DL_eNB_HARQ_t *, + LTE_DL_eNB_HARQ_t *, + uint8_t, + int16_t, + uint8_t, + int16_t *, + int16_t *, + uint32_t *, + uint8_t, + uint8_t, + uint8_t, + uint8_t, + uint8_t, + int *, + int *); + + int P1_SHIFT[13],P2_SHIFT[13]; int offset,nushiftmod3; @@ -2201,7 +2225,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, amp_rho_b = (int16_t)(((int32_t)amp*dlsch1->sqrt_rho_b)>>13); } - /*if(mod_order0 == 2) + if(mod_order0 == 2) { for(i=0;i<2;i++) { @@ -2209,7 +2233,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, qpsk_table_b0[i] = (int16_t)(((int32_t)qpsk_table[i]*amp_rho_b)>>15); } } - else*/ if (mod_order0 == 4) + else if (mod_order0 == 4) for (i=0;i<4; i++) { qam16_table_a0[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_a)>>15); qam16_table_b0[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_b)>>15); @@ -2220,14 +2244,14 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, qam64_table_b0[i] = (int16_t)(((int32_t)qam64_table[i]*amp_rho_b)>>15); } - /*if (mod_order1 == 2) + if (mod_order1 == 2) { for (i=0; i<2; i++) { qpsk_table_a1[i] = (int16_t)(((int32_t)qpsk_table[i]*amp_rho_a)>>15); qpsk_table_b1[i] = (int16_t)(((int32_t)qpsk_table[i]*amp_rho_b)>>15); } } - else*/ if (mod_order1 == 4) + else if (mod_order1 == 4) for (i=0; i<4; i++) { qam16_table_a1[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_a)>>15); qam16_table_b1[i] = (int16_t)(((int32_t)qam16_table[i]*amp_rho_b)>>15); @@ -2348,24 +2372,36 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, re_offset = frame_parms->first_carrier_offset; symbol_offset = (uint32_t)frame_parms->ofdm_symbol_size*(l+(subframe_offset*nsymb)); + allocate_REs = allocate_REs_in_RB; switch (mod_order0) { case 2: qam_table_s0 = NULL; - /*if (pilots) { + if (pilots) { qam_table_s0 = qpsk_table_b0; + allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ? + allocate_REs_in_RB_pilots_QPSK_siso : + allocate_REs_in_RB; } else { qam_table_s0 = qpsk_table_a0; - - }*/ + allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ? + allocate_REs_in_RB_no_pilots_QPSK_siso : + allocate_REs_in_RB; + } break; case 4: if (pilots) { qam_table_s0 = qam16_table_b0; + allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ? + allocate_REs_in_RB_pilots_16QAM_siso : + allocate_REs_in_RB; } else { qam_table_s0 = qam16_table_a0; + allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ? + allocate_REs_in_RB_no_pilots_16QAM_siso : + allocate_REs_in_RB; } break; @@ -2373,9 +2409,15 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, case 6: if (pilots) { qam_table_s0 = qam64_table_b0; + allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ? + allocate_REs_in_RB_pilots_64QAM_siso : + allocate_REs_in_RB; } else { qam_table_s0 = qam64_table_a0; + allocate_REs = (dlsch0->harq_processes[harq_pid]->mimo_mode == SISO) ? + allocate_REs_in_RB_no_pilots_64QAM_siso : + allocate_REs_in_RB; } break; @@ -2384,12 +2426,13 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, switch (mod_order1) { case 2: qam_table_s1 = NULL; - /*if (pilots) { + allocate_REs = allocate_REs_in_RB; + if (pilots) { qam_table_s1 = qpsk_table_b1; } else { qam_table_s1 = qpsk_table_a1; - }*/ + } break; case 4: if (pilots) { @@ -2465,7 +2508,7 @@ int dlsch_modulation(PHY_VARS_eNB* phy_vars_eNB, rb); - allocate_REs_in_RB(phy_vars_eNB, + allocate_REs(phy_vars_eNB, txdataF, &jj, &jj2, diff --git a/openair1/PHY/defs_eNB.h b/openair1/PHY/defs_eNB.h index df3c1e449770221d919851dcd63080b8fbcdf43b..c58fffe0ef2ebe8fa890dbac762dcd4e9bb2a56f 100644 --- a/openair1/PHY/defs_eNB.h +++ b/openair1/PHY/defs_eNB.h @@ -194,11 +194,11 @@ typedef struct RU_proc_t_s { pthread_cond_t cond_synch; /// condition variable for asynch RX/TX thread pthread_cond_t cond_asynch_rxtx; - /// condition varible for RU RX FEP thread + /// condition variable for RU RX FEP thread pthread_cond_t cond_fep; - /// condition varible for RU TX FEP thread + /// condition variable for RU TX FEP thread pthread_cond_t cond_feptx; - /// condition varible for emulated RF + /// condition variable for emulated RF pthread_cond_t cond_emulateRF; /// condition variable for eNB signal pthread_cond_t cond_eNBs; @@ -260,6 +260,7 @@ typedef struct RU_proc_t_s { /// pipeline ready state int ru_rx_ready; int ru_tx_ready; + int emulate_rf_busy; } RU_proc_t; typedef enum { diff --git a/openair1/SCHED/fapi_l1.c b/openair1/SCHED/fapi_l1.c index 8840d065ecef45ec85e575d2dd5cd1b20c564b50..ad72c3d9f5f6a2cf8a17933135b63a0399b62985 100644 --- a/openair1/SCHED/fapi_l1.c +++ b/openair1/SCHED/fapi_l1.c @@ -668,7 +668,6 @@ void schedule_response(Sched_Rsp_t *Sched_INFO) AssertFatal(RC.eNB[Mod_id][CC_id]!=NULL,"RC.eNB[%d][%d] is null\n",Mod_id,CC_id); - eNB = RC.eNB[Mod_id][CC_id]; fp = &eNB->frame_parms; proc = &eNB->proc.proc_rxtx[0]; diff --git a/openair1/SCHED/phy_procedures_lte_eNb.c b/openair1/SCHED/phy_procedures_lte_eNb.c index 08b7b28fa4edd5f75accc2e94b12c4a4d1d7c926..6b23133c40534db30de3326b99ce1c888fd0648c 100644 --- a/openair1/SCHED/phy_procedures_lte_eNb.c +++ b/openair1/SCHED/phy_procedures_lte_eNb.c @@ -415,7 +415,6 @@ void pdsch_procedures(PHY_VARS_eNB *eNB, &eNB->dlsch_turbo_encoding_wakeup_stats1, &eNB->dlsch_interleaving_stats); stop_meas(&eNB->dlsch_encoding_stats); - //////////////////////////////////////////////////******************************************* if(eNB->dlsch_encoding_stats.diff_now>500*3000 && opp_enabled == 1) { print_meas_now(&eNB->dlsch_encoding_stats,"total coding",stderr); @@ -1505,7 +1504,7 @@ void init_te_thread(PHY_VARS_eNB *eNB) { pthread_cond_init( &proc->tep[i].cond_te, NULL); pthread_attr_init( &proc->tep[i].attr_te); - printf("Creating te_thread 0\n"); + LOG_I(PHY,"Creating te_thread %d\n",i); pthread_create(&proc->tep[i].pthread_te, &proc->tep[i].attr_te, te_thread, (void*)&proc->tep[i]); } } diff --git a/openair1/SCHED/ru_procedures.c b/openair1/SCHED/ru_procedures.c index 6d0ceedf4f1dd31e91df13124083e9c680ae3d84..056ce0a429af517ed8d71473ec2ffc1e4edccc93 100644 --- a/openair1/SCHED/ru_procedures.c +++ b/openair1/SCHED/ru_procedures.c @@ -151,6 +151,7 @@ static void *feptx_thread(void *param) { while (!oai_exit) { if (wait_on_condition(&proc->mutex_feptx,&proc->cond_feptx,&proc->instance_cnt_feptx,"feptx thread")<0) break; + if (oai_exit) break; //stop_meas(&ru->ofdm_mod_wakeup_stats); feptx0(ru,1); if (release_thread(&proc->mutex_feptx,&proc->instance_cnt_feptx,"feptx thread")<0) break; @@ -248,7 +249,6 @@ void feptx_ofdm(RU_t *ru) { // int CC_id = ru->proc.CC_id; VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPTX_OFDM , 1 ); - slot_offset_F = 0; slot_offset = subframe*fp->samples_per_tti; @@ -456,6 +456,7 @@ static void *fep_thread(void *param) { while (!oai_exit) { if (wait_on_condition(&proc->mutex_fep,&proc->cond_fep,&proc->instance_cnt_fep,"fep thread")<0) break; + if (oai_exit) break; //stop_meas(&ru->ofdm_demod_wakeup_stats); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX1, 1 ); fep0(ru,0); @@ -505,6 +506,33 @@ void init_fep_thread(RU_t *ru,pthread_attr_t *attr_fep) { } + +extern void kill_fep_thread(RU_t *ru) +{ + RU_proc_t *proc = &ru->proc; + pthread_mutex_lock( &proc->mutex_fep ); + proc->instance_cnt_fep = 0; + pthread_cond_signal(&proc->cond_fep); + pthread_mutex_unlock( &proc->mutex_fep ); + LOG_D(PHY, "Joining pthread_fep\n"); + pthread_join(proc->pthread_fep, NULL); + pthread_mutex_destroy( &proc->mutex_fep ); + pthread_cond_destroy( &proc->cond_fep ); +} + +extern void kill_feptx_thread(RU_t *ru) +{ + RU_proc_t *proc = &ru->proc; + pthread_mutex_lock( &proc->mutex_feptx ); + proc->instance_cnt_feptx = 0; + pthread_cond_signal(&proc->cond_feptx); + pthread_mutex_unlock( &proc->mutex_feptx ); + LOG_D(PHY, "Joining pthread_feptx\n"); + pthread_join(proc->pthread_feptx, NULL); + pthread_mutex_destroy( &proc->mutex_feptx ); + pthread_cond_destroy( &proc->cond_feptx ); +} + void ru_fep_full_2thread(RU_t *ru) { RU_proc_t *proc = &ru->proc; diff --git a/openair2/LAYER2/MAC/eNB_scheduler_phytest.c b/openair2/LAYER2/MAC/eNB_scheduler_phytest.c index bf6fd8db6a1a24768a018d8a224c9d216c133f94..81848f1a7b80f57869fcb8399483d77aaf184336 100644 --- a/openair2/LAYER2/MAC/eNB_scheduler_phytest.c +++ b/openair2/LAYER2/MAC/eNB_scheduler_phytest.c @@ -67,13 +67,13 @@ schedule_ue_spec_phy_test( uint16_t TBS; uint16_t nb_rb; - unsigned char harq_pid = subframeP%5; + unsigned char harq_pid = (frameP*10+subframeP)%8; uint16_t rnti = 0x1235; - uint32_t rb_alloc = 0x1FFFFFFF; + uint32_t rb_alloc = 0x1FFFFF; int32_t tpc = 1; int32_t mcs = 28; int32_t cqi = 15; - int32_t ndi = subframeP/5; + int32_t ndi = (frameP*10+subframeP)/8; int32_t dai = 0; eNB_MAC_INST *eNB = RC.mac[module_idP]; @@ -92,10 +92,9 @@ schedule_ue_spec_phy_test( continue; nb_rb = conv_nprb(0,rb_alloc,N_RB_DL); - //printf("////////////////////////////////////*************************nb_rb = %d\n",nb_rb); TBS = get_TBS_DL(mcs,nb_rb); - LOG_D(PHY,"schedule_ue_spec_phy_test: subframe %d/%d: nb_rb=%d, TBS=%d, mcs=%d (rb_alloc=%x, N_RB_DL=%d)\n",frameP,subframeP,nb_rb,TBS,mcs,rb_alloc,N_RB_DL); + LOG_D(MAC,"schedule_ue_spec_phy_test: subframe %d/%d: nb_rb=%d, TBS=%d, mcs=%d harq_pid=%d (rb_alloc=%x, N_RB_DL=%d) pdu_number = %d \n", frameP, subframeP, nb_rb, TBS, mcs, harq_pid, rb_alloc, N_RB_DL, dl_req->number_pdu); dl_config_pdu = &dl_req->dl_config_pdu_list[dl_req->number_pdu]; memset((void*)dl_config_pdu,0,sizeof(nfapi_dl_config_request_pdu_t)); @@ -136,6 +135,8 @@ schedule_ue_spec_phy_test( //ue_sched_ctl->round[CC_id][harq_pid] = 0; dl_req->number_dci++; dl_req->number_pdu++; + eNB->DL_req[CC_id].sfn_sf = frameP<<4 | subframeP; + //eNB->DL_req[CC_id].header.message_id = NFAPI_DL_CONFIG_REQUEST; // Toggle NDI for next time /* @@ -150,7 +151,6 @@ schedule_ue_spec_phy_test( AssertFatal(UE_list->UE_template[CC_id][UE_id].physicalConfigDedicated->pdsch_ConfigDedicated!=NULL,"physicalConfigDedicated->pdsch_ConfigDedicated is NULL\n"); */ - fill_nfapi_dlsch_config(eNB, dl_req, @@ -196,32 +196,35 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s int UE_id = 0; uint8_t aggregation = 2; rnti_t rnti = 0x1235; - uint8_t mcs = 0; + uint8_t mcs = 20; uint8_t harq_pid = 0; uint32_t cqi_req = 0,cshift,ndi,tpc = 1; int32_t normalized_rx_power; int32_t target_rx_power= 178; int CC_id = 0; int nb_rb = 96; - eNB_MAC_INST *eNB = RC.mac[module_idP]; - COMMON_channels_t *cc = eNB->common_channels; - UE_list_t *UE_list=&eNB->UE_list; + eNB_MAC_INST *mac = RC.mac[module_idP]; + COMMON_channels_t *cc = &mac->common_channels[0]; + UE_list_t *UE_list=&mac->UE_list; UE_TEMPLATE *UE_template; UE_sched_ctrl *UE_sched_ctrl; int sched_frame=frameP; int sched_subframe = (subframeP+4)%10; + uint16_t ul_req_index; + uint8_t dlsch_flag; if (sched_subframe<subframeP) sched_frame++; - nfapi_hi_dci0_request_body_t *hi_dci0_req = &eNB->HI_DCI0_req[CC_id][subframeP].hi_dci0_request_body; + nfapi_hi_dci0_request_t *hi_dci0_req = &mac->HI_DCI0_req[CC_id][subframeP]; + nfapi_hi_dci0_request_body_t *hi_dci0_req_body = &hi_dci0_req->hi_dci0_request_body; nfapi_hi_dci0_request_pdu_t *hi_dci0_pdu; //nfapi_ul_config_request_pdu_t *ul_config_pdu = &ul_req->ul_config_pdu_list[0];; - nfapi_ul_config_request_body_t *ul_req = &eNB->UL_req[CC_id].ul_config_request_body; + nfapi_ul_config_request_body_t *ul_req = &mac->UL_req[CC_id].ul_config_request_body; - eNB->UL_req[CC_id].sfn_sf = (sched_frame<<4) + sched_subframe; - eNB->HI_DCI0_req[CC_id][subframeP].sfn_sf = (frameP<<4)+subframeP; + mac->UL_req[CC_id].sfn_sf = (sched_frame<<4) + sched_subframe; + hi_dci0_req->sfn_sf = (frameP << 4) + subframeP; for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { //rnti = UE_RNTI(module_idP,UE_id); @@ -235,7 +238,6 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s UE_sched_ctrl = &UE_list->UE_sched_ctrl[UE_id]; harq_pid = subframe2harqpid(&cc[CC_id],sched_frame,sched_subframe); - LOG_D(MAC,"Scheduling for frame %d, subframe %d => harq_pid %d\n",sched_frame,sched_subframe,harq_pid); RC.eNB[module_idP][CC_id]->pusch_stats_BO[UE_id][(frameP*10)+subframeP] = UE_template->TBS_UL[harq_pid]; @@ -245,7 +247,7 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s //compute the expected ULSCH RX power (for the stats) // this is the normalized RX power and this should be constant (regardless of mcs - normalized_rx_power = UE_sched_ctrl->pusch_snr[CC_id]; + normalized_rx_power = (5*UE_sched_ctrl->pusch_snr[CC_id]-640)/10+30; // new transmission @@ -281,7 +283,7 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s // save it for a potential retransmission UE_template->cshift[harq_pid] = cshift; - hi_dci0_pdu = &hi_dci0_req->hi_dci0_pdu_list[eNB->HI_DCI0_req[CC_id][subframeP].hi_dci0_request_body.number_of_dci+eNB->HI_DCI0_req[CC_id][subframeP].hi_dci0_request_body.number_of_hi]; + hi_dci0_pdu = &hi_dci0_req_body->hi_dci0_pdu_list[hi_dci0_req_body->number_of_dci + hi_dci0_req_body->number_of_hi]; memset((void*)hi_dci0_pdu,0,sizeof(nfapi_hi_dci0_request_pdu_t)); hi_dci0_pdu->pdu_type = NFAPI_HI_DCI0_DCI_PDU_TYPE; hi_dci0_pdu->pdu_size = 2+sizeof(nfapi_hi_dci0_dci_pdu); @@ -298,18 +300,28 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s hi_dci0_pdu->dci_pdu.dci_pdu_rel8.tpc = tpc; hi_dci0_pdu->dci_pdu.dci_pdu_rel8.cqi_csi_request = cqi_req; hi_dci0_pdu->dci_pdu.dci_pdu_rel8.dl_assignment_index = UE_template->DAI_ul[sched_subframe]; + hi_dci0_pdu->dci_pdu.dci_pdu_rel8.harq_pid = harq_pid; + + hi_dci0_req_body->number_of_dci++; - eNB->HI_DCI0_req[CC_id][subframeP].hi_dci0_request_body.number_of_dci++; - - + ul_req_index = 0; + dlsch_flag = 0; + for(ul_req_index = 0;ul_req_index < ul_req->number_of_pdus;ul_req_index++){ + if(ul_req->ul_config_pdu_list[ul_req_index].pdu_type == NFAPI_UL_CONFIG_UCI_HARQ_PDU_TYPE){ + dlsch_flag = 1; + LOG_D(MAC,"Frame %d, Subframe %d:rnti %x ul_req_index %d Switched UCI HARQ to ULSCH HARQ(first)\n",frameP,subframeP,rnti,ul_req_index); + break; + } + } + // Add UL_config PDUs - fill_nfapi_ulsch_config_request_rel8(&ul_req->ul_config_pdu_list[ul_req->number_of_pdus], + fill_nfapi_ulsch_config_request_rel8(& ul_req->ul_config_pdu_list[ul_req_index], cqi_req, cc, 0,//UE_template->physicalConfigDedicated, get_tmode(module_idP,CC_id,UE_id), - eNB->ul_handle, + mac->ul_handle,//eNB->ul_handle, rnti, first_rb[CC_id], // resource_block_start nb_rb, // number_of_resource_blocks @@ -327,7 +339,7 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s ); #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) if (UE_template->rach_resource_type>0) { // This is a BL/CE UE allocation - fill_nfapi_ulsch_config_request_emtc(&ul_req->ul_config_pdu_list[ul_req->number_of_pdus], + fill_nfapi_ulsch_config_request_emtc(&ul_req->ul_config_pdu_list[ul_req_index], UE_template->rach_resource_type>2 ? 2 : 1, 1, //total_number_of_repetitions 1, //repetition_number @@ -335,7 +347,7 @@ void schedule_ulsch_phy_test(module_id_t module_idP,frame_t frameP,sub_frame_t s } #endif ul_req->number_of_pdus = 1; - eNB->ul_handle++; + mac->ul_handle++; diff --git a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.100PRB.usrpx310.conf b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.100PRB.usrpx310.conf index 3064a29c698ababb992a6fc3562efcd262a02276..9a2ca88257352d763a3d67cf9cfed17a4d7e8b5b 100644 --- a/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.100PRB.usrpx310.conf +++ b/targets/PROJECTS/GENERIC-LTE-EPC/CONF/enb.band7.tm1.100PRB.usrpx310.conf @@ -33,7 +33,7 @@ eNBs = tdd_config_s = 0; prefix_type = "NORMAL"; eutra_band = 7; - downlink_frequency = 2685000000L; + downlink_frequency = 2680000000L; uplink_frequency_offset = -120000000; Nid_cell = 0; N_RB_DL = 100; diff --git a/targets/RT/USER/lte-enb.c b/targets/RT/USER/lte-enb.c index d75aa9a57442442cc76a1fdabbf9c82088f857e2..4b7e5e41bbb63af88b7397e170cc6575e336b2f7 100644 --- a/targets/RT/USER/lte-enb.c +++ b/targets/RT/USER/lte-enb.c @@ -225,7 +225,7 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam } VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER , 1 ); - if(get_nprocs() >= 8){ + if(!eNB->single_thread_flag && get_nprocs() >= 8){ if(wait_on_condition(&proc[1].mutex_rxtx,&proc[1].cond_rxtx,&proc[1].pipe_ready,"wakeup_tx")<0) { LOG_E(PHY,"Frame %d, subframe %d: TX1 not ready\n",proc[1].frame_rx,proc[1].subframe_rx); return(-1); @@ -247,7 +247,7 @@ static inline int rxtx(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, char *thread_nam /* CONFLICT RESOLUTION: BEGIN */ VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ULSCH_SCHEDULER , 0 ); if(oai_exit) return(-1); - if(get_nprocs() <= 4){ + if(eNB->single_thread_flag || get_nprocs() <= 4){ #ifndef PHY_TX_THREAD phy_procedures_eNB_TX(eNB, proc, 1); #endif @@ -560,7 +560,7 @@ int wakeup_rxtx(PHY_VARS_eNB *eNB,RU_t *ru) { eNB_proc_t *proc=&eNB->proc; RU_proc_t *ru_proc=&ru->proc; - eNB_rxtx_proc_t *proc_rxtx0=&proc->proc_rxtx[0];//*proc_rxtx=&proc->proc_rxtx[proc->frame_rx&1]; + eNB_rxtx_proc_t *proc_rxtx0=&proc->proc_rxtx[0]; //eNB_rxtx_proc_t *proc_rxtx1=&proc->proc_rxtx[1]; @@ -849,7 +849,6 @@ extern void init_td_thread(PHY_VARS_eNB *); extern void init_te_thread(PHY_VARS_eNB *); extern void kill_td_thread(PHY_VARS_eNB *); extern void kill_te_thread(PHY_VARS_eNB *); -//////////////////////////////////////need to modified////////////////***** static void* process_stats_thread(void* param) { @@ -858,20 +857,23 @@ static void* process_stats_thread(void* param) { wait_sync("process_stats_thread"); while (!oai_exit) { - sleep(1); - if (opp_enabled == 1) { - if (eNB->td) print_meas(&eNB->ulsch_decoding_stats,"ulsch_decoding",NULL,NULL); - if (eNB->te) - { - print_meas(&eNB->dlsch_turbo_encoding_preperation_stats,"dlsch_coding_crc",NULL,NULL); - print_meas(&eNB->dlsch_turbo_encoding_segmentation_stats,"dlsch_segmentation",NULL,NULL); - print_meas(&eNB->dlsch_encoding_stats,"dlsch_encoding",NULL,NULL); - print_meas(&eNB->dlsch_turbo_encoding_signal_stats,"coding_signal",NULL,NULL); - print_meas(&eNB->dlsch_turbo_encoding_main_stats,"coding_main",NULL,NULL); - print_meas(&eNB->dlsch_turbo_encoding_waiting_stats,"coding_wait",NULL,NULL); - print_meas(&eNB->dlsch_turbo_encoding_wakeup_stats0,"coding_worker_0",NULL,NULL); - print_meas(&eNB->dlsch_turbo_encoding_wakeup_stats1,"coding_worker_1",NULL,NULL); - } + sleep(1); + if (opp_enabled == 1) { + if (eNB->td) print_meas(&eNB->ulsch_decoding_stats,"ulsch_decoding",NULL,NULL); + if (eNB->te) + { + print_meas(&eNB->dlsch_turbo_encoding_preperation_stats,"dlsch_coding_crc",NULL,NULL); + print_meas(&eNB->dlsch_turbo_encoding_segmentation_stats,"dlsch_segmentation",NULL,NULL); + print_meas(&eNB->dlsch_encoding_stats,"dlsch_encoding",NULL,NULL); + print_meas(&eNB->dlsch_turbo_encoding_signal_stats,"coding_signal",NULL,NULL); + print_meas(&eNB->dlsch_turbo_encoding_main_stats,"coding_main",NULL,NULL); + print_meas(&eNB->dlsch_turbo_encoding_stats,"turbo_encoding",NULL,NULL); + print_meas(&eNB->dlsch_interleaving_stats,"turbo_interleaving",NULL,NULL); + print_meas(&eNB->dlsch_rate_matching_stats,"turbo_rate_matching",NULL,NULL); + print_meas(&eNB->dlsch_turbo_encoding_waiting_stats,"coding_wait",NULL,NULL); + print_meas(&eNB->dlsch_turbo_encoding_wakeup_stats0,"coding_worker_0",NULL,NULL); + print_meas(&eNB->dlsch_turbo_encoding_wakeup_stats1,"coding_worker_1",NULL,NULL); + } print_meas(&eNB->dlsch_modulation_stats,"dlsch_modulation",NULL,NULL); } } @@ -952,30 +954,19 @@ void init_eNB_proc(int inst) { // attr_td = &proc->attr_td; // attr_te = &proc->attr_te; #endif - //////////////////////////////////////need to modified////////////////***** + if(get_nprocs() > 2 && codingw) { init_te_thread(eNB); init_td_thread(eNB); } - //////////////////////////////////////need to modified////////////////***** - //pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, proc ); - - //pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, proc_rxtx ); - - - //Should we also include here the case where single_thread_flag = 1 ? - if(nfapi_mode!=2){ - pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, proc ); - pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, tx_thread, proc); - } LOG_I(PHY,"eNB->single_thread_flag:%d\n", eNB->single_thread_flag); - if (eNB->single_thread_flag==0) { - pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, &proc_rxtx[0] ); - pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, eNB_thread_rxtx, &proc_rxtx[1] ); + if (eNB->single_thread_flag==0 && nfapi_mode!=2) { + pthread_create( &proc_rxtx[0].pthread_rxtx, attr0, eNB_thread_rxtx, proc ); + pthread_create( &proc_rxtx[1].pthread_rxtx, attr1, tx_thread, proc); } pthread_create( &proc->pthread_prach, attr_prach, eNB_thread_prach, eNB ); #if (RRC_VERSION >= MAKE_VERSION(14, 0, 0)) diff --git a/targets/RT/USER/lte-ru.c b/targets/RT/USER/lte-ru.c index be8436035ad7dcf5bf1f8e30a0a7881a5de1a700..dd1723e99ab97bfcdf3240b156bb082358fc559b 100644 --- a/targets/RT/USER/lte-ru.c +++ b/targets/RT/USER/lte-ru.c @@ -120,6 +120,7 @@ extern volatile int oai_exit; extern int emulate_rf; extern int numerology; extern int fepw; +extern int single_thread_flag; extern void phy_init_RU(RU_t*); @@ -714,6 +715,11 @@ static void* emulatedRF_thread(void* param) { wait_sync("emulatedRF_thread"); while(!oai_exit){ nanosleep(&req, (struct timespec *)NULL); + if(proc->emulate_rf_busy ) + { + LOG_E(PHY,"rf being delayed in emulated RF\n"); + } + proc->emulate_rf_busy = 1; pthread_mutex_lock(&proc->mutex_emulateRF); ++proc->instance_cnt_emulateRF; pthread_mutex_unlock(&proc->mutex_emulateRF); @@ -1016,7 +1022,6 @@ void wakeup_slaves(RU_proc_t *proc) { wait.tv_nsec=5000000L; for (i=0;i<proc->num_slaves;i++) { - //printf("////////////////////calling for slave thrads\n");////////////////////////******** RU_proc_t *slave_proc = proc->slave_proc[i]; // wake up slave FH thread // lock the FH mutex and make sure the thread is ready @@ -1252,13 +1257,14 @@ void wakeup_eNBs(RU_t *ru) { LOG_D(PHY,"wakeup_eNBs (num %d) for RU %d ru->eNB_top:%p\n",ru->num_eNB,ru->idx, ru->eNB_top); - if (ru->num_eNB==1 && ru->eNB_top!=0 && get_nprocs() <= 4) { + if ((ru->num_eNB==1 && ru->eNB_top!=0 && get_nprocs() <= 4) || single_thread_flag) { // call eNB function directly char string[20]; sprintf(string,"Incoming RU %d",ru->idx); LOG_D(PHY,"RU %d Call eNB_top\n",ru->idx); ru->eNB_top(eNB_list[0],ru->proc.frame_rx,ru->proc.subframe_rx,string,ru); + ru->proc.emulate_rf_busy = 0; } else { @@ -1270,8 +1276,9 @@ void wakeup_eNBs(RU_t *ru) { eNB_list[i]->proc.ru_proc = &ru->proc; if (ru->wakeup_rxtx!=0 && ru->wakeup_rxtx(eNB_list[i],ru) < 0) { - LOG_E(PHY,"could not wakeup eNB rxtx process for subframe %d\n", ru->proc.subframe_rx); + LOG_E(PHY,"could not wakeup eNB rxtx process for subframe %d\n", ru->proc.subframe_rx); } + ru->proc.emulate_rf_busy = 0; } } } @@ -1490,12 +1497,11 @@ int setup_RU_buffers(RU_t *ru) { static void* ru_stats_thread(void* param) { RU_t *ru = (RU_t*)param; - wait_sync("ru_stats_thread"); while (!oai_exit) { sleep(1); - if (opp_enabled == 1 && fepw) { + if (opp_enabled) { if (ru->feprx) print_meas(&ru->ofdm_demod_stats,"feprx",NULL,NULL); if (ru->feptx_ofdm) print_meas(&ru->ofdm_mod_stats,"feptx_ofdm",NULL,NULL); if (ru->fh_north_asynch_in) print_meas(&ru->rx_fhaul,"rx_fhaul",NULL,NULL); @@ -1529,6 +1535,7 @@ static void* ru_thread_tx( void* param ) { //wait_sync("ru_thread_tx"); wait_on_condition(&proc->mutex_FH1,&proc->cond_FH1,&proc->instance_cnt_FH1,"ru_thread_tx"); + printf( "ru_thread_tx ready\n"); while (!oai_exit) { @@ -1722,7 +1729,6 @@ static void* ru_thread( void* param ) { ru->do_prach, is_prach_subframe(fp, proc->frame_rx, proc->subframe_rx), proc->frame_rx,proc->subframe_rx); - if ((ru->do_prach>0) && (is_prach_subframe(fp, proc->frame_rx, proc->subframe_rx)==1)) { wakeup_prach_ru(ru); } @@ -1775,7 +1781,7 @@ static void* ru_thread( void* param ) { if (ru->num_eNB>0) wakeup_eNBs(ru); #ifndef PHY_TX_THREAD - if(get_nprocs() <= 4 || ru->num_eNB==0){ + if(get_nprocs() <= 4 || ru->num_eNB==0 || single_thread_flag){ // do TX front-end processing if needed (precoding and/or IDFTs) if (ru->feptx_prec) ru->feptx_prec(ru); @@ -1787,6 +1793,7 @@ static void* ru_thread( void* param ) { if (ru->fh_north_out) ru->fh_north_out(ru); } + proc->emulate_rf_busy = 0; } #else struct timespec time_req, time_rem; @@ -1803,10 +1810,12 @@ static void* ru_thread( void* param ) { printf( "Exiting ru_thread \n"); - if (ru->stop_rf != NULL) { - if (ru->stop_rf(ru) != 0) - LOG_E(HW,"Could not stop the RF device\n"); - else LOG_I(PHY,"RU %d rf device stopped\n",ru->idx); + if (!emulate_rf){ + if (ru->stop_rf != NULL) { + if (ru->stop_rf(ru) != 0) + LOG_E(HW,"Could not stop the RF device\n"); + else LOG_I(PHY,"RU %d rf device stopped\n",ru->idx); + } } ru_thread_status = 0; @@ -2077,6 +2086,8 @@ extern void feptx_ofdm_2thread(RU_t *ru); extern void feptx_prec(RU_t *ru); extern void init_fep_thread(RU_t *ru,pthread_attr_t *attr); extern void init_feptx_thread(RU_t *ru,pthread_attr_t *attr); +extern void kill_fep_thread(RU_t *ru); +extern void kill_feptx_thread(RU_t *ru); void init_RU_proc(RU_t *ru) { @@ -2212,8 +2223,8 @@ void init_RU_proc(RU_t *ru) { } if (get_nprocs()> 2 && fepw) { - if (ru->feprx) init_fep_thread(ru,NULL); - if (ru->feptx_ofdm) init_feptx_thread(ru,NULL); + init_fep_thread(ru,NULL); + init_feptx_thread(ru,NULL); } if (opp_enabled == 1) pthread_create(&ru->ru_stats_thread,NULL,ru_stats_thread,(void*)ru); @@ -2224,6 +2235,13 @@ void kill_RU_proc(int inst) RU_t *ru = RC.ru[inst]; RU_proc_t *proc = &ru->proc; + if (get_nprocs() > 2 && fepw) { + LOG_D(PHY, "killing FEP thread\n"); + kill_fep_thread(ru); + LOG_D(PHY, "killing FEP TX thread\n"); + kill_feptx_thread(ru); + } + pthread_mutex_lock(&proc->mutex_FH); proc->instance_cnt_FH = 0; pthread_cond_signal(&proc->cond_FH); @@ -2262,10 +2280,10 @@ void kill_RU_proc(int inst) pthread_cond_signal(&proc->cond_asynch_rxtx); pthread_mutex_unlock(&proc->mutex_asynch_rxtx); - LOG_D(PHY, "Joining pthread_FH\n"); + /*LOG_D(PHY, "Joining pthread_FH\n"); pthread_join(proc->pthread_FH, NULL); LOG_D(PHY, "Joining pthread_FHTX\n"); - pthread_join(proc->pthread_FH1, NULL); + pthread_join(proc->pthread_FH1, NULL);*/ if (ru->function == NGFI_RRU_IF4p5) { LOG_D(PHY, "Joining pthread_prach\n"); pthread_join(proc->pthread_prach, NULL); @@ -2285,28 +2303,6 @@ void kill_RU_proc(int inst) pthread_join(proc->pthread_asynch_rxtx, NULL); } } - if (get_nprocs() > 2 && fepw) { - if (ru->feprx) { - pthread_mutex_lock(&proc->mutex_fep); - proc->instance_cnt_fep = 0; - pthread_mutex_unlock(&proc->mutex_fep); - pthread_cond_signal(&proc->cond_fep); - LOG_D(PHY, "Joining pthread_fep\n"); - pthread_join(proc->pthread_fep, NULL); - pthread_mutex_destroy(&proc->mutex_fep); - pthread_cond_destroy(&proc->cond_fep); - } - if (ru->feptx_ofdm) { - pthread_mutex_lock(&proc->mutex_feptx); - proc->instance_cnt_feptx = 0; - pthread_mutex_unlock(&proc->mutex_feptx); - pthread_cond_signal(&proc->cond_feptx); - LOG_D(PHY, "Joining pthread_feptx\n"); - pthread_join(proc->pthread_feptx, NULL); - pthread_mutex_destroy(&proc->mutex_feptx); - pthread_cond_destroy(&proc->cond_feptx); - } - } if (opp_enabled) { LOG_D(PHY, "Joining ru_stats_thread\n"); pthread_join(ru->ru_stats_thread, NULL); @@ -2671,7 +2667,7 @@ void set_function_spec_param(RU_t *ru) } // switch on interface type } -extern void RCconfig_RU(void); +//extern void RCconfig_RU(void); void init_RU(char *rf_config_file) { diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c index a349ec8134e88f6e375cb3c2e1f2112a69f05c5d..c4982274584fe479344705fc721d5e6badee8adc 100644 --- a/targets/RT/USER/lte-softmodem.c +++ b/targets/RT/USER/lte-softmodem.c @@ -137,7 +137,7 @@ static clock_source_t clock_source = internal; static int wait_for_sync = 0; unsigned int mmapped_dma=0; -int single_thread_flag=1; +int single_thread_flag = 0; static int8_t threequarter_fs=0; diff --git a/targets/RT/USER/lte-softmodem.h b/targets/RT/USER/lte-softmodem.h index 921e1ce530d309b4121a01d92fe531fcec58b1b3..0cda69bdaad0d6e1d9f3905e8bc5429d7807a670 100644 --- a/targets/RT/USER/lte-softmodem.h +++ b/targets/RT/USER/lte-softmodem.h @@ -163,7 +163,7 @@ {"mmapped-dma", CONFIG_HLP_DMAMAP, PARAMFLAG_BOOL, uptr:&mmapped_dma, defintval:0, TYPE_INT, 0}, \ {"external-clock", CONFIG_HLP_EXCCLK, PARAMFLAG_BOOL, uptr:&clock_source, defintval:0, TYPE_INT, 0}, \ {"wait-for-sync", NULL, PARAMFLAG_BOOL, iptr:&wait_for_sync, defintval:0, TYPE_INT, 0}, \ -{"single-thread-disable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:1, TYPE_INT, 0}, \ +{"single-thread-enable", CONFIG_HLP_NOSNGLT, PARAMFLAG_BOOL, iptr:&single_thread_flag, defintval:0, TYPE_INT, 0}, \ {"threadIQ", NULL, 0, iptr:&(threads.iq), defintval:1, TYPE_INT, 0}, \ {"threadOneSubframe", NULL, 0, iptr:&(threads.one), defintval:1, TYPE_INT, 0}, \ {"threadTwoSubframe", NULL, 0, iptr:&(threads.two), defintval:1, TYPE_INT, 0}, \