17 #ifndef SRC_LIBS_ad936x_iio_custom_H_ 18 #define SRC_LIBS_ad936x_iio_custom_H_ 23 #include <boost/atomic.hpp> 43 bool initialize_device(std::string pluto_device_uri, std::string board_type);
45 bool init_config_ad9361_rx(
long long bandwidth_,
46 long long sample_rate_,
48 std::string rf_port_select_,
49 std::string rf_filter,
50 std::string gain_mode_rx0_,
51 std::string gain_mode_rx1_,
57 double lo_attenuation_db_,
61 bool calibrate(
int ch,
double bw_hz);
63 double get_rx_gain(
int ch_num);
64 bool setRXGain(
int ch_num, std::string gain_mode,
double gain_dB);
66 bool set_antenna_port(
int ch,
int antenna_idx);
67 double get_frequency(
int ch);
68 bool set_frequency(
int ch,
double freq_hz);
70 bool start_sample_rx(
bool ppsmode);
76 bool get_rx_frequency(
long long &freq_hz);
77 bool set_rx_frequency(
long long freq_hz);
78 bool read_die_temp(
double &temp_c);
80 void pop_sample_buffer(std::shared_ptr<ad936x_iio_samples> ¤t_buffer);
82 void push_sample_buffer(std::shared_ptr<ad936x_iio_samples> ¤t_buffer);
86 std::shared_ptr<Concurrent_Queue<GnssTime>> GnssTime_queue;
87 std::shared_ptr<Concurrent_Queue<PpsSamplestamp>> Pps_queue;
89 bool get_iio_param(iio_device *dev,
const std::string ¶m, std::string &value);
90 void configure_params(
struct iio_device *phy,
91 const std::vector<std::string> ¶ms);
92 void set_params_rx(
struct iio_device *phy_device,
93 unsigned long long frequency,
94 unsigned long samplerate,
unsigned long bandwidth,
95 bool quadrature,
bool rfdc,
bool bbdc,
96 std::string gain1,
double gain1_value,
97 std::string gain2,
double gain2_value,
98 std::string port_select);
100 bool config_ad9361_dds(uint64_t freq_rf_tx_hz_,
101 double tx_attenuation_db_,
102 int64_t freq_dds_tx_hz_,
104 double phase_dds_deg_,
107 void get_PPS_timestamp();
108 void capture(
const std::vector<std::string> &channels);
110 bool select_rf_filter(std::string rf_filter);
112 void monitor_thread_fn();
114 void PlutoTxEnable(
bool txon);
115 void setPlutoGpo(
int p);
118 struct iio_context *ctx;
119 struct iio_device *phy;
120 struct iio_device *stream_dev;
121 struct iio_device *dds_dev;
125 uint64_t sample_rate_sps;
133 std::condition_variable cv;
135 boost::atomic<bool> receive_samples;
137 boost::atomic<bool> fpga_overflow;
142 std::thread capture_samples_thread;
143 std::thread overflow_monitor_thread;
144 std::thread capture_time_thread;
Interface of a thread-safe std::queue.
class that stores both the receiver time, relative to the receiver start and the GNSS time (absolute)...
A class that holds a custom sample buffer for Analog Devices AD936x family front-ends.
A simple container for the sample count associated to PPS rising edge.
This class implements a thread-safe std::queue.