mirror of https://github.com/pvnis/srsRAN_4G.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
118 lines
4.4 KiB
C
118 lines
4.4 KiB
C
6 years ago
|
/*
|
||
|
* Copyright 2013-2019 Software Radio Systems Limited
|
||
|
*
|
||
|
* This file is part of srsLTE.
|
||
|
*
|
||
|
* srsLTE is free software: you can redistribute it and/or modify
|
||
|
* it under the terms of the GNU Affero General Public License as
|
||
|
* published by the Free Software Foundation, either version 3 of
|
||
|
* the License, or (at your option) any later version.
|
||
|
*
|
||
|
* srsLTE is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||
|
* GNU Affero General Public License for more details.
|
||
|
*
|
||
|
* A copy of the GNU Affero General Public License can be found in
|
||
|
* the LICENSE file in the top-level directory of this distribution
|
||
|
* and at http://www.gnu.org/licenses/.
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
/******************************************************************************
|
||
6 years ago
|
* File: radio_multi.h
|
||
|
* Description: Class for using multiple srslte::radio's for both eNB/UE
|
||
6 years ago
|
*****************************************************************************/
|
||
|
|
||
6 years ago
|
#ifndef SRSLTE_RADIO_MULTI_H
|
||
|
#define SRSLTE_RADIO_MULTI_H
|
||
6 years ago
|
|
||
6 years ago
|
#include "srslte/common/logger.h"
|
||
|
#include "srslte/interfaces/common_interfaces.h"
|
||
|
#include "srslte/phy/rf/rf.h"
|
||
6 years ago
|
#include "srslte/radio/radio.h"
|
||
6 years ago
|
#include "srslte/radio/radio_base.h"
|
||
|
#include "srslte/radio/radio_metrics.h"
|
||
6 years ago
|
|
||
6 years ago
|
namespace srslte {
|
||
6 years ago
|
|
||
6 years ago
|
class radio_multi : public radio_base, public radio_interface_phy
|
||
6 years ago
|
{
|
||
|
public:
|
||
6 years ago
|
radio_multi(srslte::logger* logger_);
|
||
|
~radio_multi() override;
|
||
6 years ago
|
|
||
6 years ago
|
std::string get_type() override;
|
||
6 years ago
|
|
||
6 years ago
|
int init(const rf_args_t& args_, phy_interface_radio* phy_);
|
||
6 years ago
|
|
||
6 years ago
|
void stop() override;
|
||
6 years ago
|
|
||
|
static void rf_msg(srslte_rf_error_t error);
|
||
|
void handle_rf_msg(srslte_rf_error_t error);
|
||
|
|
||
6 years ago
|
bool get_metrics(rf_metrics_t* metrics) override;
|
||
6 years ago
|
|
||
|
// radio_interface_phy
|
||
6 years ago
|
bool is_init() override { return radios.at(0)->is_init(); }
|
||
|
void reset() override { return radios.at(0)->reset(); }
|
||
|
bool is_continuous_tx() override { return radios.at(0)->is_continuous_tx(); }
|
||
|
bool tx(const uint32_t& radio_idx,
|
||
|
cf_t* buffer[SRSLTE_MAX_PORTS],
|
||
|
const uint32_t& nof_samples,
|
||
|
const srslte_timestamp_t& tx_time) override
|
||
6 years ago
|
{
|
||
6 years ago
|
return radios.at(radio_idx)->tx(buffer, nof_samples, tx_time);
|
||
6 years ago
|
}
|
||
6 years ago
|
void tx_end() override { return radios.at(0)->tx_end(); }
|
||
6 years ago
|
|
||
6 years ago
|
bool rx_now(const uint32_t& radio_idx,
|
||
|
cf_t* buffer[SRSLTE_MAX_PORTS],
|
||
|
const uint32_t& nof_samples,
|
||
|
srslte_timestamp_t* rxd_time) override
|
||
6 years ago
|
{
|
||
6 years ago
|
return radios.at(radio_idx)->rx_now(buffer, nof_samples, rxd_time);
|
||
6 years ago
|
}
|
||
6 years ago
|
void set_rx_gain(const uint32_t& radio_idx, const float& gain) override { radios.at(radio_idx)->set_rx_gain(gain); }
|
||
|
double set_rx_gain_th(const float& gain) override { return radios.at(0)->set_rx_gain_th(gain); }
|
||
|
float get_rx_gain(const uint32_t& radio_idx) override { return radios.at(radio_idx)->get_rx_gain(); }
|
||
|
void set_tx_freq(const uint32_t& radio_idx, const uint32_t& channel_idx, const double& freq) override
|
||
|
{
|
||
|
radios.at(radio_idx)->set_tx_freq(channel_idx, freq);
|
||
|
}
|
||
|
void set_rx_freq(const uint32_t& radio_idx, const uint32_t& channel_idx, const double& freq) override
|
||
|
{
|
||
|
radios.at(radio_idx)->set_rx_freq(channel_idx, freq);
|
||
|
}
|
||
|
double get_freq_offset() override { return radios.at(0)->get_freq_offset(); }
|
||
|
double get_tx_freq(const uint32_t& radio_idx) override { return radios.at(radio_idx)->get_tx_freq(); }
|
||
|
double get_rx_freq(const uint32_t& radio_idx) override { return radios.at(radio_idx)->get_rx_freq(); }
|
||
|
float get_max_tx_power() override { return args.tx_max_power; }
|
||
|
float get_tx_gain_offset() override { return args.tx_gain_offset; }
|
||
|
float get_rx_gain_offset() override { return args.rx_gain_offset; }
|
||
|
void set_tx_srate(const uint32_t& radio_idx, const double& srate) override
|
||
|
{
|
||
|
radios.at(radio_idx)->set_tx_srate(srate);
|
||
|
}
|
||
|
void set_rx_srate(const uint32_t& radio_idx, const double& srate) override
|
||
|
{
|
||
|
radios.at(radio_idx)->set_rx_srate(srate);
|
||
|
}
|
||
|
srslte_rf_info_t* get_info(const uint32_t& radio_idx) override { return radios.at(radio_idx)->get_info(); }
|
||
6 years ago
|
|
||
6 years ago
|
protected:
|
||
|
rf_args_t args = {};
|
||
6 years ago
|
|
||
6 years ago
|
std::vector<std::unique_ptr<radio> > radios;
|
||
6 years ago
|
|
||
6 years ago
|
srslte::logger* logger = nullptr;
|
||
6 years ago
|
srslte::log_filter log;
|
||
6 years ago
|
bool running = false;
|
||
6 years ago
|
|
||
6 years ago
|
srslte::rf_metrics_t rf_metrics = {};
|
||
|
phy_interface_radio* phy = nullptr;
|
||
6 years ago
|
};
|
||
6 years ago
|
} // namespace srslte
|
||
6 years ago
|
|
||
6 years ago
|
#endif // SRSLTE_RADIO_MULTI_H
|