1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 12:40:35 +00:00

Apply fixes by clang-tidy

This commit is contained in:
Carles Fernandez 2018-12-11 02:22:33 +01:00
parent d920aa4d92
commit e2582586b9
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
2 changed files with 39 additions and 38 deletions

View File

@ -67,8 +67,8 @@
using google::LogMessage; using google::LogMessage;
pcps_opencl_acquisition_cc_sptr pcps_make_opencl_acquisition_cc( pcps_opencl_acquisition_cc_sptr pcps_make_opencl_acquisition_cc(
unsigned int sampled_ms, unsigned int max_dwells, uint32_t sampled_ms, uint32_t max_dwells,
unsigned int doppler_max, long fs_in, uint32_t doppler_max, int64_t fs_in,
int samples_per_ms, int samples_per_code, int samples_per_ms, int samples_per_code,
bool bit_transition_flag, bool bit_transition_flag,
bool dump, bool dump,
@ -81,10 +81,10 @@ pcps_opencl_acquisition_cc_sptr pcps_make_opencl_acquisition_cc(
pcps_opencl_acquisition_cc::pcps_opencl_acquisition_cc( pcps_opencl_acquisition_cc::pcps_opencl_acquisition_cc(
unsigned int sampled_ms, uint32_t sampled_ms,
unsigned int max_dwells, uint32_t max_dwells,
unsigned int doppler_max, uint32_t doppler_max,
long fs_in, int64_t fs_in,
int samples_per_ms, int samples_per_ms,
int samples_per_code, int samples_per_code,
bool bit_transition_flag, bool bit_transition_flag,
@ -115,7 +115,7 @@ pcps_opencl_acquisition_cc::pcps_opencl_acquisition_cc(
d_cl_fft_batch_size = 1; d_cl_fft_batch_size = 1;
d_in_buffer = new gr_complex *[d_max_dwells]; d_in_buffer = new gr_complex *[d_max_dwells];
for (unsigned int i = 0; i < d_max_dwells; i++) for (uint32_t i = 0; i < d_max_dwells; i++)
{ {
d_in_buffer[i] = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_in_buffer[i] = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
} }
@ -123,7 +123,7 @@ pcps_opencl_acquisition_cc::pcps_opencl_acquisition_cc(
d_fft_codes = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_fft_size_pow2 * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_fft_codes = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_fft_size_pow2 * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
d_zero_vector = static_cast<gr_complex *>(volk_gnsssdr_malloc((d_fft_size_pow2 - d_fft_size) * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_zero_vector = static_cast<gr_complex *>(volk_gnsssdr_malloc((d_fft_size_pow2 - d_fft_size) * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
for (unsigned int i = 0; i < (d_fft_size_pow2 - d_fft_size); i++) for (uint32_t i = 0; i < (d_fft_size_pow2 - d_fft_size); i++)
{ {
d_zero_vector[i] = gr_complex(0.0, 0.0); d_zero_vector[i] = gr_complex(0.0, 0.0);
} }
@ -149,14 +149,14 @@ pcps_opencl_acquisition_cc::~pcps_opencl_acquisition_cc()
{ {
if (d_num_doppler_bins > 0) if (d_num_doppler_bins > 0)
{ {
for (unsigned int i = 0; i < d_num_doppler_bins; i++) for (uint32_t i = 0; i < d_num_doppler_bins; i++)
{ {
volk_gnsssdr_free(d_grid_doppler_wipeoffs[i]); volk_gnsssdr_free(d_grid_doppler_wipeoffs[i]);
} }
delete[] d_grid_doppler_wipeoffs; delete[] d_grid_doppler_wipeoffs;
} }
for (unsigned int i = 0; i < d_max_dwells; i++) for (uint32_t i = 0; i < d_max_dwells; i++)
{ {
volk_gnsssdr_free(d_in_buffer[i]); volk_gnsssdr_free(d_in_buffer[i]);
} }
@ -314,7 +314,7 @@ void pcps_opencl_acquisition_cc::init()
d_cl_buffer_grid_doppler_wipeoffs = new cl::Buffer *[d_num_doppler_bins]; d_cl_buffer_grid_doppler_wipeoffs = new cl::Buffer *[d_num_doppler_bins];
} }
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
{ {
d_grid_doppler_wipeoffs[doppler_index] = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment())); d_grid_doppler_wipeoffs[doppler_index] = static_cast<gr_complex *>(volk_gnsssdr_malloc(d_fft_size * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
@ -407,7 +407,7 @@ void pcps_opencl_acquisition_cc::acquisition_core_volk()
d_input_power /= static_cast<float>(d_fft_size); d_input_power /= static_cast<float>(d_fft_size);
// 2- Doppler frequency search loop // 2- Doppler frequency search loop
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
{ {
// doppler search steps // doppler search steps
doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index; doppler = -static_cast<int>(d_doppler_max) + d_doppler_step * doppler_index;
@ -543,7 +543,7 @@ void pcps_opencl_acquisition_cc::acquisition_core_opencl()
cl::Kernel kernel; cl::Kernel kernel;
// 2- Doppler frequency search loop // 2- Doppler frequency search loop
for (unsigned int doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++) for (uint32_t doppler_index = 0; doppler_index < d_num_doppler_bins; doppler_index++)
{ {
// doppler search steps // doppler search steps
@ -736,8 +736,8 @@ int pcps_opencl_acquisition_cc::general_work(int noutput_items,
// Fill internal buffer with d_max_dwells signal blocks. This step ensures that // Fill internal buffer with d_max_dwells signal blocks. This step ensures that
// consecutive signal blocks will be processed in multi-dwell operation. This is // consecutive signal blocks will be processed in multi-dwell operation. This is
// essential when d_bit_transition_flag = true. // essential when d_bit_transition_flag = true.
unsigned int num_dwells = std::min(static_cast<int>(d_max_dwells - d_in_dwell_count), ninput_items[0]); uint32_t num_dwells = std::min(static_cast<int>(d_max_dwells - d_in_dwell_count), ninput_items[0]);
for (unsigned int i = 0; i < num_dwells; i++) for (uint32_t i = 0; i < num_dwells; i++)
{ {
memcpy(d_in_buffer[d_in_dwell_count++], static_cast<const gr_complex *>(input_items[i]), memcpy(d_in_buffer[d_in_dwell_count++], static_cast<const gr_complex *>(input_items[i]),
sizeof(gr_complex) * d_fft_size); sizeof(gr_complex) * d_fft_size);

View File

@ -56,6 +56,7 @@
#include <gnuradio/block.h> #include <gnuradio/block.h>
#include <gnuradio/fft/fft.h> #include <gnuradio/fft/fft.h>
#include <gnuradio/gr_complex.h> #include <gnuradio/gr_complex.h>
#include <cstdint>
#include <fstream> #include <fstream>
#include <string> #include <string>
#include <vector> #include <vector>
@ -71,8 +72,8 @@ class pcps_opencl_acquisition_cc;
typedef boost::shared_ptr<pcps_opencl_acquisition_cc> pcps_opencl_acquisition_cc_sptr; typedef boost::shared_ptr<pcps_opencl_acquisition_cc> pcps_opencl_acquisition_cc_sptr;
pcps_opencl_acquisition_cc_sptr pcps_opencl_acquisition_cc_sptr
pcps_make_opencl_acquisition_cc(unsigned int sampled_ms, unsigned int max_dwells, pcps_make_opencl_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
unsigned int doppler_max, long fs_in, uint32_t doppler_max, int64_t fs_in,
int samples_per_ms, int samples_per_code, int samples_per_ms, int samples_per_code,
bool bit_transition_flag, bool bit_transition_flag,
bool dump, bool dump,
@ -88,15 +89,15 @@ class pcps_opencl_acquisition_cc : public gr::block
{ {
private: private:
friend pcps_opencl_acquisition_cc_sptr friend pcps_opencl_acquisition_cc_sptr
pcps_make_opencl_acquisition_cc(unsigned int sampled_ms, unsigned int max_dwells, pcps_make_opencl_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
unsigned int doppler_max, long fs_in, uint32_t doppler_max, int64_t fs_in,
int samples_per_ms, int samples_per_code, int samples_per_ms, int samples_per_code,
bool bit_transition_flag, bool bit_transition_flag,
bool dump, bool dump,
std::string dump_filename); std::string dump_filename);
pcps_opencl_acquisition_cc(unsigned int sampled_ms, unsigned int max_dwells, pcps_opencl_acquisition_cc(uint32_t sampled_ms, uint32_t max_dwells,
unsigned int doppler_max, long fs_in, uint32_t doppler_max, int64_t fs_in,
int samples_per_ms, int samples_per_code, int samples_per_ms, int samples_per_code,
bool bit_transition_flag, bool bit_transition_flag,
bool dump, bool dump,
@ -107,28 +108,28 @@ private:
int init_opencl_environment(const std::string& kernel_filename); int init_opencl_environment(const std::string& kernel_filename);
long d_fs_in; int64_t d_fs_in;
int d_samples_per_ms; int d_samples_per_ms;
int d_samples_per_code; int d_samples_per_code;
unsigned int d_doppler_resolution; uint32_t d_doppler_resolution;
float d_threshold; float d_threshold;
std::string d_satellite_str; std::string d_satellite_str;
unsigned int d_doppler_max; uint32_t d_doppler_max;
unsigned int d_doppler_step; uint32_t d_doppler_step;
unsigned int d_sampled_ms; uint32_t d_sampled_ms;
unsigned int d_max_dwells; uint32_t d_max_dwells;
unsigned int d_well_count; uint32_t d_well_count;
unsigned int d_fft_size; uint32_t d_fft_size;
unsigned int d_fft_size_pow2; uint32_t d_fft_size_pow2;
int* d_max_doppler_indexs; int* d_max_doppler_indexs;
uint64_t d_sample_counter; uint64_t d_sample_counter;
gr_complex** d_grid_doppler_wipeoffs; gr_complex** d_grid_doppler_wipeoffs;
unsigned int d_num_doppler_bins; uint32_t d_num_doppler_bins;
gr_complex* d_fft_codes; gr_complex* d_fft_codes;
gr::fft::fft_complex* d_fft_if; gr::fft::fft_complex* d_fft_if;
gr::fft::fft_complex* d_ifft; gr::fft::fft_complex* d_ifft;
Gnss_Synchro* d_gnss_synchro; Gnss_Synchro* d_gnss_synchro;
unsigned int d_code_phase; uint32_t d_code_phase;
float d_doppler_freq; float d_doppler_freq;
float d_mag; float d_mag;
float* d_magnitude; float* d_magnitude;
@ -140,12 +141,12 @@ private:
int d_state; int d_state;
bool d_core_working; bool d_core_working;
bool d_dump; bool d_dump;
unsigned int d_channel; uint32_t d_channel;
std::string d_dump_filename; std::string d_dump_filename;
gr_complex* d_zero_vector; gr_complex* d_zero_vector;
gr_complex** d_in_buffer; gr_complex** d_in_buffer;
std::vector<uint64_t> d_sample_counter_buffer; std::vector<uint64_t> d_sample_counter_buffer;
unsigned int d_in_dwell_count; uint32_t d_in_dwell_count;
cl::Platform d_cl_platform; cl::Platform d_cl_platform;
cl::Device d_cl_device; cl::Device d_cl_device;
@ -182,7 +183,7 @@ public:
/*! /*!
* \brief Returns the maximum peak of grid search. * \brief Returns the maximum peak of grid search.
*/ */
inline unsigned int mag() const inline uint32_t mag() const
{ {
return d_mag; return d_mag;
} }
@ -219,7 +220,7 @@ public:
* \brief Set acquisition channel unique ID * \brief Set acquisition channel unique ID
* \param channel - receiver channel. * \param channel - receiver channel.
*/ */
inline void set_channel(unsigned int channel) inline void set_channel(uint32_t channel)
{ {
d_channel = channel; d_channel = channel;
} }
@ -238,7 +239,7 @@ public:
* \brief Set maximum Doppler grid search * \brief Set maximum Doppler grid search
* \param doppler_max - Maximum Doppler shift considered in the grid search [Hz]. * \param doppler_max - Maximum Doppler shift considered in the grid search [Hz].
*/ */
inline void set_doppler_max(unsigned int doppler_max) inline void set_doppler_max(uint32_t doppler_max)
{ {
d_doppler_max = doppler_max; d_doppler_max = doppler_max;
} }
@ -247,7 +248,7 @@ public:
* \brief Set Doppler steps for the grid search * \brief Set Doppler steps for the grid search
* \param doppler_step - Frequency bin of the search grid [Hz]. * \param doppler_step - Frequency bin of the search grid [Hz].
*/ */
inline void set_doppler_step(unsigned int doppler_step) inline void set_doppler_step(uint32_t doppler_step)
{ {
d_doppler_step = doppler_step; d_doppler_step = doppler_step;
} }