Change in osmo-trx[master]: radioInterface: Operate on real Tx power attenuation rather than on d...

2020-06-15 Thread pespin
pespin has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/18722 )

Change subject: radioInterface: Operate on real Tx power attenuation rather 
than on device specific gains
..

radioInterface: Operate on real Tx power attenuation rather than on device 
specific gains

All the Tx gain related APIs are left out of reach from radioInterface,
and in there we simply interact with radioDevice passing the attenuation
received from TRXC.

Prior gain logic is moved in base radiodevice class, with the idea that
the setTxGain() and related functions will be dropped over time in each
sublcass in favour of an specific implementation of the
SetPowerAttenuation API.

Change-Id: I4f8a1bcbed74aa9310306b97b0b1bfb02f7855e6
---
M Transceiver52M/device/common/radioDevice.h
M Transceiver52M/device/lms/LMSDevice.h
M Transceiver52M/device/uhd/UHDDevice.h
M Transceiver52M/device/usrp1/USRPDevice.h
M Transceiver52M/radioInterface.cpp
M Transceiver52M/radioInterface.h
M Transceiver52M/radioInterfaceMulti.cpp
7 files changed, 59 insertions(+), 61 deletions(-)

Approvals:
  Jenkins Builder: Verified
  neels: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved
  laforge: Looks good to me, but someone else must approve



diff --git a/Transceiver52M/device/common/radioDevice.h 
b/Transceiver52M/device/common/radioDevice.h
index 8dd8f49..e51527d 100644
--- a/Transceiver52M/device/common/radioDevice.h
+++ b/Transceiver52M/device/common/radioDevice.h
@@ -125,21 +125,9 @@
   /** return minimum Rx Gain **/
   virtual double minRxGain(void) = 0;

-  /** sets the transmit chan gain, returns the gain setting **/
-  virtual double setTxGain(double dB, size_t chan = 0) = 0;
-
   /** returns the Nominal transmit output power of the transceiver in dBm, 
negative on error **/
   virtual int getNominalTxPower(size_t chan = 0) = 0;

-  /** get transmit gain */
-  virtual double getTxGain(size_t chan = 0) = 0;
-
-  /** return maximum Tx Gain **/
-  virtual double maxTxGain(void) = 0;
-
-  /** return minimum Tx Gain **/
-  virtual double minTxGain(void) = 0;
-
   /** sets the RX path to use, returns true if successful and false otherwise 
*/
   virtual bool setRxAntenna(const std::string &ant, size_t chan = 0) = 0;

@@ -163,6 +151,18 @@
   virtual double getRxFreq(size_t chan = 0) = 0;
   virtual double getSampleRate()=0;

+  /* Default backward-compatible implementation based on TxGain APIs. New
+ implementations should be based on getNominalTxPower() once implemented 
for
+ the specific backend. */
+  virtual double setPowerAttenuation(int atten, size_t chan) {
+   double rfGain;
+   rfGain = setTxGain(maxTxGain() - atten, chan);
+   return maxTxGain() - rfGain;
+  }
+  virtual double getPowerAttenuation(size_t chan=0) {
+   return maxTxGain() - getTxGain(chan);
+  }
+
   protected:
   size_t tx_sps, rx_sps;
   InterfaceType iface;
@@ -171,6 +171,15 @@
   std::vector tx_paths, rx_paths;
   std::vector m_ctr;

+  /** sets the transmit chan gain, returns the gain setting **/
+  virtual double setTxGain(double dB, size_t chan = 0) = 0;
+
+  /** get transmit gain */
+  virtual double getTxGain(size_t chan = 0) = 0;
+
+  /** return maximum Tx Gain **/
+  virtual double maxTxGain(void) = 0;
+
   RadioDevice(size_t tx_sps, size_t rx_sps, InterfaceType type, size_t 
chan_num, double offset,
   const std::vector& tx_paths,
   const std::vector& rx_paths):
diff --git a/Transceiver52M/device/lms/LMSDevice.h 
b/Transceiver52M/device/lms/LMSDevice.h
index 78fd62a..c83fed2 100644
--- a/Transceiver52M/device/lms/LMSDevice.h
+++ b/Transceiver52M/device/lms/LMSDevice.h
@@ -77,6 +77,19 @@
void update_stream_stats_rx(size_t chan, bool *overrun);
void update_stream_stats_tx(size_t chan, bool *underrun);
bool do_clock_src_freq(enum ReferenceType ref, double freq);
+   /** sets the transmit chan gain, returns the gain setting **/
+   double setTxGain(double dB, size_t chan = 0);
+
+   /** get transmit gain */
+   double getTxGain(size_t chan = 0) {
+   return tx_gains[chan];
+   }
+
+   /** return maximum Tx Gain **/
+   double maxTxGain(void);
+
+   /** return minimum Rx Gain **/
+   double minTxGain(void);

 public:

