Change in osmo-trx[master]: uhd: smpl_buf: Drop UHD specifics out back to UHDDevice

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Fri May 3 18:26:13 UTC 2019


Pau Espin Pedrol has submitted this change and it was merged. ( https://gerrit.osmocom.org/13810 )

Change subject: uhd: smpl_buf: Drop UHD specifics out back to UHDDevice
......................................................................

uhd: smpl_buf: Drop UHD specifics out back to UHDDevice

This way smpl_buf can be re-used later by other non-UHD drivers.

Change-Id: I94061328d46a550d4147121d85baffa29c700c45
---
M Transceiver52M/device/uhd/UHDDevice.cpp
M Transceiver52M/device/uhd/smpl_buf.cpp
M Transceiver52M/device/uhd/smpl_buf.h
3 files changed, 4 insertions(+), 25 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved
  tnt: Looks good to me, but someone else must approve
  Vadim Yanitskiy: Looks good to me, but someone else must approve



diff --git a/Transceiver52M/device/uhd/UHDDevice.cpp b/Transceiver52M/device/uhd/UHDDevice.cpp
index 67b7416..40ef2a0 100644
--- a/Transceiver52M/device/uhd/UHDDevice.cpp
+++ b/Transceiver52M/device/uhd/UHDDevice.cpp
@@ -759,7 +759,7 @@
 		for (size_t i = 0; i < rx_buffers.size(); i++) {
 			rc = rx_buffers[i]->write((short *) &pkt_bufs[i].front(),
 						  num_smpls,
-						  metadata.time_spec);
+						  metadata.time_spec.to_ticks(rx_rate));
 
 			// Continue on local overrun, exit on other errors
 			if ((rc < 0)) {
diff --git a/Transceiver52M/device/uhd/smpl_buf.cpp b/Transceiver52M/device/uhd/smpl_buf.cpp
index d8bdbc4..ae21369 100644
--- a/Transceiver52M/device/uhd/smpl_buf.cpp
+++ b/Transceiver52M/device/uhd/smpl_buf.cpp
@@ -47,11 +47,6 @@
 		return time_end - timestamp;
 }
 
-ssize_t smpl_buf::avail_smpls(uhd::time_spec_t timespec) const
-{
-	return avail_smpls(timespec.to_ticks(clk_rt));
-}
-
 ssize_t smpl_buf::read(void *buf, size_t len, TIMESTAMP timestamp)
 {
 	int type_sz = 2 * sizeof(short);
@@ -93,11 +88,6 @@
 		return num_smpls;
 }
 
-ssize_t smpl_buf::read(void *buf, size_t len, uhd::time_spec_t ts)
-{
-	return read(buf, len, ts.to_ticks(clk_rt));
-}
-
 ssize_t smpl_buf::write(void *buf, size_t len, TIMESTAMP timestamp)
 {
 	int type_sz = 2 * sizeof(short);
@@ -110,14 +100,12 @@
 
 	if (timestamp < time_end) {
 		LOGC(DDEV, ERR) << "Overwriting old buffer data: timestamp="<<timestamp<<" time_end="<<time_end;
-		uhd::time_spec_t ts = uhd::time_spec_t::from_ticks(timestamp, clk_rt);
-		LOGC(DDEV, DEBUG) << "Requested timestamp = " << timestamp << " (real_sec=" << std::fixed << ts.get_real_secs() << " = " << ts.to_ticks(clk_rt) << ") rate=" << clk_rt;
+		LOGC(DDEV, DEBUG) << "Requested timestamp = " << timestamp << " rate=" << clk_rt;
 		// Do not return error here, because it's a rounding error and is not fatal
 	}
 	if (timestamp > time_end && time_end != 0) {
 		LOGC(DDEV, ERR) << "Skipping buffer data: timestamp="<<timestamp<<" time_end="<<time_end;
-		uhd::time_spec_t ts = uhd::time_spec_t::from_ticks(timestamp, clk_rt);
-		LOGC(DDEV, DEBUG) << "Requested timestamp = " << timestamp << " (real_sec=" << std::fixed << ts.get_real_secs() << " = " << ts.to_ticks(clk_rt) << ") rate=" << clk_rt;
+		LOGC(DDEV, DEBUG) << "Requested timestamp = " << timestamp << " rate=" << clk_rt;
 		// Do not return error here, because it's a rounding error and is not fatal
 	}
 
@@ -150,11 +138,6 @@
 		return len;
 }
 
-ssize_t smpl_buf::write(void *buf, size_t len, uhd::time_spec_t ts)
-{
-	return write(buf, len, ts.to_ticks(clk_rt));
-}
-
 std::string smpl_buf::str_status(size_t ts) const
 {
 	std::ostringstream ost("Sample buffer: ");
diff --git a/Transceiver52M/device/uhd/smpl_buf.h b/Transceiver52M/device/uhd/smpl_buf.h
index 6af97c2..cb231d3 100644
--- a/Transceiver52M/device/uhd/smpl_buf.h
+++ b/Transceiver52M/device/uhd/smpl_buf.h
@@ -25,13 +25,12 @@
 #pragma once
 
 #include <unistd.h>
-#include <uhd/types/time_spec.hpp>
 
 #include "radioDevice.h"
 
 /*
     Sample Buffer - Allows reading and writing of timed samples using osmo-trx
-                    or UHD style timestamps. Time conversions are handled
+                    timestamps. Time conversions are handled
                     internally or accessable through the static convert calls.
 */
 class smpl_buf {
@@ -49,7 +48,6 @@
 	    @return number of available samples or error
 	*/
 	ssize_t avail_smpls(TIMESTAMP timestamp) const;
-	ssize_t avail_smpls(uhd::time_spec_t timestamp) const;
 
 	/** Read and write
 	    @param buf pointer to buffer
@@ -58,9 +56,7 @@
 	    @return number of actual samples read or written or error
 	*/
 	ssize_t read(void *buf, size_t len, TIMESTAMP timestamp);
-	ssize_t read(void *buf, size_t len, uhd::time_spec_t timestamp);
 	ssize_t write(void *buf, size_t len, TIMESTAMP timestamp);
-	ssize_t write(void *buf, size_t len, uhd::time_spec_t timestamp);
 
 	/** Buffer status string
 	    @return a formatted string describing internal buffer state

-- 
To view, visit https://gerrit.osmocom.org/13810
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I94061328d46a550d4147121d85baffa29c700c45
Gerrit-Change-Number: 13810
Gerrit-PatchSet: 3
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: tnt <tnt at 246tNt.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190503/1bccf01b/attachment.html>


More information about the gerrit-log mailing list