Commit 7dd982e1 authored by William Johnson's avatar William Johnson

Merge branch 'l1-sidelink' of gitlab.eurecom.fr:matzakos/LTE-D2D into l1-sidelink

parents 477d0b2a 03ea01d3
......@@ -651,7 +651,7 @@ int lte_sync_timeSL(PHY_VARS_UE *ue,
for (int slot=0;slot<80;slot++) {
remove_7_5_kHz(&ru_tmp,slot);
for (int ar=0;ar<frame_parms->nb_antennas_rx;ar++) {
memcpy((void*)&rxdata[ar][slot*2*(frame_parms->samples_per_tti/2)],
memcpy((void*)&rxdata[ar][slot*(frame_parms->samples_per_tti/2)],
(void*)&rxdata_7_5kHz[ar][(slot&1)*2*(frame_parms->samples_per_tti/2)],
sizeof(int16_t)*(2*frame_parms->samples_per_tti/2));
}
......@@ -796,7 +796,7 @@ int lte_sync_time_eNB(int32_t **rxdata, ///rx data in time domain
}
}
mean_val/=length;
mean_val/=(length/4);
*peak_val_out = peak_val;
......
......@@ -62,9 +62,9 @@ int generate_slsss(int32_t **txdataF,
if (((symbol == 11) && frame_parms->Ncp == NORMAL) ||
((symbol == 10) && frame_parms->Ncp == EXTENDED))
d = &d0_sss[62*(Nid2 + (Nid1*3))];
d = &d0_sss[62*(Nid2 + (Nid1*2))];
else
d = &d5_sss[62*(Nid2 + (Nid1*3))];
d = &d5_sss[62*(Nid2 + (Nid1*2))];
Nsymb = (frame_parms->Ncp==NORMAL)?14:12;
k = frame_parms->ofdm_symbol_size-3*12+5;
......@@ -190,7 +190,7 @@ int _do_slpss_sss_extract(PHY_VARS_UE *ue,
LTE_DL_FRAME_PARMS *frame_parms = &ue->frame_parms;
int rx_offset = (subframe*frame_parms->samples_per_tti) + frame_parms->ofdm_symbol_size-3*12;
int rx_offset = frame_parms->ofdm_symbol_size-3*12;
uint8_t pss0_symb,pss1_symb,sss0_symb,sss1_symb;
int32_t **rxdataF;
......@@ -202,9 +202,9 @@ int _do_slpss_sss_extract(PHY_VARS_UE *ue,
if (frame_parms->frame_type == FDD) {
pss0_symb = 1;
pss1_symb = 2;
sss0_symb = 10;
sss1_symb = 11;
rxdataF = ue->common_vars.common_vars_rx_data_per_thread[ue->current_thread_id[subframe]].rxdataF;
sss0_symb = 11;
sss1_symb = 12;
rxdataF = ue->sl_rxdataF;
pss0_rxF = &rxdataF[aarx][(rx_offset + (pss0_symb*(frame_parms->ofdm_symbol_size)))];
sss0_rxF = &rxdataF[aarx][(rx_offset + (sss0_symb*(frame_parms->ofdm_symbol_size)))];
pss1_rxF = &rxdataF[aarx][(rx_offset + (pss1_symb*(frame_parms->ofdm_symbol_size)))];
......@@ -228,16 +228,16 @@ int _do_slpss_sss_extract(PHY_VARS_UE *ue,
// skip DC carrier
if (rb==3) {
if(frame_parms->frame_type == FDD)
{
sss0_rxF = &rxdataF[aarx][(1 + (sss0_symb*(frame_parms->ofdm_symbol_size)))];
pss0_rxF = &rxdataF[aarx][(1 + (pss0_symb*(frame_parms->ofdm_symbol_size)))];
sss1_rxF = &rxdataF[aarx][(1 + (sss1_symb*(frame_parms->ofdm_symbol_size)))];
pss1_rxF = &rxdataF[aarx][(1 + (pss1_symb*(frame_parms->ofdm_symbol_size)))];
}
{
sss0_rxF = &rxdataF[aarx][((sss0_symb*(frame_parms->ofdm_symbol_size)))];
pss0_rxF = &rxdataF[aarx][((pss0_symb*(frame_parms->ofdm_symbol_size)))];
sss1_rxF = &rxdataF[aarx][((sss1_symb*(frame_parms->ofdm_symbol_size)))];
pss1_rxF = &rxdataF[aarx][((pss1_symb*(frame_parms->ofdm_symbol_size)))];
}
else
AssertFatal(0,"");
}
}
for (i=0; i<12; i++) {
if (doPss) {
......@@ -247,6 +247,8 @@ int _do_slpss_sss_extract(PHY_VARS_UE *ue,
if (doSss) {
sss0_rxF_ext[i]=sss0_rxF[i];
sss1_rxF_ext[i]=sss1_rxF[i];
// printf("rb %d: sss0 %d (%d,%d)\n",rb,i,((int16_t*)&sss0_rxF[i])[0],((int16_t*)&sss0_rxF[i])[1]);
// printf("rb %d: sss1 %d (%d,%d)\n",rb,i,((int16_t*)&sss1_rxF[i])[0],((int16_t*)&sss1_rxF[i])[1]);
}
}
......@@ -259,7 +261,7 @@ int _do_slpss_sss_extract(PHY_VARS_UE *ue,
pss1_rxF_ext+=12;
sss1_rxF_ext+=12;
}
}
return(0);
......@@ -293,7 +295,6 @@ int rx_slsss(PHY_VARS_UE *ue,int32_t *tot_metric,uint8_t *phase_max,int Nid2,int
LTE_DL_FRAME_PARMS *frame_parms=&ue->frame_parms;
int32_t metric;
int16_t *d0,*d5;
int16_t **rxdata_7_5kHz = ue->sl_rxdata_7_5kHz;
int16_t **rxdataF = ue->sl_rxdataF;
if (frame_parms->frame_type == FDD) {
......@@ -316,7 +317,7 @@ int rx_slsss(PHY_VARS_UE *ue,int32_t *tot_metric,uint8_t *phase_max,int Nid2,int
ru_tmp.N_TA_offset=0;
ru_tmp.common.rxdata_7_5kHz = (int32_t**)malloc16(ue->frame_parms.nb_antennas_rx*sizeof(int32_t*));
for (int aa=0;aa<ue->frame_parms.nb_antennas_rx;aa++)
ru_tmp.common.rxdata_7_5kHz[aa] = (int32_t*)&rxdata_7_5kHz[aa][ue->rx_offsetSL*2];
ru_tmp.common.rxdata_7_5kHz[aa] = (int32_t*)&ue->common_vars.rxdata_syncSL[aa][ue->rx_offsetSL*2];
ru_tmp.common.rxdataF = (int32_t**)rxdataF;
ru_tmp.nb_rx = ue->frame_parms.nb_antennas_rx;
......@@ -341,12 +342,12 @@ int rx_slsss(PHY_VARS_UE *ue,int32_t *tot_metric,uint8_t *phase_max,int Nid2,int
pss1_ext,
sss1_ext,
0);
write_output("rxdataF0.m","rxF0",&rxdataF[0][0],2*14*ue->frame_parms.ofdm_symbol_size,1,1);
write_output("pss_ext0.m","pssext0",pss0_ext,72,1,1);
write_output("sss0_ext0.m","sss0ext0",sss0_ext,72,1,1);
exit(-1);
// write_output("rxdataF0.m","rxF0",&rxdataF[0][0],2*14*ue->frame_parms.ofdm_symbol_size,1,1);
// write_output("pss0_ext.m","pss0ext",pss0_ext,72,1,1);
// write_output("sss0_ext.m","sss0ext",sss0_ext,72,1,1);
// exit(-1);
// get conjugated channel estimate from PSS (symbol 6), H* = R* \cdot PSS
// and do channel estimation and compensation based on PSS
......@@ -359,7 +360,7 @@ int rx_slsss(PHY_VARS_UE *ue,int32_t *tot_metric,uint8_t *phase_max,int Nid2,int
Nid2);
// write_output("sss0_comp0.m","sss0comp0",sss0_ext,72,1,1);
// exit(-1);
// now do the SSS detection based on the precomputed sequences in PHY/LTE_TRANSPORT/sss.h
*tot_metric = -99999999;
......@@ -373,8 +374,8 @@ int rx_slsss(PHY_VARS_UE *ue,int32_t *tot_metric,uint8_t *phase_max,int Nid2,int
for (Nid1 = 0 ; Nid1 <= 167; Nid1++) { // 168 possible Nid1 values
metric = 0;
d0 = &d0_sss[62*(Nid2 + (Nid1*3))];
d5 = &d5_sss[62*(Nid2 + (Nid1*3))];
d0 = &d0_sss[62*(Nid2 + (Nid1*2))];
d5 = &d5_sss[62*(Nid2 + (Nid1*2))];
// This is the inner product using one particular value of each unknown parameter
for (i=0; i<62; i++) {
metric +=
......@@ -385,16 +386,16 @@ int rx_slsss(PHY_VARS_UE *ue,int32_t *tot_metric,uint8_t *phase_max,int Nid2,int
// if the current metric is better than the last save it
if (metric > *tot_metric) {
*tot_metric = metric;
ue->frame_parms.Nid_SL = Nid2+(2*Nid1);
ue->frame_parms.Nid_SL = (Nid2*168)+Nid1;
*phase_max = phase;
#ifdef DEBUG_SSS
printf("(phase,Nid1) (%d,%d), metric_phase %d tot_metric %d, phase_max %d\n",phase,Nid1,metric,*tot_metric,*phase_max);
#endif
//#ifdef DEBUG_SSS
LOG_I(PHY,"(phase,Nid_SL) (%d,%d), metric_phase %d tot_metric %d, phase_max %d\n",phase,ue->frame_parms.Nid_SL,metric,*tot_metric,*phase_max);
//#endif
}
}
}
exit(-1);
return(0);
}
......
......@@ -313,7 +313,7 @@ int main(int argc, char **argv) {
if (do_SLSS == 1) {
slss.SL_OffsetIndicator = 0;
slss.slss_id = 169;
slss.slss_id = 170;
slss.slmib_length = 5;
slss.slmib[0] = 0;
slss.slmib[1] = 1;
......
......@@ -276,8 +276,10 @@ extern void init_td_thread(PHY_VARS_eNB *, pthread_attr_t *);
extern void init_te_thread(PHY_VARS_eNB *, pthread_attr_t *);
PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t UE_id,
uint8_t abstraction_flag);
uint8_t UE_id,
uint8_t abstraction_flag,
int sidelink_active);
void init_eNB_afterRU(void);
extern int stop_L1L2(module_id_t enb_id);
......
......@@ -80,7 +80,7 @@ void *UE_thread(void *arg);
void *UE_threadSL(void *arg);
void init_UE_stub(int nb_inst,int,int,char*,int);
void ue_stub_rx_handler(unsigned int, char *);
void init_UE(int nb_inst,int,int,int,int,int,int);
void init_UE(int,int,int,int,int,int,int);
int32_t **rxdata;
int32_t **txdata;
......@@ -151,7 +151,8 @@ void phy_init_lte_ue_transport(PHY_VARS_UE *ue,int absraction_flag);
PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t UE_id,
uint8_t abstraction_flag)
uint8_t abstraction_flag,
int sidelink_active)
{
......@@ -167,7 +168,8 @@ PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
ue->Mod_id = UE_id;
ue->mac_enabled = 1;
ue->sidelink_active = sidelink_active;
// Panos: In phy_stub_UE (MAC-to-MAC) mode these init functions don't need to get called. Is this correct?
if (nfapi_mode!=3)
{
......@@ -226,7 +228,7 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correcti
PHY_VARS_UE *UE;
int inst;
int ret;
LOG_I(PHY,"UE : Calling Layer 2 for initialization\n");
l2_init_ue(eMBMS_active,(uecap_xer_in==1)?uecap_xer:NULL,
......@@ -236,15 +238,14 @@ void init_UE(int nb_inst,int eMBMS_active, int uecap_xer_in, int timing_correcti
for (inst=0;inst<nb_inst;inst++) {
LOG_I(PHY,"Initializing memory for UE instance %d (%p)\n",inst,PHY_vars_UE_g[inst]);
PHY_vars_UE_g[inst][0] = init_ue_vars(NULL,inst,0);
PHY_vars_UE_g[inst][0] = init_ue_vars(NULL,inst,0,sidelink_active);
// turn off timing control loop in UE
PHY_vars_UE_g[inst][0]->no_timing_correction = timing_correction;
PHY_vars_UE_g[inst][0]->SLonly = SLonly;
PHY_vars_UE_g[inst][0]->is_SynchRef = isSynchRef;
if (SLonly==1) PHY_vars_UE_g[inst][0]->sidelink_active = 1;
else PHY_vars_UE_g[inst][0]->sidelink_active = sidelink_active;
LOG_I(PHY,"Intializing UE Threads for instance %d (%p,%p)...\n",inst,PHY_vars_UE_g[inst],PHY_vars_UE_g[inst][0]);
init_UE_threads(inst);
UE = PHY_vars_UE_g[inst][0];
......@@ -299,7 +300,7 @@ void init_UE_stub(int nb_inst,int eMBMS_active, int uecap_xer_in, char *emul_ifa
for (inst=0;inst<nb_inst;inst++) {
LOG_I(PHY,"Initializing memory for UE instance %d (%p)\n",inst,PHY_vars_UE_g[inst]);
PHY_vars_UE_g[inst][0] = init_ue_vars(NULL,inst,0);
PHY_vars_UE_g[inst][0] = init_ue_vars(NULL,inst,0,0);
if (simL1 == 1) PHY_vars_UE_g[inst][0]->sidelink_l2_emulation = 2;
else PHY_vars_UE_g[inst][0]->sidelink_l2_emulation = 1;
......@@ -1688,11 +1689,11 @@ void *UE_threadSL(void *arg) {
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
rxp[i] = (void*)&UE->common_vars.rxdata_syncSL[i][0];
AssertFatal( UE->frame_parms.samples_per_tti*10 ==
AssertFatal( UE->frame_parms.samples_per_tti*40 ==
UE->rfdevice.trx_read_func(&UE->rfdevice,
&timestamp,
rxp,
UE->frame_parms.samples_per_tti*10,
UE->frame_parms.samples_per_tti*40,
UE->frame_parms.nb_antennas_rx), "");
AssertFatal ( 0== pthread_mutex_lock(&UE->proc.mutex_synchSL), "");
instance_cnt_synch = ++UE->proc.instance_cnt_synchSL;
......@@ -1708,7 +1709,7 @@ void *UE_threadSL(void *arg) {
for (int i=0; i<UE->frame_parms.nb_antennas_rx; i++)
rxp[i] = (void*)&dummy_rx[i][0];
for (int sf=0; sf<10; sf++)
for (int sf=0; sf<40; sf++)
// printf("Reading dummy sf %d\n",sf);
UE->rfdevice.trx_read_func(&UE->rfdevice,
&timestamp,
......
......@@ -216,11 +216,11 @@ uint8_t nfapi_mode = 0;
extern void reset_opp_meas(void);
extern void print_opp_meas(void);
extern PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
PHY_VARS_UE* init_ue_vars(LTE_DL_FRAME_PARMS *frame_parms,
uint8_t UE_id,
uint8_t abstraction_flag);
uint8_t abstraction_flag,
int sidelink_active);
int transmission_mode=1;
......@@ -883,8 +883,9 @@ int main( int argc, char **argv )
NB_UE_INST=1;
NB_INST=1;
PHY_vars_UE_g = malloc(sizeof(PHY_VARS_UE**));
PHY_vars_UE_g[0] = malloc(sizeof(PHY_VARS_UE*)*MAX_NUM_CCs);
PHY_vars_UE_g[0][CC_id] = init_ue_vars(frame_parms[CC_id], 0,abstraction_flag);
PHY_vars_UE_g[0] = malloc(sizeof(PHY_VARS_UE*)*MAX_NUM_CCs);
if (SLonly == 1 || synchRef==1) sidelink_active=1;
PHY_vars_UE_g[0][CC_id] = init_ue_vars(frame_parms[CC_id], 0,abstraction_flag,sidelink_active);
UE[CC_id] = PHY_vars_UE_g[0][CC_id];
printf("PHY_vars_UE_g[0][%d] = %p\n",CC_id,UE[CC_id]);
......@@ -1038,6 +1039,7 @@ int main( int argc, char **argv )
// start the main threads
int eMBMS_active = 0;
init_UE(1,eMBMS_active,uecap_xer_in,0,sidelink_active,SLonly,synchRef);
if (phy_test==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