2013-11-16 02:14:33 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2013 Thomas Tsou <tom@tsou.cc>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "Transceiver.h"
|
|
|
|
#include "radioDevice.h"
|
|
|
|
|
|
|
|
#include <time.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
2017-06-29 13:35:22 +00:00
|
|
|
#include <sched.h>
|
Add support to set Rx/TxAntenna
Some devices have different Rx or Tx ports with different RF characteristics.
For instance LimeSDR has H (High), L (Low) and W (Wide) band Rx ports,
each of one being more suitable to a specific range of frequencies.
In case one wants to support several GSM bands, the best option is to
use the WideBand port and connect the antenna physically to that port in
the board. Then the firmware must be instructed ro read from that port.
Support for Rx/Tx port configuration is already in there for all the
layers (Limesuite, SoapySDR, SoapyUHD, UHD), but we are missing the
required bits in osmo-trx to make use of the available UHD API. This
commit addresses it.
Before this patch, the Rx/Tx paths configured could be changed by means
of the LimeSuiteGUI app, but after running osmo-trx, the values were
changed to the default ones.
One can now start using osmo-trx with 1 channel and specific Rx/Tx ports
by using for instance: osmo-trx -c 1 -y BAND1 -z LNAW
Default behaviour if no specific path or an empry path is passed ("") is
to do the same as preiously, ie. nothing by not calling the
set{T,R}xAntenna APIs.
One can also configure only specific channels, for instance to configure
only the first Tx channel and the second Rx channel:
osmo-trx -c 2 -y BAND1, -z ,LNAW
Change-Id: I1735e6ab05a05b0312d6d679b16ebd4a2260fa23
2018-02-05 12:05:06 +00:00
|
|
|
#include <vector>
|
|
|
|
#include <string>
|
|
|
|
#include <sstream>
|
|
|
|
#include <iostream>
|
2013-11-16 02:14:33 +00:00
|
|
|
|
|
|
|
#include <GSMCommon.h>
|
|
|
|
#include <Logger.h>
|
|
|
|
|
2017-03-15 17:09:35 +00:00
|
|
|
extern "C" {
|
|
|
|
#include "convolve.h"
|
|
|
|
#include "convert.h"
|
|
|
|
}
|
|
|
|
|
2013-11-16 02:14:33 +00:00
|
|
|
/* Samples-per-symbol for downlink path
|
|
|
|
* 4 - Uses precision modulator (more computation, less distortion)
|
|
|
|
* 1 - Uses minimized modulator (less computation, more distortion)
|
|
|
|
*
|
|
|
|
* Other values are invalid. Receive path (uplink) is always
|
2016-05-03 22:14:45 +00:00
|
|
|
* downsampled to 1 sps. Default to 4 sps for all cases.
|
2013-11-16 02:14:33 +00:00
|
|
|
*/
|
2016-03-06 09:28:40 +00:00
|
|
|
#define DEFAULT_TX_SPS 4
|
2013-11-16 02:14:33 +00:00
|
|
|
|
2016-03-06 09:28:40 +00:00
|
|
|
/*
|
|
|
|
* Samples-per-symbol for uplink (receiver) path
|
|
|
|
* Do not modify this value. EDGE configures 4 sps automatically on
|
|
|
|
* B200/B210 devices only. Use of 4 sps on the receive path for other
|
|
|
|
* configurations is not supported.
|
|
|
|
*/
|
|
|
|
#define DEFAULT_RX_SPS 1
|
|
|
|
|
2017-03-31 00:00:42 +00:00
|
|
|
/* Default configuration parameters */
|
2013-11-16 02:14:33 +00:00
|
|
|
#define DEFAULT_TRX_PORT 5700
|
|
|
|
#define DEFAULT_TRX_IP "127.0.0.1"
|
|
|
|
#define DEFAULT_CHANS 1
|
|
|
|
|
|
|
|
struct trx_config {
|
|
|
|
std::string log_level;
|
2017-08-16 14:53:23 +00:00
|
|
|
std::string local_addr;
|
|
|
|
std::string remote_addr;
|
2013-11-16 02:14:33 +00:00
|
|
|
std::string dev_args;
|
|
|
|
unsigned port;
|
2016-03-06 09:28:40 +00:00
|
|
|
unsigned tx_sps;
|
|
|
|
unsigned rx_sps;
|
2013-11-16 02:14:33 +00:00
|
|
|
unsigned chans;
|
2015-05-20 01:26:31 +00:00
|
|
|
unsigned rtsc;
|
2016-03-25 15:28:34 +00:00
|
|
|
unsigned rach_delay;
|
2013-11-16 02:14:33 +00:00
|
|
|
bool extref;
|
2016-07-18 02:29:08 +00:00
|
|
|
bool gpsref;
|
2015-05-24 22:56:51 +00:00
|
|
|
Transceiver::FillerType filler;
|
2016-06-24 21:25:39 +00:00
|
|
|
bool mcbts;
|
2014-03-06 19:16:11 +00:00
|
|
|
double offset;
|
2015-06-04 03:47:56 +00:00
|
|
|
double rssi_offset;
|
2015-06-07 05:07:45 +00:00
|
|
|
bool swap_channels;
|
2016-03-06 11:44:34 +00:00
|
|
|
bool edge;
|
2017-06-29 13:35:22 +00:00
|
|
|
int sched_rr;
|
Add support to set Rx/TxAntenna
Some devices have different Rx or Tx ports with different RF characteristics.
For instance LimeSDR has H (High), L (Low) and W (Wide) band Rx ports,
each of one being more suitable to a specific range of frequencies.
In case one wants to support several GSM bands, the best option is to
use the WideBand port and connect the antenna physically to that port in
the board. Then the firmware must be instructed ro read from that port.
Support for Rx/Tx port configuration is already in there for all the
layers (Limesuite, SoapySDR, SoapyUHD, UHD), but we are missing the
required bits in osmo-trx to make use of the available UHD API. This
commit addresses it.
Before this patch, the Rx/Tx paths configured could be changed by means
of the LimeSuiteGUI app, but after running osmo-trx, the values were
changed to the default ones.
One can now start using osmo-trx with 1 channel and specific Rx/Tx ports
by using for instance: osmo-trx -c 1 -y BAND1 -z LNAW
Default behaviour if no specific path or an empry path is passed ("") is
to do the same as preiously, ie. nothing by not calling the
set{T,R}xAntenna APIs.
One can also configure only specific channels, for instance to configure
only the first Tx channel and the second Rx channel:
osmo-trx -c 2 -y BAND1, -z ,LNAW
Change-Id: I1735e6ab05a05b0312d6d679b16ebd4a2260fa23
2018-02-05 12:05:06 +00:00
|
|
|
std::vector<std::string> rx_paths;
|
|
|
|
std::vector<std::string> tx_paths;
|
2013-11-16 02:14:33 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
volatile bool gshutdown = false;
|
|
|
|
|
|
|
|
/* Setup configuration values
|
|
|
|
* Don't query the existence of the Log.Level because it's a
|
|
|
|
* mandatory value. That is, if it doesn't exist, the configuration
|
2013-11-17 23:54:52 +00:00
|
|
|
* table will crash or will have already crashed. Everything else we
|
|
|
|
* can survive without and use default values if the database entries
|
2013-11-16 02:14:33 +00:00
|
|
|
* are empty.
|
|
|
|
*/
|
|
|
|
bool trx_setup_config(struct trx_config *config)
|
|
|
|
{
|
2016-06-24 21:25:39 +00:00
|
|
|
std::string refstr, fillstr, divstr, mcstr, edgestr;
|
Add support to set Rx/TxAntenna
Some devices have different Rx or Tx ports with different RF characteristics.
For instance LimeSDR has H (High), L (Low) and W (Wide) band Rx ports,
each of one being more suitable to a specific range of frequencies.
In case one wants to support several GSM bands, the best option is to
use the WideBand port and connect the antenna physically to that port in
the board. Then the firmware must be instructed ro read from that port.
Support for Rx/Tx port configuration is already in there for all the
layers (Limesuite, SoapySDR, SoapyUHD, UHD), but we are missing the
required bits in osmo-trx to make use of the available UHD API. This
commit addresses it.
Before this patch, the Rx/Tx paths configured could be changed by means
of the LimeSuiteGUI app, but after running osmo-trx, the values were
changed to the default ones.
One can now start using osmo-trx with 1 channel and specific Rx/Tx ports
by using for instance: osmo-trx -c 1 -y BAND1 -z LNAW
Default behaviour if no specific path or an empry path is passed ("") is
to do the same as preiously, ie. nothing by not calling the
set{T,R}xAntenna APIs.
One can also configure only specific channels, for instance to configure
only the first Tx channel and the second Rx channel:
osmo-trx -c 2 -y BAND1, -z ,LNAW
Change-Id: I1735e6ab05a05b0312d6d679b16ebd4a2260fa23
2018-02-05 12:05:06 +00:00
|
|
|
std::vector<std::string>::const_iterator si;
|
2013-11-16 02:14:33 +00:00
|
|
|
|
2017-03-31 02:36:41 +00:00
|
|
|
if (config->mcbts && config->chans > 5) {
|
2016-06-24 21:25:39 +00:00
|
|
|
std::cout << "Unsupported number of channels" << std::endl;
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2016-03-06 11:44:34 +00:00
|
|
|
edgestr = config->edge ? "Enabled" : "Disabled";
|
2016-06-24 21:25:39 +00:00
|
|
|
mcstr = config->mcbts ? "Enabled" : "Disabled";
|
|
|
|
|
2016-07-18 02:29:08 +00:00
|
|
|
if (config->extref)
|
|
|
|
refstr = "External";
|
|
|
|
else if (config->gpsref)
|
|
|
|
refstr = "GPS";
|
|
|
|
else
|
|
|
|
refstr = "Internal";
|
|
|
|
|
2015-05-24 22:56:51 +00:00
|
|
|
switch (config->filler) {
|
|
|
|
case Transceiver::FILLER_DUMMY:
|
|
|
|
fillstr = "Dummy bursts";
|
|
|
|
break;
|
|
|
|
case Transceiver::FILLER_ZERO:
|
|
|
|
fillstr = "Disabled";
|
|
|
|
break;
|
2016-03-07 06:19:15 +00:00
|
|
|
case Transceiver::FILLER_NORM_RAND:
|
2015-05-24 22:56:51 +00:00
|
|
|
fillstr = "Normal busrts with random payload";
|
|
|
|
break;
|
2016-03-07 06:19:15 +00:00
|
|
|
case Transceiver::FILLER_EDGE_RAND:
|
|
|
|
fillstr = "EDGE busrts with random payload";
|
|
|
|
break;
|
2016-03-23 14:06:32 +00:00
|
|
|
case Transceiver::FILLER_ACCESS_RAND:
|
|
|
|
fillstr = "Access busrts with random payload";
|
|
|
|
break;
|
2015-05-24 22:56:51 +00:00
|
|
|
}
|
2013-11-16 02:14:33 +00:00
|
|
|
|
|
|
|
std::ostringstream ost("");
|
|
|
|
ost << "Config Settings" << std::endl;
|
|
|
|
ost << " Log Level............... " << config->log_level << std::endl;
|
|
|
|
ost << " Device args............. " << config->dev_args << std::endl;
|
|
|
|
ost << " TRX Base Port........... " << config->port << std::endl;
|
2017-08-16 14:53:23 +00:00
|
|
|
ost << " TRX Address............. " << config->local_addr << std::endl;
|
|
|
|
ost << " GSM Core Address........." << config->remote_addr << std::endl;
|
2013-11-16 02:14:33 +00:00
|
|
|
ost << " Channels................ " << config->chans << std::endl;
|
2016-03-06 09:28:40 +00:00
|
|
|
ost << " Tx Samples-per-Symbol... " << config->tx_sps << std::endl;
|
2016-04-20 05:44:55 +00:00
|
|
|
ost << " Rx Samples-per-Symbol... " << config->rx_sps << std::endl;
|
2016-03-06 11:44:34 +00:00
|
|
|
ost << " EDGE support............ " << edgestr << std::endl;
|
2016-07-18 02:29:08 +00:00
|
|
|
ost << " Reference............... " << refstr << std::endl;
|
2014-01-25 07:34:03 +00:00
|
|
|
ost << " C0 Filler Table......... " << fillstr << std::endl;
|
2016-06-24 21:25:39 +00:00
|
|
|
ost << " Multi-Carrier........... " << mcstr << std::endl;
|
2014-03-06 19:16:11 +00:00
|
|
|
ost << " Tuning offset........... " << config->offset << std::endl;
|
2015-06-04 03:47:56 +00:00
|
|
|
ost << " RSSI to dBm offset...... " << config->rssi_offset << std::endl;
|
2015-06-07 05:07:45 +00:00
|
|
|
ost << " Swap channels........... " << config->swap_channels << std::endl;
|
Add support to set Rx/TxAntenna
Some devices have different Rx or Tx ports with different RF characteristics.
For instance LimeSDR has H (High), L (Low) and W (Wide) band Rx ports,
each of one being more suitable to a specific range of frequencies.
In case one wants to support several GSM bands, the best option is to
use the WideBand port and connect the antenna physically to that port in
the board. Then the firmware must be instructed ro read from that port.
Support for Rx/Tx port configuration is already in there for all the
layers (Limesuite, SoapySDR, SoapyUHD, UHD), but we are missing the
required bits in osmo-trx to make use of the available UHD API. This
commit addresses it.
Before this patch, the Rx/Tx paths configured could be changed by means
of the LimeSuiteGUI app, but after running osmo-trx, the values were
changed to the default ones.
One can now start using osmo-trx with 1 channel and specific Rx/Tx ports
by using for instance: osmo-trx -c 1 -y BAND1 -z LNAW
Default behaviour if no specific path or an empry path is passed ("") is
to do the same as preiously, ie. nothing by not calling the
set{T,R}xAntenna APIs.
One can also configure only specific channels, for instance to configure
only the first Tx channel and the second Rx channel:
osmo-trx -c 2 -y BAND1, -z ,LNAW
Change-Id: I1735e6ab05a05b0312d6d679b16ebd4a2260fa23
2018-02-05 12:05:06 +00:00
|
|
|
ost << " Tx Antennas.............";
|
|
|
|
for (si = config->tx_paths.begin(); si != config->tx_paths.end(); ++si)
|
|
|
|
ost << " '" << ((*si != "") ? *si : "<default>") << "'";
|
|
|
|
ost << std::endl;
|
|
|
|
ost << " Rx Antennas.............";
|
|
|
|
for (si = config->rx_paths.begin(); si != config->rx_paths.end(); ++si)
|
|
|
|
ost << " '" << ((*si != "") ? *si : "<default>") << "'";
|
|
|
|
ost << std::endl;
|
2013-11-16 02:14:33 +00:00
|
|
|
|
Add support to set Rx/TxAntenna
Some devices have different Rx or Tx ports with different RF characteristics.
For instance LimeSDR has H (High), L (Low) and W (Wide) band Rx ports,
each of one being more suitable to a specific range of frequencies.
In case one wants to support several GSM bands, the best option is to
use the WideBand port and connect the antenna physically to that port in
the board. Then the firmware must be instructed ro read from that port.
Support for Rx/Tx port configuration is already in there for all the
layers (Limesuite, SoapySDR, SoapyUHD, UHD), but we are missing the
required bits in osmo-trx to make use of the available UHD API. This
commit addresses it.
Before this patch, the Rx/Tx paths configured could be changed by means
of the LimeSuiteGUI app, but after running osmo-trx, the values were
changed to the default ones.
One can now start using osmo-trx with 1 channel and specific Rx/Tx ports
by using for instance: osmo-trx -c 1 -y BAND1 -z LNAW
Default behaviour if no specific path or an empry path is passed ("") is
to do the same as preiously, ie. nothing by not calling the
set{T,R}xAntenna APIs.
One can also configure only specific channels, for instance to configure
only the first Tx channel and the second Rx channel:
osmo-trx -c 2 -y BAND1, -z ,LNAW
Change-Id: I1735e6ab05a05b0312d6d679b16ebd4a2260fa23
2018-02-05 12:05:06 +00:00
|
|
|
std::cout << ost << std::endl;
|
2013-11-16 02:14:33 +00:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Create radio interface
|
|
|
|
* The interface consists of sample rate changes, frequency shifts,
|
|
|
|
* channel multiplexing, and other conversions. The transceiver core
|
|
|
|
* accepts input vectors sampled at multiples of the GSM symbol rate.
|
|
|
|
* The radio interface connects the main transceiver with the device
|
|
|
|
* object, which may be operating some other rate.
|
|
|
|
*/
|
|
|
|
RadioInterface *makeRadioInterface(struct trx_config *config,
|
|
|
|
RadioDevice *usrp, int type)
|
|
|
|
{
|
|
|
|
RadioInterface *radio = NULL;
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case RadioDevice::NORMAL:
|
2016-03-06 09:28:40 +00:00
|
|
|
radio = new RadioInterface(usrp, config->tx_sps,
|
|
|
|
config->rx_sps, config->chans);
|
2013-11-16 02:14:33 +00:00
|
|
|
break;
|
|
|
|
case RadioDevice::RESAMP_64M:
|
|
|
|
case RadioDevice::RESAMP_100M:
|
2016-03-06 09:28:40 +00:00
|
|
|
radio = new RadioInterfaceResamp(usrp, config->tx_sps,
|
2016-07-20 23:35:03 +00:00
|
|
|
config->rx_sps);
|
2013-11-16 02:14:33 +00:00
|
|
|
break;
|
2016-06-24 21:25:39 +00:00
|
|
|
case RadioDevice::MULTI_ARFCN:
|
|
|
|
radio = new RadioInterfaceMulti(usrp, config->tx_sps,
|
|
|
|
config->rx_sps, config->chans);
|
|
|
|
break;
|
2013-11-16 02:14:33 +00:00
|
|
|
default:
|
|
|
|
LOG(ALERT) << "Unsupported radio interface configuration";
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!radio->init(type)) {
|
|
|
|
LOG(ALERT) << "Failed to initialize radio interface";
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return radio;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Create transceiver core
|
|
|
|
* The multi-threaded modem core operates at multiples of the GSM rate of
|
|
|
|
* 270.8333 ksps and consists of GSM specific modulation, demodulation,
|
|
|
|
* and decoding schemes. Also included are the socket interfaces for
|
|
|
|
* connecting to the upper layer stack.
|
|
|
|
*/
|
|
|
|
Transceiver *makeTransceiver(struct trx_config *config, RadioInterface *radio)
|
|
|
|
{
|
|
|
|
Transceiver *trx;
|
|
|
|
VectorFIFO *fifo;
|
|
|
|
|
2017-08-16 14:53:23 +00:00
|
|
|
trx = new Transceiver(config->port, config->local_addr.c_str(),
|
|
|
|
config->remote_addr.c_str(), config->tx_sps,
|
|
|
|
config->rx_sps, config->chans, GSM::Time(3,0),
|
|
|
|
radio, config->rssi_offset);
|
2016-07-01 10:46:46 +00:00
|
|
|
if (!trx->init(config->filler, config->rtsc,
|
|
|
|
config->rach_delay, config->edge)) {
|
2013-11-16 02:14:33 +00:00
|
|
|
LOG(ALERT) << "Failed to initialize transceiver";
|
|
|
|
delete trx;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (size_t i = 0; i < config->chans; i++) {
|
|
|
|
fifo = radio->receiveFIFO(i);
|
|
|
|
if (fifo && trx->receiveFIFO(fifo, i))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
LOG(ALERT) << "Could not attach FIFO to channel " << i;
|
|
|
|
delete trx;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return trx;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void sig_handler(int signo)
|
|
|
|
{
|
|
|
|
fprintf(stdout, "Received shutdown signal");
|
|
|
|
gshutdown = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void setup_signal_handlers()
|
|
|
|
{
|
|
|
|
if (signal(SIGINT, sig_handler) == SIG_ERR) {
|
|
|
|
fprintf(stderr, "Failed to install SIGINT signal handler\n");
|
|
|
|
exit(EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
if (signal(SIGTERM, sig_handler) == SIG_ERR) {
|
|
|
|
fprintf(stderr, "Couldn't install SIGTERM signal handler\n");
|
|
|
|
exit( EXIT_FAILURE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Add support to set Rx/TxAntenna
Some devices have different Rx or Tx ports with different RF characteristics.
For instance LimeSDR has H (High), L (Low) and W (Wide) band Rx ports,
each of one being more suitable to a specific range of frequencies.
In case one wants to support several GSM bands, the best option is to
use the WideBand port and connect the antenna physically to that port in
the board. Then the firmware must be instructed ro read from that port.
Support for Rx/Tx port configuration is already in there for all the
layers (Limesuite, SoapySDR, SoapyUHD, UHD), but we are missing the
required bits in osmo-trx to make use of the available UHD API. This
commit addresses it.
Before this patch, the Rx/Tx paths configured could be changed by means
of the LimeSuiteGUI app, but after running osmo-trx, the values were
changed to the default ones.
One can now start using osmo-trx with 1 channel and specific Rx/Tx ports
by using for instance: osmo-trx -c 1 -y BAND1 -z LNAW
Default behaviour if no specific path or an empry path is passed ("") is
to do the same as preiously, ie. nothing by not calling the
set{T,R}xAntenna APIs.
One can also configure only specific channels, for instance to configure
only the first Tx channel and the second Rx channel:
osmo-trx -c 2 -y BAND1, -z ,LNAW
Change-Id: I1735e6ab05a05b0312d6d679b16ebd4a2260fa23
2018-02-05 12:05:06 +00:00
|
|
|
|
|
|
|
static std::vector<std::string> comma_delimited_to_vector(char* opt) {
|
|
|
|
std::string str = std::string(opt);
|
|
|
|
std::vector<std::string> result;
|
|
|
|
std::stringstream ss(str);
|
|
|
|
|
|
|
|
while( ss.good() )
|
|
|
|
{
|
|
|
|
std::string substr;
|
|
|
|
getline(ss, substr, ',');
|
|
|
|
result.push_back(substr);
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2013-11-16 02:14:33 +00:00
|
|
|
static void print_help()
|
|
|
|
{
|
|
|
|
fprintf(stdout, "Options:\n"
|
|
|
|
" -h This text\n"
|
|
|
|
" -a UHD device args\n"
|
|
|
|
" -l Logging level (%s)\n"
|
|
|
|
" -i IP address of GSM core\n"
|
2017-08-16 14:53:23 +00:00
|
|
|
" -j IP address of osmo-trx\n"
|
2013-11-16 02:14:33 +00:00
|
|
|
" -p Base port number\n"
|
2016-03-06 11:44:34 +00:00
|
|
|
" -e Enable EDGE receiver\n"
|
2016-06-24 21:25:39 +00:00
|
|
|
" -m Enable multi-ARFCN transceiver (default=disabled)\n"
|
2013-11-16 02:14:33 +00:00
|
|
|
" -x Enable external 10 MHz reference\n"
|
2016-07-18 02:29:08 +00:00
|
|
|
" -g Enable GPSDO reference\n"
|
2016-06-27 22:39:16 +00:00
|
|
|
" -s Tx samples-per-symbol (1 or 4)\n"
|
|
|
|
" -b Rx samples-per-symbol (1 or 4)\n"
|
2014-01-25 07:34:03 +00:00
|
|
|
" -c Number of ARFCN channels (default=1)\n"
|
2014-03-06 19:16:11 +00:00
|
|
|
" -f Enable C0 filler table\n"
|
2015-05-20 01:26:31 +00:00
|
|
|
" -o Set baseband frequency offset (default=auto)\n"
|
2016-03-25 15:28:34 +00:00
|
|
|
" -r Random Normal Burst test mode with TSC\n"
|
|
|
|
" -A Random Access Burst test mode with delay\n"
|
2015-06-07 05:07:45 +00:00
|
|
|
" -R RSSI to dBm offset in dB (default=0)\n"
|
2017-06-29 13:35:22 +00:00
|
|
|
" -S Swap channels (UmTRX only)\n"
|
Add support to set Rx/TxAntenna
Some devices have different Rx or Tx ports with different RF characteristics.
For instance LimeSDR has H (High), L (Low) and W (Wide) band Rx ports,
each of one being more suitable to a specific range of frequencies.
In case one wants to support several GSM bands, the best option is to
use the WideBand port and connect the antenna physically to that port in
the board. Then the firmware must be instructed ro read from that port.
Support for Rx/Tx port configuration is already in there for all the
layers (Limesuite, SoapySDR, SoapyUHD, UHD), but we are missing the
required bits in osmo-trx to make use of the available UHD API. This
commit addresses it.
Before this patch, the Rx/Tx paths configured could be changed by means
of the LimeSuiteGUI app, but after running osmo-trx, the values were
changed to the default ones.
One can now start using osmo-trx with 1 channel and specific Rx/Tx ports
by using for instance: osmo-trx -c 1 -y BAND1 -z LNAW
Default behaviour if no specific path or an empry path is passed ("") is
to do the same as preiously, ie. nothing by not calling the
set{T,R}xAntenna APIs.
One can also configure only specific channels, for instance to configure
only the first Tx channel and the second Rx channel:
osmo-trx -c 2 -y BAND1, -z ,LNAW
Change-Id: I1735e6ab05a05b0312d6d679b16ebd4a2260fa23
2018-02-05 12:05:06 +00:00
|
|
|
" -t SCHED_RR real-time priority (1..32)\n"
|
|
|
|
" -y comma-delimited list of Tx paths (num elements matches -c)\n"
|
|
|
|
" -z comma-delimited list of Rx paths (num elements matches -c)\n",
|
2013-11-16 02:14:33 +00:00
|
|
|
"EMERG, ALERT, CRT, ERR, WARNING, NOTICE, INFO, DEBUG");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void handle_options(int argc, char **argv, struct trx_config *config)
|
|
|
|
{
|
|
|
|
int option;
|
Add support to set Rx/TxAntenna
Some devices have different Rx or Tx ports with different RF characteristics.
For instance LimeSDR has H (High), L (Low) and W (Wide) band Rx ports,
each of one being more suitable to a specific range of frequencies.
In case one wants to support several GSM bands, the best option is to
use the WideBand port and connect the antenna physically to that port in
the board. Then the firmware must be instructed ro read from that port.
Support for Rx/Tx port configuration is already in there for all the
layers (Limesuite, SoapySDR, SoapyUHD, UHD), but we are missing the
required bits in osmo-trx to make use of the available UHD API. This
commit addresses it.
Before this patch, the Rx/Tx paths configured could be changed by means
of the LimeSuiteGUI app, but after running osmo-trx, the values were
changed to the default ones.
One can now start using osmo-trx with 1 channel and specific Rx/Tx ports
by using for instance: osmo-trx -c 1 -y BAND1 -z LNAW
Default behaviour if no specific path or an empry path is passed ("") is
to do the same as preiously, ie. nothing by not calling the
set{T,R}xAntenna APIs.
One can also configure only specific channels, for instance to configure
only the first Tx channel and the second Rx channel:
osmo-trx -c 2 -y BAND1, -z ,LNAW
Change-Id: I1735e6ab05a05b0312d6d679b16ebd4a2260fa23
2018-02-05 12:05:06 +00:00
|
|
|
bool tx_path_set = false, rx_path_set = false;
|
2013-11-16 02:14:33 +00:00
|
|
|
|
2017-03-31 00:00:42 +00:00
|
|
|
config->log_level = "NOTICE";
|
2017-08-16 14:53:23 +00:00
|
|
|
config->local_addr = DEFAULT_TRX_IP;
|
|
|
|
config->remote_addr = DEFAULT_TRX_IP;
|
2017-03-31 00:00:42 +00:00
|
|
|
config->port = DEFAULT_TRX_PORT;
|
2016-03-06 09:28:40 +00:00
|
|
|
config->tx_sps = DEFAULT_TX_SPS;
|
|
|
|
config->rx_sps = DEFAULT_RX_SPS;
|
2015-05-20 01:26:31 +00:00
|
|
|
config->chans = DEFAULT_CHANS;
|
|
|
|
config->rtsc = 0;
|
2016-03-25 15:28:34 +00:00
|
|
|
config->rach_delay = 0;
|
2013-11-16 02:14:33 +00:00
|
|
|
config->extref = false;
|
2016-07-18 02:29:08 +00:00
|
|
|
config->gpsref = false;
|
2015-05-20 01:26:31 +00:00
|
|
|
config->filler = Transceiver::FILLER_ZERO;
|
2016-06-24 21:25:39 +00:00
|
|
|
config->mcbts = false;
|
2014-03-06 19:16:11 +00:00
|
|
|
config->offset = 0.0;
|
2015-06-04 03:47:56 +00:00
|
|
|
config->rssi_offset = 0.0;
|
2015-06-07 05:07:45 +00:00
|
|
|
config->swap_channels = false;
|
2016-03-06 11:44:34 +00:00
|
|
|
config->edge = false;
|
2017-06-29 13:35:22 +00:00
|
|
|
config->sched_rr = -1;
|
Add support to set Rx/TxAntenna
Some devices have different Rx or Tx ports with different RF characteristics.
For instance LimeSDR has H (High), L (Low) and W (Wide) band Rx ports,
each of one being more suitable to a specific range of frequencies.
In case one wants to support several GSM bands, the best option is to
use the WideBand port and connect the antenna physically to that port in
the board. Then the firmware must be instructed ro read from that port.
Support for Rx/Tx port configuration is already in there for all the
layers (Limesuite, SoapySDR, SoapyUHD, UHD), but we are missing the
required bits in osmo-trx to make use of the available UHD API. This
commit addresses it.
Before this patch, the Rx/Tx paths configured could be changed by means
of the LimeSuiteGUI app, but after running osmo-trx, the values were
changed to the default ones.
One can now start using osmo-trx with 1 channel and specific Rx/Tx ports
by using for instance: osmo-trx -c 1 -y BAND1 -z LNAW
Default behaviour if no specific path or an empry path is passed ("") is
to do the same as preiously, ie. nothing by not calling the
set{T,R}xAntenna APIs.
One can also configure only specific channels, for instance to configure
only the first Tx channel and the second Rx channel:
osmo-trx -c 2 -y BAND1, -z ,LNAW
Change-Id: I1735e6ab05a05b0312d6d679b16ebd4a2260fa23
2018-02-05 12:05:06 +00:00
|
|
|
config->tx_paths = std::vector<std::string>(DEFAULT_CHANS, "");
|
|
|
|
config->rx_paths = std::vector<std::string>(DEFAULT_CHANS, "");
|
2013-11-16 02:14:33 +00:00
|
|
|
|
Add support to set Rx/TxAntenna
Some devices have different Rx or Tx ports with different RF characteristics.
For instance LimeSDR has H (High), L (Low) and W (Wide) band Rx ports,
each of one being more suitable to a specific range of frequencies.
In case one wants to support several GSM bands, the best option is to
use the WideBand port and connect the antenna physically to that port in
the board. Then the firmware must be instructed ro read from that port.
Support for Rx/Tx port configuration is already in there for all the
layers (Limesuite, SoapySDR, SoapyUHD, UHD), but we are missing the
required bits in osmo-trx to make use of the available UHD API. This
commit addresses it.
Before this patch, the Rx/Tx paths configured could be changed by means
of the LimeSuiteGUI app, but after running osmo-trx, the values were
changed to the default ones.
One can now start using osmo-trx with 1 channel and specific Rx/Tx ports
by using for instance: osmo-trx -c 1 -y BAND1 -z LNAW
Default behaviour if no specific path or an empry path is passed ("") is
to do the same as preiously, ie. nothing by not calling the
set{T,R}xAntenna APIs.
One can also configure only specific channels, for instance to configure
only the first Tx channel and the second Rx channel:
osmo-trx -c 2 -y BAND1, -z ,LNAW
Change-Id: I1735e6ab05a05b0312d6d679b16ebd4a2260fa23
2018-02-05 12:05:06 +00:00
|
|
|
while ((option = getopt(argc, argv, "ha:l:i:j:p:c:dmxgfo:s:b:r:A:R:Set:y:z:")) != -1) {
|
2013-11-16 02:14:33 +00:00
|
|
|
switch (option) {
|
|
|
|
case 'h':
|
|
|
|
print_help();
|
|
|
|
exit(0);
|
|
|
|
break;
|
|
|
|
case 'a':
|
|
|
|
config->dev_args = optarg;
|
|
|
|
break;
|
|
|
|
case 'l':
|
|
|
|
config->log_level = optarg;
|
|
|
|
break;
|
|
|
|
case 'i':
|
2017-08-16 14:53:23 +00:00
|
|
|
config->remote_addr = optarg;
|
|
|
|
break;
|
|
|
|
case 'j':
|
|
|
|
config->local_addr = optarg;
|
2013-11-16 02:14:33 +00:00
|
|
|
break;
|
|
|
|
case 'p':
|
|
|
|
config->port = atoi(optarg);
|
|
|
|
break;
|
|
|
|
case 'c':
|
|
|
|
config->chans = atoi(optarg);
|
|
|
|
break;
|
2016-06-24 21:25:39 +00:00
|
|
|
case 'm':
|
|
|
|
config->mcbts = true;
|
|
|
|
break;
|
2013-11-16 02:14:33 +00:00
|
|
|
case 'x':
|
|
|
|
config->extref = true;
|
|
|
|
break;
|
2016-07-18 02:29:08 +00:00
|
|
|
case 'g':
|
|
|
|
config->gpsref = true;
|
|
|
|
break;
|
2014-01-25 07:34:03 +00:00
|
|
|
case 'f':
|
2015-05-20 01:26:31 +00:00
|
|
|
config->filler = Transceiver::FILLER_DUMMY;
|
2014-01-25 07:34:03 +00:00
|
|
|
break;
|
2014-03-06 19:16:11 +00:00
|
|
|
case 'o':
|
|
|
|
config->offset = atof(optarg);
|
|
|
|
break;
|
2013-11-16 02:14:33 +00:00
|
|
|
case 's':
|
2016-03-06 09:28:40 +00:00
|
|
|
config->tx_sps = atoi(optarg);
|
2015-05-20 01:26:31 +00:00
|
|
|
break;
|
2016-06-27 22:39:16 +00:00
|
|
|
case 'b':
|
|
|
|
config->rx_sps = atoi(optarg);
|
|
|
|
break;
|
2015-05-20 01:26:31 +00:00
|
|
|
case 'r':
|
|
|
|
config->rtsc = atoi(optarg);
|
2016-03-07 06:19:15 +00:00
|
|
|
config->filler = Transceiver::FILLER_NORM_RAND;
|
2013-11-16 02:14:33 +00:00
|
|
|
break;
|
2016-03-23 14:06:32 +00:00
|
|
|
case 'A':
|
2016-03-25 15:28:34 +00:00
|
|
|
config->rach_delay = atoi(optarg);
|
2016-03-23 14:06:32 +00:00
|
|
|
config->filler = Transceiver::FILLER_ACCESS_RAND;
|
|
|
|
break;
|
2015-06-04 03:47:56 +00:00
|
|
|
case 'R':
|
|
|
|
config->rssi_offset = atof(optarg);
|
|
|
|
break;
|
2015-06-07 05:07:45 +00:00
|
|
|
case 'S':
|
|
|
|
config->swap_channels = true;
|
|
|
|
break;
|
2016-03-06 11:44:34 +00:00
|
|
|
case 'e':
|
|
|
|
config->edge = true;
|
|
|
|
break;
|
2017-06-29 13:35:22 +00:00
|
|
|
case 't':
|
|
|
|
config->sched_rr = atoi(optarg);
|
|
|
|
break;
|
Add support to set Rx/TxAntenna
Some devices have different Rx or Tx ports with different RF characteristics.
For instance LimeSDR has H (High), L (Low) and W (Wide) band Rx ports,
each of one being more suitable to a specific range of frequencies.
In case one wants to support several GSM bands, the best option is to
use the WideBand port and connect the antenna physically to that port in
the board. Then the firmware must be instructed ro read from that port.
Support for Rx/Tx port configuration is already in there for all the
layers (Limesuite, SoapySDR, SoapyUHD, UHD), but we are missing the
required bits in osmo-trx to make use of the available UHD API. This
commit addresses it.
Before this patch, the Rx/Tx paths configured could be changed by means
of the LimeSuiteGUI app, but after running osmo-trx, the values were
changed to the default ones.
One can now start using osmo-trx with 1 channel and specific Rx/Tx ports
by using for instance: osmo-trx -c 1 -y BAND1 -z LNAW
Default behaviour if no specific path or an empry path is passed ("") is
to do the same as preiously, ie. nothing by not calling the
set{T,R}xAntenna APIs.
One can also configure only specific channels, for instance to configure
only the first Tx channel and the second Rx channel:
osmo-trx -c 2 -y BAND1, -z ,LNAW
Change-Id: I1735e6ab05a05b0312d6d679b16ebd4a2260fa23
2018-02-05 12:05:06 +00:00
|
|
|
case 'y':
|
|
|
|
config->tx_paths = comma_delimited_to_vector(optarg);
|
|
|
|
tx_path_set = true;
|
|
|
|
break;
|
|
|
|
case 'z':
|
|
|
|
config->rx_paths = comma_delimited_to_vector(optarg);
|
|
|
|
rx_path_set = true;
|
|
|
|
break;
|
2013-11-16 02:14:33 +00:00
|
|
|
default:
|
|
|
|
print_help();
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
}
|
2015-05-20 01:26:31 +00:00
|
|
|
|
2016-06-24 21:25:39 +00:00
|
|
|
/* Force 4 SPS for EDGE or multi-ARFCN configurations */
|
|
|
|
if ((config->edge) || (config->mcbts)) {
|
2016-06-27 22:39:16 +00:00
|
|
|
config->tx_sps = 4;
|
|
|
|
config->rx_sps = 4;
|
|
|
|
}
|
|
|
|
|
2016-07-20 23:35:03 +00:00
|
|
|
if (config->gpsref && config->extref) {
|
|
|
|
printf("External and GPSDO references unavailable at the same time\n\n");
|
|
|
|
goto bad_config;
|
|
|
|
}
|
|
|
|
|
2016-03-07 06:19:15 +00:00
|
|
|
if (config->edge && (config->filler == Transceiver::FILLER_NORM_RAND))
|
|
|
|
config->filler = Transceiver::FILLER_EDGE_RAND;
|
|
|
|
|
2016-06-24 21:25:39 +00:00
|
|
|
if ((config->tx_sps != 1) && (config->tx_sps != 4) &&
|
|
|
|
(config->rx_sps != 1) && (config->rx_sps != 4)) {
|
2016-03-06 09:28:40 +00:00
|
|
|
printf("Unsupported samples-per-symbol %i\n\n", config->tx_sps);
|
2016-07-20 23:35:03 +00:00
|
|
|
goto bad_config;
|
2015-05-20 01:26:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (config->rtsc > 7) {
|
|
|
|
printf("Invalid training sequence %i\n\n", config->rtsc);
|
2016-07-20 23:35:03 +00:00
|
|
|
goto bad_config;
|
2015-05-20 01:26:31 +00:00
|
|
|
}
|
2016-03-25 15:28:34 +00:00
|
|
|
|
|
|
|
if (config->rach_delay > 68) {
|
|
|
|
printf("RACH delay is too big %i\n\n", config->rach_delay);
|
2016-07-20 23:35:03 +00:00
|
|
|
goto bad_config;
|
2016-03-25 15:28:34 +00:00
|
|
|
}
|
2016-07-20 23:35:03 +00:00
|
|
|
|
Add support to set Rx/TxAntenna
Some devices have different Rx or Tx ports with different RF characteristics.
For instance LimeSDR has H (High), L (Low) and W (Wide) band Rx ports,
each of one being more suitable to a specific range of frequencies.
In case one wants to support several GSM bands, the best option is to
use the WideBand port and connect the antenna physically to that port in
the board. Then the firmware must be instructed ro read from that port.
Support for Rx/Tx port configuration is already in there for all the
layers (Limesuite, SoapySDR, SoapyUHD, UHD), but we are missing the
required bits in osmo-trx to make use of the available UHD API. This
commit addresses it.
Before this patch, the Rx/Tx paths configured could be changed by means
of the LimeSuiteGUI app, but after running osmo-trx, the values were
changed to the default ones.
One can now start using osmo-trx with 1 channel and specific Rx/Tx ports
by using for instance: osmo-trx -c 1 -y BAND1 -z LNAW
Default behaviour if no specific path or an empry path is passed ("") is
to do the same as preiously, ie. nothing by not calling the
set{T,R}xAntenna APIs.
One can also configure only specific channels, for instance to configure
only the first Tx channel and the second Rx channel:
osmo-trx -c 2 -y BAND1, -z ,LNAW
Change-Id: I1735e6ab05a05b0312d6d679b16ebd4a2260fa23
2018-02-05 12:05:06 +00:00
|
|
|
if (!tx_path_set) {
|
|
|
|
config->tx_paths = std::vector<std::string>(config->chans, "");
|
|
|
|
} else if (config->tx_paths.size() != config->chans) {
|
|
|
|
printf("Num of channels and num of Tx Antennas doesn't match\n\n");
|
|
|
|
goto bad_config;
|
|
|
|
}
|
|
|
|
if (!rx_path_set) {
|
|
|
|
config->rx_paths = std::vector<std::string>(config->chans, "");
|
|
|
|
} else if (config->rx_paths.size() != config->chans) {
|
|
|
|
printf("Num of channels and num of Rx Antennas doesn't match\n\n");
|
|
|
|
goto bad_config;
|
|
|
|
}
|
|
|
|
|
2016-07-20 23:35:03 +00:00
|
|
|
return;
|
|
|
|
|
|
|
|
bad_config:
|
|
|
|
print_help();
|
|
|
|
exit(0);
|
2013-11-16 02:14:33 +00:00
|
|
|
}
|
|
|
|
|
2017-06-29 13:35:22 +00:00
|
|
|
static int set_sched_rr(int prio)
|
|
|
|
{
|
|
|
|
struct sched_param param;
|
|
|
|
int rc;
|
|
|
|
memset(¶m, 0, sizeof(param));
|
|
|
|
param.sched_priority = prio;
|
|
|
|
printf("Setting SCHED_RR priority(%d)\n", param.sched_priority);
|
|
|
|
rc = sched_setscheduler(getpid(), SCHED_RR, ¶m);
|
|
|
|
if (rc != 0) {
|
|
|
|
std::cerr << "Config: Setting SCHED_RR failed" << std::endl;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-11-16 02:14:33 +00:00
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
2016-07-18 02:29:08 +00:00
|
|
|
int type, chans, ref;
|
2013-11-16 02:14:33 +00:00
|
|
|
RadioDevice *usrp;
|
|
|
|
RadioInterface *radio = NULL;
|
|
|
|
Transceiver *trx = NULL;
|
2016-06-22 23:09:44 +00:00
|
|
|
RadioDevice::InterfaceType iface = RadioDevice::NORMAL;
|
2013-11-16 02:14:33 +00:00
|
|
|
struct trx_config config;
|
|
|
|
|
2017-03-16 11:09:34 +00:00
|
|
|
#ifdef HAVE_SSE3
|
|
|
|
printf("Info: SSE3 support compiled in");
|
2017-05-19 22:46:51 +00:00
|
|
|
#ifdef HAVE___BUILTIN_CPU_SUPPORTS
|
2017-03-16 11:09:34 +00:00
|
|
|
if (__builtin_cpu_supports("sse3"))
|
|
|
|
printf(" and supported by CPU\n");
|
|
|
|
else
|
|
|
|
printf(", but not supported by CPU\n");
|
2017-05-19 22:46:51 +00:00
|
|
|
#else
|
|
|
|
printf(", but runtime SIMD detection disabled\n");
|
|
|
|
#endif
|
2017-03-16 11:09:34 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef HAVE_SSE4_1
|
|
|
|
printf("Info: SSE4.1 support compiled in");
|
2017-05-19 22:46:51 +00:00
|
|
|
#ifdef HAVE___BUILTIN_CPU_SUPPORTS
|
2017-03-16 11:09:34 +00:00
|
|
|
if (__builtin_cpu_supports("sse4.1"))
|
|
|
|
printf(" and supported by CPU\n");
|
|
|
|
else
|
|
|
|
printf(", but not supported by CPU\n");
|
2017-05-19 22:46:51 +00:00
|
|
|
#else
|
|
|
|
printf(", but runtime SIMD detection disabled\n");
|
|
|
|
#endif
|
2017-03-16 11:09:34 +00:00
|
|
|
#endif
|
|
|
|
|
2017-03-15 17:09:35 +00:00
|
|
|
convolve_init();
|
|
|
|
convert_init();
|
|
|
|
|
2013-11-16 02:14:33 +00:00
|
|
|
handle_options(argc, argv, &config);
|
|
|
|
|
2017-06-29 13:35:22 +00:00
|
|
|
if (config.sched_rr != -1) {
|
|
|
|
if (set_sched_rr(config.sched_rr) < 0)
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
2013-11-16 02:14:33 +00:00
|
|
|
setup_signal_handlers();
|
|
|
|
|
|
|
|
/* Check database sanity */
|
|
|
|
if (!trx_setup_config(&config)) {
|
|
|
|
std::cerr << "Config: Database failure - exiting" << std::endl;
|
|
|
|
return EXIT_FAILURE;
|
|
|
|
}
|
|
|
|
|
2018-02-20 16:52:28 +00:00
|
|
|
gLogInit(config.log_level.c_str());
|
2013-11-16 02:14:33 +00:00
|
|
|
|
|
|
|
srandom(time(NULL));
|
|
|
|
|
|
|
|
/* Create the low level device object */
|
2016-06-24 21:25:39 +00:00
|
|
|
if (config.mcbts)
|
|
|
|
iface = RadioDevice::MULTI_ARFCN;
|
|
|
|
|
2016-07-18 02:29:08 +00:00
|
|
|
if (config.extref)
|
|
|
|
ref = RadioDevice::REF_EXTERNAL;
|
|
|
|
else if (config.gpsref)
|
|
|
|
ref = RadioDevice::REF_GPS;
|
|
|
|
else
|
|
|
|
ref = RadioDevice::REF_INTERNAL;
|
|
|
|
|
2016-06-22 23:09:44 +00:00
|
|
|
usrp = RadioDevice::make(config.tx_sps, config.rx_sps, iface,
|
Add support to set Rx/TxAntenna
Some devices have different Rx or Tx ports with different RF characteristics.
For instance LimeSDR has H (High), L (Low) and W (Wide) band Rx ports,
each of one being more suitable to a specific range of frequencies.
In case one wants to support several GSM bands, the best option is to
use the WideBand port and connect the antenna physically to that port in
the board. Then the firmware must be instructed ro read from that port.
Support for Rx/Tx port configuration is already in there for all the
layers (Limesuite, SoapySDR, SoapyUHD, UHD), but we are missing the
required bits in osmo-trx to make use of the available UHD API. This
commit addresses it.
Before this patch, the Rx/Tx paths configured could be changed by means
of the LimeSuiteGUI app, but after running osmo-trx, the values were
changed to the default ones.
One can now start using osmo-trx with 1 channel and specific Rx/Tx ports
by using for instance: osmo-trx -c 1 -y BAND1 -z LNAW
Default behaviour if no specific path or an empry path is passed ("") is
to do the same as preiously, ie. nothing by not calling the
set{T,R}xAntenna APIs.
One can also configure only specific channels, for instance to configure
only the first Tx channel and the second Rx channel:
osmo-trx -c 2 -y BAND1, -z ,LNAW
Change-Id: I1735e6ab05a05b0312d6d679b16ebd4a2260fa23
2018-02-05 12:05:06 +00:00
|
|
|
config.chans, config.offset, config.tx_paths, config.rx_paths);
|
2016-07-18 02:29:08 +00:00
|
|
|
type = usrp->open(config.dev_args, ref, config.swap_channels);
|
2013-11-16 02:14:33 +00:00
|
|
|
if (type < 0) {
|
|
|
|
LOG(ALERT) << "Failed to create radio device" << std::endl;
|
|
|
|
goto shutdown;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Setup the appropriate device interface */
|
|
|
|
radio = makeRadioInterface(&config, usrp, type);
|
|
|
|
if (!radio)
|
|
|
|
goto shutdown;
|
|
|
|
|
|
|
|
/* Create the transceiver core */
|
|
|
|
trx = makeTransceiver(&config, radio);
|
|
|
|
if (!trx)
|
|
|
|
goto shutdown;
|
|
|
|
|
|
|
|
chans = trx->numChans();
|
|
|
|
std::cout << "-- Transceiver active with "
|
|
|
|
<< chans << " channel(s)" << std::endl;
|
|
|
|
|
|
|
|
while (!gshutdown)
|
|
|
|
sleep(1);
|
|
|
|
|
|
|
|
shutdown:
|
|
|
|
std::cout << "Shutting down transceiver..." << std::endl;
|
|
|
|
|
|
|
|
delete trx;
|
|
|
|
delete radio;
|
|
|
|
delete usrp;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|