1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2025-06-27 07:32:57 +00:00

Use cstdint type names

This commit is contained in:
Carles Fernandez 2019-02-11 17:17:35 +01:00
parent 45b4478047
commit 0707963ab5
4 changed files with 26 additions and 25 deletions

View File

@ -81,7 +81,7 @@ BeidouB1iPcpsAcquisition::BeidouB1iPcpsAcquisition(
dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename); dump_filename_ = configuration_->property(role + ".dump_filename", default_dump_filename);
acq_parameters.dump_filename = dump_filename_; acq_parameters.dump_filename = dump_filename_;
//--- Find number of samples per spreading code ------------------------- //--- Find number of samples per spreading code -------------------------
code_length_ = static_cast<unsigned int>(std::round(static_cast<double>(fs_in_) / (BEIDOU_B1I_CODE_RATE_HZ / BEIDOU_B1I_CODE_LENGTH_CHIPS))); code_length_ = static_cast<uint32_t>(std::round(static_cast<double>(fs_in_) / (BEIDOU_B1I_CODE_RATE_HZ / BEIDOU_B1I_CODE_LENGTH_CHIPS)));
vector_length_ = code_length_ * sampled_ms_; vector_length_ = code_length_ * sampled_ms_;
@ -144,7 +144,7 @@ void BeidouB1iPcpsAcquisition::stop_acquisition()
{ {
} }
void BeidouB1iPcpsAcquisition::set_channel(unsigned int channel) void BeidouB1iPcpsAcquisition::set_channel(uint32_t channel)
{ {
channel_ = channel; channel_ = channel;
acquisition_->set_channel(channel_); acquisition_->set_channel(channel_);
@ -170,7 +170,7 @@ void BeidouB1iPcpsAcquisition::set_threshold(float threshold)
} }
void BeidouB1iPcpsAcquisition::set_doppler_max(unsigned int doppler_max) void BeidouB1iPcpsAcquisition::set_doppler_max(uint32_t doppler_max)
{ {
doppler_max_ = doppler_max; doppler_max_ = doppler_max;
@ -178,7 +178,7 @@ void BeidouB1iPcpsAcquisition::set_doppler_max(unsigned int doppler_max)
} }
void BeidouB1iPcpsAcquisition::set_doppler_step(unsigned int doppler_step) void BeidouB1iPcpsAcquisition::set_doppler_step(uint32_t doppler_step)
{ {
doppler_step_ = doppler_step; doppler_step_ = doppler_step;
@ -213,7 +213,7 @@ void BeidouB1iPcpsAcquisition::set_local_code()
beidou_b1i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0); beidou_b1i_code_gen_complex_sampled(code, gnss_synchro_->PRN, fs_in_, 0);
for (unsigned int i = 0; i < sampled_ms_; i++) for (uint32_t i = 0; i < sampled_ms_; i++)
{ {
memcpy(&(code_[i * code_length_]), code, memcpy(&(code_[i * code_length_]), code,
sizeof(gr_complex) * code_length_); sizeof(gr_complex) * code_length_);
@ -239,7 +239,7 @@ void BeidouB1iPcpsAcquisition::set_state(int state)
float BeidouB1iPcpsAcquisition::calculate_threshold(float pfa) float BeidouB1iPcpsAcquisition::calculate_threshold(float pfa)
{ {
//Calculate the threshold //Calculate the threshold
unsigned int frequency_bins = 0; uint32_t frequency_bins = 0;
/* /*
for (int doppler = (int)(-doppler_max_); doppler <= (int)doppler_max_; doppler += doppler_step_) for (int doppler = (int)(-doppler_max_); doppler <= (int)doppler_max_; doppler += doppler_step_)
{ {
@ -250,7 +250,7 @@ float BeidouB1iPcpsAcquisition::calculate_threshold(float pfa)
frequency_bins = (2 * doppler_max_ + doppler_step_) / doppler_step_; frequency_bins = (2 * doppler_max_ + doppler_step_) / doppler_step_;
DLOG(INFO) << "Channel " << channel_ << " Pfa = " << pfa; DLOG(INFO) << "Channel " << channel_ << " Pfa = " << pfa;
unsigned int ncells = vector_length_ * frequency_bins; uint32_t ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells); double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent); double val = pow(1.0 - pfa, exponent);
auto lambda = static_cast<double>(vector_length_); auto lambda = static_cast<double>(vector_length_);

View File

@ -42,6 +42,7 @@
#include <gnuradio/blocks/stream_to_vector.h> #include <gnuradio/blocks/stream_to_vector.h>
#include <volk_gnsssdr/volk_gnsssdr.h> #include <volk_gnsssdr/volk_gnsssdr.h>
#include <string> #include <string>
#include <cstdint>
class ConfigurationInterface; class ConfigurationInterface;
@ -92,7 +93,7 @@ public:
/*! /*!
* \brief Set acquisition channel unique ID * \brief Set acquisition channel unique ID
*/ */
void set_channel(unsigned int channel) override; void set_channel(uint32_t channel) override;
/*! /*!
* \brief Set statistics threshold of PCPS algorithm * \brief Set statistics threshold of PCPS algorithm
@ -102,12 +103,12 @@ public:
/*! /*!
* \brief Set maximum Doppler off grid search * \brief Set maximum Doppler off grid search
*/ */
void set_doppler_max(unsigned int doppler_max) override; void set_doppler_max(uint32_t doppler_max) override;
/*! /*!
* \brief Set Doppler steps for the grid search * \brief Set Doppler steps for the grid search
*/ */
void set_doppler_step(unsigned int doppler_step) override; void set_doppler_step(uint32_t doppler_step) override;
/*! /*!
* \brief Initializes acquisition algorithm. * \brief Initializes acquisition algorithm.
@ -153,25 +154,25 @@ private:
complex_byte_to_float_x2_sptr cbyte_to_float_x2_; complex_byte_to_float_x2_sptr cbyte_to_float_x2_;
size_t item_size_; size_t item_size_;
std::string item_type_; std::string item_type_;
unsigned int vector_length_; uint32_t vector_length_;
unsigned int code_length_; uint32_t code_length_;
bool bit_transition_flag_; bool bit_transition_flag_;
bool use_CFAR_algorithm_flag_; bool use_CFAR_algorithm_flag_;
unsigned int channel_; uint32_t channel_;
float threshold_; float threshold_;
unsigned int doppler_max_; uint32_t doppler_max_;
unsigned int doppler_step_; uint32_t doppler_step_;
unsigned int sampled_ms_; uint32_t sampled_ms_;
unsigned int max_dwells_; uint32_t max_dwells_;
long fs_in_; int64_t fs_in_;
bool dump_; bool dump_;
bool blocking_; bool blocking_;
std::string dump_filename_; std::string dump_filename_;
std::complex<float>* code_; std::complex<float>* code_;
Gnss_Synchro* gnss_synchro_; Gnss_Synchro* gnss_synchro_;
std::string role_; std::string role_;
unsigned int in_streams_; uint32_t in_streams_;
unsigned int out_streams_; uint32_t out_streams_;
float calculate_threshold(float pfa); float calculate_threshold(float pfa);
}; };

View File

@ -55,8 +55,8 @@ FileSignalSource::FileSignalSource(ConfigurationInterface* configuration,
double default_seconds_to_skip = 0.0; double default_seconds_to_skip = 0.0;
size_t header_size = 0; size_t header_size = 0;
samples_ = configuration->property(role + ".samples", 0); samples_ = configuration->property(role + ".samples", 0ULL);
sampling_frequency_ = configuration->property(role + ".sampling_frequency", 0); sampling_frequency_ = configuration->property(role + ".sampling_frequency", 0LL);
filename_ = configuration->property(role + ".filename", default_filename); filename_ = configuration->property(role + ".filename", default_filename);
// override value with commandline flag, if present // override value with commandline flag, if present

View File

@ -97,19 +97,19 @@ public:
return repeat_; return repeat_;
} }
inline long sampling_frequency() const inline int64_t sampling_frequency() const
{ {
return sampling_frequency_; return sampling_frequency_;
} }
inline long samples() const inline uint64_t samples() const
{ {
return samples_; return samples_;
} }
private: private:
uint64_t samples_; uint64_t samples_;
long sampling_frequency_; int64_t sampling_frequency_;
std::string filename_; std::string filename_;
std::string item_type_; std::string item_type_;
bool repeat_; bool repeat_;