mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-06-09 01:54:09 +00:00
Apply clang-format, fix libiio detection in MacOS
This commit is contained in:
parent
1d0452463f
commit
b31f929655
@ -9,11 +9,12 @@ FIND_PATH(
|
||||
PATHS ${CMAKE_INSTALL_PREFIX}/include
|
||||
/usr/local/include
|
||||
/usr/include
|
||||
/opt/local/include
|
||||
)
|
||||
|
||||
FIND_LIBRARY(
|
||||
LIBIIO_LIBRARIES
|
||||
NAMES libiio.so
|
||||
NAMES libiio.so iio
|
||||
HINTS $ENV{LIBIIO_DIR}/lib
|
||||
${PC_LIBIIO_LIBDIR}
|
||||
PATHS ${CMAKE_INSTALL_PREFIX}/lib
|
||||
@ -23,10 +24,30 @@ FIND_LIBRARY(
|
||||
/usr/lib
|
||||
/usr/lib64
|
||||
/usr/lib/x86_64-linux-gnu
|
||||
/usr/lib/gcc/alpha-linux-gnu
|
||||
/usr/lib/gcc/aarch64-linux-gnu
|
||||
/usr/lib/gcc/arm-linux-gnueabi
|
||||
/usr/lib/gcc/arm-linux-gnueabihf
|
||||
/usr/lib/gcc/hppa-linux-gnu
|
||||
/usr/lib/gcc/i686-gnu
|
||||
/usr/lib/gcc/i686-linux-gnu
|
||||
/usr/lib/gcc/x86_64-kfreebsd-gnu
|
||||
/usr/lib/gcc/i686-kfreebsd-gnu
|
||||
/usr/lib/gcc/m68k-linux-gnu
|
||||
/usr/lib/gcc/mips-linux-gnu
|
||||
/usr/lib/gcc/mips64el-linux-gnuabi64
|
||||
/usr/lib/gcc/mipsel-linux-gnu
|
||||
/usr/lib/gcc/powerpc-linux-gnu
|
||||
/usr/lib/gcc/powerpc-linux-gnuspe
|
||||
/usr/lib/gcc/powerpc64-linux-gnu
|
||||
/usr/lib/gcc/powerpc64le-linux-gnu
|
||||
/usr/lib/gcc/s390x-linux-gnu
|
||||
/usr/lib/gcc/sparc64-linux-gnu
|
||||
/usr/lib/gcc/x86_64-linux-gnux32
|
||||
/usr/lib/gcc/sh4-linux-gnu
|
||||
/Library/Frameworks/iio.framework/
|
||||
)
|
||||
|
||||
message("find libiio:")
|
||||
message(${LIBIIO_LIBRARIES})
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBIIO DEFAULT_MSG LIBIIO_LIBRARIES LIBIIO_INCLUDE_DIRS)
|
||||
MARK_AS_ADVANCED(LIBIIO_LIBRARIES LIBIIO_INCLUDE_DIRS)
|
||||
|
@ -78,7 +78,6 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration
|
||||
phase_dds_deg_ = configuration->property(role + ".phase_dds_deg", 0.0);
|
||||
tx_attenuation_db_ = configuration->property(role + ".tx_attenuation_db", 0.0);
|
||||
|
||||
|
||||
item_size_ = sizeof(gr_complex);
|
||||
|
||||
std::cout << "device address: " << uri_ << std::endl;
|
||||
@ -149,10 +148,11 @@ Fmcomms2SignalSource::Fmcomms2SignalSource(ConfigurationInterface* configuration
|
||||
scale_dds_dbfs_);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(FATAL) << "Configuration error: Unsupported number of RF_channels !";
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -35,26 +35,31 @@
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
|
||||
/* check return value of attr_write function */
|
||||
void errchk(int v, const char* what) {
|
||||
void errchk(int v, const char *what)
|
||||
{
|
||||
if (v < 0)
|
||||
{
|
||||
LOG(WARNING) << "Error " << v << " writing to channel " << what << " value may not be supported. ";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* write attribute: long long int */
|
||||
void wr_ch_lli(struct iio_channel *chn, const char *what, long long val)
|
||||
{
|
||||
errchk(iio_channel_attr_write_longlong(chn, what, val), what);
|
||||
}
|
||||
|
||||
|
||||
/* write attribute: string */
|
||||
void wr_ch_str(struct iio_channel *chn, const char *what, const char *str)
|
||||
{
|
||||
errchk(iio_channel_attr_write(chn, what, str), what);
|
||||
}
|
||||
|
||||
|
||||
/* returns ad9361 phy device */
|
||||
struct iio_device *get_ad9361_phy(struct iio_context *ctx)
|
||||
{
|
||||
@ -62,16 +67,24 @@ struct iio_device* get_ad9361_phy(struct iio_context *ctx)
|
||||
return dev;
|
||||
}
|
||||
|
||||
|
||||
/* finds AD9361 streaming IIO devices */
|
||||
bool get_ad9361_stream_dev(struct iio_context *ctx, enum iodev d, struct iio_device **dev)
|
||||
{
|
||||
switch (d) {
|
||||
case TX: *dev = iio_context_find_device(ctx, "cf-ad9361-dds-core-lpc"); return *dev != NULL;
|
||||
case RX: *dev = iio_context_find_device(ctx, "cf-ad9361-lpc"); return *dev != NULL;
|
||||
default: return false;
|
||||
switch (d)
|
||||
{
|
||||
case TX:
|
||||
*dev = iio_context_find_device(ctx, "cf-ad9361-dds-core-lpc");
|
||||
return *dev != NULL;
|
||||
case RX:
|
||||
*dev = iio_context_find_device(ctx, "cf-ad9361-lpc");
|
||||
return *dev != NULL;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* finds AD9361 streaming IIO channels */
|
||||
bool get_ad9361_stream_ch(struct iio_context *ctx, enum iodev d, struct iio_device *dev, int chid, struct iio_channel **chn)
|
||||
{
|
||||
@ -90,11 +103,13 @@ bool get_ad9361_stream_ch(struct iio_context *ctx, enum iodev d, struct iio_devi
|
||||
return *chn != NULL;
|
||||
}
|
||||
|
||||
|
||||
/* finds AD9361 phy IIO configuration channel with id chid */
|
||||
bool get_phy_chan(struct iio_context *ctx, enum iodev d, int chid, struct iio_channel **chn)
|
||||
{
|
||||
std::stringstream name;
|
||||
switch (d) {
|
||||
switch (d)
|
||||
{
|
||||
case RX:
|
||||
name.str("");
|
||||
name << "voltage";
|
||||
@ -109,14 +124,17 @@ bool get_phy_chan(struct iio_context *ctx, enum iodev d, int chid, struct iio_ch
|
||||
*chn = iio_device_find_channel(get_ad9361_phy(ctx), name.str().c_str(), true);
|
||||
return *chn != NULL;
|
||||
break;
|
||||
default: return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* finds AD9361 local oscillator IIO configuration channels */
|
||||
bool get_lo_chan(struct iio_context *ctx, enum iodev d, struct iio_channel **chn)
|
||||
{
|
||||
switch (d) {
|
||||
switch (d)
|
||||
{
|
||||
// LO chan is always output, i.e. true
|
||||
case RX:
|
||||
*chn = iio_device_find_channel(get_ad9361_phy(ctx), "altvoltage0", true);
|
||||
@ -138,7 +156,10 @@ bool cfg_ad9361_streaming_ch(struct iio_context *ctx, struct stream_cfg *cfg, en
|
||||
// Configure phy and lo channels
|
||||
//LOG(INFO)<<"* Acquiring AD9361 phy channel"<<chid;
|
||||
std::cout << "* Acquiring AD9361 phy channel" << chid << std::endl;
|
||||
if (!get_phy_chan(ctx, type, chid, &chn)) { return false; }
|
||||
if (!get_phy_chan(ctx, type, chid, &chn))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
wr_ch_str(chn, "rf_port_select", cfg->rfport);
|
||||
wr_ch_lli(chn, "rf_bandwidth", cfg->bw_hz);
|
||||
wr_ch_lli(chn, "sampling_frequency", cfg->fs_hz);
|
||||
@ -146,7 +167,10 @@ bool cfg_ad9361_streaming_ch(struct iio_context *ctx, struct stream_cfg *cfg, en
|
||||
// Configure LO channel
|
||||
//LOG(INFO)<<"* Acquiring AD9361 "<<type == TX ? "TX" : "RX";
|
||||
std::cout << "* Acquiring AD9361 " << (type == TX ? "TX" : "RX") << std::endl;
|
||||
if (!get_lo_chan(ctx, type, &chn)) { return false; }
|
||||
if (!get_lo_chan(ctx, type, &chn))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
wr_ch_lli(chn, "frequency", cfg->lo_hz);
|
||||
return true;
|
||||
}
|
||||
@ -226,31 +250,38 @@ bool config_ad9361_rx_local(unsigned long bandwidth_,
|
||||
ad9361_phy = iio_context_find_device(ctx, "ad9361-phy");
|
||||
int ret;
|
||||
ret = iio_device_attr_write(ad9361_phy, "trx_rate_governor", "nominal");
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set trx_rate_governor: " << ret << std::endl;
|
||||
}
|
||||
ret = iio_device_attr_write(ad9361_phy, "ensm_mode", "fdd");
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set ensm_mode: " << ret << std::endl;
|
||||
}
|
||||
ret = iio_device_attr_write(ad9361_phy, "calib_mode", "auto");
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set calib_mode: " << ret << std::endl;
|
||||
}
|
||||
ret = iio_device_attr_write(ad9361_phy, "in_voltage0_gain_control_mode", gain_mode_rx1_.c_str());
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set in_voltage0_gain_control_mode: " << ret << std::endl;
|
||||
}
|
||||
ret = iio_device_attr_write(ad9361_phy, "in_voltage1_gain_control_mode", gain_mode_rx2_.c_str());
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set in_voltage1_gain_control_mode: " << ret << std::endl;
|
||||
}
|
||||
ret = iio_device_attr_write_double(ad9361_phy, "in_voltage0_hardwaregain", rf_gain_rx1_);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set in_voltage0_hardwaregain: " << ret << std::endl;
|
||||
}
|
||||
ret = iio_device_attr_write_double(ad9361_phy, "in_voltage1_hardwaregain", rf_gain_rx2_);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set in_voltage1_hardwaregain: " << ret << std::endl;
|
||||
}
|
||||
|
||||
@ -259,6 +290,7 @@ bool config_ad9361_rx_local(unsigned long bandwidth_,
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool config_ad9361_rx_remote(std::string remote_host,
|
||||
unsigned long bandwidth_,
|
||||
unsigned long sample_rate_,
|
||||
@ -334,31 +366,38 @@ bool config_ad9361_rx_remote(std::string remote_host,
|
||||
ad9361_phy = iio_context_find_device(ctx, "ad9361-phy");
|
||||
int ret;
|
||||
ret = iio_device_attr_write(ad9361_phy, "trx_rate_governor", "nominal");
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set trx_rate_governor: " << ret << std::endl;
|
||||
}
|
||||
ret = iio_device_attr_write(ad9361_phy, "ensm_mode", "fdd");
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set ensm_mode: " << ret << std::endl;
|
||||
}
|
||||
ret = iio_device_attr_write(ad9361_phy, "calib_mode", "auto");
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set calib_mode: " << ret << std::endl;
|
||||
}
|
||||
ret = iio_device_attr_write(ad9361_phy, "in_voltage0_gain_control_mode", gain_mode_rx1_.c_str());
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set in_voltage0_gain_control_mode: " << ret << std::endl;
|
||||
}
|
||||
ret = iio_device_attr_write(ad9361_phy, "in_voltage1_gain_control_mode", gain_mode_rx2_.c_str());
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set in_voltage1_gain_control_mode: " << ret << std::endl;
|
||||
}
|
||||
ret = iio_device_attr_write_double(ad9361_phy, "in_voltage0_hardwaregain", rf_gain_rx1_);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set in_voltage0_hardwaregain: " << ret << std::endl;
|
||||
}
|
||||
ret = iio_device_attr_write_double(ad9361_phy, "in_voltage1_hardwaregain", rf_gain_rx2_);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set in_voltage1_hardwaregain: " << ret << std::endl;
|
||||
}
|
||||
|
||||
@ -368,6 +407,7 @@ bool config_ad9361_rx_remote(std::string remote_host,
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool config_ad9361_lo_local(unsigned long bandwidth_,
|
||||
unsigned long sample_rate_,
|
||||
unsigned long freq_rf_tx_hz_,
|
||||
@ -375,7 +415,6 @@ bool config_ad9361_lo_local(unsigned long bandwidth_,
|
||||
long long freq_dds_tx_hz_,
|
||||
double scale_dds_dbfs_)
|
||||
{
|
||||
|
||||
// TX stream config
|
||||
std::cout << "Start of AD9361 TX Local Oscillator DDS configuration\n";
|
||||
struct stream_cfg txcfg;
|
||||
@ -417,7 +456,8 @@ bool config_ad9361_lo_local(unsigned long bandwidth_,
|
||||
int ret;
|
||||
//set output amplifier attenuation
|
||||
ret = iio_device_attr_write_double(ad9361_phy, "out_voltage0_hardwaregain", -tx_attenuation_db_);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set out_voltage0_hardwaregain value " << -tx_attenuation_db_ << " error " << ret << std::endl;
|
||||
}
|
||||
|
||||
@ -430,40 +470,47 @@ bool config_ad9361_lo_local(unsigned long bandwidth_,
|
||||
dds_channel0_Q = iio_device_find_channel(dds, "TX1_Q_F1", true);
|
||||
|
||||
ret = iio_channel_attr_write_bool(dds_channel0_I, "raw", true);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to toggle DDS: " << ret << std::endl;
|
||||
}
|
||||
|
||||
//set frequency, scale and phase
|
||||
|
||||
ret = iio_channel_attr_write_longlong(dds_channel0_I, "frequency", (long long)freq_dds_tx_hz_);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX DDS frequency I: " << ret << std::endl;
|
||||
}
|
||||
|
||||
ret = iio_channel_attr_write_longlong(dds_channel0_Q, "frequency", (long long)freq_dds_tx_hz_);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX DDS frequency Q: " << ret << std::endl;
|
||||
}
|
||||
|
||||
|
||||
ret = iio_channel_attr_write_double(dds_channel0_I, "phase", 0.0);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX DDS phase I: " << ret << std::endl;
|
||||
}
|
||||
|
||||
ret = iio_channel_attr_write_double(dds_channel0_Q, "phase", 270000.0);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX DDS phase Q: " << ret << std::endl;
|
||||
}
|
||||
|
||||
ret = iio_channel_attr_write_double(dds_channel0_I, "scale", pow(10, scale_dds_dbfs_ / 20.0));
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX DDS scale I: " << ret << std::endl;
|
||||
}
|
||||
|
||||
ret = iio_channel_attr_write_double(dds_channel0_Q, "scale", pow(10, scale_dds_dbfs_ / 20.0));
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX DDS scale Q: " << ret << std::endl;
|
||||
}
|
||||
|
||||
@ -471,7 +518,8 @@ bool config_ad9361_lo_local(unsigned long bandwidth_,
|
||||
|
||||
|
||||
ret = iio_device_attr_write_double(ad9361_phy, "out_voltage1_hardwaregain", -89.0);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set out_voltage1_hardwaregain value " << -89.0 << " error " << ret << std::endl;
|
||||
}
|
||||
|
||||
@ -483,12 +531,14 @@ bool config_ad9361_lo_local(unsigned long bandwidth_,
|
||||
|
||||
|
||||
ret = iio_channel_attr_write_double(dds_channel1_I, "scale", 0);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX2 DDS scale I: " << ret << std::endl;
|
||||
}
|
||||
|
||||
ret = iio_channel_attr_write_double(dds_channel1_Q, "scale", 0);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX2 DDS scale Q: " << ret << std::endl;
|
||||
}
|
||||
|
||||
@ -496,6 +546,7 @@ bool config_ad9361_lo_local(unsigned long bandwidth_,
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool config_ad9361_lo_remote(std::string remote_host,
|
||||
unsigned long bandwidth_,
|
||||
unsigned long sample_rate_,
|
||||
@ -504,7 +555,6 @@ bool config_ad9361_lo_remote(std::string remote_host,
|
||||
long long freq_dds_tx_hz_,
|
||||
double scale_dds_dbfs_)
|
||||
{
|
||||
|
||||
// TX stream config
|
||||
std::cout << "Start of AD9361 TX Local Oscillator DDS configuration\n";
|
||||
struct stream_cfg txcfg;
|
||||
@ -546,7 +596,8 @@ bool config_ad9361_lo_remote(std::string remote_host,
|
||||
int ret;
|
||||
//set output amplifier attenuation
|
||||
ret = iio_device_attr_write_double(ad9361_phy, "out_voltage0_hardwaregain", -tx_attenuation_db_);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set out_voltage0_hardwaregain value " << -tx_attenuation_db_ << " error " << ret << std::endl;
|
||||
}
|
||||
|
||||
@ -559,48 +610,54 @@ bool config_ad9361_lo_remote(std::string remote_host,
|
||||
dds_channel0_Q = iio_device_find_channel(dds, "TX1_Q_F1", true);
|
||||
|
||||
ret = iio_channel_attr_write_bool(dds_channel0_I, "raw", true);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to toggle DDS: " << ret << std::endl;
|
||||
}
|
||||
|
||||
//set frequency, scale and phase
|
||||
|
||||
ret = iio_channel_attr_write_longlong(dds_channel0_I, "frequency", (long long)freq_dds_tx_hz_);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX DDS frequency I: " << ret << std::endl;
|
||||
}
|
||||
|
||||
ret = iio_channel_attr_write_longlong(dds_channel0_Q, "frequency", (long long)freq_dds_tx_hz_);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX DDS frequency Q: " << ret << std::endl;
|
||||
}
|
||||
|
||||
|
||||
ret = iio_channel_attr_write_double(dds_channel0_I, "phase", 0.0);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX DDS phase I: " << ret << std::endl;
|
||||
}
|
||||
|
||||
ret = iio_channel_attr_write_double(dds_channel0_Q, "phase", 270000.0);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX DDS phase Q: " << ret << std::endl;
|
||||
}
|
||||
|
||||
ret = iio_channel_attr_write_double(dds_channel0_I, "scale", pow(10, scale_dds_dbfs_ / 20.0));
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX DDS scale I: " << ret << std::endl;
|
||||
}
|
||||
|
||||
ret = iio_channel_attr_write_double(dds_channel0_Q, "scale", pow(10, scale_dds_dbfs_ / 20.0));
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX DDS scale Q: " << ret << std::endl;
|
||||
}
|
||||
|
||||
//disable TX2
|
||||
|
||||
|
||||
ret = iio_device_attr_write_double(ad9361_phy, "out_voltage1_hardwaregain", -89.0);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set out_voltage1_hardwaregain value " << -89.0 << " error " << ret << std::endl;
|
||||
}
|
||||
|
||||
@ -610,14 +667,15 @@ bool config_ad9361_lo_remote(std::string remote_host,
|
||||
struct iio_channel *dds_channel1_Q;
|
||||
dds_channel1_Q = iio_device_find_channel(dds, "TX2_Q_F1", true);
|
||||
|
||||
|
||||
ret = iio_channel_attr_write_double(dds_channel1_I, "scale", 0);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX2 DDS scale I: " << ret << std::endl;
|
||||
}
|
||||
|
||||
ret = iio_channel_attr_write_double(dds_channel1_Q, "scale", 0);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX2 DDS scale Q: " << ret << std::endl;
|
||||
}
|
||||
|
||||
@ -645,17 +703,20 @@ bool ad9361_disable_lo_remote(std::string remote_host)
|
||||
dds_channel0_Q = iio_device_find_channel(dds, "TX1_Q_F1", true);
|
||||
int ret;
|
||||
ret = iio_channel_attr_write_bool(dds_channel0_I, "raw", false);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to toggle DDS: " << ret << std::endl;
|
||||
}
|
||||
|
||||
ret = iio_channel_attr_write_double(dds_channel0_I, "scale", 0.0);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX DDS scale I: " << ret << std::endl;
|
||||
}
|
||||
|
||||
ret = iio_channel_attr_write_double(dds_channel0_Q, "scale", 0.0);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX DDS scale Q: " << ret << std::endl;
|
||||
}
|
||||
|
||||
@ -664,6 +725,7 @@ bool ad9361_disable_lo_remote(std::string remote_host)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool ad9361_disable_lo_local()
|
||||
{
|
||||
std::cout << "AD9361 Acquiring IIO LOCAL context" << std::endl;
|
||||
@ -683,17 +745,20 @@ bool ad9361_disable_lo_local()
|
||||
dds_channel0_Q = iio_device_find_channel(dds, "TX1_Q_F1", true);
|
||||
int ret;
|
||||
ret = iio_channel_attr_write_bool(dds_channel0_I, "raw", false);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to toggle DDS: " << ret << std::endl;
|
||||
}
|
||||
|
||||
ret = iio_channel_attr_write_double(dds_channel0_I, "scale", 0.0);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX DDS scale I: " << ret << std::endl;
|
||||
}
|
||||
|
||||
ret = iio_channel_attr_write_double(dds_channel0_Q, "scale", 0.0);
|
||||
if (ret < 0) {
|
||||
if (ret < 0)
|
||||
{
|
||||
std::cout << "Failed to set TX DDS scale Q: " << ret << std::endl;
|
||||
}
|
||||
|
||||
@ -701,4 +766,3 @@ bool ad9361_disable_lo_local()
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -30,8 +30,8 @@
|
||||
* -------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
#ifndef __AD9361_MANAGER__
|
||||
#define __AD9361_MANAGER__
|
||||
#ifndef GNSS_SDR_AD9361_MANAGER_H
|
||||
#define GNSS_SDR_AD9361_MANAGER_H
|
||||
|
||||
#include <string>
|
||||
|
||||
@ -42,10 +42,15 @@
|
||||
#endif
|
||||
|
||||
/* RX is input, TX is output */
|
||||
enum iodev { RX, TX };
|
||||
enum iodev
|
||||
{
|
||||
RX,
|
||||
TX
|
||||
};
|
||||
|
||||
/* common RX and TX streaming params */
|
||||
struct stream_cfg {
|
||||
struct stream_cfg
|
||||
{
|
||||
long long bw_hz; // Analog banwidth in Hz
|
||||
long long fs_hz; // Baseband sample rate in Hz
|
||||
long long lo_hz; // Local oscillator frequency in Hz
|
||||
@ -83,7 +88,6 @@ bool get_lo_chan(struct iio_context *ctx, enum iodev d, struct iio_channel **chn
|
||||
/* applies streaming configuration through IIO */
|
||||
bool cfg_ad9361_streaming_ch(struct iio_context *ctx, struct stream_cfg *cfg, enum iodev type, int chid);
|
||||
|
||||
|
||||
bool config_ad9361_rx_local(unsigned long bandwidth_,
|
||||
unsigned long sample_rate_,
|
||||
unsigned long freq_,
|
||||
@ -123,5 +127,4 @@ bool ad9361_disable_lo_remote(std::string remote_host);
|
||||
|
||||
bool ad9361_disable_lo_local();
|
||||
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user