resolve errors after merging with develop / add configuration file for RRH with USRP

This commit is contained in:
Aikaterini
2016-02-05 11:10:28 +01:00
parent 8fc747ac7a
commit ca790b5903
10 changed files with 375 additions and 376 deletions
+23 -73
View File
@@ -172,7 +172,7 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
#endif
if (device->type == USRP_B200_IF) {
if (device->type == USRP_B200_DEV) {
if (cc>1) {
// receive multiple channels (e.g. RF A and RF B)
std::vector<void *> buff_ptrs;
@@ -198,7 +198,7 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
#endif
}
}
} else if (device->type == USRP_X300_IF) {
} else if (device->type == USRP_X300_DEV) {
if (cc>1) {
// receive multiple channels (e.g. RF A and RF B)
std::vector<void *> buff_ptrs;
@@ -395,15 +395,9 @@ extern "C" {
// Initialize USRP device
<<<<<<< HEAD
std::string args = "type=b200";
std::string args = "type=b200";
uhd::device_addrs_t device_adds = uhd::device::find(args);
size_t i;
printf("Checking for USRPs\n");
=======
uhd::device_addrs_t device_adds = uhd::device::find(args);
size_t i;
@@ -413,29 +407,19 @@ extern "C" {
sscanf(uhd::get_version_string().c_str(),"%d.%d.%d",&vers,&subvers,&subsubvers);
printf("Checking for USRPs : UHD %s (%d.%d.%d)\n",uhd::get_version_string().c_str(),vers,subvers,subsubvers);
>>>>>>> acd607fa359709ba16a83437f483c230cee1d9b0
if(device_adds.size() == 0)
{
double usrp_master_clock = 184.32e6;
std::string args = "type=x300";
// workaround for an api problem, master clock has to be set with the constructor not via set_master_clock_rate
args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock);
uhd::device_addrs_t device_adds = uhd::device::find(args);
if(device_adds.size() == 0)
<<<<<<< HEAD
{
std::cerr<<"No USRP Device Found. " << std::endl;
free(s);
return -1;
}
=======
{
std::cerr<<"No USRP Device Found. " << std::endl;
free(s);
@@ -444,17 +428,16 @@ extern "C" {
}
>>>>>>> acd607fa359709ba16a83437f483c230cee1d9b0
printf("Found USRP X300\n");
s->usrp = uhd::usrp::multi_usrp::make(args);
// s->usrp->set_rx_subdev_spec(rx_subdev);
// s->usrp->set_tx_subdev_spec(tx_subdev);
// lock mboard clocks
s->usrp->set_clock_source("internal");
//Setting device type to USRP X300/X310
device->type=USRP_X300_IF;
device->type=USRP_X300_DEV;
// this is not working yet, master clock has to be set via constructor
// set master clock rate and sample rate for tx & rx for streaming
@@ -511,11 +494,8 @@ extern "C" {
// s->usrp->set_clock_source("internal");
// set master clock rate and sample rate for tx & rx for streaming
device->type = USRP_B200_IF;
device->type = USRP_B200_DEV;
<<<<<<< HEAD
=======
if ((vers == 3) && (subvers == 9) && (subsubvers>=2)) {
openair0_cfg[0].rx_gain_calib_table = calib_table_b210;
@@ -574,20 +554,14 @@ extern "C" {
}
}
>>>>>>> acd607fa359709ba16a83437f483c230cee1d9b0
for(i=0;i<s->usrp->get_rx_num_channels();i++) {
if (i<openair0_cfg[0].rx_num_channels) {
s->usrp->set_rx_rate(openair0_cfg[0].sample_rate,i);
s->usrp->set_rx_bandwidth(openair0_cfg[0].rx_bw,i);
printf("Setting rx freq/gain on channel %lu/%lu : BW %f (readback %f)\n",i,s->usrp->get_rx_num_channels(),openair0_cfg[0].rx_bw/1e6,s->usrp->get_rx_bandwidth(i)/1e6);
s->usrp->set_rx_freq(openair0_cfg[0].rx_freq[i],i);
<<<<<<< HEAD
set_rx_gain_offset(&openair0_cfg[0],i);
=======
set_rx_gain_offset(&openair0_cfg[0],i,bw_gain_adjust);
>>>>>>> acd607fa359709ba16a83437f483c230cee1d9b0
::uhd::gain_range_t gain_range = s->usrp->get_rx_gain_range(i);
// limit to maximum gain
if (openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i] > gain_range.stop()) {
@@ -610,11 +584,11 @@ extern "C" {
s->usrp->set_tx_gain(openair0_cfg[0].tx_gain[i],i);
}
}
// display USRP settings
std::cout << boost::format("Actual master clock: %fMHz...") % (s->usrp->get_master_clock_rate()/1e6) << std::endl;
// create tx & rx streamer
uhd::stream_args_t stream_args_rx("sc16", "sc16");
//stream_args_rx.args["spp"] = str(boost::format("%d") % 2048);//(openair0_cfg[0].rx_num_channels*openair0_cfg[0].samples_per_packet));
@@ -623,17 +597,18 @@ extern "C" {
s->rx_stream = s->usrp->get_rx_stream(stream_args_rx);
std::cout << boost::format("rx_max_num_samps %u") % (s->rx_stream->get_max_num_samps()) << std::endl;
//openair0_cfg[0].samples_per_packet = s->rx_stream->get_max_num_samps();
uhd::stream_args_t stream_args_tx("sc16", "sc16");
//stream_args_tx.args["spp"] = str(boost::format("%d") % 2048);//(openair0_cfg[0].tx_num_channels*openair0_cfg[0].samples_per_packet));
for (i = 0; i<openair0_cfg[0].tx_num_channels; i++)
stream_args_tx.channels.push_back(i);
stream_args_tx.channels.push_back(i);
s->tx_stream = s->usrp->get_tx_stream(stream_args_tx);
std::cout << boost::format("tx_max_num_samps %u") % (s->tx_stream->get_max_num_samps()) << std::endl;
s->usrp->set_time_now(uhd::time_spec_t(0.0));
for (i=0;i<openair0_cfg[0].rx_num_channels;i++) {
if (i<openair0_cfg[0].rx_num_channels) {
printf("RX Channel %lu\n",i);
@@ -644,8 +619,9 @@ extern "C" {
std::cout << boost::format("Actual RX antenna: %s...") % (s->usrp->get_rx_antenna(i)) << std::endl;
}
}
for (i=0;i<openair0_cfg[0].tx_num_channels;i++) {
if (i<openair0_cfg[0].tx_num_channels) {
printf("TX Channel %lu\n",i);
std::cout << std::endl<<boost::format("Actual TX sample rate: %fMSps...") % (s->usrp->get_tx_rate(i)/1e6) << std::endl;
@@ -655,11 +631,10 @@ extern "C" {
std::cout << boost::format("Actual TX antenna: %s...") % (s->usrp->get_tx_antenna(i)) << std::endl;
}
}
std::cout << boost::format("Device timestamp: %f...") % (s->usrp->get_time_now().get_real_secs()) << std::endl;
device->priv = s;
device->type = USRP_DEV;
device->trx_start_func = trx_usrp_start;
device->trx_write_func = trx_usrp_write;
device->trx_read_func = trx_usrp_read;
@@ -673,37 +648,12 @@ extern "C" {
s->sample_rate = openair0_cfg[0].sample_rate;
// TODO:
// init tx_forward_nsamps based usrp_time_offset ex
/*if(is_equal(s->sample_rate, (double)30.72e6))
if(is_equal(s->sample_rate, (double)30.72e6))
s->tx_forward_nsamps = 176;
if(is_equal(s->sample_rate, (double)15.36e6))
if(is_equal(s->sample_rate, (double)15.36e6))
s->tx_forward_nsamps = 90;
if(is_equal(s->sample_rate, (double)7.68e6))
s->tx_forward_nsamps = 50;*/
/* move device specific parameters from lte-softmodem.c here */
if(is_equal(s->sample_rate, (double)30.72e6)) {
openair0_cfg->tx_delay = 8;
s->tx_forward_nsamps = 175;
openair0_cfg->tx_forward_nsamps = 175;
}
if(is_equal(s->sample_rate, (double)15.36e6)) {
openair0_cfg->tx_delay = 5;
s->tx_forward_nsamps = 95;
openair0_cfg->tx_forward_nsamps = 95;
}
if(is_equal(s->sample_rate, (double)7.68e6)) {
openair0_cfg->tx_delay = 5;
s->tx_forward_nsamps = 70;
openair0_cfg->tx_forward_nsamps = 70;
}
if(is_equal(s->sample_rate, (double)1.92e6)) {
openair0_cfg->tx_delay = 8;
s->tx_forward_nsamps = 40;
openair0_cfg->tx_forward_nsamps = 40;
}
openair0_cfg->iq_txshift= 5;
openair0_cfg->iq_rxrescale = 15;
printf("check params %d:%d",openair0_cfg->tx_forward_nsamps, openair0_cfg->tx_delay);
s->tx_forward_nsamps = 50;
return 0;
}
}