57 qCritical(
"DeviceBladeRF2::open: could not open BladeRF");
61 fpga_loaded = bladerf_is_fpga_configured(
m_dev);
65 qCritical(
"DeviceBladeRF2::open: failed to check FPGA state: %s",
66 bladerf_strerror(fpga_loaded));
69 else if (fpga_loaded == 0)
71 qCritical(
"DeviceBladeRF2::open: the device's FPGA is not loaded.");
99 struct bladerf_devinfo info;
105 bladerf_init_devinfo(&info);
111 strncpy(info.serial, serial, BLADERF_SERIAL_LENGTH - 1);
112 info.serial[BLADERF_SERIAL_LENGTH - 1] =
'\0';
115 status = bladerf_open_with_devinfo(&dev, &info);
117 if (status == BLADERF_ERR_NODEV)
119 qCritical(
"DeviceBladeRF2::open_bladerf_from_serial: No devices available with serial %s", serial);
122 else if (status != 0)
124 qCritical(
"DeviceBladeRF2::open_bladerf_from_serial: Failed to open device with serial %s (%s)",
125 serial, bladerf_strerror(status));
142 qCritical(
"DeviceBladeRF2::openRx: invalid Rx channel index %d", channel);
150 status = bladerf_enable_module(
m_dev, BLADERF_CHANNEL_RX(channel),
true);
154 qCritical(
"DeviceBladeRF2::openRx: failed to enable Rx channel %d: %s",
155 channel, bladerf_strerror(status));
160 qDebug(
"DeviceBladeRF2::openRx: Rx channel %d enabled", channel);
167 qDebug(
"DeviceBladeRF2::openRx: Rx channel %d already opened", channel);
180 qCritical(
"DeviceBladeRF2::openTx: invalid Tx channel index %d", channel);
188 status = bladerf_enable_module(
m_dev, BLADERF_CHANNEL_TX(channel),
true);
192 qCritical(
"DeviceBladeRF2::openTx: Failed to enable Tx channel %d: %s",
193 channel, bladerf_strerror(status));
198 qDebug(
"DeviceBladeRF2::openTx: Tx channel %d enabled", channel);
205 qDebug(
"DeviceBladeRF2::openTx: Tx channel %d already opened", channel);
218 qCritical(
"DeviceBladeRF2::closeRx: invalid Rx channel index %d", channel);
224 int status = bladerf_enable_module(
m_dev, BLADERF_CHANNEL_RX(channel),
false);
228 qCritical(
"DeviceBladeRF2::closeRx: failed to disable Rx channel %d: %s", channel, bladerf_strerror(status));
230 qDebug(
"DeviceBladeRF2::closeRx: Rx channel %d disabled", channel);
235 qDebug(
"DeviceBladeRF2::closeRx: Rx channel %d already closed", channel);
247 qCritical(
"DeviceBladeRF2::closeTx: invalid Tx channel index %d", channel);
253 int status = bladerf_enable_module(
m_dev, BLADERF_CHANNEL_TX(channel),
false);
257 qCritical(
"DeviceBladeRF2::closeTx: failed to disable Tx channel %d: %s", channel, bladerf_strerror(status));
259 qDebug(
"DeviceBladeRF2::closeTx: Tx channel %d disabled", channel);
264 qDebug(
"DeviceBladeRF2::closeTx: Rx channel %d already closed", channel);
272 const struct bladerf_range *range;
275 status = bladerf_get_frequency_range(
m_dev, BLADERF_CHANNEL_RX(0), &range);
279 qCritical(
"DeviceBladeRF2::getFrequencyRangeRx: Failed to get Rx frequency range: %s",
280 bladerf_strerror(status));
295 const struct bladerf_range *range;
298 status = bladerf_get_frequency_range(
m_dev, BLADERF_CHANNEL_TX(0), &range);
302 qCritical(
"DeviceBladeRF2::getFrequencyRangeTx: Failed to get Tx frequency range: %s",
303 bladerf_strerror(status));
318 const struct bladerf_range *range;
321 status = bladerf_get_sample_rate_range(
m_dev, BLADERF_CHANNEL_RX(0), &range);
325 qCritical(
"DeviceBladeRF2::getSampleRateRangeRx: Failed to get Rx sample rate range: %s",
326 bladerf_strerror(status));
341 const struct bladerf_range *range;
344 status = bladerf_get_sample_rate_range(
m_dev, BLADERF_CHANNEL_TX(0), &range);
348 qCritical(
"DeviceBladeRF2::getSampleRateRangeTx: Failed to get Tx sample rate range: %s",
349 bladerf_strerror(status));
365 const struct bladerf_range *range;
368 status = bladerf_get_bandwidth_range(
m_dev, BLADERF_CHANNEL_RX(0), &range);
372 qCritical(
"DeviceBladeRF2::getBandwidthRangeRx: Failed to get Rx bandwidth range: %s",
373 bladerf_strerror(status));
388 const struct bladerf_range *range;
391 status = bladerf_get_bandwidth_range(
m_dev, BLADERF_CHANNEL_TX(0), &range);
395 qCritical(
"DeviceBladeRF2::getBandwidthRangeTx: Failed to get Tx bandwidth range: %s",
396 bladerf_strerror(status));
411 const struct bladerf_range *range;
414 status = bladerf_get_gain_range(
m_dev, BLADERF_CHANNEL_RX(0), &range);
418 qCritical(
"DeviceBladeRF2::getGlobalGainRangeRx: Failed to get Rx global gain range: %s",
419 bladerf_strerror(status));
434 const struct bladerf_range *range;
437 status = bladerf_get_gain_range(
m_dev, BLADERF_CHANNEL_TX(0), &range);
441 qCritical(
"DeviceBladeRF2::getGlobalGainRangeTx: Failed to get Tx global gain range: %s",
442 bladerf_strerror(status));
457 int n = bladerf_get_gain_modes(
m_dev, BLADERF_CHANNEL_RX(0), 0);
461 qCritical(
"DeviceBladeRF2::getGainModesRx: Failed to get the number of Rx gain modes: %s", bladerf_strerror(n));
465 int status = bladerf_get_gain_modes(
m_dev, BLADERF_CHANNEL_RX(0), modes);
469 qCritical(
"DeviceBladeRF2::getGainModesRx: Failed to get Rx gain modes: %s", bladerf_strerror(status));
487 int status = bladerf_set_bias_tee(
m_dev, BLADERF_CHANNEL_RX(0), enable);
490 qCritical(
"DeviceBladeRF2::setBiasTeeRx: Failed to set Rx bias tee: %s", bladerf_strerror(status));
499 int status = bladerf_set_bias_tee(
m_dev, BLADERF_CHANNEL_TX(0), enable);
502 qCritical(
"DeviceBladeRF2::setBiasTeeTx: Failed to set Tx bias tee: %s", bladerf_strerror(status));
static struct bladerf * open_bladerf_from_serial(const char *serial)
void getGlobalGainRangeTx(int &min, int &max, int &step)
void getBandwidthRangeRx(int &min, int &max, int &step)
void setBiasTeeTx(bool enable)
void getBandwidthRangeTx(int &min, int &max, int &step)
void getSampleRateRangeTx(int &min, int &max, int &step)
void getFrequencyRangeRx(uint64_t &min, uint64_t &max, int &step)
void getSampleRateRangeRx(int &min, int &max, int &step)
void setBiasTeeRx(bool enable)
void getFrequencyRangeTx(uint64_t &min, uint64_t &max, int &step)
bool open(const char *serial)
void closeRx(int channel)
void getGlobalGainRangeRx(int &min, int &max, int &step)
int getGainModesRx(const bladerf_gain_modes **)
void closeTx(int channel)
T max(const T &x, const T &y)
T min(const T &x, const T &y)
unsigned __int64 uint64_t