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
This commit is contained in:
Pau Espin 2020-05-29 16:39:07 +02:00
parent 1b3a8881eb
commit 0e09e7c98a
10 changed files with 50 additions and 0 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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. */

View File

@ -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);

View File

@ -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

View File

@ -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();

View File

@ -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()) {

View File

@ -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);

View File

@ -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)
{

View File

@ -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();