Commit 08a77aab authored by ivan's avatar ivan

Testing of Relay-node functionality (two USRP integration

parent 03ba5582
......@@ -56,7 +56,7 @@ int initial_syncSL(PHY_VARS_UE *ue) {
&index,
&psslevel,
&avglevel);
printf("index %d, psslevel %d dB avglevel %d dB => %d sample offset\n",
LOG_I(PHY,"index %d, psslevel %d dB avglevel %d dB => %d sample offset\n",
index,dB_fixed64((uint64_t)psslevel),dB_fixed64((uint64_t)avglevel),ue->rx_offsetSL);
if (ue->rx_offsetSL >= 0) {
int32_t sss_metric;
......
......@@ -94,9 +94,11 @@ void sldch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
ru_tmp.N_TA_offset=0;
// ru_tmp.common.rxdata = ue->common_vars.rxdata;
ru_tmp.common.rxdata = (int32_t**)malloc16(ue->frame_parms.nb_antennas_rx*sizeof(int32_t*));
ru_tmp.common.rxdata = (int32_t**)malloc16((1+ue->frame_parms.nb_antennas_rx)*sizeof(int32_t*));
int aaSL=0;
for (int aa=SLaoffset;aa<(ue->frame_parms.nb_antennas_rx<<SLaoffset);aa+=(1<<SLaoffset)) {
ru_tmp.common.rxdata[aa>>1] = (int32_t*)&ue->common_vars.rxdata[aa][0];
ru_tmp.common.rxdata[aaSL] = (int32_t*)&ue->common_vars.rxdata[aa][0];
aaSL++;
}
ru_tmp.common.rxdata_7_5kHz = (int32_t**)rxdata_7_5kHz;
ru_tmp.common.rxdataF = (int32_t**)rxdataF;
......@@ -115,8 +117,8 @@ void sldch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
}
}
LOG_D(PHY,"sldch_decoding: FEP in %d.%d for npsdch %d rvidx %d rx signal energy %d (%p) dB %d dB\n",frame_rx,subframe_rx,npsdch,rvidx,
dB_fixed(signal_energy((int32_t*)&ue->common_vars.rxdata[0][ue->frame_parms.samples_per_tti*subframe_rx],ue->frame_parms.samples_per_tti)),
&ue->common_vars.rxdata[0][ue->frame_parms.samples_per_tti*subframe_rx],
dB_fixed(signal_energy((int32_t*)&ue->common_vars.rxdata[SLaoffset][ue->frame_parms.samples_per_tti*subframe_rx],ue->frame_parms.samples_per_tti)),
&ue->common_vars.rxdata[SLaoffset][ue->frame_parms.samples_per_tti*subframe_rx],
dB_fixed(signal_energy((int32_t*)ue->sl_rxdata_7_5kHz[ue->current_thread_id[subframe_rx]][0],ue->frame_parms.samples_per_tti)));
for (int l=0; l<Nsymb; l++) {
......@@ -193,7 +195,7 @@ void sldch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
log2_maxh = (log2_approx(avgs)/2)+ log2_approx(ue->frame_parms.nb_antennas_rx-1)+4;
LOG_D(PHY,"sldch_decoding %d.%d npsdch %d log2_maxh %d\n",frame_rx,subframe_rx,npsdch,log2_maxh);
if (log2_maxh > 5) LOG_D(PHY,"sldch_decoding %d.%d npsdch %d log2_maxh %d\n",frame_rx,subframe_rx,npsdch,log2_maxh);
......@@ -320,7 +322,7 @@ void sldch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
// printf("slsch decoding round %d ret %d\n",ue->dlsch_rx_sldch->harq_processes[0]->round,ret);
if (ret<ue->dlsch_rx_sldch[npsdch]->max_turbo_iterations) {
LOG_D(PHY,"SLDCH received for npsdch %d (rvidx %d, iter %d)\n",
LOG_I(PHY,"SLDCH received for npsdch %d (rvidx %d, iter %d)\n",
npsdch,
rvidx,ret);
ue->sldch_received[npsdch] = 1;
......
......@@ -877,7 +877,6 @@ void pscch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
// slot FEP
int SLaoffset=0;
if (ue->SLonly==0) SLaoffset=1;
if (proc->sl_fep_done == 0) {
RU_t ru_tmp;
memset((void*)&ru_tmp,0,sizeof(RU_t));
......@@ -885,11 +884,13 @@ void pscch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
memcpy((void*)&ru_tmp.frame_parms,(void*)&ue->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
ru_tmp.N_TA_offset=0;
// ru_tmp.common.rxdata = ue->common_vars.rxdata;
ru_tmp.common.rxdata = (int32_t**)malloc16(ue->frame_parms.nb_antennas_rx*sizeof(int32_t*));
ru_tmp.common.rxdata = (int32_t**)malloc16((1+ue->frame_parms.nb_antennas_rx)*sizeof(int32_t*));
int aaSL=0;
for (int aa=SLaoffset;aa<(ue->frame_parms.nb_antennas_rx<<SLaoffset);aa+=(1<<SLaoffset)) {
ru_tmp.common.rxdata[aa>>1] = (int32_t*)&ue->common_vars.rxdata[aa][0];
ru_tmp.common.rxdata[aaSL] = (int32_t*)&ue->common_vars.rxdata[aa][0];
aaSL++;
}
ru_tmp.common.rxdata_7_5kHz = (int32_t**)rxdata_7_5kHz;
ru_tmp.common.rxdataF = (int32_t**)rxdataF;
ru_tmp.nb_rx = ue->frame_parms.nb_antennas_rx;
......@@ -1109,12 +1110,13 @@ void pscch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
}
}
//if(slsch->group_destination_id == UE_mac_inst[ue->Mod_id].groupL2Id || slsch->group_destination_id == UE_mac_inst[ue->Mod_id].sourceL2Id)
if(slsch->mcs<=20 && slsch->freq_hopping_flag==0 && (group_id_found|| slsch->group_destination_id == UE_mac_inst[ue->Mod_id].sourceL2Id))
if(slsch->mcs<=20 && slsch->freq_hopping_flag==0 && (group_id_found|| slsch->group_destination_id == UE_mac_inst[ue->Mod_id].sourceL2Id)) {
ue->slcch_received = 1;
ue->slsch_rx_sdu_active=1;
}
else
ue->slcch_received = 0;
ue->slcch_received = 1;
ue->slsch_decoded = 0;
#ifdef DEBUG_SCI_DECODING
printf("%d.%d sci %lx (%d bits,RAbits %d) : freq_hop %d, resource_block_coding %d, time_resource_pattern %d, mcs %d, timing_advance_indication %d, group_destination_id %d (gid shift %d result %lx => %lx\n",
......@@ -1132,7 +1134,6 @@ void pscch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
);
#endif
// check group_id here (not done yet)
ue->slsch_rx_sdu_active=1;
/*
write_output("rxsig0_input.m","rxs0_in",&ue->common_vars.rxdata[0][((subframe_rx<<1)+slot)*ue->frame_parms.samples_per_tti>>1],ue->frame_parms.samples_per_tti>>1,1,1);
write_output("rxsig0_7_5kHz.m","rxs0_7_5kHz",rxdata_7_5kHz[0],ue->frame_parms.samples_per_tti,1,1);
......@@ -1272,9 +1273,11 @@ void slsch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
memcpy((void*)&ru_tmp.frame_parms,(void*)&ue->frame_parms,sizeof(LTE_DL_FRAME_PARMS));
ru_tmp.N_TA_offset=0;
// ru_tmp.common.rxdata = ue->common_vars.rxdata;
ru_tmp.common.rxdata = (int32_t**)malloc16(ue->frame_parms.nb_antennas_rx*sizeof(int32_t*));
ru_tmp.common.rxdata = (int32_t**)malloc16((1+ue->frame_parms.nb_antennas_rx)*sizeof(int32_t*));
int aaSL=0;
for (int aa=SLaoffset;aa<(ue->frame_parms.nb_antennas_rx<<SLaoffset);aa+=(1<<SLaoffset)) {
ru_tmp.common.rxdata[aa] = (int32_t*)&ue->common_vars.rxdata[aa][0];
ru_tmp.common.rxdata[aaSL] = (int32_t*)&ue->common_vars.rxdata[aa][0];
aaSL++;
}
ru_tmp.common.rxdata_7_5kHz = (int32_t**)rxdata_7_5kHz;
ru_tmp.common.rxdataF = (int32_t**)rxdataF;
......
......@@ -75,7 +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 (frame_tx == 0) LOG_I(PHY, "slss: ue->tx_power_dBm: %d, tx_amp: %d\n", ue->tx_power_dBm[subframe_tx], tx_amp);
if (ue->generate_ul_signal[subframe_tx][0] == 0)
for (int aa=0; aa<ue->frame_parms.nb_antennas_tx; aa++) {
......
......@@ -2204,10 +2204,8 @@ void phy_procedures_UE_SL_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc) {
ue->generate_ul_signal[subframe_tx][0]);
if (frame_tx==0 && subframe_tx ==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]);
}
void phy_procedures_UE_TX(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,uint8_t eNB_id,uint8_t abstraction_flag,runmode_t mode) {
......
......@@ -2344,7 +2344,7 @@ ue_get_sdu(module_id_t module_idP, int CC_id, frame_t frameP,
phr_p->R = 0;
LOG_I(MAC,
LOG_D(MAC,
"[UE %d] Frame %d report PHR with mapping (%d->%d) for LCID %d\n",
module_idP, frameP, get_PHR(module_idP, CC_id, eNB_index),
phr_p->PH, POWER_HEADROOM);
......@@ -3626,14 +3626,14 @@ SLSCH_t *ue_get_slsch(module_id_t module_idP,int CC_id,frame_t frameP,sub_frame_
LOG_D(MAC,"absSF_offset %d (test %d): Checking status (%d,Dest %d) => LCID %d => %d bytes\n",absSF_offset,slsch_test,ue->sourceL2Id,ue->sl_info[i].destinationL2Id,ue->sl_info[i].LCID,rlc_status.bytes_in_buffer);
if (rlc_status.bytes_in_buffer > 2 || slsch_test == 1){
if (slsch_test == 1 && rlc_status.bytes_in_buffer <= 2) rlc_status.bytes_in_buffer = 300;
LOG_D(MAC,"SFN.SF %d.%d: Scheduling for %d bytes in Sidelink buffer \n",frameP,subframeP,rlc_status.bytes_in_buffer);
LOG_I(MAC,"SFN.SF %d.%d: Scheduling for %d bytes in Sidelink buffer \n",frameP,subframeP,rlc_status.bytes_in_buffer);
// Fill in group id for off-network communications
ue->sltx_active = 1;
//store LCID, destinationL2Id
ue->slsch_lcid = ue->sl_info[i].LCID;
ue->destinationL2Id = ue->sl_info[i].destinationL2Id;
LOG_D(MAC,"LCID %d, source L2ID 0x%08x, destinationL2Id: 0x%08x \n",ue->slsch_lcid, ue->sourceL2Id, ue->destinationL2Id);
LOG_I(MAC,"LCID %d, source L2ID 0x%08x, destinationL2Id: 0x%08x \n",ue->slsch_lcid, ue->sourceL2Id, ue->destinationL2Id);
break;
}
}
......
......@@ -812,7 +812,7 @@ pdcp_data_ind(
{ //traffic from eNB
((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 1;
}
((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 1;
//((pdcp_data_ind_header_t*) new_sdu_p->data)->inst = 1;
}
#endif
......@@ -841,7 +841,7 @@ pdcp_data_ind(
}
/* Print octets of incoming data in hexadecimal form */
LOG_D(PDCP, "Following content has been received from RLC (%d,%d)(PDCP header has already been removed):\n",
LOG_I(PDCP, "Following content has been received from RLC (%d,%d)(PDCP header has already been removed):\n",
sdu_buffer_sizeP - payload_offset + (int)sizeof(pdcp_data_ind_header_t),
sdu_buffer_sizeP - payload_offset);
//util_print_hex_octets(PDCP, &new_sdu_p->data[sizeof (pdcp_data_ind_header_t)], sdu_buffer_sizeP - payload_offset);
......
......@@ -30,8 +30,8 @@
*/
#define PDCP_FIFO_C
//#define PDCP_DEBUG 1
//#define DEBUG_PDCP_FIFO_FLUSH_SDU
#define PDCP_DEBUG 1
#define DEBUG_PDCP_FIFO_FLUSH_SDU
extern int otg_enabled;
......@@ -216,7 +216,7 @@ int pdcp_fifo_flush_sdus(const protocol_ctxt_t* const ctxt_pP)
#endif /* defined(ENABLE_USE_MME) */
#ifdef PDCP_DEBUG
LOG_D(PDCP, "PDCP->IP TTI %d INST %d: Preparing %d Bytes of data from rab %d to Nas_mesh\n",
LOG_I(PDCP, "PDCP->IP TTI %d INST %d: Preparing %d Bytes of data from rab %d to Nas_mesh\n",
ctxt_pP->frame, ((pdcp_data_ind_header_t *)(sdu_p->data))->inst,
((pdcp_data_ind_header_t *)(sdu_p->data))->data_size, ((pdcp_data_ind_header_t *)(sdu_p->data))->rb_id);
#endif //PDCP_DEBUG
......
......@@ -291,7 +291,7 @@ mac_rrc_data_ind_ue(
}
//TTN (for D2D)
if(srb_idP == SL_DISCOVERY) {
LOG_I(RRC,"[UE %d] Received SDU (%d bytes) for SL_DISCOVERY on SRB %d from eNB %d\n",module_idP, sdu_lenP, srb_idP,eNB_indexP);
LOG_I(RRC,"[UE %d] Received SDU (%d bytes) for SL_DISCOVERY on SRB %d\n",module_idP, sdu_lenP, srb_idP);
decode_SL_Discovery_Message(&ctxt, eNB_indexP, sduP, sdu_lenP);
}
......@@ -307,7 +307,7 @@ mac_rrc_data_ind_ue(
//TTN (for D2D)
if(srb_idP == SL_DISCOVERY) {
LOG_D(RRC,"[UE %d] Received SDU (%d bytes) for SL_DISCOVERY on SRB %d from eNB %d\n",module_idP, sdu_lenP, srb_idP,eNB_indexP);
LOG_D(RRC,"[UE %d] Received SDU (%d bytes) for SL_DISCOVERY on SRB %d\n",module_idP, sdu_lenP, srb_idP);
decode_SL_Discovery_Message(&ctxt, eNB_indexP, sduP, sdu_lenP);
}
#endif // Re114
......
......@@ -579,23 +579,23 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
#if defined(__x86_64) || defined(__i386__)
#ifdef __AVX2__
nsamps2 = (nsamps+7)>>3;
__m256i buff_tmp[cc*nboards][nsamps2];
__m256i buff_tmp[2][nsamps2];
#else
nsamps2 = (nsamps+3)>>2;
__m128i buff_tmp[cc*nboards][nsamps2];
__m128i buff_tmp[2][nsamps2];
#endif
#elif defined(__arm__)
nsamps2 = (nsamps+3)>>2;
int16x8_t buff_tmp[cc*nboards][nsamps2];
int16x8_t buff_tmp[2][nsamps2];
#endif
if (device->type == USRP_B200_DEV) {
for (s= (usrp_state_t *)device->priv,board=0;s!=(usrp_state_t *)NULL,board=1;s=(usrp_state_t *)device->priv2) {
for (s= (usrp_state_t *)device->priv,board=0;s!=(usrp_state_t *)NULL;s=(usrp_state_t *)device->priv2,board=1) {
if (cc>1) {
// receive multiple channels (e.g. RF A and RF B)
std::vector<void *> buff_ptrs;
for (int i=0; i<cc; i++) buff_ptrs.push_back(buff_tmp[i+(board*cc)]);
for (int i=0; i<cc; i++) buff_ptrs.push_back(buff_tmp[i]);
samples_received = s->rx_stream->recv(buff_ptrs, nsamps, s->rx_md);
} else {
......@@ -603,9 +603,8 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
samples_received=0;
while (samples_received != nsamps) {
samples_received += s->rx_stream->recv(buff_tmp[board]+samples_received,
samples_received += s->rx_stream->recv(buff_tmp[0]+samples_received,
nsamps-samples_received, s->rx_md);
if ((s->wait_for_first_pps == 0) && (s->rx_md.error_code!=uhd::rx_metadata_t::ERROR_CODE_NONE))
break;
/*
......@@ -616,22 +615,23 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
if (samples_received == nsamps) s->wait_for_first_pps=0;
}
if (s==(usrp_state_t *)device->priv2) break;
}
// bring RX data into 12 LSBs for softmodem RX
for (int i=0; i<cc*nboards; i++) {
for (int j=0; j<nsamps2; j++) {
// bring RX data into 12 LSBs for softmodem RX
for (int i=0; i<cc; i++) {
for (int j=0; j<nsamps2; j++) {
#if defined(__x86_64__) || defined(__i386__)
#ifdef __AVX2__
((__m256i *)buff[i])[j] = _mm256_srai_epi16(buff_tmp[i][j],4);
((__m256i *)buff[i+(cc*board)])[j] = _mm256_srai_epi16(buff_tmp[i][j],4);
#else
((__m128i *)buff[i])[j] = _mm_srai_epi16(buff_tmp[i][j],4);
((__m128i *)buff[i+(cc*board)])[j] = _mm_srai_epi16(buff_tmp[i][j],4);
#endif
#elif defined(__arm__)
((int16x8_t *)buff[i])[j] = vshrq_n_s16(buff_tmp[i][j],4);
((int16x8_t *)buff[i])[j] = vshrq_n_s16(buff_tmp[i][j],4);
#endif
}
}
}
if (s==(usrp_state_t *)device->priv2) break;
}
} else if (device->type == USRP_X300_DEV) {
if (cc>1) {
// receive multiple channels (e.g. RF A and RF B)
......@@ -649,6 +649,8 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
if (samples_received < nsamps)
LOG_E(PHY,"[recv] received %d samples out of %d\n",samples_received,nsamps);
s= (usrp_state_t *)device->priv;
if ( s->rx_md.error_code != uhd::rx_metadata_t::ERROR_CODE_NONE)
LOG_E(PHY, "%s\n", s->rx_md.to_pp_string(true).c_str());
......@@ -774,6 +776,8 @@ int trx_usrp_set_freq(openair0_device *device, openair0_config_t *openair0_cfg,
usrp_state_t *s = (usrp_state_t *)device->priv;
pthread_t f_thread;
usrp_state_t *s2= (usrp_state_t *)device->priv2;
// spawn a thread to handle the frequency change to not block the calling thread
if (dont_block == 1)
pthread_create(&f_thread,NULL,freq_thread,(void *)device);
......@@ -781,10 +785,18 @@ int trx_usrp_set_freq(openair0_device *device, openair0_config_t *openair0_cfg,
for (int i=0;i<device->openair0_cfg[0].tx_num_channels;i++) {
LOG_I(HW,"Setting USRP TX%d Freq %f\n",i,openair0_cfg[0].tx_freq[i]);
s->usrp->set_tx_freq(device->openair0_cfg[0].tx_freq[i],i);
if (s2) {
LOG_I(HW,"Setting 2nd USRP TX%d Freq %f\n",i,openair0_cfg[0].tx_freq[i+device->openair0_cfg[0].tx_num_channels]);
s2->usrp->set_tx_freq(device->openair0_cfg[0].tx_freq[i+device->openair0_cfg[0].tx_num_channels],i);
}
}
for (int i=0;i<device->openair0_cfg[0].rx_num_channels;i++) {
s->usrp->set_rx_freq(device->openair0_cfg[0].rx_freq[i],i);
LOG_I(HW,"Setting USRP RX%d Freq %f\n",i,openair0_cfg[0].rx_freq[i]);
if (s2) {
LOG_I(HW,"Setting 2nd USRP RX%d Freq %f\n",i,openair0_cfg[0].rx_freq[i+device->openair0_cfg[0].rx_num_channels]);
s2->usrp->set_rx_freq(device->openair0_cfg[0].rx_freq[i+device->openair0_cfg[0].rx_num_channels],i);
}
}
}
......@@ -1088,7 +1100,7 @@ extern "C" {
#endif
uhd::set_thread_priority_safe(1.0);
usrp_state_t *s = (usrp_state_t *)calloc(sizeof(usrp_state_t),1);
usrp_state_t *s2;
usrp_state_t *s2=NULL;
if (openair0_cfg[0].clock_source==gpsdo)
s->use_gps =1;
......@@ -1158,10 +1170,10 @@ extern "C" {
args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock);
}
s->usrp = uhd::usrp::multi_usrp::make(args+device_adds[1].get("serial").c_str());
s->usrp = uhd::usrp::multi_usrp::make(args+device_adds[0].get("serial").c_str());
if (device_adds.size()==2 && device->type == USRP_B200_DEV) { //allow for second instance of UHD with B2x0
s2 = (usrp_state_t *)calloc(sizeof(usrp_state_t),1);
s2->usrp = uhd::usrp::multi_usrp::make(args+device_adds[0].get("serial").c_str());
s2->usrp = uhd::usrp::multi_usrp::make(args+device_adds[1].get("serial").c_str());
}
// lock mboard clocks
if (openair0_cfg[0].clock_source == internal && device_adds.size() == 1) {
......@@ -1325,7 +1337,7 @@ extern "C" {
s->usrp->set_rx_freq(openair0_cfg[0].rx_freq[i],i);
if (device_adds.size()==2 && device->type == USRP_B200_DEV) {
s2->usrp->set_rx_rate(openair0_cfg[0].sample_rate,i);
s2->usrp->set_rx_freq(openair0_cfg[0].rx_freq[i],i);
s2->usrp->set_rx_freq(openair0_cfg[0].rx_freq[i+s->usrp->get_rx_num_channels()],i);
}
set_rx_gain_offset(&openair0_cfg[0],i,bw_gain_adjust);
::uhd::gain_range_t gain_range = s->usrp->get_rx_gain_range(i);
......@@ -1409,6 +1421,14 @@ extern "C" {
LOG_I(PHY," Actual RX gain: %f...\n", s->usrp->get_rx_gain(i));
LOG_I(PHY," Actual RX bandwidth: %fM...\n", s->usrp->get_rx_bandwidth(i)/1e6);
LOG_I(PHY," Actual RX antenna: %s...\n", s->usrp->get_rx_antenna(i).c_str());
if (s2) {
LOG_I(PHY,"RX2 Channel %d\n",i);
LOG_I(PHY," Actual RX2 sample rate: %fMSps...\n",s2->usrp->get_rx_rate(i)/1e6);
LOG_I(PHY," Actual RX2 frequency: %fGHz...\n", s2->usrp->get_rx_freq(i)/1e9);
LOG_I(PHY," Actual RX2 gain: %f...\n", s2->usrp->get_rx_gain(i));
LOG_I(PHY," Actual RX2 bandwidth: %fM...\n", s2->usrp->get_rx_bandwidth(i)/1e6);
LOG_I(PHY," Actual RX2 antenna: %s...\n", s2->usrp->get_rx_antenna(i).c_str());
}
}
for (int i=0; i<openair0_cfg[0].tx_num_channels; i++) {
......
......@@ -282,7 +282,7 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correcti
for (inst=0;inst<nb_inst;inst++) {
if (PHY_vars_UE_g[inst]==NULL) PHY_vars_UE_g[inst] = (PHY_VARS_UE**)calloc(1+MAX_NUM_CCs,sizeof(PHY_VARS_UE*));
LOG_I(PHY,"Allocating UE context %d\n",inst);
LOG_I(PHY,"Allocating UE context %d, (sidelink active %d, isSynchRef %d, SLonly %d)\n",inst,sidelink_active,isSynchRef,SLonly);
if (simL1flag == 0) PHY_vars_UE_g[inst][0] = init_ue_vars(fp0,inst,0,sidelink_active);
else {
......@@ -524,10 +524,12 @@ static void *UE_thread_synch(void *arg)
sprintf(threadname, "sync UE %d\n", UE->Mod_id);
init_thread(100000, 500000, FIFO_PRIORITY-1, &cpuset, threadname);
printf("starting UE synch thread (IC %d)\n",UE->proc.instance_cnt_synch);
LOG_I(PHY,"starting UE synch thread (IC %d)\n",UE->proc.instance_cnt_synch);
ind = 0;
found = 0;
int SLactive = UE->sidelink_active;
AssertFatal(SLactive == 0 || SLactive == 1,"SLactive needs to be 0 or 1\n");
// this is number of RX antennas for legacy LTE operation (i.e. not sidelink)
int nb_rx = openair0_cfg[UE->rf_map.card].rx_num_channels;
......@@ -554,12 +556,13 @@ static void *UE_thread_synch(void *arg)
}
LOG_I( PHY, "[SCHED][UE] Check absolute frequency DL %"PRIu32", UL %"PRIu32" (oai_exit %d, rx_num_channels %d)\n", UE->frame_parms.dl_CarrierFreq, UE->frame_parms.ul_CarrierFreq,oai_exit, openair0_cfg[0].rx_num_channels);
LOG_I( PHY, "[SCHED][UE] Check absolute frequency DL %"PRIu32", UL %"PRIu32" (oai_exit %d, rx_num_channels %d)\n", UE->frame_parms.dl_CarrierFreq, UE->frame_parms.ul_CarrierFreq,oai_exit, nb_rx);
for (i=0;i<nb_rx;i++) {
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] = UE->frame_parms.dl_CarrierFreq;
openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i] = UE->frame_parms.ul_CarrierFreq;
openair0_cfg[UE->rf_map.card].autocal[UE->rf_map.chain+i] = 1;
if (SLactive == 1) openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i+nb_rx] = UE->frame_parms.ul_CarrierFreq;
if (uplink_frequency_offset[CC_id][i] != 0) //
openair0_cfg[UE->rf_map.card].duplex_mode = duplex_mode_FDD;
else //FDD
......@@ -647,18 +650,26 @@ static void *UE_thread_synch(void *arg)
// rerun with new cell parameters and frequency-offset
for (i=0; i<openair0_cfg[UE->rf_map.card].rx_num_channels; i++) {
for (i=0; i<nb_rx; i++) {
openair0_cfg[UE->rf_map.card].rx_gain[UE->rf_map.chain+i] = UE->rx_total_gain_dB;//-USRP_GAIN_OFFSET;
if (UE->UE_scan_carrier == 1) {
if (freq_offset >= 0)
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] += abs(UE->common_vars.freq_offset);
else
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] -= abs(UE->common_vars.freq_offset);
openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i] =
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i]+uplink_frequency_offset[CC_id][i];
downlink_frequency[CC_id][i] = openair0_cfg[CC_id].rx_freq[i];
freq_offset=0;
}
openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i] =
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i]+uplink_frequency_offset[CC_id][i];
LOG_I(PHY,"Setting TX%d frequency to %f\n",i,openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i]);
LOG_I(PHY,"Setting TX%d frequency to %f\n",i,openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i]);
if (SLactive == 1) {
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i+nb_rx] = openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i];
LOG_I(PHY,"Setting SL RX%d frequency to %f\n",i,openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i+nb_rx]);
}
downlink_frequency[CC_id][i] = openair0_cfg[CC_id].rx_freq[i];
freq_offset=0;
}
// reconfigure for potentially different bandwidth
......@@ -770,12 +781,12 @@ static void *UE_thread_synch(void *arg)
downlink_frequency[0][0]+uplink_frequency_offset[0][0]+freq_offset );
#endif
for (i=0; i<openair0_cfg[UE->rf_map.card].rx_num_channels; i++) {
if (UE->sidelink_active == 1) openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i+openair0_cfg[UE->rf_map.card].rx_num_channels] = downlink_frequency[CC_id][0]+uplink_frequency_offset[CC_id][0]+freq_offset;
for (i=0; i<nb_rx; i++) {
if (UE->sidelink_active == 1) openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i+nb_rx] = downlink_frequency[CC_id][0]+uplink_frequency_offset[CC_id][0]+freq_offset;
openair0_cfg[UE->rf_map.card].rx_freq[UE->rf_map.chain+i] = downlink_frequency[CC_id][0]+freq_offset;
openair0_cfg[UE->rf_map.card].tx_freq[UE->rf_map.chain+i] = downlink_frequency[CC_id][0]+uplink_frequency_offset[CC_id][0]+freq_offset;
openair0_cfg[UE->rf_map.card].rx_gain[UE->rf_map.chain+i] = UE->rx_total_gain_dB;//-USRP_GAIN_OFFSET;
if (UE->sidelink_active == 1) openair0_cfg[UE->rf_map.card].rx_gain[UE->rf_map.chain+i+openair0_cfg[UE->rf_map.card].rx_num_channels] = UE->rx_total_gain_dB;//-USRP_GAIN_OFFSET;
if (UE->sidelink_active == 1) openair0_cfg[UE->rf_map.card].rx_gain[UE->rf_map.chain+i+nb_rx] = UE->rx_total_gain_dB;//-USRP_GAIN_OFFSET;
if (UE->UE_scan_carrier==1)
openair0_cfg[UE->rf_map.card].autocal[UE->rf_map.chain+i] = 1;
}
......@@ -1833,7 +1844,7 @@ void *UE_thread(void *arg) {
openair0_timestamp timestamp,timestamp1;
void* rxp[NB_ANTENNAS_RX], *txp[NB_ANTENNAS_TX];
int start_rx_stream =1;
int start_rx_stream =0;
int i;
int th_id;
......@@ -2126,7 +2137,7 @@ void init_UE_threads(int inst) {
pthread_mutex_init(&UE->proc.mutex_synch,NULL);
pthread_cond_init(&UE->proc.cond_synch,NULL);
UE->proc.instance_cnt_synch = -1;
UE->is_synchronized = 1;
UE->is_synchronized = 0;
if (UE->sidelink_active == 1 && UE->SLonly==1) {
pthread_attr_init (&UE->proc.attr_ueSL);
......
......@@ -618,10 +618,11 @@ void init_openair0(LTE_DL_FRAME_PARMS *frame_parms,int rxgain,int SLactive) {
openair0_cfg[card].rx_freq[i]=0.0;
}
else { // assign DL and UL frequency alternately on antenna ports if SL is active
if (i<openair0_cfg[card].rx_num_channels) {
openair0_cfg[card].rx_freq[i] = downlink_frequency[0][i/2];
openair0_cfg[card].rx_freq[i+openair0_cfg[card].rx_num_channels] = downlink_frequency[0][i/2]+uplink_frequency_offset[0][i];
LOG_I(PHY,"Setting SL receiver @ %f\n",openair0_cfg[card].rx_freq[i+openair0_cfg[card].rx_num_channels]);
int num_legacy_channels=openair0_cfg[card].rx_num_channels;
if (i<num_legacy_channels) {
openair0_cfg[card].rx_freq[i] = downlink_frequency[0][i];
openair0_cfg[card].rx_freq[i+num_legacy_channels] = downlink_frequency[0][i]+uplink_frequency_offset[0][i];
LOG_I(PHY,"Setting SL receiver @ %f\n",openair0_cfg[card].rx_freq[i+num_legacy_channels]);
}
else
openair0_cfg[card].rx_freq[i]=0.0;
......
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