aboutsummaryrefslogtreecommitdiffstats
path: root/host
diff options
context:
space:
mode:
authorLars Amsel <lars.amsel@ni.com>2020-06-19 13:29:33 +0200
committerAaron Rossetto <aaron.rossetto@ni.com>2020-06-23 12:25:05 -0500
commitb772b5b2cb8b0c55187142e69e4abe22ef27df5c (patch)
treee26ac47cba5ccfd0c4fdc4d80f7368697b49f624 /host
parenta9e91b016926bacbd79ca40b538c64233acd3f90 (diff)
downloaduhd-b772b5b2cb8b0c55187142e69e4abe22ef27df5c.tar.gz
uhd-b772b5b2cb8b0c55187142e69e4abe22ef27df5c.tar.bz2
uhd-b772b5b2cb8b0c55187142e69e4abe22ef27df5c.zip
cal: change default extension of calibration files
Flatbuffers offers an option to set the default extension for binary files. Our calibration files have the extension .cal. Set the extension in all schema files to ease conversion between binary and text representation of calibration files. Updated documentation accordingly.
Diffstat (limited to 'host')
-rw-r--r--host/docs/calibration.dox4
-rw-r--r--host/include/uhd/cal/iq_cal.fbs1
-rw-r--r--host/include/uhd/cal/iq_cal_generated.h28
-rw-r--r--host/include/uhd/cal/pwr_cal.fbs1
-rw-r--r--host/include/uhd/cal/pwr_cal_generated.h12
5 files changed, 30 insertions, 16 deletions
diff --git a/host/docs/calibration.dox b/host/docs/calibration.dox
index 162bd8825..90beda82d 100644
--- a/host/docs/calibration.dox
+++ b/host/docs/calibration.dox
@@ -97,8 +97,8 @@ The JSON data can be converted back to binary using
flatc -b <install dir>/include/uhd/cal/<foo>_cal.fbs <data>.json
-This generates a `<data>.bin` that can be read by the calibration routines
-of UHD. To make UHD reading these files you need to rename it to `<data>.cal`.
+This generates a `<data>.cal` that can be read by the calibration routines
+of UHD.
\subsection calibration_data_csv Converting UHD 3.x calibration data to UHD 4
diff --git a/host/include/uhd/cal/iq_cal.fbs b/host/include/uhd/cal/iq_cal.fbs
index 55c9ae3de..8aeda185e 100644
--- a/host/include/uhd/cal/iq_cal.fbs
+++ b/host/include/uhd/cal/iq_cal.fbs
@@ -30,3 +30,4 @@ table IQCalCoeffs
root_type IQCalCoeffs;
file_identifier "IQ/f"; // I/Q data per frequency
+file_extension "cal";
diff --git a/host/include/uhd/cal/iq_cal_generated.h b/host/include/uhd/cal/iq_cal_generated.h
index f0dfa0b82..0e5aabb1c 100644
--- a/host/include/uhd/cal/iq_cal_generated.h
+++ b/host/include/uhd/cal/iq_cal_generated.h
@@ -15,6 +15,7 @@ namespace cal {
struct IQCalCoeff;
struct IQCalCoeffs;
+struct IQCalCoeffsBuilder;
FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) IQCalCoeff FLATBUFFERS_FINAL_CLASS {
private:
@@ -25,8 +26,12 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) IQCalCoeff FLATBUFFERS_FINAL_CLASS {
double suppression_delta_;
public:
- IQCalCoeff() {
- memset(static_cast<void *>(this), 0, sizeof(IQCalCoeff));
+ IQCalCoeff()
+ : freq_(0),
+ coeff_real_(0),
+ coeff_imag_(0),
+ suppression_abs_(0),
+ suppression_delta_(0) {
}
IQCalCoeff(double _freq, double _coeff_real, double _coeff_imag, double _suppression_abs, double _suppression_delta)
: freq_(flatbuffers::EndianScalar(_freq)),
@@ -54,6 +59,7 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) IQCalCoeff FLATBUFFERS_FINAL_CLASS {
FLATBUFFERS_STRUCT_END(IQCalCoeff, 40);
struct IQCalCoeffs FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
+ typedef IQCalCoeffsBuilder Builder;
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_METADATA = 4,
VT_COEFFS = 6
@@ -61,8 +67,8 @@ struct IQCalCoeffs FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
const Metadata *metadata() const {
return GetPointer<const Metadata *>(VT_METADATA);
}
- const flatbuffers::Vector<const IQCalCoeff *> *coeffs() const {
- return GetPointer<const flatbuffers::Vector<const IQCalCoeff *> *>(VT_COEFFS);
+ const flatbuffers::Vector<const uhd::usrp::cal::IQCalCoeff *> *coeffs() const {
+ return GetPointer<const flatbuffers::Vector<const uhd::usrp::cal::IQCalCoeff *> *>(VT_COEFFS);
}
bool Verify(flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
@@ -75,19 +81,19 @@ struct IQCalCoeffs FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
};
struct IQCalCoeffsBuilder {
+ typedef IQCalCoeffs Table;
flatbuffers::FlatBufferBuilder &fbb_;
flatbuffers::uoffset_t start_;
void add_metadata(flatbuffers::Offset<Metadata> metadata) {
fbb_.AddOffset(IQCalCoeffs::VT_METADATA, metadata);
}
- void add_coeffs(flatbuffers::Offset<flatbuffers::Vector<const IQCalCoeff *>> coeffs) {
+ void add_coeffs(flatbuffers::Offset<flatbuffers::Vector<const uhd::usrp::cal::IQCalCoeff *>> coeffs) {
fbb_.AddOffset(IQCalCoeffs::VT_COEFFS, coeffs);
}
explicit IQCalCoeffsBuilder(flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- IQCalCoeffsBuilder &operator=(const IQCalCoeffsBuilder &);
flatbuffers::Offset<IQCalCoeffs> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<IQCalCoeffs>(end);
@@ -98,7 +104,7 @@ struct IQCalCoeffsBuilder {
inline flatbuffers::Offset<IQCalCoeffs> CreateIQCalCoeffs(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<Metadata> metadata = 0,
- flatbuffers::Offset<flatbuffers::Vector<const IQCalCoeff *>> coeffs = 0) {
+ flatbuffers::Offset<flatbuffers::Vector<const uhd::usrp::cal::IQCalCoeff *>> coeffs = 0) {
IQCalCoeffsBuilder builder_(_fbb);
builder_.add_coeffs(coeffs);
builder_.add_metadata(metadata);
@@ -108,8 +114,8 @@ inline flatbuffers::Offset<IQCalCoeffs> CreateIQCalCoeffs(
inline flatbuffers::Offset<IQCalCoeffs> CreateIQCalCoeffsDirect(
flatbuffers::FlatBufferBuilder &_fbb,
flatbuffers::Offset<Metadata> metadata = 0,
- const std::vector<IQCalCoeff> *coeffs = nullptr) {
- auto coeffs__ = coeffs ? _fbb.CreateVectorOfStructs<IQCalCoeff>(*coeffs) : 0;
+ const std::vector<uhd::usrp::cal::IQCalCoeff> *coeffs = nullptr) {
+ auto coeffs__ = coeffs ? _fbb.CreateVectorOfStructs<uhd::usrp::cal::IQCalCoeff>(*coeffs) : 0;
return uhd::usrp::cal::CreateIQCalCoeffs(
_fbb,
metadata,
@@ -143,6 +149,10 @@ inline bool VerifySizePrefixedIQCalCoeffsBuffer(
return verifier.VerifySizePrefixedBuffer<uhd::usrp::cal::IQCalCoeffs>(IQCalCoeffsIdentifier());
}
+inline const char *IQCalCoeffsExtension() {
+ return "cal";
+}
+
inline void FinishIQCalCoeffsBuffer(
flatbuffers::FlatBufferBuilder &fbb,
flatbuffers::Offset<uhd::usrp::cal::IQCalCoeffs> root) {
diff --git a/host/include/uhd/cal/pwr_cal.fbs b/host/include/uhd/cal/pwr_cal.fbs
index 7cf66feee..6aa19d10f 100644
--- a/host/include/uhd/cal/pwr_cal.fbs
+++ b/host/include/uhd/cal/pwr_cal.fbs
@@ -44,3 +44,4 @@ table PowerCal
root_type PowerCal;
file_identifier "dB/m"; // dB per dBm
+file_extension "cal";
diff --git a/host/include/uhd/cal/pwr_cal_generated.h b/host/include/uhd/cal/pwr_cal_generated.h
index f7ea8d8a7..6dc6cc103 100644
--- a/host/include/uhd/cal/pwr_cal_generated.h
+++ b/host/include/uhd/cal/pwr_cal_generated.h
@@ -29,8 +29,9 @@ FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(8) PowerMap FLATBUFFERS_FINAL_CLASS {
double power_dbm_;
public:
- PowerMap() {
- memset(static_cast<void *>(this), 0, sizeof(PowerMap));
+ PowerMap()
+ : gain_(0),
+ power_dbm_(0) {
}
PowerMap(double _gain, double _power_dbm)
: gain_(flatbuffers::EndianScalar(_gain)),
@@ -108,7 +109,6 @@ struct FreqPowerMapBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- FreqPowerMapBuilder &operator=(const FreqPowerMapBuilder &);
flatbuffers::Offset<FreqPowerMap> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<FreqPowerMap>(end);
@@ -187,7 +187,6 @@ struct TempFreqMapBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- TempFreqMapBuilder &operator=(const TempFreqMapBuilder &);
flatbuffers::Offset<TempFreqMap> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<TempFreqMap>(end);
@@ -261,7 +260,6 @@ struct PowerCalBuilder {
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
- PowerCalBuilder &operator=(const PowerCalBuilder &);
flatbuffers::Offset<PowerCal> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = flatbuffers::Offset<PowerCal>(end);
@@ -321,6 +319,10 @@ inline bool VerifySizePrefixedPowerCalBuffer(
return verifier.VerifySizePrefixedBuffer<uhd::usrp::cal::PowerCal>(PowerCalIdentifier());
}
+inline const char *PowerCalExtension() {
+ return "cal";
+}
+
inline void FinishPowerCalBuffer(
flatbuffers::FlatBufferBuilder &fbb,
flatbuffers::Offset<uhd::usrp::cal::PowerCal> root) {