Commit 3ea9834d authored by Raymond Knopp's avatar Raymond Knopp

changes in targets/RT/USER/lte-softmodem.c and targets/RT/USER/lte-ue.c for UE band scanning

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7298 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent d4bac78d
...@@ -2002,6 +2002,7 @@ static void get_options (int argc, char **argv) ...@@ -2002,6 +2002,7 @@ static void get_options (int argc, char **argv)
break; break;
case 'r': case 'r':
UE_scan = 0;
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
switch(atoi(optarg)) { switch(atoi(optarg)) {
case 6: case 6:
...@@ -2251,11 +2252,11 @@ int main( int argc, char **argv ) ...@@ -2251,11 +2252,11 @@ int main( int argc, char **argv )
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) { for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
frame_parms[CC_id] = (LTE_DL_FRAME_PARMS*) malloc(sizeof(LTE_DL_FRAME_PARMS)); frame_parms[CC_id] = (LTE_DL_FRAME_PARMS*) malloc(sizeof(LTE_DL_FRAME_PARMS));
/* Set some default values that may be overwritten while reading options */ /* Set some default values that may be overwritten while reading options */
frame_parms[CC_id]->frame_type = TDD; /* TDD */ frame_parms[CC_id]->frame_type = FDD; /* TDD */
frame_parms[CC_id]->tdd_config = 3; frame_parms[CC_id]->tdd_config = 3;
frame_parms[CC_id]->tdd_config_S = 0; frame_parms[CC_id]->tdd_config_S = 0;
frame_parms[CC_id]->N_RB_DL = 25; frame_parms[CC_id]->N_RB_DL = 100;
frame_parms[CC_id]->N_RB_UL = 25; frame_parms[CC_id]->N_RB_UL = 100;
frame_parms[CC_id]->Ncp = NORMAL; frame_parms[CC_id]->Ncp = NORMAL;
frame_parms[CC_id]->Ncp_UL = NORMAL; frame_parms[CC_id]->Ncp_UL = NORMAL;
frame_parms[CC_id]->Nid_cell = Nid_cell; frame_parms[CC_id]->Nid_cell = Nid_cell;
...@@ -2272,6 +2273,14 @@ int main( int argc, char **argv ) ...@@ -2272,6 +2273,14 @@ int main( int argc, char **argv )
set_taus_seed (0); set_taus_seed (0);
for (CC_id=0; CC_id<MAX_NUM_CCs; CC_id++) {
downlink_frequency[CC_id][0] = 2680000000; // Use float to avoid issue with frequency over 2^31.
downlink_frequency[CC_id][1] = downlink_frequency[CC_id][0];
downlink_frequency[CC_id][2] = downlink_frequency[CC_id][0];
downlink_frequency[CC_id][3] = downlink_frequency[CC_id][0];
printf("Downlink for CC_id %d frequency set to %u\n", CC_id, downlink_frequency[CC_id][0]);
}
get_options (argc, argv); //Command-line options get_options (argc, argv); //Command-line options
set_glog(glog_level, glog_verbosity); set_glog(glog_level, glog_verbosity);
...@@ -2736,10 +2745,6 @@ int main( int argc, char **argv ) ...@@ -2736,10 +2745,6 @@ int main( int argc, char **argv )
0,// cba_group_active 0,// cba_group_active
0); // HO flag 0); // HO flag
if (UE_flag == 1)
mac_xface->dl_phy_sync_success (0, 0, 0, 1);
else
mac_xface->mrbch_phy_sync_failure (0, 0, 0);
#endif #endif
...@@ -2756,11 +2761,15 @@ int main( int argc, char **argv ) ...@@ -2756,11 +2761,15 @@ int main( int argc, char **argv )
#endif #endif
#ifdef OPENAIR2 #ifdef OPENAIR2
printf("Filling UE band info\n"); printf("Filling UE band info\n");
if (UE_flag==1) if (UE_flag==1) {
fill_ue_band_info(); fill_ue_band_info();
mac_xface->dl_phy_sync_success (0, 0, 0, 1);
}
else
mac_xface->mrbch_phy_sync_failure (0, 0, 0);
#endif #endif
/* #ifdef OPENAIR2 /* #ifdef OPENAIR2
......
...@@ -233,29 +233,32 @@ static void *UE_thread_synch(void *arg) ...@@ -233,29 +233,32 @@ static void *UE_thread_synch(void *arg)
found = 0; found = 0;
current_band = eutra_bands[ind].band; current_band = eutra_bands[ind].band;
do {
printf("Scanning band %d, dl_min %u\n",current_band,eutra_bands[ind].dl_min);
if ((eutra_bands[ind].dl_min <= downlink_frequency[0][0]) && (eutra_bands[ind].dl_max>= downlink_frequency[0][0])) { if (UE->UE_scan == 0) {
for (card=0; card<MAX_NUM_CCs; card++) do {
for (i=0; i<4; i++) printf("Scanning band %d, dl_min %u\n",current_band,eutra_bands[ind].dl_min);
uplink_frequency_offset[card][i] = eutra_bands[ind].ul_min - eutra_bands[ind].dl_min;
found = 1; if ((eutra_bands[ind].dl_min <= downlink_frequency[0][0]) && (eutra_bands[ind].dl_max>= downlink_frequency[0][0])) {
break; for (card=0; card<MAX_NUM_CCs; card++)
} for (i=0; i<4; i++)
uplink_frequency_offset[card][i] = eutra_bands[ind].ul_min - eutra_bands[ind].dl_min;
ind++; found = 1;
current_band = eutra_bands[ind].band; break;
} while (current_band < 44); }
if (found == 0) { ind++;
exit_fun("Can't find EUTRA band for frequency"); current_band = eutra_bands[ind].band;
oai_exit=1; } while (current_band < 44);
}
if (found == 0) {
exit_fun("Can't find EUTRA band for frequency");
oai_exit=1;
}
}
if (UE->UE_scan == 1) { else if (UE->UE_scan == 1) {
current_band=0;
for (card=0; card<MAX_CARDS; card++) { for (card=0; card<MAX_CARDS; card++) {
for (i=0; i<openair0_cfg[card].rx_num_channels; i++) { for (i=0; i<openair0_cfg[card].rx_num_channels; i++) {
downlink_frequency[card][i] = bands_to_scan.band_info[0].dl_min; downlink_frequency[card][i] = bands_to_scan.band_info[0].dl_min;
...@@ -299,7 +302,7 @@ static void *UE_thread_synch(void *arg) ...@@ -299,7 +302,7 @@ static void *UE_thread_synch(void *arg)
openair0_set_gains(&openair0,&openair0_cfg[0]); openair0_set_gains(&openair0,&openair0_cfg[0]);
#endif #endif
#endif #endif
LOG_D(PHY,"[SCHED][UE] Scanning band %d, freq %u\n",bands_to_scan.band_info[0].band, bands_to_scan.band_info[0].dl_min);
} else { } else {
LOG_D(PHY,"[SCHED][UE] Check absolute frequency %u (oai_exit %d)\n",downlink_frequency[0][0],oai_exit); LOG_D(PHY,"[SCHED][UE] Check absolute frequency %u (oai_exit %d)\n",downlink_frequency[0][0],oai_exit);
...@@ -329,6 +332,8 @@ static void *UE_thread_synch(void *arg) ...@@ -329,6 +332,8 @@ static void *UE_thread_synch(void *arg)
switch (sync_mode) { switch (sync_mode) {
case pss: case pss:
LOG_I(PHY,"[SCHED][UE] Scanning band %d (%d), freq %u\n",bands_to_scan.band_info[current_band].band, current_band,bands_to_scan.band_info[current_band].dl_min+current_offset);
lte_sync_timefreq(UE,current_band,bands_to_scan.band_info[current_band].dl_min+current_offset);
current_offset += 20000000; // increase by 20 MHz current_offset += 20000000; // increase by 20 MHz
...@@ -375,7 +380,7 @@ static void *UE_thread_synch(void *arg) ...@@ -375,7 +380,7 @@ static void *UE_thread_synch(void *arg)
printf("UE synch: setting RX gain (%d,%d) to %f\n",card,i,openair0_cfg[card].rx_gain[i]); printf("UE synch: setting RX gain (%d,%d) to %f\n",card,i,openair0_cfg[card].rx_gain[i]);
#endif #endif
} }
#ifdef EXMIMO #ifdef EXMIMO
//openair0_config(&openair0_cfg[card],1); //openair0_config(&openair0_cfg[card],1);
...@@ -388,6 +393,7 @@ static void *UE_thread_synch(void *arg) ...@@ -388,6 +393,7 @@ static void *UE_thread_synch(void *arg)
// openair0_set_gains(&openair0,&openair0_cfg[0]); // openair0_set_gains(&openair0,&openair0_cfg[0]);
#endif #endif
#endif #endif
break; break;
case pbch: case pbch:
...@@ -499,7 +505,6 @@ static void *UE_thread_synch(void *arg) ...@@ -499,7 +505,6 @@ static void *UE_thread_synch(void *arg)
default: default:
break; break;
} }
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SYNCH,0); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SYNCH,0);
if (pthread_mutex_lock(&UE->mutex_synch) != 0) { if (pthread_mutex_lock(&UE->mutex_synch) != 0) {
...@@ -1012,7 +1017,7 @@ void *UE_thread(void *arg) ...@@ -1012,7 +1017,7 @@ void *UE_thread(void *arg)
UE->PHY_measurements.rx_power_avg_dB[0] - rx_input_level_dBm, UE->PHY_measurements.rx_power_avg_dB[0] - rx_input_level_dBm,
UE->rx_total_gain_dB, UE->rx_total_gain_dB,
openair0_cfg[0].rx_gain[0] openair0_cfg[0].rx_gain[0]
); );
exit_fun("[HW][UE] UE in RX calibration mode, exiting"); exit_fun("[HW][UE] UE in RX calibration mode, exiting");
} }
} }
...@@ -1378,7 +1383,7 @@ void *UE_thread(void *arg) ...@@ -1378,7 +1383,7 @@ void *UE_thread(void *arg)
UE->PHY_measurements.rx_power_avg_dB[0] - rx_input_level_dBm, UE->PHY_measurements.rx_power_avg_dB[0] - rx_input_level_dBm,
UE->rx_total_gain_dB, UE->rx_total_gain_dB,
openair0_cfg[0].rx_gain[0] openair0_cfg[0].rx_gain[0]
); );
exit_fun("[HW][UE] UE in RX calibration mode, exiting"); exit_fun("[HW][UE] UE in RX calibration mode, exiting");
} }
} }
...@@ -1414,8 +1419,8 @@ void *UE_thread(void *arg) ...@@ -1414,8 +1419,8 @@ void *UE_thread(void *arg)
} }
/* /*
if ((slot%2000)<10) if ((slot%2000)<10)
LOG_D(HW,"fun0: doing very hard work\n"); LOG_D(HW,"fun0: doing very hard work\n");
*/ */
// now increment slot and frame counters // now increment slot and frame counters
slot++; slot++;
......
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