@@ -165,20 +178,6 @@
/** return minimum Rx Gain **/
double minRxGain(void);

-   /** sets the transmit chan gain, returns the gain setting **/
-   double setTxGain(double dB, size_t chan = 0);
-
-   /** get transmit gain */
-   double getTxGain(size_t chan = 0) {
-   return tx_gains[chan];
-   }
-
-   /** return maximum Tx Gain **/
-   double maxTxGain(void);
-
-   /** return minimum Rx Gain **/
-   double minTxGain(void);
-
int getNominalTxPower(size_t chan = 0);

/** sets the RX path to use, returns true if successful and false 
otherwise */

Change in osmo-trx[master]: radioInterface: Operate on real Tx power attenuation rather than on d...

2020-06-15 Thread pespin
pespin has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/18722 )

Change subject: radioInterface: Operate on real Tx power attenuation rather 
than on device specific gains
..


Patch Set 3: Code-Review+2

+1+1=+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/18722
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I4f8a1bcbed74aa9310306b97b0b1bfb02f7855e6
Gerrit-Change-Number: 18722
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Hoernchen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: neels 
Gerrit-Reviewer: pespin 
Gerrit-Reviewer: roh 
Gerrit-Reviewer: tnt 
Gerrit-Comment-Date: Mon, 15 Jun 2020 08:34:36 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-trx[master]: radioInterface: Operate on real Tx power attenuation rather than on d...

2020-06-14 Thread neels
neels has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/18722 )

Change subject: radioInterface: Operate on real Tx power attenuation rather 
than on device specific gains
..


Patch Set 3: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/18722
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I4f8a1bcbed74aa9310306b97b0b1bfb02f7855e6
Gerrit-Change-Number: 18722
Gerrit-PatchSet: 3
Gerrit-Owner: pespin 
Gerrit-Reviewer: Hoernchen 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: daniel 
Gerrit-Reviewer: fixeria 
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: neels 
Gerrit-Reviewer: pespin 
Gerrit-Reviewer: roh 
Gerrit-Reviewer: tnt 
Gerrit-Comment-Date: Sun, 14 Jun 2020 11:57:33 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-trx[master]: radioInterface: Operate on real Tx power attenuation rather than on d...

2020-06-09 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/18722 )

Change subject: radioInterface: Operate on real Tx power attenuation rather 
than on device specific gains
..


Patch Set 2: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/18722
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I4f8a1bcbed74aa9310306b97b0b1bfb02f7855e6
Gerrit-Change-Number: 18722
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Tue, 09 Jun 2020 07:40:41 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in osmo-trx[master]: radioInterface: Operate on real Tx power attenuation rather than on d...

2020-06-08 Thread pespin
pespin has uploaded a new patch set (#2). ( 
https://gerrit.osmocom.org/c/osmo-trx/+/18722 )

Change subject: radioInterface: Operate on real Tx power attenuation rather 
than on device specific gains
..

radioInterface: Operate on real Tx power attenuation rather than on device 
specific gains

All the Tx gain related APIs are left out of reach from radioInterface,
and in there we simply interact with radioDevice passing the attenuation
received from TRXC.

Prior gain logic is moved in base radiodevice class, with the idea that
the setTxGain() and related functions will be dropped over time in each
sublcass in favour of an specific implementation of the
SetPowerAttenuation API.

Change-Id: I4f8a1bcbed74aa9310306b97b0b1bfb02f7855e6
---
M Transceiver52M/device/common/radioDevice.h
M Transceiver52M/device/lms/LMSDevice.h
M Transceiver52M/device/uhd/UHDDevice.h
M Transceiver52M/device/usrp1/USRPDevice.h
M Transceiver52M/radioInterface.cpp
M Transceiver52M/radioInterface.h
M Transceiver52M/radioInterfaceMulti.cpp
7 files changed, 59 insertions(+), 61 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-trx refs/changes/22/18722/2
--
To view, visit https://gerrit.osmocom.org/c/osmo-trx/+/18722
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-trx
Gerrit-Branch: master
Gerrit-Change-Id: I4f8a1bcbed74aa9310306b97b0b1bfb02f7855e6
Gerrit-Change-Number: 18722
Gerrit-PatchSet: 2
Gerrit-Owner: pespin 
Gerrit-CC: Jenkins Builder
Gerrit-MessageType: newpatchset


Change in osmo-trx[master]: radioInterface: Operate on real Tx power attenuation rather than on d...

2020-06-08 Thread pespin
pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-trx/+/18722 )


Change subject: radioInterface: Operate on real Tx power attenuation rather 
than on device specific gains
..

radioInterface: Operate on real Tx power attenuation rather than on device 
specific gains

All the Tx gain related APIs are left out of reach from radioInterface,
and in there we simply interact with radioDevice passing the attenuation
received from TRXC.

Prior gain logic is moved in base radiodevice class, with the idea that
the setTxGain() and related functions will be dropped over time in each
sublcass in favour of an specific implementation of the
SetPowerAttenuation API.

