mirror of
				https://github.com/gnss-sdr/gnss-sdr
				synced 2025-10-30 14:53:03 +00:00 
			
		
		
		
	Currently creating a generic tracking class for the FPGA in the same way as it is done in the SW.
This commit is contained in:
		| @@ -132,12 +132,13 @@ GpsL1CaPcpsAcquisitionFpga::GpsL1CaPcpsAcquisitionFpga( | ||||
|     delete fft_if; | ||||
|     delete[] fft_codes_padded; | ||||
|  | ||||
|     acquisition_fpga_ = pcps_make_acquisition(acq_parameters); | ||||
|     acquisition_fpga_ = pcps_make_acquisition_fpga(acq_parameters); | ||||
|     DLOG(INFO) << "acquisition(" << acquisition_fpga_->unique_id() << ")"; | ||||
|  | ||||
|     channel_ = 0; | ||||
|     doppler_step_ = 0; | ||||
|     gnss_synchro_ = 0; | ||||
|  | ||||
| } | ||||
|  | ||||
|  | ||||
|   | ||||
| @@ -45,7 +45,7 @@ | ||||
|  | ||||
| using google::LogMessage; | ||||
|  | ||||
| pcps_acquisition_fpga_sptr pcps_make_acquisition(pcpsconf_fpga_t conf_) | ||||
| pcps_acquisition_fpga_sptr pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_) | ||||
| { | ||||
|     return pcps_acquisition_fpga_sptr(new pcps_acquisition_fpga(conf_)); | ||||
| } | ||||
|   | ||||
| @@ -81,7 +81,7 @@ class pcps_acquisition_fpga; | ||||
| typedef boost::shared_ptr<pcps_acquisition_fpga> pcps_acquisition_fpga_sptr; | ||||
|  | ||||
| pcps_acquisition_fpga_sptr | ||||
| pcps_make_acquisition(pcpsconf_fpga_t conf_); | ||||
| pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_); | ||||
|  | ||||
| /*! | ||||
|  * \brief This class implements a Parallel Code Phase Search Acquisition that uses the FPGA. | ||||
| @@ -94,7 +94,7 @@ class pcps_acquisition_fpga : public gr::block | ||||
| private: | ||||
|     friend pcps_acquisition_fpga_sptr | ||||
|  | ||||
|     pcps_make_acquisition(pcpsconf_fpga_t conf_); | ||||
|     pcps_make_acquisition_fpga(pcpsconf_fpga_t conf_); | ||||
|  | ||||
|     pcps_acquisition_fpga(pcpsconf_fpga_t conf_); | ||||
|  | ||||
|   | ||||
| @@ -1,8 +1,9 @@ | ||||
| /*! | ||||
|  * \file gps_l1_ca_dll_pll_tracking.cc | ||||
|  * \brief Implementation of an adapter of a DLL+PLL tracking loop block | ||||
|  * for GPS L1 C/A to a TrackingInterface | ||||
|  * \author Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com | ||||
|  * for GPS L1 C/A to a TrackingInterface that uses the FPGA | ||||
|  * \author Marc Majoral, 2018, mmajoral(at)cttc.es | ||||
|  *         Carlos Aviles, 2010. carlos.avilesr(at)googlemail.com | ||||
|  *         Javier Arribas, 2011. jarribas(at)cttc.es | ||||
|  * | ||||
|  * Code DLL + carrier PLL according to the algorithms described in: | ||||
| @@ -36,11 +37,19 @@ | ||||
|  */ | ||||
|  | ||||
|  | ||||
| #include "gps_l1_ca_dll_pll_tracking_fpga.h" | ||||
| #include <glog/logging.h> | ||||
| #include "GPS_L1_CA.h" | ||||
| #include "configuration_interface.h" | ||||
|  | ||||
| //#include <volk_gnsssdr/volk_gnsssdr.h> | ||||
|  | ||||
| #include <glog/logging.h> | ||||
| #include "gps_sdr_signal_processing.h" | ||||
| #include "gps_l1_ca_dll_pll_tracking_fpga.h" | ||||
| #include "configuration_interface.h" | ||||
| #include "GPS_L1_CA.h" | ||||
| #include "gnss_sdr_flags.h" | ||||
| #include "display.h" | ||||
|  | ||||
|  | ||||
| #define NUM_PRNs 32 | ||||
|  | ||||
| using google::LogMessage; | ||||
|  | ||||
| @@ -49,59 +58,88 @@ GpsL1CaDllPllTrackingFpga::GpsL1CaDllPllTrackingFpga( | ||||
|         unsigned int in_streams, unsigned int out_streams) : | ||||
|                 role_(role), in_streams_(in_streams), out_streams_(out_streams) | ||||
| { | ||||
|     dllpllconf_fpga_t trk_param_fpga; | ||||
|     DLOG(INFO) << "role " << role; | ||||
|     //################# CONFIGURATION PARAMETERS ######################## | ||||
|     int fs_in; | ||||
|     int vector_length; | ||||
|     int f_if; | ||||
|     bool dump; | ||||
|     std::string dump_filename; | ||||
|     std::string item_type; | ||||
|     //std::string default_item_type = "gr_complex"; | ||||
|     std::string default_item_type = "cshort"; | ||||
|     float pll_bw_hz; | ||||
|     float dll_bw_hz; | ||||
|     float early_late_space_chips; | ||||
|     item_type = configuration->property(role + ".item_type", default_item_type); | ||||
|     int fs_in_deprecated = configuration->property("GNSS-SDR.internal_fs_hz", 2048000); | ||||
|     std::string device_name; | ||||
|     unsigned int device_base;     | ||||
|     std::string default_device_name = "/dev/uio"; | ||||
|     device_name = configuration->property(role + ".devicename", default_device_name); | ||||
|     device_base = configuration->property(role + ".device_base", 1); | ||||
|     fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); | ||||
|     f_if = configuration->property(role + ".if", 0); | ||||
|     dump = configuration->property(role + ".dump", false); | ||||
|     pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0); | ||||
|     dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0); | ||||
|     early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5); | ||||
|     int fs_in = configuration->property("GNSS-SDR.internal_fs_sps", fs_in_deprecated); | ||||
|     trk_param_fpga.fs_in = fs_in; | ||||
|     bool dump = configuration->property(role + ".dump", false); | ||||
|     trk_param_fpga.dump = dump; | ||||
|     float pll_bw_hz = configuration->property(role + ".pll_bw_hz", 50.0); | ||||
|     if (FLAGS_pll_bw_hz != 0.0) pll_bw_hz = static_cast<float>(FLAGS_pll_bw_hz); | ||||
|     trk_param_fpga.pll_bw_hz = pll_bw_hz; | ||||
|     float pll_bw_narrow_hz = configuration->property(role + ".pll_bw_narrow_hz", 20.0); | ||||
|     trk_param_fpga.pll_bw_narrow_hz = pll_bw_narrow_hz; | ||||
|     float dll_bw_narrow_hz = configuration->property(role + ".dll_bw_narrow_hz", 2.0); | ||||
|     trk_param_fpga.dll_bw_narrow_hz = dll_bw_narrow_hz; | ||||
|     float dll_bw_hz = configuration->property(role + ".dll_bw_hz", 2.0); | ||||
|     if (FLAGS_dll_bw_hz != 0.0) dll_bw_hz = static_cast<float>(FLAGS_dll_bw_hz); | ||||
|     trk_param_fpga.dll_bw_hz = dll_bw_hz; | ||||
|     float early_late_space_chips = configuration->property(role + ".early_late_space_chips", 0.5); | ||||
|     trk_param_fpga.early_late_space_chips = early_late_space_chips; | ||||
|     float early_late_space_narrow_chips = configuration->property(role + ".early_late_space_narrow_chips", 0.5); | ||||
|     trk_param_fpga.early_late_space_narrow_chips = early_late_space_narrow_chips; | ||||
|     std::string default_dump_filename = "./track_ch"; | ||||
|     dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); //unused! | ||||
|     vector_length = std::round(fs_in / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)); | ||||
|     if (item_type.compare("cshort") == 0) | ||||
|     std::string dump_filename = configuration->property(role + ".dump_filename", default_dump_filename); | ||||
|     trk_param_fpga.dump_filename = dump_filename; | ||||
|     int vector_length = std::round(fs_in / (GPS_L1_CA_CODE_RATE_HZ / GPS_L1_CA_CODE_LENGTH_CHIPS)); | ||||
|     trk_param_fpga.vector_length = vector_length; | ||||
|     int symbols_extended_correlator = configuration->property(role + ".extend_correlation_symbols", 1); | ||||
|     if (symbols_extended_correlator < 1) | ||||
|         { | ||||
|             item_size_ = sizeof(lv_16sc_t); | ||||
|             tracking_fpga_sc = gps_l1_ca_dll_pll_make_tracking_fpga_sc( | ||||
|                     f_if, fs_in, vector_length, dump, dump_filename, pll_bw_hz, | ||||
|                     dll_bw_hz, early_late_space_chips, device_name, | ||||
|                     device_base); | ||||
|             DLOG(INFO) << "tracking(" << tracking_fpga_sc->unique_id() | ||||
|                     << ")"; | ||||
|             symbols_extended_correlator = 1; | ||||
|             std::cout << TEXT_RED << "WARNING: GPS L1 C/A. extend_correlation_symbols must be bigger than 1. Coherent integration has been set to 1 symbol (1 ms)" << TEXT_RESET << std::endl; | ||||
|         } | ||||
|     else | ||||
|     else if (symbols_extended_correlator > 20) | ||||
|         { | ||||
|             symbols_extended_correlator = 20; | ||||
|             std::cout << TEXT_RED << "WARNING: GPS L1 C/A. extend_correlation_symbols must be lower than 21. Coherent integration has been set to 20 symbols (20 ms)" << TEXT_RESET << std::endl; | ||||
|         } | ||||
|     trk_param_fpga.extend_correlation_symbols = symbols_extended_correlator; | ||||
|     bool track_pilot = configuration->property(role + ".track_pilot", false); | ||||
|     if (track_pilot) | ||||
|         { | ||||
|             std::cout << TEXT_RED << "WARNING: GPS L1 C/A does not have pilot signal. Data tracking has been enabled" << TEXT_RESET << std::endl; | ||||
|         } | ||||
|     if ((symbols_extended_correlator > 1) and (pll_bw_narrow_hz > pll_bw_hz or dll_bw_narrow_hz > dll_bw_hz)) | ||||
|         { | ||||
|             std::cout << TEXT_RED << "WARNING: GPS L1 C/A. PLL or DLL narrow tracking bandwidth is higher than wide tracking one" << TEXT_RESET << std::endl; | ||||
|         } | ||||
|     trk_param_fpga.very_early_late_space_chips = 0.0; | ||||
|     trk_param_fpga.very_early_late_space_narrow_chips = 0.0; | ||||
|     trk_param_fpga.track_pilot = false; | ||||
|     trk_param_fpga.system = 'G'; | ||||
|     char sig_[3] = "1C"; | ||||
|     std::memcpy(trk_param_fpga.signal, sig_, 3); | ||||
|  | ||||
|             item_size_ = sizeof(lv_16sc_t); | ||||
|             //  LOG(WARNING) << item_type_ << " unknown tracking item type"; | ||||
|             LOG(WARNING) << item_type | ||||
|                     << " the tracking item type for the FPGA tracking test has to be cshort"; | ||||
|         } | ||||
|     // FPGA configuration parameters | ||||
|     std::string default_device_name = "/dev/uio"; | ||||
|     std::string device_name = configuration->property(role + ".devicename", default_device_name); | ||||
|     trk_param_fpga.device_name = device_name; | ||||
|     unsigned int device_base = configuration->property(role + ".device_base", 1); | ||||
|     trk_param_fpga.device_base = device_base; | ||||
|  | ||||
|     //################# PRE-COMPUTE ALL THE CODES ################# | ||||
|     d_ca_codes = static_cast<int*>(volk_gnsssdr_malloc(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS*NUM_PRNs) * sizeof(int), volk_gnsssdr_get_alignment())); | ||||
|     for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++) | ||||
|     { | ||||
|         gps_l1_ca_code_gen_int(&d_ca_codes[(int(GPS_L1_CA_CODE_LENGTH_CHIPS)) * (PRN - 1)], PRN, 0); | ||||
|     } | ||||
|     trk_param_fpga.ca_codes = d_ca_codes; | ||||
|     trk_param_fpga.code_length = GPS_L1_CA_CODE_LENGTH_CHIPS; | ||||
|  | ||||
|     //################# MAKE TRACKING GNURadio object ################### | ||||
|     tracking_fpga_sc = dll_pll_veml_make_tracking_fpga(trk_param_fpga); | ||||
|     channel_ = 0; | ||||
|     DLOG(INFO) << "tracking(" << tracking_fpga_sc->unique_id() << ")"; | ||||
|  | ||||
| } | ||||
|  | ||||
| GpsL1CaDllPllTrackingFpga::~GpsL1CaDllPllTrackingFpga() | ||||
| {} | ||||
| { | ||||
|     delete[] d_ca_codes; | ||||
| } | ||||
|  | ||||
| void GpsL1CaDllPllTrackingFpga::start_tracking() | ||||
| { | ||||
| @@ -125,14 +163,14 @@ void GpsL1CaDllPllTrackingFpga::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) | ||||
| void GpsL1CaDllPllTrackingFpga::connect(gr::top_block_sptr top_block) | ||||
| { | ||||
|     if(top_block) { /* top_block is not null */}; | ||||
|     //nothing to connect, now the tracking uses gr_sync_decimator | ||||
|     //nothing to connect | ||||
| } | ||||
|  | ||||
|  | ||||
| void GpsL1CaDllPllTrackingFpga::disconnect(gr::top_block_sptr top_block) | ||||
| { | ||||
|     if(top_block) { /* top_block is not null */}; | ||||
|     //nothing to disconnect, now the tracking uses gr_sync_decimator | ||||
|     //nothing to disconnect | ||||
| } | ||||
|  | ||||
|  | ||||
| @@ -148,8 +186,3 @@ gr::basic_block_sptr GpsL1CaDllPllTrackingFpga::get_right_block() | ||||
| } | ||||
|  | ||||
|  | ||||
| void GpsL1CaDllPllTrackingFpga::reset(void) | ||||
| { | ||||
|   //  tracking_fpga_sc->reset(); | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -40,7 +40,7 @@ | ||||
|  | ||||
| #include <string> | ||||
| #include "tracking_interface.h" | ||||
| #include "gps_l1_ca_dll_pll_tracking_fpga_sc.h" | ||||
| #include "dll_pll_veml_tracking_fpga.h" | ||||
|  | ||||
|  | ||||
| class ConfigurationInterface; | ||||
| @@ -92,16 +92,17 @@ public: | ||||
|  | ||||
|     void start_tracking() override; | ||||
|  | ||||
| 	void reset(void); | ||||
| 	//void reset(void); | ||||
| 	 | ||||
| private: | ||||
|     //gps_l1_ca_dll_pll_tracking_cc_sptr tracking_; | ||||
|     gps_l1_ca_dll_pll_tracking_fpga_sc_sptr tracking_fpga_sc; | ||||
| 	//gps_l1_ca_dll_pll_tracking_cc_sptr tracking_; | ||||
| 	dll_pll_veml_tracking_fpga_sptr tracking_fpga_sc; | ||||
|     size_t item_size_; | ||||
|     unsigned int channel_; | ||||
|     std::string role_; | ||||
|     unsigned int in_streams_; | ||||
|     unsigned int out_streams_; | ||||
|     int* d_ca_codes; | ||||
| }; | ||||
|  | ||||
| #endif // GNSS_SDR_GPS_L1_CA_DLL_PLL_TRACKING_FPGA_H_ | ||||
|   | ||||
| @@ -23,7 +23,7 @@ if(ENABLE_CUDA) | ||||
| endif(ENABLE_CUDA) | ||||
|  | ||||
| if(ENABLE_FPGA) | ||||
|      set(OPT_TRACKING_BLOCKS ${OPT_TRACKING_BLOCKS} gps_l1_ca_dll_pll_tracking_fpga_sc.cc) | ||||
|      set(OPT_TRACKING_BLOCKS ${OPT_TRACKING_BLOCKS} dll_pll_veml_tracking_fpga.cc) | ||||
| endif(ENABLE_FPGA) | ||||
|  | ||||
| set(TRACKING_GR_BLOCKS_SOURCES | ||||
|   | ||||
| @@ -34,7 +34,7 @@ | ||||
|  * ------------------------------------------------------------------------- | ||||
|  */ | ||||
| 
 | ||||
| #include "gps_l1_ca_dll_pll_tracking_fpga_sc.h" | ||||
| #include "dll_pll_veml_tracking_fpga.h" | ||||
| #include <cmath> | ||||
| #include <iostream> | ||||
| #include <memory> | ||||
| @@ -61,43 +61,96 @@ | ||||
| 
 | ||||
| using google::LogMessage; | ||||
| 
 | ||||
| gps_l1_ca_dll_pll_tracking_fpga_sc_sptr | ||||
| gps_l1_ca_dll_pll_make_tracking_fpga_sc( | ||||
|         long if_freq, | ||||
|         long fs_in, | ||||
|         unsigned int vector_length, | ||||
|         bool dump, | ||||
|         std::string dump_filename, | ||||
|         float pll_bw_hz, | ||||
|         float dll_bw_hz, | ||||
|         float early_late_space_chips, | ||||
|         std::string device_name,  | ||||
|         unsigned int device_base) | ||||
| //dll_pll_veml_tracking_fpga_sptr
 | ||||
| //dll_pll_veml_make_tracking_fpga(
 | ||||
| //        long if_freq,
 | ||||
| //        long fs_in,
 | ||||
| //        unsigned int vector_length,
 | ||||
| //        bool dump,
 | ||||
| //        std::string dump_filename,
 | ||||
| //        float pll_bw_hz,
 | ||||
| //        float dll_bw_hz,
 | ||||
| //        float early_late_space_chips,
 | ||||
| //        std::string device_name,
 | ||||
| //        unsigned int device_base,
 | ||||
| //        int* ca_codes,
 | ||||
| //        unsigned int code_length)
 | ||||
| //{
 | ||||
| //    return dll_pll_veml_tracking_fpga_sptr(new dll_pll_veml_tracking_fpga(if_freq,
 | ||||
| //            fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips, device_name, device_base, ca_codes, code_length));
 | ||||
| //
 | ||||
| ////    return dll_pll_veml_tracking_fpga_sptr(new dll_pll_veml_tracking_fpga(conf_));
 | ||||
| //}
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| dll_pll_veml_tracking_fpga_sptr dll_pll_veml_make_tracking_fpga(dllpllconf_fpga_t conf_) | ||||
| { | ||||
|     return gps_l1_ca_dll_pll_tracking_fpga_sc_sptr(new Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc(if_freq, | ||||
|             fs_in, vector_length, dump, dump_filename, pll_bw_hz, dll_bw_hz, early_late_space_chips, device_name, device_base)); | ||||
| 
 | ||||
|     return dll_pll_veml_tracking_fpga_sptr(new dll_pll_veml_tracking_fpga(conf_)); | ||||
|     //return dll_pll_veml_tracking_fpga_sptr(new dll_pll_veml_tracking_fpga(//0, //conf_.f_if, // if_freq is removed ... why ????????????
 | ||||
|     //        conf_.fs_in, conf_.vector_length, conf_.dump, conf_.dump_filename, conf_.pll_bw_hz, conf_.dll_bw_hz,
 | ||||
|     //        conf_.early_late_space_chips, conf_.device_name, conf_.device_base, conf_.ca_codes, conf_.code_length));
 | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc::Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc( | ||||
|         long if_freq, | ||||
|         long fs_in, | ||||
|         unsigned int vector_length, | ||||
|         bool dump, | ||||
|         std::string dump_filename, | ||||
|         float pll_bw_hz, | ||||
|         float dll_bw_hz, | ||||
|         float early_late_space_chips, | ||||
|         std::string device_name,  | ||||
|         unsigned int device_base) : | ||||
|                 gr::block("Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc", gr::io_signature::make(0, 0, sizeof(lv_16sc_t)), | ||||
|                         gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) | ||||
| 
 | ||||
| 
 | ||||
| //dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(
 | ||||
| //        //long if_freq,
 | ||||
| //        long fs_in,
 | ||||
| //        unsigned int vector_length,
 | ||||
| //        bool dump,
 | ||||
| //        std::string dump_filename,
 | ||||
| //        float pll_bw_hz,
 | ||||
| //        float dll_bw_hz,
 | ||||
| //        float early_late_space_chips,
 | ||||
| //        std::string device_name,
 | ||||
| //        unsigned int device_base,
 | ||||
| //        int* ca_codes,
 | ||||
| //        unsigned int code_length) :
 | ||||
| //                gr::block("dll_pll_veml_tracking_fpga", gr::io_signature::make(0, 0, sizeof(lv_16sc_t)),
 | ||||
| //                        gr::io_signature::make(1, 1, sizeof(Gnss_Synchro)))
 | ||||
| //{
 | ||||
| 
 | ||||
| dll_pll_veml_tracking_fpga::dll_pll_veml_tracking_fpga(dllpllconf_fpga_t conf_) : | ||||
|                 gr::block("dll_pll_veml_tracking_fpga", gr::io_signature::make(0, 0, sizeof(lv_16sc_t)), | ||||
|                 gr::io_signature::make(1, 1, sizeof(Gnss_Synchro))) | ||||
| { | ||||
| 
 | ||||
|     trk_parameters = conf_; | ||||
| 
 | ||||
|     // Telemetry bit synchronization message port input
 | ||||
|     this->message_port_register_out(pmt::mp("events")); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     long fs_in = trk_parameters.fs_in; | ||||
|     unsigned int vector_length = trk_parameters.vector_length; | ||||
|     bool dump = trk_parameters.dump; | ||||
|     std::string dump_filename = trk_parameters.dump_filename; | ||||
|     float pll_bw_hz = trk_parameters.pll_bw_hz; | ||||
|     float dll_bw_hz = trk_parameters.dll_bw_hz; | ||||
|     float early_late_space_chips = trk_parameters.early_late_space_chips; | ||||
|     std::string device_name = trk_parameters.device_name; | ||||
|     unsigned int device_base = trk_parameters.device_base; | ||||
|     int* ca_codes = trk_parameters.ca_codes; | ||||
|     unsigned int code_length = trk_parameters.code_length; | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     // initialize internal vars
 | ||||
|     d_dump = dump; | ||||
|     d_if_freq = if_freq; | ||||
|     //d_if_freq = if_freq;
 | ||||
|     d_fs_in = fs_in; | ||||
|     d_vector_length = vector_length; | ||||
|     d_dump_filename = dump_filename; | ||||
| @@ -132,7 +185,7 @@ Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc::Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc( | ||||
|     d_local_code_shift_chips[2] = d_early_late_spc_chips; | ||||
| 
 | ||||
|     // create multicorrelator class
 | ||||
|     multicorrelator_fpga_8sc = std::make_shared <fpga_multicorrelator_8sc>(d_n_correlator_taps, device_name, device_base); | ||||
|     multicorrelator_fpga_8sc = std::make_shared <fpga_multicorrelator_8sc>(d_n_correlator_taps, device_name, device_base, ca_codes, code_length); | ||||
| 
 | ||||
|     //--- Perform initializations ------------------------------
 | ||||
|     // define initial code frequency basis of NCO
 | ||||
| @@ -174,9 +227,10 @@ Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc::Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc( | ||||
|     set_relative_rate(1.0 / static_cast<double>(d_vector_length)); | ||||
| 
 | ||||
|     multicorrelator_fpga_8sc->set_output_vectors(d_correlator_outs); | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| void Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc::start_tracking() | ||||
| void dll_pll_veml_tracking_fpga::start_tracking() | ||||
| { | ||||
|     /*
 | ||||
|      *  correct the code phase according to the delay between acq and trk | ||||
| @@ -252,7 +306,7 @@ void Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc::start_tracking() | ||||
|             << " PULL-IN Code Phase [samples]=" << d_acq_code_phase_samples; | ||||
| } | ||||
| 
 | ||||
| Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc::~Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc() | ||||
| dll_pll_veml_tracking_fpga::~dll_pll_veml_tracking_fpga() | ||||
| { | ||||
|     if (d_dump_file.is_open()) | ||||
|         { | ||||
| @@ -278,7 +332,7 @@ Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc::~Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc() | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| int Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), | ||||
| int dll_pll_veml_tracking_fpga::general_work (int noutput_items __attribute__((unused)), gr_vector_int &ninput_items __attribute__((unused)), | ||||
|         gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) | ||||
| { | ||||
| 	 | ||||
| @@ -513,7 +567,7 @@ int Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc::general_work (int noutput_items __attrib | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| void Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc::set_channel(unsigned int channel) | ||||
| void dll_pll_veml_tracking_fpga::set_channel(unsigned int channel) | ||||
| { | ||||
|     d_channel = channel; | ||||
|     multicorrelator_fpga_8sc->set_channel(d_channel); | ||||
| @@ -541,12 +595,12 @@ void Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc::set_channel(unsigned int channel) | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| void Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) | ||||
| void dll_pll_veml_tracking_fpga::set_gnss_synchro(Gnss_Synchro* p_gnss_synchro) | ||||
| { | ||||
|     d_acquisition_gnss_synchro = p_gnss_synchro; | ||||
| } | ||||
| 
 | ||||
| void Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc::reset(void) | ||||
| void dll_pll_veml_tracking_fpga::reset(void) | ||||
| { | ||||
|     multicorrelator_fpga_8sc->unlock_channel(); | ||||
| } | ||||
| @@ -35,8 +35,8 @@ | ||||
|  * ------------------------------------------------------------------------- | ||||
|  */ | ||||
| 
 | ||||
| #ifndef GNSS_SDR_GPS_L1_CA_DLL_PLL_TRACKING_FPGA_SC_H | ||||
| #define GNSS_SDR_GPS_L1_CA_DLL_PLL_TRACKING_FPGA_SC_H | ||||
| #ifndef GNSS_SDR_DLL_PLL_VEML_TRACKING_FPGA_H | ||||
| #define GNSS_SDR_DLL_PLL_VEML_TRACKING_FPGA_H | ||||
| 
 | ||||
| #include <fstream> | ||||
| #include <map> | ||||
| @@ -45,34 +45,63 @@ | ||||
| #include "gnss_synchro.h" | ||||
| #include "tracking_2nd_DLL_filter.h" | ||||
| #include "tracking_2nd_PLL_filter.h" | ||||
| #include "fpga_multicorrelator_8sc.h" | ||||
| #include "fpga_multicorrelator.h" | ||||
| 
 | ||||
| class Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc; | ||||
| typedef struct | ||||
| { | ||||
|     /* DLL/PLL tracking configuration */ | ||||
|     double fs_in; | ||||
|     unsigned int vector_length; | ||||
|     bool dump; | ||||
|     std::string dump_filename; | ||||
|     float pll_bw_hz; | ||||
|     float dll_bw_hz; | ||||
|     float pll_bw_narrow_hz; | ||||
|     float dll_bw_narrow_hz; | ||||
|     float early_late_space_chips; | ||||
|     float very_early_late_space_chips; | ||||
|     float early_late_space_narrow_chips; | ||||
|     float very_early_late_space_narrow_chips; | ||||
|     int extend_correlation_symbols; | ||||
|     bool track_pilot; | ||||
|     char system; | ||||
|     char signal[3]; | ||||
|     std::string device_name; | ||||
|     unsigned int device_base; | ||||
|     unsigned int code_length; | ||||
|     int* ca_codes; | ||||
|     //int f_if;
 | ||||
| } dllpllconf_fpga_t; | ||||
| 
 | ||||
| typedef boost::shared_ptr<Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc> | ||||
|         gps_l1_ca_dll_pll_tracking_fpga_sc_sptr; | ||||
| class dll_pll_veml_tracking_fpga; | ||||
| 
 | ||||
| gps_l1_ca_dll_pll_tracking_fpga_sc_sptr | ||||
| gps_l1_ca_dll_pll_make_tracking_fpga_sc(long if_freq, | ||||
|                                    long fs_in, unsigned | ||||
|                                    int vector_length, | ||||
|                                    bool dump, | ||||
|                                    std::string dump_filename, | ||||
|                                    float pll_bw_hz, | ||||
|                                    float dll_bw_hz, | ||||
|                                    float early_late_space_chips, | ||||
|                                    std::string device_name,  | ||||
|                                    unsigned int device_base); | ||||
| typedef boost::shared_ptr<dll_pll_veml_tracking_fpga> | ||||
| dll_pll_veml_tracking_fpga_sptr; | ||||
| 
 | ||||
| //dll_pll_veml_tracking_fpga_sptr
 | ||||
| //dll_pll_veml_make_tracking_fpga(long if_freq,
 | ||||
| //                                   long fs_in, unsigned
 | ||||
| //                                   int vector_length,
 | ||||
| //                                   bool dump,
 | ||||
| //                                   std::string dump_filename,
 | ||||
| //                                   float pll_bw_hz,
 | ||||
| //                                   float dll_bw_hz,
 | ||||
| //                                   float early_late_space_chips,
 | ||||
| //                                   std::string device_name,
 | ||||
| //                                   unsigned int device_base,
 | ||||
| //                                   int* ca_codes,
 | ||||
| //                                   unsigned int code_length);
 | ||||
| 
 | ||||
| dll_pll_veml_tracking_fpga_sptr dll_pll_veml_make_tracking_fpga(dllpllconf_fpga_t conf_); | ||||
| 
 | ||||
| 
 | ||||
| /*!
 | ||||
|  * \brief This class implements a DLL + PLL tracking loop block | ||||
|  */ | ||||
| class Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc: public gr::block | ||||
| class dll_pll_veml_tracking_fpga: public gr::block | ||||
| { | ||||
| public: | ||||
|     ~Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc(); | ||||
|     ~dll_pll_veml_tracking_fpga(); | ||||
| 
 | ||||
|     void set_channel(unsigned int channel); | ||||
|     void set_gnss_synchro(Gnss_Synchro* p_gnss_synchro); | ||||
| @@ -84,28 +113,37 @@ public: | ||||
|     void reset(void); | ||||
| 
 | ||||
| private: | ||||
|     friend gps_l1_ca_dll_pll_tracking_fpga_sc_sptr | ||||
|     gps_l1_ca_dll_pll_make_tracking_fpga_sc(long if_freq, | ||||
|             long fs_in, unsigned | ||||
|             int vector_length, | ||||
|             bool dump, | ||||
|             std::string dump_filename, | ||||
|             float pll_bw_hz, | ||||
|             float dll_bw_hz, | ||||
|             float early_late_space_chips, | ||||
|             std::string device_name, | ||||
|             unsigned int device_base); | ||||
| //    friend dll_pll_veml_tracking_fpga_sptr
 | ||||
| //    dll_pll_veml_make_tracking_fpga(long if_freq,
 | ||||
| //            long fs_in, unsigned
 | ||||
| //            int vector_length,
 | ||||
| //            bool dump,
 | ||||
| //            std::string dump_filename,
 | ||||
| //            float pll_bw_hz,
 | ||||
| //            float dll_bw_hz,
 | ||||
| //            float early_late_space_chips,
 | ||||
| //            std::string device_name,
 | ||||
| //            unsigned int device_base,
 | ||||
| //            int* ca_codes,
 | ||||
| //            unsigned int code_length);
 | ||||
|     friend dll_pll_veml_tracking_fpga_sptr dll_pll_veml_make_tracking_fpga(dllpllconf_fpga_t conf_); | ||||
| 
 | ||||
|     Gps_L1_Ca_Dll_Pll_Tracking_fpga_sc(long if_freq, | ||||
|             long fs_in, unsigned | ||||
|             int vector_length, | ||||
|             bool dump, | ||||
|             std::string dump_filename, | ||||
|             float pll_bw_hz, | ||||
|             float dll_bw_hz, | ||||
|             float early_late_space_chips, | ||||
|             std::string device_name, | ||||
|             unsigned int device_base); | ||||
|     dll_pll_veml_tracking_fpga(dllpllconf_fpga_t conf_); | ||||
| //    dll_pll_veml_tracking_fpga(//long if_freq,
 | ||||
| //            long fs_in, unsigned
 | ||||
| //            int vector_length,
 | ||||
| //            bool dump,
 | ||||
| //            std::string dump_filename,
 | ||||
| //            float pll_bw_hz,
 | ||||
| //            float dll_bw_hz,
 | ||||
| //            float early_late_space_chips,
 | ||||
| //            std::string device_name,
 | ||||
| //            unsigned int device_base,
 | ||||
| //            int* ca_codes,
 | ||||
| //            unsigned int code_length);
 | ||||
| 
 | ||||
| 
 | ||||
|     dllpllconf_fpga_t trk_parameters; | ||||
| 
 | ||||
|     // tracking configuration vars
 | ||||
|     unsigned int d_vector_length; | ||||
| @@ -114,7 +152,7 @@ private: | ||||
|     Gnss_Synchro* d_acquisition_gnss_synchro; | ||||
|     unsigned int d_channel; | ||||
| 
 | ||||
|     long d_if_freq; | ||||
|     //long d_if_freq;
 | ||||
|     long d_fs_in; | ||||
| 
 | ||||
|     double d_early_late_spc_chips; | ||||
| @@ -184,4 +222,4 @@ private: | ||||
|      | ||||
| }; | ||||
| 
 | ||||
| #endif //GNSS_SDR_GPS_L1_CA_DLL_PLL_TRACKING_FPGA_SC_H
 | ||||
| #endif //GNSS_SDR_DLL_PLL_VEML_TRACKING_FPGA_H
 | ||||
| @@ -46,7 +46,7 @@ set(TRACKING_LIB_SOURCES | ||||
| ) | ||||
|  | ||||
| if(ENABLE_FPGA) | ||||
|     SET(TRACKING_LIB_SOURCES ${TRACKING_LIB_SOURCES} fpga_multicorrelator_8sc.cc) | ||||
|     SET(TRACKING_LIB_SOURCES ${TRACKING_LIB_SOURCES} fpga_multicorrelator.cc) | ||||
| endif(ENABLE_FPGA) | ||||
|  | ||||
| include_directories( | ||||
|   | ||||
| @@ -34,7 +34,7 @@ | ||||
|  * ------------------------------------------------------------------------- | ||||
|  */ | ||||
| 
 | ||||
| #include "fpga_multicorrelator_8sc.h" | ||||
| #include "fpga_multicorrelator.h" | ||||
| 
 | ||||
| #include <cmath> | ||||
| 
 | ||||
| @@ -65,9 +65,9 @@ | ||||
| #include <string> | ||||
| 
 | ||||
| // constants
 | ||||
| #include "GPS_L1_CA.h"  | ||||
| #include "GPS_L1_CA.h" | ||||
| 
 | ||||
| #include "gps_sdr_signal_processing.h" | ||||
| //#include "gps_sdr_signal_processing.h"
 | ||||
| 
 | ||||
| #define NUM_PRNs 32 | ||||
| #define PAGE_SIZE 0x10000 | ||||
| @@ -144,7 +144,7 @@ void fpga_multicorrelator_8sc::Carrier_wipeoff_multicorrelator_resampler( | ||||
| } | ||||
| 
 | ||||
| fpga_multicorrelator_8sc::fpga_multicorrelator_8sc(int n_correlators, | ||||
|         std::string device_name, unsigned int device_base) | ||||
|         std::string device_name, unsigned int device_base, int *ca_codes, unsigned int code_length) | ||||
| { | ||||
|     d_n_correlators = n_correlators; | ||||
|     d_device_name = device_name; | ||||
| @@ -170,14 +170,16 @@ fpga_multicorrelator_8sc::fpga_multicorrelator_8sc(int n_correlators, | ||||
|     d_phase_step_rad_int = 0; | ||||
|     d_initial_sample_counter = 0; | ||||
|     d_channel = 0; | ||||
|     d_correlator_length_samples = 0; | ||||
|     d_correlator_length_samples = 0, | ||||
|     d_code_length = code_length; | ||||
|      | ||||
|     // pre-compute all the codes
 | ||||
|     d_ca_codes = static_cast<int*>(volk_gnsssdr_malloc(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS*NUM_PRNs) * sizeof(int), volk_gnsssdr_get_alignment())); | ||||
|     for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++) | ||||
|     { | ||||
| 		gps_l1_ca_code_gen_int(&d_ca_codes[(int(GPS_L1_CA_CODE_LENGTH_CHIPS)) * (PRN - 1)], PRN, 0); | ||||
|     } | ||||
| //    d_ca_codes = static_cast<int*>(volk_gnsssdr_malloc(static_cast<int>(GPS_L1_CA_CODE_LENGTH_CHIPS*NUM_PRNs) * sizeof(int), volk_gnsssdr_get_alignment()));
 | ||||
| //    for (unsigned int PRN = 1; PRN <= NUM_PRNs; PRN++)
 | ||||
| //    {
 | ||||
| //		gps_l1_ca_code_gen_int(&d_ca_codes[(int(GPS_L1_CA_CODE_LENGTH_CHIPS)) * (PRN - 1)], PRN, 0);
 | ||||
| //    }
 | ||||
|     d_ca_codes = ca_codes; | ||||
|     DLOG(INFO) << "TRACKING FPGA CLASS CREATED"; | ||||
|      | ||||
| } | ||||
| @@ -278,7 +280,7 @@ void fpga_multicorrelator_8sc::fpga_configure_tracking_gps_local_code(int PRN) | ||||
|             for (k = 0; k < d_code_length_chips; k++) | ||||
|                 { | ||||
|                     //if (d_local_code_in[k] == 1)
 | ||||
|                     if (d_ca_codes[((int(GPS_L1_CA_CODE_LENGTH_CHIPS)) * (PRN - 1)) + k] == 1) | ||||
|                     if (d_ca_codes[((int(d_code_length)) * (PRN - 1)) + k] == 1) | ||||
|                         { | ||||
|                             code_chip = 1; | ||||
|                         } | ||||
| @@ -49,7 +49,7 @@ class fpga_multicorrelator_8sc | ||||
| { | ||||
| public: | ||||
|     fpga_multicorrelator_8sc(int n_correlators, std::string device_name, | ||||
|             unsigned int device_base); | ||||
|             unsigned int device_base, int *ca_codes, unsigned int code_length); | ||||
|     ~fpga_multicorrelator_8sc(); | ||||
| 	//bool set_output_vectors(gr_complex* corr_out);
 | ||||
| 	void set_output_vectors(gr_complex* corr_out); | ||||
| @@ -110,6 +110,8 @@ private: | ||||
| 
 | ||||
|     int* d_ca_codes; | ||||
| 
 | ||||
|     unsigned int d_code_length; // nominal number of chips
 | ||||
| 
 | ||||
|     // private functions
 | ||||
|     unsigned fpga_acquisition_test_register(unsigned writeval); | ||||
|     void fpga_configure_tracking_gps_local_code(int PRN); | ||||
| @@ -534,7 +534,7 @@ TEST_F(GpsL1CADllPllTrackingTestFpga, ValidationOfResultsFpga) | ||||
|                 { | ||||
|                     start = std::chrono::system_clock::now(); | ||||
|                     top_block->run(); // Start threads and wait | ||||
|                     tracking->reset();// unlock the channel | ||||
|                     //tracking->reset();// unlock the channel | ||||
|                     end = std::chrono::system_clock::now(); | ||||
|                     elapsed_seconds = end - start; | ||||
|                 }) << "Failure running the top_block."; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 mmajoral
					mmajoral