Transceiver52M: Move reference select from compile time to database

Enabling the external reference on UHD devices through the configure
time switch is awkward. Use a database variable "TRX.Reference" with
'0' or '1' value for internal and external references respectively.
Use internal reference is no entry is defined.

Signed-off-by: Thomas Tsou <tom@tsou.cc>

git-svn-id: http://wush.net/svn/range/software/public/openbts/trunk@6754 19bc5d8c-e614-43d4-8b26-e1612bc8e597
This commit is contained in:
Thomas Tsou
2013-10-17 06:19:30 +00:00
parent f8b26f9aba
commit cf111aaad1
7 changed files with 20 additions and 20 deletions

View File

@@ -214,7 +214,7 @@ public:
uhd_device(int sps, bool skip_rx); uhd_device(int sps, bool skip_rx);
~uhd_device(); ~uhd_device();
int open(const std::string &args); int open(const std::string &args, bool extref);
bool start(); bool start();
bool stop(); bool stop();
void restart(uhd::time_spec_t ts); void restart(uhd::time_spec_t ts);
@@ -519,7 +519,7 @@ bool uhd_device::parse_dev_type()
return true; return true;
} }
int uhd_device::open(const std::string &args) int uhd_device::open(const std::string &args, bool extref)
{ {
// Find UHD devices // Find UHD devices
uhd::device_addr_t addr(args); uhd::device_addr_t addr(args);
@@ -542,9 +542,9 @@ int uhd_device::open(const std::string &args)
if (!parse_dev_type()) if (!parse_dev_type())
return -1; return -1;
#ifdef EXTREF if (extref)
set_ref_clk(true); set_ref_clk(true);
#endif
// Create TX and RX streamers // Create TX and RX streamers
uhd::stream_args_t stream_args("sc16"); uhd::stream_args_t stream_args("sc16");
tx_stream = usrp_dev->get_tx_stream(stream_args); tx_stream = usrp_dev->get_tx_stream(stream_args);

View File

@@ -90,7 +90,7 @@ USRPDevice::USRPDevice(int sps, bool skipRx)
#endif #endif
} }
int USRPDevice::open(const std::string &) int USRPDevice::open(const std::string &, bool)
{ {
writeLock.unlock(); writeLock.unlock();

View File

@@ -105,7 +105,7 @@ private:
USRPDevice(int sps, bool skipRx); USRPDevice(int sps, bool skipRx);
/** Instantiate the USRP */ /** Instantiate the USRP */
int open(const std::string &); int open(const std::string &, bool);
/** Start the USRP */ /** Start the USRP */
bool start(); bool start();

View File

@@ -43,7 +43,7 @@ int main(int argc, char *argv[]) {
RadioDevice *usrp = RadioDevice::make(52.0e6/192.0, 1); RadioDevice *usrp = RadioDevice::make(52.0e6/192.0, 1);
usrp->open(""); usrp->open();
TIMESTAMP timestamp; TIMESTAMP timestamp;

View File

@@ -39,7 +39,7 @@ class RadioDevice {
static RadioDevice *make(int sps, bool skipRx = false); static RadioDevice *make(int sps, bool skipRx = false);
/** Initialize the USRP */ /** Initialize the USRP */
virtual int open(const std::string &args)=0; virtual int open(const std::string &args = "", bool extref = false)=0;
/** Start the USRP */ /** Start the USRP */
virtual bool start()=0; virtual bool start()=0;

View File

@@ -109,7 +109,7 @@ int testConfig(const char *filename)
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int trxPort, fail = 0; int trxPort, radioType, extref = 0, fail = 0;
std::string deviceArgs, logLevel, trxAddr; std::string deviceArgs, logLevel, trxAddr;
RadioDevice *usrp = NULL; RadioDevice *usrp = NULL;
RadioInterface *radio = NULL; RadioInterface *radio = NULL;
@@ -139,12 +139,21 @@ int main(int argc, char *argv[])
logLevel = gConfig.getStr("Log.Level"); logLevel = gConfig.getStr("Log.Level");
trxPort = gConfig.getNum("TRX.Port"); trxPort = gConfig.getNum("TRX.Port");
trxAddr = gConfig.getStr("TRX.IP"); trxAddr = gConfig.getStr("TRX.IP");
if (gConfig.defines("TRX.Reference"))
extref = gConfig.getNum("TRX.Reference");
if (extref)
std::cout << "Using external clock reference" << std::endl;
else
std::cout << "Using internal clock reference" << std::endl;
gLogInit("transceiver", logLevel.c_str(), LOG_LOCAL7); gLogInit("transceiver", logLevel.c_str(), LOG_LOCAL7);
srandom(time(NULL)); srandom(time(NULL));
usrp = RadioDevice::make(SPS); usrp = RadioDevice::make(SPS);
int radioType = usrp->open(deviceArgs); radioType = usrp->open(deviceArgs, extref);
if (radioType < 0) { if (radioType < 0) {
LOG(ALERT) << "Transceiver exiting..." << std::endl; LOG(ALERT) << "Transceiver exiting..." << std::endl;
return EXIT_FAILURE; return EXIT_FAILURE;

View File

@@ -70,11 +70,6 @@ AC_ARG_WITH(singledb, [
[enable single daughterboard use on USRP1]) [enable single daughterboard use on USRP1])
]) ])
AC_ARG_WITH(extref, [
AS_HELP_STRING([--with-extref],
[enable external reference on UHD devices])
])
AS_IF([test "x$with_usrp1" = "xyes"], [ AS_IF([test "x$with_usrp1" = "xyes"], [
PKG_CHECK_MODULES(USRP, usrp >= 3.3) PKG_CHECK_MODULES(USRP, usrp >= 3.3)
# Find and define supported SIMD extensions # Find and define supported SIMD extensions
@@ -87,10 +82,6 @@ AS_IF([test "x$with_uhd" = "xyes"],[
AX_EXT AX_EXT
]) ])
AS_IF([test "x$with_extref" = "xyes"], [
AC_DEFINE(EXTREF, 1, Define to 1 for external reference)
])
AS_IF([test "x$with_singledb" = "xyes"], [ AS_IF([test "x$with_singledb" = "xyes"], [
AC_DEFINE(SINGLEDB, 1, Define to 1 for single daughterboard) AC_DEFINE(SINGLEDB, 1, Define to 1 for single daughterboard)
]) ])