aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M/osmo-trx.cpp
diff options
context:
space:
mode:
authorTom Tsou <tom.tsou@ettus.com>2016-07-17 19:29:08 -0700
committerTom Tsou <tom.tsou@ettus.com>2016-07-17 19:34:22 -0700
commit2f3e60bc1f7da051183fe00f961d14da6d2c5981 (patch)
treec4a8ffdb1e0f2c23f4899078ba1a7153b537a16f /Transceiver52M/osmo-trx.cpp
parentcbfef6e40a030a7e99c8bba49482ac53f05b803b (diff)
uhd: Add command line option for GPS reference
Unlike earlier versions of UHD, the current release (3.9.2) does not automatically select on-board GPSDO as the reference source. Modify the command line settings to allow explicit selection of GPS in addition to the external setting. Simultaneous GPS and external reference settingis disallowed. Signed-off-by: Tom Tsou <tom.tsou@ettus.com>
Diffstat (limited to 'Transceiver52M/osmo-trx.cpp')
-rw-r--r--Transceiver52M/osmo-trx.cpp37
1 files changed, 31 insertions, 6 deletions
diff --git a/Transceiver52M/osmo-trx.cpp b/Transceiver52M/osmo-trx.cpp
index 29f0488..a13ec1b 100644
--- a/Transceiver52M/osmo-trx.cpp
+++ b/Transceiver52M/osmo-trx.cpp
@@ -72,6 +72,7 @@ struct trx_config {
unsigned rtsc;
unsigned rach_delay;
bool extref;
+ bool gpsref;
Transceiver::FillerType filler;
bool diversity;
bool mcbts;
@@ -183,10 +184,16 @@ bool trx_setup_config(struct trx_config *config)
}
edgestr = config->edge ? "Enabled" : "Disabled";
- refstr = config->extref ? "Enabled" : "Disabled";
divstr = config->diversity ? "Enabled" : "Disabled";
mcstr = config->mcbts ? "Enabled" : "Disabled";
+ if (config->extref)
+ refstr = "External";
+ else if (config->gpsref)
+ refstr = "GPS";
+ else
+ refstr = "Internal";
+
switch (config->filler) {
case Transceiver::FILLER_DUMMY:
fillstr = "Dummy bursts";
@@ -215,7 +222,7 @@ bool trx_setup_config(struct trx_config *config)
ost << " Tx Samples-per-Symbol... " << config->tx_sps << std::endl;
ost << " Rx Samples-per-Symbol... " << config->rx_sps << std::endl;
ost << " EDGE support............ " << edgestr << std::endl;
- ost << " External Reference...... " << refstr << std::endl;
+ ost << " Reference............... " << refstr << std::endl;
ost << " C0 Filler Table......... " << fillstr << std::endl;
ost << " Multi-Carrier........... " << mcstr << std::endl;
ost << " Diversity............... " << divstr << std::endl;
@@ -331,9 +338,10 @@ static void print_help()
" -i IP address of GSM core\n"
" -p Base port number\n"
" -e Enable EDGE receiver\n"
- " -d Enable dual channel diversity receiver\n"
+ " -d Enable dual channel diversity receiver (deprecated)\n"
" -m Enable multi-ARFCN transceiver (default=disabled)\n"
" -x Enable external 10 MHz reference\n"
+ " -g Enable GPSDO reference\n"
" -s Tx samples-per-symbol (1 or 4)\n"
" -b Rx samples-per-symbol (1 or 4)\n"
" -c Number of ARFCN channels (default=1)\n"
@@ -357,6 +365,7 @@ static void handle_options(int argc, char **argv, struct trx_config *config)
config->rtsc = 0;
config->rach_delay = 0;
config->extref = false;
+ config->gpsref = false;
config->filler = Transceiver::FILLER_ZERO;
config->mcbts = false;
config->diversity = false;
@@ -365,7 +374,7 @@ static void handle_options(int argc, char **argv, struct trx_config *config)
config->swap_channels = false;
config->edge = false;
- while ((option = getopt(argc, argv, "ha:l:i:p:c:dmxfo:s:b:r:A:R:Se")) != -1) {
+ while ((option = getopt(argc, argv, "ha:l:i:p:c:dmxgfo:s:b:r:A:R:Se")) != -1) {
switch (option) {
case 'h':
print_help();
@@ -395,6 +404,9 @@ static void handle_options(int argc, char **argv, struct trx_config *config)
case 'x':
config->extref = true;
break;
+ case 'g':
+ config->gpsref = true;
+ break;
case 'f':
config->filler = Transceiver::FILLER_DUMMY;
break;
@@ -430,6 +442,12 @@ static void handle_options(int argc, char **argv, struct trx_config *config)
}
}
+ if (config->gpsref && config->extref) {
+ printf("External and GPSDO references unavailable at the same time\n\n");
+ print_help();
+ exit(0);
+ }
+
/* Force 4 SPS for EDGE or multi-ARFCN configurations */
if ((config->edge) || (config->mcbts)) {
config->tx_sps = 4;
@@ -461,7 +479,7 @@ static void handle_options(int argc, char **argv, struct trx_config *config)
int main(int argc, char *argv[])
{
- int type, chans;
+ int type, chans, ref;
RadioDevice *usrp;
RadioInterface *radio = NULL;
Transceiver *trx = NULL;
@@ -486,9 +504,16 @@ int main(int argc, char *argv[])
if (config.mcbts)
iface = RadioDevice::MULTI_ARFCN;
+ if (config.extref)
+ ref = RadioDevice::REF_EXTERNAL;
+ else if (config.gpsref)
+ ref = RadioDevice::REF_GPS;
+ else
+ ref = RadioDevice::REF_INTERNAL;
+
usrp = RadioDevice::make(config.tx_sps, config.rx_sps, iface,
config.chans, config.offset);
- type = usrp->open(config.dev_args, config.extref, config.swap_channels);
+ type = usrp->open(config.dev_args, ref, config.swap_channels);
if (type < 0) {
LOG(ALERT) << "Failed to create radio device" << std::endl;
goto shutdown;