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.
- Loading branch information
Showing
67 changed files
with
3,230 additions
and
1,124 deletions.
There are no files selected for viewing
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,111 @@ | ||
// automatically generated by the FlatBuffers compiler, do not modify | ||
|
||
|
||
#ifndef FLATBUFFERS_GENERATED_CALMETADATA_H_ | ||
#define FLATBUFFERS_GENERATED_CALMETADATA_H_ | ||
|
||
#include "flatbuffers/flatbuffers.h" | ||
|
||
struct Metadata; | ||
|
||
struct Metadata FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { | ||
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { | ||
VT_NAME = 4, | ||
VT_SERIAL = 6, | ||
VT_TIMESTAMP = 8, | ||
VT_VERSION_MAJOR = 10, | ||
VT_VERSION_MINOR = 12 | ||
}; | ||
const flatbuffers::String *name() const { | ||
return GetPointer<const flatbuffers::String *>(VT_NAME); | ||
} | ||
const flatbuffers::String *serial() const { | ||
return GetPointer<const flatbuffers::String *>(VT_SERIAL); | ||
} | ||
uint64_t timestamp() const { | ||
return GetField<uint64_t>(VT_TIMESTAMP, 0); | ||
} | ||
int32_t version_major() const { | ||
return GetField<int32_t>(VT_VERSION_MAJOR, 0); | ||
} | ||
int32_t version_minor() const { | ||
return GetField<int32_t>(VT_VERSION_MINOR, 0); | ||
} | ||
bool Verify(flatbuffers::Verifier &verifier) const { | ||
return VerifyTableStart(verifier) && | ||
VerifyOffset(verifier, VT_NAME) && | ||
verifier.VerifyString(name()) && | ||
VerifyOffset(verifier, VT_SERIAL) && | ||
verifier.VerifyString(serial()) && | ||
VerifyField<uint64_t>(verifier, VT_TIMESTAMP) && | ||
VerifyField<int32_t>(verifier, VT_VERSION_MAJOR) && | ||
VerifyField<int32_t>(verifier, VT_VERSION_MINOR) && | ||
verifier.EndTable(); | ||
} | ||
}; | ||
|
||
struct MetadataBuilder { | ||
flatbuffers::FlatBufferBuilder &fbb_; | ||
flatbuffers::uoffset_t start_; | ||
void add_name(flatbuffers::Offset<flatbuffers::String> name) { | ||
fbb_.AddOffset(Metadata::VT_NAME, name); | ||
} | ||
void add_serial(flatbuffers::Offset<flatbuffers::String> serial) { | ||
fbb_.AddOffset(Metadata::VT_SERIAL, serial); | ||
} | ||
void add_timestamp(uint64_t timestamp) { | ||
fbb_.AddElement<uint64_t>(Metadata::VT_TIMESTAMP, timestamp, 0); | ||
} | ||
void add_version_major(int32_t version_major) { | ||
fbb_.AddElement<int32_t>(Metadata::VT_VERSION_MAJOR, version_major, 0); | ||
} | ||
void add_version_minor(int32_t version_minor) { | ||
fbb_.AddElement<int32_t>(Metadata::VT_VERSION_MINOR, version_minor, 0); | ||
} | ||
explicit MetadataBuilder(flatbuffers::FlatBufferBuilder &_fbb) | ||
: fbb_(_fbb) { | ||
start_ = fbb_.StartTable(); | ||
} | ||
MetadataBuilder &operator=(const MetadataBuilder &); | ||
flatbuffers::Offset<Metadata> Finish() { | ||
const auto end = fbb_.EndTable(start_); | ||
auto o = flatbuffers::Offset<Metadata>(end); | ||
return o; | ||
} | ||
}; | ||
|
||
inline flatbuffers::Offset<Metadata> CreateMetadata( | ||
flatbuffers::FlatBufferBuilder &_fbb, | ||
flatbuffers::Offset<flatbuffers::String> name = 0, | ||
flatbuffers::Offset<flatbuffers::String> serial = 0, | ||
uint64_t timestamp = 0, | ||
int32_t version_major = 0, | ||
int32_t version_minor = 0) { | ||
MetadataBuilder builder_(_fbb); | ||
builder_.add_timestamp(timestamp); | ||
builder_.add_version_minor(version_minor); | ||
builder_.add_version_major(version_major); | ||
builder_.add_serial(serial); | ||
builder_.add_name(name); | ||
return builder_.Finish(); | ||
} | ||
|
||
inline flatbuffers::Offset<Metadata> CreateMetadataDirect( | ||
flatbuffers::FlatBufferBuilder &_fbb, | ||
const char *name = nullptr, | ||
const char *serial = nullptr, | ||
uint64_t timestamp = 0, | ||
int32_t version_major = 0, | ||
int32_t version_minor = 0) { | ||
auto name__ = name ? _fbb.CreateString(name) : 0; | ||
auto serial__ = serial ? _fbb.CreateString(serial) : 0; | ||
return CreateMetadata( | ||
_fbb, | ||
name__, | ||
serial__, | ||
timestamp, | ||
version_major, | ||
version_minor); | ||
} | ||
|
||
#endif // FLATBUFFERS_GENERATED_CALMETADATA_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,130 @@ | ||
// | ||
// Copyright 2020 Ettus Research, a National Instruments Brand | ||
// | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
// | ||
|
||
#ifndef INCLUDED_LIBUHD_CAL_GAIN_HPP | ||
#define INCLUDED_LIBUHD_CAL_GAIN_HPP | ||
|
||
#include <uhd/cal/container.hpp> | ||
#include <uhd/config.hpp> | ||
#include <boost/optional.hpp> | ||
#include <array> | ||
#include <map> | ||
|
||
namespace uhd { namespace usrp { namespace cal { | ||
|
||
/*! Class that stores DSA indices for all ZBX TX bands. | ||
*/ | ||
class UHD_API zbx_tx_dsa_cal : public container | ||
{ | ||
public: | ||
static constexpr uint32_t NUM_AMP = 1; | ||
static constexpr uint32_t NUM_DSA = 2 + NUM_AMP; | ||
static constexpr uint32_t NUM_GAIN_STAGES = 61; | ||
|
||
using sptr = std::shared_ptr<zbx_tx_dsa_cal>; | ||
using step_settings = std::array<uint32_t, NUM_DSA>; | ||
|
||
/*! Add a new band description | ||
* | ||
* max_freq is the (inclusive) upper limit | ||
* for the band (lower limit derives from the other bands). Name is an | ||
* text representation (human readable) for the band. dsa_steps is an | ||
* array of DSA settings for all gains in the band. | ||
*/ | ||
virtual void add_frequency_band(const double max_freq, | ||
const std::string& name, | ||
std::array<step_settings, NUM_GAIN_STAGES> dsa_steps) = 0; | ||
|
||
/*! Retrieves DSA settings for frequency and gain_index. | ||
* | ||
* The settings are | ||
* retrieved from the band with the biggest max_freq that is smaller or | ||
* equal to freq. DSA settings are the settings at gain_index in that band. | ||
* Value errors are thrown if freq is larger that the largest freq_max of | ||
* all bands or gain_index is not within range. | ||
*/ | ||
virtual const step_settings get_dsa_setting( | ||
const double freq, const size_t gain_index) const = 0; | ||
|
||
/* Check whether two frequencies map to the same band. | ||
*/ | ||
virtual bool is_same_band(double freq1, double freq2) const = 0; | ||
|
||
/*! Retrieves DSA settings as flat list. | ||
* The values are flattened by frequency band, gain and values in that order. | ||
* Use NUM_DSA and NUM_GAIN_STAGES to find values in the list. | ||
*/ | ||
virtual std::vector<uint32_t> get_band_settings(double freq, uint8_t dsa) const = 0; | ||
|
||
/*! | ||
* Clear all stored values | ||
*/ | ||
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(); | ||
}; | ||
|
||
/*! Class that stores DSA indices for all ZBX TX bands. | ||
*/ | ||
class UHD_API zbx_rx_dsa_cal : public container | ||
{ | ||
public: | ||
static constexpr uint32_t NUM_DSA = 4; | ||
static constexpr uint32_t NUM_GAIN_STAGES = 61; | ||
|
||
using sptr = std::shared_ptr<zbx_rx_dsa_cal>; | ||
using step_settings = std::array<uint32_t, NUM_DSA>; | ||
|
||
/*! Add a new band description. | ||
* | ||
* max_freq is the (inclusive) upper limit | ||
* for the band (lower limit derives from the other bands). Name is an | ||
* text representation (human readable) for the band. dsa_steps is an | ||
* array of DSA settings for all gains in the band. | ||
*/ | ||
virtual void add_frequency_band(const double max_freq, | ||
const std::string& name, | ||
std::array<step_settings, NUM_GAIN_STAGES> dsa_steps) = 0; | ||
|
||
virtual bool is_same_band(double freq1, double freq2) const = 0; | ||
/*! Retrieves DSA settings for frequency and gain_index. | ||
* | ||
* The settings are | ||
* retrieved from the band with the biggest max_freq that is smaller or | ||
* equal to freq. DSA settings are the settings at gain_index in that band. | ||
* Value errors are thrown if freq is larger that the largest freq_max of | ||
* all bands or gain_index is not within range. | ||
*/ | ||
virtual const step_settings get_dsa_setting( | ||
const double freq, const size_t gain_index) const = 0; | ||
|
||
/*! Retrieves DSA settings as flat list. | ||
* The values are flattend by frequency band, gain and values in that order. | ||
* Use NUM_DSA and NUM_GAIN_STAGES to find values in the list. | ||
*/ | ||
virtual std::vector<uint32_t> get_band_settings(double freq, uint8_t dsa) const = 0; | ||
|
||
/*! | ||
* Clear all stored values | ||
*/ | ||
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 | ||
|
||
#endif /* INCLUDED_LIBUHD_CAL_GAIN_HPP */ |
Oops, something went wrong.