From dfc6e5ffc786756bded94ea06eb2502720b28839 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Thu, 12 Mar 2020 19:35:33 +0100 Subject: [PATCH] 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 --- Transceiver52M/device/common/radioDevice.h | 3 +-- Transceiver52M/device/lms/LMSDevice.cpp | 8 +------- Transceiver52M/device/lms/LMSDevice.h | 4 +--- Transceiver52M/device/uhd/UHDDevice.cpp | 8 +------- Transceiver52M/device/uhd/UHDDevice.h | 2 +- Transceiver52M/device/usrp1/USRPDevice.cpp | 13 +++++++++---- Transceiver52M/device/usrp1/USRPDevice.h | 6 ++++-- 7 files changed, 18 insertions(+), 26 deletions(-) diff --git a/Transceiver52M/device/common/radioDevice.h b/Transceiver52M/device/common/radioDevice.h index c504b3ac..0dc38d5a 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 &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 0cd80028..932817d2 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 c2fd2f65..5b6330ab 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 ddb6631f..ad562500 100644 --- a/Transceiver52M/device/uhd/UHDDevice.cpp +++ b/Transceiver52M/device/uhd/UHDDevice.cpp @@ -804,7 +804,7 @@ int uhd_device::readSamples(std::vector &bufs, int len, bool *overrun, } int uhd_device::writeSamples(std::vector &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 &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 4809b255..1e66246c 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 &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 5eaca07e..1a9a7e11 100644 --- a/Transceiver52M/device/usrp1/USRPDevice.cpp +++ b/Transceiver52M/device/usrp1/USRPDevice.cpp @@ -515,9 +515,8 @@ int USRPDevice::readSamples(std::vector &bufs, int len, bool *overrun, #endif } -int USRPDevice::writeSamples(std::vector &bufs, int len, - bool *underrun, unsigned long long timestamp, - bool isControl) +int USRPDevice::writeSamplesControl(std::vector &bufs, int len, + bool *underrun, unsigned long long timestamp, bool isControl) { writeLock.lock(); @@ -571,6 +570,12 @@ int USRPDevice::writeSamples(std::vector &bufs, int len, #endif } +int USRPDevice::writeSamples(std::vector &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 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 0cf5ec36..a4a0886a 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 &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 &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);