From 281f874ec31e7fcfabb4661dbdf1de6edd137cff Mon Sep 17 00:00:00 2001 From: Alexander Hurd Date: Sun, 17 Jun 2018 20:18:20 -0400 Subject: [PATCH] adding write function stubs --- SoapySidekiq.hpp | 19 ++++++++++++++++++- Streaming.cpp | 46 ++++++++++++++++++++++++++++++++++++---------- 2 files changed, 54 insertions(+), 11 deletions(-) diff --git a/SoapySidekiq.hpp b/SoapySidekiq.hpp index a432616..2e8fdff 100644 --- a/SoapySidekiq.hpp +++ b/SoapySidekiq.hpp @@ -16,7 +16,6 @@ #include #include - #define DEFAULT_BUFFER_LENGTH (65536) #define DEFAULT_NUM_BUFFERS (8) #define DEFAULT_ELEMS_PER_SAMPLE (2) @@ -74,6 +73,13 @@ class SoapySidekiq : public SoapySDR::Device { long long &timeNs, const long timeoutUs = 100000); + int writeStream(SoapySDR::Stream *stream, + const void *const *buffs, + const size_t numElems, + int &flags, + const long long timeNs = 0, + const long timeoutUs = 100000); + /******************************************************************* * Direct buffer access API ******************************************************************/ @@ -91,6 +97,17 @@ class SoapySidekiq : public SoapySDR::Device { void releaseReadBuffer(SoapySDR::Stream *stream, const size_t handle); + int acquireWriteBuffer(SoapySDR::Stream *stream, + size_t &handle, + void **buffs, + const long timeoutUs = 100000); + + void releaseWriteBuffer(SoapySDR::Stream *stream, + const size_t handle, + const size_t numElems, + int &flags, + const long long timeNs = 0); + /******************************************************************* * Antenna API ******************************************************************/ diff --git a/Streaming.cpp b/Streaming.cpp index 8cd83ee..15de244 100644 --- a/Streaming.cpp +++ b/Streaming.cpp @@ -110,24 +110,24 @@ void SoapySidekiq::rx_receive_operation(void) { int16_t *dptr = buff.data(); dptr += (buff.size() - space_req); for (i = 0; i < (num_samples / elementsPerSample); i++) { - if (iq_swap) { - dptr[i * 2] = p_rx_block->data[i * 2 + 1]; // I - dptr[i * 2 + 1] = p_rx_block->data[i * 2]; // Q + if (!iq_swap) { + *dptr++ = p_rx_block->data[i * 2 + 1]; // I + *dptr++ = p_rx_block->data[i * 2]; // Q } else { - dptr[i * 2] = p_rx_block->data[i * 2]; // Q - dptr[i * 2 + 1] = p_rx_block->data[i * 2 + 1]; // I + *dptr++ = p_rx_block->data[i * 2]; // Q + *dptr++ = p_rx_block->data[i * 2 + 1]; // I } } } else { // float float *dptr = (float *) buff.data(); dptr += ((buff.size() - space_req) / shortsPerWord); for (i = 0; i < (num_samples / elementsPerSample); i++) { - if (iq_swap) { - dptr[i * 2] = (float)p_rx_block->data[i * 2 + 1] / 32768.0f ; // I - dptr[i * 2 + 1] = (float)p_rx_block->data[i * 2]/ 32768.0f; // Q + if (!iq_swap) { + *dptr++ = (float) p_rx_block->data[i * 2 + 1] / 32768.0f; // I + *dptr++ = (float) p_rx_block->data[i * 2] / 32768.0f; // Q } else { - dptr[i * 2] = (float)p_rx_block->data[i * 2] / 32768.0f ; // Q - dptr[i * 2 + 1] = (float)p_rx_block->data[i * 2 + 1] / 32768.0f; // I + *dptr++ = (float) p_rx_block->data[i * 2] / 32768.0f; // Q + *dptr++ = (float) p_rx_block->data[i * 2 + 1] / 32768.0f; // I } } } @@ -302,6 +302,15 @@ int SoapySidekiq::readStream(SoapySDR::Stream *stream, return returnedElems; } +int SoapySidekiq::writeStream(SoapySDR::Stream *stream, + const void *const *buffs, + const size_t numElems, + int &flags, + const long long timeNs, + const long timeoutUs) { +return -1; +} + /******************************************************************* * Direct buffer access API ******************************************************************/ @@ -369,3 +378,20 @@ void SoapySidekiq::releaseReadBuffer(SoapySDR::Stream *stream, const size_t hand _buffs[handle].clear(); _buf_count--; } + +int SoapySidekiq::acquireWriteBuffer(SoapySDR::Stream *stream, + size_t &handle, + void **buffs, + const long timeoutUs) { + + return -1; + +} + +void SoapySidekiq::releaseWriteBuffer(SoapySDR::Stream *stream, + const size_t handle, + const size_t numElems, + int &flags, + const long long timeNs) { + +} \ No newline at end of file