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

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@6421 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent b4635ac4
...@@ -1870,8 +1870,8 @@ static void *UE_thread_synch(void *arg) { ...@@ -1870,8 +1870,8 @@ static void *UE_thread_synch(void *arg) {
openair0_cfg[card].rx_gain[i] = PHY_vars_UE_g[0][0]->rx_total_gain_dB-USRP_GAIN_OFFSET; openair0_cfg[card].rx_gain[i] = PHY_vars_UE_g[0][0]->rx_total_gain_dB-USRP_GAIN_OFFSET;
#ifdef USRP #ifdef USRP
#ifndef USRP_DEBUG #ifndef USRP_DEBUG
openair0_set_frequencies(&openair0,&openair0_cfg[0]); openair0_set_rx_frequencies(&openair0,&openair0_cfg[0]);
// openair0_set_gains(&openair0,&openair0_cfg[0]); openair0_set_gains(&openair0,&openair0_cfg[0]);
#endif #endif
#endif #endif
} }
...@@ -1881,6 +1881,7 @@ static void *UE_thread_synch(void *arg) { ...@@ -1881,6 +1881,7 @@ static void *UE_thread_synch(void *arg) {
else { else {
LOG_D(PHY,"[SCHED][UE] Check absolute frequency %u\n",downlink_frequency[0][0]); LOG_D(PHY,"[SCHED][UE] Check absolute frequency %u\n",downlink_frequency[0][0]);
} }
while (!oai_exit) { while (!oai_exit) {
if (pthread_mutex_lock(&UE->mutex_synch) != 0) { if (pthread_mutex_lock(&UE->mutex_synch) != 0) {
...@@ -1897,40 +1898,32 @@ static void *UE_thread_synch(void *arg) { ...@@ -1897,40 +1898,32 @@ static void *UE_thread_synch(void *arg) {
} }
} // mutex_lock } // mutex_lock
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SYNCH,1);
switch (sync_mode) { switch (sync_mode) {
case rssi: case rssi:
rssi_min = 1<<31; rssi_min = (1<<31)-1;
rssi_max = 0; rssi_max = 0;
rssi_avg = 0; rssi_avg = 0;
memset(power_dBm_max,0,1024); for (i=0;i<76800;i+=7680) {
for (i=0;i<76800*4;i+=1024) {
//compute frequency-domain representation of 1024-sample chunk
dft1024(&PHY_vars_UE_g[0][0]->lte_ue_common_vars.rxdata[0][i],
spectrum,
1);
compute_spectrum_stats(spectrum,
power_avg,
power_max,
power_min,
PHY_vars_UE_g[0][0]->rx_total_gain_dB);
}
/*
rssi_lin = signal_energy(&PHY_vars_UE_g[0][0]->lte_ue_common_vars.rxdata[0][i],7680); rssi_lin = signal_energy(&PHY_vars_UE_g[0][0]->lte_ue_common_vars.rxdata[0][i],7680);
if (PHY_vars_UE_g[0][0]->lte_frame_parms.nb_antennas_rx>1) if (PHY_vars_UE_g[0][0]->lte_frame_parms.nb_antennas_rx>1)
rssi_lin += signal_energy(&PHY_vars_UE_g[0][0]->lte_ue_common_vars.rxdata[1][i],7680); rssi_lin += signal_energy(&PHY_vars_UE_g[0][0]->lte_ue_common_vars.rxdata[1][i],7680);
rssi_avg += rssi; rssi_avg += rssi_lin;
rssi_min = (rssi < rssi_min) ? rssi : rssi_min; rssi_min = (rssi_lin < rssi_min) ? rssi_lin : rssi_min;
rssi_max = (rssi > rssi_max) ? rssi : rssi_max; rssi_max = (rssi_lin > rssi_max) ? rssi_lin : rssi_max;
} }
rssi_dBm = dB_fixed_times10(rssi_avg/10)/10.0 - PHY_vars_UE_g[0][0]->rx_total_gain_dB; rssi_dBm = dB_fixed_times10(rssi_avg/10)/10.0 - PHY_vars_UE_g[0][0]->rx_total_gain_dB;
rssi_max_dBm = dB_fixed_times10(rssi_max)/10.0 - PHY_vars_UE_g[0][0]->rx_total_gain_dB; rssi_max_dBm = dB_fixed_times10(rssi_max)/10.0 - PHY_vars_UE_g[0][0]->rx_total_gain_dB;
rssi_min_dBm = dB_fixed_times10(rssi_min)/10.0 - PHY_vars_UE_g[0][0]->rx_total_gain_dB; rssi_min_dBm = dB_fixed_times10(rssi_min)/10.0 - PHY_vars_UE_g[0][0]->rx_total_gain_dB;
LOG_D(PHY,"Band %d, DL Freq %u: RSSI (avg, min, max) %f,%f,%f dBm\n", LOG_D(PHY,"Band %d, DL Freq %u: RSSI (%d,%d,%d) (avg, min, max) %f,%f,%f dBm\n",
bands_to_scan.band_info[current_band].band, bands_to_scan.band_info[current_band].band,
downlink_frequency[0][0], downlink_frequency[0][0],
rssi_avg/10,
rssi_min,
rssi_max,
rssi_dBm, rssi_dBm,
rssi_min_dBm, rssi_min_dBm,
rssi_max_dBm); rssi_max_dBm);
...@@ -1942,23 +1935,27 @@ static void *UE_thread_synch(void *arg) { ...@@ -1942,23 +1935,27 @@ static void *UE_thread_synch(void *arg) {
} }
if (current_band==bands_to_scan.nbands) { if (current_band==bands_to_scan.nbands) {
current_band=0; current_band=0;
oai_exit=1;
} }
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[current_band].dl_min+current_offset;
uplink_frequency_offset[card][i] = bands_to_scan.band_info[current_band].ul_min-bands_to_scan.band_info[0].dl_min + current_offset;
openair0_cfg[card].rx_freq[i] = downlink_frequency[card][i]+openair_daq_vars.freq_offset; openair0_cfg[card].rx_freq[i] = downlink_frequency[card][i]+openair_daq_vars.freq_offset;
openair0_cfg[card].tx_freq[i] = downlink_frequency[card][i]+uplink_frequency_offset[card][i]+openair_daq_vars.freq_offset; openair0_cfg[card].tx_freq[i] = downlink_frequency[card][i]+uplink_frequency_offset[card][i]+openair_daq_vars.freq_offset;
openair0_cfg[card].rx_gain[i] = PHY_vars_UE_g[0][0]->rx_total_gain_dB-USRP_GAIN_OFFSET; // 65 calibrated for USRP B210 @ 2.6 GHz openair0_cfg[card].rx_gain[i] = PHY_vars_UE_g[0][0]->rx_total_gain_dB-USRP_GAIN_OFFSET; // 65 calibrated for USRP B210 @ 2.6 GHz
#ifdef USRP #ifdef USRP
#ifndef USRP_DEBUG #ifndef USRP_DEBUG
openair0_set_frequencies(&openair0,&openair0_cfg[0]); openair0_set_rx_frequencies(&openair0,&openair0_cfg[0]);
// openair0_set_gains(&openair0,&openair0_cfg[0]); // openair0_set_gains(&openair0,&openair0_cfg[0]);
#endif #endif
#endif #endif
} }
} }
*/
break; break;
case pbch: case pbch:
...@@ -2030,7 +2027,7 @@ static void *UE_thread_synch(void *arg) { ...@@ -2030,7 +2027,7 @@ 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);
if (pthread_mutex_lock(&PHY_vars_UE_g[0][0]->mutex_synch) != 0) { if (pthread_mutex_lock(&PHY_vars_UE_g[0][0]->mutex_synch) != 0) {
printf("[openair][SCHED][eNB] error locking mutex for UE synch\n"); printf("[openair][SCHED][eNB] error locking mutex for UE synch\n");
} }
...@@ -2041,7 +2038,7 @@ if (pthread_mutex_lock(&PHY_vars_UE_g[0][0]->mutex_synch) != 0) { ...@@ -2041,7 +2038,7 @@ if (pthread_mutex_lock(&PHY_vars_UE_g[0][0]->mutex_synch) != 0) {
printf("[openair][SCHED][eNB] error unlocking mutex for UE synch\n"); printf("[openair][SCHED][eNB] error unlocking mutex for UE synch\n");
} }
} }
vcd_signal_dumper_dump_function_by_name(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_SYNCH,0);
} // while !oai_exit } // while !oai_exit
return(0); return(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