device: Drop unused numberRead/numberWritten APIs

It's really not used, so let's drop unused code and simplify work for
new to come device drivers implementation.

Change-Id: I0d18f9c2584771e2f7b3d5c6b016e764e02855ff
This commit is contained in:
Pau Espin 2019-04-30 19:01:37 +02:00
parent 51509b3895
commit 7214fde085
7 changed files with 1 additions and 33 deletions

View File

@ -238,8 +238,6 @@ int LMSDevice::open(const std::string &args, int ref, bool swap_channels)
goto out_close; goto out_close;
} }
samplesRead = 0;
samplesWritten = 0;
started = false; started = false;
return NORMAL; return NORMAL;
@ -630,8 +628,6 @@ int LMSDevice::readSamples(std::vector < short *>&bufs, int len, bool * overrun,
thread_enable_cancel(true); thread_enable_cancel(true);
} }
samplesRead += rc;
if (((TIMESTAMP) rx_metadata.timestamp) < timestamp) if (((TIMESTAMP) rx_metadata.timestamp) < timestamp)
rc = 0; rc = 0;
@ -678,8 +674,6 @@ int LMSDevice::writeSamples(std::vector < short *>&bufs, int len,
thread_enable_cancel(true); thread_enable_cancel(true);
} }
samplesWritten += rc;
return rc; return rc;
} }

View File

@ -55,9 +55,6 @@ private:
double actualSampleRate; ///< the actual USRP sampling rate double actualSampleRate; ///< the actual USRP sampling rate
unsigned long long samplesRead; ///< number of samples read from LMS
unsigned long long samplesWritten; ///< number of samples sent to LMS
bool started; ///< flag indicates LMS has started bool started; ///< flag indicates LMS has started
bool skipRx; ///< set if LMS is transmit-only. bool skipRx; ///< set if LMS is transmit-only.
@ -203,12 +200,6 @@ public:
inline double getSampleRate() { inline double getSampleRate() {
return actualSampleRate; return actualSampleRate;
} }
inline double numberRead() {
return samplesRead;
}
inline double numberWritten() {
return samplesWritten;
}
}; };
#endif // _LMS_DEVICE_H_ #endif // _LMS_DEVICE_H_

View File

@ -161,8 +161,6 @@ class RadioDevice {
virtual double getTxFreq(size_t chan = 0) = 0; virtual double getTxFreq(size_t chan = 0) = 0;
virtual double getRxFreq(size_t chan = 0) = 0; virtual double getRxFreq(size_t chan = 0) = 0;
virtual double getSampleRate()=0; virtual double getSampleRate()=0;
virtual double numberRead()=0;
virtual double numberWritten()=0;
protected: protected:
size_t tx_sps, rx_sps; size_t tx_sps, rx_sps;

View File

@ -165,7 +165,7 @@ uhd_device::uhd_device(size_t tx_sps, size_t rx_sps,
tx_gain_min(0.0), tx_gain_max(0.0), tx_gain_min(0.0), tx_gain_max(0.0),
rx_gain_min(0.0), rx_gain_max(0.0), rx_gain_min(0.0), rx_gain_max(0.0),
tx_spp(0), rx_spp(0), tx_spp(0), rx_spp(0),
started(false), aligned(false), rx_pkt_cnt(0), drop_cnt(0), started(false), aligned(false), drop_cnt(0),
prev_ts(0,0), ts_initial(0), ts_offset(0), async_event_thrd(NULL) prev_ts(0,0), ts_initial(0), ts_offset(0), async_event_thrd(NULL)
{ {
} }
@ -725,8 +725,6 @@ int uhd_device::readSamples(std::vector<short *> &bufs, int len, bool *overrun,
metadata, 0.1, true); metadata, 0.1, true);
thread_enable_cancel(true); thread_enable_cancel(true);
rx_pkt_cnt++;
// Check for errors // Check for errors
rc = check_rx_md_err(metadata, num_smpls); rc = check_rx_md_err(metadata, num_smpls);
switch (rc) { switch (rc) {

View File

@ -112,8 +112,6 @@ public:
GSM::Time minLatency(); GSM::Time minLatency();
inline double getSampleRate() { return tx_rate; } inline double getSampleRate() { return tx_rate; }
inline double numberRead() { return rx_pkt_cnt; }
inline double numberWritten() { return 0; }
/** Receive and process asynchronous message /** Receive and process asynchronous message
@return true if message received or false on timeout or error @return true if message received or false on timeout or error
@ -146,7 +144,6 @@ private:
bool started; bool started;
bool aligned; bool aligned;
size_t rx_pkt_cnt;
size_t drop_cnt; size_t drop_cnt;
uhd::time_spec_t prev_ts; uhd::time_spec_t prev_ts;

View File

@ -173,8 +173,6 @@ int USRPDevice::open(const std::string &, int, bool)
m_dbTx = m_uTx->selected_subdev(txSubdevSpec); m_dbTx = m_uTx->selected_subdev(txSubdevSpec);
m_dbRx = m_uRx->selected_subdev(rxSubdevSpec); m_dbRx = m_uRx->selected_subdev(rxSubdevSpec);
samplesRead = 0;
samplesWritten = 0;
started = false; started = false;
return NORMAL; return NORMAL;
@ -505,7 +503,6 @@ int USRPDevice::readSamples(std::vector<short *> &bufs, int len, bool *overrun,
gettimeofday(&lastReadTime,NULL); gettimeofday(&lastReadTime,NULL);
firstRead = true; firstRead = true;
} }
samplesRead += numSamples;
return numSamples; return numSamples;
#endif #endif
@ -555,14 +552,12 @@ int USRPDevice::writeSamples(std::vector<short *> &bufs, int len,
} }
m_uTx->write((const void*) outPkt,sizeof(uint32_t)*128*numPkts,NULL); m_uTx->write((const void*) outPkt,sizeof(uint32_t)*128*numPkts,NULL);
samplesWritten += len/2/sizeof(short);
writeLock.unlock(); writeLock.unlock();
return len/2/sizeof(short); return len/2/sizeof(short);
#else #else
int retVal = len; int retVal = len;
memcpy(loopbackBuffer+loopbackBufferSize,buf,sizeof(short)*2*len); memcpy(loopbackBuffer+loopbackBufferSize,buf,sizeof(short)*2*len);
samplesWritten += retVal;
loopbackBufferSize += retVal*2; loopbackBufferSize += retVal*2;
return retVal; return retVal;

View File

@ -51,9 +51,6 @@ private:
double actualSampleRate; ///< the actual USRP sampling rate double actualSampleRate; ///< the actual USRP sampling rate
unsigned int decimRate; ///< the USRP decimation rate unsigned int decimRate; ///< the USRP decimation rate
unsigned long long samplesRead; ///< number of samples read from USRP
unsigned long long samplesWritten; ///< number of samples sent to USRP
bool started; ///< flag indicates USRP has started bool started; ///< flag indicates USRP has started
static const unsigned int currDataSize_log2 = 21; static const unsigned int currDataSize_log2 = 21;
@ -201,8 +198,6 @@ private:
inline double getTxFreq(size_t chan = 0) { return 0; } inline double getTxFreq(size_t chan = 0) { return 0; }
inline double getRxFreq(size_t chan = 0) { return 0; } inline double getRxFreq(size_t chan = 0) { return 0; }
inline double getSampleRate() { return actualSampleRate; } inline double getSampleRate() { return actualSampleRate; }
inline double numberRead() { return samplesRead; }
inline double numberWritten() { return samplesWritten; }
}; };
#endif // _USRP_DEVICE_H_ #endif // _USRP_DEVICE_H_