forked from ra1nb0w/sdrangel-windows-libraries
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add UHD library (https://github.com/EttusResearch/uhd) for USRP radios.
Remove Soapy UHD support library, as it is buggy and not compatible with v4 of UHD.
- Loading branch information
Showing
161 changed files
with
21,888 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
PlutoSDRSupport.dll disabled, as it causes problems with other support libs - and SDRangel has native support anyway. | ||
PlutoSDRSupport.dll disabled, as it causes problems with other support libs - and SDRangel has native support anyway. | ||
UHD disabled as fairly buggy, it's incompatible with latest uhdl.dll and SDRangel now has native support. |
File renamed without changes.
File renamed without changes.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright 2015 Ettus Research LLC | ||
* Copyright 2018 Ettus Research, a National Instruments Company | ||
* Copyright 2019 Ettus Research, a National Instruments Brand | ||
* | ||
* SPDX-License-Identifier: GPL-3.0-or-later | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <uhd/config.h> | ||
#include <uhd/error.h> | ||
#include <uhd/version.h> | ||
|
||
#include <uhd/types/metadata.h> | ||
#include <uhd/types/ranges.h> | ||
#include <uhd/types/sensors.h> | ||
#include <uhd/types/string_vector.h> | ||
#include <uhd/types/tune_request.h> | ||
#include <uhd/types/tune_result.h> | ||
#include <uhd/types/usrp_info.h> | ||
|
||
#include <uhd/usrp/dboard_eeprom.h> | ||
#include <uhd/usrp/mboard_eeprom.h> | ||
#include <uhd/usrp/subdev_spec.h> | ||
#include <uhd/usrp/usrp.h> | ||
|
||
#include <uhd/usrp_clock/usrp_clock.h> | ||
|
||
#include <uhd/utils/thread_priority.h> | ||
#include <uhd/utils/log.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// | ||
// Copyright 2015 National Instruments Corp. | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// | ||
|
||
#pragma once | ||
|
||
#include <uhd/config.hpp> | ||
#include <string> | ||
|
||
namespace uhd { namespace build_info { | ||
|
||
//! Return the version of Boost this build was built with. | ||
UHD_API const std::string boost_version(); | ||
|
||
//! Return the date and time (GMT) this UHD build was built. | ||
UHD_API const std::string build_date(); | ||
|
||
//! Return the C compiler used for this build. | ||
UHD_API const std::string c_compiler(); | ||
|
||
//! Return the C++ compiler used for this build. | ||
UHD_API const std::string cxx_compiler(); | ||
|
||
//! Return the C flags passed into this build. | ||
UHD_API const std::string c_flags(); | ||
|
||
//! Return the C++ flags passed into this build. | ||
UHD_API const std::string cxx_flags(); | ||
|
||
//! Return the UHD components enabled for this build, comma-delimited. | ||
UHD_API const std::string enabled_components(); | ||
|
||
//! Return the default CMake install prefix for this build. | ||
UHD_API const std::string install_prefix(); | ||
|
||
//! Return the version of libusb this build was built with. | ||
UHD_API const std::string libusb_version(); | ||
}} // namespace uhd::build_info |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
// | ||
// Copyright 2020 Ettus Research, a National Instruments Brand | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// | ||
|
||
#pragma once | ||
|
||
#include <uhd/config.hpp> | ||
#include <stdint.h> | ||
#include <memory> | ||
#include <vector> | ||
#include <string> | ||
|
||
namespace uhd { namespace usrp { namespace cal { | ||
|
||
/*! Generic parent class for calibration data | ||
* | ||
* Derive any class that stores cal data which needs to be stored/retrieved from | ||
* this parent class. | ||
*/ | ||
class UHD_API container | ||
{ | ||
public: | ||
virtual ~container() = default; | ||
|
||
//! Return the name of this calibration table | ||
virtual std::string get_name() const = 0; | ||
|
||
//! Return the device serial of this calibration table | ||
virtual std::string get_serial() const = 0; | ||
|
||
//! Timestamp of acquisition time | ||
virtual uint64_t get_timestamp() const = 0; | ||
|
||
//! Return a serialized version of this container | ||
virtual std::vector<uint8_t> serialize() = 0; | ||
|
||
//! Populate this class from the serialized data | ||
virtual void deserialize(const std::vector<uint8_t>& data) = 0; | ||
|
||
//! Generic factory for cal data from serialized data | ||
// | ||
// \tparam container_type The class type of cal data which should be | ||
// generated from \p data | ||
// \param data The serialized data to be turned into the cal class | ||
template <typename container_type> | ||
static std::shared_ptr<container_type> make(const std::vector<uint8_t>& data) | ||
{ | ||
auto cal_data = container_type::make(); | ||
cal_data->deserialize(data); | ||
return cal_data; | ||
} | ||
}; | ||
|
||
}}} // namespace uhd::usrp::cal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,158 @@ | ||
// | ||
// Copyright 2020 Ettus Research, a National Instruments Brand | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// | ||
|
||
#pragma once | ||
|
||
#include <uhd/config.hpp> | ||
#include <stddef.h> | ||
#include <string> | ||
#include <vector> | ||
#include <functional> | ||
|
||
namespace uhd { namespace usrp { namespace cal { | ||
|
||
//! Identify the source of calibration data, i.e., where was it stored | ||
// | ||
// This enum lists the sources in reverse order of priority, i.e., user-provided | ||
// data has the highest priority, and hard-coded data from the resource compiler | ||
// has the lowest priority. | ||
enum class source { | ||
NONE, //!< No calibration data available | ||
ANY, //!< Undefined source | ||
RC, //!< Internal Resource Compiler (i.e., hard-coded within UHD) | ||
FLASH, //!< Stored on device flash memory, e.g. EEPROM | ||
FILESYSTEM, //!< Stored on the local filesystem | ||
USER //!< Provided by the user | ||
}; | ||
|
||
/*! Calibration Data Storage/Retrieval Class | ||
* | ||
* UHD can store calibration data on disk or compiled within UHD. This class | ||
* provides access to both locations. | ||
* | ||
* \section cal_db_blob Format of binary data | ||
* | ||
* This class can read and write binary data, but it does not verify the data | ||
* or expect any kind of format. It simply manages BLOBs (binary large objects). | ||
* It is up to the consumers and producers of this data to agree on a format. | ||
* Typically, since this class stores calibration data, it will be consuming | ||
* data that was produced by uhd::usrp::cal::container::serialize(). | ||
* | ||
* \section cal_db_serial Serial number and key | ||
* | ||
* Calibration data is indexed by two keys: An arbitrary key that describes the | ||
* type of calibration data (e.g., "rx_iq") and a serial number. The serial | ||
* number has to uniquely identify the device for which the calibration data was | ||
* obtained. This can either be the serial number of the daughterboard (if the | ||
* calibration data only relates to the daughterboard), the motherboard (for | ||
* example, if there is no such thing as a daughterboard, or the data only | ||
* relates to the motherboard), it can be combination of both daughterboard and | ||
* motherboard serial (if the calibration data is only valid for a combination), | ||
* or it can be a combination of a device serial number and a channel index | ||
* (if a device with single serial has different channels that have separate | ||
* characteristics). | ||
* | ||
* It is up to the individual device drivers which value they use for the serial | ||
* numbers and keys. | ||
* | ||
* Note that the serial number is irrelevant when the data is pulled out of the | ||
* resource compiler. By definition, it is not permitted to store data in the | ||
* resource compiler that is specific to a certain serial number, only data that | ||
* applies to an entire family of devices is permitted. | ||
*/ | ||
class UHD_API database | ||
{ | ||
public: | ||
//! Return a calibration data set as a serialized string | ||
// | ||
// Note: the \p source_type parameter can be used to specify where to read | ||
// cal data from. However, this class only has | ||
// access to RC and FILESYSTEM type cal data. ANY | ||
// will pick FILESYSTEM data if both are available, | ||
// and RC data if only RC data is available. | ||
// \param key The calibration type key (e.g., "rx_iq") | ||
// \param serial The serial number of the device this data is for. See also | ||
// \ref cal_db_serial | ||
// \param source_type Where to read the calibration data from. See comments | ||
// above. For anything other than RC, FILESYSTEM, or ANY, | ||
// this will always throw a uhd::key_error because this | ||
// class does not have access to user data or EEPROM data. | ||
// | ||
// \throws uhd::key_error if no calibration data is found matching the source | ||
// type. | ||
static std::vector<uint8_t> read_cal_data(const std::string& key, | ||
const std::string& serial, | ||
const source source_type = source::ANY); | ||
|
||
//! Check if calibration data exists for a given source type | ||
// | ||
// This can be called before calling read_cal_data() to avoid having to | ||
// catch an exception. If \p source_type is FILESYSTEM, then it will only | ||
// return true if a file is found with the appropriate cal data. The same | ||
// is true for RC. If \p is ANY, then having either RC or FILESYSTEM data | ||
// will yield true. | ||
// | ||
// \param key The calibration type key (e.g., "rx_iq") | ||
// \param serial The serial number of the device this data is for. See also | ||
// \ref cal_db_serial | ||
// \param source_type Where to read the calibration data from. For anything | ||
// other than RC, FILESYSTEM, or ANY, this will always | ||
// return false because this class does not have access | ||
// to user data or EEPROM data. | ||
// \return true if calibration data is available that matches this key/serial | ||
// pair. | ||
static bool has_cal_data(const std::string& key, | ||
const std::string& serial, | ||
const source source_type = source::ANY); | ||
|
||
//! Store calibration data to the local filesystem database | ||
// | ||
// This implies a source type of FILESYSTEM. Note that writing the data does | ||
// not apply it to a currently running UHD session. Devices will typically | ||
// load calibration data at initialization time, and thus this call will | ||
// take effect only for future UHD sessions. | ||
// | ||
// If calibration data for this key/serial pair already exists in the | ||
// database, the original data will be backed up by renaming the original | ||
// file from `filename.cal` to `filename.cal.$TIMESTAMP`. Alternatively, a | ||
// custom extension can be chosen instead of `$TIMESTAMP`. | ||
// | ||
// \param key The calibration type key (e.g., "rx_iq") | ||
// \param serial The serial number of the device this data is for. See also | ||
// \ref cal_db_serial | ||
// \param cal_data The calibration data to be written | ||
// \param backup_ext A custom extension for backing up calibration data. If | ||
// left empty, a POSIX timestamp is used. | ||
static void write_cal_data(const std::string& key, | ||
const std::string& serial, | ||
const std::vector<uint8_t>& cal_data, | ||
const std::string& backup_ext = ""); | ||
|
||
//! Function type to look up if there is cal data given a key and serial | ||
using has_data_fn_type = std::function<bool(const std::string&, const std::string&)>; | ||
|
||
//! Function type to return serialized cal data key and serial | ||
// | ||
// These functions should throw a uhd::runtime_error if called with invalid | ||
// key/serial pairs, although database will internally always call the | ||
// corresponding 'has' function before calling this. | ||
using get_data_fn_type = | ||
std::function<std::vector<uint8_t>(const std::string&, const std::string&)>; | ||
|
||
//! Register a lookup function for cal data | ||
// | ||
// \param has_cal_data A function object to a function that returns true if | ||
// cal data is available | ||
// \param get_cal_data A function object to a function that returns serialized | ||
// cal data | ||
// \param source_type Reserved. Must be source::FLASH. | ||
static void register_lookup(has_data_fn_type has_cal_data, | ||
get_data_fn_type get_cal_data, | ||
const source source_type = source::FLASH); | ||
}; | ||
|
||
|
||
}}} // namespace uhd::usrp::cal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// | ||
// Copyright 2020 Ettus Research, a National Instruments Brand | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// | ||
|
||
#pragma once | ||
|
||
#include <uhd/cal/container.hpp> | ||
#include <uhd/config.hpp> | ||
#include <uhd/utils/interpolation.hpp> | ||
#include <complex> | ||
#include <memory> | ||
#include <string> | ||
|
||
namespace uhd { namespace usrp { namespace cal { | ||
|
||
/*! Class that stores IQ cal data per frequency | ||
* | ||
* The following calibrations use this: | ||
* - Gen-2 and Gen-3 TX DC Offset | ||
* - Gen-2 and Gen-3 RX,TX IQ Imbalance | ||
*/ | ||
class UHD_API iq_cal : public container | ||
{ | ||
public: | ||
using sptr = std::shared_ptr<iq_cal>; | ||
|
||
//! Choose interpolation mode | ||
// | ||
// This class supports two kinds of interpolation: Nearest-neighbour, and | ||
// linear. | ||
// | ||
// \param interp The new interpolation mode | ||
// \throws uhd::value_error if the given interpolation mode is not | ||
// supported. | ||
virtual void set_interp_mode(const uhd::math::interp_mode interp) = 0; | ||
|
||
//! Return a calibration coefficient for a given frequency | ||
// | ||
// This function will interpolate to return a valid coefficient for any | ||
// given frequency. | ||
virtual std::complex<double> get_cal_coeff(const double freq) const = 0; | ||
|
||
//! Update / set a calbration coefficient | ||
// | ||
// This usually only needs to called by calibration utilities. | ||
// | ||
// \param freq The frequency at which this coefficient is measured | ||
// \param coeff The value that is stored | ||
// \param suppression_abs The amount of impairment suppression this | ||
// coefficient provides, in dB. | ||
// \param suppression_delta The difference of impairment power between | ||
// applying this coefficient and applying none, in | ||
// dB. | ||
virtual void set_cal_coeff(const double freq, | ||
const std::complex<double> coeff, | ||
const double suppression_abs = 0, | ||
const double suppression_delta = 0) = 0; | ||
|
||
//! Clear the list of coefficients | ||
// | ||
// This can be useful in order to drop existing cal data, and load an | ||
// entirely new set with deserialize(). | ||
virtual void clear() = 0; | ||
|
||
//! Factory for new cal data sets | ||
static sptr make( | ||
const std::string& name, const std::string& serial, const uint64_t timestamp); | ||
|
||
//! Default factory | ||
static sptr make(); | ||
}; | ||
|
||
}}} // namespace uhd::usrp::cal |
Oops, something went wrong.