Harald Welte has uploaded this change for review. ( 
https://gerrit.osmocom.org/9621


Change subject: radioDevice: Move tx_sps from derived into base class
......................................................................

radioDevice: Move tx_sps from derived into base class

All three derived classes use a tx_sps member, let's move this into
the base class.

Change-Id: I73b4aa2705c5049561e2d7b21301a0d2b3c96ced
---
M Transceiver52M/device/lms/LMSDevice.cpp
M Transceiver52M/device/lms/LMSDevice.h
M Transceiver52M/device/radioDevice.h
M Transceiver52M/device/uhd/UHDDevice.cpp
M Transceiver52M/device/usrp1/USRPDevice.cpp
M Transceiver52M/device/usrp1/USRPDevice.h
6 files changed, 18 insertions(+), 17 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/21/9621/1

diff --git a/Transceiver52M/device/lms/LMSDevice.cpp 
b/Transceiver52M/device/lms/LMSDevice.cpp
index 518e581..68d4b97 100644
--- a/Transceiver52M/device/lms/LMSDevice.cpp
+++ b/Transceiver52M/device/lms/LMSDevice.cpp
@@ -40,13 +40,14 @@
 #define LMS_MIN_BW_SUPPORTED 2.5e6 /* 2.5mHz, minimum supported by LMS */
 #define LMS_CALIBRATE_BW_HZ OSMO_MAX(GSM_CARRIER_BW, LMS_MIN_BW_SUPPORTED)

-LMSDevice::LMSDevice(size_t sps, size_t chans,
+LMSDevice::LMSDevice(size_t tx_sps, size_t chans,
                     const std::vector<std::string>& tx_paths,
                     const std::vector<std::string>& rx_paths):
-       m_lms_dev(NULL), sps(sps), chans(chans)
+       m_lms_dev(NULL), chans(chans)
 {
        LOG(INFO) << "creating LMS device...";

+       this->tx_sps = tx_sps;
        this->tx_paths = tx_paths;
        this->rx_paths = rx_paths;

@@ -135,8 +136,8 @@
                goto out_close;
        print_range("Sample Rate", &range_sr);

-       LOG(DEBUG) << "Setting sample rate to " << GSMRATE*sps << " " << sps;
-       if (LMS_SetSampleRate(m_lms_dev, GSMRATE*sps, 32) < 0)
+       LOG(DEBUG) << "Setting sample rate to " << GSMRATE*tx_sps << " " << 
tx_sps;
+       if (LMS_SetSampleRate(m_lms_dev, GSMRATE*tx_sps, 32) < 0)
                goto out_close;

        if (LMS_GetSampleRate(m_lms_dev, LMS_CH_RX, 0, &sr_host, &sr_rf))
@@ -144,7 +145,7 @@
        LOG(DEBUG) << "Sample Rate: Host=" << sr_host << " RF=" << sr_rf;

        /* FIXME: make this device/model dependent, like 
UHDDevice:dev_param_map! */
-       ts_offset = static_cast<TIMESTAMP>(8.9e-5 * GSMRATE * sps); /* time * 
sample_rate */
+       ts_offset = static_cast<TIMESTAMP>(8.9e-5 * GSMRATE * tx_sps); /* time 
* sample_rate */

        switch (ref) {
        case REF_INTERNAL:
@@ -362,7 +363,7 @@
 bool LMSDevice::flush_recv(size_t num_pkts)
 {
        #define CHUNK 625
-       int len = CHUNK * sps;
+       int len = CHUNK * tx_sps;
        short *buffer = new short[len * 2];
        int rc;
        lms_stream_meta_t rx_metadata = {};
diff --git a/Transceiver52M/device/lms/LMSDevice.h 
b/Transceiver52M/device/lms/LMSDevice.h
index ef6d2b4..0fe4c15 100644
--- a/Transceiver52M/device/lms/LMSDevice.h
+++ b/Transceiver52M/device/lms/LMSDevice.h
@@ -46,7 +46,7 @@
        std::vector<uint32_t> m_last_tx_underruns;
        std::vector<uint32_t> m_last_tx_overruns;

-       size_t sps, chans;
+       size_t chans;
        double actualSampleRate;        ///< the actual USRP sampling rate

        unsigned long long samplesRead; ///< number of samples read from LMS
@@ -65,7 +65,7 @@
 public:

        /** Object constructor */
-       LMSDevice(size_t sps, size_t chans,
+       LMSDevice(size_t tx_sps, size_t chans,
                  const std::vector<std::string>& tx_paths,
                  const std::vector<std::string>& rx_paths);

diff --git a/Transceiver52M/device/radioDevice.h 
b/Transceiver52M/device/radioDevice.h
index 469b574..a9328ec 100644
--- a/Transceiver52M/device/radioDevice.h
+++ b/Transceiver52M/device/radioDevice.h
@@ -165,6 +165,7 @@
   virtual double numberWritten()=0;

   std::vector<std::string> tx_paths, rx_paths;
+  size_t tx_sps;
   bool set_antennas() {
        unsigned int i;

diff --git a/Transceiver52M/device/uhd/UHDDevice.cpp 
b/Transceiver52M/device/uhd/UHDDevice.cpp
index 77a3446..ddcad3a 100644
--- a/Transceiver52M/device/uhd/UHDDevice.cpp
+++ b/Transceiver52M/device/uhd/UHDDevice.cpp
@@ -282,7 +282,7 @@
        enum TxWindowType tx_window;
        enum uhd_dev_type dev_type;

-       size_t tx_sps, rx_sps, chans;
+       size_t rx_sps, chans;
        double tx_rate, rx_rate;

        double tx_gain_min, tx_gain_max;
diff --git a/Transceiver52M/device/usrp1/USRPDevice.cpp 
b/Transceiver52M/device/usrp1/USRPDevice.cpp
index 7f73f43..07ba1c9 100644
--- a/Transceiver52M/device/usrp1/USRPDevice.cpp
+++ b/Transceiver52M/device/usrp1/USRPDevice.cpp
@@ -58,12 +58,12 @@

 const double USRPDevice::masterClockRate = 52.0e6;

-USRPDevice::USRPDevice(size_t sps)
+USRPDevice::USRPDevice(size_t tx_sps)
 {
   LOG(INFO) << "creating USRP device...";

-  this->sps = sps;
-  decimRate = (unsigned int) round(masterClockRate/((GSMRATE) * (double) sps));
+  this->tx_sps = tx_sps;
+  decimRate = (unsigned int) round(masterClockRate/((GSMRATE) * (double) 
tx_sps));
   actualSampleRate = masterClockRate/decimRate;
   rxGain = 0;

@@ -73,9 +73,9 @@
    * split sample rate Tx/Rx - 4/1 sps we need to need to
    * compensate for advance rather than delay.
    */
-  if (sps == 1)
+  if (tx_sps == 1)
     pingOffset = 272;
-  else if (sps == 4)
+  else if (tx_sps == 4)
     pingOffset = 269 - 7500;
   else
     pingOffset = 0;
@@ -100,7 +100,7 @@
   if (!skipRx) {
   try {
     m_uRx = usrp_standard_rx_sptr(usrp_standard_rx::make(
-                                        0, decimRate * sps, 1, -1,
+                                        0, decimRate * tx_sps, 1, -1,
                                         usrp_standard_rx::FPGA_MODE_NORMAL,
                                         1024, 16 * 8, rbf));
     m_uRx->set_fpga_master_clock_freq(masterClockRate);
diff --git a/Transceiver52M/device/usrp1/USRPDevice.h 
b/Transceiver52M/device/usrp1/USRPDevice.h
index efdedb3..ff5b273 100644
--- a/Transceiver52M/device/usrp1/USRPDevice.h
+++ b/Transceiver52M/device/usrp1/USRPDevice.h
@@ -48,7 +48,6 @@
   usrp_subdev_spec rxSubdevSpec;
   usrp_subdev_spec txSubdevSpec;

-  int sps;
   double actualSampleRate;     ///< the actual USRP sampling rate
   unsigned int decimRate;      ///< the USRP decimation rate

@@ -96,7 +95,7 @@
  public:

   /** Object constructor */
-  USRPDevice(size_t sps);
+  USRPDevice(size_t tx_sps);

   /** Instantiate the USRP */
   int open(const std::string &, int, bool);

--
To view, visit https://gerrit.osmocom.org/9621
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I73b4aa2705c5049561e2d7b21301a0d2b3c96ced
Gerrit-Change-Number: 9621
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <[email protected]>

Reply via email to