diff options
author | ttsou <ttsou@19bc5d8c-e614-43d4-8b26-e1612bc8e597> | 2012-10-22 00:07:14 +0000 |
---|---|---|
committer | ttsou <ttsou@19bc5d8c-e614-43d4-8b26-e1612bc8e597> | 2012-10-22 00:07:14 +0000 |
commit | f60dafa4ff101800efd8b332498971ca22489bb7 (patch) | |
tree | 668b5c1bc5e8019f5493251c8b69da1ac1c300c4 /Transceiver52M | |
parent | 60dc4c9da4392eeec627118e6245ec9a34bce0bb (diff) |
Transceiver52M: UHD: Setup option to pass arguments from command line
UHD accepts optional 'args' that can be used for device descriptions
such as IP address, device type, etc. Allow these to be passed in on
the transceiver command line as the third argument (number of supported
carriers is the second argument). This option benefits those who may
have multiple UHD devices attached to a single system.
This option is not yet supported by GSM core and requires starting the
transceiver independently on the command line. This option has no
effect when USRP1 is used.
Signed-off-by: Thomas Tsou <tom@tsou.cc>
git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@4315 19bc5d8c-e614-43d4-8b26-e1612bc8e597
Diffstat (limited to 'Transceiver52M')
-rw-r--r-- | Transceiver52M/UHDDevice.cpp | 10 | ||||
-rw-r--r-- | Transceiver52M/USRPDevice.cpp | 2 | ||||
-rw-r--r-- | Transceiver52M/USRPDevice.h | 2 | ||||
-rw-r--r-- | Transceiver52M/USRPping.cpp | 2 | ||||
-rw-r--r-- | Transceiver52M/radioDevice.h | 3 | ||||
-rw-r--r-- | Transceiver52M/runTransceiver.cpp | 13 |
6 files changed, 22 insertions, 10 deletions
diff --git a/Transceiver52M/UHDDevice.cpp b/Transceiver52M/UHDDevice.cpp index 1bc0519..78e9e57 100644 --- a/Transceiver52M/UHDDevice.cpp +++ b/Transceiver52M/UHDDevice.cpp @@ -151,7 +151,7 @@ public: uhd_device(double rate, bool skip_rx); ~uhd_device(); - bool open(); + bool open(const std::string &args); bool start(); bool stop(); void restart(uhd::time_spec_t ts); @@ -422,16 +422,16 @@ bool uhd_device::parse_dev_type() return true; } -bool uhd_device::open() +bool uhd_device::open(const std::string &args) { // Register msg handler uhd::msg::register_handler(&uhd_msg_handler); // Find UHD devices - uhd::device_addr_t args(""); - uhd::device_addrs_t dev_addrs = uhd::device::find(args); + uhd::device_addr_t addr(args); + uhd::device_addrs_t dev_addrs = uhd::device::find(addr); if (dev_addrs.size() == 0) { - LOG(ALERT) << "No UHD devices found"; + LOG(ALERT) << "No UHD devices found with address '" << args << "'"; return false; } diff --git a/Transceiver52M/USRPDevice.cpp b/Transceiver52M/USRPDevice.cpp index d9eefc8..237c5f1 100644 --- a/Transceiver52M/USRPDevice.cpp +++ b/Transceiver52M/USRPDevice.cpp @@ -75,7 +75,7 @@ USRPDevice::USRPDevice (double _desiredSampleRate, bool skipRx) #endif } -bool USRPDevice::open() +bool USRPDevice::open(const std::string &) { writeLock.unlock(); diff --git a/Transceiver52M/USRPDevice.h b/Transceiver52M/USRPDevice.h index 700f1ca..b88afcb 100644 --- a/Transceiver52M/USRPDevice.h +++ b/Transceiver52M/USRPDevice.h @@ -115,7 +115,7 @@ private: USRPDevice (double _desiredSampleRate, bool skipRx); /** Instantiate the USRP */ - bool open(); + bool open(const std::string &); /** Start the USRP */ bool start(); diff --git a/Transceiver52M/USRPping.cpp b/Transceiver52M/USRPping.cpp index 62f7de6..9c09e2a 100644 --- a/Transceiver52M/USRPping.cpp +++ b/Transceiver52M/USRPping.cpp @@ -43,7 +43,7 @@ int main(int argc, char *argv[]) { RadioDevice *usrp = RadioDevice::make(52.0e6/192.0); - usrp->open(); + usrp->open(""); TIMESTAMP timestamp; diff --git a/Transceiver52M/radioDevice.h b/Transceiver52M/radioDevice.h index 47012a1..f7dcb03 100644 --- a/Transceiver52M/radioDevice.h +++ b/Transceiver52M/radioDevice.h @@ -15,6 +15,7 @@ #ifndef __RADIO_DEVICE_H__ #define __RADIO_DEVICE_H__ +#include <string> #ifdef HAVE_CONFIG_H #include "config.h" @@ -33,7 +34,7 @@ class RadioDevice { static RadioDevice *make(double desiredSampleRate, bool skipRx = false); /** Initialize the USRP */ - virtual bool open()=0; + virtual bool open(const std::string &args)=0; /** Start the USRP */ virtual bool start()=0; diff --git a/Transceiver52M/runTransceiver.cpp b/Transceiver52M/runTransceiver.cpp index 1b8df36..b95c28e 100644 --- a/Transceiver52M/runTransceiver.cpp +++ b/Transceiver52M/runTransceiver.cpp @@ -57,6 +57,17 @@ static void ctrlCHandler(int signo) int main(int argc, char *argv[]) { + std::string deviceArgs; + + if (argc == 3) + { + deviceArgs = std::string(argv[2]); + } + else + { + deviceArgs = ""; + } + if ( signal( SIGINT, ctrlCHandler ) == SIG_ERR ) { cerr << "Couldn't install signal handler for SIGINT" << endl; @@ -79,7 +90,7 @@ int main(int argc, char *argv[]) int mOversamplingRate = numARFCN/2 + numARFCN; RadioDevice *usrp = RadioDevice::make(DEVICERATE); - if (!usrp->open()) { + if (!usrp->open(deviceArgs)) { LOG(ALERT) << "Transceiver exiting..." << std::endl; return EXIT_FAILURE; } |