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
This commit is contained in:
parent
60dc4c9da4
commit
f60dafa4ff
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ USRPDevice::USRPDevice (double _desiredSampleRate, bool skipRx)
|
|||
#endif
|
||||
}
|
||||
|
||||
bool USRPDevice::open()
|
||||
bool USRPDevice::open(const std::string &)
|
||||
{
|
||||
writeLock.unlock();
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -43,7 +43,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
RadioDevice *usrp = RadioDevice::make(52.0e6/192.0);
|
||||
|
||||
usrp->open();
|
||||
usrp->open("");
|
||||
|
||||
TIMESTAMP timestamp;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue