Commit 1d8794a8 authored by Raymond Knopp's avatar Raymond Knopp

PSS RX testing with USRP

parent 79b6e1d8
......@@ -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;
......
......@@ -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;
......@@ -1679,7 +1680,7 @@ void *UE_threadSL(void *arg) {
int is_synchronized = UE->is_synchronizedSL;
AssertFatal ( 0== pthread_mutex_unlock(&UE->proc.mutex_synch), "");
LOG_I(PHY,"UHD Thread SL (is_synchronized %d, is_SynchRef %d\n",
LOG_D(PHY,"UHD Thread SL (is_synchronized %d, is_SynchRef %d\n",
is_synchronized,UE->is_SynchRef);
if (is_synchronized == 0 && UE->is_SynchRef == 0) {
......@@ -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