mirror of
https://github.com/gnss-sdr/gnss-sdr
synced 2025-11-15 06:37:15 +00:00
Apply code formatting
This commit is contained in:
@@ -33,15 +33,17 @@
|
|||||||
*
|
*
|
||||||
* -------------------------------------------------------------------------
|
* -------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
#include <new>
|
|
||||||
|
#include "configuration_interface.h"
|
||||||
|
#include "gnss_sdr_flags.h"
|
||||||
|
#include "gps_l1_ca_pcps_acquisition_fpga.h"
|
||||||
|
#include "gps_sdr_signal_processing.h"
|
||||||
|
#include "GPS_L1_CA.h"
|
||||||
#include <gnuradio/fft/fft.h>
|
#include <gnuradio/fft/fft.h>
|
||||||
#include <volk/volk.h>
|
#include <volk/volk.h>
|
||||||
#include <glog/logging.h>
|
#include <glog/logging.h>
|
||||||
#include "gps_l1_ca_pcps_acquisition_fpga.h"
|
#include <new>
|
||||||
#include "configuration_interface.h"
|
|
||||||
#include "gps_sdr_signal_processing.h"
|
|
||||||
#include "GPS_L1_CA.h"
|
|
||||||
#include "gnss_sdr_flags.h"
|
|
||||||
|
|
||||||
#define NUM_PRNs 32
|
#define NUM_PRNs 32
|
||||||
|
|
||||||
@@ -70,10 +72,10 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
|
|||||||
unsigned int code_length = static_cast<unsigned int>(std::round(static_cast<double>(fs_in) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)));
|
unsigned int code_length = static_cast<unsigned int>(std::round(static_cast<double>(fs_in) / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)));
|
||||||
|
|
||||||
// The FPGA can only use FFT lengths that are a power of two.
|
// The FPGA can only use FFT lengths that are a power of two.
|
||||||
float nbits = ceilf(log2f((float) code_length));
|
float nbits = ceilf(log2f((float)code_length));
|
||||||
unsigned int nsamples_total = pow(2, nbits);
|
unsigned int nsamples_total = pow(2, nbits);
|
||||||
unsigned int vector_length = nsamples_total * sampled_ms;
|
unsigned int vector_length = nsamples_total * sampled_ms;
|
||||||
unsigned int select_queue_Fpga = configuration_->property(role + ".select_queue_Fpga",0);
|
unsigned int select_queue_Fpga = configuration_->property(role + ".select_queue_Fpga", 0);
|
||||||
acq_parameters.select_queue_Fpga = select_queue_Fpga;
|
acq_parameters.select_queue_Fpga = select_queue_Fpga;
|
||||||
std::string default_device_name = "/dev/uio0";
|
std::string default_device_name = "/dev/uio0";
|
||||||
std::string device_name = configuration_->property(role + ".devicename", default_device_name);
|
std::string device_name = configuration_->property(role + ".devicename", default_device_name);
|
||||||
@@ -84,27 +86,27 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
|
|||||||
// compute all the GPS L1 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
|
// compute all the GPS L1 PRN Codes (this is done only once upon the class constructor in order to avoid re-computing the PRN codes every time
|
||||||
// a channel is assigned)
|
// a channel is assigned)
|
||||||
|
|
||||||
gr::fft::fft_complex* fft_if = new gr::fft::fft_complex(vector_length, true); // Direct FFT
|
gr::fft::fft_complex* fft_if = new gr::fft::fft_complex(vector_length, true); // Direct FFT
|
||||||
// allocate memory to compute all the PRNs and compute all the possible codes
|
// allocate memory to compute all the PRNs and compute all the possible codes
|
||||||
std::complex<float>* code = new std::complex<float>[nsamples_total]; // buffer for the local code
|
std::complex<float>* code = new std::complex<float>[nsamples_total]; // buffer for the local code
|
||||||
gr_complex* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
gr_complex* fft_codes_padded = static_cast<gr_complex*>(volk_gnsssdr_malloc(nsamples_total * sizeof(gr_complex), volk_gnsssdr_get_alignment()));
|
||||||
d_all_fft_codes_ = new lv_16sc_t[nsamples_total * NUM_PRNs]; // memory containing all the possible fft codes for PRN 0 to 32
|
d_all_fft_codes_ = new lv_16sc_t[nsamples_total * NUM_PRNs]; // memory containing all the possible fft codes for PRN 0 to 32
|
||||||
float max; // temporary maxima search
|
float max; // temporary maxima search
|
||||||
|
|
||||||
for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++)
|
for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++)
|
||||||
{
|
{
|
||||||
gps_l1_ca_code_gen_complex_sampled(code, PRN, fs_in, 0); // generate PRN code
|
gps_l1_ca_code_gen_complex_sampled(code, PRN, fs_in, 0); // generate PRN code
|
||||||
// fill in zero padding
|
// fill in zero padding
|
||||||
for (int s=code_length;s<nsamples_total;s++)
|
for (int s = code_length; s < nsamples_total; s++)
|
||||||
{
|
{
|
||||||
code[s] = 0;
|
code[s] = 0;
|
||||||
}
|
}
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
memcpy(fft_if->get_inbuf() + offset, code, sizeof(gr_complex) * nsamples_total); // copy to FFT buffer
|
memcpy(fft_if->get_inbuf() + offset, code, sizeof(gr_complex) * nsamples_total); // copy to FFT buffer
|
||||||
fft_if->execute(); // Run the FFT of local code
|
fft_if->execute(); // Run the FFT of local code
|
||||||
volk_32fc_conjugate_32fc(fft_codes_padded, fft_if->get_outbuf(), nsamples_total); // conjugate values
|
volk_32fc_conjugate_32fc(fft_codes_padded, fft_if->get_outbuf(), nsamples_total); // conjugate values
|
||||||
max = 0; // initialize maximum value
|
max = 0; // initialize maximum value
|
||||||
for (unsigned int i = 0; i < nsamples_total; i++) // search for maxima
|
for (unsigned int i = 0; i < nsamples_total; i++) // search for maxima
|
||||||
{
|
{
|
||||||
if (std::abs(fft_codes_padded[i].real()) > max)
|
if (std::abs(fft_codes_padded[i].real()) > max)
|
||||||
{
|
{
|
||||||
@@ -115,13 +117,12 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga(
|
|||||||
max = std::abs(fft_codes_padded[i].imag());
|
max = std::abs(fft_codes_padded[i].imag());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (unsigned int i = 0; i < nsamples_total; i++) // map the FFT to the dynamic range of the fixed point values an copy to buffer containing all FFTs
|
for (unsigned int i = 0; i < nsamples_total; i++) // map the FFT to the dynamic range of the fixed point values an copy to buffer containing all FFTs
|
||||||
{
|
{
|
||||||
d_all_fft_codes_[i + nsamples_total * (PRN -1)] = lv_16sc_t(static_cast<int>(floor(fft_codes_padded[i].real() * (pow(2, 7) - 1) / max)),
|
d_all_fft_codes_[i + nsamples_total * (PRN - 1)] = lv_16sc_t(static_cast<int>(floor(fft_codes_padded[i].real() * (pow(2, 7) - 1) / max)),
|
||||||
static_cast<int>(floor(fft_codes_padded[i].imag() * (pow(2, 7) - 1) / max)));
|
static_cast<int>(floor(fft_codes_padded[i].imag() * (pow(2, 7) - 1) / max)));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//acq_parameters
|
//acq_parameters
|
||||||
|
|
||||||
|
|||||||
@@ -37,11 +37,10 @@
|
|||||||
#ifndef GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_FPGA_H_
|
#ifndef GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_FPGA_H_
|
||||||
#define GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_FPGA_H_
|
#define GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_FPGA_H_
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include "acquisition_interface.h"
|
#include "acquisition_interface.h"
|
||||||
#include "gnss_synchro.h"
|
#include "gnss_synchro.h"
|
||||||
#include "pcps_acquisition_fpga.h"
|
#include "pcps_acquisition_fpga.h"
|
||||||
|
#include <string>
|
||||||
|
|
||||||
class ConfigurationInterface;
|
class ConfigurationInterface;
|
||||||
|
|
||||||
@@ -144,8 +143,7 @@ private:
|
|||||||
std::string role_;
|
std::string role_;
|
||||||
unsigned int in_streams_;
|
unsigned int in_streams_;
|
||||||
unsigned int out_streams_;
|
unsigned int out_streams_;
|
||||||
lv_16sc_t *d_all_fft_codes_; // memory that contains all the code ffts
|
lv_16sc_t* d_all_fft_codes_; // memory that contains all the code ffts
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_FPGA_H_ */
|
#endif /* GNSS_SDR_GPS_L1_CA_PCPS_ACQUISITION_FPGA_H_ */
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ if(ENABLE_FPGA)
|
|||||||
conjugate_ic.cc
|
conjugate_ic.cc
|
||||||
)
|
)
|
||||||
else(ENABLE_FPGA)
|
else(ENABLE_FPGA)
|
||||||
set(GNSS_SPLIBS_SOURCES
|
set(GNSS_SPLIBS_SOURCES
|
||||||
gps_l2c_signal.cc
|
gps_l2c_signal.cc
|
||||||
gps_l5_signal.cc
|
gps_l5_signal.cc
|
||||||
galileo_e1_signal_processing.cc
|
galileo_e1_signal_processing.cc
|
||||||
@@ -62,38 +62,38 @@ else(ENABLE_FPGA)
|
|||||||
conjugate_cc.cc
|
conjugate_cc.cc
|
||||||
conjugate_sc.cc
|
conjugate_sc.cc
|
||||||
conjugate_ic.cc
|
conjugate_ic.cc
|
||||||
)
|
)
|
||||||
endif(ENABLE_FPGA)
|
endif(ENABLE_FPGA)
|
||||||
|
|
||||||
if(OPENCL_FOUND)
|
if(OPENCL_FOUND)
|
||||||
set(GNSS_SPLIBS_SOURCES ${GNSS_SPLIBS_SOURCES}
|
set(GNSS_SPLIBS_SOURCES ${GNSS_SPLIBS_SOURCES}
|
||||||
opencl/fft_execute.cc # Needs OpenCL
|
opencl/fft_execute.cc # Needs OpenCL
|
||||||
opencl/fft_setup.cc # Needs OpenCL
|
opencl/fft_setup.cc # Needs OpenCL
|
||||||
opencl/fft_kernelstring.cc # Needs OpenCL
|
opencl/fft_kernelstring.cc # Needs OpenCL
|
||||||
)
|
)
|
||||||
endif(OPENCL_FOUND)
|
endif(OPENCL_FOUND)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
${CMAKE_SOURCE_DIR}/src/core/system_parameters
|
${CMAKE_SOURCE_DIR}/src/core/system_parameters
|
||||||
${CMAKE_SOURCE_DIR}/src/core/receiver
|
${CMAKE_SOURCE_DIR}/src/core/receiver
|
||||||
${CMAKE_SOURCE_DIR}/src/core/interfaces
|
${CMAKE_SOURCE_DIR}/src/core/interfaces
|
||||||
${Boost_INCLUDE_DIRS}
|
${Boost_INCLUDE_DIRS}
|
||||||
${GLOG_INCLUDE_DIRS}
|
${GLOG_INCLUDE_DIRS}
|
||||||
${GFlags_INCLUDE_DIRS}
|
${GFlags_INCLUDE_DIRS}
|
||||||
${GNURADIO_RUNTIME_INCLUDE_DIRS}
|
${GNURADIO_RUNTIME_INCLUDE_DIRS}
|
||||||
${GNURADIO_BLOCKS_INCLUDE_DIRS}
|
${GNURADIO_BLOCKS_INCLUDE_DIRS}
|
||||||
${VOLK_INCLUDE_DIRS}
|
${VOLK_INCLUDE_DIRS}
|
||||||
${VOLK_GNSSSDR_INCLUDE_DIRS}
|
${VOLK_GNSSSDR_INCLUDE_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
if(OPENCL_FOUND)
|
if(OPENCL_FOUND)
|
||||||
include_directories( ${OPENCL_INCLUDE_DIRS} )
|
include_directories( ${OPENCL_INCLUDE_DIRS} )
|
||||||
if(OS_IS_MACOSX)
|
if(OS_IS_MACOSX)
|
||||||
set(OPT_LIBRARIES ${OPT_LIBRARIES} "-framework OpenCL")
|
set(OPT_LIBRARIES ${OPT_LIBRARIES} "-framework OpenCL")
|
||||||
else(OS_IS_MACOSX)
|
else(OS_IS_MACOSX)
|
||||||
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${OPENCL_LIBRARIES})
|
set(OPT_LIBRARIES ${OPT_LIBRARIES} ${OPENCL_LIBRARIES})
|
||||||
endif(OS_IS_MACOSX)
|
endif(OS_IS_MACOSX)
|
||||||
endif(OPENCL_FOUND)
|
endif(OPENCL_FOUND)
|
||||||
|
|
||||||
add_definitions(-DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}")
|
add_definitions(-DGNSSSDR_INSTALL_DIR="${CMAKE_INSTALL_PREFIX}")
|
||||||
@@ -105,22 +105,22 @@ add_library(gnss_sp_libs ${GNSS_SPLIBS_SOURCES} ${GNSS_SPLIBS_HEADERS})
|
|||||||
source_group(Headers FILES ${GNSS_SPLIBS_HEADERS})
|
source_group(Headers FILES ${GNSS_SPLIBS_HEADERS})
|
||||||
|
|
||||||
target_link_libraries(gnss_sp_libs ${GNURADIO_RUNTIME_LIBRARIES}
|
target_link_libraries(gnss_sp_libs ${GNURADIO_RUNTIME_LIBRARIES}
|
||||||
${VOLK_LIBRARIES} ${ORC_LIBRARIES}
|
${VOLK_LIBRARIES} ${ORC_LIBRARIES}
|
||||||
${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES}
|
${VOLK_GNSSSDR_LIBRARIES} ${ORC_LIBRARIES}
|
||||||
${GFlags_LIBS}
|
${GFlags_LIBS}
|
||||||
${GNURADIO_BLOCKS_LIBRARIES}
|
${GNURADIO_BLOCKS_LIBRARIES}
|
||||||
${GNURADIO_FFT_LIBRARIES}
|
${GNURADIO_FFT_LIBRARIES}
|
||||||
${GNURADIO_FILTER_LIBRARIES}
|
${GNURADIO_FILTER_LIBRARIES}
|
||||||
${OPT_LIBRARIES}
|
${OPT_LIBRARIES}
|
||||||
gnss_rx
|
gnss_rx
|
||||||
)
|
)
|
||||||
|
|
||||||
if(NOT VOLK_GNSSSDR_FOUND)
|
if(NOT VOLK_GNSSSDR_FOUND)
|
||||||
add_dependencies(gnss_sp_libs volk_gnsssdr_module)
|
add_dependencies(gnss_sp_libs volk_gnsssdr_module)
|
||||||
endif(NOT VOLK_GNSSSDR_FOUND)
|
endif(NOT VOLK_GNSSSDR_FOUND)
|
||||||
|
|
||||||
if(${GFLAGS_GREATER_20})
|
if(${GFLAGS_GREATER_20})
|
||||||
add_definitions(-DGFLAGS_GREATER_2_0=1)
|
add_definitions(-DGFLAGS_GREATER_2_0=1)
|
||||||
endif(${GFLAGS_GREATER_20})
|
endif(${GFLAGS_GREATER_20})
|
||||||
|
|
||||||
add_library(gnss_sdr_flags gnss_sdr_flags.cc gnss_sdr_flags.h)
|
add_library(gnss_sdr_flags gnss_sdr_flags.cc gnss_sdr_flags.h)
|
||||||
|
|||||||
Reference in New Issue
Block a user