diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-04-29 17:46:34 +0200 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-05-03 13:50:50 +0200 |
commit | 87b7d098e517470fec53ac13a28d1d0fa7b16bb4 (patch) | |
tree | 8e3a5689c17fe21ad891a8fe83ec448167d69aa7 /Transceiver52M | |
parent | 7bef2346c41d2e02d221a7f501a295bd5cbbbc9b (diff) |
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
Diffstat (limited to 'Transceiver52M')
-rw-r--r-- | Transceiver52M/device/uhd/UHDDevice.cpp | 2 | ||||
-rw-r--r-- | Transceiver52M/device/uhd/smpl_buf.cpp | 21 | ||||
-rw-r--r-- | 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<short *> &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="<<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 @@ ssize_t smpl_buf::write(void *buf, size_t len, TIMESTAMP timestamp) 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 @@ 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 |