Commit d08675d8 authored by rdoost's avatar rdoost

fixes for ue-scan-carrier mode

parent 956dba6b
...@@ -159,7 +159,7 @@ extern "C" { ...@@ -159,7 +159,7 @@ extern "C" {
# define LOG_W(c, x...) logIt(c, LOG_WARNING, x) # define LOG_W(c, x...) logIt(c, LOG_WARNING, x)
# define LOG_N(c, x...) logIt(c, LOG_NOTICE, x) # define LOG_N(c, x...) logIt(c, LOG_NOTICE, x)
# define LOG_I(c, x...) logIt(c, LOG_INFO, x) # define LOG_I(c, x...) logIt(c, LOG_INFO, x)
# define LOG_D(c, x...) logIt(c, LOG_DEBUG, x) # define LOG_D(c, x...) //logIt(c, LOG_DEBUG, x)
# define LOG_F(c, x...) logIt(c, LOG_FILE, x) // log to a file, useful for the MSC chart generation # define LOG_F(c, x...) logIt(c, LOG_FILE, x) // log to a file, useful for the MSC chart generation
# define LOG_T(c, x...) logIt(c, LOG_TRACE, x) # define LOG_T(c, x...) logIt(c, LOG_TRACE, x)
# endif /* T_TRACER */ # endif /* T_TRACER */
......
...@@ -74,9 +74,10 @@ typedef struct ...@@ -74,9 +74,10 @@ typedef struct
static int trx_iris_start(openair0_device *device) static int trx_iris_start(openair0_device *device)
{ {
iris_state_t *s = (iris_state_t*)device->priv; iris_state_t *s = (iris_state_t*)device->priv;
long long timeNs = s->iris->getHardwareTime("") + 500000; long long timeNs = s->iris->getHardwareTime("") + 500000;
int flags = 0; int flags = 0;
flags |= SOAPY_SDR_HAS_TIME; //flags |= SOAPY_SDR_HAS_TIME;
int ret = s->iris->activateStream(s->rxStream, flags, timeNs, 0); int ret = s->iris->activateStream(s->rxStream, flags, timeNs, 0);
int ret2 = s->iris->activateStream(s->txStream); int ret2 = s->iris->activateStream(s->txStream);
if (ret < 0 | ret2 < 0) if (ret < 0 | ret2 < 0)
...@@ -496,19 +497,6 @@ extern "C" { ...@@ -496,19 +497,6 @@ extern "C" {
int samples=openair0_cfg[0].sample_rate; int samples=openair0_cfg[0].sample_rate;
samples/=24000; samples/=24000;
// create tx & rx streamer
const SoapySDR::Kwargs &arg = SoapySDR::Kwargs();
std::vector<size_t> channels={};
for (i = 0; i<openair0_cfg[0].rx_num_channels; i++)
if (i < s->iris->getNumChannels(SOAPY_SDR_RX))
channels.push_back(i);
s->rxStream = s->iris->setupStream(SOAPY_SDR_RX, SOAPY_SDR_CS16, channels, arg);
std::vector<size_t> tx_channels={};
for (i = 0; i<openair0_cfg[0].tx_num_channels; i++)
if (i < s->iris->getNumChannels(SOAPY_SDR_TX))
tx_channels.push_back(i);
s->txStream = s->iris->setupStream(SOAPY_SDR_TX, SOAPY_SDR_CS16, tx_channels, arg);
/* Setting TX/RX BW after streamers are created due to iris calibration issue */ /* Setting TX/RX BW after streamers are created due to iris calibration issue */
for(i = 0; i < openair0_cfg[0].tx_num_channels; i++) { for(i = 0; i < openair0_cfg[0].tx_num_channels; i++) {
...@@ -524,6 +512,19 @@ extern "C" { ...@@ -524,6 +512,19 @@ extern "C" {
} }
} }
// create tx & rx streamer
const SoapySDR::Kwargs &arg = SoapySDR::Kwargs();
std::vector<size_t> channels={};
for (i = 0; i<openair0_cfg[0].rx_num_channels; i++)
if (i < s->iris->getNumChannels(SOAPY_SDR_RX))
channels.push_back(i);
s->rxStream = s->iris->setupStream(SOAPY_SDR_RX, SOAPY_SDR_CS16, channels, arg);
std::vector<size_t> tx_channels={};
for (i = 0; i<openair0_cfg[0].tx_num_channels; i++)
if (i < s->iris->getNumChannels(SOAPY_SDR_TX))
tx_channels.push_back(i);
s->txStream = s->iris->setupStream(SOAPY_SDR_TX, SOAPY_SDR_CS16, tx_channels, arg);
s->iris->setHardwareTime(0, ""); s->iris->setHardwareTime(0, "");
......
...@@ -483,13 +483,13 @@ static void *UE_thread_synch(void *arg) ...@@ -483,13 +483,13 @@ static void *UE_thread_synch(void *arg)
UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0); UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0);
//UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]); //UE->rfdevice.trx_set_gains_func(&openair0,&openair0_cfg[0]);
UE->rfdevice.trx_stop_func(&UE->rfdevice); //UE->rfdevice.trx_stop_func(&UE->rfdevice);
sleep(1); //usleep(100);
init_frame_parms(&UE->frame_parms,1); init_frame_parms(&UE->frame_parms,1);
if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) { //if (UE->rfdevice.trx_start_func(&UE->rfdevice) != 0 ) {
LOG_E(HW,"Could not start the device\n"); // LOG_E(HW,"Could not start the device\n");
oai_exit=1; // oai_exit=1;
} //}
} }
else { else {
UE->is_synchronized = 1; UE->is_synchronized = 1;
...@@ -521,13 +521,13 @@ static void *UE_thread_synch(void *arg) ...@@ -521,13 +521,13 @@ static void *UE_thread_synch(void *arg)
// calculate new offset and try again // calculate new offset and try again
if (UE->UE_scan_carrier == 1) { if (UE->UE_scan_carrier == 1) {
if (freq_offset >= 0) { if (freq_offset >= 0) {
freq_offset += 100; freq_offset += 20;
freq_offset *= -1; freq_offset *= -1;
} else { } else {
freq_offset *= -1; freq_offset *= -1;
} }
if (abs(freq_offset) > 7500) { if (abs(freq_offset) > 20000) {
LOG_I( PHY, "[initial_sync] No cell synchronization found, abandoning\n" ); LOG_I( PHY, "[initial_sync] No cell synchronization found, abandoning\n" );
FILE *fd; FILE *fd;
if ((fd = fopen("rxsig_frame0.dat","w"))!=NULL) { if ((fd = fopen("rxsig_frame0.dat","w"))!=NULL) {
...@@ -543,9 +543,8 @@ static void *UE_thread_synch(void *arg) ...@@ -543,9 +543,8 @@ static void *UE_thread_synch(void *arg)
return &UE_thread_synch_retval; // not reached return &UE_thread_synch_retval; // not reached
} }
} }
else { if (freq_offset%100 == 0)
{
}
LOG_I( PHY, "[initial_sync] trying carrier off %d Hz, rxgain %d (DL %u, UL %u)\n", LOG_I( PHY, "[initial_sync] trying carrier off %d Hz, rxgain %d (DL %u, UL %u)\n",
freq_offset, freq_offset,
UE->rx_total_gain_dB, UE->rx_total_gain_dB,
...@@ -564,7 +563,7 @@ static void *UE_thread_synch(void *arg) ...@@ -564,7 +563,7 @@ static void *UE_thread_synch(void *arg)
} }
UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0); UE->rfdevice.trx_set_freq_func(&UE->rfdevice,&openair0_cfg[0],0);
}
}// initial_sync=0 }// initial_sync=0
break; break;
......
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