diff --git a/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc b/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc index ffaae3e9c..45cc5046f 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/ad936x_iio_source.cc @@ -94,8 +94,8 @@ void ad936x_iio_source::ad9361_channel_demux_and_record(ad936x_iio_samples *samp { for (ch = 0; ch < nchannels; ch++) { - //std::cout << current_byte << " of " << samples_in->n_bytes << " test: " << (int)samples_in->buffer[current_byte] << "\n"; - (*files_out).at(ch).write(&samples_in->buffer[current_byte], 4); //two bytes I + two bytes Q per channel + // std::cout << current_byte << " of " << samples_in->n_bytes << " test: " << (int)samples_in->buffer[current_byte] << "\n"; + (*files_out).at(ch).write(&samples_in->buffer[current_byte], 4); // two bytes I + two bytes Q per channel current_byte += 4; } } @@ -134,7 +134,7 @@ ad936x_iio_source::ad936x_iio_source( { if (ad936x_custom->initialize_device(pluto_uri_, board_type_) == true) { - //configure channels + // configure channels if (ad936x_custom->init_config_ad9361_rx(bandwidth_, sample_rate_, freq_, @@ -153,19 +153,19 @@ ad936x_iio_source::ad936x_iio_source( { std::cout << "ad936x_iio_source HW configured OK!\n"; - //PPS FPGA Samplestamp information from TCP server + // PPS FPGA Samplestamp information from TCP server pps_rx = std::make_shared(); ppsqueue = std::shared_ptr>(new Concurrent_Queue()); pps_rx->set_pps_samplestamp_queue(ppsqueue); ad936x_custom->set_pps_samplestamp_queue(ppsqueue); - //start PPS RX thread + // start PPS RX thread if (ppsmode_ == true or customsamplesize_ == true) { pps_rx_thread = std::thread(&pps_tcp_rx::receive_pps, pps_rx, fe_ip_, fe_ctlport_); std::this_thread::sleep_for(std::chrono::milliseconds(500)); - //configure custom FPGA options + // configure custom FPGA options switch (ssize_) { case 16: @@ -251,13 +251,13 @@ ad936x_iio_source::ad936x_iio_source( set_min_noutput_items(IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES * 2); // multiplexed I,Q, so, two samples per complex sample set_min_output_buffer(IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES * sizeof(int16_t) * 2); - //std::cout << "max_output_buffer " << min_output_buffer(0) << " min_noutput_items: " << min_noutput_items() << "\n"; + // std::cout << "max_output_buffer " << min_output_buffer(0) << " min_noutput_items: " << min_noutput_items() << "\n"; // for (int n = 0; n < ad936x_custom->n_channels; n++) // { // std::string cap_file_root_name = "./debug_cap_ch"; // samplesfile.push_back(std::fstream(cap_file_root_name + std::to_string(n) + ".dat", std::ios::out | std::ios::binary)); - // //samplesfile.back().exceptions(std::ios_base::badbit | std::ios_base::failbit); //this will enable exceptions for debug + // // samplesfile.back().exceptions(std::ios_base::badbit | std::ios_base::failbit); //this will enable exceptions for debug // // if (samplesfile.back().is_open() == false) // { @@ -301,7 +301,7 @@ int ad936x_iio_source::general_work(int noutput_items, ad936x_custom->pop_sample_buffer(current_buffer); current_samples = current_buffer.get(); - //I and Q samples are interleaved in buffer: IQIQIQ... + // I and Q samples are interleaved in buffer: IQIQIQ... int32_t n_interleaved_iq_samples_per_channel = current_samples->n_bytes / (ad936x_custom->n_channels * 2); if (noutput_items < n_interleaved_iq_samples_per_channel) { @@ -310,12 +310,12 @@ int ad936x_iio_source::general_work(int noutput_items, } else { - //ad9361_channel_demux_and_record(current_samples, ad936x_custom->n_channels, &samplesfile); + // ad9361_channel_demux_and_record(current_samples, ad936x_custom->n_channels, &samplesfile); uint32_t current_byte = 0; uint32_t current_byte_in_gr = 0; int16_t ch = 0; - //std::cout << "nbytes: " << samples_in->n_bytes << " nsamples: " << samples_in->n_samples << " nch: " << nchannels << "\n"; + // std::cout << "nbytes: " << samples_in->n_bytes << " nsamples: " << samples_in->n_samples << " nch: " << nchannels << "\n"; if (ad936x_custom->n_channels == 1) { memcpy(&((char *)output_items[0])[0], ¤t_samples->buffer[current_byte], current_samples->n_bytes); diff --git a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc index 20f829e6a..0153a11a2 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc +++ b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.cc @@ -193,7 +193,7 @@ bool Gr_Complex_Ip_Packet_Source::stop() bool Gr_Complex_Ip_Packet_Source::open() { std::array errbuf{}; - //boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function + // boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function gr::thread::scoped_lock guard(d_setlock); // open device for reading descr = pcap_open_live(d_src_device.c_str(), 1500, 1, 1000, errbuf.data()); @@ -250,7 +250,7 @@ void Gr_Complex_Ip_Packet_Source::static_pcap_callback(u_char *args, const struc void Gr_Complex_Ip_Packet_Source::pcap_callback(__attribute__((unused)) u_char *args, __attribute__((unused)) const struct pcap_pkthdr *pkthdr, const u_char *packet) { - //boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function + // boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function const gr_ip_header *ih; const gr_udp_header *uh; @@ -500,7 +500,7 @@ int Gr_Complex_Ip_Packet_Source::work(int noutput_items, gr_vector_void_star &output_items) { // send samples to next GNU Radio block - //boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function + // boost::mutex::scoped_lock lock(d_mutex); // hold mutex for duration of this function if (fifo_items == 0) { return 0; diff --git a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h index 9f8939904..a7d37b5a0 100644 --- a/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h +++ b/src/algorithms/signal_source/gnuradio_blocks/gr_complex_ip_packet_source.h @@ -83,7 +83,7 @@ private: bool open(); boost::thread *d_pcap_thread; - //boost::mutex d_mutex; + // boost::mutex d_mutex; struct sockaddr_in si_me { }; diff --git a/src/algorithms/signal_source/libs/ad936x_iio_custom.cc b/src/algorithms/signal_source/libs/ad936x_iio_custom.cc index efd67e778..c9d788bdd 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_custom.cc +++ b/src/algorithms/signal_source/libs/ad936x_iio_custom.cc @@ -40,10 +40,10 @@ ad936x_iio_custom::ad936x_iio_custom(int debug_level_, int log_level_) ad936x_iio_custom::~ad936x_iio_custom() { - //disable TX + // disable TX if (phy != NULL) PlutoTxEnable(false); - //Close device + // Close device if (ctx != NULL) iio_context_destroy(ctx); } @@ -60,7 +60,7 @@ void ad936x_iio_custom::set_pps_samplestamp_queue(std::shared_ptr(&pps.samplestamp), sizeof(uint64_t)); - //int32_t: Galileo/GPS Week Number associated to the rising edge of PPS signal + // int32_t: Galileo/GPS Week Number associated to the rising edge of PPS signal // ppstimefile.write(reinterpret_cast(&tow.week), sizeof(int32_t)); - //int32_t: Galileo/GPS TOW associated to the rising edge of PPS signal + // int32_t: Galileo/GPS TOW associated to the rising edge of PPS signal // ppstimefile.write(reinterpret_cast(&tow.tow_ms), sizeof(int32_t)); - //record pps rise samplestamp associated to the absolute sample counter - //PPS rising edge must be associated with the corresponding uBlox time message (tx once a second) + // record pps rise samplestamp associated to the absolute sample counter + // PPS rising edge must be associated with the corresponding uBlox time message (tx once a second) if (GnssTime_queue->timed_wait_and_pop(tow, 2000) == false) @@ -1066,10 +1066,10 @@ void ad936x_iio_custom::get_PPS_timestamp() } bool ad936x_iio_custom::start_sample_rx(bool ppsmode) { - //using queues of smart pointers to preallocated buffers + // using queues of smart pointers to preallocated buffers free_buffers.clear(); used_buffers.clear(); - //preallocate buffers and use queues + // preallocate buffers and use queues std::cerr << "Allocating memory..\n"; try { @@ -1084,33 +1084,33 @@ bool ad936x_iio_custom::start_sample_rx(bool ppsmode) return false; } - //prepare capture channels + // prepare capture channels std::vector channels; switch (n_channels) { case 1: - channels.push_back("voltage0"); //Channel 0 I - channels.push_back("voltage1"); //Channel 0 Q + channels.push_back("voltage0"); // Channel 0 I + channels.push_back("voltage1"); // Channel 0 Q break; case 2: - channels.push_back("voltage0"); //Channel 0 I - channels.push_back("voltage1"); //Channel 0 Q - channels.push_back("voltage2"); //Channel 1 I - channels.push_back("voltage3"); //Channel 1 Q + channels.push_back("voltage0"); // Channel 0 I + channels.push_back("voltage1"); // Channel 0 Q + channels.push_back("voltage2"); // Channel 1 I + channels.push_back("voltage3"); // Channel 1 Q break; default: - channels.push_back("voltage0"); //Channel 0 I - channels.push_back("voltage1"); //Channel 0 Q + channels.push_back("voltage0"); // Channel 0 I + channels.push_back("voltage1"); // Channel 0 Q } receive_samples = true; - //start sample capture thread + // start sample capture thread capture_samples_thread = std::thread(&ad936x_iio_custom::capture, this, channels); - //start sample overflow detector + // start sample overflow detector overflow_monitor_thread = std::thread(&ad936x_iio_custom::monitor_thread_fn, this); - //start PPS and GNSS Time capture thread + // start PPS and GNSS Time capture thread if (ppsmode == true) { diff --git a/src/algorithms/signal_source/libs/ad936x_iio_custom.h b/src/algorithms/signal_source/libs/ad936x_iio_custom.h index de36f5b5b..83a61282a 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_custom.h +++ b/src/algorithms/signal_source/libs/ad936x_iio_custom.h @@ -31,7 +31,7 @@ #endif #include "ad936x_iio_samples.h" -#include //multichip sync and high level functions +#include // multichip sync and high level functions #include #include @@ -114,13 +114,13 @@ private: void PlutoTxEnable(bool txon); void setPlutoGpo(int p); - //Device structure + // Device structure struct iio_context *ctx; struct iio_device *phy; struct iio_device *stream_dev; struct iio_device *dds_dev; - //stream + // stream uint64_t sample_rate_sps; @@ -135,7 +135,7 @@ private: boost::atomic receive_samples; boost::atomic fpga_overflow; - //using queues of smart pointers to preallocated buffers + // using queues of smart pointers to preallocated buffers Concurrent_Queue> free_buffers; Concurrent_Queue> used_buffers; diff --git a/src/algorithms/signal_source/libs/ad936x_iio_samples.h b/src/algorithms/signal_source/libs/ad936x_iio_samples.h index 5156e89f0..96fd9e6ae 100644 --- a/src/algorithms/signal_source/libs/ad936x_iio_samples.h +++ b/src/algorithms/signal_source/libs/ad936x_iio_samples.h @@ -34,7 +34,7 @@ public: uint32_t n_interleaved_iq_samples; uint16_t n_channels; uint16_t step_bytes; - char buffer[IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES * 4 * 4]; //max 16 bits samples per buffer (4 channels, 2-bytes per I + 2-bytes per Q) + char buffer[IIO_DEFAULTAD936XAPIFIFOSIZE_SAMPLES * 4 * 4]; // max 16 bits samples per buffer (4 channels, 2-bytes per I + 2-bytes per Q) }; #endif diff --git a/src/algorithms/signal_source/libs/pps_samplestamp.h b/src/algorithms/signal_source/libs/pps_samplestamp.h index cdbc1276f..900388867 100644 --- a/src/algorithms/signal_source/libs/pps_samplestamp.h +++ b/src/algorithms/signal_source/libs/pps_samplestamp.h @@ -13,7 +13,7 @@ class PpsSamplestamp { public: - uint64_t samplestamp; //PPS rising edge samples counter from the beginning of rx stream opperation. Notice that it is reseted to zero if sample buffer overflow is detected on the FPGA side + uint64_t samplestamp; // PPS rising edge samples counter from the beginning of rx stream opperation. Notice that it is reseted to zero if sample buffer overflow is detected on the FPGA side uint32_t overflow_reg; // >0 indicates overflow situation in the FPGA RX buffer }; diff --git a/src/algorithms/signal_source/libs/ppstcprx.cc b/src/algorithms/signal_source/libs/ppstcprx.cc index 0a10d8545..73ea791db 100644 --- a/src/algorithms/signal_source/libs/ppstcprx.cc +++ b/src/algorithms/signal_source/libs/ppstcprx.cc @@ -52,16 +52,16 @@ bool pps_tcp_rx::send_cmd(std::string cmd) } void pps_tcp_rx::receive_pps(std::string ip_address, int port) { - //create a message buffer + // create a message buffer char buf[1500]; - //setup a socket and connection tools + // setup a socket and connection tools sockaddr_in sendSockAddr; sendSockAddr.sin_family = AF_INET; sendSockAddr.sin_addr.s_addr = inet_addr(ip_address.c_str()); sendSockAddr.sin_port = htons(port); clientSd = socket(AF_INET, SOCK_STREAM, 0); - //try to connect... + // try to connect... int status = connect(clientSd, (sockaddr *)&sendSockAddr, sizeof(sendSockAddr)); if (status < 0) @@ -84,8 +84,8 @@ void pps_tcp_rx::receive_pps(std::string ip_address, int port) { if (new_pps_line.length() > 0) { - //std::cout << "pps_tcp_rx debug: " << new_pps_line << "\n"; - //parse string and push PPS data to the PPS queue + // std::cout << "pps_tcp_rx debug: " << new_pps_line << "\n"; + // parse string and push PPS data to the PPS queue std::stringstream ss(new_pps_line); std::vector data; while (ss.good()) @@ -97,7 +97,7 @@ void pps_tcp_rx::receive_pps(std::string ip_address, int port) if (data.size() >= 2) { PpsSamplestamp new_pps; - //sample counter + // sample counter std::size_t found = data.at(0).find("sc="); if (found != std::string::npos) { @@ -131,7 +131,7 @@ void pps_tcp_rx::receive_pps(std::string ip_address, int port) std::cout << "pps_tcp_rx debug: o parse error str " << data.at(1) << "\n"; } Pps_queue->push(new_pps); - //std::cout << "pps_tcp_rx debug: pps pushed!\n"; + // std::cout << "pps_tcp_rx debug: pps pushed!\n"; } else {