31 m_nbChannels(nbChannels),
32 m_uniqueChannelIndex(uniqueChannelIndex)
34 qDebug(
"XTRXOutputThread::XTRXOutputThread: nbChannels: %u uniqueChannelIndex: %u", nbChannels, uniqueChannelIndex);
40 qDebug(
"XTRXOutputThread::~XTRXOutputThread");
69 unsigned int fifoCount = 0;
71 for (
unsigned int i = 0;
i < 2;
i++)
124 xtrx_run_params params;
125 xtrx_run_params_init(¶ms);
127 params.dir = XTRX_TX;
128 params.tx_repeat_buf = 0;
130 params.tx.chs = XTRX_CH_AB;
131 params.tx.wfmt = XTRX_WF_16;
132 params.tx.hfmt = XTRX_IQ_INT16;
133 params.tx.flags |= XTRX_RSP_SWAP_IQ;
138 params.tx.flags |= XTRX_RSP_SISO_MODE;
141 params.tx.flags |= XTRX_RSP_SWAP_AB;
145 res = xtrx_run_ex(
m_dev, ¶ms);
149 qCritical(
"XTRXOutputThread::run: could not start stream err:%d", res);
154 std::this_thread::sleep_for(std::chrono::milliseconds(50));
155 qDebug(
"XTRXOutputThread::run: stream started");
158 const unsigned int elemSize = 4;
161 master_ts ts = 4096*1024;
164 buffs[
i] = buffMem[
i].data();
167 xtrx_send_ex_info_t nfo;
170 nfo.buffers = (
void*
const*) buffs.data();
171 nfo.flags = XTRX_TX_DONT_BUFFER;
173 nfo.out_txlatets = 0;
185 res = xtrx_send_sync_ex(
m_dev, &nfo);
189 qCritical(
"XTRXOutputThread::run send error: %d", res);
190 qDebug(
"XTRXOutputThread::run: out_samples: %u out_flags: %u", nfo.out_samples, nfo.out_flags);
194 if (nfo.out_flags & XTRX_TX_DISCARDED_TO) {
195 qDebug(
"XTRXOutputThread::run: underrun");
198 if (nfo.out_txlatets) {
199 qDebug(
"XTRXOutputThread::run: out_txlatets: %lu", nfo.out_txlatets);
205 res = xtrx_stop(
m_dev, XTRX_TX);
209 qCritical(
"XTRXOutputThread::run: could not stop stream");
213 std::this_thread::sleep_for(std::chrono::milliseconds(50));
214 qDebug(
"XTRXOutputThread::run: stream stopped");
219 qWarning(
"XTRXOutputThread::run: no channels or FIFO allocated. Aborting");
232 qDebug(
"XTRXOutputThread::callbackSO: read lags: %f", bal);
233 }
else if (bal > 0.25) {
234 qDebug(
"XTRXOutputThread::callbackSO: read leads: %f", bal);
237 SampleVector::iterator beginRead;
274 std::fill(buf, buf+2*len, 0);
285 qDebug(
"XTRXOutputThread::callbackSO: read lags: %f", bal);
286 }
else if (bal > 0.25) {
287 qDebug(
"XTRXOutputThread::callbackSO: read leads: %f", bal);
290 SampleVector::iterator beginRead;
327 std::fill(buf, buf+2*len, 0);
unsigned int getLog2Interpolation(unsigned int channel) const
void interpolate64_cen(SampleVector::iterator *it, T *buf, qint32 len, bool invertIQ=false)
float getRWBalance() const
void callbackSO(qint16 *buf, qint32 len)
void interpolate32_cen(SampleVector::iterator *it, T *buf, qint32 len, bool invertIQ=false)
unsigned int m_nbChannels
Channel * m_channels
Array of channels dynamically allocated for the given number of Rx channels.
void interpolate8_cen(SampleVector::iterator *it, T *buf, qint32 len, bool invertIQ=false)
void callback(qint16 *buf, qint32 len)
void interpolate2_cen(SampleVector::iterator *it, T *buf, qint32 len, bool invertIQ=false)
SampleSourceFifo * getFifo(unsigned int channel)
void setFifo(unsigned int channel, SampleSourceFifo *sampleFifo)
void readAdvance(SampleVector::iterator &readUntil, unsigned int nbSamples)
XTRXOutputThread(struct xtrx_dev *dev, unsigned int nbChannels, unsigned int uniqueChannelIndex=0, QObject *parent=0)
SampleSourceFifo * m_sampleFifo
static const unsigned int blockSize
Interpolators< qint16, SDR_TX_SAMP_SZ, 12 > m_interpolators
unsigned int getNbFifos()
void interpolate1(SampleVector::iterator *it, T *buf, qint32 len, bool invertIQ=false)
void interpolate16_cen(SampleVector::iterator *it, T *buf, qint32 len, bool invertIQ=false)
void interpolate4_cen(SampleVector::iterator *it, T *buf, qint32 len, bool invertIQ=false)
unsigned int m_uniqueChannelIndex
void callbackMO(qint16 *buf0, qint16 *buf1, qint32 len)
void setLog2Interpolation(unsigned int channel, unsigned int log2_interp)
unsigned int m_log2Interp
QWaitCondition m_startWaiter