Commit 05b0ebda authored by Raymond Knopp's avatar Raymond Knopp

Sidelink synchronization works in parallel with UL/DL now. Connected synchref...

Sidelink synchronization works in parallel with UL/DL now. Connected synchref UE can attach to the network, send and receive UL/DL IP traffic and also transmit the SL synch signals.
parent e0ac4edc
......@@ -75,6 +75,7 @@ void check_and_generate_slss(PHY_VARS_UE *ue,int frame_tx,int subframe_tx) {
#else
tx_amp = AMP;
#endif
LOG_D(PHY, "slss: ue->tx_power_dBm: %d, tx_amp: %d \n \n", ue->tx_power_dBm, tx_amp);
if (ue->generate_ul_signal[subframe_tx][0] == 0)
for (int aa=0; aa<ue->frame_parms.nb_antennas_tx; aa++) {
......@@ -86,7 +87,6 @@ void check_and_generate_slss(PHY_VARS_UE *ue,int frame_tx,int subframe_tx) {
// PSS
generate_slpss(ue->common_vars.txdataF,
tx_amp<<1,
&ue->frame_parms,
......@@ -134,12 +134,13 @@ void check_and_generate_slss(PHY_VARS_UE *ue,int frame_tx,int subframe_tx) {
0);
LOG_D(PHY,"%d.%d : SLSS nbrb %d, first rb %d\n",frame_tx,subframe_tx,6,(ue->frame_parms.N_RB_UL/2)-3);
ue->generate_ul_signal[subframe_tx][0] = 1;
ue->slss_generated = 1;
LOG_D(PHY,"ULSCH (after slss) : signal F energy %d dB (txdataF %p)\n",dB_fixed(signal_energy(&ue->common_vars.txdataF[0][subframe_tx*14*ue->frame_parms.ofdm_symbol_size],14*ue->frame_parms.ofdm_symbol_size)),&ue->common_vars.txdataF[0][subframe_tx*14*ue->frame_parms.ofdm_symbol_size]);
LOG_D(PHY,"ULSCH (after slss) : signal F energy %d dB (txdataF %p) at SFN/SF: %d/%d \n",dB_fixed(signal_energy(&ue->common_vars.txdataF[0][subframe_tx*14*ue->frame_parms.ofdm_symbol_size],14*ue->frame_parms.ofdm_symbol_size)),&ue->common_vars.txdataF[0][subframe_tx*14*ue->frame_parms.ofdm_symbol_size], frame_tx, subframe_tx);
}
#endif
......@@ -1559,7 +1559,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
}
}
if ( LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) { //LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) {
if ( LOG_DEBUGFLAG(DEBUG_UE_PHYPROC)) {
LOG_I(PHY,
"[UE %d][PUSCH %d] AbsSubframe %d.%d Generating PUSCH : first_rb %d, nb_rb %d, round %d, mcs %d, rv %d, "
"cyclic_shift %d (cyclic_shift_common %d,n_DMRS2 %d,n_PRS %d), ACK (%d,%d), O_ACK %d, ack_status_cw0 %d ack_status_cw1 %d bundling %d, Nbundled %d, CQI %d, RI %d\n",
......@@ -1727,6 +1727,7 @@ void ue_ulsch_uespec_procedures(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB
0,
0);
ue->sl_chan = NO_SL;
for (aa=0; aa<1/*frame_parms->nb_antennas_tx*/; aa++)
generate_drs_pusch(ue,
proc,
......@@ -2198,20 +2199,10 @@ void phy_procedures_UE_SL_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc) {
check_and_generate_pssch(ue,proc,frame_tx,subframe_tx);
}
AssertFatal(0==pthread_mutex_unlock(&ue->slsch_mutex),"");
//LOG_I(PHY,"%d.%d ULSCH (after slsch) generate_ul_signal %d : signal F energy %d dB (txdataF %p)\n",frame_tx,subframe_tx,ue->generate_ul_signal[subframe_tx][0],dB_fixed(signal_energy(&ue->common_vars.txdataF[0][subframe_tx*14*ue->frame_parms.ofdm_symbol_size],14*ue->frame_parms.ofdm_symbol_size)),&ue->common_vars.txdataF[0][subframe_tx*14*ue->frame_parms.ofdm_symbol_size]);
LOG_D(PHY,"%d.%d ULSCH (after slsch) generate_ul_signal %d : signal F energy %d dB (txdataF %p)\n",frame_tx,subframe_tx,ue->generate_ul_signal[subframe_tx][0],dB_fixed(signal_energy(&ue->common_vars.txdataF[0][subframe_tx*14*ue->frame_parms.ofdm_symbol_size],14*ue->frame_parms.ofdm_symbol_size)),&ue->common_vars.txdataF[0][subframe_tx*14*ue->frame_parms.ofdm_symbol_size]);
LOG_D(PHY,"****** end Sidelink TX-Chain for AbsSubframe %d.%d (ul %d) ******\n", frame_tx, subframe_tx,
ue->generate_ul_signal[subframe_tx][0]);
if (ue->SLonly == 1) {
// LOG_I(PHY,"ULSCH %d.%d (generate_ul_signal %d): signal F energy %d dB (txdataF %p)\n",frame_tx,subframe_tx,ue->generate_ul_signal[subframe_tx][0],dB_fixed(signal_energy(&ue->common_vars.txdataF[0][subframe_tx*14*ue->frame_parms.ofdm_symbol_size],14*ue->frame_parms.ofdm_symbol_size)),&ue->common_vars.txdataF[0][subframe_tx*14*ue->frame_parms.ofdm_symbol_size]);
ulsch_common_procedures(ue,proc, (ue->generate_ul_signal[subframe_tx][0] == 0));
}
if (frame_tx==0 && subframe_tx ==0)
for (int i=0;i<MAX_SLDCH;i++) if (ue->sldch_txcnt[i]>0) LOG_I(PHY,"n_psdch %d TX count %d\n",i,ue->sldch_txcnt[i]);
......@@ -2266,9 +2257,6 @@ void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,ui
} // UE_mode==PUSCH
}
LOG_D(PHY,"doing ulsch_common_procedures (%d.%d): generate_ul_signal %d\n",frame_tx,subframe_tx,
ue->generate_ul_signal[subframe_tx][eNB_id]);
ulsch_common_procedures(ue,proc, (ue->generate_ul_signal[subframe_tx][eNB_id] == 0));
if ((ue->UE_mode[eNB_id] == PRACH) &&
(ue->frame_parms.prach_config_common.prach_Config_enabled==1)) {
......
......@@ -404,7 +404,7 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correcti
&UE->proc.attr_ue,
UE_thread,
(void*)UE), "");
if (UE->sidelink_active == 1)
if (UE->sidelink_active == 1 && UE->SLonly == 1) //&& UE->SLonly == 0
AssertFatal(0 == pthread_create(&UE->proc.pthread_ueSL,
&UE->proc.attr_ueSL,
UE_threadSL,
......@@ -1061,7 +1061,7 @@ static void *UE_thread_rxn_txnp4(void *arg) {
}
// This is for Sidelink
if (UE->sidelink_active == 1) {
if (UE->sidelink_active == 1) { //&& UE->UE_mode[0]==PUSCH
phy_procedures_UE_SL_RX(UE,proc);
......@@ -1106,6 +1106,11 @@ static void *UE_thread_rxn_txnp4(void *arg) {
updateTimes(current, &t3, 10000, "Delay to process sub-frame (case 3)");
if(UE->generate_prach==0) {
LOG_D(PHY,"ULSCH %d.%d (generate_ul_signal %d): signal F energy %d dB (txdataF %p)\n",proc->frame_tx,proc->subframe_tx,UE->generate_ul_signal[proc->subframe_tx][0],dB_fixed(signal_energy(&UE->common_vars.txdataF[0][proc->subframe_tx*14*UE->frame_parms.ofdm_symbol_size],14*UE->frame_parms.ofdm_symbol_size)),&UE->common_vars.txdataF[0][proc->subframe_tx*14*UE->frame_parms.ofdm_symbol_size]);
ulsch_common_procedures(UE,proc, (UE->generate_ul_signal[proc->subframe_tx][0] == 0));
}
if (pthread_mutex_lock(&proc->mutex_rxtx) != 0) {
LOG_E( PHY, "[SCHED][UE] error locking mutex for UE RXTX\n" );
exit_fun("noting to add");
......@@ -2045,7 +2050,7 @@ void *UE_thread(void *arg) {
//UE->proc.proc_rxtx[0].frame_rx++;
//UE->proc.proc_rxtx[1].frame_rx++;
for (th_id=0; th_id < RX_NB_TH; th_id++) {
UE->proc.proc_rxtx[th_id].frame_rx++;
UE->proc.proc_rxtx[th_id].frame_rx=(UE->proc.proc_rxtx[th_id].frame_rx+1)&1023;
}
}
//UE->proc.proc_rxtx[0].gotIQs=readTime(gotIQs);
......@@ -2055,7 +2060,8 @@ void *UE_thread(void *arg) {
}
proc->subframe_rx=sub_frame;
proc->subframe_tx=(sub_frame+4)%10;
proc->frame_tx = proc->frame_rx + (proc->subframe_rx>5?1:0);
proc->frame_tx = (proc->frame_rx + (proc->subframe_rx>5?1:0))&1023;
proc->timestamp_tx = timestamp+
(4*UE->frame_parms.samples_per_tti)-
UE->frame_parms.ofdm_symbol_size-UE->frame_parms.nb_prefix_samples0;
......@@ -2116,7 +2122,7 @@ void init_UE_threads(int inst) {
UE->proc.instance_cnt_synch = -1;
UE->is_synchronized = 0;
if (UE->sidelink_active == 1) {
if (UE->sidelink_active == 1 && UE->SLonly==1) {
pthread_attr_init (&UE->proc.attr_ueSL);
pthread_attr_setstacksize(&UE->proc.attr_ueSL,8192);//5*PTHREAD_STACK_MIN);
......@@ -2157,7 +2163,7 @@ void init_UE_threads(int inst) {
pthread_mutex_init(&UE->sldch_mutex,NULL);
pthread_mutex_init(&UE->slsch_mutex,NULL);
pthread_mutex_init(&UE->slsch_rx_mutex,NULL);
pthread_create(&UE->proc.pthread_synchSL,NULL,UE_thread_synchSL,(void*)UE);
if(UE->SLonly==1) pthread_create(&UE->proc.pthread_synchSL,NULL,UE_thread_synchSL,(void*)UE);
}
}
......
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