1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-06-18 11:09:56 +00:00

Replace C style casts by C++ casts

This commit is contained in:
Carles Fernandez 2019-08-18 12:54:16 +02:00
parent eea6dc29f8
commit 4dd8aa12b4
No known key found for this signature in database
GPG Key ID: 4C583C52B0C3877D
31 changed files with 83 additions and 83 deletions

View File

@ -300,7 +300,7 @@ char Nmea_Printer::checkSum(const std::string& sentence)
// iterate over the string, XOR each byte with the total sum:
for (char c : sentence)
{
check = char(check ^ c);
check = static_cast<char>(check ^ c);
}
// return the result
return check;

View File

@ -11769,7 +11769,7 @@ void Rinex_Printer::to_date_time(int32_t gps_week, int32_t gps_tow, int& year, i
int32_t Rinex_Printer::signalStrength(const double snr)
{
int32_t ss;
ss = int(std::min(std::max(int(floor(snr / 6)), 1), 9));
ss = static_cast<int>(std::min(std::max(static_cast<int>(floor(snr / 6)), 1), 9));
return ss;
}

View File

@ -235,7 +235,7 @@ float BeidouB3iPcpsAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1.0 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
auto lambda = double(vector_length_);
auto lambda = static_cast<double>(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
auto threshold = static_cast<float>(quantile(mydist, val));

View File

@ -252,7 +252,7 @@ float GalileoE1Pcps8msAmbiguousAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
auto lambda = double(vector_length_);
auto lambda = static_cast<double>(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
auto threshold = static_cast<float>(quantile(mydist, val));

View File

@ -316,7 +316,7 @@ float GalileoE1PcpsAmbiguousAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
auto lambda = double(vector_length_);
auto lambda = static_cast<double>(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
auto threshold = static_cast<float>(quantile(mydist, val));

View File

@ -85,7 +85,7 @@ GalileoE1PcpsAmbiguousAcquisitionFpga::GalileoE1PcpsAmbiguousAcquisitionFpga(
acq_parameters.code_length = code_length;
// The FPGA can only use FFT lengths that are a power of two.
float nbits = ceilf(log2f((float)code_length * 2));
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0));
uint32_t nsamples_total = pow(2, nbits);
uint32_t select_queue_Fpga = configuration_->property(role + ".select_queue_Fpga", 0);

View File

@ -261,7 +261,7 @@ float GalileoE1PcpsTongAmbiguousAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
auto lambda = double(vector_length_);
auto lambda = static_cast<double>(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
auto threshold = static_cast<float>(quantile(mydist, val));

View File

@ -286,7 +286,7 @@ float GalileoE5aNoncoherentIQAcquisitionCaf::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
auto lambda = double(vector_length_);
auto lambda = static_cast<double>(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
auto threshold = static_cast<float>(quantile(mydist, val));

View File

@ -291,7 +291,7 @@ float GalileoE5aPcpsAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
auto lambda = double(vector_length_);
auto lambda = static_cast<double>(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
auto threshold = static_cast<float>(quantile(mydist, val));

View File

@ -86,7 +86,7 @@ GalileoE5aPcpsAcquisitionFpga::GalileoE5aPcpsAcquisitionFpga(ConfigurationInterf
acq_parameters.code_length = code_length;
// The FPGA can only use FFT lengths that are a power of two.
float nbits = ceilf(log2f((float)code_length * 2));
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0));
uint32_t nsamples_total = pow(2, nbits);
uint32_t select_queue_Fpga = configuration_->property(role + ".select_queue_Fpga", 1);
acq_parameters.select_queue_Fpga = select_queue_Fpga;

View File

@ -276,7 +276,7 @@ float GpsL1CaPcpsAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
auto lambda = double(vector_length_);
auto lambda = static_cast<double>(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
auto threshold = static_cast<float>(quantile(mydist, val));

View File

@ -79,7 +79,7 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
auto code_length = static_cast<uint32_t>(std::round(static_cast<double>(fs_in) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)));
acq_parameters.code_length = code_length;
// The FPGA can only use FFT lengths that are a power of two.
float nbits = ceilf(log2f((float)code_length * 2));
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0));
uint32_t nsamples_total = pow(2, nbits);
uint32_t select_queue_Fpga = configuration_->property(role + ".select_queue_Fpga", 0);
acq_parameters.select_queue_Fpga = select_queue_Fpga;

View File

@ -243,7 +243,7 @@ float GpsL1CaPcpsOpenClAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
auto lambda = double(vector_length_);
auto lambda = static_cast<double>(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
auto threshold = static_cast<float>(quantile(mydist, val));

View File

@ -240,7 +240,7 @@ float GpsL1CaPcpsTongAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
auto lambda = double(vector_length_);
auto lambda = static_cast<double>(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
auto threshold = static_cast<float>(quantile(mydist, val));

View File

@ -287,7 +287,7 @@ float GpsL2MPcpsAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1.0 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
auto lambda = double(vector_length_);
auto lambda = static_cast<double>(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
auto threshold = static_cast<float>(quantile(mydist, val));

View File

@ -78,7 +78,7 @@ GpsL2MPcpsAcquisitionFpga::GpsL2MPcpsAcquisitionFpga(
unsigned int code_length = std::round(static_cast<double>(fs_in_) / (GPS_L2_M_CODE_RATE_HZ / static_cast<double>(GPS_L2_M_CODE_LENGTH_CHIPS)));
acq_parameters.code_length = code_length;
// The FPGA can only use FFT lengths that are a power of two.
float nbits = ceilf(log2f((float)code_length));
float nbits = ceilf(log2f(static_cast<float>(code_length)));
unsigned int nsamples_total = pow(2, nbits);
unsigned int select_queue_Fpga = configuration_->property(role + ".select_queue_Fpga", 0);
acq_parameters.select_queue_Fpga = select_queue_Fpga;

View File

@ -282,7 +282,7 @@ float GpsL5iPcpsAcquisition::calculate_threshold(float pfa)
unsigned int ncells = vector_length_ * frequency_bins;
double exponent = 1.0 / static_cast<double>(ncells);
double val = pow(1.0 - pfa, exponent);
auto lambda = double(vector_length_);
auto lambda = static_cast<double>(vector_length_);
boost::math::exponential_distribution<double> mydist(lambda);
auto threshold = static_cast<float>(quantile(mydist, val));

View File

@ -82,7 +82,7 @@ GpsL5iPcpsAcquisitionFpga::GpsL5iPcpsAcquisitionFpga(
auto code_length = static_cast<uint32_t>(std::round(static_cast<double>(fs_in) / (GPS_L5I_CODE_RATE_HZ / static_cast<double>(GPS_L5I_CODE_LENGTH_CHIPS))));
acq_parameters.code_length = code_length;
// The FPGA can only use FFT lengths that are a power of two.
float nbits = ceilf(log2f((float)code_length * 2));
float nbits = ceilf(log2f(static_cast<float>(code_length) * 2.0));
uint32_t nsamples_total = pow(2, nbits);
uint32_t select_queue_Fpga = configuration_->property(role + ".select_queue_Fpga", 1);
acq_parameters.select_queue_Fpga = select_queue_Fpga;

View File

@ -389,6 +389,6 @@ void FirFilter::init()
taps_.reserve(taps_d.size());
for (double& it : taps_d)
{
taps_.push_back(float(it));
taps_.push_back(static_cast<float>(it));
}
}

View File

@ -53,32 +53,32 @@ void galileo_e5_a_code_gen_complex_primary(gsl::span<std::complex<float>> _dest,
for (size_t i = 0; i < GALILEO_E5A_Q_PRIMARY_CODE[prn].length() - 1; i++)
{
hex_to_binary_converter(a, GALILEO_E5A_Q_PRIMARY_CODE[prn].at(i));
_dest[index] = std::complex<float>(0.0, float(a[0]));
_dest[index + 1] = std::complex<float>(0.0, float(a[1]));
_dest[index + 2] = std::complex<float>(0.0, float(a[2]));
_dest[index + 3] = std::complex<float>(0.0, float(a[3]));
_dest[index] = std::complex<float>(0.0, static_cast<float>(a[0]));
_dest[index + 1] = std::complex<float>(0.0, static_cast<float>(a[1]));
_dest[index + 2] = std::complex<float>(0.0, static_cast<float>(a[2]));
_dest[index + 3] = std::complex<float>(0.0, static_cast<float>(a[3]));
index = index + 4;
}
// last 2 bits are filled up zeros
hex_to_binary_converter(a, GALILEO_E5A_Q_PRIMARY_CODE[prn].at(GALILEO_E5A_Q_PRIMARY_CODE[prn].length() - 1));
_dest[index] = std::complex<float>(float(0.0), a[0]);
_dest[index + 1] = std::complex<float>(float(0.0), a[1]);
_dest[index] = std::complex<float>(0.0, static_cast<float>(a[0]));
_dest[index + 1] = std::complex<float>(0.0, static_cast<float>(a[1]));
}
else if (_Signal[0] == '5' && _Signal[1] == 'I')
{
for (size_t i = 0; i < GALILEO_E5A_I_PRIMARY_CODE[prn].length() - 1; i++)
{
hex_to_binary_converter(a, GALILEO_E5A_I_PRIMARY_CODE[prn].at(i));
_dest[index] = std::complex<float>(float(a[0]), 0.0);
_dest[index + 1] = std::complex<float>(float(a[1]), 0.0);
_dest[index + 2] = std::complex<float>(float(a[2]), 0.0);
_dest[index + 3] = std::complex<float>(float(a[3]), 0.0);
_dest[index] = std::complex<float>(static_cast<float>(a[0]), 0.0);
_dest[index + 1] = std::complex<float>(static_cast<float>(a[1]), 0.0);
_dest[index + 2] = std::complex<float>(static_cast<float>(a[2]), 0.0);
_dest[index + 3] = std::complex<float>(static_cast<float>(a[3]), 0.0);
index = index + 4;
}
// last 2 bits are filled up zeros
hex_to_binary_converter(a, GALILEO_E5A_I_PRIMARY_CODE[prn].at(GALILEO_E5A_I_PRIMARY_CODE[prn].length() - 1));
_dest[index] = std::complex<float>(float(a[0]), 0.0);
_dest[index + 1] = std::complex<float>(float(a[1]), 0.0);
_dest[index] = std::complex<float>(static_cast<float>(a[0]), 0.0);
_dest[index + 1] = std::complex<float>(static_cast<float>(a[1]), 0.0);
}
else if (_Signal[0] == '5' && _Signal[1] == 'X')
{
@ -87,17 +87,17 @@ void galileo_e5_a_code_gen_complex_primary(gsl::span<std::complex<float>> _dest,
{
hex_to_binary_converter(a, GALILEO_E5A_I_PRIMARY_CODE[prn].at(i));
hex_to_binary_converter(b, GALILEO_E5A_Q_PRIMARY_CODE[prn].at(i));
_dest[index] = std::complex<float>(float(a[0]), float(b[0]));
_dest[index + 1] = std::complex<float>(float(a[1]), float(b[1]));
_dest[index + 2] = std::complex<float>(float(a[2]), float(b[2]));
_dest[index + 3] = std::complex<float>(float(a[3]), float(b[3]));
_dest[index] = std::complex<float>(static_cast<float>(a[0]), static_cast<float>(b[0]));
_dest[index + 1] = std::complex<float>(static_cast<float>(a[1]), static_cast<float>(b[1]));
_dest[index + 2] = std::complex<float>(static_cast<float>(a[2]), static_cast<float>(b[2]));
_dest[index + 3] = std::complex<float>(static_cast<float>(a[3]), static_cast<float>(b[3]));
index = index + 4;
}
// last 2 bits are filled up zeros
hex_to_binary_converter(a, GALILEO_E5A_I_PRIMARY_CODE[prn].at(GALILEO_E5A_I_PRIMARY_CODE[prn].length() - 1));
hex_to_binary_converter(b, GALILEO_E5A_Q_PRIMARY_CODE[prn].at(GALILEO_E5A_Q_PRIMARY_CODE[prn].length() - 1));
_dest[index] = std::complex<float>(float(a[0]), float(b[0]));
_dest[index + 1] = std::complex<float>(float(a[1]), float(b[1]));
_dest[index] = std::complex<float>(static_cast<float>(a[0]), static_cast<float>(b[0]));
_dest[index + 1] = std::complex<float>(static_cast<float>(a[1]), static_cast<float>(b[1]));
}
}

View File

@ -58,7 +58,7 @@
#define MIN_PPP(x, y) ((x) <= (y) ? (x) : (y))
#define ROUND_PPP(x) (int)floor((x) + 0.5)
#define ROUND_PPP(x) static_cast<int>(floor((x) + 0.5))
#define SWAP_I(x, y) \
do \

View File

@ -360,9 +360,9 @@ void tidedisp(gtime_t tutc, const double *rr, int opt, const erp_t *erp,
#ifdef IERS_MODEL
time2epoch(tutc, ep);
year = (int)ep[0];
mon = (int)ep[1];
day = (int)ep[2];
year = static_cast<int>(ep[0]);
mon = static_cast<int>(ep[1]);
day = static_cast<int>(ep[2]);
fhr = ep[3] + ep[4] / 60.0 + ep[5] / 3600.0;
/* call DEHANTTIDEINEL */

View File

@ -103,12 +103,12 @@ Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc::Gps_L1_Ca_Dll_Pll_Tracking_GPU_cc(
//pinned memory mode - use special function to get OS-pinned memory
d_n_correlator_taps = 3; // Early, Prompt, and Late
// Get space for a vector with the C/A code replica sampled 1x/chip
cudaHostAlloc((void **)&d_ca_code, (static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex)), cudaHostAllocMapped || cudaHostAllocWriteCombined);
cudaHostAlloc(reinterpret_cast<void **>(&d_ca_code), (static_cast<int32_t>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex)), cudaHostAllocMapped || cudaHostAllocWriteCombined);
// Get space for the resampled early / prompt / late local replicas
cudaHostAlloc((void **)&d_local_code_shift_chips, d_n_correlator_taps * sizeof(float), cudaHostAllocMapped || cudaHostAllocWriteCombined);
cudaHostAlloc((void **)&in_gpu, 2 * d_vector_length * sizeof(gr_complex), cudaHostAllocMapped || cudaHostAllocWriteCombined);
cudaHostAlloc(reinterpret_cast<void **>(&d_local_code_shift_chips), d_n_correlator_taps * sizeof(float), cudaHostAllocMapped || cudaHostAllocWriteCombined);
cudaHostAlloc(reinterpret_cast<void **>(&in_gpu), 2 * d_vector_length * sizeof(gr_complex), cudaHostAllocMapped || cudaHostAllocWriteCombined);
// correlator outputs (scalar)
cudaHostAlloc((void **)&d_correlator_outs, sizeof(gr_complex) * d_n_correlator_taps, cudaHostAllocMapped || cudaHostAllocWriteCombined);
cudaHostAlloc(reinterpret_cast<void **>(&d_correlator_outs), sizeof(gr_complex) * d_n_correlator_taps, cudaHostAllocMapped || cudaHostAllocWriteCombined);
// Set TAPs delay values [chips]
d_local_code_shift_chips[0] = -d_early_late_spc_chips;

View File

@ -522,7 +522,7 @@ void Fpga_Multicorrelator_8sc::initialize_secondary_code(uint32_t secondary_code
void Fpga_Multicorrelator_8sc::write_secondary_code(uint32_t secondary_code_length, std::string *secondary_code_string, uint32_t reg_addr)
{
uint32_t num_words = ceil(((float)secondary_code_length) / secondary_code_word_size);
uint32_t num_words = ceil(static_cast<float>(secondary_code_length) / secondary_code_word_size);
uint32_t last_word_size = secondary_code_length % secondary_code_word_size;
if (last_word_size == 0)

View File

@ -77,9 +77,9 @@ void thread_acquisition_send_rx_samples(gr::top_block_sptr top_block,
// we want for the test
usleep(ONE_SECOND);
char *buffer_float; // temporary buffer to convert from binary char to float and from float to char
signed char *buffer_DMA; // temporary buffer to store the samples to be sent to the DMA
buffer_float = (char *)malloc(FLOAT_SIZE); // allocate space for the temporary buffer
char *buffer_float; // temporary buffer to convert from binary char to float and from float to char
signed char *buffer_DMA; // temporary buffer to store the samples to be sent to the DMA
buffer_float = reinterpret_cast<char *>(malloc(FLOAT_SIZE)); // allocate space for the temporary buffer
if (!buffer_float)
{
std::cerr << "Memory error!" << std::endl;
@ -102,7 +102,7 @@ void thread_acquisition_send_rx_samples(gr::top_block_sptr top_block,
// first step: check for the maximum value of the received signal
float max = 0;
float *pointer_float;
pointer_float = (float *)&buffer_float[0];
pointer_float = reinterpret_cast<float *>(&buffer_float[0]);
for (int k = 0; k < file_length; k = k + FLOAT_SIZE)
{
size_t result = fread(buffer_float, FLOAT_SIZE, 1, rx_signal_file);

View File

@ -402,7 +402,7 @@ void* handler_DMA_obs_test(void* arguments)
while (send_samples_start_obs_test == 0)
; // wait until acquisition starts
// skip initial samples
int skip_samples = (int)FLAGS_skip_samples;
int skip_samples = static_cast<int>(FLAGS_skip_samples);
fseek(rx_signal_file_id, (skip_samples + skip_used_samples) * 2, SEEK_SET);
@ -634,7 +634,7 @@ bool HybridObservablesTestFpga::acquire_signal()
args.nsamples_tx = TEST_OBS_DOWNAMPLING_FILTER_INIT_SAMPLES + TEST_OBS_DOWNSAMPLING_FILTER_DELAY;
if (pthread_create(&thread_DMA, nullptr, handler_DMA_obs_test, (void*)&args) < 0)
if (pthread_create(&thread_DMA, nullptr, handler_DMA_obs_test, reinterpret_cast<void*>(&args)) < 0)
{
std::cout << "ERROR cannot create DMA Process" << std::endl;
}
@ -656,7 +656,7 @@ bool HybridObservablesTestFpga::acquire_signal()
}
// create DMA child process
if (pthread_create(&thread_DMA, nullptr, handler_DMA_obs_test, (void*)&args) < 0)
if (pthread_create(&thread_DMA, nullptr, handler_DMA_obs_test, reinterpret_cast<void*>(&args)) < 0)
{
std::cout << "ERROR cannot create DMA Process" << std::endl;
}
@ -1672,7 +1672,7 @@ TEST_F(HybridObservablesTestFpga, ValidationOfResults)
args.skip_used_samples = 0;
if (pthread_create(&thread_DMA, nullptr, handler_DMA_obs_test, (void*)&args) < 0)
if (pthread_create(&thread_DMA, nullptr, handler_DMA_obs_test, reinterpret_cast<void*>(&args)) < 0)
{
std::cout << "ERROR cannot create DMA Process" << std::endl;
}

View File

@ -317,10 +317,10 @@ TEST(RinexPrinterTest, GlonassObsLog)
gs4.System = *sys.c_str();
std::string sig = "1C";
std::memcpy((void*)gs1.Signal, sig.c_str(), 3);
std::memcpy((void*)gs2.Signal, sig.c_str(), 3);
std::memcpy((void*)gs3.Signal, sig.c_str(), 3);
std::memcpy((void*)gs4.Signal, sig.c_str(), 3);
std::memcpy(reinterpret_cast<void*>(gs1.Signal), sig.c_str(), 3);
std::memcpy(reinterpret_cast<void*>(gs2.Signal), sig.c_str(), 3);
std::memcpy(reinterpret_cast<void*>(gs3.Signal), sig.c_str(), 3);
std::memcpy(reinterpret_cast<void*>(gs4.Signal), sig.c_str(), 3);
gs1.PRN = 3;
gs2.PRN = 8;
@ -680,16 +680,16 @@ TEST(RinexPrinterTest, MixedObsLogGpsGlo)
gs8.System = *sys.c_str();
std::string sig = "1C";
std::memcpy((void*)gs1.Signal, sig.c_str(), 3);
std::memcpy((void*)gs2.Signal, sig.c_str(), 3);
std::memcpy((void*)gs3.Signal, sig.c_str(), 3);
std::memcpy((void*)gs4.Signal, sig.c_str(), 3);
std::memcpy(reinterpret_cast<void*>(gs1.Signal), sig.c_str(), 3);
std::memcpy(reinterpret_cast<void*>(gs2.Signal), sig.c_str(), 3);
std::memcpy(reinterpret_cast<void*>(gs3.Signal), sig.c_str(), 3);
std::memcpy(reinterpret_cast<void*>(gs4.Signal), sig.c_str(), 3);
sig = "1G";
std::memcpy((void*)gs5.Signal, sig.c_str(), 3);
std::memcpy((void*)gs6.Signal, sig.c_str(), 3);
std::memcpy((void*)gs7.Signal, sig.c_str(), 3);
std::memcpy((void*)gs8.Signal, sig.c_str(), 3);
std::memcpy(reinterpret_cast<void*>(gs5.Signal), sig.c_str(), 3);
std::memcpy(reinterpret_cast<void*>(gs6.Signal), sig.c_str(), 3);
std::memcpy(reinterpret_cast<void*>(gs7.Signal), sig.c_str(), 3);
std::memcpy(reinterpret_cast<void*>(gs8.Signal), sig.c_str(), 3);
gs1.PRN = 3;
gs2.PRN = 8;

View File

@ -386,12 +386,12 @@ TEST(RtcmTest, MSMCell)
gnss_synchro5.System = *gps.c_str();
gnss_synchro6.System = *glo.c_str();
std::memcpy((void*)gnss_synchro.Signal, x5.c_str(), 3);
std::memcpy((void*)gnss_synchro2.Signal, s2.c_str(), 3);
std::memcpy((void*)gnss_synchro3.Signal, c1.c_str(), 3);
std::memcpy((void*)gnss_synchro4.Signal, x5.c_str(), 3);
std::memcpy((void*)gnss_synchro5.Signal, c1.c_str(), 3);
std::memcpy((void*)gnss_synchro6.Signal, c1.c_str(), 3);
std::memcpy(reinterpret_cast<void*>(gnss_synchro.Signal), x5.c_str(), 3);
std::memcpy(reinterpret_cast<void*>(gnss_synchro2.Signal), s2.c_str(), 3);
std::memcpy(reinterpret_cast<void*>(gnss_synchro3.Signal), c1.c_str(), 3);
std::memcpy(reinterpret_cast<void*>(gnss_synchro4.Signal), x5.c_str(), 3);
std::memcpy(reinterpret_cast<void*>(gnss_synchro5.Signal), c1.c_str(), 3);
std::memcpy(reinterpret_cast<void*>(gnss_synchro6.Signal), c1.c_str(), 3);
gnss_synchro.Pseudorange_m = 20000000.0;
gnss_synchro2.Pseudorange_m = 20001010.0;
@ -465,7 +465,7 @@ TEST(RtcmTest, MSMCell)
Gnss_Synchro gnss_synchro7;
gnss_synchro7.PRN = 10;
gnss_synchro7.System = *gps.c_str();
std::memcpy((void*)gnss_synchro7.Signal, s2.c_str(), 3);
std::memcpy(reinterpret_cast<void*>(gnss_synchro7.Signal), s2.c_str(), 3);
gnss_synchro7.Pseudorange_m = 24000000.0;
std::map<int, Gnss_Synchro> pseudoranges3;

View File

@ -83,7 +83,7 @@ void send_tracking_gps_input_samples(FILE *rx_signal_file,
return;
}
buffer_DMA = (char *)malloc(DMA_TRACK_TRANSFER_SIZE);
buffer_DMA = reinterpret_cast<char *>(malloc(DMA_TRACK_TRANSFER_SIZE));
if (!buffer_DMA)
{
std::cerr << "Memory error!" << std::endl;

View File

@ -86,12 +86,12 @@ TEST(GpuMulticorrelatorTest, MeasureExecutionTime)
//pinned memory mode - use special function to get OS-pinned memory
d_n_correlator_taps = 3; // Early, Prompt, and Late
// Get space for a vector with the C/A code replica sampled 1x/chip
cudaHostAlloc((void**)&d_ca_code, (static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex)), cudaHostAllocMapped | cudaHostAllocWriteCombined);
cudaHostAlloc(reinterpret_cast<void**>(&d_ca_code), (static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS) * sizeof(gr_complex)), cudaHostAllocMapped | cudaHostAllocWriteCombined);
// Get space for the resampled early / prompt / late local replicas
cudaHostAlloc((void**)&d_local_code_shift_chips, d_n_correlator_taps * sizeof(float), cudaHostAllocMapped | cudaHostAllocWriteCombined);
cudaHostAlloc((void**)&in_gpu, 2 * d_vector_length * sizeof(gr_complex), cudaHostAllocMapped | cudaHostAllocWriteCombined);
cudaHostAlloc(reinterpret_cast<void**>(&d_local_code_shift_chips), d_n_correlator_taps * sizeof(float), cudaHostAllocMapped | cudaHostAllocWriteCombined);
cudaHostAlloc(reinterpret_cast<void**>(&in_gpu), 2 * d_vector_length * sizeof(gr_complex), cudaHostAllocMapped | cudaHostAllocWriteCombined);
// correlator outputs (scalar)
cudaHostAlloc((void**)&d_correlator_outs, sizeof(gr_complex) * d_n_correlator_taps, cudaHostAllocMapped | cudaHostAllocWriteCombined);
cudaHostAlloc(reinterpret_cast<void**>(&d_correlator_outs), sizeof(gr_complex) * d_n_correlator_taps, cudaHostAllocMapped | cudaHostAllocWriteCombined);
//--- Perform initializations ------------------------------
//local code resampler on GPU

View File

@ -485,7 +485,7 @@ void* handler_DMA(void* arguments)
; // wait until main thread tells the DMA to start
// skip initial samples
int skip_samples = (int)FLAGS_skip_samples;
int skip_samples = static_cast<int>(FLAGS_skip_samples);
fseek(rx_signal_file_id, (skip_samples + skip_used_samples) * 2, SEEK_SET);
@ -723,7 +723,7 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID)
args.nsamples_tx = DOWNAMPLING_FILTER_INIT_SAMPLES + DOWNSAMPLING_FILTER_DELAY;
if (pthread_create(&thread_DMA, nullptr, handler_DMA, (void*)&args) < 0)
if (pthread_create(&thread_DMA, nullptr, handler_DMA, reinterpret_cast<void*>(&args)) < 0)
{
std::cout << "ERROR cannot create DMA Process" << std::endl;
}
@ -744,7 +744,7 @@ bool TrackingPullInTestFpga::acquire_signal(int SV_ID)
args.skip_used_samples = 0;
}
if (pthread_create(&thread_DMA, nullptr, handler_DMA, (void*)&args) < 0)
if (pthread_create(&thread_DMA, nullptr, handler_DMA, reinterpret_cast<void*>(&args)) < 0)
{
std::cout << "ERROR cannot create DMA Process" << std::endl;
}
@ -954,7 +954,7 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults)
code_length = static_cast<unsigned int>(std::round(static_cast<double>(baseband_sampling_freq) / (GPS_L5I_CODE_RATE_HZ / static_cast<double>(GPS_L5I_CODE_LENGTH_CHIPS))));
}
float nbits = ceilf(log2f((float)code_length));
float nbits = ceilf(log2f(static_cast<float>(code_length)));
unsigned int fft_size = pow(2, nbits);
// The HW has been reset after the acquisition phase when the acquisition class was destroyed.
@ -1053,7 +1053,7 @@ TEST_F(TrackingPullInTestFpga, ValidationOfResults)
//********************************************************************
args.nsamples_tx = baseband_sampling_freq * FLAGS_duration;
if (pthread_create(&thread_DMA, nullptr, handler_DMA, (void*)&args) < 0)
if (pthread_create(&thread_DMA, nullptr, handler_DMA, reinterpret_cast<void*>(&args)) < 0)
{
std::cout << "ERROR cannot create DMA Process" << std::endl;
}