mirror of https://github.com/PentHertz/srsLTE.git
UHD: fix compatibility with 3.9.7 LTS
This commit is contained in:
parent
0a01bd4e1b
commit
46ab07123d
|
@ -226,13 +226,17 @@ public:
|
|||
{
|
||||
UHD_SAFE_C_SAVE_ERROR(this, sensors = usrp->get_rx_sensor_names();)
|
||||
}
|
||||
uhd_error get_sensor(const std::string& sensor_name, uhd::sensor_value_t& sensor_value) override
|
||||
uhd_error get_sensor(const std::string& sensor_name, double& sensor_value) override
|
||||
{
|
||||
UHD_SAFE_C_SAVE_ERROR(this, sensor_value = usrp->get_mboard_sensor(sensor_name);)
|
||||
UHD_SAFE_C_SAVE_ERROR(this, sensor_value = usrp->get_mboard_sensor(sensor_name).to_real();)
|
||||
}
|
||||
uhd_error get_rx_sensor(const std::string& sensor_name, uhd::sensor_value_t& sensor_value) override
|
||||
uhd_error get_sensor(const std::string& sensor_name, bool& sensor_value) override
|
||||
{
|
||||
UHD_SAFE_C_SAVE_ERROR(this, sensor_value = usrp->get_rx_sensor(sensor_name);)
|
||||
UHD_SAFE_C_SAVE_ERROR(this, sensor_value = usrp->get_mboard_sensor(sensor_name).to_bool();)
|
||||
}
|
||||
uhd_error get_rx_sensor(const std::string& sensor_name, bool& sensor_value) override
|
||||
{
|
||||
UHD_SAFE_C_SAVE_ERROR(this, sensor_value = usrp->get_rx_sensor(sensor_name).to_bool();)
|
||||
}
|
||||
uhd_error set_time_unknown_pps(const uhd::time_spec_t& timespec) override
|
||||
{
|
||||
|
|
|
@ -358,14 +358,13 @@ static int set_time_to_gps_time(rf_uhd_handler_t* handler)
|
|||
}
|
||||
|
||||
// Get actual sensor value
|
||||
uhd::sensor_value_t sensor_value("w", "t", "f");
|
||||
if (handler->uhd->get_sensor(sensor_name, sensor_value) != UHD_ERROR_NONE) {
|
||||
double frac_secs = 0.0;
|
||||
if (handler->uhd->get_sensor(sensor_name, frac_secs) != UHD_ERROR_NONE) {
|
||||
print_usrp_error(handler);
|
||||
return SRSLTE_ERROR;
|
||||
}
|
||||
|
||||
// Get time and set
|
||||
double frac_secs = sensor_value.to_real();
|
||||
printf("Setting USRP time to %fs\n", frac_secs);
|
||||
if (handler->uhd->set_time_unknown_pps(uhd::time_spec_t(frac_secs)) != UHD_ERROR_NONE) {
|
||||
print_usrp_error(handler);
|
||||
|
@ -421,21 +420,19 @@ static int wait_sensor_locked(rf_uhd_handler_t* handler,
|
|||
|
||||
do {
|
||||
// Get actual sensor value
|
||||
uhd::sensor_value_t sensor_value("", true, "True", "False");
|
||||
if (is_mboard) {
|
||||
if (handler->uhd->get_sensor(sensor_name, sensor_value) != UHD_ERROR_NONE) {
|
||||
if (handler->uhd->get_sensor(sensor_name, is_locked) != UHD_ERROR_NONE) {
|
||||
print_usrp_error(handler);
|
||||
return SRSLTE_ERROR;
|
||||
}
|
||||
} else {
|
||||
if (handler->uhd->get_rx_sensor(sensor_name, sensor_value) != UHD_ERROR_NONE) {
|
||||
if (handler->uhd->get_rx_sensor(sensor_name, is_locked) != UHD_ERROR_NONE) {
|
||||
print_usrp_error(handler);
|
||||
return SRSLTE_ERROR;
|
||||
}
|
||||
}
|
||||
|
||||
// Read value and wait
|
||||
is_locked = sensor_value.to_bool();
|
||||
usleep(1000); // 1ms
|
||||
timeout -= 1; // 1ms
|
||||
} while (not is_locked and timeout > 0);
|
||||
|
@ -600,6 +597,7 @@ int rf_uhd_open_multi(char* args, void** h, uint32_t nof_channels)
|
|||
}
|
||||
|
||||
// Logging level
|
||||
#ifdef UHD_LOG_INFO
|
||||
uhd::log::severity_level severity_level = uhd::log::severity_level::info;
|
||||
if (device_addr.has_key("log_level")) {
|
||||
std::string log_level = device_addr.pop("log_level");
|
||||
|
@ -621,6 +619,7 @@ int rf_uhd_open_multi(char* args, void** h, uint32_t nof_channels)
|
|||
}
|
||||
}
|
||||
uhd::log::set_console_level(severity_level);
|
||||
#endif
|
||||
|
||||
#if HAVE_ASYNC_THREAD
|
||||
bool start_async_thread = true;
|
||||
|
|
|
@ -480,15 +480,25 @@ public:
|
|||
sensors = device3->get_tree()->list(TREE_RX_SENSORS);
|
||||
})
|
||||
}
|
||||
uhd_error get_sensor(const std::string& sensor_name, uhd::sensor_value_t& sensor_value) override
|
||||
uhd_error get_sensor(const std::string& sensor_name, double& sensor_value) override
|
||||
{
|
||||
UHD_SAFE_C_SAVE_ERROR(
|
||||
this, sensor_value = device3->get_tree()->access<uhd::sensor_value_t>(TREE_MBOARD_SENSORS / sensor_name).get();)
|
||||
this,
|
||||
sensor_value =
|
||||
device3->get_tree()->access<uhd::sensor_value_t>(TREE_MBOARD_SENSORS / sensor_name).get().to_real();)
|
||||
}
|
||||
uhd_error get_rx_sensor(const std::string& sensor_name, uhd::sensor_value_t& sensor_value) override
|
||||
uhd_error get_sensor(const std::string& sensor_name, bool& sensor_value) override
|
||||
{
|
||||
UHD_SAFE_C_SAVE_ERROR(
|
||||
this, sensor_value = device3->get_tree()->access<uhd::sensor_value_t>(TREE_RX_SENSORS / sensor_name).get();)
|
||||
this,
|
||||
sensor_value =
|
||||
device3->get_tree()->access<uhd::sensor_value_t>(TREE_MBOARD_SENSORS / sensor_name).get().to_bool();)
|
||||
}
|
||||
uhd_error get_rx_sensor(const std::string& sensor_name, bool& sensor_value) override
|
||||
{
|
||||
UHD_SAFE_C_SAVE_ERROR(
|
||||
this,
|
||||
sensor_value = device3->get_tree()->access<uhd::sensor_value_t>(TREE_RX_SENSORS / sensor_name).get().to_bool();)
|
||||
}
|
||||
uhd_error set_time_unknown_pps(const uhd::time_spec_t& timespec) override
|
||||
{
|
||||
|
|
|
@ -21,11 +21,20 @@
|
|||
#ifndef SRSLTE_RF_UHD_SAFE_H
|
||||
#define SRSLTE_RF_UHD_SAFE_H
|
||||
|
||||
#include <set>
|
||||
#include <uhd/utils/log.hpp>
|
||||
|
||||
#ifdef UHD_LOG_INFO
|
||||
#define Warning(message) UHD_LOG_WARNING("UHD RF", message)
|
||||
#define Info(message) UHD_LOG_INFO("UHD RF", message)
|
||||
#define Debug(message) UHD_LOG_DEBUG("UHD RF", message)
|
||||
#define Trace(message) UHD_LOG_TRACE("UHD RF", message)
|
||||
#else
|
||||
#define Warning(message) UHD_LOG << message
|
||||
#define Info(message) UHD_LOG << message
|
||||
#define Debug(message) UHD_LOG << message
|
||||
#define Trace(message) UHD_LOG << message
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_UHD_X300_FW_RESET
|
||||
#include <uhd/transport/udp_simple.hpp>
|
||||
|
@ -115,8 +124,9 @@ public:
|
|||
virtual uhd_error get_mboard_name(std::string& mboard_name) = 0;
|
||||
virtual uhd_error get_mboard_sensor_names(std::vector<std::string>& sensors) = 0;
|
||||
virtual uhd_error get_rx_sensor_names(std::vector<std::string>& sensors) = 0;
|
||||
virtual uhd_error get_sensor(const std::string& sensor_name, uhd::sensor_value_t& sensor_value) = 0;
|
||||
virtual uhd_error get_rx_sensor(const std::string& sensor_name, uhd::sensor_value_t& sensor_value) = 0;
|
||||
virtual uhd_error get_sensor(const std::string& sensor_name, double& sensor_value) = 0;
|
||||
virtual uhd_error get_sensor(const std::string& sensor_name, bool& sensor_value) = 0;
|
||||
virtual uhd_error get_rx_sensor(const std::string& sensor_name, bool& sensor_value) = 0;
|
||||
virtual uhd_error set_time_unknown_pps(const uhd::time_spec_t& timespec) = 0;
|
||||
virtual uhd_error get_time_now(uhd::time_spec_t& timespec) = 0;
|
||||
uhd_error start_rx_stream(double delay)
|
||||
|
|
Loading…
Reference in New Issue