Commit 18e1fdbe authored by aikaterini.trilyraki's avatar aikaterini.trilyraki

minor update in library name

parent d8b69ffb
...@@ -101,19 +101,9 @@ int set_transport(openair0_device *device) { ...@@ -101,19 +101,9 @@ int set_transport(openair0_device *device) {
int load_lib(openair0_device *device, openair0_config_t *openair0_cfg, char *cfgfile, uint8_t flag) { int load_lib(openair0_device *device, openair0_config_t *openair0_cfg, char *cfgfile, uint8_t flag) {
void *lib_handle; void *lib_handle;
char *OAI_RF_LIBNAME;
char *OAI_TP_LIBNAME;
oai_device_initfunc_t fp ; oai_device_initfunc_t fp ;
if (device->host_type==BBU_HOST) { if (flag == RF_DEVICE) {
OAI_RF_LIBNAME= "/home/guepe/openairinterface5g/cmake_targets/lte_noS1_build_oai/build/liboai_device.so";
OAI_TP_LIBNAME= "/home/guepe/openairinterface5g/cmake_targets/lte_noS1_build_oai/build/liboai_transpro.so";
} else {
OAI_RF_LIBNAME= "liboai_device.so";
OAI_TP_LIBNAME= "liboai_transpro.so";
}
if (flag == RF_DEVICE) {
lib_handle = dlopen(OAI_RF_LIBNAME, RTLD_LAZY); lib_handle = dlopen(OAI_RF_LIBNAME, RTLD_LAZY);
if (!lib_handle) { if (!lib_handle) {
printf( "Unable to locate %s: HW device set to NONE_DEV.\n", OAI_RF_LIBNAME); printf( "Unable to locate %s: HW device set to NONE_DEV.\n", OAI_RF_LIBNAME);
......
...@@ -332,44 +332,44 @@ int trx_usrp_reset_stats(openair0_device* device) { ...@@ -332,44 +332,44 @@ int trx_usrp_reset_stats(openair0_device* device) {
extern "C" { extern "C" {
int device_init(openair0_device* device, openair0_config_t *openair0_cfg, char *cfgfile) { int device_init(openair0_device* device, openair0_config_t *openair0_cfg, char *cfgfile) {
uhd::set_thread_priority_safe(1.0); uhd::set_thread_priority_safe(1.0);
usrp_state_t *s = (usrp_state_t*)malloc(sizeof(usrp_state_t)); usrp_state_t *s = (usrp_state_t*)malloc(sizeof(usrp_state_t));
memset(s, 0, sizeof(usrp_state_t)); memset(s, 0, sizeof(usrp_state_t));
// Initialize USRP device // Initialize USRP device
std::string args = "type=b200";
uhd::device_addrs_t device_adds = uhd::device::find(args); std::string args = "type=b200";
size_t i;
uhd::device_addrs_t device_adds = uhd::device::find(args);
size_t i;
printf("Checking for USRPs\n"); printf("Checking for USRPs\n");
if(device_adds.size() == 0) if(device_adds.size() == 0)
{ {
double usrp_master_clock = 184.32e6; double usrp_master_clock = 184.32e6;
std::string args = "type=x300"; 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 // 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); args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock);
uhd::device_addrs_t device_adds = uhd::device::find(args); uhd::device_addrs_t device_adds = uhd::device::find(args);
if(device_adds.size() == 0) if(device_adds.size() == 0)
{ {
std::cerr<<"No USRP Device Found. " << std::endl; std::cerr<<"No USRP Device Found. " << std::endl;
free(s); free(s);
return -1; return -1;
} }
printf("Found USRP X300\n"); printf("Found USRP X300\n");
s->usrp = uhd::usrp::multi_usrp::make(args); s->usrp = uhd::usrp::multi_usrp::make(args);
// s->usrp->set_rx_subdev_spec(rx_subdev); // s->usrp->set_rx_subdev_spec(rx_subdev);
// s->usrp->set_tx_subdev_spec(tx_subdev); // s->usrp->set_tx_subdev_spec(tx_subdev);
// lock mboard clocks // lock mboard clocks
s->usrp->set_clock_source("internal"); s->usrp->set_clock_source("internal");
...@@ -382,16 +382,15 @@ extern "C" { ...@@ -382,16 +382,15 @@ extern "C" {
// s->usrp->set_rx_subdev_spec(rx_subdev); // s->usrp->set_rx_subdev_spec(rx_subdev);
// s->usrp->set_tx_subdev_spec(tx_subdev); // s->usrp->set_tx_subdev_spec(tx_subdev);
// do not explicitly set the clock to "internal", because this will disable the gpsdo // do not explicitly set the clock to "internal", because this will disable the gpsdo
// // lock mboard clocks // // lock mboard clocks
// s->usrp->set_clock_source("internal"); // s->usrp->set_clock_source("internal");
// set master clock rate and sample rate for tx & rx for streaming // set master clock rate and sample rate for tx & rx for streaming
s->usrp->set_master_clock_rate(30.72e6); s->usrp->set_master_clock_rate(30.72e6);
} }
for(i=0;i<s->usrp->get_rx_num_channels();i++) { for(i=0;i<s->usrp->get_rx_num_channels();i++) {
if (i<openair0_cfg[0].rx_num_channels) { if (i<openair0_cfg[0].rx_num_channels) {
s->usrp->set_rx_rate(openair0_cfg[0].sample_rate,i); s->usrp->set_rx_rate(openair0_cfg[0].sample_rate,i);
...@@ -399,7 +398,7 @@ extern "C" { ...@@ -399,7 +398,7 @@ extern "C" {
printf("Setting rx freq/gain on channel %lu/%lu\n",i,s->usrp->get_rx_num_channels()); printf("Setting rx freq/gain on channel %lu/%lu\n",i,s->usrp->get_rx_num_channels());
s->usrp->set_rx_freq(openair0_cfg[0].rx_freq[i],i); s->usrp->set_rx_freq(openair0_cfg[0].rx_freq[i],i);
set_rx_gain_offset(&openair0_cfg[0],i); set_rx_gain_offset(&openair0_cfg[0],i);
::uhd::gain_range_t gain_range = s->usrp->get_rx_gain_range(i); ::uhd::gain_range_t gain_range = s->usrp->get_rx_gain_range(i);
// limit to maximum gain // limit to maximum gain
if (openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i] > gain_range.stop()) { if (openair0_cfg[0].rx_gain[i]-openair0_cfg[0].rx_gain_offset[i] > gain_range.stop()) {
...@@ -422,11 +421,11 @@ extern "C" { ...@@ -422,11 +421,11 @@ extern "C" {
s->usrp->set_tx_gain(openair0_cfg[0].tx_gain[i],i); s->usrp->set_tx_gain(openair0_cfg[0].tx_gain[i],i);
} }
} }
// display USRP settings // display USRP settings
std::cout << boost::format("Actual master clock: %fMHz...") % (s->usrp->get_master_clock_rate()/1e6) << std::endl; std::cout << boost::format("Actual master clock: %fMHz...") % (s->usrp->get_master_clock_rate()/1e6) << std::endl;
// create tx & rx streamer // create tx & rx streamer
uhd::stream_args_t stream_args_rx("sc16", "sc16"); 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)); //stream_args_rx.args["spp"] = str(boost::format("%d") % 2048);//(openair0_cfg[0].rx_num_channels*openair0_cfg[0].samples_per_packet));
...@@ -435,21 +434,17 @@ extern "C" { ...@@ -435,21 +434,17 @@ extern "C" {
s->rx_stream = s->usrp->get_rx_stream(stream_args_rx); 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; 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(); //openair0_cfg[0].samples_per_packet = s->rx_stream->get_max_num_samps();
uhd::stream_args_t stream_args_tx("sc16", "sc16"); 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)); //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++) 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); 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; 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)); s->usrp->set_time_now(uhd::time_spec_t(0.0));
for (i=0;i<openair0_cfg[0].rx_num_channels;i++) { for (i=0;i<openair0_cfg[0].rx_num_channels;i++) {
if (i<openair0_cfg[0].rx_num_channels) { if (i<openair0_cfg[0].rx_num_channels) {
printf("RX Channel %lu\n",i); printf("RX Channel %lu\n",i);
...@@ -460,9 +455,8 @@ extern "C" { ...@@ -460,9 +455,8 @@ extern "C" {
std::cout << boost::format("Actual RX antenna: %s...") % (s->usrp->get_rx_antenna(i)) << std::endl; 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++) { for (i=0;i<openair0_cfg[0].tx_num_channels;i++) {
if (i<openair0_cfg[0].tx_num_channels) { if (i<openair0_cfg[0].tx_num_channels) {
printf("TX Channel %lu\n",i); 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; std::cout << std::endl<<boost::format("Actual TX sample rate: %fMSps...") % (s->usrp->get_tx_rate(i)/1e6) << std::endl;
...@@ -472,7 +466,7 @@ extern "C" { ...@@ -472,7 +466,7 @@ extern "C" {
std::cout << boost::format("Actual TX antenna: %s...") % (s->usrp->get_tx_antenna(i)) << std::endl; 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; std::cout << boost::format("Device timestamp: %f...") % (s->usrp->get_time_now().get_real_secs()) << std::endl;
device->priv = s; device->priv = s;
...@@ -492,35 +486,35 @@ extern "C" { ...@@ -492,35 +486,35 @@ extern "C" {
// init tx_forward_nsamps based usrp_time_offset ex // 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; 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; s->tx_forward_nsamps = 90;
if(is_equal(s->sample_rate, (double)7.68e6)) if(is_equal(s->sample_rate, (double)7.68e6))
s->tx_forward_nsamps = 50;*/ s->tx_forward_nsamps = 50;*/
/* move device specific parameters from lte-softmodem.c here */ /* move device specific parameters from lte-softmodem.c here */
if(is_equal(s->sample_rate, (double)30.72e6)) { if(is_equal(s->sample_rate, (double)30.72e6)) {
openair0_cfg->tx_delay = 8; openair0_cfg->tx_delay = 8;
s->tx_forward_nsamps = 175; s->tx_forward_nsamps = 175;
openair0_cfg->tx_forward_nsamps = 175; openair0_cfg->tx_forward_nsamps = 175;
} }
if(is_equal(s->sample_rate, (double)15.36e6)) { if(is_equal(s->sample_rate, (double)15.36e6)) {
openair0_cfg->tx_delay = 5; openair0_cfg->tx_delay = 5;
s->tx_forward_nsamps = 95; s->tx_forward_nsamps = 95;
openair0_cfg->tx_forward_nsamps = 95; openair0_cfg->tx_forward_nsamps = 95;
} }
if(is_equal(s->sample_rate, (double)7.68e6)) { if(is_equal(s->sample_rate, (double)7.68e6)) {
openair0_cfg->tx_delay = 5; openair0_cfg->tx_delay = 5;
s->tx_forward_nsamps = 70; s->tx_forward_nsamps = 70;
openair0_cfg->tx_forward_nsamps = 70; openair0_cfg->tx_forward_nsamps = 70;
} }
if(is_equal(s->sample_rate, (double)1.92e6)) { if(is_equal(s->sample_rate, (double)1.92e6)) {
openair0_cfg->tx_delay = 8; openair0_cfg->tx_delay = 8;
s->tx_forward_nsamps = 40; s->tx_forward_nsamps = 40;
openair0_cfg->tx_forward_nsamps = 40; openair0_cfg->tx_forward_nsamps = 40;
} }
openair0_cfg->iq_txshift= 5; openair0_cfg->iq_txshift= 5;
openair0_cfg->iq_rxrescale = 15; openair0_cfg->iq_rxrescale = 15;
printf("check params %d:%d",openair0_cfg->tx_forward_nsamps, openair0_cfg->tx_delay); printf("check params %d:%d",openair0_cfg->tx_forward_nsamps, openair0_cfg->tx_delay);
return 0; return 0;
}
} }
}
\ No newline at end of file
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