aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-05-29 16:39:07 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2020-06-08 15:49:36 +0200
commit0e09e7c98a981b1b6f19cc19e29a60c601a02970 (patch)
tree504a3f554c09ebed234c3ce86bd4a0ebccee2a8f
parent1b3a8881eb8a1d8c90be3895def091677d320894 (diff)
Transceiver: Implement TRXC cmd NOMTXPOWER
It allows the BTS to retrieve the nominal transmit output power value of each TRX in order to compute attenuation later on and apply it through SETPOWER or ADJPOWER TRXC commands. Change-Id: I1d7efe56e008d8d60e23f9a85aa40809f7f84d9c
-rw-r--r--Transceiver52M/Transceiver.cpp6
-rw-r--r--Transceiver52M/device/common/radioDevice.h3
-rw-r--r--Transceiver52M/device/lms/LMSDevice.cpp8
-rw-r--r--Transceiver52M/device/lms/LMSDevice.h2
-rw-r--r--Transceiver52M/device/uhd/UHDDevice.cpp8
-rw-r--r--Transceiver52M/device/uhd/UHDDevice.h2
-rw-r--r--Transceiver52M/device/usrp1/USRPDevice.cpp8
-rw-r--r--Transceiver52M/device/usrp1/USRPDevice.h2
-rw-r--r--Transceiver52M/radioInterface.cpp10
-rw-r--r--Transceiver52M/radioInterface.h1
10 files changed, 50 insertions, 0 deletions
diff --git a/Transceiver52M/Transceiver.cpp b/Transceiver52M/Transceiver.cpp
index 8308def..0b7ac31 100644
--- a/Transceiver52M/Transceiver.cpp
+++ b/Transceiver52M/Transceiver.cpp
@@ -902,6 +902,12 @@ int Transceiver::ctrl_sock_handle_rx(int chan)
power = mRadioInterface->setPowerAttenuation(power, chan);
mStates[chan].mPower = power;
sprintf(response, "RSP ADJPOWER 0 %d", power);
+} else if (match_cmd(command, "NOMTXPOWER", NULL)) {
+ int power = mRadioInterface->getNominalTxPower(chan);
+ if (power > 0)
+ sprintf(response, "RSP NOMTXPOWER 0 %d", power);
+ else
+ sprintf(response, "RSP NOMTXPOWER 1 %d", -power);
} else if (match_cmd(command, "RXTUNE", &params)) {
// tune receiver
int freqKhz;
diff --git a/Transceiver52M/device/common/radioDevice.h b/Transceiver52M/device/common/radioDevice.h
index 0dc38d5..8dd8f49 100644
--- a/Transceiver52M/device/common/radioDevice.h
+++ b/Transceiver52M/device/common/radioDevice.h
@@ -128,6 +128,9 @@ class RadioDevice {
/** 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;
diff --git a/Transceiver52M/device/lms/LMSDevice.cpp b/Transceiver52M/device/lms/LMSDevice.cpp
index 932817d..355c8e4 100644
--- a/Transceiver52M/device/lms/LMSDevice.cpp
+++ b/Transceiver52M/device/lms/LMSDevice.cpp
@@ -530,6 +530,14 @@ double LMSDevice::setRxGain(double dB, size_t chan)
return rx_gains[chan];
}
+int LMSDevice::getNominalTxPower(size_t chan)
+{
+ /* TODO: return value based on some experimentally generated table depending on
+ * band/arfcn, which is known here thanks to TXTUNE
+ */
+ return 23;
+}
+
void LMSDevice::log_ant_list(bool dir_tx, size_t chan, std::ostringstream& os)
{
lms_name_t name_list[MAX_ANTENNA_LIST_SIZE]; /* large enough list for antenna names. */
diff --git a/Transceiver52M/device/lms/LMSDevice.h b/Transceiver52M/device/lms/LMSDevice.h
index 5b6330a..78fd62a 100644
--- a/Transceiver52M/device/lms/LMSDevice.h
+++ b/Transceiver52M/device/lms/LMSDevice.h
@@ -179,6 +179,8 @@ public:
/** 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 */
bool setRxAntenna(const std::string & ant, size_t chan = 0);
diff --git a/Transceiver52M/device/uhd/UHDDevice.cpp b/Transceiver52M/device/uhd/UHDDevice.cpp
index ad56250..2970173 100644
--- a/Transceiver52M/device/uhd/UHDDevice.cpp
+++ b/Transceiver52M/device/uhd/UHDDevice.cpp
@@ -341,6 +341,14 @@ double uhd_device::getTxGain(size_t chan)
return tx_gains[chan];
}
+int uhd_device::getNominalTxPower(size_t chan)
+{
+ /* TODO: return value based on some experimentally generated table depending on
+ * band/arfcn, which is known here thanks to TXTUNE
+ */
+ return 23;
+}
+
/*
Parse the UHD device tree and mboard name to find out what device we're
dealing with. We need the window type so that the transceiver knows how to
diff --git a/Transceiver52M/device/uhd/UHDDevice.h b/Transceiver52M/device/uhd/UHDDevice.h
index 1e66246..01d71a0 100644
--- a/Transceiver52M/device/uhd/UHDDevice.h
+++ b/Transceiver52M/device/uhd/UHDDevice.h
@@ -100,6 +100,8 @@ public:
double maxTxGain(void) { return tx_gain_max; }
double minTxGain(void) { return tx_gain_min; }
+ int getNominalTxPower(size_t chan = 0);
+
double getTxFreq(size_t chan);
double getRxFreq(size_t chan);
double getRxFreq();
diff --git a/Transceiver52M/device/usrp1/USRPDevice.cpp b/Transceiver52M/device/usrp1/USRPDevice.cpp
index 1a9a7e1..73117d2 100644
--- a/Transceiver52M/device/usrp1/USRPDevice.cpp
+++ b/Transceiver52M/device/usrp1/USRPDevice.cpp
@@ -314,6 +314,14 @@ double USRPDevice::setRxGain(double dB, size_t chan)
return rxGain;
}
+int USRPDevice::getNominalTxPower(size_t chan)
+{
+ /* TODO: return value based on some experimentally generated table depending on
+ * band/arfcn, which is known here thanks to TXTUNE
+ */
+ return 23;
+}
+
bool USRPDevice::setRxAntenna(const std::string &ant, size_t chan)
{
if (chan >= rx_paths.size()) {
diff --git a/Transceiver52M/device/usrp1/USRPDevice.h b/Transceiver52M/device/usrp1/USRPDevice.h
index a4a0886..0549192 100644
--- a/Transceiver52M/device/usrp1/USRPDevice.h
+++ b/Transceiver52M/device/usrp1/USRPDevice.h
@@ -180,6 +180,8 @@ private:
/** 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 */
bool setRxAntenna(const std::string &ant, size_t chan = 0);
diff --git a/Transceiver52M/radioInterface.cpp b/Transceiver52M/radioInterface.cpp
index fbcacf1..fb724d2 100644
--- a/Transceiver52M/radioInterface.cpp
+++ b/Transceiver52M/radioInterface.cpp
@@ -124,6 +124,16 @@ int RadioInterface::setPowerAttenuation(int atten, size_t chan)
return atten;
}
+int RadioInterface::getNominalTxPower(size_t chan)
+{
+ if (chan >= mChans) {
+ LOG(ALERT) << "Invalid channel requested";
+ return -1;
+ }
+
+ return mDevice->getNominalTxPower(chan);
+}
+
int RadioInterface::radioifyVector(signalVector &wVector,
size_t chan, bool zero)
{
diff --git a/Transceiver52M/radioInterface.h b/Transceiver52M/radioInterface.h
index c75a983..eb7ed3b 100644
--- a/Transceiver52M/radioInterface.h
+++ b/Transceiver52M/radioInterface.h
@@ -117,6 +117,7 @@ public:
int driveReceiveRadio();
int setPowerAttenuation(int atten, size_t chan = 0);
+ int getNominalTxPower(size_t chan = 0);
/** returns the full-scale transmit amplitude **/
double fullScaleInputValue();