1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-10-31 23:26:22 +00:00

Make Clang-format happy

This commit is contained in:
Javier Arribas 2023-07-05 11:37:33 +02:00
parent 1cf508ad20
commit 1517bb1ab8
8 changed files with 49 additions and 24 deletions

View File

@ -18,7 +18,6 @@ if(ENABLE_PLUTOSDR)
############################################## ##############################################
set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} plutosdr_signal_source.cc) set(OPT_DRIVER_SOURCES ${OPT_DRIVER_SOURCES} plutosdr_signal_source.cc)
set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} plutosdr_signal_source.h) set(OPT_DRIVER_HEADERS ${OPT_DRIVER_HEADERS} plutosdr_signal_source.h)
############################################## ##############################################
# CUSTOM AD936X IIO SOURCE # CUSTOM AD936X IIO SOURCE
############################################## ##############################################

View File

@ -301,6 +301,7 @@ int ad936x_iio_source::general_work(int noutput_items,
ad936x_custom->pop_sample_buffer(current_buffer); ad936x_custom->pop_sample_buffer(current_buffer);
current_samples = current_buffer.get(); 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); 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) if (noutput_items < n_interleaved_iq_samples_per_channel)
@ -311,14 +312,14 @@ int ad936x_iio_source::general_work(int noutput_items,
else 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);
auto **out = reinterpret_cast<int8_t **>(&output_items[0]);
uint32_t current_byte = 0; uint32_t current_byte = 0;
uint32_t current_byte_in_gr = 0; uint32_t current_byte_in_gr = 0;
int16_t ch = 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) if (ad936x_custom->n_channels == 1)
{ {
memcpy(&((char *)output_items[0])[0], &current_samples->buffer[current_byte], current_samples->n_bytes); memcpy(out[0], &current_samples->buffer[current_byte], current_samples->n_bytes);
} }
else else
{ {
@ -327,7 +328,7 @@ int ad936x_iio_source::general_work(int noutput_items,
{ {
for (ch = 0; ch < ad936x_custom->n_channels; ch++) for (ch = 0; ch < ad936x_custom->n_channels; ch++)
{ {
memcpy(&((char *)output_items[ch])[current_byte_in_gr], &current_samples->buffer[current_byte], 4); // two bytes I + two bytes Q per channel: 4 bytes memcpy(&out[ch][current_byte_in_gr], &current_samples->buffer[current_byte], 4); // two bytes I + two bytes Q per channel: 4 bytes
current_byte += 4; current_byte += 4;
} }
current_byte_in_gr += 4; current_byte_in_gr += 4;

View File

@ -334,7 +334,7 @@ void Gr_Complex_Ip_Packet_Source::demux_samples(const gr_vector_void_star &outpu
{ {
if (d_wire_sample_type == 5) if (d_wire_sample_type == 5)
{ {
//interleaved 2-bit I 2-bit Q samples packed in bytes: 1 byte -> 2 complex samples // interleaved 2-bit I 2-bit Q samples packed in bytes: 1 byte -> 2 complex samples
int nsample = 0; int nsample = 0;
byte_2bit_struct sample{}; // <- 2 bits wide only byte_2bit_struct sample{}; // <- 2 bits wide only
int real; int real;

View File

@ -21,6 +21,7 @@
#include <fstream> #include <fstream>
#include <iostream> #include <iostream>
#include <string> #include <string>
#include <utility>
#include <vector> #include <vector>
ad936x_iio_custom::ad936x_iio_custom(int debug_level_, int log_level_) ad936x_iio_custom::ad936x_iio_custom(int debug_level_, int log_level_)
@ -834,10 +835,10 @@ void ad936x_iio_custom::monitor_thread_fn()
continue; continue;
} }
// if (device_is_tx) { // if (device_is_tx) {
// if (val & 1) // if (val & 1)
// fprintf(stderr, "Underflow detected\n"); // fprintf(stderr, "Underflow detected\n");
// } else { // } else {
if (val & 4) if (val & 4)
{ {
std::cout << "WARNING: IIO status register reported overflow!\n"; std::cout << "WARNING: IIO status register reported overflow!\n";
@ -909,7 +910,7 @@ void ad936x_iio_custom::PlutoTxEnable(bool txon)
void ad936x_iio_custom::setPlutoGpo(int p) void ad936x_iio_custom::setPlutoGpo(int p)
{ {
char pins[11]; char pins[11];
sprintf(pins, "0x27 0x%x0", p); // direct access to AD9361 registers... WARNING! snprintf(pins, sizeof(pins), "0x27 0x%x0", p); // direct access to AD9361 registers... WARNING!
pins[9] = 0; pins[9] = 0;
int ret; int ret;
// std::cout << "send: " << pins << " \n"; // std::cout << "send: " << pins << " \n";
@ -926,9 +927,9 @@ void ad936x_iio_custom::setPlutoGpo(int p)
bool ad936x_iio_custom::select_rf_filter(std::string rf_filter) bool ad936x_iio_custom::select_rf_filter(std::string rf_filter)
{ {
// adi,gpo-manual-mode-enable Enables GPO manual mode, this will conflict with automatic ENSM slave and eLNA mode // adi,gpo-manual-mode-enable Enables GPO manual mode, this will conflict with automatic ENSM slave and eLNA mode
// adi,gpo-manual-mode-enable-mask Enable bit mask, setting or clearing bits will change the level of the corresponding output. Bit0 → GPO, Bit1 → GPO1, Bit2 → GPO2, Bit3 → GP03 // adi,gpo-manual-mode-enable-mask Enable bit mask, setting or clearing bits will change the level of the corresponding output. Bit0 → GPO, Bit1 → GPO1, Bit2 → GPO2, Bit3 → GP03
// adi,gpo-manual-mode-enable // adi,gpo-manual-mode-enable
// adi,gpo-manual-mode-enable-mask does not work... // adi,gpo-manual-mode-enable-mask does not work...
// some software use the direct_reg_access (see https://github.com/g4eml/Langstone/blob/master/LangstoneGUI.c) // some software use the direct_reg_access (see https://github.com/g4eml/Langstone/blob/master/LangstoneGUI.c)

View File

@ -71,8 +71,8 @@ private:
double d_clock_offset_ms; double d_clock_offset_ms;
double d_fraction_ms_offset; double d_fraction_ms_offset;
double d_integer_ms_offset; double d_integer_ms_offset;
uint64_t d_next_timetag_samplecount;
int d_items_to_samples; int d_items_to_samples;
uint64_t d_next_timetag_samplecount;
bool d_get_next_timetag; bool d_get_next_timetag;
}; };

View File

@ -1,8 +1,16 @@
/* ------------------------------------------------------------------------- /*!
* \file pps_samplestamp.h
* \brief A simple container for the sample count associated to PPS rising edge
* \author Javier Arribas, jarribas(at)cttc.es
* -----------------------------------------------------------------------------
* *
* Copyright (C) 2022 (see AUTHORS file for a list of contributors) * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* This file is part of GNSS-SDR.
* *
* Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
* *
* -----------------------------------------------------------------------------
*/ */
#ifndef IIOPPS_PPS_SAMPLESTAMP_H #ifndef IIOPPS_PPS_SAMPLESTAMP_H

View File

@ -1,8 +1,16 @@
/* /*!
* ppstcprx.cc * \file ppstcprx.cc
* \brief TCP client class for front-end PPS samplestamp information reception
* \author Javier Arribas, jarribas(at)cttc.es
* -----------------------------------------------------------------------------
* *
* Created on: 28 feb 2022 * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* Author: javier * This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
*/ */
#include "ppstcprx.h" #include "ppstcprx.h"

View File

@ -1,8 +1,16 @@
/* /*!
* ppstcprx.h * \file ppstcprx.h
* \brief TCP client class for front-end PPS samplestamp information reception
* \author Javier Arribas, jarribas(at)cttc.es
* -----------------------------------------------------------------------------
* *
* Created on: 28 feb 2022 * GNSS-SDR is a Global Navigation Satellite System software-defined receiver.
* Author: javier * This file is part of GNSS-SDR.
*
* Copyright (C) 2010-2023 (see AUTHORS file for a list of contributors)
* SPDX-License-Identifier: GPL-3.0-or-later
*
* -----------------------------------------------------------------------------
*/ */
#ifndef SRC_LIBS_PPSTCPRX_H_ #ifndef SRC_LIBS_PPSTCPRX_H_