aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-03-12 19:35:33 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2020-03-12 19:35:47 +0100
commitdfc6e5ffc786756bded94ea06eb2502720b28839 (patch)
treee00ef29a13aec44cdf08da79f239baaf7a18833c
parentf8c0c464b84f6ca44c7a50623909e1a4aace0a1e (diff)
radioDevice: Drop unused isControl param from WriteSamples API
The out "isControl" parameter is only used by internal callers of USRPDevice, and not used at all by any user of the generic API (radioInterface*.cpp). Hence, we can get rid of it and keep it as a flag for an internal API of USRPDevice. Change-Id: I843384e24b76cdd28a95f9ee4e95e6157098e4a3
-rw-r--r--Transceiver52M/device/common/radioDevice.h3
-rw-r--r--Transceiver52M/device/lms/LMSDevice.cpp8
-rw-r--r--Transceiver52M/device/lms/LMSDevice.h4
-rw-r--r--Transceiver52M/device/uhd/UHDDevice.cpp8
-rw-r--r--Transceiver52M/device/uhd/UHDDevice.h2
-rw-r--r--Transceiver52M/device/usrp1/USRPDevice.cpp13
-rw-r--r--Transceiver52M/device/usrp1/USRPDevice.h6
7 files changed, 18 insertions, 26 deletions
diff --git a/Transceiver52M/device/common/radioDevice.h b/Transceiver52M/device/common/radioDevice.h
index c504b3a..0dc38d5 100644
--- a/Transceiver52M/device/common/radioDevice.h
+++ b/Transceiver52M/device/common/radioDevice.h
@@ -87,11 +87,10 @@ class RadioDevice {
@param len number of samples to write.
@param underrun Set if radio does not have data to transmit, e.g. data not being sent fast enough
@param timestamp The timestamp of the first sample of the data buffer.
- @param isControl Set if data is a control packet, e.g. a ping command
@return The number of samples actually written
*/
virtual int writeSamples(std::vector<short *> &bufs, int len, bool *underrun,
- TIMESTAMP timestamp, bool isControl = false) = 0;
+ TIMESTAMP timestamp) = 0;
/** Update the alignment between the read and write timestamps */
virtual bool updateAlignment(TIMESTAMP timestamp)=0;
diff --git a/Transceiver52M/device/lms/LMSDevice.cpp b/Transceiver52M/device/lms/LMSDevice.cpp
index 0cd8002..932817d 100644
--- a/Transceiver52M/device/lms/LMSDevice.cpp
+++ b/Transceiver52M/device/lms/LMSDevice.cpp
@@ -858,8 +858,7 @@ void LMSDevice::update_stream_stats_tx(size_t chan, bool *underrun)
}
int LMSDevice::writeSamples(std::vector < short *>&bufs, int len,
- bool * underrun, unsigned long long timestamp,
- bool isControl)
+ bool * underrun, unsigned long long timestamp)
{
int rc = 0;
unsigned int i;
@@ -868,11 +867,6 @@ int LMSDevice::writeSamples(std::vector < short *>&bufs, int len,
tx_metadata.waitForTimestamp = true;
tx_metadata.timestamp = timestamp - ts_offset; /* Shift Tx time by offset */
- if (isControl) {
- LOGC(DDEV, ERROR) << "Control packets not supported";
- return 0;
- }
-
if (bufs.size() != chans) {
LOGC(DDEV, ERROR) << "Invalid channel combination " << bufs.size();
return -1;
diff --git a/Transceiver52M/device/lms/LMSDevice.h b/Transceiver52M/device/lms/LMSDevice.h
index c2fd2f6..5b6330a 100644
--- a/Transceiver52M/device/lms/LMSDevice.h
+++ b/Transceiver52M/device/lms/LMSDevice.h
@@ -117,12 +117,10 @@ public:
@param len number of samples to write.
@param underrun Set if LMS does not have data to transmit, e.g. data not being sent fast enough
@param timestamp The timestamp of the first sample of the data buffer.
- @param isControl Set if data is a control packet, e.g. a ping command
@return The number of samples actually written
*/
int writeSamples(std::vector < short *>&bufs, int len, bool * underrun,
- TIMESTAMP timestamp = 0xffffffff, bool isControl =
- false);
+ TIMESTAMP timestamp = 0xffffffff);
/** Update the alignment between the read and write timestamps */
bool updateAlignment(TIMESTAMP timestamp);
diff --git a/Transceiver52M/device/uhd/UHDDevice.cpp b/Transceiver52M/device/uhd/UHDDevice.cpp
index ddb6631..ad56250 100644
--- a/Transceiver52M/device/uhd/UHDDevice.cpp
+++ b/Transceiver52M/device/uhd/UHDDevice.cpp
@@ -804,7 +804,7 @@ int uhd_device::readSamples(std::vector<short *> &bufs, int len, bool *overrun,
}
int uhd_device::writeSamples(std::vector<short *> &bufs, int len, bool *underrun,
- unsigned long long timestamp,bool isControl)
+ unsigned long long timestamp)
{
uhd::tx_metadata_t metadata;
metadata.has_time_spec = true;
@@ -814,12 +814,6 @@ int uhd_device::writeSamples(std::vector<short *> &bufs, int len, bool *underrun
*underrun = false;
- // No control packets
- if (isControl) {
- LOGC(DDEV, ERROR) << "Control packets not supported";
- return 0;
- }
-
if (bufs.size() != chans) {
LOGC(DDEV, ALERT) << "Invalid channel combination " << bufs.size();
return -1;
diff --git a/Transceiver52M/device/uhd/UHDDevice.h b/Transceiver52M/device/uhd/UHDDevice.h
index 4809b25..1e66246 100644
--- a/Transceiver52M/device/uhd/UHDDevice.h
+++ b/Transceiver52M/device/uhd/UHDDevice.h
@@ -77,7 +77,7 @@ public:
TIMESTAMP timestamp, bool *underrun);
int writeSamples(std::vector<short *> &bufs, int len, bool *underrun,
- TIMESTAMP timestamp, bool isControl);
+ TIMESTAMP timestamp);
bool updateAlignment(TIMESTAMP timestamp);
diff --git a/Transceiver52M/device/usrp1/USRPDevice.cpp b/Transceiver52M/device/usrp1/USRPDevice.cpp
index 5eaca07..1a9a7e1 100644
--- a/Transceiver52M/device/usrp1/USRPDevice.cpp
+++ b/Transceiver52M/device/usrp1/USRPDevice.cpp
@@ -515,9 +515,8 @@ int USRPDevice::readSamples(std::vector<short *> &bufs, int len, bool *overrun,
#endif
}
-int USRPDevice::writeSamples(std::vector<short *> &bufs, int len,
- bool *underrun, unsigned long long timestamp,
- bool isControl)
+int USRPDevice::writeSamplesControl(std::vector<short *> &bufs, int len,
+ bool *underrun, unsigned long long timestamp, bool isControl)
{
writeLock.lock();
@@ -571,6 +570,12 @@ int USRPDevice::writeSamples(std::vector<short *> &bufs, int len,
#endif
}
+int USRPDevice::writeSamples(std::vector<short *> &bufs, int len,
+ bool *underrun, unsigned long long timestamp)
+{
+ return writeSamplesControl(bufs, len, underrun, timestamp, false);
+}
+
bool USRPDevice::updateAlignment(TIMESTAMP timestamp)
{
#ifndef SWLOOPBACK
@@ -580,7 +585,7 @@ bool USRPDevice::updateAlignment(TIMESTAMP timestamp)
bool tmpUnderrun;
std::vector<short *> buf(1, data);
- if (writeSamples(buf, 1, &tmpUnderrun, timestamp & 0x0ffffffffll, true)) {
+ if (writeSamplesControl(buf, 1, &tmpUnderrun, timestamp & 0x0ffffffffll, true)) {
pingTimestamp = timestamp;
return true;
}
diff --git a/Transceiver52M/device/usrp1/USRPDevice.h b/Transceiver52M/device/usrp1/USRPDevice.h
index 0cf5ec3..a4a0886 100644
--- a/Transceiver52M/device/usrp1/USRPDevice.h
+++ b/Transceiver52M/device/usrp1/USRPDevice.h
@@ -82,6 +82,9 @@ private:
double rxGain;
double txGain;
+ int writeSamplesControl(std::vector<short *> &bufs, int len, bool *underrun,
+ TIMESTAMP timestamp = 0xffffffff, bool isControl = false);
+
#ifdef SWLOOPBACK
short loopbackBuffer[1000000];
int loopbackBufferSize;
@@ -127,11 +130,10 @@ private:
@param len number of samples to write.
@param underrun Set if USRP does not have data to transmit, e.g. data not being sent fast enough
@param timestamp The timestamp of the first sample of the data buffer.
- @param isControl Set if data is a control packet, e.g. a ping command
@return The number of samples actually written
*/
int writeSamples(std::vector<short *> &bufs, int len, bool *underrun,
- TIMESTAMP timestamp = 0xffffffff, bool isControl = false);
+ TIMESTAMP timestamp = 0xffffffff);
/** Update the alignment between the read and write timestamps */
bool updateAlignment(TIMESTAMP timestamp);