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>
This commit is contained in:
parent
61b4a6ad9f
commit
010fff783b
|
@ -214,7 +214,7 @@ public:
|
|||
uhd_device(int sps, bool skip_rx);
|
||||
~uhd_device();
|
||||
|
||||
int open(const std::string &args);
|
||||
int open(const std::string &args, bool extref);
|
||||
bool start();
|
||||
bool stop();
|
||||
void restart(uhd::time_spec_t ts);
|
||||
|
@ -519,7 +519,7 @@ bool uhd_device::parse_dev_type()
|
|||
return true;
|
||||
}
|
||||
|
||||
int uhd_device::open(const std::string &args)
|
||||
int uhd_device::open(const std::string &args, bool extref)
|
||||
{
|
||||
// Find UHD devices
|
||||
uhd::device_addr_t addr(args);
|
||||
|
@ -542,9 +542,9 @@ int uhd_device::open(const std::string &args)
|
|||
if (!parse_dev_type())
|
||||
return -1;
|
||||
|
||||
#ifdef EXTREF
|
||||
set_ref_clk(true);
|
||||
#endif
|
||||
if (extref)
|
||||
set_ref_clk(true);
|
||||
|
||||
// Create TX and RX streamers
|
||||
uhd::stream_args_t stream_args("sc16");
|
||||
tx_stream = usrp_dev->get_tx_stream(stream_args);
|
||||
|
|
|
@ -90,7 +90,7 @@ USRPDevice::USRPDevice(int sps, bool skipRx)
|
|||
#endif
|
||||
}
|
||||
|
||||
int USRPDevice::open(const std::string &)
|
||||
int USRPDevice::open(const std::string &, bool)
|
||||
{
|
||||
writeLock.unlock();
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ private:
|
|||
USRPDevice(int sps, bool skipRx);
|
||||
|
||||
/** Instantiate the USRP */
|
||||
int open(const std::string &);
|
||||
int open(const std::string &, bool);
|
||||
|
||||
/** Start the USRP */
|
||||
bool start();
|
||||
|
|
|
@ -43,7 +43,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
RadioDevice *usrp = RadioDevice::make(52.0e6/192.0, 1);
|
||||
|
||||
usrp->open("");
|
||||
usrp->open();
|
||||
|
||||
TIMESTAMP timestamp;
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class RadioDevice {
|
|||
static RadioDevice *make(int sps, bool skipRx = false);
|
||||
|
||||
/** 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 */
|
||||
virtual bool start()=0;
|
||||
|
|
|
@ -108,7 +108,7 @@ int testConfig(const char *filename)
|
|||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int trxPort, fail = 0;
|
||||
int trxPort, radioType, extref = 0, fail = 0;
|
||||
std::string deviceArgs, logLevel, trxAddr;
|
||||
RadioDevice *usrp = NULL;
|
||||
RadioInterface *radio = NULL;
|
||||
|
@ -138,12 +138,21 @@ int main(int argc, char *argv[])
|
|||
logLevel = gConfig.getStr("Log.Level");
|
||||
trxPort = gConfig.getNum("TRX.Port");
|
||||
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);
|
||||
|
||||
srandom(time(NULL));
|
||||
|
||||
usrp = RadioDevice::make(SPS);
|
||||
int radioType = usrp->open(deviceArgs);
|
||||
radioType = usrp->open(deviceArgs, extref);
|
||||
if (radioType < 0) {
|
||||
LOG(ALERT) << "Transceiver exiting..." << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
|
|
|
@ -73,11 +73,6 @@ AC_ARG_WITH(singledb, [
|
|||
[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"], [
|
||||
PKG_CHECK_MODULES(USRP, usrp >= 3.3)
|
||||
# Find and define supported SIMD extensions
|
||||
|
@ -90,10 +85,6 @@ AS_IF([test "x$with_uhd" = "xyes"],[
|
|||
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"], [
|
||||
AC_DEFINE(SINGLEDB, 1, Define to 1 for single daughterboard)
|
||||
])
|
||||
|
|
Loading…
Reference in New Issue