transceiver: make the transmit drive loop bus dependent
With the introduction of the B100, there is USB support using UHD devices. The characteristics of the trasmit side burst submissions are more reflective of the bus type than the device or driver. Use a fixed latency interval for network devices and the adaptive underrun approach for USB devices - regardless of driver or device type. The GPMC based transport on the E100 appears unaffected by either latency scheme, which defaults to network. Signed-off-by: Thomas Tsou <ttsou@vt.edu>
This commit is contained in:
parent
cdbfa6910f
commit
eb10d9b31d
|
@ -714,27 +714,27 @@ void Transceiver::driveTransmitFIFO()
|
|||
while (radioClock->get() + mTransmitLatency > mTransmitDeadlineClock) {
|
||||
// if underrun, then we're not providing bursts to radio/USRP fast
|
||||
// enough. Need to increase latency by one GSM frame.
|
||||
#ifndef USE_UHD
|
||||
if (mRadioInterface->isUnderrun()) {
|
||||
// only do latency update every 10 frames, so we don't over update
|
||||
if (radioClock->get() > mLatencyUpdateTime + GSM::Time(10,0)) {
|
||||
mTransmitLatency = mTransmitLatency + GSM::Time(1,0);
|
||||
LOG(INFO) << "new latency: " << mTransmitLatency;
|
||||
mLatencyUpdateTime = radioClock->get();
|
||||
}
|
||||
if (mRadioInterface->getBus() == RadioDevice::USB) {
|
||||
if (mRadioInterface->isUnderrun()) {
|
||||
// only do latency update every 10 frames, so we don't over update
|
||||
if (radioClock->get() > mLatencyUpdateTime + GSM::Time(10,0)) {
|
||||
mTransmitLatency = mTransmitLatency + GSM::Time(1,0);
|
||||
LOG(INFO) << "new latency: " << mTransmitLatency;
|
||||
mLatencyUpdateTime = radioClock->get();
|
||||
}
|
||||
}
|
||||
else {
|
||||
// if underrun hasn't occurred in the last sec (216 frames) drop
|
||||
// transmit latency by a timeslot
|
||||
if (mTransmitLatency > GSM::Time(1,1)) {
|
||||
if (radioClock->get() > mLatencyUpdateTime + GSM::Time(216,0)) {
|
||||
mTransmitLatency.decTN();
|
||||
LOG(INFO) << "reduced latency: " << mTransmitLatency;
|
||||
mLatencyUpdateTime = radioClock->get();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// if underrun hasn't occurred in the last sec (216 frames) drop
|
||||
// transmit latency by a timeslot
|
||||
if (mTransmitLatency > GSM::Time(1,1)) {
|
||||
if (radioClock->get() > mLatencyUpdateTime + GSM::Time(216,0)) {
|
||||
mTransmitLatency.decTN();
|
||||
LOG(INFO) << "reduced latency: " << mTransmitLatency;
|
||||
mLatencyUpdateTime = radioClock->get();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
// time to push burst to transmit FIFO
|
||||
pushRadioVector(mTransmitDeadlineClock);
|
||||
mTransmitDeadlineClock.incTN();
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "radioDevice.h"
|
||||
#include "Threads.h"
|
||||
#include "Logger.h"
|
||||
#include <uhd/property_tree.hpp>
|
||||
#include <uhd/usrp/single_usrp.hpp>
|
||||
#include <uhd/utils/thread_priority.hpp>
|
||||
#include <uhd/utils/msg.hpp>
|
||||
|
@ -154,6 +155,7 @@ public:
|
|||
bool stop();
|
||||
void restart(uhd::time_spec_t ts);
|
||||
void setPriority();
|
||||
enum busType getBus() { return bus; }
|
||||
|
||||
int readSamples(short *buf, int len, bool *overrun,
|
||||
TIMESTAMP timestamp, bool *underrun, unsigned *RSSI);
|
||||
|
@ -201,6 +203,7 @@ public:
|
|||
|
||||
private:
|
||||
uhd::usrp::single_usrp::sptr usrp_dev;
|
||||
enum busType bus;
|
||||
|
||||
double desired_smpl_rt, actual_smpl_rt;
|
||||
|
||||
|
@ -373,20 +376,38 @@ double uhd_device::setRxGain(double db)
|
|||
|
||||
bool uhd_device::open()
|
||||
{
|
||||
LOG(INFO) << "creating USRP device...";
|
||||
std::string dev_str;
|
||||
uhd::property_tree::sptr prop_tree;
|
||||
|
||||
// Register msg handler
|
||||
uhd::msg::register_handler(&uhd_msg_handler);
|
||||
|
||||
// Allow all UHD devices
|
||||
LOG(INFO) << "Creating transceiver with first found UHD device";
|
||||
uhd::device_addr_t dev_addr("");
|
||||
try {
|
||||
usrp_dev = uhd::usrp::single_usrp::make(dev_addr);
|
||||
} catch(...) {
|
||||
LOG(ERROR) << "UHD make failed";
|
||||
return false;
|
||||
}
|
||||
|
||||
catch(...) {
|
||||
LOG(ERROR) << "USRP make failed";
|
||||
return false;
|
||||
// Set the device name and bus type
|
||||
dev_str = usrp_dev->get_mboard_name();
|
||||
LOG(NOTICE) << "Found " << dev_str;
|
||||
|
||||
prop_tree = usrp_dev->get_device()->get_tree();
|
||||
dev_str = prop_tree->access<std::string>("/name").get();
|
||||
|
||||
size_t res1 = dev_str.find("B100");
|
||||
size_t res2 = dev_str.find("B-Series");
|
||||
|
||||
if ((res1 != std::string::npos) || (res2 != std::string::npos)) {
|
||||
bus = USB;
|
||||
LOG(NOTICE) << "Using USB bus for " << dev_str;
|
||||
} else {
|
||||
bus = NET;
|
||||
LOG(NOTICE) << "Using network bus for " << dev_str;
|
||||
}
|
||||
|
||||
// Number of samples per over-the-wire packet
|
||||
|
|
|
@ -136,6 +136,9 @@ private:
|
|||
/** Set priority not supported */
|
||||
void setPriority() { return; }
|
||||
|
||||
/** Only USB bus supported */
|
||||
busType getBus() { return USB; }
|
||||
|
||||
/**
|
||||
Read samples from the USRP.
|
||||
@param buf preallocated buf to contain read result
|
||||
|
|
|
@ -37,6 +37,9 @@ typedef unsigned long long TIMESTAMP;
|
|||
class RadioDevice {
|
||||
|
||||
public:
|
||||
/* Available transport bus types */
|
||||
enum busType { USB, NET };
|
||||
|
||||
static RadioDevice *make(double desiredSampleRate, bool skipRx = false);
|
||||
|
||||
/** Initialize the USRP */
|
||||
|
@ -48,6 +51,9 @@ class RadioDevice {
|
|||
/** Stop the USRP */
|
||||
virtual bool stop()=0;
|
||||
|
||||
/** Get the bus type */
|
||||
virtual enum busType getBus()=0;
|
||||
|
||||
/** Enable thread priority */
|
||||
virtual void setPriority()=0;
|
||||
|
||||
|
|
|
@ -140,6 +140,9 @@ public:
|
|||
/** set thread priority on current thread */
|
||||
void setPriority() { mRadio->setPriority(); }
|
||||
|
||||
/** get transport bus type of attached device */
|
||||
enum RadioDevice::busType getBus() { return mRadio->getBus(); }
|
||||
|
||||
protected:
|
||||
|
||||
/** drive synchronization of Tx/Rx of USRP */
|
||||
|
|
Reference in New Issue