Commit a7b53a25 authored by Raymond Knopp's avatar Raymond Knopp

handling of joint legacy UE and SL procedures, modifications to antenna mappings in USRP for SL

parent 09ff2087
......@@ -177,10 +177,13 @@ int rx_psbch(PHY_VARS_UE *ue,int frame_rx,int subframe_rx) {
ru_tmp.common.rxdataF = (int32_t**)rxdataF;
ru_tmp.nb_rx = ue->frame_parms.nb_antennas_rx;
int SLaoffset=0;
if (ue->SLonly==0) SLaoffset=1;
// if SLonly then all antennas are SL only, else they are inteleaved with legacy RX antennas
if (ue->is_synchronizedSL == 1) { // Run front-end processing
ru_tmp.common.rxdata = (int32_t**)malloc16(ue->frame_parms.nb_antennas_rx*sizeof(int32_t*));
for (int aa=0;aa<ue->frame_parms.nb_antennas_rx;aa++) {
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];
}
......
......@@ -81,6 +81,9 @@ void sldch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
if (ue->sldch_received[npsdch] > 0) return;
int SLaoffset=0;
if (ue->SLonly==0) SLaoffset=1;
// slot FEP
if (proc->sl_fep_done == 0) {
proc->sl_fep_done = 1;
......@@ -89,7 +92,12 @@ void sldch_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 = ue->common_vars.rxdata;
ru_tmp.common.rxdata = (int32_t**)malloc16(ue->frame_parms.nb_antennas_rx*sizeof(int32_t*));
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_7_5kHz = (int32_t**)rxdata_7_5kHz;
ru_tmp.common.rxdataF = (int32_t**)rxdataF;
ru_tmp.nb_rx = ue->frame_parms.nb_antennas_rx;
......@@ -97,6 +105,8 @@ void sldch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
remove_7_5_kHz(&ru_tmp,(subframe_rx<<1));
remove_7_5_kHz(&ru_tmp,(subframe_rx<<1)+1);
free(ru_tmp.common.rxdata);
// extract symbols from slot
for (int l=0; l<Nsymb; l++) {
slot_fep_ul(&ru_tmp,l,(subframe_rx<<1),0);
......
......@@ -874,25 +874,37 @@ void pscch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
if (frame_rx < 100) LOG_D(PHY,"%d.%d: Running pscch decoding slot %d, nprb %d, a %d, amod %d,N_SL_RB_SC %d\n",frame_rx,subframe_rx,slot,nprb,a,amod,slsch->N_SL_RB_SC);
// 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));
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 = ue->common_vars.rxdata;
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_7_5kHz = (int32_t**)rxdata_7_5kHz;
ru_tmp.common.rxdataF = (int32_t**)rxdataF;
ru_tmp.nb_rx = ue->frame_parms.nb_antennas_rx;
remove_7_5_kHz(&ru_tmp,(subframe_rx<<1)+slot);
remove_7_5_kHz(&ru_tmp,(subframe_rx<<1));
remove_7_5_kHz(&ru_tmp,(subframe_rx<<1)+1);
free(ru_tmp.common.rxdata);
#ifdef PSCCH_DEBUG
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);
#endif
for (int l=0; l<Nsymb; l++) slot_fep_ul(&ru_tmp,l,(subframe_rx<<1)+slot,0);
for (int l=0; l<Nsymb; l++) {
slot_fep_ul(&ru_tmp,l,(subframe_rx<<1),0);
slot_fep_ul(&ru_tmp,l,(subframe_rx<<1)+1,0);
}
proc->sl_fep_done = 1;
}
// extract symbols from slot
......@@ -1240,6 +1252,9 @@ void slsch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
LOG_D(PHY,"slsch_decoding %d.%d => lmod10 %d\n",frame_rx,subframe_rx,ljmod10);
int SLaoffset=0;
if (ue->SLonly==0) SLaoffset=1;
// slot FEP
if (proc->sl_fep_done == 0) {
proc->sl_fep_done = 1;
......@@ -1248,7 +1263,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 = ue->common_vars.rxdata;
ru_tmp.common.rxdata = (int32_t**)malloc16(ue->frame_parms.nb_antennas_rx*sizeof(int32_t*));
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_7_5kHz = (int32_t**)rxdata_7_5kHz;
ru_tmp.common.rxdataF = (int32_t**)rxdataF;
ru_tmp.nb_rx = ue->frame_parms.nb_antennas_rx;
......@@ -1256,6 +1275,8 @@ void slsch_decoding(PHY_VARS_UE *ue,UE_rxtx_proc_t *proc,int frame_rx,int subfra
remove_7_5_kHz(&ru_tmp,(subframe_rx<<1));
remove_7_5_kHz(&ru_tmp,(subframe_rx<<1)+1);
free(ru_tmp.common.rxdata);
for (int l=0; l<Nsymb; l++) {
slot_fep_ul(&ru_tmp,l,(subframe_rx<<1),0);
if (l<Nsymb-1) // skip last symbol in second slot
......
......@@ -746,8 +746,10 @@ int trx_usrp_set_freq(openair0_device *device, openair0_config_t *openair0_cfg,
if (dont_block == 1)
pthread_create(&f_thread,NULL,freq_thread,(void *)device);
else {
s->usrp->set_tx_freq(device->openair0_cfg[0].tx_freq[0]);
s->usrp->set_rx_freq(device->openair0_cfg[0].rx_freq[0]);
for (int i=0;i<device->openair0_cfg[0].tx_num_channels;i++)
s->usrp->set_tx_freq(device->openair0_cfg[0].tx_freq[i],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);
}
return(0);
......@@ -1123,9 +1125,12 @@ extern "C" {
// lock mboard clocks
if (openair0_cfg[0].clock_source == internal && device_adds.size() == 1)
s->usrp->set_clock_source("internal");
else
else // if we set to external or if we have more than 1 USRP
s->usrp->set_clock_source("external");
// if we have more than 1 USRP require PPS source
if (device_adds.size()>1) s->usrp->set_time_source("external");
if (device->type==USRP_X300_DEV) {
openair0_cfg[0].rx_gain_calib_table = calib_table_x310;
#if defined(USRP_REC_PLAY)
......
......@@ -528,6 +528,8 @@ static void *UE_thread_synch(void *arg)
ind = 0;
found = 0;
// this is number of RX antennas for legacy LTE operation (i.e. not sidelink)
int nb_rx = UE->sidelink_active == 1 ? openair0_cfg[UE->rf_map.card].rx_num_channels : openair0_cfg[UE->rf_map.card].rx_num_channels>>1;
if (UE->UE_scan == 0) {
do {
......@@ -554,7 +556,7 @@ 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);
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_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;
......@@ -569,7 +571,7 @@ static void *UE_thread_synch(void *arg)
} else if (UE->UE_scan == 1) {
current_band=0;
for (i=0; i<openair0_cfg[UE->rf_map.card].rx_num_channels; i++) {
for (i=0; i<nb_rx; i++) {
downlink_frequency[UE->rf_map.card][UE->rf_map.chain+i] = bands_to_scan.band_info[CC_id].dl_min;
uplink_frequency_offset[UE->rf_map.card][UE->rf_map.chain+i] =
bands_to_scan.band_info[CC_id].ul_min-bands_to_scan.band_info[CC_id].dl_min;
......@@ -612,7 +614,7 @@ static void *UE_thread_synch(void *arg)
oai_exit=1;
}
for (i=0; i<openair0_cfg[UE->rf_map.card].rx_num_channels; i++) {
for (i=0; i<nb_rx; i++) {
downlink_frequency[UE->rf_map.card][UE->rf_map.chain+i] = bands_to_scan.band_info[current_band].dl_min+current_offset;
uplink_frequency_offset[UE->rf_map.card][UE->rf_map.chain+i] = bands_to_scan.band_info[current_band].ul_min-bands_to_scan.band_info[0].dl_min + current_offset;
......@@ -1094,7 +1096,7 @@ static void *UE_thread_rxn_txnp4(void *arg) {
LOG_E( PHY, "[UE %"PRIu8"] Frame %"PRIu32", subframe %u %s\n",
UE->Mod_id, proc->frame_rx, proc->subframe_tx,txt );
}
}
} // SLonly==1 && mac_enabled == 1
phy_procedures_UE_SL_TX(UE,proc);
}
......
......@@ -552,9 +552,12 @@ void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
}
}
void init_openair0(LTE_DL_FRAME_PARMS *frame_parms,int rxgain) {
void init_openair0(LTE_DL_FRAME_PARMS *frame_parms,int rxgain,int SLactive) {
int card;
int i;
AssertFatal(frame_parms!=NULL,"frame_parms is null\n");
AssertFatal(SLactive == 0 || SLactive == 1, "Illegal SLactive %d\n",SLactive);
for (card=0; card<MAX_CARDS; card++) {
openair0_cfg[card].mmapped_dma=mmapped_dma;
......@@ -597,8 +600,8 @@ void init_openair0(LTE_DL_FRAME_PARMS *frame_parms,int rxgain) {
openair0_cfg[card].Mod_id = 0;
openair0_cfg[card].num_rb_dl=frame_parms->N_RB_DL;
openair0_cfg[card].clock_source = clock_source;
openair0_cfg[card].tx_num_channels=min(2,frame_parms->nb_antennas_tx);
openair0_cfg[card].rx_num_channels=min(2,frame_parms->nb_antennas_rx);
openair0_cfg[card].tx_num_channels=min(2,frame_parms->nb_antennas_tx)<<SLactive;
openair0_cfg[card].rx_num_channels=min(2,frame_parms->nb_antennas_rx)<<SLactive;
for (i=0; i<4; i++) {
if (i<openair0_cfg[card].tx_num_channels)
......@@ -606,11 +609,20 @@ void init_openair0(LTE_DL_FRAME_PARMS *frame_parms,int rxgain) {
else
openair0_cfg[card].tx_freq[i]=0.0;
if (i<openair0_cfg[card].rx_num_channels)
openair0_cfg[card].rx_freq[i] = downlink_frequency[0][i];
else
if (SLactive==0) {
if (i<openair0_cfg[card].rx_num_channels)
openair0_cfg[card].rx_freq[i] = downlink_frequency[0][i];
else
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) {
if ((i&2)==0) openair0_cfg[card].rx_freq[i] = downlink_frequency[0][i/2];
else openair0_cfg[card].rx_freq[i] = downlink_frequency[0][i/2]+uplink_frequency_offset[0][i];
}
else
openair0_cfg[card].rx_freq[i]=0.0;
}
openair0_cfg[card].autocal[i] = 1;
openair0_cfg[card].tx_gain[i] = tx_gain[0][i];
openair0_cfg[card].rx_gain[i] = rxgain - rx_gain_off;
......@@ -728,6 +740,7 @@ int main( int argc, char **argv ) {
if (SLonly == 1 || synchRef==1) sidelink_active=1;
printf("Running with %d UE instances\n",NB_UE_INST);
if (NB_UE_INST > 1 && simL1flag != 1 && nfapi_mode != 3) {
......@@ -830,7 +843,7 @@ int main( int argc, char **argv ) {
}
}
}
else init_openair0(frame_parms[0],(int)rx_gain[0][0]);
else init_openair0(frame_parms[0],(int)rx_gain[0][0],(PHY_vars_UE_g[0][0]->sidelink_active==1 && PHY_vars_UE_g[0][0]->SLonly==0)?1:0);
if (simL1flag==1) {
RCConfig_sim();
......
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