Skip to content

Commit

Permalink
adding write function stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
hurdad committed Jun 18, 2018
1 parent a0f059b commit 281f874
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 11 deletions.
19 changes: 18 additions & 1 deletion SoapySidekiq.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
#include <SoapySDR/Logger.hpp>
#include <SoapySDR/Types.hpp>


#define DEFAULT_BUFFER_LENGTH (65536)
#define DEFAULT_NUM_BUFFERS (8)
#define DEFAULT_ELEMS_PER_SAMPLE (2)
Expand Down Expand Up @@ -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
******************************************************************/
Expand All @@ -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
******************************************************************/
Expand Down
46 changes: 36 additions & 10 deletions Streaming.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
}
Expand Down Expand Up @@ -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
******************************************************************/
Expand Down Expand Up @@ -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) {

}

0 comments on commit 281f874

Please sign in to comment.