From 87b7d098e517470fec53ac13a28d1d0fa7b16bb4 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Mon, 29 Apr 2019 17:46:34 +0200 Subject: 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 --- Transceiver52M/device/uhd/UHDDevice.cpp | 2 +- Transceiver52M/device/uhd/smpl_buf.cpp | 21 ++------------------- Transceiver52M/device/uhd/smpl_buf.h | 6 +----- 3 files changed, 4 insertions(+), 25 deletions(-) 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 @@ int uhd_device::readSamples(std::vector &bufs, int len, bool *overrun, 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 @@ ssize_t smpl_buf::avail_smpls(TIMESTAMP timestamp) const 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 @@ ssize_t smpl_buf::read(void *buf, size_t len, TIMESTAMP timestamp) 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 @@ ssize_t smpl_buf::write(void *buf, size_t len, TIMESTAMP timestamp) if (timestamp < time_end) { LOGC(DDEV, ERR) << "Overwriting old buffer data: timestamp="< -#include #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 @@ public: @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 @@ public: @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 -- cgit v1.2.3