aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Transceiver52M/device/lms/LMSDevice.cpp13
-rw-r--r--Transceiver52M/device/lms/LMSDevice.h2
-rw-r--r--Transceiver52M/device/radioDevice.h13
-rw-r--r--Transceiver52M/device/uhd/UHDDevice.cpp26
-rw-r--r--Transceiver52M/device/usrp1/USRPDevice.cpp11
-rw-r--r--Transceiver52M/device/usrp1/USRPDevice.h4
6 files changed, 37 insertions, 32 deletions
diff --git a/Transceiver52M/device/lms/LMSDevice.cpp b/Transceiver52M/device/lms/LMSDevice.cpp
index 68d4b97..c4d5f96 100644
--- a/Transceiver52M/device/lms/LMSDevice.cpp
+++ b/Transceiver52M/device/lms/LMSDevice.cpp
@@ -40,17 +40,14 @@ constexpr double LMSDevice::masterClockRate;
#define LMS_MIN_BW_SUPPORTED 2.5e6 /* 2.5mHz, minimum supported by LMS */
#define LMS_CALIBRATE_BW_HZ OSMO_MAX(GSM_CARRIER_BW, LMS_MIN_BW_SUPPORTED)
-LMSDevice::LMSDevice(size_t tx_sps, size_t chans,
+LMSDevice::LMSDevice(size_t tx_sps, size_t rx_sps, InterfaceType iface, size_t chans, double lo_offset,
const std::vector<std::string>& tx_paths,
const std::vector<std::string>& rx_paths):
- m_lms_dev(NULL), chans(chans)
+ RadioDevice(tx_sps, rx_sps, iface, chans, lo_offset, tx_paths, rx_paths),
+ m_lms_dev(NULL)
{
LOG(INFO) << "creating LMS device...";
- this->tx_sps = tx_sps;
- this->tx_paths = tx_paths;
- this->rx_paths = rx_paths;
-
m_lms_stream_rx.resize(chans);
m_lms_stream_tx.resize(chans);
@@ -624,9 +621,9 @@ bool LMSDevice::setRxFreq(double wFreq, size_t chan)
}
RadioDevice *RadioDevice::make(size_t tx_sps, size_t rx_sps,
- InterfaceType iface, size_t chans, double offset,
+ InterfaceType iface, size_t chans, double lo_offset,
const std::vector < std::string > &tx_paths,
const std::vector < std::string > &rx_paths)
{
- return new LMSDevice(tx_sps, chans, tx_paths, rx_paths);
+ return new LMSDevice(tx_sps, rx_sps, iface, chans, lo_offset, tx_paths, rx_paths);
}
diff --git a/Transceiver52M/device/lms/LMSDevice.h b/Transceiver52M/device/lms/LMSDevice.h
index 0fe4c15..7d8d44b 100644
--- a/Transceiver52M/device/lms/LMSDevice.h
+++ b/Transceiver52M/device/lms/LMSDevice.h
@@ -65,7 +65,7 @@ private:
public:
/** Object constructor */
- LMSDevice(size_t tx_sps, size_t chans,
+ LMSDevice(size_t tx_sps, size_t rx_sps, InterfaceType iface, size_t chans, double lo_offset,
const std::vector<std::string>& tx_paths,
const std::vector<std::string>& rx_paths);
diff --git a/Transceiver52M/device/radioDevice.h b/Transceiver52M/device/radioDevice.h
index a9328ec..806ee8a 100644
--- a/Transceiver52M/device/radioDevice.h
+++ b/Transceiver52M/device/radioDevice.h
@@ -58,6 +58,13 @@ class RadioDevice {
/** Initialize the USRP */
virtual int open(const std::string &args, int ref, bool swap_channels)=0;
+ RadioDevice(size_t tx_sps, size_t rx_sps, InterfaceType type, size_t chans, double offset,
+ const std::vector<std::string>& tx_paths,
+ const std::vector<std::string>& rx_paths):
+ tx_sps(tx_sps), rx_sps(rx_sps), iface(type), chans(chans), lo_offset(offset),
+ tx_paths(tx_paths), rx_paths(rx_paths)
+ { }
+
virtual ~RadioDevice() { }
/** Start the USRP */
@@ -164,8 +171,12 @@ class RadioDevice {
virtual double numberRead()=0;
virtual double numberWritten()=0;
+ protected:
+ size_t tx_sps, rx_sps;
+ InterfaceType iface;
+ size_t chans;
+ double lo_offset;
std::vector<std::string> tx_paths, rx_paths;
- size_t tx_sps;
bool set_antennas() {
unsigned int i;
diff --git a/Transceiver52M/device/uhd/UHDDevice.cpp b/Transceiver52M/device/uhd/UHDDevice.cpp
index ddcad3a..e8cec68 100644
--- a/Transceiver52M/device/uhd/UHDDevice.cpp
+++ b/Transceiver52M/device/uhd/UHDDevice.cpp
@@ -287,7 +287,6 @@ private:
double tx_gain_min, tx_gain_max;
double rx_gain_min, rx_gain_max;
- double offset;
std::vector<double> tx_gains, rx_gains;
std::vector<double> tx_freqs, rx_freqs;
@@ -317,7 +316,6 @@ private:
bool set_freq(double freq, size_t chan, bool tx);
Thread *async_event_thrd;
- InterfaceType iface;
Mutex tune_lock;
};
@@ -364,22 +362,16 @@ static void thread_enable_cancel(bool cancel)
}
uhd_device::uhd_device(size_t tx_sps, size_t rx_sps,
- InterfaceType iface, size_t chans, double offset,
+ InterfaceType iface, size_t chans, double lo_offset,
const std::vector<std::string>& tx_paths,
const std::vector<std::string>& rx_paths)
- : tx_gain_min(0.0), tx_gain_max(0.0),
+ : RadioDevice(tx_sps, rx_sps, iface, chans, lo_offset, tx_paths, rx_paths),
+ tx_gain_min(0.0), tx_gain_max(0.0),
rx_gain_min(0.0), rx_gain_max(0.0),
tx_spp(0), rx_spp(0),
started(false), aligned(false), rx_pkt_cnt(0), drop_cnt(0),
prev_ts(0,0), ts_initial(0), ts_offset(0), async_event_thrd(NULL)
{
- this->tx_sps = tx_sps;
- this->rx_sps = rx_sps;
- this->chans = chans;
- this->offset = offset;
- this->iface = iface;
- this->tx_paths = tx_paths;
- this->rx_paths = rx_paths;
}
uhd_device::~uhd_device()
@@ -1057,8 +1049,8 @@ uhd::tune_request_t uhd_device::select_freq(double freq, size_t chan, bool tx)
uhd::tune_request_t treq(freq);
if (dev_type == UMTRX) {
- if (offset != 0.0)
- return uhd::tune_request_t(freq, offset);
+ if (lo_offset != 0.0)
+ return uhd::tune_request_t(freq, lo_offset);
// Don't use DSP tuning, because LMS6002D PLL steps are small enough.
// We end up with DSP tuning just for 2-3Hz, which is meaningless and
@@ -1070,10 +1062,10 @@ uhd::tune_request_t uhd_device::select_freq(double freq, size_t chan, bool tx)
treq.dsp_freq = 0.0;
return treq;
} else if (chans == 1) {
- if (offset == 0.0)
+ if (lo_offset == 0.0)
return treq;
- return uhd::tune_request_t(freq, offset);
+ return uhd::tune_request_t(freq, lo_offset);
} else if ((dev_type != B210) || (chans > 2) || (chan > 1)) {
LOG(ALERT) << chans << " channels unsupported";
return treq;
@@ -1556,9 +1548,9 @@ std::string smpl_buf::str_code(ssize_t code)
}
RadioDevice *RadioDevice::make(size_t tx_sps, size_t rx_sps,
- InterfaceType iface, size_t chans, double offset,
+ InterfaceType iface, size_t chans, double lo_offset,
const std::vector<std::string>& tx_paths,
const std::vector<std::string>& rx_paths)
{
- return new uhd_device(tx_sps, rx_sps, iface, chans, offset, tx_paths, rx_paths);
+ return new uhd_device(tx_sps, rx_sps, iface, chans, lo_offset, tx_paths, rx_paths);
}
diff --git a/Transceiver52M/device/usrp1/USRPDevice.cpp b/Transceiver52M/device/usrp1/USRPDevice.cpp
index 07ba1c9..7a31c97 100644
--- a/Transceiver52M/device/usrp1/USRPDevice.cpp
+++ b/Transceiver52M/device/usrp1/USRPDevice.cpp
@@ -58,11 +58,14 @@ const dboardConfigType dboardConfig = TXA_RXB;
const double USRPDevice::masterClockRate = 52.0e6;
-USRPDevice::USRPDevice(size_t tx_sps)
+USRPDevice::USRPDevice(size_t tx_sps, size_t rx_sps, InterfaceType iface,
+ size_t chans, double lo_offset,
+ const std::vector<std::string>& tx_paths,
+ const std::vector<std::string>& rx_paths):
+ RadioDevice(tx_sps, rx_sps, iface, chans, lo_offset, tx_paths, rx_paths)
{
LOG(INFO) << "creating USRP device...";
- this->tx_sps = tx_sps;
decimRate = (unsigned int) round(masterClockRate/((GSMRATE) * (double) tx_sps));
actualSampleRate = masterClockRate/decimRate;
rxGain = 0;
@@ -648,9 +651,9 @@ bool USRPDevice::setRxFreq(double wFreq) { return true;};
#endif
RadioDevice *RadioDevice::make(size_t tx_sps, size_t rx_sps,
- InterfaceType iface, size_t chans, double offset,
+ InterfaceType iface, size_t chans, double lo_offset,
const std::vector<std::string>& tx_paths,
const std::vector<std::string>& rx_paths)
{
- return new USRPDevice(tx_sps);
+ return new USRPDevice(tx_sps, rx_sps, iface, chans, lo_offset, tx_paths, rx_paths);
}
diff --git a/Transceiver52M/device/usrp1/USRPDevice.h b/Transceiver52M/device/usrp1/USRPDevice.h
index ff5b273..451b5a9 100644
--- a/Transceiver52M/device/usrp1/USRPDevice.h
+++ b/Transceiver52M/device/usrp1/USRPDevice.h
@@ -95,7 +95,9 @@ private:
public:
/** Object constructor */
- USRPDevice(size_t tx_sps);
+ USRPDevice(size_t tx_sps, size_t rx_sps, InterfaceType iface, size_t chans, double lo_offset,
+ const std::vector<std::string>& tx_paths,
+ const std::vector<std::string>& rx_paths);
/** Instantiate the USRP */
int open(const std::string &, int, bool);