While changing the logic, this commit is also fixing a wrong calculation
of digital Attenuation in RadioInterface::setPowerAttenuation().

Change-Id: I4f8a1bcbed74aa9310306b97b0b1bfb02f7855e6
---
M Transceiver52M/device/common/radioDevice.h
M Transceiver52M/device/lms/LMSDevice.h
M Transceiver52M/device/uhd/UHDDevice.h
M Transceiver52M/device/usrp1/USRPDevice.h
M Transceiver52M/radioInterface.cpp
M Transceiver52M/radioInterface.h
M Transceiver52M/radioInterfaceMulti.cpp
7 files changed, 59 insertions(+), 61 deletions(-)



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

diff --git a/Transceiver52M/device/common/radioDevice.h 
b/Transceiver52M/device/common/radioDevice.h
index 8dd8f49..e51527d 100644
--- a/Transceiver52M/device/common/radioDevice.h
+++ b/Transceiver52M/device/common/radioDevice.h
@@ -125,21 +125,9 @@
   /** return minimum Rx Gain **/
   virtual double minRxGain(void) = 0;

-  /** sets the transmit chan gain, returns the gain setting **/
-  virtual double setTxGain(double dB, size_t chan = 0) = 0;
-
   /** returns the Nominal transmit output power of the transceiver in dBm, 
negative on error **/
   virtual int getNominalTxPower(size_t chan = 0) = 0;

-  /** get transmit gain */
-  virtual double getTxGain(size_t chan = 0) = 0;
-
-  /** return maximum Tx Gain **/
-  virtual double maxTxGain(void) = 0;
-
-  /** return minimum Tx Gain **/
-  virtual double minTxGain(void) = 0;
-
   /** sets the RX path to use, returns true if successful and false otherwise 
*/
   virtual bool setRxAntenna(const std::string &ant, size_t chan = 0) = 0;

@@ -163,6 +151,18 @@
   virtual double getRxFreq(size_t chan = 0) = 0;
   virtual double getSampleRate()=0;

+  /* Default backward-compatible implementation based on TxGain APIs. New
+ implementations should be based on getNominalTxPower() once implemented 
for
+ the specific backend. */
+  virtual double setPowerAttenuation(int atten, size_t chan) {
+   double rfGain;
+   rfGain = setTxGain(maxTxGain() - atten, chan);
+   return maxTxGain() - rfGain;
+  }
+  virtual double getPowerAttenuation(size_t chan=0) {
+   return maxTxGain() - getTxGain(chan);
+  }
+
   protected:
   size_t tx_sps, rx_sps;
   InterfaceType iface;
@@ -171,6 +171,15 @@
   std::vector tx_paths, rx_paths;
   std::vector m_ctr;

+  /** sets the transmit chan gain, returns the gain setting **/
+  virtual double setTxGain(double dB, size_t chan = 0) = 0;
+
+  /** get transmit gain */
+  virtual double getTxGain(size_t chan = 0) = 0;
+
+  /** return maximum Tx Gain **/
+  virtual double maxTxGain(void) = 0;
+
   RadioDevice(size_t tx_sps, size_t rx_sps, InterfaceType type, size_t 
chan_num, double offset,
   const std::vector& tx_paths,
   const std::vector& rx_paths):
diff --git a/Transceiver52M/device/lms/LMSDevice.h 
b/Transceiver52M/device/lms/LMSDevice.h
index 78fd62a..c83fed2 100644
--- a/Transceiver52M/device/lms/LMSDevice.h
+++ b/Transceiver52M/device/lms/LMSDevice.h
@@ -77,6 +77,19 @@
void update_stream_stats_rx(size_t chan, bool *overrun);
void update_stream_stats_tx(size_t chan, bool *underrun);
bool do_clock_src_freq(enum ReferenceType ref, double freq);
+   /** sets the transmit chan gain, returns the gain setting **/
+   double setTxGain(double dB, size_t chan = 0);
+
+   /** get transmit gain */
+   double getTxGain(size_t chan = 0) {
+   return tx_gains[chan];
+   }
+
+   /** return maximum Tx Gain **/
+   double maxTxGain(void);
+
+   /** return minimum Rx Gain **/
+   double minTxGain(void);

 public:

@@ -165,20 +178,6 @@
/** return minimum Rx Gain **/
double minRxGain(void);

-   /** sets the transmit chan gain, returns the gain setting **/
-   double setTxGain(double dB, size_t chan = 0);
-
-   /** get transmit gain */
-   double getTxGain(size_t chan = 0) {
-   return tx_gains[chan];
-   }
-
-   /** return maximum Tx Gain **/
-   double maxTxGain(void);
-
-   /** return minimum Rx Gain **/
-   double minTxGain(void);
-
int getNominalTxPower(size_t chan = 0);

/** sets the RX path to use, returns true if s